feat(schedule): 新增平台任务参数契约与动态选项支持
This commit is contained in:
1 parent
2ce1aca023
commit
8b5b0b49bf
76 files changed
+7103
-1203
No files matched your search
@@ -15,6 +15,8 @@ export interface ScheduleTask {
|
||||
dify_agent_id?: number | null;
|
||||
platform_api_path?: string | null;
|
||||
data_source_type?: 'database' | 'external_api' | null;
|
||||
/** platform_job 结构化参数(按注册表 params_schema 校验) */
|
||||
job_params?: Record<string, any> | null;
|
||||
kb_sync_enabled?: boolean;
|
||||
kb_group_id?: number | null;
|
||||
notify_user_ids_json: number[];
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* shared/utils/schedule-run-display.utils.ts
|
||||
* 用途:排程 run 列表展示辅助(失败计数、Excel 导出状态等)。
|
||||
* 依赖:无。
|
||||
* 逻辑:管理端 ScheduleWorkbenchPanel、工作台 ScheduleRunsPage 等复用。
|
||||
*/
|
||||
|
||||
type ScheduleRunSummaryCarrier = {
|
||||
failed_count?: number | null;
|
||||
response_summary_json?: Record<string, unknown> | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断排程 run 是否因 Excel 汇总导出失败而标记 partial_failed(源数据可能已全部成功)。
|
||||
* 核心逻辑:读取 response_summary_json.excel_failed 或 excel_export_status=failed。
|
||||
*/
|
||||
export function isScheduleRunExcelExportFailed(run: ScheduleRunSummaryCarrier | null | undefined): boolean {
|
||||
const summary = run?.response_summary_json;
|
||||
if (!summary || typeof summary !== 'object') return false;
|
||||
if (summary.excel_failed === true) return true;
|
||||
return summary.excel_export_status === 'failed';
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成失败数列 title,含 Excel 汇总层失败说明。
|
||||
* @param run - 排程 run 记录
|
||||
* @param excelFailedHint - 已翻译的 Excel 失败提示文案
|
||||
*/
|
||||
export function getScheduleRunFailedCountTitle(
|
||||
run: ScheduleRunSummaryCarrier | null | undefined,
|
||||
excelFailedHint: string,
|
||||
): string {
|
||||
const failed = run?.failed_count ?? 0;
|
||||
if (!isScheduleRunExcelExportFailed(run)) {
|
||||
return String(failed);
|
||||
}
|
||||
return `${failed} (${excelFailedHint})`;
|
||||
}
|
||||
Reference in new issue
Block a user