feat: surface live build metadata on workbench
This commit is contained in:
@@ -3118,16 +3118,30 @@ async function inspectLiveDom(url, options = {}) {
|
||||
outerScrollLocked: document.documentElement.scrollHeight <= document.documentElement.clientHeight + 2,
|
||||
rootAfterScrollAttempt,
|
||||
liveBuildLatest: document.querySelector("#live-build-latest")?.textContent?.replace(/\s+/gu, " ").trim() ?? "",
|
||||
liveBuildRows: document.querySelectorAll("#live-build-list .live-build-row").length,
|
||||
liveBuildDefaultVisible: visible("#live-build-latest"),
|
||||
liveBuildSummaryOpen: document.querySelector("#live-build-summary")?.open === true,
|
||||
liveBuildListVisibleWhenClosed: visible("#live-build-list"),
|
||||
liveBuildListScrollableWhenOpen: (() => {
|
||||
liveBuildDetailWhenOpen: (() => {
|
||||
const details = document.querySelector("#live-build-summary");
|
||||
const list = document.querySelector("#live-build-list");
|
||||
if (!details || !list) return false;
|
||||
if (!details || !list) {
|
||||
return {
|
||||
visible: false,
|
||||
rows: 0,
|
||||
scrollContained: false,
|
||||
text: "",
|
||||
overflowX: 0
|
||||
};
|
||||
}
|
||||
details.open = true;
|
||||
return visible("#live-build-list") && list.scrollHeight >= list.clientHeight && list.clientHeight <= Math.ceil(window.innerHeight * 0.42) + 4;
|
||||
const rows = [...list.querySelectorAll(".live-build-row")];
|
||||
return {
|
||||
visible: visible("#live-build-list"),
|
||||
rows: rows.length,
|
||||
scrollContained: list.clientHeight <= Math.ceil(window.innerHeight * 0.42) + 4,
|
||||
text: list.textContent?.replace(/\s+/gu, " ").trim() ?? "",
|
||||
overflowX: Math.max(0, ...rows.map((row) => row.scrollWidth - row.clientWidth), list.scrollWidth - list.clientWidth)
|
||||
};
|
||||
})(),
|
||||
firstViewportForbiddenPresent: forbiddenTerms.filter((term) => textHasForbiddenTerm(firstViewportText, term)),
|
||||
firstViewportTextSample: firstViewportText.slice(0, 400),
|
||||
@@ -3189,10 +3203,19 @@ async function inspectLiveDom(url, options = {}) {
|
||||
/最新镜像构建时间:\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} 北京时间/u.test(dom.liveBuildLatest) &&
|
||||
/hwlab-agent-mgr/u.test(dom.liveBuildLatest) &&
|
||||
/tag f09ad05/u.test(dom.liveBuildLatest) &&
|
||||
dom.liveBuildRows === 0 &&
|
||||
/commit f09ad05/u.test(dom.liveBuildLatest) &&
|
||||
/revision f09ad05/u.test(dom.liveBuildLatest) &&
|
||||
dom.liveBuildSummaryOpen === false &&
|
||||
dom.liveBuildListVisibleWhenClosed === false &&
|
||||
dom.liveBuildListScrollableWhenOpen &&
|
||||
dom.liveBuildDetailWhenOpen.visible &&
|
||||
dom.liveBuildDetailWhenOpen.rows >= 4 &&
|
||||
dom.liveBuildDetailWhenOpen.scrollContained &&
|
||||
dom.liveBuildDetailWhenOpen.overflowX <= 1 &&
|
||||
/hwlab-cloud-api/u.test(dom.liveBuildDetailWhenOpen.text) &&
|
||||
/hwlab-agent-worker/u.test(dom.liveBuildDetailWhenOpen.text) &&
|
||||
/构建时间不可用/u.test(dom.liveBuildDetailWhenOpen.text) &&
|
||||
/外部镜像或非 HWLAB 构建产物/u.test(dom.liveBuildDetailWhenOpen.text) &&
|
||||
/来源 health metadata/u.test(dom.liveBuildDetailWhenOpen.text) &&
|
||||
dom.firstViewportForbiddenPresent.length === 0 &&
|
||||
dom.labelsPresent &&
|
||||
dom.navLabelsPresent &&
|
||||
@@ -3227,7 +3250,8 @@ async function inspectLiveDom(url, options = {}) {
|
||||
`bodyOverflow=${dom.bodyOverflow}`,
|
||||
`htmlOverflow=${dom.htmlOverflow}`,
|
||||
`liveBuildLatest=${dom.liveBuildLatest}`,
|
||||
`liveBuildRowsClosed=${dom.liveBuildRows}`,
|
||||
`liveBuildRowsOpen=${dom.liveBuildDetailWhenOpen.rows}`,
|
||||
`liveBuildOverflowX=${dom.liveBuildDetailWhenOpen.overflowX}`,
|
||||
`firstViewportForbidden=${dom.firstViewportForbiddenPresent.join(",") || "none"}`,
|
||||
`gateRouteAvailable=${dom.gateRouteAvailable}`,
|
||||
`wiringLayout=${dom.wiringLayout}`,
|
||||
@@ -5566,7 +5590,7 @@ function liveBuildsFixturePayload() {
|
||||
contractVersion: "live-builds-v1",
|
||||
observedAt: "2026-05-23T00:30:00.000Z",
|
||||
source: {
|
||||
kind: "live-health",
|
||||
kind: "live-health+artifact-catalog",
|
||||
route: "/v1/live-builds",
|
||||
healthPath: "/health/live"
|
||||
},
|
||||
@@ -5577,7 +5601,8 @@ function liveBuildsFixturePayload() {
|
||||
status: "ok",
|
||||
build: {
|
||||
createdAt: "2026-05-23T00:20:00.000Z",
|
||||
metadataSource: "runtime-env:HWLAB_BUILD_CREATED_AT"
|
||||
metadataSource: "runtime-env:HWLAB_BUILD_CREATED_AT",
|
||||
liveHealthMissingReason: "health payload 缺少 build.createdAt / image.createdAt / buildCreatedAt,已使用 repo-owned artifact metadata"
|
||||
},
|
||||
image: {
|
||||
reference: "127.0.0.1:5000/hwlab/hwlab-agent-mgr:f09ad05",
|
||||
@@ -5591,11 +5616,11 @@ function liveBuildsFixturePayload() {
|
||||
revision: "f09ad05dec5f2bbca12ae661b140a87dfcbf54a4"
|
||||
},
|
||||
counts: {
|
||||
total: 4,
|
||||
total: 5,
|
||||
hwlab: 4,
|
||||
withBuildTime: 2,
|
||||
unavailable: 2,
|
||||
external: 0
|
||||
external: 1
|
||||
},
|
||||
services: [
|
||||
{
|
||||
@@ -5638,6 +5663,27 @@ function liveBuildsFixturePayload() {
|
||||
},
|
||||
revision: "f09ad05dec5f2bbca12ae661b140a87dfcbf54a4"
|
||||
},
|
||||
{
|
||||
serviceId: "hwlab-frpc",
|
||||
name: "hwlab-frpc",
|
||||
kind: "external",
|
||||
status: "external",
|
||||
build: {
|
||||
createdAt: null,
|
||||
metadataSource: "external-image",
|
||||
unavailableReason: "外部镜像或非 HWLAB 构建产物"
|
||||
},
|
||||
image: {
|
||||
reference: "127.0.0.1:5000/hwlab/frpc:v0.68.1",
|
||||
tag: "v0.68.1",
|
||||
digest: "unknown"
|
||||
},
|
||||
commit: {
|
||||
id: "unknown",
|
||||
source: "external-image"
|
||||
},
|
||||
revision: "unknown"
|
||||
},
|
||||
{
|
||||
serviceId: "hwlab-agent-worker",
|
||||
name: "hwlab-agent-worker",
|
||||
|
||||
Reference in New Issue
Block a user