Skip to content

Commit 15b21f2

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

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
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/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",

0 commit comments

Comments
 (0)