feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -19,6 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Tag } from '@/components/ui';
|
||||
import { RefreshCw } from 'lucide-react';
|
||||
import { isAdmin } from '../../../helpers';
|
||||
|
||||
const AdminTokensActions = ({
|
||||
@@ -30,7 +31,7 @@ const AdminTokensActions = ({
|
||||
const hasSelection = selectedRowKeys && selectedRowKeys.length > 0;
|
||||
|
||||
return (
|
||||
<div className='flex flex-wrap items-center gap-2 w-full md:w-auto order-2 md:order-1'>
|
||||
<div className='admin-tokens-tools'>
|
||||
{hasSelection && (
|
||||
<Tag color='violet' shape='circle' size='small'>
|
||||
{t('已选 {{count}} 项', { count: selectedRowKeys.length })}
|
||||
@@ -57,7 +58,7 @@ const AdminTokensActions = ({
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<Button size='small' type='tertiary' onClick={onRefresh}>
|
||||
<Button icon={<RefreshCw size={16} />} onClick={onRefresh}>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -18,15 +18,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
Button,
|
||||
Space,
|
||||
Tag,
|
||||
Typography,
|
||||
Popover,
|
||||
Dropdown,
|
||||
} from '@/components/ui';
|
||||
import { IconMore } from '@/components/ui/icons';
|
||||
import { Button, Switch, Tag as AntTag } from 'antd';
|
||||
import { Tag, Typography, Popover } from '@/components/ui';
|
||||
import {
|
||||
renderGroup,
|
||||
renderQuota,
|
||||
@@ -37,18 +30,33 @@ import {
|
||||
const { Text } = Typography;
|
||||
|
||||
const statusMeta = {
|
||||
1: { color: 'green', label: '已启用' },
|
||||
2: { color: 'grey', label: '已禁用' },
|
||||
3: { color: 'red', label: '已过期' },
|
||||
4: { color: 'orange', label: '已耗尽' },
|
||||
3: { color: 'error', label: '已过期' },
|
||||
4: { color: 'warning', label: '已耗尽' },
|
||||
};
|
||||
|
||||
const renderStatus = (status, t) => {
|
||||
const meta = statusMeta[status] || { color: 'red', label: t('未知状态') };
|
||||
const renderStatus = (status, record, t, showEnableDisableModal) => {
|
||||
const meta =
|
||||
statusMeta[status] ||
|
||||
(![1, 2].includes(status) ? { color: 'error', label: '未知状态' } : null);
|
||||
return (
|
||||
<Tag color={meta.color} shape='circle' size='small'>
|
||||
{t(meta.label)}
|
||||
</Tag>
|
||||
<div className='admin-tokens-status'>
|
||||
<Switch
|
||||
size='small'
|
||||
checked={status === 1}
|
||||
checkedChildren={t('启用')}
|
||||
unCheckedChildren={t('禁用')}
|
||||
aria-label={status === 1 ? t('禁用') : t('启用')}
|
||||
disabled={!isAdmin() || Boolean(record.DeletedAt)}
|
||||
onChange={() =>
|
||||
showEnableDisableModal(record, status === 1 ? 'disable' : 'enable')
|
||||
}
|
||||
/>
|
||||
{meta && (
|
||||
<AntTag color={meta.color} bordered={false}>
|
||||
{t(meta.label)}
|
||||
</AntTag>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -72,21 +80,17 @@ const renderUserCell = (text, record, t) => {
|
||||
);
|
||||
};
|
||||
|
||||
const renderKey = (text, record) => {
|
||||
const renderKey = (text) => {
|
||||
// 后端已脱敏,前端再加 sk- 前缀
|
||||
return (
|
||||
<code className='text-xs bg-[var(--ui-color-fill-0)] px-2 py-0.5 rounded font-mono'>
|
||||
sk-{text}
|
||||
</code>
|
||||
);
|
||||
return <code className='admin-tokens-key'>sk-{text}</code>;
|
||||
};
|
||||
|
||||
const renderQuotaCell = (text, record, t) => {
|
||||
if (record.unlimited_quota) {
|
||||
return (
|
||||
<Tag color='violet' shape='circle' size='small'>
|
||||
<AntTag color='success' bordered={false}>
|
||||
{t('无限制')}
|
||||
</Tag>
|
||||
</AntTag>
|
||||
);
|
||||
}
|
||||
const used = record.used_quota || 0;
|
||||
@@ -103,9 +107,7 @@ const renderQuotaCell = (text, record, t) => {
|
||||
);
|
||||
return (
|
||||
<Popover content={popoverContent} position='top'>
|
||||
<Tag color='white' shape='circle' size='small'>
|
||||
{renderQuota(remain)}
|
||||
</Tag>
|
||||
<span>{renderQuota(remain)}</span>
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
@@ -113,13 +115,8 @@ const renderQuotaCell = (text, record, t) => {
|
||||
const renderTime = (ts, t) => {
|
||||
if (!ts || ts === 0)
|
||||
return <span className='text-[var(--ui-color-text-2)]'>—</span>;
|
||||
if (ts === -1)
|
||||
return (
|
||||
<Tag color='blue' shape='circle' size='small'>
|
||||
{t('永不过期')}
|
||||
</Tag>
|
||||
);
|
||||
return <span className='text-xs'>{timestamp2string(ts)}</span>;
|
||||
if (ts === -1) return <span>{t('永不过期')}</span>;
|
||||
return <span>{timestamp2string(ts)}</span>;
|
||||
};
|
||||
|
||||
const renderScope = (orgId, t) => {
|
||||
@@ -140,51 +137,28 @@ const renderScope = (orgId, t) => {
|
||||
const renderOperations = (
|
||||
text,
|
||||
record,
|
||||
{ showEditTokenModal, showEnableDisableModal, showDeleteTokenModal, t },
|
||||
{ showEditTokenModal, showDeleteTokenModal, t },
|
||||
) => {
|
||||
if (record.DeletedAt) return <></>;
|
||||
const isEnabled = record.status === 1;
|
||||
if (!isAdmin()) return null;
|
||||
return (
|
||||
<Space>
|
||||
<div className='admin-tokens-row-actions'>
|
||||
<Button
|
||||
size='small'
|
||||
type='tertiary'
|
||||
type='link'
|
||||
onClick={() => showEditTokenModal(record)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
{isEnabled ? (
|
||||
<Button
|
||||
size='small'
|
||||
type='danger'
|
||||
onClick={() => showEnableDisableModal(record, 'disable')}
|
||||
>
|
||||
{t('禁用')}
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
size='small'
|
||||
onClick={() => showEnableDisableModal(record, 'enable')}
|
||||
>
|
||||
{t('启用')}
|
||||
</Button>
|
||||
)}
|
||||
<Dropdown
|
||||
trigger='click'
|
||||
position='bottomRight'
|
||||
menu={[
|
||||
{
|
||||
node: 'item',
|
||||
name: t('删除'),
|
||||
type: 'danger',
|
||||
onClick: () => showDeleteTokenModal(record),
|
||||
},
|
||||
]}
|
||||
<Button
|
||||
size='small'
|
||||
type='link'
|
||||
danger
|
||||
onClick={() => showDeleteTokenModal(record)}
|
||||
>
|
||||
<Button size='small' type='tertiary' icon={<IconMore />} />
|
||||
</Dropdown>
|
||||
</Space>
|
||||
{t('删除')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -207,10 +181,13 @@ export const getAdminTokensColumns = ({
|
||||
render: (text, record) => renderUserCell(text, record, t),
|
||||
},
|
||||
{
|
||||
title: t('密钥名称'),
|
||||
title: t('名称'),
|
||||
dataIndex: 'name',
|
||||
render: (text) => (
|
||||
<span className='truncate inline-block max-w-[160px]' title={text}>
|
||||
<span
|
||||
className='admin-tokens-name truncate inline-block max-w-[160px]'
|
||||
title={text}
|
||||
>
|
||||
{text || <Text type='tertiary'>—</Text>}
|
||||
</span>
|
||||
),
|
||||
@@ -223,8 +200,9 @@ export const getAdminTokensColumns = ({
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'status',
|
||||
width: 90,
|
||||
render: (text) => renderStatus(text, t),
|
||||
width: 150,
|
||||
render: (text, record) =>
|
||||
renderStatus(text, record, t, showEnableDisableModal),
|
||||
},
|
||||
{
|
||||
title: t('归属'),
|
||||
@@ -248,11 +226,7 @@ export const getAdminTokensColumns = ({
|
||||
title: t('已用额度'),
|
||||
dataIndex: 'used_quota',
|
||||
width: 110,
|
||||
render: (text) => (
|
||||
<Text type='tertiary' size='small'>
|
||||
{renderQuota(text || 0)}
|
||||
</Text>
|
||||
),
|
||||
render: (text) => <span>{renderQuota(text || 0)}</span>,
|
||||
},
|
||||
{
|
||||
title: t('创建时间'),
|
||||
@@ -273,14 +247,13 @@ export const getAdminTokensColumns = ({
|
||||
render: (text) => renderTime(text, t),
|
||||
},
|
||||
{
|
||||
title: '',
|
||||
title: t('操作'),
|
||||
dataIndex: 'operate',
|
||||
fixed: 'right',
|
||||
width: 200,
|
||||
width: 130,
|
||||
render: (text, record) =>
|
||||
renderOperations(text, record, {
|
||||
showEditTokenModal,
|
||||
showEnableDisableModal,
|
||||
showDeleteTokenModal,
|
||||
t,
|
||||
}),
|
||||
|
||||
@@ -18,29 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Typography, Tag } from '@/components/ui';
|
||||
import { IconKey } from '@/components/ui/icons';
|
||||
import CompactModeToggle from '../../common/ui/CompactModeToggle';
|
||||
import { TableTitle } from '../../common/table/TableToolbar';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const AdminTokensDescription = ({ compactMode, setCompactMode, t }) => {
|
||||
return (
|
||||
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
|
||||
<div className='flex items-center gap-2 text-brand'>
|
||||
<IconKey />
|
||||
<Text>{t('密钥管理')}</Text>
|
||||
<Tag color='orange' shape='circle' size='small'>
|
||||
{t('管理员')}
|
||||
</Tag>
|
||||
</div>
|
||||
<CompactModeToggle
|
||||
compactMode={compactMode}
|
||||
setCompactMode={setCompactMode}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const AdminTokensDescription = ({ t }) => (
|
||||
<TableTitle>{t('密钥列表')}</TableTitle>
|
||||
);
|
||||
|
||||
export default AdminTokensDescription;
|
||||
|
||||
@@ -20,12 +20,13 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React, { useRef } from 'react';
|
||||
import { Form, Button } from '@/components/ui';
|
||||
import { IconSearch } from '@/components/ui/icons';
|
||||
import FilterSearchButton from '../../common/table/FilterSearchButton';
|
||||
import { useFilterSearch } from '../../../hooks/common/useFilterSearch';
|
||||
|
||||
const AdminTokensFilters = ({
|
||||
formInitValues,
|
||||
setFormApi,
|
||||
searchTokens,
|
||||
debouncedSearch,
|
||||
loadTokens,
|
||||
pageSize,
|
||||
groupOptions,
|
||||
@@ -34,61 +35,71 @@ const AdminTokensFilters = ({
|
||||
t,
|
||||
}) => {
|
||||
const formApiRef = useRef(null);
|
||||
const { scheduleSearch, submitSearch, cancelPendingSearch } = useFilterSearch(
|
||||
() => searchTokens(pageSize),
|
||||
);
|
||||
|
||||
const handleReset = () => {
|
||||
if (!formApiRef.current) return;
|
||||
formApiRef.current.reset();
|
||||
cancelPendingSearch();
|
||||
// 重置后立即用初始值刷新(不走 debounce)
|
||||
loadTokens(1, pageSize, formInitValues);
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
initValues={formInitValues}
|
||||
initValues={{
|
||||
...formInitValues,
|
||||
group: formInitValues.group === '' ? undefined : formInitValues.group,
|
||||
unlimited:
|
||||
formInitValues.unlimited === ''
|
||||
? undefined
|
||||
: formInitValues.unlimited,
|
||||
}}
|
||||
getFormApi={(api) => {
|
||||
setFormApi(api);
|
||||
formApiRef.current = api;
|
||||
}}
|
||||
onSubmit={() => searchTokens(pageSize)}
|
||||
onSubmit={submitSearch}
|
||||
onValueChange={scheduleSearch}
|
||||
allowEmpty
|
||||
autoComplete='off'
|
||||
layout='horizontal'
|
||||
layout='vertical'
|
||||
trigger='change'
|
||||
className='w-full md:w-auto order-1 md:order-2'
|
||||
className='admin-tokens-filter-form'
|
||||
>
|
||||
<div className='flex flex-col md:flex-row items-center gap-2 w-full md:w-auto flex-wrap'>
|
||||
<div className='w-full md:w-56'>
|
||||
<div className='admin-tokens-filter-grid'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Input
|
||||
field='keyword'
|
||||
label={t('密钥名称 / Key 片段')}
|
||||
prefix={<IconSearch />}
|
||||
placeholder={t('密钥名称 / Key 片段')}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-44'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Input
|
||||
field='user_keyword'
|
||||
label={t('用户名/昵称')}
|
||||
placeholder={t('用户名/昵称')}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-28'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Input
|
||||
field='user_id'
|
||||
label={t('用户ID')}
|
||||
placeholder={t('用户ID')}
|
||||
type='number'
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-44'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Select
|
||||
field='statuses'
|
||||
label={t('状态')}
|
||||
placeholder={t('状态(多选)')}
|
||||
multiple
|
||||
optionList={[
|
||||
@@ -98,42 +109,36 @@ const AdminTokensFilters = ({
|
||||
{ label: t('已耗尽'), value: 4 },
|
||||
]}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
className='w-full'
|
||||
onChange={debouncedSearch}
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-36'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Select
|
||||
field='group'
|
||||
label={t('分组')}
|
||||
placeholder={t('分组')}
|
||||
optionList={groupOptions}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
className='w-full'
|
||||
onChange={debouncedSearch}
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-32'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Select
|
||||
field='unlimited'
|
||||
placeholder={t('额度类型')}
|
||||
label={t('剩余额度')}
|
||||
placeholder={t('剩余额度')}
|
||||
optionList={[
|
||||
{ label: t('无限额度'), value: true },
|
||||
{ label: t('有限额度'), value: false },
|
||||
]}
|
||||
showClear
|
||||
pure
|
||||
size='small'
|
||||
className='w-full'
|
||||
onChange={debouncedSearch}
|
||||
/>
|
||||
</div>
|
||||
<div className='w-full md:w-32'>
|
||||
<div className='admin-tokens-filter-field'>
|
||||
<Form.Select
|
||||
field='org_scope'
|
||||
label={t('归属')}
|
||||
placeholder={t('归属')}
|
||||
optionList={[
|
||||
{ label: t('全部'), value: 'all' },
|
||||
@@ -141,25 +146,13 @@ const AdminTokensFilters = ({
|
||||
{ label: t('企业'), value: 'org' },
|
||||
]}
|
||||
showClear={false}
|
||||
pure
|
||||
size='small'
|
||||
className='w-full'
|
||||
onChange={debouncedSearch}
|
||||
/>
|
||||
</div>
|
||||
<div className='flex gap-2 w-full md:w-auto'>
|
||||
<Button
|
||||
type='tertiary'
|
||||
htmlType='submit'
|
||||
loading={loading || searching}
|
||||
size='small'
|
||||
>
|
||||
{t('查询')}
|
||||
</Button>
|
||||
<Button type='tertiary' onClick={handleReset} size='small'>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className='admin-tokens-filter-actions'>
|
||||
<Button onClick={handleReset}>{t('重置')}</Button>
|
||||
<FilterSearchButton loading={loading || searching} />
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -17,13 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import TableEmpty from '../../common/table/TableEmpty';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Empty } from '@/components/ui';
|
||||
import CardTable from '../../common/ui/CardTable';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
IllustrationNoResultDark,
|
||||
} from '../../common/illustrations';
|
||||
|
||||
import { getAdminTokensColumns } from './AdminTokensColumnDefs';
|
||||
|
||||
const AdminTokensTable = ({
|
||||
@@ -32,7 +29,6 @@ const AdminTokensTable = ({
|
||||
activePage,
|
||||
pageSize,
|
||||
tokenCount,
|
||||
compactMode,
|
||||
selectedRowKeys,
|
||||
setSelectedRowKeys,
|
||||
handlePageChange,
|
||||
@@ -72,20 +68,6 @@ const AdminTokensTable = ({
|
||||
[t],
|
||||
);
|
||||
|
||||
const tableColumns = useMemo(
|
||||
() =>
|
||||
compactMode
|
||||
? columns.map((col) => {
|
||||
if (col.dataIndex === 'operate') {
|
||||
const { fixed, ...rest } = col;
|
||||
return rest;
|
||||
}
|
||||
return col;
|
||||
})
|
||||
: columns,
|
||||
[compactMode, columns],
|
||||
);
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowKeys,
|
||||
onChange: (keys) => setSelectedRowKeys(keys),
|
||||
@@ -93,10 +75,10 @@ const AdminTokensTable = ({
|
||||
|
||||
return (
|
||||
<CardTable
|
||||
columns={tableColumns}
|
||||
columns={columns}
|
||||
dataSource={tokens}
|
||||
rowKey='id'
|
||||
scroll={compactMode ? undefined : { x: 'max-content' }}
|
||||
scroll={{ x: 'max-content' }}
|
||||
pagination={{
|
||||
currentPage: activePage,
|
||||
pageSize: pageSize,
|
||||
@@ -110,17 +92,8 @@ const AdminTokensTable = ({
|
||||
loading={loading}
|
||||
onRow={handleRow}
|
||||
rowSelection={rowSelection}
|
||||
empty={
|
||||
<Empty
|
||||
image={<IllustrationNoResult style={{ width: 150, height: 150 }} />}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark style={{ width: 150, height: 150 }} />
|
||||
}
|
||||
description={t('搜索无结果')}
|
||||
style={{ padding: 30 }}
|
||||
/>
|
||||
}
|
||||
className='overflow-hidden'
|
||||
empty={<TableEmpty />}
|
||||
className='admin-tokens-table overflow-hidden'
|
||||
size='middle'
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
.console-page .console-search-card .admin-tokens-filter-form {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.admin-tokens-filter-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.console-page .admin-tokens-filter-grid .ant-form-item-label > label {
|
||||
color: var(--console-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.admin-tokens-filter-actions,
|
||||
.admin-tokens-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.admin-tokens-filter-actions {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.admin-tokens-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 1.25rem;
|
||||
width: 100%;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.admin-tokens-tools {
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
.console-page .console-table.admin-tokens-table .ant-table-thead > tr > th {
|
||||
height: 46px;
|
||||
padding-block: 0;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.admin-tokens-name {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.admin-tokens-key {
|
||||
font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 21px;
|
||||
}
|
||||
|
||||
.admin-tokens-status,
|
||||
.admin-tokens-row-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.admin-tokens-status {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.admin-tokens-status .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
.admin-tokens-row-actions .ant-btn {
|
||||
height: auto;
|
||||
padding: 0 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.admin-tokens-filter-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.admin-tokens-filter-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import './admin-tokens.css';
|
||||
import CardPro from '../../common/ui/CardPro';
|
||||
import AdminTokensTable from './AdminTokensTable';
|
||||
import AdminTokensActions from './AdminTokensActions';
|
||||
@@ -79,9 +80,6 @@ const AdminTokensPage = () => {
|
||||
handlePageSizeChange,
|
||||
handleRow,
|
||||
|
||||
compactMode,
|
||||
setCompactMode,
|
||||
|
||||
t,
|
||||
} = data;
|
||||
|
||||
@@ -150,37 +148,34 @@ const AdminTokensPage = () => {
|
||||
/>
|
||||
|
||||
<CardPro
|
||||
type='type1'
|
||||
descriptionArea={
|
||||
<AdminTokensDescription
|
||||
compactMode={compactMode}
|
||||
setCompactMode={setCompactMode}
|
||||
searchArea={
|
||||
<AdminTokensFilters
|
||||
formInitValues={formInitValues}
|
||||
setFormApi={setFormApi}
|
||||
searchTokens={searchTokens}
|
||||
debouncedSearch={debouncedSearch}
|
||||
loadTokens={loadTokens}
|
||||
pageSize={pageSize}
|
||||
groupOptions={groupOptions}
|
||||
loading={loading}
|
||||
searching={searching}
|
||||
t={t}
|
||||
/>
|
||||
}
|
||||
type='type1'
|
||||
actionsArea={
|
||||
<div className='flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full'>
|
||||
<div className='admin-tokens-toolbar'>
|
||||
<AdminTokensDescription t={t} />
|
||||
<AdminTokensActions
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onBatchAction={handleBatchClick}
|
||||
onRefresh={refresh}
|
||||
t={t}
|
||||
/>
|
||||
<AdminTokensFilters
|
||||
formInitValues={formInitValues}
|
||||
setFormApi={setFormApi}
|
||||
searchTokens={searchTokens}
|
||||
debouncedSearch={debouncedSearch}
|
||||
loadTokens={loadTokens}
|
||||
pageSize={pageSize}
|
||||
groupOptions={groupOptions}
|
||||
loading={loading}
|
||||
searching={searching}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
paginationArea={createCardProPagination({
|
||||
showRange: false,
|
||||
currentPage: activePage,
|
||||
pageSize: pageSize,
|
||||
total: tokenCount,
|
||||
@@ -197,7 +192,6 @@ const AdminTokensPage = () => {
|
||||
activePage={activePage}
|
||||
pageSize={pageSize}
|
||||
tokenCount={tokenCount}
|
||||
compactMode={compactMode}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
setSelectedRowKeys={setSelectedRowKeys}
|
||||
handlePageChange={handlePageChange}
|
||||
|
||||
@@ -24,7 +24,7 @@ const { Text } = Typography;
|
||||
|
||||
const AdminDeleteTokenModal = ({ visible, onCancel, onConfirm, token, t }) => {
|
||||
if (!token) return null;
|
||||
const isOrgToken = token.organization_id && token.organization_id > 0;
|
||||
const isOrgToken = token.organization_id > 0;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
||||
@@ -20,10 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Modal, Form, Typography, Banner, Spin, Tag } from '@/components/ui';
|
||||
import { API, showError, renderQuotaWithPrompt } from '../../../../helpers';
|
||||
import {
|
||||
quotaToMoney,
|
||||
moneyToQuota,
|
||||
} from '../../../common/ui/QuotaInput';
|
||||
import { quotaToMoney, moneyToQuota } from '../../../common/ui/QuotaInput';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -131,7 +128,7 @@ const AdminEditTokenModal = ({
|
||||
|
||||
if (!token) return null;
|
||||
|
||||
const isOrgToken = token.organization_id && token.organization_id > 0;
|
||||
const isOrgToken = token.organization_id > 0;
|
||||
const curStatusMeta = statusMeta[token.status] || statusMeta[2];
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user