feat: 优化config
This commit is contained in:
parent
1d97ff88b9
commit
cbbb48af97
@ -70,5 +70,6 @@
|
|||||||
"usernames": "Usernames",
|
"usernames": "Usernames",
|
||||||
"content-type": "Content Type",
|
"content-type": "Content Type",
|
||||||
"app-source": "App Source",
|
"app-source": "App Source",
|
||||||
"app-version": "App Version"
|
"app-version": "App Version",
|
||||||
|
"Detect": "Detect"
|
||||||
}
|
}
|
@ -70,5 +70,6 @@
|
|||||||
"usernames": "用户名",
|
"usernames": "用户名",
|
||||||
"content-type": "内容类型",
|
"content-type": "内容类型",
|
||||||
"app-source": "应用来源",
|
"app-source": "应用来源",
|
||||||
"app-version": "应用版本"
|
"app-version": "应用版本",
|
||||||
|
"Detect": "检测"
|
||||||
}
|
}
|
@ -36,11 +36,6 @@ export const LayoutMenu = () => {
|
|||||||
icon: <CodeOutlined />,
|
icon: <CodeOutlined />,
|
||||||
link: '/container/edit/list',
|
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('Config'), icon: <Settings size={16} />, link: '/config/edit/list' },
|
||||||
{
|
{
|
||||||
title: t('About'),
|
title: t('About'),
|
||||||
|
@ -188,7 +188,7 @@ export const MyController = React.forwardRef(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
export const List = () => {
|
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();
|
const [modal, contextHolder] = useModal();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getConfig();
|
getConfig();
|
||||||
@ -221,8 +221,22 @@ export const List = () => {
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className=' grow p-4 '>
|
<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 '>
|
<div className='flex flex-wrap gap-2 '>
|
||||||
{list.map((item) => (
|
{list.map((item) => (
|
||||||
<div className='card w-[300px] ' key={item.id}>
|
<div className='card w-[300px] ' key={item.id}>
|
||||||
@ -237,7 +251,7 @@ export const List = () => {
|
|||||||
<div>{item.key}</div>
|
<div>{item.key}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='card-footer flex justify-end'>
|
<div className='card-footer flex justify-end mt-1'>
|
||||||
<ButtonGroup variant='contained'>
|
<ButtonGroup variant='contained'>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -14,6 +14,7 @@ interface ConfigStore {
|
|||||||
formData: any;
|
formData: any;
|
||||||
setFormData: (formData: any) => void;
|
setFormData: (formData: any) => void;
|
||||||
deleteConfig: (id: string) => Promise<void>;
|
deleteConfig: (id: string) => Promise<void>;
|
||||||
|
detectConfig: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useConfigStore = create<ConfigStore>((set, get) => ({
|
export const useConfigStore = create<ConfigStore>((set, get) => ({
|
||||||
@ -50,4 +51,14 @@ export const useConfigStore = create<ConfigStore>((set, get) => ({
|
|||||||
toast.error('删除失败');
|
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
|
Loading…
x
Reference in New Issue
Block a user