Client: added indexing in nested structures

This commit is contained in:
Dmitry Sychugov 2024-05-16 18:39:46 +05:00
parent 5be75c1745
commit 75abe1a629
8 changed files with 46 additions and 49 deletions

View File

@ -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}
</div>
{isVirtualDataRoom && (
{isIndexing && (
<Text
containerMinWidth="200px"
containerWidth="15%"
@ -370,7 +369,7 @@ export default inject(
settingsStore,
treeFoldersStore,
filesStore,
selectedFolderStore,
indexingStore,
}) => {
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,
};
},
)(

View File

@ -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,
};
},
)(

View File

@ -62,12 +62,12 @@ const RowDataComponent = (props) => {
badgesComponent,
quickButtonsComponent,
enableIndexing,
isIndexing,
} = props;
return (
<>
{indexColumnIsEnabled && enableIndexing && (
{indexColumnIsEnabled && isIndexing && (
<TableCell
className={classNames(
selectionProp?.className,
@ -214,7 +214,7 @@ const RowDataComponent = (props) => {
);
};
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));

View File

@ -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 = [

View File

@ -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();

View File

@ -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;

View File

@ -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}`;
}

View File

@ -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;