Skip to content

Commit 5e9de67

Browse files
committed
Get Branch head version when available
#331 (comment)
1 parent aa66c0b commit 5e9de67

File tree

8 files changed

+57
-5
lines changed

8 files changed

+57
-5
lines changed

lib/bencher_schema/src/model/project/branch/head.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ impl QueryHead {
9898
None
9999
};
100100

101+
let version = version
102+
.or_else(|| {
103+
schema::head_version::table
104+
.inner_join(
105+
schema::version::table
106+
.on(schema::head_version::version_id.eq(schema::version::id)),
107+
)
108+
.filter(schema::head_version::head_id.eq(query_head.id))
109+
.order(schema::version::number.desc())
110+
.select(QueryVersion::as_select())
111+
.first::<QueryVersion>(conn)
112+
.ok()
113+
})
114+
.map(QueryVersion::into_json);
115+
101116
let Self {
102117
uuid,
103118
created,
@@ -107,7 +122,7 @@ impl QueryHead {
107122
Ok(JsonHead {
108123
uuid,
109124
start_point,
110-
version: version.map(QueryVersion::into_json),
125+
version,
111126
created,
112127
replaced,
113128
})

services/console/src/chunks/docs-reference/changelog/en/changelog.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- Fix fork pull request example (Thank you [@ruyadorno](https://github.com/ruyadorno))
33
- Improve database backup to run in the background
44
- Improve server stats to run in the background
5+
- Add branch head version to the Console UI
56

67
## `v0.5.3`
78
- Improve `iai-callgrind` adapter (Thank you [gamma0987](https://github.com/gamma0987))

services/console/src/config/project/alerts.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Params } from "astro";
22
import { PubResourceKind } from "../../components/perf/util";
3+
import IconTitle from "../../components/site/IconTitle";
34
import { isAllowedProjectEdit } from "../../util/auth";
45
import { ActionButton, Button, Card, Display, Operation, Row } from "../types";
56
import { parentPath, viewUuidPath } from "../util";
6-
import IconTitle from "../../components/site/IconTitle";
77

88
export const ALERT_ICON = "fas fa-bell";
99
export const ALERT_OFF_ICON = "far fa-bell-slash";
@@ -96,6 +96,12 @@ const alertsConfig = {
9696
keys: ["threshold", "branch"],
9797
display: Display.BRANCH,
9898
},
99+
{
100+
kind: Card.NESTED_FIELD,
101+
label: "Branch Version Hash",
102+
keys: ["threshold", "branch", "head", "version", "hash"],
103+
display: Display.GIT_HASH,
104+
},
99105
{
100106
kind: Card.NESTED_FIELD,
101107
label: "Testbed",

services/console/src/config/project/alerts_pub.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ const alertsPubConfig = {
4242
keys: ["threshold", "branch"],
4343
display: Display.BRANCH,
4444
},
45+
{
46+
kind: Card.NESTED_FIELD,
47+
label: "Branch Version Hash",
48+
keys: ["threshold", "branch", "head", "version", "hash"],
49+
display: Display.GIT_HASH,
50+
},
4551
{
4652
kind: Card.NESTED_FIELD,
4753
label: "Testbed",

services/console/src/config/project/branches.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Params } from "astro";
22
import FieldKind from "../../components/field/kind";
3+
import IconTitle from "../../components/site/IconTitle";
34
import type { JsonBranch } from "../../types/bencher";
45
import {
56
isAllowedProjectCreate,
@@ -18,7 +19,6 @@ import {
1819
ThresholdDimension,
1920
} from "../types";
2021
import { addPath, createdSlugPath, parentPath, viewSlugPath } from "../util";
21-
import IconTitle from "../../components/site/IconTitle";
2222

2323
export const BRANCH_ICON = "fas fa-code-branch";
2424

@@ -180,6 +180,12 @@ const branchesConfig = {
180180
key: "uuid",
181181
display: Display.RAW,
182182
},
183+
{
184+
kind: Card.NESTED_FIELD,
185+
label: "Branch Version Hash",
186+
keys: ["head", "version", "hash"],
187+
display: Display.GIT_HASH,
188+
},
183189
{
184190
kind: Card.NESTED_FIELD,
185191
label: "Branch Start Point",

services/console/src/config/project/branches_pub.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ const branchesPubConfig = {
4444
key: "uuid",
4545
display: Display.RAW,
4646
},
47+
{
48+
kind: Card.NESTED_FIELD,
49+
label: "Branch Version Hash",
50+
keys: ["head", "version", "hash"],
51+
display: Display.GIT_HASH,
52+
},
4753
{
4854
kind: Card.NESTED_FIELD,
4955
label: "Branch Start Point",

services/console/src/config/project/reports.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Params } from "astro";
2+
import IconTitle from "../../components/site/IconTitle";
23
import { isAllowedProjectDelete } from "../../util/auth";
34
import { ActionButton, Button, Card, Display, Operation, Row } from "../types";
45
import { parentPath, viewUuidPath } from "../util";
5-
import IconTitle from "../../components/site/IconTitle";
66

77
export const REPORT_ICON = "far fa-list-alt";
88

@@ -82,6 +82,12 @@ const reportsConfig = {
8282
key: "branch",
8383
display: Display.BRANCH,
8484
},
85+
{
86+
kind: Card.NESTED_FIELD,
87+
label: "Branch Version Hash",
88+
keys: ["branch", "head", "version", "hash"],
89+
display: Display.GIT_HASH,
90+
},
8591
{
8692
kind: Card.FIELD,
8793
label: "Testbed",

services/console/src/config/project/reports_pub.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Params } from "astro";
2-
import { Button, Card, Display } from "../types";
32
import { PubResourceKind } from "../../components/perf/util";
3+
import { Button, Card, Display } from "../types";
44

55
const reportsPubConfig = {
66
resource: PubResourceKind.Report,
@@ -43,6 +43,12 @@ const reportsPubConfig = {
4343
key: "branch",
4444
display: Display.BRANCH,
4545
},
46+
{
47+
kind: Card.NESTED_FIELD,
48+
label: "Branch Version Hash",
49+
keys: ["branch", "head", "version", "hash"],
50+
display: Display.GIT_HASH,
51+
},
4652
{
4753
kind: Card.FIELD,
4854
label: "Testbed",

0 commit comments

Comments
 (0)