yocto_console_view: Keep known revision mappings

The yp_build_revision property disappears from the build instance once
the build is done. There is no reason for its value to change, so keep
the last seen value in revision mapping. This will prevent finished
builds to jump back to "Unresolved Revision".

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mathieu Dubois-Briand 2025-02-11 15:48:19 +01:00 committed by Richard Purdie
parent d9bcc41cf7
commit 2ab0fa45dd

View File

@ -208,6 +208,9 @@ function selectChangeForBuild(build: Build, buildset: Buildset,
return fakeChange
}
const revMapping = new Map<int, string>();
const branchMapping = new Map<int, string>();
export const ConsoleView = observer(() => {
const accessor = useDataAccessor([]);
@ -263,8 +266,6 @@ export const ConsoleView = observer(() => {
builderIdsWithBuilds.add(build.builderid);
}
const revMapping = new Map<int, string>();
const branchMapping = new Map<int, string>();
for (const build of buildsQuery.array) {
let change = false;
let {
@ -278,26 +279,6 @@ export const ConsoleView = observer(() => {
branchMapping[build.buildid] = build.properties.yp_build_branch[0];
change = true;
}
if ((!revMapping[buildid] || !branchMapping[buildid]) && !build.complete_at) {
build.getProperties().onChange = properties => {
change = false;
buildid = properties.endpoint.split('/')[1];
if (!revMapping[buildid]) {
const rev = getBuildProperty(properties[0], 'yp_build_revision');
if (rev != null) {
revMapping[buildid] = rev;
change = true;
}
}
if (!branchMapping[buildid]) {
const branch = getBuildProperty(properties[0], 'yp_build_branch');
if (branch != null) {
branchMapping[buildid] = branch;
change = true;
}
}
};
}
}
function getBuildProperty(properties, property) {