mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
perf: app list permission (#3023)
* perf: app list permission * perf: create dataset tip
This commit is contained in:
@@ -117,6 +117,7 @@ async function handler(req: ApiRequestProps<ListAppBody>): Promise<AppListItemTy
|
||||
}).lean()
|
||||
]);
|
||||
|
||||
// Filter apps by permission
|
||||
const filterApps = myApps
|
||||
.map((app) => {
|
||||
const { Per, privateApp } = (() => {
|
||||
@@ -124,20 +125,21 @@ async function handler(req: ApiRequestProps<ListAppBody>): Promise<AppListItemTy
|
||||
(item) =>
|
||||
String(item.tmbId) === String(tmbId) || myGroupIds.includes(String(item.groupId))
|
||||
);
|
||||
const getPer = (id: string) => {
|
||||
const getPer = (appId: string) => {
|
||||
const tmbPer = myPerList.find(
|
||||
(item) => String(item.resourceId) === id && !!item.tmbId
|
||||
(item) => String(item.resourceId) === appId && !!item.tmbId
|
||||
)?.permission;
|
||||
const groupPer = getGroupPer(
|
||||
myPerList
|
||||
.filter(
|
||||
(item) =>
|
||||
String(item.resourceId) === id && myGroupIds.includes(String(item.groupId))
|
||||
String(item.resourceId) === appId && myGroupIds.includes(String(item.groupId))
|
||||
)
|
||||
.map((item) => item.permission)
|
||||
);
|
||||
|
||||
const clbCount = perList.filter((item) => String(item.resourceId) === id).length;
|
||||
// Count app collaborators
|
||||
const clbCount = perList.filter((item) => String(item.resourceId) === appId).length;
|
||||
|
||||
return {
|
||||
Per: new AppPermission({
|
||||
|
@@ -108,20 +108,20 @@ async function handler(req: ApiRequestProps<GetDatasetListBody>) {
|
||||
String(item.tmbId) === String(tmbId) || myGroupIds.includes(String(item.groupId))
|
||||
);
|
||||
|
||||
const getPer = (id: string) => {
|
||||
const getPer = (datasetId: string) => {
|
||||
const tmbPer = myPerList.find(
|
||||
(item) => String(item.resourceId) === id && !!item.tmbId
|
||||
(item) => String(item.resourceId) === datasetId && !!item.tmbId
|
||||
)?.permission;
|
||||
const groupPer = getGroupPer(
|
||||
myPerList
|
||||
.filter(
|
||||
(item) =>
|
||||
String(item.resourceId) === id && myGroupIds.includes(String(item.groupId))
|
||||
String(item.resourceId) === datasetId && myGroupIds.includes(String(item.groupId))
|
||||
)
|
||||
.map((item) => item.permission)
|
||||
);
|
||||
|
||||
const clbCount = perList.filter((item) => String(item.resourceId) === id).length;
|
||||
const clbCount = perList.filter((item) => String(item.resourceId) === datasetId).length;
|
||||
|
||||
return {
|
||||
Per: new DatasetPermission({
|
||||
|
@@ -157,19 +157,19 @@ const Dataset = () => {
|
||||
icon: 'core/dataset/commonDatasetColor',
|
||||
label: t('dataset:common_dataset'),
|
||||
description: t('dataset:common_dataset_desc'),
|
||||
onClick: () => setCreateDatasetType(DatasetTypeEnum.dataset)
|
||||
onClick: () => onSelectDatasetType(DatasetTypeEnum.dataset)
|
||||
},
|
||||
{
|
||||
icon: 'core/dataset/websiteDatasetColor',
|
||||
label: t('dataset:website_dataset'),
|
||||
description: t('dataset:website_dataset_desc'),
|
||||
onClick: () => setCreateDatasetType(DatasetTypeEnum.websiteDataset)
|
||||
onClick: () => onSelectDatasetType(DatasetTypeEnum.websiteDataset)
|
||||
},
|
||||
{
|
||||
icon: 'core/dataset/externalDatasetColor',
|
||||
label: t('dataset:external_file'),
|
||||
description: t('dataset:external_file_dataset_desc'),
|
||||
onClick: () => setCreateDatasetType(DatasetTypeEnum.externalFile)
|
||||
onClick: () => onSelectDatasetType(DatasetTypeEnum.externalFile)
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Reference in New Issue
Block a user