新增项目发布 readiness summary view model
This commit is contained in:
@@ -214,6 +214,58 @@ export function createProjectReleaseReadinessReport({
|
||||
};
|
||||
}
|
||||
|
||||
export function createProjectReleaseReadinessSummaryViewModel(
|
||||
report = createProjectReleaseReadinessReport(),
|
||||
) {
|
||||
const missing = Array.isArray(report?.missing) ? report.missing : [];
|
||||
const gateResultMatrix = objectOrEmpty(report?.gateResultMatrix);
|
||||
const simConfigInventory = objectOrEmpty(report?.simConfigInventory);
|
||||
const blockedRuntimeFamilies = arrayOrEmpty(report?.blockedRuntimeFamilies);
|
||||
const promotedBlockedFamilies = arrayOrEmpty(report?.promotedBlockedFamilies);
|
||||
const ready = report?.ready === true;
|
||||
const statusText = ready ? "Ready" : "Waiting";
|
||||
const detailText = ready ? "No blocking reasons" : (missing.length > 0 ? missing.join(", ") : "release evidence missing");
|
||||
return {
|
||||
apiName: "project-release-readiness-summary-view-model",
|
||||
viewModelVersion: 1,
|
||||
phase: ready ? "ready" : "waiting",
|
||||
ready,
|
||||
title: "Project release readiness",
|
||||
statusText,
|
||||
detailText,
|
||||
statusLine: `${statusText}: ${detailText}`,
|
||||
rows: [
|
||||
{
|
||||
id: "gate-results",
|
||||
label: "Release gates",
|
||||
value: `${gateResultMatrix.passedCount ?? 0}/${gateResultMatrix.gateCount ?? 0} passed`,
|
||||
},
|
||||
{
|
||||
id: "unknown-gates",
|
||||
label: "Unknown gates",
|
||||
value: `${gateResultMatrix.unknownCount ?? 0}`,
|
||||
},
|
||||
{
|
||||
id: "sim-config-inventory",
|
||||
label: "Sim config inventory",
|
||||
value: `unexpected_fail=${simConfigInventory.unexpectedFail ?? "unknown"}`,
|
||||
},
|
||||
{
|
||||
id: "blocked-runtime-families",
|
||||
label: "Blocked runtime families",
|
||||
value: promotedBlockedFamilies.length > 0
|
||||
? `promoted: ${promotedBlockedFamilies.join(", ")}`
|
||||
: (blockedRuntimeFamilies.join(", ") || "none"),
|
||||
},
|
||||
{
|
||||
id: "missing",
|
||||
label: "Missing readiness",
|
||||
value: missing.length > 0 ? missing.join(", ") : "none",
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function parseProjectReleaseReadinessArtifactJson(text) {
|
||||
return JSON.parse(String(text));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user