feat: TaskSelector v2 全链路展示 + 同步检查 + MCP Server + 服务器 Git 排除

- admin-web: TaskSelector 重构为按域+层全链路展示,新增同步检查功能
- admin-web: TaskConfig 动态加载 Flow/处理模式定义,DWD 表过滤内嵌域面板
- admin-web: App hydrate 完成前显示 loading,避免误跳 /login
- backend: 新增 /tasks/sync-check 对比后端与 ETL 真实注册表
- backend: 新增 /tasks/flows 返回 Flow 和处理模式定义
- apps/mcp-server: 新增 MCP Server 模块(百炼 AI PostgreSQL 只读查询)
- scripts/server: 新增 setup-server-git.py + server-exclude.txt
- docs: 更新 LAUNCH-CHECKLIST 添加 Git 排除配置步骤
- pyproject.toml: workspace members 新增 mcp-server
This commit is contained in:
Neo
2026-02-19 10:31:16 +08:00
parent 4eac07da47
commit 254ccb1e77
16 changed files with 2375 additions and 1285 deletions

View File

@@ -1,32 +1,77 @@
/**
* 任务相关 API 调用。
*
* - fetchTaskRegistry获取按业务域分组的任务注册表
*/
import { apiClient } from './client';
import type { TaskConfig, TaskDefinition } from '../types';
/** 获取按业务域分组的任务注册表 */
export async function fetchTaskRegistry(): Promise<Record<string, TaskDefinition[]>> {
// 后端返回 { groups: { 域名: [TaskItem] } },需要解包
const { data } = await apiClient.get<{ groups: Record<string, TaskDefinition[]> }>('/tasks/registry');
return data.groups;
}
/** 获取按业务域分组的 DWD 表定义 */
export async function fetchDwdTables(): Promise<Record<string, string[]>> {
// 后端返回 { groups: { 域名: [DwdTableItem] } },需要解包并提取 table_name
const { data } = await apiClient.get<{ groups: Record<string, { table_name: string }[]> }>('/tasks/dwd-tables');
const result: Record<string, string[]> = {};
for (const [domain, items] of Object.entries(data.groups)) {
result[domain] = items.map((item) => item.table_name);
}
return result;
}
/** 验证任务配置并返回生成的 CLI 命令预览 */
export async function validateTaskConfig(config: TaskConfig): Promise<{ command: string }> {
const { data } = await apiClient.post<{ command: string }>('/tasks/validate', { config });
return data;
}
/**
* 任务相关 API 调用。
*/
import { apiClient } from './client';
import type { TaskConfig, TaskDefinition } from '../types';
/** DWD 表项(后端返回的原始结构) */
export interface DwdTableItem {
table_name: string;
display_name: string;
domain: string;
ods_source: string;
is_dimension: boolean;
}
/** Flow 定义 */
export interface FlowDef {
id: string;
name: string;
layers: string[];
}
/** 处理模式定义 */
export interface ProcessingModeDef {
id: string;
name: string;
description: string;
}
/** 同步检查结果 */
export interface SyncCheckResult {
in_sync: boolean;
backend_only: string[];
etl_only: string[];
error: string | null;
}
/** 获取按业务域分组的任务注册表 */
export async function fetchTaskRegistry(): Promise<Record<string, TaskDefinition[]>> {
const { data } = await apiClient.get<{ groups: Record<string, TaskDefinition[]> }>('/tasks/registry');
return data.groups;
}
/** 获取按业务域分组的 DWD 表定义(保留完整结构) */
export async function fetchDwdTablesRich(): Promise<Record<string, DwdTableItem[]>> {
const { data } = await apiClient.get<{ groups: Record<string, DwdTableItem[]> }>('/tasks/dwd-tables');
return data.groups;
}
/** 获取按业务域分组的 DWD 表定义(仅表名,兼容旧调用) */
export async function fetchDwdTables(): Promise<Record<string, string[]>> {
const groups = await fetchDwdTablesRich();
const result: Record<string, string[]> = {};
for (const [domain, items] of Object.entries(groups)) {
result[domain] = items.map((item) => item.table_name);
}
return result;
}
/** 获取 Flow 定义和处理模式定义 */
export async function fetchFlows(): Promise<{ flows: FlowDef[]; processing_modes: ProcessingModeDef[] }> {
const { data } = await apiClient.get<{ flows: FlowDef[]; processing_modes: ProcessingModeDef[] }>('/tasks/flows');
return data;
}
/** 验证任务配置并返回生成的 CLI 命令预览 */
export async function validateTaskConfig(config: TaskConfig): Promise<{ command: string }> {
const { data } = await apiClient.post<{ command: string }>('/tasks/validate', { config });
return data;
}
/** 对比后端与 ETL 真实注册表的任务列表差异 */
export async function checkTaskSync(): Promise<SyncCheckResult> {
const { data } = await apiClient.get<SyncCheckResult>('/tasks/sync-check');
return data;
}