feat: 优化config

This commit is contained in:
xion 2025-03-23 04:02:03 +08:00
parent 1d97ff88b9
commit cbbb48af97
6 changed files with 33 additions and 11 deletions

View File

@ -70,5 +70,6 @@
"usernames": "Usernames",
"content-type": "Content Type",
"app-source": "App Source",
"app-version": "App Version"
"app-version": "App Version",
"Detect": "Detect"
}

View File

@ -70,5 +70,6 @@
"usernames": "用户名",
"content-type": "内容类型",
"app-source": "应用来源",
"app-version": "应用版本"
"app-version": "应用版本",
"Detect": "检测"
}

View File

@ -36,11 +36,6 @@ export const LayoutMenu = () => {
icon: <CodeOutlined />,
link: '/container/edit/list',
},
{
title: t('Org'),
icon: <SwitcherOutlined />,
link: '/org/edit/list',
},
{ title: t('Config'), icon: <Settings size={16} />, link: '/config/edit/list' },
{
title: t('About'),

View File

@ -188,7 +188,7 @@ export const MyController = React.forwardRef(
},
);
export const List = () => {
const { list, getConfig, setShowEdit, setFormData, deleteConfig, updateData, formData } = useConfigStore();
const { list, getConfig, setShowEdit, setFormData, deleteConfig, updateData, formData, detectConfig } = useConfigStore();
const [modal, contextHolder] = useModal();
useEffect(() => {
getConfig();
@ -221,8 +221,22 @@ export const List = () => {
</IconButton>
</div>
</div>
<div className=' grow p-4 '>
<div className='w-full h-full bg-white rounded-lg p-2 scrollbar '>
<div className='flex pb-4 gap-4'>
<Tooltip title={t('从config的json的配置的数据同步过来。')}>
<Button
variant='contained'
color='primary'
size='small'
onClick={() => {
detectConfig();
}}>
{t('Detect')}
</Button>
</Tooltip>
</div>
<div className='w-full bg-white rounded-lg p-2 scrollbar ' style={{ height: 'calc(100% - 80px)' }}>
<div className='flex flex-wrap gap-2 '>
{list.map((item) => (
<div className='card w-[300px] ' key={item.id}>
@ -237,7 +251,7 @@ export const List = () => {
<div>{item.key}</div>
</div>
</div>
<div className='card-footer flex justify-end'>
<div className='card-footer flex justify-end mt-1'>
<ButtonGroup variant='contained'>
<Button
onClick={() => {

View File

@ -14,6 +14,7 @@ interface ConfigStore {
formData: any;
setFormData: (formData: any) => void;
deleteConfig: (id: string) => Promise<void>;
detectConfig: () => Promise<void>;
}
export const useConfigStore = create<ConfigStore>((set, get) => ({
@ -50,4 +51,14 @@ export const useConfigStore = create<ConfigStore>((set, get) => ({
toast.error('删除失败');
}
},
detectConfig: async () => {
const res = await queryConfig.detectConfig();
if (res.code === 200) {
const data = res?.data?.updateList || [];
console.log(data);
toast.success('检测成功');
} else {
toast.error('检测失败');
}
},
}));

@ -1 +1 @@
Subproject commit f993b2466ec4680a0a6ef044ad524130a4c24c0a
Subproject commit 93cd7cf979b4a695bb582fb5eb490a10f51746c8