1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

feat: adds on hover popup on the side menu

This commit is contained in:
Amir Raminfar
2023-04-27 11:07:08 -07:00
parent e96ab50486
commit e6efe6ff59
7 changed files with 46 additions and 24 deletions

View File

@@ -12,12 +12,15 @@ declare module '@vue/runtime-core' {
'Carbon:caretDown': typeof import('~icons/carbon/caret-down')['default'] 'Carbon:caretDown': typeof import('~icons/carbon/caret-down')['default']
'Cil:checkCircle': typeof import('~icons/cil/check-circle')['default'] 'Cil:checkCircle': typeof import('~icons/cil/check-circle')['default']
'Cil:circle': typeof import('~icons/cil/circle')['default'] 'Cil:circle': typeof import('~icons/cil/circle')['default']
'Cil:clock': typeof import('~icons/cil/clock')['default']
'Cil:columns': typeof import('~icons/cil/columns')['default'] 'Cil:columns': typeof import('~icons/cil/columns')['default']
'Cil:findInPage': typeof import('~icons/cil/find-in-page')['default'] 'Cil:findInPage': typeof import('~icons/cil/find-in-page')['default']
'Cil:xCircle': typeof import('~icons/cil/x-circle')['default'] 'Cil:xCircle': typeof import('~icons/cil/x-circle')['default']
ComplexLogItem: typeof import('./components/LogViewer/ComplexLogItem.vue')['default'] ComplexLogItem: typeof import('./components/LogViewer/ComplexLogItem.vue')['default']
ContainerStat: typeof import('./components/LogViewer/ContainerStat.vue')['default'] ContainerStat: typeof import('./components/LogViewer/ContainerStat.vue')['default']
ContainerTitle: typeof import('./components/LogViewer/ContainerTitle.vue')['default'] ContainerTitle: typeof import('./components/LogViewer/ContainerTitle.vue')['default']
DateTime: typeof import('./components/DateTime.vue')['default']
DistanceTime: typeof import('./components/DistanceTime.vue')['default']
DockerEventLogItem: typeof import('./components/LogViewer/DockerEventLogItem.vue')['default'] DockerEventLogItem: typeof import('./components/LogViewer/DockerEventLogItem.vue')['default']
DropdownMenu: typeof import('./components/DropdownMenu.vue')['default'] DropdownMenu: typeof import('./components/DropdownMenu.vue')['default']
FieldList: typeof import('./components/LogViewer/FieldList.vue')['default'] FieldList: typeof import('./components/LogViewer/FieldList.vue')['default']
@@ -28,6 +31,7 @@ declare module '@vue/runtime-core' {
LogDate: typeof import('./components/LogViewer/LogDate.vue')['default'] LogDate: typeof import('./components/LogViewer/LogDate.vue')['default']
LogEventSource: typeof import('./components/LogViewer/LogEventSource.vue')['default'] LogEventSource: typeof import('./components/LogViewer/LogEventSource.vue')['default']
LogLevel: typeof import('./components/LogViewer/LogLevel.vue')['default'] LogLevel: typeof import('./components/LogViewer/LogLevel.vue')['default']
LogTime: typeof import('./components/LogViewer/LogTime.vue')['default']
LogViewer: typeof import('./components/LogViewer/LogViewer.vue')['default'] LogViewer: typeof import('./components/LogViewer/LogViewer.vue')['default']
LogViewerWithSource: typeof import('./components/LogViewer/LogViewerWithSource.vue')['default'] LogViewerWithSource: typeof import('./components/LogViewer/LogViewerWithSource.vue')['default']
'Mdi:dotsVertical': typeof import('~icons/mdi/dots-vertical')['default'] 'Mdi:dotsVertical': typeof import('~icons/mdi/dots-vertical')['default']

View File

@@ -0,0 +1,27 @@
<template>
<time :datetime="date.toISOString()">{{ text }}</time>
</template>
<script lang="ts" setup>
import formatDistanceToNow from "date-fns/formatDistanceToNow";
import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict";
const {
date,
strict = false,
suffix = true,
} = defineProps<{
date: Date;
strict?: boolean;
suffix?: boolean;
}>();
const text = ref<string>();
function updateFromNow() {
const fn = strict ? formatDistanceToNowStrict : formatDistanceToNow;
text.value = fn(date, {
addSuffix: suffix,
});
}
useIntervalFn(updateFromNow, 30_000, { immediateCallback: true });
</script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<relative-time :date="date" class="date"></relative-time> <date-time :date="date" class="date"></date-time>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
defineProps<{ defineProps<{

View File

@@ -1,19 +0,0 @@
<template>
<time :datetime="date.toISOString()">{{ text }}</time>
</template>
<script lang="ts" setup>
import formatDistance from "date-fns/formatDistance";
const { date } = defineProps<{
date: Date;
}>();
const text = ref<string>();
function updateFromNow() {
text.value = formatDistance(date, new Date(), {
addSuffix: true,
});
}
useIntervalFn(updateFromNow, 30_000, { immediateCallback: true });
</script>

View File

@@ -87,9 +87,19 @@
</div> </div>
</router-link> </router-link>
<template #content> <template #content>
<div class="tooltip"> <div>
This is data <span class="has-text-weight-light"> RUNNING </span>
<button>test</button> <span class="has-text-weight-semibold">
<distance-time :date="item.created" strict :suffix="false"></distance-time>
</span>
</div>
<div>
<span class="has-text-weight-light"> LOAD </span>
<span class="has-text-weight-semibold"> {{ item.getLastStat().snapshot.cpu }}% </span>
</div>
<div>
<span class="has-text-weight-light"> MEM </span>
<span class="has-text-weight-semibold"> {{ item.getLastStat().snapshot.memory }} </span>
</div> </div>
</template> </template>
</popup> </popup>

View File

@@ -65,7 +65,7 @@
<span class="name">{{ item.name }}</span> <span class="name">{{ item.name }}</span>
<div class="subtitle is-7 status"> <div class="subtitle is-7 status">
<past-time :date="item.created"></past-time> <distance-time :date="item.created"></distance-time>
</div> </div>
</router-link> </router-link>
</div> </div>