Skip to content

Commit 7bfd465

Browse files
authored
Merge pull request #1739 from rust-lang/revert-1718-redesign-status-page
Revert "Redesign status page"
2 parents 1550a72 + 96087f7 commit 7bfd465

File tree

12 files changed

+191
-618
lines changed

12 files changed

+191
-618
lines changed

database/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@ pub struct CompileBenchmark {
710710

711711
#[derive(Debug)]
712712
pub struct ArtifactCollection {
713-
pub artifact: ArtifactId,
714713
pub duration: Duration,
715714
pub end_time: DateTime<Utc>,
716715
}

database/src/pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub trait Connection: Send + Sync {
158158

159159
async fn in_progress_steps(&self, aid: &ArtifactId) -> Vec<Step>;
160160

161-
async fn last_n_artifact_collections(&self, n: u32) -> Vec<ArtifactCollection>;
161+
async fn last_artifact_collection(&self) -> Option<ArtifactCollection>;
162162

163163
/// Returns the sha of the parent commit, if available.
164164
///

database/src/pool/postgres.rs

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,31 +1216,21 @@ where
12161216
})
12171217
.collect()
12181218
}
1219-
async fn last_n_artifact_collections(&self, n: u32) -> Vec<ArtifactCollection> {
1219+
async fn last_artifact_collection(&self) -> Option<ArtifactCollection> {
12201220
self.conn()
1221-
.query(
1222-
"select art.name, art.date, art.type, acd.date_recorded, acd.duration \
1223-
from artifact_collection_duration as acd \
1224-
join artifact as art on art.id = acd.aid \
1221+
.query_opt(
1222+
"select date_recorded, duration \
1223+
from artifact_collection_duration \
12251224
order by date_recorded desc \
1226-
limit $1;",
1227-
&[&n],
1225+
limit 1;",
1226+
&[],
12281227
)
12291228
.await
12301229
.unwrap()
1231-
.into_iter()
1232-
.map(|r| {
1233-
let sha = r.get::<_, String>(0);
1234-
let date = r.get::<_, Option<DateTime<Utc>>>(1);
1235-
let ty = r.get::<_, String>(2);
1236-
1237-
ArtifactCollection {
1238-
artifact: parse_artifact_id(&ty, &sha, date),
1239-
end_time: r.get(3),
1240-
duration: Duration::from_secs(r.get::<_, i32>(4) as u64),
1241-
}
1230+
.map(|r| ArtifactCollection {
1231+
end_time: r.get(0),
1232+
duration: Duration::from_secs(r.get::<_, i32>(1) as u64),
12421233
})
1243-
.collect()
12441234
}
12451235
async fn parent_of(&self, sha: &str) -> Option<String> {
12461236
self.conn()
@@ -1384,7 +1374,23 @@ where
13841374
.unwrap()?;
13851375
let date = row.get::<_, Option<DateTime<Utc>>>(0);
13861376
let ty = row.get::<_, String>(1);
1387-
Some(parse_artifact_id(&ty, artifact, date))
1377+
1378+
match ty.as_str() {
1379+
"master" => Some(ArtifactId::Commit(Commit {
1380+
sha: artifact.to_owned(),
1381+
date: Date(date.expect("date present for master commits")),
1382+
r#type: CommitType::Master,
1383+
})),
1384+
"try" => Some(ArtifactId::Commit(Commit {
1385+
sha: artifact.to_owned(),
1386+
date: date
1387+
.map(Date)
1388+
.unwrap_or_else(|| Date::ymd_hms(2000, 1, 1, 0, 0, 0)),
1389+
r#type: CommitType::Try,
1390+
})),
1391+
"release" => Some(ArtifactId::Tag(artifact.to_owned())),
1392+
_ => panic!("unknown artifact type: {:?}", ty),
1393+
}
13881394
}
13891395

13901396
async fn purge_artifact(&self, aid: &ArtifactId) {
@@ -1397,22 +1403,3 @@ where
13971403
.unwrap();
13981404
}
13991405
}
1400-
1401-
fn parse_artifact_id(ty: &str, sha: &str, date: Option<DateTime<Utc>>) -> ArtifactId {
1402-
match ty {
1403-
"master" => ArtifactId::Commit(Commit {
1404-
sha: sha.to_owned(),
1405-
date: Date(date.expect("date present for master commits")),
1406-
r#type: CommitType::Master,
1407-
}),
1408-
"try" => ArtifactId::Commit(Commit {
1409-
sha: sha.to_owned(),
1410-
date: date
1411-
.map(Date)
1412-
.unwrap_or_else(|| Date::ymd_hms(2000, 1, 1, 0, 0, 0)),
1413-
r#type: CommitType::Try,
1414-
}),
1415-
"release" => ArtifactId::Tag(sha.to_owned()),
1416-
_ => panic!("unknown artifact type: {:?}", ty),
1417-
}
1418-
}

database/src/pool/sqlite.rs

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,25 @@ impl Connection for SqliteConnection {
577577
.optional()
578578
.unwrap()?;
579579

580-
Some(parse_artifact_id(ty.as_str(), artifact, date))
580+
match ty.as_str() {
581+
"master" => Some(ArtifactId::Commit(Commit {
582+
sha: artifact.to_owned(),
583+
date: Date(
584+
Utc.timestamp_opt(date.expect("master has date"), 0)
585+
.unwrap(),
586+
),
587+
r#type: CommitType::Master,
588+
})),
589+
"try" => Some(ArtifactId::Commit(Commit {
590+
sha: artifact.to_owned(),
591+
date: date
592+
.map(|d| Date(Utc.timestamp_opt(d, 0).unwrap()))
593+
.unwrap_or_else(|| Date::ymd_hms(2000, 1, 1, 0, 0, 0)),
594+
r#type: CommitType::Try,
595+
})),
596+
"release" => Some(ArtifactId::Tag(artifact.to_owned())),
597+
_ => panic!("unknown artifact type: {:?}", ty),
598+
}
581599
}
582600

583601
async fn record_duration(&self, artifact: ArtifactIdNumber, duration: Duration) {
@@ -1148,31 +1166,24 @@ impl Connection for SqliteConnection {
11481166
.collect()
11491167
}
11501168

1151-
async fn last_n_artifact_collections(&self, n: u32) -> Vec<ArtifactCollection> {
1169+
async fn last_artifact_collection(&self) -> Option<ArtifactCollection> {
11521170
self.raw_ref()
1153-
.prepare_cached(
1154-
"select art.name, art.date, art.type, acd.date_recorded, acd.duration \
1155-
from artifact_collection_duration as acd \
1156-
join artifact as art on art.id = acd.aid \
1171+
.query_row(
1172+
"select date_recorded, duration \
1173+
from artifact_collection_duration \
11571174
order by date_recorded desc \
1158-
limit ?;",
1175+
limit 1;",
1176+
params![],
1177+
|r| {
1178+
Ok((
1179+
Utc.timestamp_opt(r.get(0)?, 0).unwrap(),
1180+
Duration::from_secs(r.get(1)?),
1181+
))
1182+
},
11591183
)
1184+
.optional()
11601185
.unwrap()
1161-
.query(params![&n])
1162-
.unwrap()
1163-
.mapped(|r| {
1164-
let sha = r.get::<_, String>(0)?;
1165-
let date = r.get::<_, Option<i64>>(1)?;
1166-
let ty = r.get::<_, String>(2)?;
1167-
1168-
Ok(ArtifactCollection {
1169-
artifact: parse_artifact_id(&ty, &sha, date),
1170-
end_time: Utc.timestamp_opt(r.get(3)?, 0).unwrap(),
1171-
duration: Duration::from_secs(r.get(4)?),
1172-
})
1173-
})
1174-
.collect::<Result<Vec<_>, _>>()
1175-
.unwrap()
1186+
.map(|(end_time, duration)| ArtifactCollection { end_time, duration })
11761187
}
11771188

11781189
async fn parent_of(&self, sha: &str) -> Option<String> {
@@ -1241,25 +1252,3 @@ impl Connection for SqliteConnection {
12411252
.unwrap();
12421253
}
12431254
}
1244-
1245-
fn parse_artifact_id(ty: &str, sha: &str, date: Option<i64>) -> ArtifactId {
1246-
match ty {
1247-
"master" => ArtifactId::Commit(Commit {
1248-
sha: sha.to_owned(),
1249-
date: Date(
1250-
Utc.timestamp_opt(date.expect("master has date"), 0)
1251-
.unwrap(),
1252-
),
1253-
r#type: CommitType::Master,
1254-
}),
1255-
"try" => ArtifactId::Commit(Commit {
1256-
sha: sha.to_owned(),
1257-
date: date
1258-
.map(|d| Date(Utc.timestamp_opt(d, 0).unwrap()))
1259-
.unwrap_or_else(|| Date::ymd_hms(2000, 1, 1, 0, 0, 0)),
1260-
r#type: CommitType::Try,
1261-
}),
1262-
"release" => ArtifactId::Tag(sha.to_owned()),
1263-
_ => panic!("unknown artifact type: {:?}", ty),
1264-
}
1265-
}

site/frontend/package-lock.json

Lines changed: 0 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"vue-tsc": "^1.8.3"
2121
},
2222
"dependencies": {
23-
"date-fns": "^2.30.0",
2423
"highcharts": "6.0.7",
2524
"msgpack-lite": "^0.1.26",
2625
"parcel": "^2.8.3",
Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
export interface Commit {
1+
interface Commit {
22
sha: string;
33
date: string;
44
type: "Try" | "Master";
55
}
66

7-
export interface BenchmarkError {
7+
interface BenchmarkStatus {
88
name: string;
99
error: string;
1010
}
@@ -16,50 +16,20 @@ interface Step {
1616
current_progress: number;
1717
}
1818

19-
export type Artifact =
20-
| {
21-
Commit: Commit;
22-
}
23-
| {
24-
Tag: string;
25-
};
26-
27-
export type MissingReason =
28-
| {
29-
Master: {
30-
pr: number;
31-
parent_sha: string;
32-
is_try_parent: boolean;
33-
};
34-
}
35-
| {
36-
Try: {
37-
pr: number;
38-
parent_sha: string;
39-
include: string | null;
40-
exclude: string | null;
41-
runs: number | null;
42-
};
43-
}
44-
| {
45-
InProgress: MissingReason;
46-
};
47-
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+
*/
4824
interface CurrentState {
49-
artifact: Artifact;
25+
artifact: any;
5026
progress: Step[];
5127
}
5228

53-
export interface FinishedRun {
54-
artifact: Artifact;
55-
pr: number | null;
56-
errors: BenchmarkError[];
57-
duration: number;
58-
finished_at: number;
59-
}
60-
6129
export interface StatusResponse {
62-
finished_runs: FinishedRun[];
30+
last_commit: Commit | null;
31+
benchmarks: BenchmarkStatus[];
32+
missing: Array<[Commit, any]>;
6333
current: CurrentState | null;
64-
missing: Array<[Commit, MissingReason]>;
34+
most_recent_end: number | null;
6535
}

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

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)