fix(monitor): clean up unused updatedAt/updatedLabel after label removal
This commit is contained in:
@@ -60,14 +60,11 @@ import { computed } from 'vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import Icon from '@/components/icons/Icon.vue'
|
import Icon from '@/components/icons/Icon.vue'
|
||||||
import AutoRefreshButton from '@/components/common/AutoRefreshButton.vue'
|
import AutoRefreshButton from '@/components/common/AutoRefreshButton.vue'
|
||||||
import { useChannelMonitorFormat } from '@/composables/useChannelMonitorFormat'
|
|
||||||
|
|
||||||
export type MonitorWindow = '7d' | '15d' | '30d'
|
export type MonitorWindow = '7d' | '15d' | '30d'
|
||||||
export type OverallStatus = 'operational' | 'degraded'
|
export type OverallStatus = 'operational' | 'degraded'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
overallStatus: OverallStatus
|
overallStatus: OverallStatus
|
||||||
updatedAt: string | null
|
|
||||||
intervalSeconds: number
|
intervalSeconds: number
|
||||||
window: MonitorWindow
|
window: MonitorWindow
|
||||||
loading: boolean
|
loading: boolean
|
||||||
@@ -87,7 +84,6 @@ const emit = defineEmits<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const { formatRelativeTime } = useChannelMonitorFormat()
|
|
||||||
|
|
||||||
const windowOptions = computed<{ value: MonitorWindow; label: string }[]>(() => [
|
const windowOptions = computed<{ value: MonitorWindow; label: string }[]>(() => [
|
||||||
{ value: '7d', label: t('channelStatus.windowTab.7d') },
|
{ value: '7d', label: t('channelStatus.windowTab.7d') },
|
||||||
@@ -117,8 +113,4 @@ const overallDotClass = computed(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const updatedLabel = computed(() => {
|
|
||||||
if (!props.updatedAt) return t('monitorCommon.updatedAt', { time: '--' })
|
|
||||||
return t('monitorCommon.updatedAt', { time: formatRelativeTime(props.updatedAt) })
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<AppLayout>
|
<AppLayout>
|
||||||
<MonitorHero
|
<MonitorHero
|
||||||
:overall-status="overallStatus"
|
:overall-status="overallStatus"
|
||||||
:updated-at="updatedAt"
|
|
||||||
:interval-seconds="DEFAULT_INTERVAL_SECONDS"
|
:interval-seconds="DEFAULT_INTERVAL_SECONDS"
|
||||||
:window="currentWindow"
|
:window="currentWindow"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@@ -56,7 +55,6 @@ const appStore = useAppStore()
|
|||||||
// ── State ──
|
// ── State ──
|
||||||
const items = ref<UserMonitorView[]>([])
|
const items = ref<UserMonitorView[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const updatedAt = ref<string | null>(null)
|
|
||||||
const currentWindow = ref<MonitorWindow>('7d')
|
const currentWindow = ref<MonitorWindow>('7d')
|
||||||
const detailCache = reactive<Record<number, UserMonitorDetail>>({})
|
const detailCache = reactive<Record<number, UserMonitorDetail>>({})
|
||||||
const showDetail = ref(false)
|
const showDetail = ref(false)
|
||||||
@@ -97,7 +95,6 @@ async function reload(silent = false) {
|
|||||||
const res = await listChannelMonitorViews({ signal: ctrl.signal })
|
const res = await listChannelMonitorViews({ signal: ctrl.signal })
|
||||||
if (ctrl.signal.aborted || abortController !== ctrl) return
|
if (ctrl.signal.aborted || abortController !== ctrl) return
|
||||||
items.value = res.items || []
|
items.value = res.items || []
|
||||||
updatedAt.value = new Date().toISOString()
|
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
const e = err as { name?: string; code?: string }
|
const e = err as { name?: string; code?: string }
|
||||||
if (e?.name === 'AbortError' || e?.code === 'ERR_CANCELED') return
|
if (e?.name === 'AbortError' || e?.code === 'ERR_CANCELED') return
|
||||||
|
|||||||
Reference in New Issue
Block a user