diff --git a/client/src/components/History/CurrentHistory/HistoryCounter.vue b/client/src/components/History/CurrentHistory/HistoryCounter.vue index 98efa0bf11b..ce02cca585b 100644 --- a/client/src/components/History/CurrentHistory/HistoryCounter.vue +++ b/client/src/components/History/CurrentHistory/HistoryCounter.vue @@ -9,14 +9,13 @@ import prettyBytes from "pretty-bytes"; import { computed, onMounted, ref, toRef } from "vue"; import { useRouter } from "vue-router/composables"; -import type { HistorySummary } from "@/api"; +import type { HistorySummaryExtended } from "@/api"; import { HistoryFilters } from "@/components/History/HistoryFilters.js"; import { useConfig } from "@/composables/config"; +import { useHistoryContentStats } from "@/composables/historyContentStats"; import { useStorageLocationConfiguration } from "@/composables/storageLocation"; import { useUserStore } from "@/stores/userStore"; -import { useDetailedHistory } from "./usesDetailedHistory"; - import PreferredStorePopover from "./PreferredStorePopover.vue"; import SelectPreferredStore from "./SelectPreferredStore.vue"; @@ -26,7 +25,7 @@ library.add(faDatabase, faEyeSlash, faHdd, faMapMarker, faSync, faTrash); const props = withDefaults( defineProps<{ - history: HistorySummary; + history: HistorySummaryExtended; isWatching?: boolean; lastChecked: Date; filterText?: string; @@ -47,7 +46,9 @@ const emit = defineEmits(["update:filter-text", "reloadContents"]); const router = useRouter(); const { config } = useConfig(); const { currentUser } = storeToRefs(useUserStore()); -const { historySize, numItemsActive, numItemsDeleted, numItemsHidden } = useDetailedHistory(toRef(props, "history")); +const { historySize, numItemsActive, numItemsDeleted, numItemsHidden } = useHistoryContentStats( + toRef(props, "history") +); const reloadButtonLoading = ref(false); const reloadButtonTitle = ref(""); diff --git a/client/src/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue b/client/src/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue index ad3f94fda94..07bb357e4c3 100644 --- a/client/src/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue +++ b/client/src/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue @@ -5,26 +5,26 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BDropdown, BDropdownItem, BDropdownText, BModal } from "bootstrap-vue"; import { toRef } from "vue"; -import type { HistorySummary } from "@/api"; -import { useDetailedHistory } from "@/components/History/CurrentHistory/usesDetailedHistory"; +import type { HistorySummary, HistorySummaryExtended } from "@/api"; import { deleteAllHiddenContent, purgeAllDeletedContent, unhideAllHiddenContent, } from "@/components/History/model/crud"; import { iframeRedirect } from "@/components/plugins/legacyNavigation"; +import { useHistoryContentStats } from "@/composables/historyContentStats"; library.add(faCog); interface Props { - history: HistorySummary; + history: HistorySummaryExtended; } const props = defineProps(); const emit = defineEmits(["update:operation-running"]); -const { numItemsDeleted, numItemsHidden } = useDetailedHistory(toRef(props, "history")); +const { numItemsDeleted, numItemsHidden } = useHistoryContentStats(toRef(props, "history")); function onCopy() { iframeRedirect("/dataset/copy_datasets"); diff --git a/client/src/components/History/CurrentHistory/HistoryOperations/HistoryOperations.vue b/client/src/components/History/CurrentHistory/HistoryOperations/HistoryOperations.vue index cddb848018d..95189d85bd4 100644 --- a/client/src/components/History/CurrentHistory/HistoryOperations/HistoryOperations.vue +++ b/client/src/components/History/CurrentHistory/HistoryOperations/HistoryOperations.vue @@ -3,14 +3,14 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faCheckSquare, faCompress } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import type { HistorySummary } from "@/api"; +import type { HistorySummaryExtended } from "@/api"; import DefaultOperations from "@/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue"; library.add(faCheckSquare, faCompress); interface Props { - history: HistorySummary; + history: HistorySummaryExtended; hasMatches: boolean; expandedCount: number; showSelection: boolean; diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index 5e287c961ec..3c3d2c6638a 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -3,7 +3,7 @@ import { BAlert } from "bootstrap-vue"; import { storeToRefs } from "pinia"; import { computed, onMounted, type Ref, ref, set as VueSet, unref, watch } from "vue"; -import type { HistorySummary } from "@/api"; +import type { HistorySummaryExtended } from "@/api"; import { copyDataset } from "@/api/datasets"; import ExpandedItems from "@/components/History/Content/ExpandedItems"; import SelectedItems from "@/components/History/Content/SelectedItems"; @@ -47,7 +47,7 @@ interface BackendFilterError { interface Props { listOffset?: number; - history: HistorySummary; + history: HistorySummaryExtended; filter?: string; canEditHistory?: boolean; filterable?: boolean; diff --git a/client/src/components/History/CurrentHistory/usesDetailedHistory.js b/client/src/components/History/CurrentHistory/usesDetailedHistory.js deleted file mode 100644 index 78c0c725675..00000000000 --- a/client/src/components/History/CurrentHistory/usesDetailedHistory.js +++ /dev/null @@ -1,15 +0,0 @@ -import { computed } from "vue"; - -export function useDetailedHistory(history) { - const historySize = computed(() => history.value.size || 0); - const numItemsActive = computed(() => history.value.contents_active?.active || 0); - const numItemsDeleted = computed(() => history.value.contents_active?.deleted || 0); - const numItemsHidden = computed(() => history.value.contents_active?.hidden || 0); - - return { - historySize, - numItemsActive, - numItemsDeleted, - numItemsHidden, - }; -} diff --git a/client/src/components/History/Multiple/MultipleViewItem.vue b/client/src/components/History/Multiple/MultipleViewItem.vue index de19d9af530..4d3faacd4e5 100644 --- a/client/src/components/History/Multiple/MultipleViewItem.vue +++ b/client/src/components/History/Multiple/MultipleViewItem.vue @@ -1,8 +1,9 @@