feat: add change user-config
This commit is contained in:
		| @@ -19,6 +19,7 @@ import { isEmpty, pick } from 'lodash-es'; | ||||
| import { usePermissionModal } from '@kevisual/resources/index.ts'; | ||||
| import React from 'react'; | ||||
| import { queryLogin } from '@/modules'; | ||||
| import { useLayoutStore } from '@/modules/layout/store'; | ||||
| type DataYamlEditProps = { | ||||
|   onSave: (data: any) => Promise<void>; | ||||
|   type?: 'yaml' | 'json'; | ||||
| @@ -190,14 +191,11 @@ export const DrawerEdit = () => { | ||||
| export const List = () => { | ||||
|   const { list, getConfigList, setShowEdit, setFormData, deleteConfig, updateData, formData, detectConfig, onOpenKey } = useConfigStore(); | ||||
|   const [modal, contextHolder] = useModal(); | ||||
|   const [isAdmin, setIsAdmin] = useState<boolean>(false); | ||||
|   const isAdmin = useLayoutStore(useShallow((state) => state.isAdmin)); | ||||
|   useEffect(() => { | ||||
|     getConfigList(); | ||||
|     queryLogin.cacheStore.getCurrentUser().then((res) => { | ||||
|       const org = res?.orgs || []; | ||||
|       setIsAdmin(org.includes('admin')); | ||||
|     }); | ||||
|   }, []); | ||||
|  | ||||
|   const { setOpen, contextHolder: contextHolderPermission } = usePermissionModal({ | ||||
|     onSave: async (values) => { | ||||
|       const permission = values; | ||||
| @@ -253,17 +251,30 @@ export const List = () => { | ||||
|               {t('Upload Config')} | ||||
|             </Button> | ||||
|           </Tooltip> | ||||
|           <Tooltip title={t('Workspace Config Tips')}> | ||||
|           <Tooltip title={t('User Config Tips')}> | ||||
|             <Button | ||||
|               variant='contained' | ||||
|               color='primary' | ||||
|               size='small' | ||||
|               onClick={() => { | ||||
|                 onOpenKey('workspace.json'); | ||||
|                 onOpenKey('user.json'); | ||||
|               }}> | ||||
|               {t('Workspace Config')} | ||||
|               {t('User Config')} | ||||
|             </Button> | ||||
|           </Tooltip> | ||||
|           {isAdmin && ( | ||||
|             <Tooltip title={t('Workspace Config Tips')}> | ||||
|               <Button | ||||
|                 variant='contained' | ||||
|                 color='primary' | ||||
|                 size='small' | ||||
|                 onClick={() => { | ||||
|                   onOpenKey('workspace.json'); | ||||
|                 }}> | ||||
|                 {t('Workspace Config')} | ||||
|               </Button> | ||||
|             </Tooltip> | ||||
|           )} | ||||
|           {isAdmin && ( | ||||
|             <Tooltip title={t('VIP Config Tips')}> | ||||
|               <Button | ||||
|   | ||||
		Reference in New Issue
	
	Block a user