From ceb40a25983c49b7f2330033098e9ebccdce37b9 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 9 Jul 2024 15:10:03 +0200 Subject: [PATCH 01/33] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F:=20refactor=20`Sele?= =?UTF-8?q?ctionDialog/selectionTypes.ts`=20to=20use=20TypeScript=20litera?= =?UTF-8?q?l=20types=20for=20selection=20states=20and=20rename=20`selectAl?= =?UTF-8?q?lIcon`=20prop=20to=20`selectAllVariant`=20in=20`SelectionDialog?= =?UTF-8?q?`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/FilesDialog/FilesDialog.test.ts | 6 +++--- client/src/components/FilesDialog/FilesDialog.vue | 5 +++-- .../src/components/SelectionDialog/SelectionDialog.vue | 6 +++--- client/src/components/SelectionDialog/selectionTypes.ts | 9 ++++++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client/src/components/FilesDialog/FilesDialog.test.ts b/client/src/components/FilesDialog/FilesDialog.test.ts index c158f71a21bb..54cd7dcddf8f 100644 --- a/client/src/components/FilesDialog/FilesDialog.test.ts +++ b/client/src/components/FilesDialog/FilesDialog.test.ts @@ -4,7 +4,7 @@ import flushPromises from "flush-promises"; import { getLocalVue } from "tests/jest/helpers"; import { useServerMock } from "@/api/client/__mocks__"; -import { SELECTION_STATES, type SelectionItem } from "@/components/SelectionDialog/selectionTypes"; +import { SELECTION_STATES, type SelectionItem, type SelectionState } from "@/components/SelectionDialog/selectionTypes"; /** * The following imports mock a remote file resource directory structure, @@ -57,7 +57,7 @@ jest.mock("@/composables/config", () => ({ const { server, http } = useServerMock(); interface RowElement extends SelectionItem, Element { - _rowVariant: string; + _rowVariant: SelectionState; } function paramsToKey(query: { target?: string | null; recursive?: string | null; writeable?: string | null }): string { @@ -392,7 +392,7 @@ class Utils { } expectSelectAllIconStatusToBe(status: string) { - expect(this.getSelectionDialog().props("selectAllIcon")).toBe(status); + expect(this.getSelectionDialog().props("selectAllVariant")).toBe(status); } expectNoErrorMessage() { diff --git a/client/src/components/FilesDialog/FilesDialog.vue b/client/src/components/FilesDialog/FilesDialog.vue index f61c7c372c85..74c0647e3680 100644 --- a/client/src/components/FilesDialog/FilesDialog.vue +++ b/client/src/components/FilesDialog/FilesDialog.vue @@ -16,6 +16,7 @@ import { type ItemsProviderContext, SELECTION_STATES, type SelectionItem, + type SelectionState, } from "@/components/SelectionDialog/selectionTypes"; import { useConfig } from "@/composables/config"; import { useFileSources } from "@/composables/fileSources"; @@ -73,7 +74,7 @@ const showDetails = ref(true); const isBusy = ref(false); const currentDirectory = ref(); const showFTPHelper = ref(false); -const selectAllIcon = ref(SELECTION_STATES.UNSELECTED); +const selectAllIcon = ref(SELECTION_STATES.UNSELECTED); const urlTracker = ref(new UrlTracker("")); const totalItems = ref(0); @@ -415,7 +416,7 @@ onMounted(() => { :modal-static="modalStatic" :multiple="multiple" :options-show="optionsShow" - :select-all-icon="selectAllIcon" + :select-all-variant="selectAllIcon" :show-select-icon="undoShow && multiple" :undo-show="undoShow" @onCancel="() => (modalShow = false)" diff --git a/client/src/components/SelectionDialog/SelectionDialog.vue b/client/src/components/SelectionDialog/SelectionDialog.vue index 7a9c08ebaa0d..b0a9ebd60eac 100644 --- a/client/src/components/SelectionDialog/SelectionDialog.vue +++ b/client/src/components/SelectionDialog/SelectionDialog.vue @@ -35,7 +35,7 @@ interface Props { multiple?: boolean; optionsShow?: boolean; undoShow?: boolean; - selectAllIcon?: string; + selectAllVariant?: SelectionState; showSelectIcon?: boolean; title?: string; } @@ -57,7 +57,7 @@ const props = withDefaults(defineProps(), { multiple: false, optionsShow: false, undoShow: false, - selectAllIcon: SELECTION_STATES.UNSELECTED, + selectAllVariant: SELECTION_STATES.UNSELECTED, showSelectIcon: false, title: "", }); @@ -174,7 +174,7 @@ watch( - from History + from History from User Directory @@ -356,5 +362,11 @@ onMounted(async () => { v-if="props.metadata && props.metadata.full_path" :full_path="props.metadata.full_path" :current-id="props.folderId" /> + + From d6eba5a635e61e16be70acf9fe10920d3a582148 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 19 Jul 2024 14:30:22 +0200 Subject: [PATCH 06/33] =?UTF-8?q?=E2=9C=A8:=20add=20and=20expose=20`resetP?= =?UTF-8?q?agination`=20method=20to=20`SelectDialog`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/SelectionDialog/SelectionDialog.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/components/SelectionDialog/SelectionDialog.vue b/client/src/components/SelectionDialog/SelectionDialog.vue index c67f203b6560..d829e4d82c94 100644 --- a/client/src/components/SelectionDialog/SelectionDialog.vue +++ b/client/src/components/SelectionDialog/SelectionDialog.vue @@ -117,9 +117,9 @@ function selectionIcon(variant: string) { } /** Resets pagination when a filter/search word is entered **/ -function filtered(items: Array) { +function filtered(items: SelectionItem[]) { if (props.itemsProvider === undefined) { - currentPage.value = 1; + resetPagination(); } } @@ -139,6 +139,14 @@ function formatTime(value: string) { } } +function resetPagination() { + currentPage.value = 1; +} + +defineExpose({ + resetPagination, +}); + watch( () => props.items, () => { @@ -151,7 +159,7 @@ watch( () => { // We need to reset the current page when drilling down sub-folders if (props.itemsProvider !== undefined) { - currentPage.value = 1; + resetPagination(); } } ); From a950dd7ad468aab4910c490b05528a4cadd52777 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 19 Jul 2024 14:53:56 +0200 Subject: [PATCH 07/33] =?UTF-8?q?=F0=9F=90=9B:=20fix=20reactivity=20issue?= =?UTF-8?q?=20when=20selecting=20an=20item=20in=20`HistoryDatasetPicker`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LibraryFolder/TopToolbar/HistoryDatasetPicker.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/components/Libraries/LibraryFolder/TopToolbar/HistoryDatasetPicker.vue b/client/src/components/Libraries/LibraryFolder/TopToolbar/HistoryDatasetPicker.vue index 02f8384934d5..d52e8a985291 100644 --- a/client/src/components/Libraries/LibraryFolder/TopToolbar/HistoryDatasetPicker.vue +++ b/client/src/components/Libraries/LibraryFolder/TopToolbar/HistoryDatasetPicker.vue @@ -1,7 +1,7 @@