From fcd35932040bd9341c98ca7eb8c32edb0a2c4d19 Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Wed, 17 Mar 2021 15:41:48 +0000 Subject: [PATCH 1/2] rename isVirgin to neutral isInitialised in all files --- jsapp/js/components/library/myLibraryStore.es6 | 8 ++++---- jsapp/js/components/library/ownedCollectionsStore.es6 | 6 +++--- jsapp/js/components/library/publicCollectionsStore.es6 | 8 ++++---- jsapp/js/components/library/singleCollectionStore.es6 | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/jsapp/js/components/library/myLibraryStore.es6 b/jsapp/js/components/library/myLibraryStore.es6 index ba6607ee52..3ca1ebbb3d 100644 --- a/jsapp/js/components/library/myLibraryStore.es6 +++ b/jsapp/js/components/library/myLibraryStore.es6 @@ -25,7 +25,7 @@ const myLibraryStore = Reflux.createStore({ PAGE_SIZE: 100, DEFAULT_ORDER_COLUMN: ASSETS_TABLE_COLUMNS['date-modified'], - isVirgin: true, + isInitialised: false, data: { isFetchingData: false, @@ -69,7 +69,7 @@ const myLibraryStore = Reflux.createStore({ * otherwise wait until route changes to a library (see `onRouteChange`) */ startupStore() { - if (this.isVirgin && isOnLibraryRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnLibraryRoute() && !this.data.isFetchingData) { this.fetchData(true); } }, @@ -133,7 +133,7 @@ const myLibraryStore = Reflux.createStore({ }, onRouteChange(data) { - if (this.isVirgin && isOnLibraryRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnLibraryRoute() && !this.data.isFetchingData) { this.fetchData(true); } else if ( ( @@ -186,7 +186,7 @@ const myLibraryStore = Reflux.createStore({ this.data.totalUserAssets = this.data.totalSearchAssets; } this.data.isFetchingData = false; - this.isVirgin = false; + this.isInitialised = true; this.trigger(this.data); }, diff --git a/jsapp/js/components/library/ownedCollectionsStore.es6 b/jsapp/js/components/library/ownedCollectionsStore.es6 index b1b5781683..03d490dd85 100644 --- a/jsapp/js/components/library/ownedCollectionsStore.es6 +++ b/jsapp/js/components/library/ownedCollectionsStore.es6 @@ -7,7 +7,7 @@ import {isOnLibraryRoute} from './libraryUtils'; import {ASSET_TYPES} from 'js/constants'; const ownedCollectionsStore = Reflux.createStore({ - isVirgin: true, + isInitialised: false, data: { isFetchingData: false, @@ -33,7 +33,7 @@ const ownedCollectionsStore = Reflux.createStore({ startupStore() { if ( - this.isVirgin && + !this.isInitialised && isOnLibraryRoute() && stores.session.currentAccount !== undefined && !this.data.isFetchingData @@ -47,7 +47,7 @@ const ownedCollectionsStore = Reflux.createStore({ onGetCollectionsCompleted(response) { this.data.collections = response.results; this.data.isFetchingData = false; - this.isVirgin = false; + this.isInitialised = true; this.trigger(this.data); }, diff --git a/jsapp/js/components/library/publicCollectionsStore.es6 b/jsapp/js/components/library/publicCollectionsStore.es6 index 66bcd1d868..c3cf363e14 100644 --- a/jsapp/js/components/library/publicCollectionsStore.es6 +++ b/jsapp/js/components/library/publicCollectionsStore.es6 @@ -28,7 +28,7 @@ const publicCollectionsStore = Reflux.createStore({ PAGE_SIZE: 100, DEFAULT_ORDER_COLUMN: ASSETS_TABLE_COLUMNS['date-modified'], - isVirgin: true, + isInitialised: false, data: { isFetchingData: false, @@ -66,7 +66,7 @@ const publicCollectionsStore = Reflux.createStore({ * otherwise wait until route changes to a library (see `onRouteChange`) */ startupStore() { - if (this.isVirgin && isOnPublicCollectionsRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnPublicCollectionsRoute() && !this.data.isFetchingData) { this.fetchData(true); } }, @@ -129,7 +129,7 @@ const publicCollectionsStore = Reflux.createStore({ }, onRouteChange(data) { - if (this.isVirgin && isOnPublicCollectionsRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnPublicCollectionsRoute() && !this.data.isFetchingData) { this.fetchData(true); } else if ( this.previousPath.startsWith(ROUTES.PUBLIC_COLLECTIONS) === false && @@ -172,7 +172,7 @@ const publicCollectionsStore = Reflux.createStore({ } this.data.totalSearchAssets = response.count; this.data.isFetchingData = false; - this.isVirgin = false; + this.isInitialised = true; this.trigger(this.data); }, diff --git a/jsapp/js/components/library/singleCollectionStore.es6 b/jsapp/js/components/library/singleCollectionStore.es6 index 308ce1f7c4..3e46498349 100644 --- a/jsapp/js/components/library/singleCollectionStore.es6 +++ b/jsapp/js/components/library/singleCollectionStore.es6 @@ -26,7 +26,7 @@ const singleCollectionStore = Reflux.createStore({ PAGE_SIZE: 100, DEFAULT_ORDER_COLUMN: ASSETS_TABLE_COLUMNS['date-modified'], - isVirgin: true, + isInitialised: false, data: { isFetchingData: false, @@ -65,7 +65,7 @@ const singleCollectionStore = Reflux.createStore({ * otherwise wait until route changes to a library (see `onRouteChange`) */ startupStore() { - if (this.isVirgin && isOnLibraryAssetRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnLibraryAssetRoute() && !this.data.isFetchingData) { this.fetchData(true); } }, @@ -134,7 +134,7 @@ const singleCollectionStore = Reflux.createStore({ }, onRouteChange(data) { - if (this.isVirgin && isOnLibraryAssetRoute() && !this.data.isFetchingData) { + if (!this.isInitialised && isOnLibraryAssetRoute() && !this.data.isFetchingData) { this.fetchData(true); } else if ( ( @@ -173,7 +173,7 @@ const singleCollectionStore = Reflux.createStore({ this.data.totalUserAssets = this.data.totalSearchAssets; } this.data.isFetchingData = false; - this.isVirgin = false; + this.isInitialised = true; this.trigger(this.data); }, From 86f9ce4cc9c0ad0da8eec8115671025f5cb9c086 Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Wed, 24 Mar 2021 23:49:50 +0000 Subject: [PATCH 2/2] clear selected defined export on any form changes (include few missing inputs) --- .../projectDownloads/projectExportsCreator.es6 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/jsapp/js/components/projectDownloads/projectExportsCreator.es6 b/jsapp/js/components/projectDownloads/projectExportsCreator.es6 index 0ee22d755d..58bb5e9fbc 100644 --- a/jsapp/js/components/projectDownloads/projectExportsCreator.es6 +++ b/jsapp/js/components/projectDownloads/projectExportsCreator.es6 @@ -278,10 +278,10 @@ export default class ProjectExportsCreator extends React.Component { } onAnyInputChange(statePropName, newValue) { + this.clearSelectedDefinedExport(); const newStateObj = {}; newStateObj[statePropName] = newValue; this.setState(newStateObj); - this.clearSelectedDefinedExport(); } onSelectedExportTypeChange(newValue) { @@ -290,6 +290,7 @@ export default class ProjectExportsCreator extends React.Component { } onSelectedRowsChange(newRowsArray) { + this.clearSelectedDefinedExport(); const newSelectedRows = new Set(); newRowsArray.forEach((item) => { if (item.checked) { @@ -301,11 +302,13 @@ export default class ProjectExportsCreator extends React.Component { selectAllRows(evt) { evt.preventDefault(); + this.clearSelectedDefinedExport(); this.setState({selectedRows: new Set(this.getAllSelectableRows())}); } clearSelectedRows(evt) { evt.preventDefault(); + this.clearSelectedDefinedExport(); this.setState({selectedRows: new Set()}); } @@ -392,7 +395,8 @@ export default class ProjectExportsCreator extends React.Component { payload.name = this.state.customExportName || this.generateExportName(); } - // unless custom selection is enabled, we send empty fields (it means "all fields" for backend) + // unless custom selection is enabled, we send empty fields (it means "all + // fields" for backend); otherwise we send the selected rows if (this.state.isCustomSelectionEnabled) { payload.export_settings.fields = Array.from(this.state.selectedRows); } @@ -603,7 +607,10 @@ export default class ProjectExportsCreator extends React.Component { /> {t('Select all')} @@ -612,7 +619,10 @@ export default class ProjectExportsCreator extends React.Component { {t('Deselect all')}