fix(ui): 修复登录与并发请求并统一表格、主题和页面展示
验证:868 项单测、ESLint、Prettier、UI 依赖审计和差异检查通过。
This commit is contained in:
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { writeClipboardText } from '../../../helpers/clipboard';
|
||||
import { TableRowActions } from '@/components/common/table/TableToolbar';
|
||||
import React, { useState } from 'react';
|
||||
import { Switch } from 'antd';
|
||||
import {
|
||||
@@ -729,142 +730,110 @@ export const getChannelsColumns = ({
|
||||
dataIndex: 'operate',
|
||||
fixed: 'right',
|
||||
render: (text, record, index) => {
|
||||
if (record.children === undefined) {
|
||||
const moreMenuItems = [
|
||||
{
|
||||
node: 'item',
|
||||
name: t('删除'),
|
||||
type: 'danger',
|
||||
onClick: async () => {
|
||||
const content = await buildDeleteConfirmContent(record.id, t);
|
||||
Modal.confirm({
|
||||
title: t('确定是否要删除此渠道?'),
|
||||
content,
|
||||
onOk: () => {
|
||||
(async () => {
|
||||
await manageChannel(record.id, 'delete', record);
|
||||
await refresh();
|
||||
setTimeout(() => {
|
||||
if (channels.length === 0 && activePage > 1) {
|
||||
refresh(activePage - 1);
|
||||
}
|
||||
}, 100);
|
||||
})();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
node: 'item',
|
||||
name: t('复制'),
|
||||
type: 'tertiary',
|
||||
onClick: () => {
|
||||
Modal.confirm({
|
||||
title: t('确定是否要复制此渠道?'),
|
||||
content: t('复制渠道的所有信息'),
|
||||
onOk: () => copySelectedChannel(record),
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (!isRoot()) return null;
|
||||
if (record.children !== undefined) {
|
||||
return (
|
||||
<Space wrap className='console-module-row-actions'>
|
||||
{isRoot() && (
|
||||
<>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => testChannel(record, '')}
|
||||
>
|
||||
{t('测试')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setCurrentTestChannel(record);
|
||||
setShowModelTestModal(true);
|
||||
}}
|
||||
>
|
||||
{t('批量测试')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setEditingChannel(record);
|
||||
setShowEdit(true);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
danger
|
||||
size='small'
|
||||
onClick={moreMenuItems[0].onClick}
|
||||
>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={moreMenuItems[1].onClick}
|
||||
>
|
||||
{t('复制')}
|
||||
</Button>
|
||||
{record.channel_info?.is_multi_key && (
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setCurrentMultiKeyChannel(record);
|
||||
setShowMultiKeyManageModal(true);
|
||||
}}
|
||||
>
|
||||
{t('多密钥管理')}
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
);
|
||||
} else {
|
||||
// 标签操作按钮
|
||||
return (
|
||||
<Space wrap>
|
||||
{isRoot() && (
|
||||
<>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => manageTag(record.key, 'enable')}
|
||||
>
|
||||
{t('启用全部')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => manageTag(record.key, 'disable')}
|
||||
>
|
||||
{t('禁用全部')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setShowEditTag(true);
|
||||
setEditingTag(record.key);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'enable',
|
||||
label: t('启用全部'),
|
||||
onClick: () => manageTag(record.key, 'enable'),
|
||||
},
|
||||
{
|
||||
key: 'disable',
|
||||
label: t('禁用全部'),
|
||||
onClick: () => manageTag(record.key, 'disable'),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setShowEditTag(true);
|
||||
setEditingTag(record.key);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<TableRowActions
|
||||
items={[
|
||||
{
|
||||
key: 'batch-test',
|
||||
label: t('批量测试'),
|
||||
onClick: () => {
|
||||
setCurrentTestChannel(record);
|
||||
setShowModelTestModal(true);
|
||||
},
|
||||
},
|
||||
record.channel_info?.is_multi_key && {
|
||||
key: 'multi-key',
|
||||
label: t('多密钥管理'),
|
||||
onClick: () => {
|
||||
setCurrentMultiKeyChannel(record);
|
||||
setShowMultiKeyManageModal(true);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
label: t('复制'),
|
||||
onClick: () => {
|
||||
Modal.confirm({
|
||||
title: t('确定是否要复制此渠道?'),
|
||||
content: t('复制渠道的所有信息'),
|
||||
onOk: () => copySelectedChannel(record),
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: t('删除'),
|
||||
danger: true,
|
||||
onClick: async () => {
|
||||
const content = await buildDeleteConfirmContent(record.id, t);
|
||||
Modal.confirm({
|
||||
title: t('确定是否要删除此渠道?'),
|
||||
content,
|
||||
onOk: () => {
|
||||
(async () => {
|
||||
await manageChannel(record.id, 'delete', record);
|
||||
await refresh();
|
||||
setTimeout(() => {
|
||||
if (channels.length === 0 && activePage > 1) {
|
||||
refresh(activePage - 1);
|
||||
}
|
||||
}, 100);
|
||||
})();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => testChannel(record, '')}
|
||||
>
|
||||
{t('测试')}
|
||||
</Button>
|
||||
<Button
|
||||
type='link'
|
||||
size='small'
|
||||
onClick={() => {
|
||||
setEditingChannel(record);
|
||||
setShowEdit(true);
|
||||
}}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
</TableRowActions>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatIdReference } from '../../../../helpers/safeDisplay';
|
||||
|
||||
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
|
||||
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
|
||||
@@ -290,11 +291,11 @@ const EditChannelModal = (props) => {
|
||||
if (ch.status !== 1) {
|
||||
return {
|
||||
value: ch.id,
|
||||
label: `#${ch.id} ${ch.name}${t('(已禁用)')}`,
|
||||
label: `${formatIdReference(ch.id)} ${ch.name}${t('(已禁用)')}`,
|
||||
disabled: true,
|
||||
};
|
||||
}
|
||||
const parts = [`#${ch.id} ${ch.name}`];
|
||||
const parts = [`${formatIdReference(ch.id)} ${ch.name}`];
|
||||
if (ch.group) parts.push(ch.group);
|
||||
if (ch.region) parts.push(ch.region);
|
||||
return { value: ch.id, label: parts.join(' · ') };
|
||||
@@ -345,7 +346,7 @@ const EditChannelModal = (props) => {
|
||||
.filter((id) => !known.has(id) && id !== channelId)
|
||||
.map((id) => ({
|
||||
value: id,
|
||||
label: `#${id}${t('(已删除)')}`,
|
||||
label: `${formatIdReference(id)}${t('(已删除)')}`,
|
||||
disabled: true,
|
||||
}));
|
||||
return missing.length
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { formatIdReference } from '../../../../helpers/safeDisplay';
|
||||
|
||||
import { useEffectEvent } from '../../../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
@@ -359,7 +360,7 @@ const MultiKeyManageModal = ({ visible, onCancel, channel, onRefresh }) => {
|
||||
{
|
||||
title: t('索引'),
|
||||
dataIndex: 'index',
|
||||
render: (text) => `#${text}`,
|
||||
render: (text) => formatIdReference(text),
|
||||
},
|
||||
// {
|
||||
// title: t('密钥预览'),
|
||||
|
||||
Reference in New Issue
Block a user