update resources
This commit is contained in:
@@ -31,28 +31,6 @@ export const LayoutUser = () => {
|
||||
}, []);
|
||||
const navigate = useNewNavigate();
|
||||
const { t } = useTranslation();
|
||||
const meun = [
|
||||
{
|
||||
title: t('Your profile'),
|
||||
icon: <SquareUser size={16} />,
|
||||
link: '/user/profile',
|
||||
},
|
||||
{
|
||||
title: t('Your orgs'),
|
||||
icon: <SwitcherOutlined />,
|
||||
link: '/org/edit/list',
|
||||
},
|
||||
{
|
||||
title: t('Site Map'),
|
||||
icon: <Map size={16} />,
|
||||
link: '/map',
|
||||
},
|
||||
{
|
||||
title: t('Domain'),
|
||||
icon: <ArrowDownLeftFromSquareIcon size={16} />,
|
||||
link: '/domain/edit/list',
|
||||
},
|
||||
];
|
||||
const items = useMemo(() => {
|
||||
const orgs = store.me?.orgs || [];
|
||||
return orgs.map((item) => {
|
||||
@@ -63,7 +41,43 @@ export const LayoutUser = () => {
|
||||
};
|
||||
});
|
||||
}, [store.me]);
|
||||
|
||||
const menu = useMemo(() => {
|
||||
const orgs = store.me?.orgs || [];
|
||||
const hasOrg = orgs.length > 0;
|
||||
const items = [
|
||||
{
|
||||
title: t('Your profile'),
|
||||
icon: <SquareUser size={16} />,
|
||||
link: '/user/profile',
|
||||
},
|
||||
{
|
||||
title: t('Your orgs'),
|
||||
icon: <SwitcherOutlined />,
|
||||
link: '/org/edit/list',
|
||||
isOrg: true,
|
||||
},
|
||||
{
|
||||
title: t('Site Map'),
|
||||
icon: <Map size={16} />,
|
||||
link: '/map',
|
||||
},
|
||||
{
|
||||
title: t('Domain'),
|
||||
icon: <ArrowDownLeftFromSquareIcon size={16} />,
|
||||
link: '/domain/edit/list',
|
||||
isAdmin: true,
|
||||
},
|
||||
];
|
||||
return items.filter((item) => {
|
||||
if (item.isOrg) {
|
||||
return hasOrg;
|
||||
}
|
||||
if (item.isAdmin) {
|
||||
return isAdmin;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, [store.me]);
|
||||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
||||
|
||||
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
||||
@@ -101,7 +115,7 @@ export const LayoutUser = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className='mt-3 font-medium'>
|
||||
{meun.map((item, index) => {
|
||||
{menu.map((item, index) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
|
||||
@@ -88,11 +88,11 @@ const FormModal = () => {
|
||||
<DialogContent>
|
||||
<form className='flex flex-col gap-4 pt-2' onSubmit={handleSubmit(onFinish)}>
|
||||
<Controller name='title' control={control} render={({ field }) => <TextField {...defaultProps} {...field} label='title' />} />
|
||||
<Controller
|
||||
{/* <Controller
|
||||
name='domain'
|
||||
control={control}
|
||||
render={({ field }) => <TextField {...defaultProps} {...field} label='domain' variant='outlined' helperText='域名自定义绑定' />}
|
||||
/>
|
||||
/> */}
|
||||
<Controller name='key' control={control} render={({ field }) => <TextField {...defaultProps} {...field} label='key' fullWidth />} />
|
||||
<Controller
|
||||
name='description'
|
||||
@@ -277,6 +277,17 @@ export const List = () => {
|
||||
<CodeOutlined />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title='域名自定义绑定'>
|
||||
<IconButton
|
||||
sx={{
|
||||
padding: '8px',
|
||||
}}
|
||||
onClick={() => {
|
||||
message.info('联系管理员');
|
||||
}}>
|
||||
<LinkOutlined />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className='grow'>
|
||||
<div className='w-full h-full p-4'>
|
||||
@@ -307,9 +318,9 @@ export const List = () => {
|
||||
{item.id}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{item.domain && (
|
||||
{item?.data?.domain && (
|
||||
<div className='text-xs'>
|
||||
{t('app.domain')}: {item.domain}
|
||||
{t('app.domain')}: {item?.data?.domain}
|
||||
</div>
|
||||
)}
|
||||
<div className='text-xs'>
|
||||
|
||||
@@ -12,9 +12,10 @@ import UploadOutlined from '@ant-design/icons/lib/icons/UploadOutlined';
|
||||
import { Tooltip } from '@mui/material';
|
||||
import { useResourceFileStore } from '@kevisual/resources/pages/store/resource-file.ts';
|
||||
import { FileDrawerApp } from '@kevisual/resources/pages/file/draw/FileDrawer.tsx';
|
||||
import { RefreshCw, Upload } from 'lucide-react';
|
||||
import { Delete, FolderPlus, RefreshCw, Trash, Upload } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { UploadButton } from '@kevisual/resources/pages/upload/index.tsx';
|
||||
import { DialogDirectory, DialogDeleteDirectory } from '@kevisual/resources/pages/upload/DialogDirectory.tsx';
|
||||
export const CardPath = ({ children }: any) => {
|
||||
const userAppStore = useFileStore(
|
||||
useShallow((state) => {
|
||||
@@ -26,6 +27,8 @@ export const CardPath = ({ children }: any) => {
|
||||
};
|
||||
}),
|
||||
);
|
||||
const [dialogDirectory, setDialogDirectory] = useState(false);
|
||||
const [dialogDeleteDirectory, setDialogDeleteDirectory] = useState(false);
|
||||
const paths = ['root', ...userAppStore.path.split('/').filter((item) => item)];
|
||||
const onDirectoryClick = (prefix: string) => {
|
||||
if (prefix === 'root') {
|
||||
@@ -38,13 +41,14 @@ export const CardPath = ({ children }: any) => {
|
||||
};
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [usrname, appKey, version] = paths;
|
||||
const [_username, appKey, version, ...directory] = paths;
|
||||
const onUloadFinish = (res: any) => {
|
||||
console.log(res);
|
||||
userAppStore.getList();
|
||||
};
|
||||
const directoryPath = directory.join('/');
|
||||
return (
|
||||
<div className='border border-gray-200 rounded'>
|
||||
<div className='border border-gray-200 rounded h-full overflow-hidden'>
|
||||
<div className='p-2'>
|
||||
<div className='flex flex-col'>
|
||||
<div className='flex justify-between'>
|
||||
@@ -78,25 +82,81 @@ export const CardPath = ({ children }: any) => {
|
||||
<RefreshCw />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
{version && (
|
||||
<>
|
||||
<Tooltip title={t('create_directory')} placement='bottom'>
|
||||
<IconButton color='primary' onClick={() => setDialogDirectory(true)}>
|
||||
<FolderPlus />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DialogDirectory
|
||||
open={dialogDirectory}
|
||||
onClose={() => setDialogDirectory(false)}
|
||||
onSuccess={(newPrefix) => {
|
||||
const currentPath = appKey + '/' + version + '/' + newPrefix;
|
||||
onDirectoryClick(currentPath);
|
||||
setDialogDirectory(false);
|
||||
}}
|
||||
prefix={directoryPath}
|
||||
opts={{
|
||||
appKey,
|
||||
version,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{version && (
|
||||
<>
|
||||
<Tooltip title={t('uploadDirectory')} placement='bottom'>
|
||||
<IconButton color='primary'>
|
||||
<UploadButton onlyIcon uploadDirectory icon={<Upload />} appKey={appKey} version={version} username={usrname} onUpload={onUloadFinish} />
|
||||
<UploadButton
|
||||
onlyIcon
|
||||
uploadDirectory
|
||||
icon={<Upload />}
|
||||
directory={directoryPath}
|
||||
appKey={appKey}
|
||||
version={version}
|
||||
onUpload={onUloadFinish}
|
||||
/>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Tooltip title={t('upload')} placement='bottom'>
|
||||
<IconButton color='primary'>
|
||||
<UploadButton onlyIcon appKey={appKey} version={version} username={usrname} onUpload={onUloadFinish} />
|
||||
<UploadButton onlyIcon appKey={appKey} version={version} directory={directoryPath} onUpload={onUloadFinish} />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
)}
|
||||
{version && directoryPath && (
|
||||
<>
|
||||
<Tooltip title={t('deleteDirectory')} placement='bottom'>
|
||||
<IconButton
|
||||
color='primary'
|
||||
onClick={() => {
|
||||
setDialogDeleteDirectory(true);
|
||||
}}>
|
||||
<Trash />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<DialogDeleteDirectory
|
||||
open={dialogDeleteDirectory}
|
||||
onClose={() => setDialogDeleteDirectory(false)}
|
||||
onSuccess={(prefix) => {
|
||||
const newPrefix = prefix.split('/').slice(0, -1).join('/');
|
||||
setDialogDeleteDirectory(false);
|
||||
onDirectoryClick(newPrefix);
|
||||
}}
|
||||
prefix={appKey + '/' + version + '/' + directoryPath}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className=''>{children}</div>
|
||||
<div className='scrollbar' style={{ height: 'calc(100% - 20px)' }}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user