From 1e4d8232bcdaa6a2405edae042b556a1918ed27c Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 31 Oct 2023 09:41:02 +0100 Subject: [PATCH] Allow to set current history from Storage Dashboard --- .../HistoriesStorageOverview.vue | 8 +++++ .../Visualizations/SelectedItemActions.vue | 31 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/client/src/components/User/DiskUsage/Visualizations/HistoriesStorageOverview.vue b/client/src/components/User/DiskUsage/Visualizations/HistoriesStorageOverview.vue index 246fe4d4455c..45c6480e7304 100644 --- a/client/src/components/User/DiskUsage/Visualizations/HistoriesStorageOverview.vue +++ b/client/src/components/User/DiskUsage/Visualizations/HistoriesStorageOverview.vue @@ -4,6 +4,7 @@ import { useRouter } from "vue-router/composables"; import { useConfirmDialog } from "@/composables/confirmDialog"; import { useToast } from "@/composables/toast"; +import { useHistoryStore } from "@/stores/historyStore"; import localize from "@/utils/localization"; import type { DataValuePoint } from "./Charts"; @@ -16,6 +17,7 @@ import SelectedItemActions from "./SelectedItemActions.vue"; import Heading from "@/components/Common/Heading.vue"; import LoadingSpan from "@/components/LoadingSpan.vue"; +const historyStore = useHistoryStore(); const router = useRouter(); const { success: successToast, error: errorToast } = useToast(); const { confirm } = useConfirmDialog(); @@ -98,6 +100,11 @@ function isArchivedDataPoint(dataPoint: DataValuePoint): boolean { return false; } +async function onSetCurrentHistory(historyId: string) { + await historyStore.setCurrentHistory(historyId); + router.push({ path: "/" }); +} + function onViewHistory(historyId: string) { router.push({ name: "HistoryOverview", params: { historyId } }); } @@ -197,6 +204,7 @@ async function onPermanentlyDeleteHistory(historyId: string) { item-type="history" :is-recoverable="isRecoverableDataPoint(data)" :is-archived="isArchivedDataPoint(data)" + @set-current-history="onSetCurrentHistory" @view-item="onViewHistory" @undelete-item="onUndeleteHistory" @permanently-delete-item="onPermanentlyDeleteHistory" /> diff --git a/client/src/components/User/DiskUsage/Visualizations/SelectedItemActions.vue b/client/src/components/User/DiskUsage/Visualizations/SelectedItemActions.vue index fb39e9468c3e..bd161716efb3 100644 --- a/client/src/components/User/DiskUsage/Visualizations/SelectedItemActions.vue +++ b/client/src/components/User/DiskUsage/Visualizations/SelectedItemActions.vue @@ -1,10 +1,18 @@