diff --git a/client/src/components/Grid/configs/histories.ts b/client/src/components/Grid/configs/histories.ts index 2c34d2b5a7e3..189b27c1cc9d 100644 --- a/client/src/components/Grid/configs/histories.ts +++ b/client/src/components/Grid/configs/histories.ts @@ -1,4 +1,5 @@ import { + faBurn, faExchangeAlt, faEye, faPlus, @@ -10,7 +11,7 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { useEventBus } from "@vueuse/core"; -import { deleteHistories, deleteHistory, historiesFetcher, undeleteHistories, undeleteHistory } from "@/api/histories"; +import { historiesFetcher } from "@/api/histories"; import { updateTags } from "@/api/tags"; import { useHistoryStore } from "@/stores/historyStore"; import Filtering, { contains, equals, expandNameTag, toBool, type ValidFilter } from "@/utils/filtering"; @@ -70,7 +71,8 @@ const batch: BatchOperationArray = [ if (confirm(_l(`Are you sure that you want to delete the selected histories?`))) { try { const historyIds = data.map((x) => String(x.id)); - await deleteHistories({ ids: historyIds }); + const historyStore = useHistoryStore(); + await historyStore.deleteHistories(historyIds); return { status: "success", message: `Deleted ${data.length} histories.`, @@ -92,7 +94,8 @@ const batch: BatchOperationArray = [ if (confirm(_l(`Are you sure that you want to restore the selected histories?`))) { try { const historyIds = data.map((x) => String(x.id)); - await undeleteHistories({ ids: historyIds }); + const historyStore = useHistoryStore(); + await historyStore.restoreHistories(historyIds); return { status: "success", message: `Restored ${data.length} histories.`, @@ -108,13 +111,14 @@ const batch: BatchOperationArray = [ }, { title: "Purge", - icon: faTrash, + icon: faBurn, condition: (data: Array) => !data.some((x) => x.purged), handler: async (data: Array) => { if (confirm(_l(`Are you sure that you want to permanently delete the selected histories?`))) { try { const historyIds = data.map((x) => String(x.id)); - await deleteHistories({ ids: historyIds, purge: true }); + const historyStore = useHistoryStore(); + await historyStore.deleteHistories(historyIds, true); return { status: "success", message: `Purged ${data.length} histories.`, @@ -185,7 +189,8 @@ const fields: FieldArray = [ handler: async (data: HistoryEntry) => { if (confirm(_l("Are you sure that you want to delete this history?"))) { try { - await deleteHistory({ history_id: String(data.id) }); + const historyStore = useHistoryStore(); + await historyStore.deleteHistory(String(data.id)); return { status: "success", message: `'${data.name}' has been deleted.`, @@ -201,12 +206,13 @@ const fields: FieldArray = [ }, { title: "Delete Permanently", - icon: faTrash, + icon: faBurn, condition: (data: HistoryEntry) => !data.purged, handler: async (data: HistoryEntry) => { if (confirm(_l("Are you sure that you want to permanently delete this history?"))) { try { - await deleteHistory({ history_id: String(data.id), purge: true }); + const historyStore = useHistoryStore(); + await historyStore.deleteHistory(String(data.id), true); return { status: "success", message: `'${data.name}' has been permanently deleted.`, @@ -226,7 +232,8 @@ const fields: FieldArray = [ condition: (data: HistoryEntry) => !!data.deleted && !data.purged, handler: async (data: HistoryEntry) => { try { - await undeleteHistory({ history_id: String(data.id) }); + const historyStore = useHistoryStore(); + await historyStore.restoreHistory(String(data.id)); return { status: "success", message: `'${data.name}' has been restored.`, diff --git a/client/src/components/History/CurrentHistory/HistoryDetails.vue b/client/src/components/History/CurrentHistory/HistoryDetails.vue index 52619647dd25..0fa1c0d90f7e 100644 --- a/client/src/components/History/CurrentHistory/HistoryDetails.vue +++ b/client/src/components/History/CurrentHistory/HistoryDetails.vue @@ -1,22 +1,22 @@ + + diff --git a/client/src/components/History/HistoryScrollList.vue b/client/src/components/History/HistoryScrollList.vue index dad3c94eb05a..56bb35773595 100644 --- a/client/src/components/History/HistoryScrollList.vue +++ b/client/src/components/History/HistoryScrollList.vue @@ -19,10 +19,10 @@ import localize from "@/utils/localization"; import { HistoriesFilters } from "./HistoriesFilters"; import TextSummary from "../Common/TextSummary.vue"; +import HistoryIndicators from "./HistoryIndicators.vue"; import Heading from "@/components/Common/Heading.vue"; import StatelessTags from "@/components/TagsMultiselect/StatelessTags.vue"; import ScrollToTopButton from "@/components/ToolsList/ScrollToTopButton.vue"; -import UtcDate from "@/components/UtcDate.vue"; type AdditionalOptions = "set-current" | "multi" | "center"; type PinnedHistory = { id: string }; @@ -277,18 +277,7 @@ async function loadMore(noScroll = false) { -
- - {{ history.count }} {{ localize("items") }} - - - - -
+

{{ history.annotation }}

diff --git a/client/src/components/History/HistoryView.test.js b/client/src/components/History/HistoryView.test.js index c37f4306b124..d74ce6d885a2 100644 --- a/client/src/components/History/HistoryView.test.js +++ b/client/src/components/History/HistoryView.test.js @@ -185,7 +185,9 @@ describe("History center panel View", () => { expect(storageDashboardButtonDisabled(wrapper)).toBeFalsy(); // instead we have an alert - expect(wrapper.find("[data-description='history messages']").text()).toBe("History has been purged"); + expect(wrapper.find("[data-description='history messages']").text()).toBe( + "History has been permanently deleted" + ); }); it("should not display archived message and should be importable when user is not owner and history is archived", async () => { diff --git a/client/src/components/History/Index.vue b/client/src/components/History/Index.vue index 5a192ef8bbb7..634d8f6c5a59 100644 --- a/client/src/components/History/Index.vue +++ b/client/src/components/History/Index.vue @@ -40,8 +40,7 @@ function onViewCollection(collection: CollectionEntry, currentOffset?: number) { + :histories-loading="historiesLoading" /> diff --git a/client/src/components/History/Layout/DetailsLayout.vue b/client/src/components/History/Layout/DetailsLayout.vue index ef49938ca9f3..19611ba408b9 100644 --- a/client/src/components/History/Layout/DetailsLayout.vue +++ b/client/src/components/History/Layout/DetailsLayout.vue @@ -9,6 +9,8 @@ import { computed, ref } from "vue"; import { useUserStore } from "@/stores/userStore"; import l from "@/utils/localization"; +import type { DetailsLayoutSummarized } from "./types"; + import TextSummary from "@/components/Common/TextSummary.vue"; import StatelessTags from "@/components/TagsMultiselect/StatelessTags.vue"; @@ -20,7 +22,7 @@ interface Props { writeable?: boolean; annotation?: string; showAnnotation?: boolean; - summarized?: boolean; + summarized?: DetailsLayoutSummarized; } const props = withDefaults(defineProps(), { @@ -29,7 +31,7 @@ const props = withDefaults(defineProps(), { writeable: true, annotation: undefined, showAnnotation: true, - summarized: false, + summarized: undefined, }); const emit = defineEmits(["save"]); @@ -47,6 +49,20 @@ const localProps = ref<{ name: string; annotation: string | null; tags: string[] tags: [], }); +const detailsClass = computed(() => { + const classes: Record = { + details: true, + "summarized-details": props.summarized && !editing.value, + "m-3": !props.summarized || editing.value, + }; + + if (props.summarized) { + classes[props.summarized] = true; + } + + return classes; +}); + const editButtonTitle = computed(() => { if (isAnonymous.value) { return l("Log in to Rename History"); @@ -90,10 +106,7 @@ function selectText() {