refactor(corps): normalize credential categories and format workflow history logs

This commit is contained in:
gitea committed 2026-10-14 18:19:13 +08:00
1 parent f91a80f9dd
commit 0499ccb2cc
9 files changed
+161 -49

No files matched your search

+14 -10
View File
@@ -38,10 +38,14 @@ export async function handleLogs(parsed: CliParsedArgs, runtime: CliRuntime): Pr
endTime: stringOption(parsed.options, ["end-time", "endTime"]),
});
const hasErrorFilter = booleanOption(parsed.options, ["has-error", "hasError", "errors"]);
const isJobError = (job: any): boolean => {
if (job.hasError === true || job.hasError === "存在" || job.hasError === "true") return true;
if (typeof job.errorTaskCount === "number" && job.errorTaskCount > 0) return true;
if (job.state === "FAILED" || job.status === "FAILED") return true;
return false;
};
const filteredJobList = hasErrorFilter
? rawResult.jobList.filter(
(job) => job.hasError === true || job.errorTaskCount > 0 || job.state === "FAILED"
)
? rawResult.jobList.filter(isJobError)
: rawResult.jobList;
const result = hasErrorFilter
? { ...rawResult, jobList: filteredJobList }
@@ -49,15 +53,15 @@ export async function handleLogs(parsed: CliParsedArgs, runtime: CliRuntime): Pr
if (runtime.jsonMode) return { stdout: printJson(result, runtime.outputOptions), stderr: "", exitCode: 0 };
const rows = result.jobList.map((job, idx) => [
const rows = result.jobList.map((job: any, idx) => [
idx + 1,
job.id,
job.state,
job.successTaskCount,
job.errorTaskCount,
job.hasError || job.errorTaskCount > 0 ? "⚠️ 是 (true)" : "否 (false)",
job.jobId || job.id || "-",
job.status || (job.state === 0 ? "COMPLETED" : String(job.state ?? "-")),
job.successTaskCount ?? 0,
job.errorTaskCount ?? 0,
isJobError(job) ? "⚠️ 包含错误" : "正常",
job.durationTime ?? "-",
job.startTime || "-",
job.executeTime || job.startTime || "-",
]);
const tableStr = rows.length
? printTable(