feat(accounts): 自有账号列表展示运行环境——monitor-views 内联网关/环境/出口视图,状态列升级可调度判定
This commit is contained in:
@@ -9,16 +9,27 @@ import { Alert, App, Button, Card, Flex, Form, Modal, Popconfirm, Select, Space,
|
||||
import { PlusOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { remove, creatorUpdate, creatorGet, creatorAction } from '@/services/api';
|
||||
import { conflictMessage, dateTime } from '@/utils/helpers';
|
||||
import { accountReadiness, conflictMessage, dateTime } from '@/utils/helpers';
|
||||
import { fixedLeft, fixedRight, tablePagination, tableScroll, useOverflowGrid } from '@/utils/table';
|
||||
|
||||
// 仅用 antd 默认组件:Table/Tag/Modal/Popconfirm/Select(tags)。
|
||||
interface EnvironmentView {
|
||||
gateway?: string;
|
||||
name?: string;
|
||||
alias?: string;
|
||||
runtime_id?: string;
|
||||
runtime_cleanup_pending?: boolean;
|
||||
network_exit_id?: string;
|
||||
network_exit_health?: string;
|
||||
}
|
||||
|
||||
interface Row {
|
||||
id: string;
|
||||
name: string;
|
||||
platform_account_key: string;
|
||||
tags?: string[];
|
||||
runtime_status?: string;
|
||||
environment?: EnvironmentView;
|
||||
work_count?: number;
|
||||
latest_published_at?: string | null;
|
||||
follower_count?: number | null;
|
||||
@@ -207,14 +218,42 @@ export default function AccountManagementList() {
|
||||
title: '标签',
|
||||
dataIndex: 'tags',
|
||||
render: (tags?: string[]) => (tags?.length ? <Flex wrap="wrap" gap={4}>{tags.map((tag) => <Tag key={tag}>{tag}</Tag>)}</Flex> : <Typography.Text type="secondary">未设置</Typography.Text>) },
|
||||
{
|
||||
title: '运行环境',
|
||||
render: (_, account) => {
|
||||
const env = account.environment;
|
||||
if (!env) return <Typography.Text type="secondary">未绑定运行环境</Typography.Text>;
|
||||
return (
|
||||
<Flex vertical gap={2}>
|
||||
<Flex align="center" gap={8}>
|
||||
<Typography.Text ellipsis>{env.name || env.alias || '—'}</Typography.Text>
|
||||
<Tag color={env.runtime_id && !env.runtime_cleanup_pending ? 'processing' : 'default'}>
|
||||
{env.runtime_cleanup_pending ? '停止待确认' : env.runtime_id ? '运行中' : '未启动'}
|
||||
</Tag>
|
||||
</Flex>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
网关 {env.gateway || '—'}
|
||||
</Typography.Text>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
{env.network_exit_id
|
||||
? `出口 ${env.network_exit_id} · ${env.network_exit_health === 'healthy' ? '健康' : env.network_exit_health || '状态未知'}`
|
||||
: '机器直连'}
|
||||
</Typography.Text>
|
||||
</Flex>
|
||||
);
|
||||
} },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
render: (_, account) => (
|
||||
<Tag color={account.runtime_status === 'active' ? 'success' : 'default'}>
|
||||
{account.runtime_status === 'active' ? '启用' : '暂停'}
|
||||
</Tag>
|
||||
) },
|
||||
render: (_, account) => {
|
||||
// 与详情页同款三层判定(绑定/出口/账号),环境未绑定时退化为账号启停状态。
|
||||
const readiness = accountReadiness(account, account.environment ?? null);
|
||||
return (
|
||||
<Tag color={readiness.ready ? 'success' : account.runtime_status === 'paused' && readiness.canResume ? 'warning' : 'error'}>
|
||||
{readiness.label}
|
||||
</Tag>
|
||||
);
|
||||
} },
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
@@ -265,7 +304,7 @@ export default function AccountManagementList() {
|
||||
loading={pending}
|
||||
sticky
|
||||
pagination={tablePagination()}
|
||||
scroll={tableScroll(horizontal ? 1200 : undefined, vertical ? 'calc(100vh - 300px)' : undefined)}
|
||||
scroll={tableScroll(horizontal ? 1320 : undefined, vertical ? 'calc(100vh - 300px)' : undefined)}
|
||||
locale={{ emptyText: '暂无自有账号。' }}
|
||||
/>
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user