mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
fix(console): show overview loading failures
Failed overview requests must not look like an empty dashboard or a successful refresh. Show the reason while retaining prior data.
This commit is contained in:
1 parent
4fae01453c
commit
a31f7cbe43
3 files changed
+22
-2
No files matched your search
@@ -8,6 +8,8 @@ const props = defineProps<{
|
||||
groupsLoading: boolean;
|
||||
logsLoading: boolean;
|
||||
metricsLoading: boolean;
|
||||
/** Why the latest load failed (what is shown may be empty or older). */
|
||||
error?: string;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -72,6 +74,7 @@ function fmtTime(ts: number): string {
|
||||
|
||||
<template>
|
||||
<div class="space-y-6">
|
||||
<p v-if="error" class="err">{{ t("overview.loadFailed", { error }) }}</p>
|
||||
<!-- KPI cards -->
|
||||
<section class="grid grid-cols-2 gap-4 xl:grid-cols-4">
|
||||
<RcCard v-for="k in kpis" :key="k.label" variant="outline" padding="md" class="p-5">
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
:groups-loading="groupsLoading"
|
||||
:logs-loading="overviewLogsLoading"
|
||||
:metrics-loading="overviewMetricsLoading"
|
||||
:error="overviewError"
|
||||
/>
|
||||
|
||||
<template v-else-if="selectedGroup">
|
||||
@@ -543,12 +544,22 @@ const { logs, loading: logsLoading, error: logsError, load: loadLogs } = useSend
|
||||
// Overview shows every group's latest sends and totals, apart from the Send
|
||||
// Logs and Stats pages and their group filters (the console stays mounted, so
|
||||
// shared state would carry one page's filter into the other).
|
||||
const { logs: overviewLogs, loading: overviewLogsLoading, load: loadOverviewLogs } = useSendLogs();
|
||||
const {
|
||||
logs: overviewLogs,
|
||||
loading: overviewLogsLoading,
|
||||
error: overviewLogsError,
|
||||
load: loadOverviewLogs,
|
||||
} = useSendLogs();
|
||||
const {
|
||||
metrics: overviewMetrics,
|
||||
loading: overviewMetricsLoading,
|
||||
error: overviewMetricsError,
|
||||
load: loadOverviewMetrics,
|
||||
} = useMetrics();
|
||||
/** A failed overview load: shown, never passed off as "no data". */
|
||||
const overviewError = computed(
|
||||
() => groupsError.value || overviewLogsError.value || overviewMetricsError.value,
|
||||
);
|
||||
const {
|
||||
entries: auditEntries,
|
||||
loading: auditLoading,
|
||||
@@ -870,7 +881,8 @@ watch(
|
||||
async function refreshOverview(): Promise<void> {
|
||||
refreshKey.value++;
|
||||
await Promise.all([loadGroups(), loadOverviewLogs(50), loadOverviewMetrics()]);
|
||||
push(t("overview.refreshed"));
|
||||
if (overviewError.value) push(t("overview.refreshFailed"), "bad");
|
||||
else push(t("overview.refreshed"));
|
||||
}
|
||||
|
||||
function enterGroup(group: Group): void {
|
||||
|
||||
@@ -25,6 +25,9 @@ const en: Dict = {
|
||||
"overview.recent": "Recent deliveries",
|
||||
"overview.viewAll": "View all",
|
||||
"overview.refreshed": "Refreshed",
|
||||
"overview.refreshFailed": "Refresh failed",
|
||||
"overview.loadFailed":
|
||||
"Some data could not be loaded; what is shown may be incomplete or out of date: {error}",
|
||||
"overview.thRoute": "Route",
|
||||
"overview.thGroup": "Group",
|
||||
"overview.thEvents": "Events",
|
||||
@@ -475,6 +478,8 @@ const zh: Dict = {
|
||||
"overview.recent": "最近投递",
|
||||
"overview.viewAll": "查看全部",
|
||||
"overview.refreshed": "已刷新",
|
||||
"overview.refreshFailed": "刷新失败",
|
||||
"overview.loadFailed": "部分数据加载失败,当前显示的内容可能不完整或已过期:{error}",
|
||||
"overview.thRoute": "路由",
|
||||
"overview.thGroup": "分组",
|
||||
"overview.thEvents": "事件",
|
||||
|
||||
Reference in new issue
Block a user