diff --git a/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContent.js b/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContent.js index 9a6aee4b66..e494a41d96 100644 --- a/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContent.js +++ b/packages/client/src/pages/Home/Section/Body/RowsView/FilesRowContent.js @@ -39,7 +39,6 @@ import { import { Link } from "@docspace/shared/components/link"; import { Text } from "@docspace/shared/components/text"; import { RowContent } from "@docspace/shared/components/row-content"; -import { RoomsType } from "@docspace/shared/enums"; import withContent from "../../../../../HOCs/withContent"; @@ -217,7 +216,7 @@ const FilesRowContent = ({ isDefaultRoomsQuotaSet, isStatisticsAvailable, showStorageInfo, - isVirtualDataRoom, + isIndexing, }) => { const { contentLength, @@ -326,7 +325,7 @@ const FilesRowContent = ({ {!isRoom && !isRooms && quickButtons} - {isVirtualDataRoom && ( + {isIndexing && ( { const { filter, roomsFilter } = filesStore; const { isRecycleBinFolder, isRoomsFolder, isArchiveFolder } = @@ -379,11 +378,7 @@ export default inject( const isRooms = isRoomsFolder || isArchiveFolder; const filterSortBy = isRooms ? roomsFilter.sortBy : filter.sortBy; - const { indexing, roomType } = selectedFolderStore; - - const isVirtualDataRoom = - window.location.pathname.includes("rooms/shared") && - roomType === RoomsType.VirtualDataRoom; + const { isIndexing } = indexingStore; const { isDefaultRoomsQuotaSet, isStatisticsAvailable, showStorageInfo } = currentQuotaStore; @@ -394,7 +389,7 @@ export default inject( isDefaultRoomsQuotaSet, isStatisticsAvailable, showStorageInfo, - isVirtualDataRoom, + isIndexing, }; }, )( diff --git a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js index be6eeb3f58..35944b6c9e 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/TableHeader.js @@ -26,7 +26,6 @@ import React from "react"; import { TableHeader } from "@docspace/shared/components/table"; -import { RoomsType } from "@docspace/shared/enums"; import { inject, observer } from "mobx-react"; import { withTranslation } from "react-i18next"; import { Events } from "@docspace/shared/enums"; @@ -56,9 +55,7 @@ class FilesTableHeader extends React.Component { isDefaultRoomsQuotaSet, showStorageInfo, isArchiveFolder, - indexing, - roomType, - isVirtualDataRoom, + isIndexing, } = this.props; const defaultColumns = []; @@ -362,7 +359,7 @@ class FilesTableHeader extends React.Component { defaultColumns.push(...columns); } - if (isVirtualDataRoom && indexing) { + if (isIndexing) { defaultColumns.unshift({ key: "Index", title: "#", @@ -566,8 +563,8 @@ class FilesTableHeader extends React.Component { isFrame, showSettings, - isVirtualDataRoom, - indexing, + isIndexing, + isIndexEditingMode, } = this.props; const { @@ -592,7 +589,8 @@ class FilesTableHeader extends React.Component { columnInfoPanelStorageName={columnInfoPanelStorageName} sectionWidth={sectionWidth} resetColumnsSize={resetColumnsSize} - sortingVisible={isVirtualDataRoom && indexing ? false : sortingVisible} + sortingVisible={isIndexing ? false : sortingVisible} + isIndexEditingMode={isIndexEditingMode} infoPanelVisible={infoPanelVisible} useReactWindow={!withPaging} tagRef={tagRef} @@ -615,12 +613,13 @@ export default inject( clientLoadingStore, infoPanelStore, currentQuotaStore, + indexingStore, }) => { const { isVisible: infoPanelVisible } = infoPanelStore; const { isDefaultRoomsQuotaSet, showStorageInfo } = currentQuotaStore; - const { indexing, roomType } = selectedFolderStore; + const { isIndexEditingMode, isIndexing } = indexingStore; const { isHeaderChecked, @@ -673,10 +672,6 @@ export default inject( const { isPublicRoom, publicRoomKey } = publicRoomStore; - const isVirtualDataRoom = - window.location.pathname.includes("rooms/shared") && - roomType === RoomsType.VirtualDataRoom; - return { setRoomsFilter, isHeaderChecked, @@ -685,8 +680,7 @@ export default inject( withContent, sortingVisible, - indexing, - roomType, + isIndexing, setIsLoading: clientLoadingStore.setIsSectionBodyLoading, @@ -730,7 +724,6 @@ export default inject( setColumnEnable, isTrashFolder, isPublicRoom, - isVirtualDataRoom, publicRoomKey, isFrame, @@ -740,6 +733,7 @@ export default inject( isDefaultRoomsQuotaSet, showStorageInfo, isArchiveFolder, + isIndexEditingMode, }; }, )( diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js index a89ce9fea4..a38486cfc6 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/RowData.js @@ -62,12 +62,12 @@ const RowDataComponent = (props) => { badgesComponent, quickButtonsComponent, - enableIndexing, + isIndexing, } = props; return ( <> - {indexColumnIsEnabled && enableIndexing && ( + {indexColumnIsEnabled && isIndexing && ( { ); }; -export default inject(({ tableStore, selectedFolderStore }) => { +export default inject(({ tableStore, indexingStore }) => { const { authorColumnIsEnabled, createdColumnIsEnabled, @@ -225,12 +225,7 @@ export default inject(({ tableStore, selectedFolderStore }) => { quickButtonsColumnIsEnabled, } = tableStore; - const { indexing, roomType } = selectedFolderStore; - - const enableIndexing = - window.location.pathname.includes("rooms/shared") && - roomType === RoomsType.VirtualDataRoom && - indexing; + const { isIndexing } = indexingStore; return { authorColumnIsEnabled, @@ -241,6 +236,6 @@ export default inject(({ tableStore, selectedFolderStore }) => { typeColumnIsEnabled, quickButtonsColumnIsEnabled, - enableIndexing, + isIndexing, }; })(observer(RowDataComponent)); diff --git a/packages/client/src/store/ContextOptionsStore.js b/packages/client/src/store/ContextOptionsStore.js index 9dce1a278d..754bcf7c44 100644 --- a/packages/client/src/store/ContextOptionsStore.js +++ b/packages/client/src/store/ContextOptionsStore.js @@ -1208,8 +1208,7 @@ class ContextOptionsStore { const isArchive = item.rootFolderType === FolderType.Archive; - const isVirtualDataRoom = - this.selectedFolderStore.roomType === RoomsType.VirtualDataRoom; + const { isIndexing } = this.indexingStore; const indexOptions = { id: "option_edit-index", @@ -1217,7 +1216,7 @@ class ContextOptionsStore { label: t("Common:EditIndex"), icon: EditIndexReactSvgUrl, onClick: () => this.onEditIndex(), - disabled: !isVirtualDataRoom, + disabled: !isIndexing, }; const optionsModel = [ diff --git a/packages/client/src/store/FilesStore.js b/packages/client/src/store/FilesStore.js index 7f4f8e91a9..e062eb315d 100644 --- a/packages/client/src/store/FilesStore.js +++ b/packages/client/src/store/FilesStore.js @@ -93,6 +93,7 @@ class FilesStore { publicRoomStore; settingsStore; currentQuotaStore; + indexingStore; pluginStore; @@ -197,6 +198,7 @@ class FilesStore { userStore, currentTariffStatusStore, settingsStore, + indexingStore, ) { const pathname = window.location.pathname.toLowerCase(); this.isEditor = pathname.indexOf("doceditor") !== -1; @@ -215,6 +217,7 @@ class FilesStore { this.infoPanelStore = infoPanelStore; this.currentTariffStatusStore = currentTariffStatusStore; this.settingsStore = settingsStore; + this.indexingStore = indexingStore; this.roomsController = new AbortController(); this.filesController = new AbortController(); @@ -1455,6 +1458,12 @@ class FilesStore { await this.publicRoomStore.getExternalLinks(data.current.id); } + if (data.current.indexing || data.current.order) { + this.indexingStore.setIsIndexing(true); + } else if (data.current.rootFolderId !== FolderType.COMMON) { + this.indexingStore.setIsIndexing(false); + } + if (data.current?.indexing && filterData.sortBy !== "customOrder") { filterData.sortBy = "customOrder"; return window.DocSpace.navigate( @@ -1707,6 +1716,9 @@ class FilesStore { withFilterLocalStorage = false, ) => { const { setSelectedNode, roomsFolderId } = this.treeFoldersStore; + const { setIsIndexing, isIndexing } = this.indexingStore; + + if (isIndexing) setIsIndexing(false); if (this.clientLoadingStore.isLoading) { this.filesController.abort(); diff --git a/packages/client/src/store/IndexingStore.js b/packages/client/src/store/IndexingStore.js index f503f73012..713bbefc20 100644 --- a/packages/client/src/store/IndexingStore.js +++ b/packages/client/src/store/IndexingStore.js @@ -30,15 +30,16 @@ class IndexingStore { selectedFolderStore; isIndexEditingMode = false; + isIndexing = false; constructor(selectedFolderStore) { this.selectedFolderStore = selectedFolderStore; makeAutoObservable(this); } - get isIndexing() { - return this.selectedFolderStore?.indexing; - } + setIsIndexing = (indexing) => { + this.isIndexing = indexing; + }; setIsIndexEditingMode = (mode) => { this.isIndexEditingMode = mode; diff --git a/packages/client/src/store/TableStore.js b/packages/client/src/store/TableStore.js index 8bdd0096cc..a8c8101391 100644 --- a/packages/client/src/store/TableStore.js +++ b/packages/client/src/store/TableStore.js @@ -99,7 +99,7 @@ class TableStore { treeFoldersStore, userStore, settingsStore, - selectedFolderStore, + indexingStore, ) { makeAutoObservable(this); @@ -107,7 +107,7 @@ class TableStore { this.treeFoldersStore = treeFoldersStore; this.userStore = userStore; this.settingsStore = settingsStore; - this.selectedFolderStore = selectedFolderStore; + this.indexingStore = indexingStore; } setRoomColumnType = (enable) => { @@ -412,7 +412,7 @@ class TableStore { getIsAccountsInsideGroup, } = this.treeFoldersStore; - const { indexing, roomType } = this.selectedFolderStore; + const { isIndexing } = this.indexingStore; const isRooms = isRoomsFolder || isArchiveFolder; const userId = this.userStore.user?.id; const isFrame = this.settingsStore.isFrame; @@ -431,7 +431,7 @@ class TableStore { ? `${TABLE_TRASH_COLUMNS}=${userId}` : isRecentTab ? `${TABLE_RECENT_COLUMNS}=${userId}` - : indexing && roomType === RoomsType.VirtualDataRoom + : isIndexing ? `${TABLE_VDR_INDEXING_COLUMNS}=${userId}` : `${TABLE_COLUMNS}=${userId}`; } @@ -439,7 +439,7 @@ class TableStore { get columnStorageName() { const { isRoomsFolder, isArchiveFolder, isTrashFolder, isRecentTab } = this.treeFoldersStore; - const { indexing, roomType } = this.selectedFolderStore; + const { isIndexing } = this.indexingStore; const isRooms = isRoomsFolder || isArchiveFolder; const userId = this.userStore.user?.id; const isFrame = this.settingsStore.isFrame; @@ -452,7 +452,7 @@ class TableStore { ? `${COLUMNS_TRASH_SIZE}=${userId}` : isRecentTab ? `${COLUMNS_RECENT_SIZE}=${userId}` - : indexing && roomType === RoomsType.VirtualDataRoom + : isIndexing ? `${COLUMNS_VDR_INDEXING_SIZE}=${userId}` : `${COLUMNS_SIZE}=${userId}`; } diff --git a/packages/client/src/store/index.js b/packages/client/src/store/index.js index 7482af8ba9..afeb9bcd2c 100644 --- a/packages/client/src/store/index.js +++ b/packages/client/src/store/index.js @@ -151,6 +151,7 @@ const filesStore = new FilesStore( userStore, currentTariffStatusStore, settingsStore, + indexingStore, ); const mediaViewerDataStore = new MediaViewerDataStore( @@ -264,7 +265,7 @@ const tableStore = new TableStore( treeFoldersStore, userStore, settingsStore, - selectedFolderStore, + indexingStore, ); infoPanelStore.filesSettingsStore = filesSettingsStore;