Skip to content

Commit 399935a

Browse files
committed
Model status page data in TypeScript
1 parent 7bfd465 commit 399935a

File tree

1 file changed

+30
-7
lines changed
  • site/frontend/src/pages/status

1 file changed

+30
-7
lines changed

site/frontend/src/pages/status/data.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,43 @@ interface Step {
1616
current_progress: number;
1717
}
1818

19-
/**
20-
* The `any` types in the interface below were chosen because the types are quite complex
21-
* on the Rust side (they are modeled with enums encoded in a way that is not so simple to model in
22-
* TS).
23-
*/
19+
type Artifact =
20+
| {
21+
Commit: Commit;
22+
}
23+
| {
24+
Tag: string;
25+
};
26+
27+
type MissingReason =
28+
| {
29+
Master: {
30+
pr: number;
31+
parent_sha: string;
32+
is_try_parent: boolean;
33+
};
34+
}
35+
| {
36+
Try: {
37+
parent_sha: string;
38+
include: string | null;
39+
exclude: string | null;
40+
runs: number | null;
41+
};
42+
}
43+
| {
44+
InProgress: MissingReason;
45+
};
46+
2447
interface CurrentState {
25-
artifact: any;
48+
artifact: Artifact;
2649
progress: Step[];
2750
}
2851

2952
export interface StatusResponse {
3053
last_commit: Commit | null;
3154
benchmarks: BenchmarkStatus[];
32-
missing: Array<[Commit, any]>;
55+
missing: Array<[Commit, MissingReason]>;
3356
current: CurrentState | null;
3457
most_recent_end: number | null;
3558
}

0 commit comments

Comments
 (0)