From aaa68f98ce69034828111d241411d3281605cced Mon Sep 17 00:00:00 2001 From: Piyush Bhaskar <102078527+Piyush-r-bhaskar@users.noreply.github.com> Date: Sat, 15 Feb 2025 22:58:48 +0530 Subject: [PATCH 1/3] fix(ui): skeletons based on type like for chart and table. --- ui/src/components/dashboard/Dashboard.vue | 75 ++++--- .../components/charts/executions/Bar.vue | 11 +- .../components/charts/executions/BarChart.vue | 60 +++++- .../components/charts/executions/Doughnut.vue | 43 +++- .../dashboard/components/charts/logs/Bar.vue | 59 +++++- .../tables/executions/EmptyNextScheduled.vue | 185 +++++++++++++++++- .../tables/executions/InProgress.vue | 42 +++- .../tables/executions/NextScheduled.vue | 50 ++++- ui/src/components/executions/Executions.vue | 12 +- ui/src/components/flows/Flows.vue | 9 +- ui/src/components/logs/LogsWrapper.vue | 2 +- 11 files changed, 496 insertions(+), 52 deletions(-) diff --git a/ui/src/components/dashboard/Dashboard.vue b/ui/src/components/dashboard/Dashboard.vue index 37cfc668383..53de0211720 100644 --- a/ui/src/components/dashboard/Dashboard.vue +++ b/ui/src/components/dashboard/Dashboard.vue @@ -131,12 +131,14 @@ @@ -169,6 +171,7 @@ v-else :flow="props.flowId" :namespace="props.namespace" + :loading="executionsLoading" class="card card-1/2" /> @@ -176,23 +179,34 @@ v-if="props.flow" :flow="props.flowId" :namespace="props.namespace" + :loading="executionsLoading" class="card card-1/2" /> - + - + @@ -403,20 +417,22 @@ const fetchExecutions = () => { executionsLoading.value = true; - store.dispatch("stat/daily", mergeQuery()).then((response) => { - const sorted = response.sort( - (a, b) => new Date(b.date) - new Date(a.date), - ); - - executions.value = { - raw: sorted, - all: transformer(sorted), - yesterday: sorted.at(-2), - today: sorted.at(-1), - }; - }).finally(() => { - executionsLoading.value = false; - }); + return store.dispatch("stat/daily", mergeQuery()) + .then((response) => { + const sorted = response.sort( + (a, b) => new Date(b.date) - new Date(a.date), + ); + + executions.value = { + raw: sorted, + all: transformer(sorted), + yesterday: sorted.at(-2), + today: sorted.at(-1), + }; + }) + .finally(() => { + executionsLoading.value = false; + }); }; const graphData = computed(() => store.state.stat.daily || []); @@ -453,14 +469,25 @@ if (!custom.value.shown) { try { - await Promise.any([ - fetchNumbers(), - fetchExecutions(), - fetchNamespaceExecutions(), - fetchLogs(), - ]); - } catch (error) { - console.error("All promises failed:", error); + executionsLoading.value = true; + await new Promise((resolve) => { + setTimeout(async () => { + try { + await Promise.any([ + fetchNumbers(), + fetchExecutions(), + fetchNamespaceExecutions(), + fetchLogs(), + ]); + resolve(); + } catch (error) { + console.error("All promises failed:", error); + resolve(); + } + }, 1000); // 1 second delay - please remove this after testing. + }); + } finally { + executionsLoading.value = false; } } }; diff --git a/ui/src/components/dashboard/components/charts/executions/Bar.vue b/ui/src/components/dashboard/components/charts/executions/Bar.vue index bdda0294c2e..9e190143f55 100644 --- a/ui/src/components/dashboard/components/charts/executions/Bar.vue +++ b/ui/src/components/dashboard/components/charts/executions/Bar.vue @@ -11,7 +11,8 @@

- {{ total }} + + {{ total }}

@@ -23,6 +24,7 @@ v-model="duration" :active-icon="CheckIcon" inline-prompt + :disabled="loading" /> {{ t("duration") }} @@ -31,12 +33,13 @@ @@ -71,6 +74,10 @@ type: Number, required: true, }, + loading: { + type: Boolean, + default: false + } }); diff --git a/ui/src/components/dashboard/components/charts/executions/BarChart.vue b/ui/src/components/dashboard/components/charts/executions/BarChart.vue index 72957367f80..2c31d98300a 100644 --- a/ui/src/components/dashboard/components/charts/executions/BarChart.vue +++ b/ui/src/components/dashboard/components/charts/executions/BarChart.vue @@ -12,6 +12,13 @@ >
+ { + const barColor = theme.value === "dark" + ? "rgba(255, 255, 255, 0.08)" + : "rgba(0, 0, 0, 0.06)"; + + return { + labels: Array(18).fill(""), + datasets: [{ + data: Array(18).fill(0).map(() => Math.random() * 70 + 30), + backgroundColor: barColor, + borderRadius: 2, + barThickness: props.small ? 8 : 12, + }] + }; + }); + + const skeletonOptions = computed(() => ({ + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: { + display: false + }, + tooltip: { + enabled: false + } + }, + scales: { + x: { + display: false, + grid: { + display: false + } + }, + y: { + display: false, + grid: { + display: false + }, + min: 0, + max: 100 + } + } + })); + const parsedData = computed(() => { let datasets = props.data.reduce(function (accumulator, value) { Object.keys(value.executionCounts).forEach(function (state) { @@ -234,8 +290,8 @@ ); - \ No newline at end of file diff --git a/ui/src/components/dashboard/components/charts/executions/Doughnut.vue b/ui/src/components/dashboard/components/charts/executions/Doughnut.vue index 4cb219e00a6..ec76b532bf7 100644 --- a/ui/src/components/dashboard/components/charts/executions/Doughnut.vue +++ b/ui/src/components/dashboard/components/charts/executions/Doughnut.vue @@ -9,7 +9,13 @@ >
+ defaultConfig({ plugins: { @@ -161,6 +169,35 @@ }); }, }; + + const skeletonData = computed(() => { + const barColor = theme.value === "dark" + ? "rgba(255, 255, 255, 0.08)" + : "rgba(0, 0, 0, 0.06)"; + + return { + labels: ["Loading"], + datasets: [{ + data: [100], + backgroundColor: [barColor], + borderWidth: 0 + }] + }; + }); + + const skeletonOptions = computed(() => ({ + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: { + display: false + }, + tooltip: { + enabled: false + } + }, + cutout: "40%" + })); diff --git a/ui/src/components/dashboard/components/tables/executions/InProgress.vue b/ui/src/components/dashboard/components/tables/executions/InProgress.vue index 9e514e9805b..5648600a7ed 100644 --- a/ui/src/components/dashboard/components/tables/executions/InProgress.vue +++ b/ui/src/components/dashboard/components/tables/executions/InProgress.vue @@ -22,7 +22,37 @@
-
+
+ + + + + + + + + + + + + + + + + +
+ +
{ store .dispatch("execution/findExecutions", { @@ -190,4 +226,8 @@ code { .inprogress { background: var(--ks-background-table-row); } + +:deep(.el-skeleton-item) { + background: var(--ks-background-skeleton); +} diff --git a/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue b/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue index ba776495f11..cbcf0b7294b 100644 --- a/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue +++ b/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue @@ -1,17 +1,44 @@ - + - + @@ -150,6 +176,10 @@ required: false, default: null, }, + loading: { + type: Boolean, + default: false + } }); const store = useStore(); @@ -158,6 +188,8 @@ const executions = ref({results: [], total: 0}); const currentPage = ref(1); + const skeletonData = Array(5).fill({}); + const loadExecutions = (page = 1) => { store .dispatch("trigger/search", { @@ -215,4 +247,8 @@ code { .next-toggle { padding: 8px 0 0 0 !important; } + +:deep(.el-skeleton-item) { + background: var(--ks-background-skeleton); +} diff --git a/ui/src/components/executions/Executions.vue b/ui/src/components/executions/Executions.vue index 76e524e8108..75041afcd0d 100644 --- a/ui/src/components/executions/Executions.vue +++ b/ui/src/components/executions/Executions.vue @@ -59,7 +59,12 @@ @@ -531,7 +536,8 @@ actionOptions: {}, lastRefreshDate: new Date(), changeStatusDialogVisible: false, - selectedStatus: undefined + selectedStatus: undefined, + loading: false }; }, created() { @@ -704,6 +710,7 @@ }, loadStats() { this.dailyReady = false; + this.loading = true; this.$store .dispatch("stat/daily", this.loadQuery({ @@ -712,6 +719,7 @@ }, true)) .then(() => { this.dailyReady = true; + this.loading = false; }); }, loadData(callback) { diff --git a/ui/src/components/flows/Flows.vue b/ui/src/components/flows/Flows.vue index 164204557fa..347a6fff7ca 100644 --- a/ui/src/components/flows/Flows.vue +++ b/ui/src/components/flows/Flows.vue @@ -76,7 +76,11 @@ @@ -440,6 +444,7 @@ showChart: ["true", null].includes( localStorage.getItem(storageKeys.SHOW_FLOWS_CHART), ), + loading: false, }; }, computed: { @@ -817,6 +822,7 @@ }, loadStats() { this.dailyReady = false; + this.loading = true; if (this.user.hasAny(permission.EXECUTION) && this.showStatChart) { this.$store @@ -834,6 +840,7 @@ ) .then(() => { this.dailyReady = true; + this.loading = false; }); } }, diff --git a/ui/src/components/logs/LogsWrapper.vue b/ui/src/components/logs/LogsWrapper.vue index 33d0bbe7cf5..9a450643377 100644 --- a/ui/src/components/logs/LogsWrapper.vue +++ b/ui/src/components/logs/LogsWrapper.vue @@ -18,7 +18,7 @@
From 37c43b1c9e5df906602b277e49a9baad4ce645d3 Mon Sep 17 00:00:00 2001 From: Piyush Bhaskar <102078527+Piyush-r-bhaskar@users.noreply.github.com> Date: Sat, 15 Feb 2025 23:15:04 +0530 Subject: [PATCH 2/3] minor tweak --- .../tables/executions/EmptyNextScheduled.vue | 187 +----------------- .../tables/executions/NextScheduled.vue | 16 +- 2 files changed, 17 insertions(+), 186 deletions(-) diff --git a/ui/src/components/dashboard/components/tables/executions/EmptyNextScheduled.vue b/ui/src/components/dashboard/components/tables/executions/EmptyNextScheduled.vue index 7d6126a8e77..37525b442c8 100644 --- a/ui/src/components/dashboard/components/tables/executions/EmptyNextScheduled.vue +++ b/ui/src/components/dashboard/components/tables/executions/EmptyNextScheduled.vue @@ -1,188 +1,19 @@ - - + \ No newline at end of file diff --git a/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue b/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue index cbcf0b7294b..2adaecf8054 100644 --- a/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue +++ b/ui/src/components/dashboard/components/tables/executions/NextScheduled.vue @@ -15,22 +15,22 @@
- + - + - + - + @@ -74,7 +74,7 @@ /> - + - + From 3b5dbaf9e61ec1d85291fef9fc81243701f9a772 Mon Sep 17 00:00:00 2001 From: Piyush-r-bhaskar Date: Sat, 1 Mar 2025 00:35:43 +0530 Subject: [PATCH 3/3] fix(ui): fixed momentary No Data visual. --- ui/src/components/dashboard/Dashboard.vue | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ui/src/components/dashboard/Dashboard.vue b/ui/src/components/dashboard/Dashboard.vue index 53de0211720..8a4dcd8d132 100644 --- a/ui/src/components/dashboard/Dashboard.vue +++ b/ui/src/components/dashboard/Dashboard.vue @@ -470,21 +470,13 @@ if (!custom.value.shown) { try { executionsLoading.value = true; - await new Promise((resolve) => { - setTimeout(async () => { - try { - await Promise.any([ - fetchNumbers(), - fetchExecutions(), - fetchNamespaceExecutions(), - fetchLogs(), - ]); - resolve(); - } catch (error) { - console.error("All promises failed:", error); - resolve(); - } - }, 1000); // 1 second delay - please remove this after testing. + await Promise.all([ + fetchNumbers(), + fetchExecutions(), + fetchNamespaceExecutions(), + fetchLogs(), + ]).catch(error => { + console.error("Failed to fetch dashboard data:", error); }); } finally { executionsLoading.value = false;