mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 15:33:56 +08:00
refactor(desktop): derive summary group types from schema (#17422)
This commit is contained in:
@@ -147,6 +147,7 @@ export const desktopSummarySchema = z.strictObject({
|
||||
deferred_probes: z.array(desktopDeferredProbeSchema),
|
||||
});
|
||||
|
||||
type DesktopSummary = z.output<typeof desktopSummarySchema>;
|
||||
type DesktopCollection = z.infer<typeof desktopViewRequestSchema>["collection"];
|
||||
type DesktopViewRow = DesktopApplication[DesktopCollection][number];
|
||||
|
||||
@@ -194,7 +195,7 @@ export const projectDesktopApplicationView = (
|
||||
};
|
||||
if (view.kind === "summary") {
|
||||
const byId = new Map<string, string>();
|
||||
const probeIssues: z.infer<typeof desktopSummarySchema>["probe_issues"] = {
|
||||
const probeIssues: DesktopSummary["probe_issues"] = {
|
||||
file_count: 0,
|
||||
issue_count: 0,
|
||||
preview: [],
|
||||
@@ -233,14 +234,8 @@ export const projectDesktopApplicationView = (
|
||||
.map((id) => byId.get(id) ?? id),
|
||||
};
|
||||
};
|
||||
const groups = new Map<
|
||||
string,
|
||||
{
|
||||
operation: DesktopApplication["next_probes"][number]["operation"];
|
||||
count: number;
|
||||
example: DesktopApplication["next_probes"][number];
|
||||
}
|
||||
>();
|
||||
type ProbeGroup = DesktopSummary["next_probe_groups"][number];
|
||||
const groups = new Map<ProbeGroup["operation"], ProbeGroup>();
|
||||
for (const probe of report.next_probes) {
|
||||
const group = groups.get(probe.operation);
|
||||
if (group === undefined)
|
||||
|
||||
Reference in New Issue
Block a user