feat(web): 账号即环境 UI 收敛——删 /browsers 页面,环境并入账号详情
- 删除 /browsers 列表/创建/详情页与菜单项,运行环境不再是独立资源 - 账号详情:GET /api/phase-a/accounts/:id 内联 environment 字段 (网关/出口/绑定版本/运行实例/不可调度原因),固定资源卡直接展示 - 状态卡两态开关:暂停→「启动账号」(start=resume+启动环境), 运行中→「暂停账号」(联动停环境);出口重绑卡片内完成 (POST /network-exits/:id/rebind 返回内联 environment,出口切换不再跳环境页) - 删除 creator/settings 残留的转写服务字段(后端 settings 无此列) - helpers.ts accountReadiness 改用 runtime_id/runtime_cleanup_pending - network-exits 列表绑定账号列改由账号列表内联数据驱动 - 全量验证:go test ./...(PG)全绿、tsc --noEmit 通过、max build 通过、 node --test 12/12 通过
This commit is contained in:
+1
-14
@@ -3,7 +3,6 @@
|
||||
import { AUTH_STORAGE_KEY, RequestError, jsonOptions, request, unauthorized } from '@/requestErrorConfig';
|
||||
|
||||
export const resourcePaths = {
|
||||
browsers: '/browsers',
|
||||
gateways: '/gateways',
|
||||
accounts: '/phase-a/accounts',
|
||||
'network-exits': '/network-exits',
|
||||
@@ -56,7 +55,7 @@ export async function getList<T = any>({ resource, page, pageSize, filters = {}
|
||||
};
|
||||
}
|
||||
|
||||
const GETONE_ALLOWED: Resource[] = ['accounts', 'network-exits', 'browsers', 'creator-accounts', 'creator-competitors', 'creator-competitor-share-jobs', 'creator-works', 'creator-comments', 'creator-rules'];
|
||||
const GETONE_ALLOWED: Resource[] = ['accounts', 'network-exits', 'creator-accounts', 'creator-competitors', 'creator-competitor-share-jobs', 'creator-works', 'creator-comments', 'creator-rules'];
|
||||
|
||||
export async function getOne<T = any>(resource: Resource, id: string | number): Promise<T> {
|
||||
if (!GETONE_ALLOWED.includes(resource)) throw new Error(`${resource} 不支持 getOne`);
|
||||
@@ -68,7 +67,6 @@ export async function create(resource: Resource, variables: unknown): Promise<an
|
||||
}
|
||||
|
||||
export async function update(resource: Resource, id: string | number, variables: unknown): Promise<void> {
|
||||
if (resource === 'browsers') throw new Error('browsers 不支持 update');
|
||||
await request(`${resourcePaths[resource]}/${encodeURIComponent(id)}`, jsonOptions('PUT', variables));
|
||||
}
|
||||
|
||||
@@ -79,17 +77,6 @@ export async function remove(resource: Resource, id: string | number): Promise<v
|
||||
|
||||
// ===== 显式动词的领域动作(不伪装成 CRUD)=====
|
||||
|
||||
export async function browserAction(alias: string, action: 'start' | 'stop' | 'recycle'): Promise<void> {
|
||||
const targets: Record<string, [string, string]> = {
|
||||
start: [`/browsers/${encodeURIComponent(alias)}/start`, 'POST'],
|
||||
stop: [`/browsers/${encodeURIComponent(alias)}/stop`, 'POST'],
|
||||
recycle: [`/browsers/${encodeURIComponent(alias)}`, 'DELETE'],
|
||||
};
|
||||
const target = targets[action];
|
||||
if (!target) throw new Error(`未知运行环境操作: ${action}`);
|
||||
await request(target[0], { method: target[1] });
|
||||
}
|
||||
|
||||
export async function accountAction(id: string, action: 'pause' | 'resume'): Promise<void> {
|
||||
if (action !== 'pause' && action !== 'resume') throw new Error(`未知账号操作: ${action}`);
|
||||
await request(`/phase-a/accounts/${encodeURIComponent(id)}/${action}`, { method: 'POST' });
|
||||
|
||||
Reference in New Issue
Block a user