fix: frontend permission check (#784)

This commit is contained in:
Matri
2023-08-15 13:35:47 +08:00
committed by GitHub
parent 440cf63317
commit 2c77a74c40
19 changed files with 186 additions and 74 deletions

View File

@@ -8,6 +8,7 @@ import Indicator from '../indicator'
import type { AppDetailResponse } from '@/models/app'
import NewAppDialog from '@/app/(commonLayout)/apps/NewAppDialog'
import AppIcon from '@/app/components/base/app-icon'
import { useAppContext } from '@/context/app-context'
type IAppSelectorProps = {
appItems: AppDetailResponse[]
@@ -16,6 +17,7 @@ type IAppSelectorProps = {
export default function AppSelector({ appItems, curApp }: IAppSelectorProps) {
const router = useRouter()
const { isCurrentWorkspaceManager } = useAppContext()
const [showNewAppDialog, setShowNewAppDialog] = useState(false)
const { t } = useTranslation()
@@ -77,7 +79,7 @@ export default function AppSelector({ appItems, curApp }: IAppSelectorProps) {
))
}
</div>)}
<Menu.Item>
{isCurrentWorkspaceManager && <Menu.Item>
<div className='p-1' onClick={() => setShowNewAppDialog(true)}>
<div
className='flex items-center h-12 rounded-lg cursor-pointer hover:bg-gray-100'
@@ -95,6 +97,7 @@ export default function AppSelector({ appItems, curApp }: IAppSelectorProps) {
</div>
</div>
</Menu.Item>
}
</Menu.Items>
</Transition>
</Menu>