Web:Role Added file updates

This commit is contained in:
Akmal Isomadinov 2023-09-21 13:29:21 +05:00
parent 295e8957a4
commit 3f90404c5f
2 changed files with 24 additions and 1 deletions

View File

@ -55,6 +55,7 @@ class FilesStore {
filesSettingsStore;
thirdPartyStore;
clientLoadingStore;
roleStore;
/**
* @type {DashboardStore}
@ -1377,6 +1378,13 @@ class FilesStore {
return this.dashboardStore.refreshDashboard(this.selectedFolderStore.id);
}
if (this.selectedFolderStore.isRolePage) {
return this.roleStore?.refreshRole(
this.selectedFolderStore.id,
this.filter
);
}
const res = await this.fetchFiles(this.selectedFolderStore.id, this.filter);
return res;
};

View File

@ -1,3 +1,5 @@
import { makeAutoObservable } from "mobx";
import api from "@docspace/common/api";
import RoleFilter from "@docspace/common/api/files/roleFilter";
@ -15,13 +17,18 @@ import type DashboardStore from "./DashboardStore";
import type FilesStore from "./FilesStore";
class RoleStore {
private boardId?: string;
public role?: IRole;
constructor(
private filesStore: FilesStore,
private dashboardStore: DashboardStore,
private dashboardContextOptionStore: DashboardContextOptionStore
) {}
) {
makeAutoObservable(this);
filesStore.roleStore = this;
}
private resetState = (): void => {
const { setFolders, setBoards, setSelection, setSelected } =
@ -102,6 +109,12 @@ class RoleStore {
this.role = this.dashboardStore.convertToRole(role);
};
public refreshRole = (roleId: string, filter: RoleFilter) => {
if (!this.boardId) return;
return this.getRole(this.boardId, roleId, filter);
};
public getRoleHeaderContextMenu = (t: (arg: string) => string) => {
if (!this.role) return [];
@ -115,6 +128,8 @@ class RoleStore {
try {
const filterData = filter.clone();
this.boardId = boardId;
filterData.page = 0;
filterData.pageCount = 100;