From c6e700b7c5d7ec3cfa548984406bf4341ce4619c Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:35:25 +0100 Subject: [PATCH 01/40] Disable add button when nothing is selected --- client/src/components/History/Modals/SelectorModal.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/components/History/Modals/SelectorModal.vue b/client/src/components/History/Modals/SelectorModal.vue index 76dded0a196..60771b6d37a 100644 --- a/client/src/components/History/Modals/SelectorModal.vue +++ b/client/src/components/History/Modals/SelectorModal.vue @@ -31,7 +31,9 @@ @@ -77,6 +79,9 @@ export default { return item; }); }, + isEmptySelection() { + return this.selectedHistories.length === 0; + }, }, watch: { histories(newVal) { From a30beb4da541d6160037ad67855961d5a999bdc9 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:43:52 +0100 Subject: [PATCH 02/40] Update row variant conditionally The current history will be still highlighted differently when is not explicitly selected. --- client/src/components/History/Modals/SelectorModal.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/History/Modals/SelectorModal.vue b/client/src/components/History/Modals/SelectorModal.vue index 60771b6d37a..4776ed30dd5 100644 --- a/client/src/components/History/Modals/SelectorModal.vue +++ b/client/src/components/History/Modals/SelectorModal.vue @@ -74,7 +74,10 @@ export default { formattedItems() { return this.histories.map((item) => { if (item.id === this.currentHistoryId) { - item._rowVariant = "info"; + const isCurrentSelected = this.selectedHistories.some( + (history) => history.id === this.currentHistoryId + ); + item._rowVariant = isCurrentSelected ? "success" : "info"; } return item; }); From 67a5e81d51fcf2e04207733bf6e6c328b1b123cc Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:16:55 +0100 Subject: [PATCH 03/40] Add jest test for current history highlight --- .../History/Modals/SelectorModal.test.js | 62 +++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/client/src/components/History/Modals/SelectorModal.test.js b/client/src/components/History/Modals/SelectorModal.test.js index bc026247c84..8aa8b281aed 100644 --- a/client/src/components/History/Modals/SelectorModal.test.js +++ b/client/src/components/History/Modals/SelectorModal.test.js @@ -5,7 +5,7 @@ import SelectorModal from "./SelectorModal"; const localVue = getLocalVue(); -const SELECTED_HISTORY_ID = "COOL_ID"; +const CURRENT_HISTORY_ID = "COOL_ID"; const getFakeHistorySummaries = (num, selectedIndex = 0) => { const result = Array.from({ length: num }, (_, index) => ({ id: `ID-${index}`, @@ -13,11 +13,11 @@ const getFakeHistorySummaries = (num, selectedIndex = 0) => { tags: [], update_time: new Date().toISOString(), })); - result[selectedIndex].id = SELECTED_HISTORY_ID; + result[selectedIndex].id = CURRENT_HISTORY_ID; return result; }; const PROPS_WITH_10_HISTORIES = { - currentHistoryId: SELECTED_HISTORY_ID, + currentHistoryId: CURRENT_HISTORY_ID, histories: getFakeHistorySummaries(10), perPage: 3, static: true, // Force the modal visible for testing @@ -27,6 +27,9 @@ const PROPS_WITH_10_HISTORY_MULTIPLE_SELECT = { multiple: true, }; +const CURRENT_HISTORY_HIGHLIGHT_CLASS = ".table-info"; +const SELECTED_HISTORY_HIGHLIGHT_CLASS = ".table-success"; + describe("History SelectorModal.vue", () => { let wrapper; @@ -41,9 +44,9 @@ describe("History SelectorModal.vue", () => { it("should highlight the currently selected history", async () => { await mountWith(PROPS_WITH_10_HISTORIES); - const selectedRows = wrapper.findAll(".table-info"); + const selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); expect(selectedRows.length).toBe(1); - expect(selectedRows.at(0).attributes("data-pk")).toBe(SELECTED_HISTORY_ID); + expect(selectedRows.at(0).attributes("data-pk")).toBe(CURRENT_HISTORY_ID); }); it("paginates the histories", async () => { @@ -67,25 +70,48 @@ describe("History SelectorModal.vue", () => { expect(wrapper.emitted()["selectHistory"][0][0].id).toBe(targetHistoryId); }); - it("select multiple histories", async () => { - await mountWith(PROPS_WITH_10_HISTORY_MULTIPLE_SELECT); + describe("Multi-selection Mode", () => { + it("should select multiple histories", async () => { + await mountWith(PROPS_WITH_10_HISTORY_MULTIPLE_SELECT); - expect(wrapper.emitted()["selectHistories"]).toBeUndefined(); + expect(wrapper.emitted()["selectHistories"]).toBeUndefined(); - const targetHistoryId1 = "ID-1"; - const targetRow1 = wrapper.find(`[data-pk="${targetHistoryId1}"]`); - await targetRow1.trigger("click"); + const targetHistoryId1 = "ID-1"; + const targetRow1 = wrapper.find(`[data-pk="${targetHistoryId1}"]`); + await targetRow1.trigger("click"); - const targetHistoryId2 = "ID-2"; - const targetRow2 = wrapper.find(`[data-pk="${targetHistoryId2}"]`); - await targetRow2.trigger("click"); + const targetHistoryId2 = "ID-2"; + const targetRow2 = wrapper.find(`[data-pk="${targetHistoryId2}"]`); + await targetRow2.trigger("click"); - expect(wrapper.vm.selectedHistories.length).toBe(2); + expect(wrapper.vm.selectedHistories.length).toBe(2); - const button = wrapper.find(".btn-primary"); + const button = wrapper.find(".btn-primary"); - await button.trigger("click"); + await button.trigger("click"); - expect(wrapper.emitted()["selectHistories"][0][0][0].id).toBe(targetHistoryId1); + expect(wrapper.emitted()["selectHistories"][0][0][0].id).toBe(targetHistoryId1); + + console.debug(wrapper.html()); + }); + + it("should highlight the current history differently by default but equally when selected", async () => { + await mountWith(PROPS_WITH_10_HISTORY_MULTIPLE_SELECT); + + let selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); + expect(selectedRows.length).toBe(1); + expect(selectedRows.at(0).attributes("data-pk")).toBe(CURRENT_HISTORY_ID); + + const targetRow = wrapper.find(`[data-pk="${CURRENT_HISTORY_ID}"]`); + await targetRow.trigger("click"); + + // No longer highlighted as current + selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); + expect(selectedRows.length).toBe(0); + + // Highlighted as normal selection + selectedRows = wrapper.findAll(SELECTED_HISTORY_HIGHLIGHT_CLASS); + expect(selectedRows.length).toBe(1); + }); }); }); From 6f99f8aa281c6f2caf6002c4597030e7b6ee9936 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 24 Jan 2023 19:12:25 +0100 Subject: [PATCH 04/40] Indicate current history without color highlight --- .../History/Modals/SelectorModal.test.js | 29 +++---------------- .../History/Modals/SelectorModal.vue | 16 +++------- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/client/src/components/History/Modals/SelectorModal.test.js b/client/src/components/History/Modals/SelectorModal.test.js index 8aa8b281aed..121e911f63b 100644 --- a/client/src/components/History/Modals/SelectorModal.test.js +++ b/client/src/components/History/Modals/SelectorModal.test.js @@ -27,8 +27,7 @@ const PROPS_WITH_10_HISTORY_MULTIPLE_SELECT = { multiple: true, }; -const CURRENT_HISTORY_HIGHLIGHT_CLASS = ".table-info"; -const SELECTED_HISTORY_HIGHLIGHT_CLASS = ".table-success"; +const CURRENT_HISTORY_INDICATION_TEXT = "(Current)"; describe("History SelectorModal.vue", () => { let wrapper; @@ -41,12 +40,11 @@ describe("History SelectorModal.vue", () => { await flushPromises(); } - it("should highlight the currently selected history", async () => { + it("should indicate the currently selected history", async () => { await mountWith(PROPS_WITH_10_HISTORIES); - const selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); - expect(selectedRows.length).toBe(1); - expect(selectedRows.at(0).attributes("data-pk")).toBe(CURRENT_HISTORY_ID); + const currentHistoryRow = wrapper.find(`[data-pk="${CURRENT_HISTORY_ID}"]`); + expect(currentHistoryRow.html()).toContain(CURRENT_HISTORY_INDICATION_TEXT); }); it("paginates the histories", async () => { @@ -94,24 +92,5 @@ describe("History SelectorModal.vue", () => { console.debug(wrapper.html()); }); - - it("should highlight the current history differently by default but equally when selected", async () => { - await mountWith(PROPS_WITH_10_HISTORY_MULTIPLE_SELECT); - - let selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); - expect(selectedRows.length).toBe(1); - expect(selectedRows.at(0).attributes("data-pk")).toBe(CURRENT_HISTORY_ID); - - const targetRow = wrapper.find(`[data-pk="${CURRENT_HISTORY_ID}"]`); - await targetRow.trigger("click"); - - // No longer highlighted as current - selectedRows = wrapper.findAll(CURRENT_HISTORY_HIGHLIGHT_CLASS); - expect(selectedRows.length).toBe(0); - - // Highlighted as normal selection - selectedRows = wrapper.findAll(SELECTED_HISTORY_HIGHLIGHT_CLASS); - expect(selectedRows.length).toBe(1); - }); }); }); diff --git a/client/src/components/History/Modals/SelectorModal.vue b/client/src/components/History/Modals/SelectorModal.vue index 4776ed30dd5..5fdd0440798 100644 --- a/client/src/components/History/Modals/SelectorModal.vue +++ b/client/src/components/History/Modals/SelectorModal.vue @@ -11,7 +11,7 @@ primary-key="id" :fields="fields" :filter="filter" - :items="formattedItems" + :items="histories" :per-page="perPage" :current-page="currentPage" :selectable="true" @@ -22,6 +22,9 @@ selected-variant="success" @row-selected="rowSelected" @filtered="onFiltered"> + @@ -71,17 +74,6 @@ export default { }; }, computed: { - formattedItems() { - return this.histories.map((item) => { - if (item.id === this.currentHistoryId) { - const isCurrentSelected = this.selectedHistories.some( - (history) => history.id === this.currentHistoryId - ); - item._rowVariant = isCurrentSelected ? "success" : "info"; - } - return item; - }); - }, isEmptySelection() { return this.selectedHistories.length === 0; }, From bf1938b1075633b2827aded350a5199a621a0289 Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 26 Jan 2023 15:03:07 -0500 Subject: [PATCH 05/40] Hide metadata auto-detection option if dataset is in improper state --- .../src/components/DatasetInformation/DatasetAttributes.vue | 4 ++-- lib/galaxy/webapps/galaxy/controllers/dataset.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/DatasetInformation/DatasetAttributes.vue b/client/src/components/DatasetInformation/DatasetAttributes.vue index dd942966dd0..fbb1aa44e52 100644 --- a/client/src/components/DatasetInformation/DatasetAttributes.vue +++ b/client/src/components/DatasetInformation/DatasetAttributes.vue @@ -20,12 +20,12 @@ @click="submit('attribute', 'attributes')"> {{ "Save" | l }} - + {{ "Auto-detect" | l }} - +