fix(ui): 统一表格筛选分页和用量明细,升级 ESLint
This commit is contained in:
@@ -18,10 +18,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Copy as ActionCopy } from '@/components/common/icons/ActionIcons';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React from 'react';
|
||||
import { Button as AntButton, Tooltip as AntTooltip } from 'antd';
|
||||
import { Button, Tag, Modal, Tooltip } from '@/components/ui';
|
||||
import { Button, Space, Tag, Modal, Tooltip } from '@/components/ui';
|
||||
import {
|
||||
timestamp2string,
|
||||
getLobeHubIcon,
|
||||
@@ -240,57 +239,64 @@ const renderOperations = (
|
||||
setDetailModel,
|
||||
) => {
|
||||
return (
|
||||
<TableRowActions
|
||||
items={
|
||||
isRoot()
|
||||
? [
|
||||
{
|
||||
key: 'toggle-status',
|
||||
label: record.status === 1 ? t('禁用') : t('启用'),
|
||||
onClick: () =>
|
||||
manageModel(
|
||||
record.id,
|
||||
record.status === 1 ? 'disable' : 'enable',
|
||||
record,
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
danger: true,
|
||||
onClick: () => {
|
||||
Modal.confirm({
|
||||
title: t('确定是否要删除此模型?'),
|
||||
content: t('此修改将不可逆'),
|
||||
onOk: () => {
|
||||
(async () => {
|
||||
await manageModel(record.id, 'delete', record);
|
||||
await refresh();
|
||||
})();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
>
|
||||
<Space wrap className='console-module-row-actions'>
|
||||
<Button type='link' size='small' onClick={() => setDetailModel(record)}>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
{isRoot() && (
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setEditingModel(record);
|
||||
setShowEdit(true);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
<>
|
||||
{record.status === 1 ? (
|
||||
<Button
|
||||
type='link'
|
||||
danger
|
||||
size='small'
|
||||
onClick={() => manageModel(record.id, 'disable', record)}
|
||||
>
|
||||
{t('禁用')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => manageModel(record.id, 'enable', record)}
|
||||
>
|
||||
{t('启用')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setEditingModel(record);
|
||||
setShowEdit(true);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
type='link'
|
||||
danger
|
||||
size='small'
|
||||
onClick={() => {
|
||||
Modal.confirm({
|
||||
title: t('确定是否要删除此模型?'),
|
||||
content: t('此修改将不可逆'),
|
||||
onOk: () => {
|
||||
(async () => {
|
||||
await manageModel(record.id, 'delete', record);
|
||||
await refresh();
|
||||
})();
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</TableRowActions>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user