From 682cdf16781473318da83c9620a0e5d59e004bbe Mon Sep 17 00:00:00 2001 From: John Chilton Date: Fri, 10 Mar 2023 11:47:05 -0500 Subject: [PATCH] Improve SelectPreferredStore.vue. --- .../SelectPreferredStore.test.js | 23 ++++++++++++++++++ .../CurrentHistory/SelectPreferredStore.vue | 24 +++++++++---------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/client/src/components/History/CurrentHistory/SelectPreferredStore.test.js b/client/src/components/History/CurrentHistory/SelectPreferredStore.test.js index 0e9a627293e0..b5ff7967016d 100644 --- a/client/src/components/History/CurrentHistory/SelectPreferredStore.test.js +++ b/client/src/components/History/CurrentHistory/SelectPreferredStore.test.js @@ -60,4 +60,27 @@ describe("SelectPreferredStore.vue", () => { const emitted = wrapper.emitted(); expect(emitted["updated"][0][0]).toEqual(null); }); + + it("updates object store to on non-null selection", async () => { + const wrapper = mountComponent(); + await flushPromises(); + const els = wrapper.findAll(PREFERENCES.object_store_selection.option_buttons.selector); + expect(els.length).toBe(3); + const galaxyDefaultOption = wrapper.find( + PREFERENCES.object_store_selection.option_button({ object_store_id: "object_store_2" }).selector + ); + expect(galaxyDefaultOption.exists()).toBeTruthy(); + axiosMock + .onPut( + `/api/histories/${TEST_HISTORY_ID}`, + expect.objectContaining({ preferred_object_store_id: "object_store_2" }) + ) + .reply(202); + await galaxyDefaultOption.trigger("click"); + await flushPromises(); + const errorEl = wrapper.find(".object-store-selection-error"); + expect(errorEl.exists()).toBeFalsy(); + const emitted = wrapper.emitted(); + expect(emitted["updated"][0][0]).toEqual("object_store_2"); + }); }); diff --git a/client/src/components/History/CurrentHistory/SelectPreferredStore.vue b/client/src/components/History/CurrentHistory/SelectPreferredStore.vue index 367b88a2ff43..9c15e2e63074 100644 --- a/client/src/components/History/CurrentHistory/SelectPreferredStore.vue +++ b/client/src/components/History/CurrentHistory/SelectPreferredStore.vue @@ -19,28 +19,26 @@ const props = defineProps({ const error = ref(null); const selectedObjectStoreId = ref(props.history.preferred_object_store_id); -const newDatasetsDescription = ref("New dataset outputs from tools and workflows executed in this history"); -const galaxySelectionDefaultTitle = ref("Use Galaxy Defaults"); -const galaxySelectionDefaultDescription = ref( - "Selecting this will reset Galaxy to default behaviors configured by your Galaxy administrator." -); -const userSelectionDefaultTitle = ref("Use Your User Preference Defaults"); -const userSelectionDefaultDescription = ref( - "Selecting this will cause the history to not set a default and to fallback to your user preference defined default." -); +const newDatasetsDescription = "New dataset outputs from tools and workflows executed in this history"; +const galaxySelectionDefaultTitle = "Use Galaxy Defaults"; +const galaxySelectionDefaultDescription = + "Selecting this will reset Galaxy to default behaviors configured by your Galaxy administrator."; +const userSelectionDefaultTitle = "Use Your User Preference Defaults"; +const userSelectionDefaultDescription = + "Selecting this will cause the history to not set a default and to fallback to your user preference defined default."; const defaultOptionTitle = computed(() => { if (props.userPreferredObjectStoreId) { - return userSelectionDefaultTitle.value; + return userSelectionDefaultTitle; } else { - return galaxySelectionDefaultTitle.value; + return galaxySelectionDefaultTitle; } }); const defaultOptionDescription = computed(() => { if (props.userPreferredObjectStoreId) { - return userSelectionDefaultDescription.value; + return userSelectionDefaultDescription; } else { - return galaxySelectionDefaultDescription.value; + return galaxySelectionDefaultDescription; } });