fix: prefer real provider upgrade records

This commit is contained in:
Codex
2026-05-05 02:30:13 +00:00
parent ac346d0ea9
commit cce8a78508
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -232,6 +232,10 @@ function providerUpgradeTasks(tasks: any[], providerId: string): any[] {
.sort((left, right) => (timeMs(right.updatedAt) ?? 0) - (timeMs(left.updatedAt) ?? 0));
}
function latestScheduledUpgradeTask(records: any[]): any | null {
return records.find((task) => taskUpgradeMode(task) === "schedule") || records[0] || null;
}
async function requestJson(path: string, options: AnyRecord = {}): Promise<any> {
const headers = new Headers(options.headers || {});
if (options.body && !headers.has("content-type")) headers.set("content-type", "application/json");
@@ -749,7 +753,7 @@ function ProviderUpgradeRecordsPanel({ provider, tasks, onRaw, limit = 5 }: AnyR
function GatewayVersionPage({ nodes, tasks, onRaw }: AnyRecord) {
const rows = useMemo(() => nodes.map((node: any) => {
const records = providerUpgradeTasks(tasks, node.providerId);
return { node, records, latest: records[0] || null, capabilities: nodeCapabilities(node) };
return { node, records, latest: latestScheduledUpgradeTask(records), capabilities: nodeCapabilities(node) };
}), [nodes, tasks]);
const totalRecords = rows.reduce((sum: number, row: any) => sum + row.records.length, 0);