Skip to content

Commit

Permalink
fix: create btn permission (#3233)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Nov 25, 2024
1 parent 2b1f6f1 commit f05b849
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 60 deletions.
119 changes: 60 additions & 59 deletions projects/app/src/pages/app/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,66 +179,67 @@ const MyApps = () => {

{isPc && RenderSearchInput}

{userInfo?.team.permission.hasWritePer &&
folderDetail?.type !== AppTypeEnum.httpPlugin && (
<MyMenu
size="md"
Button={
<Button variant={'primary'} leftIcon={<AddIcon />}>
<Box>{t('common:common.Create New')}</Box>
</Button>
{(folderDetail
? folderDetail.permission.hasWritePer && folderDetail?.type !== AppTypeEnum.httpPlugin
: userInfo?.team.permission.hasWritePer) && (
<MyMenu
size="md"
Button={
<Button variant={'primary'} leftIcon={<AddIcon />}>
<Box>{t('common:common.Create New')}</Box>
</Button>
}
menuList={[
{
children: [
{
icon: 'core/app/simpleBot',
label: t('app:type.Simple bot'),
description: t('app:type.Create simple bot tip'),
onClick: () => setCreateAppType(AppTypeEnum.simple)
},
{
icon: 'core/app/type/workflowFill',
label: t('app:type.Workflow bot'),
description: t('app:type.Create workflow tip'),
onClick: () => setCreateAppType(AppTypeEnum.workflow)
},
{
icon: 'core/app/type/pluginFill',
label: t('app:type.Plugin'),
description: t('app:type.Create one plugin tip'),
onClick: () => setCreateAppType(AppTypeEnum.plugin)
},
{
icon: 'core/app/type/httpPluginFill',
label: t('app:type.Http plugin'),
description: t('app:type.Create http plugin tip'),
onClick: onOpenCreateHttpPlugin
}
]
},
{
children: [
{
icon: '/imgs/app/templateFill.svg',
label: t('app:template_market'),
description: t('app:template_market_description'),
onClick: () => setTemplateModalType('all')
}
]
},
{
children: [
{
icon: FolderIcon,
label: t('common:Folder'),
onClick: () => setEditFolder({})
}
]
}
menuList={[
{
children: [
{
icon: 'core/app/simpleBot',
label: t('app:type.Simple bot'),
description: t('app:type.Create simple bot tip'),
onClick: () => setCreateAppType(AppTypeEnum.simple)
},
{
icon: 'core/app/type/workflowFill',
label: t('app:type.Workflow bot'),
description: t('app:type.Create workflow tip'),
onClick: () => setCreateAppType(AppTypeEnum.workflow)
},
{
icon: 'core/app/type/pluginFill',
label: t('app:type.Plugin'),
description: t('app:type.Create one plugin tip'),
onClick: () => setCreateAppType(AppTypeEnum.plugin)
},
{
icon: 'core/app/type/httpPluginFill',
label: t('app:type.Http plugin'),
description: t('app:type.Create http plugin tip'),
onClick: onOpenCreateHttpPlugin
}
]
},
{
children: [
{
icon: '/imgs/app/templateFill.svg',
label: t('app:template_market'),
description: t('app:template_market_description'),
onClick: () => setTemplateModalType('all')
}
]
},
{
children: [
{
icon: FolderIcon,
label: t('common:Folder'),
onClick: () => setEditFolder({})
}
]
}
]}
/>
)}
]}
/>
)}
</Flex>

{!isPc && <Box mt={2}>{RenderSearchInput}</Box>}
Expand Down
4 changes: 3 additions & 1 deletion projects/app/src/pages/dataset/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ const Dataset = () => {

{isPc && RenderSearchInput}

{userInfo?.team?.permission.hasWritePer && (
{(folderDetail
? folderDetail.permission.hasWritePer
: userInfo?.team?.permission.hasWritePer) && (
<Box pl={[0, 4]}>
<MyMenu
size="md"
Expand Down

0 comments on commit f05b849

Please sign in to comment.