Skip to content

Commit b15c51a

Browse files
committed
Display only keep storage option if celery is disabled
Using the export tracking functionality to associate export records requires Celery to be enabled in the instance.
1 parent 444ce13 commit b15c51a

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

client/src/components/History/Archiving/HistoryArchiveWizard.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ import { setActivePinia } from "pinia";
88
import { useHistoryStore, type HistorySummary } from "@/stores/historyStore";
99
import HistoryArchiveWizard from "./HistoryArchiveWizard.vue";
1010

11+
jest.mock("@/composables/config", () => ({
12+
useConfig: jest.fn(() => ({
13+
config: {
14+
value: {
15+
enable_celery_tasks: true,
16+
},
17+
},
18+
})),
19+
}));
20+
1121
const localVue = getLocalVue(true);
1222

1323
const TEST_HISTORY_ID = "test-history-id";
@@ -67,7 +77,7 @@ describe("HistoryArchiveWizard.vue", () => {
6777
expect(optionTabs.exists()).toBe(false);
6878
});
6979

70-
it("should render both archival modes when writeable file sources are available", async () => {
80+
it("should render both archival modes when writeable file sources and celery tasks are available", async () => {
7181
axiosMock.onGet(REMOTE_FILES_API_ENDPOINT).reply(200, [
7282
{
7383
id: "test-posix-source",

client/src/components/History/Archiving/HistoryArchiveWizard.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import HistoryArchiveExportSelector from "@/components/History/Archiving/History
1010
import HistoryArchiveSimple from "@/components/History/Archiving/HistoryArchiveSimple.vue";
1111
import { useHistoryStore, type HistorySummary } from "@/stores/historyStore";
1212
import LoadingSpan from "@/components/LoadingSpan.vue";
13+
import { useConfig } from "@/composables/config";
1314
import { useToast } from "@/composables/toast";
1415
1516
library.add(faArchive);
1617
1718
const historyStore = useHistoryStore();
19+
const { config } = useConfig(true);
1820
const toast = useToast();
1921
2022
const { hasWritable: hasWritableFileSources } = useFileSources();
@@ -42,6 +44,10 @@ const isHistoryAlreadyArchived = computed(() => {
4244
return history.value?.archived;
4345
});
4446
47+
const canFreeStorage = computed(() => {
48+
return hasWritableFileSources.value && config.value.enable_celery_tasks;
49+
});
50+
4551
const archivedHistoriesRoute = "/histories/archived";
4652
4753
async function onArchiveHistory(exportRecordId?: string) {
@@ -77,20 +83,20 @@ async function onArchiveHistory(exportRecordId?: string) {
7783
<router-link :to="archivedHistoriesRoute">Archived Histories</router-link> section.
7884
</b-alert>
7985

80-
<history-archive-simple v-if="!hasWritableFileSources" :history="history" @onArchive="onArchiveHistory" />
81-
<div v-else>
86+
<div v-if="canFreeStorage">
8287
<h2 class="h-md">How do you want to archive this history?</h2>
8388
<b-card no-body class="mt-3">
8489
<b-tabs pills card vertical lazy class="archival-option-tabs">
8590
<b-tab id="keep-storage-tab" title="Keep storage space" active>
8691
<history-archive-simple :history="history" @onArchive="onArchiveHistory" />
8792
</b-tab>
88-
<b-tab v-if="hasWritableFileSources" id="free-storage-tab" title="Free storage space">
93+
<b-tab id="free-storage-tab" title="Free storage space">
8994
<history-archive-export-selector :history="history" @onArchive="onArchiveHistory" />
9095
</b-tab>
9196
</b-tabs>
9297
</b-card>
9398
</div>
99+
<history-archive-simple v-else :history="history" @onArchive="onArchiveHistory" />
94100
</div>
95101
</div>
96102
</template>

0 commit comments

Comments
 (0)