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; filesSettingsStore;
thirdPartyStore; thirdPartyStore;
clientLoadingStore; clientLoadingStore;
roleStore;
/** /**
* @type {DashboardStore} * @type {DashboardStore}
@ -1377,6 +1378,13 @@ class FilesStore {
return this.dashboardStore.refreshDashboard(this.selectedFolderStore.id); 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); const res = await this.fetchFiles(this.selectedFolderStore.id, this.filter);
return res; return res;
}; };

View File

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