web: open searched documents in the viewer and name the run's pipeline
A markdown/text artifact hit now opens the artifact viewer (with its Open run action) instead of a raw browser tab, and the run Summary's Pipeline row shows the pipeline's name beside its id and version, all in the link to the definition.
This commit is contained in:
@@ -205,6 +205,8 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
.kv-pipeline-link:hover { color: var(--color-text); }
|
||||
.kv-pipeline-name { font-weight: 600; }
|
||||
.kv-pipeline-ident { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 400; }
|
||||
|
||||
.stat-add { color: var(--ok); }
|
||||
.stat-del { color: var(--bad); }
|
||||
|
||||
@@ -143,6 +143,7 @@ export function summaryRows(run, nowMillis, options = {}) {
|
||||
key: "Pipeline",
|
||||
value: `id ${run.pipeline_id} · v${run.version ?? 0}`,
|
||||
pipelineId: Number(run.pipeline_id),
|
||||
pipelineName: String(run.name ?? ""),
|
||||
version: Number(run.version) || 0,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -250,10 +250,17 @@ function renderPipelineRow(row) {
|
||||
const link = h("button", {
|
||||
class: "kv-val kv-pipeline-link",
|
||||
type: "button",
|
||||
text: row.value,
|
||||
title: `Open pipeline ${row.pipelineId}`,
|
||||
"aria-label": `Open pipeline ${row.pipelineId}, version ${row.version}`,
|
||||
"aria-label": `Open pipeline ${row.pipelineName || row.pipelineId}, version ${row.version}`,
|
||||
});
|
||||
if (row.pipelineName) {
|
||||
link.append(
|
||||
h("span", { class: "kv-pipeline-name", text: row.pipelineName }),
|
||||
h("span", { class: "kv-pipeline-ident", text: row.value }),
|
||||
);
|
||||
} else {
|
||||
link.textContent = row.value;
|
||||
}
|
||||
link.addEventListener("click", async () => {
|
||||
state.view = "pipelines";
|
||||
state.selectedRunId = null;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { h } from "../dom.js";
|
||||
import { describeError } from "../format.js";
|
||||
import { resolveArtifactUrl } from "../serverUrl.js";
|
||||
import { ArtifactKind, artifactKind } from "../artifacts.js";
|
||||
import { ArtifactKind, artifactKind, isViewerArtifact } from "../artifacts.js";
|
||||
import {
|
||||
DEFAULT_SEARCH_KIND,
|
||||
DEFAULT_SEARCH_SORT,
|
||||
@@ -560,14 +560,16 @@ async function routeSearchResult(hit) {
|
||||
const resolved = resolveArtifactUrl(state.url, artifact.url);
|
||||
if (!resolved) return;
|
||||
closeSearch();
|
||||
const kind = artifactKind(artifact.content_type, artifact.name);
|
||||
if (kind === ArtifactKind.Image || kind === ArtifactKind.Video) {
|
||||
// Media, markdown and text all belong in the viewer, which now renders the
|
||||
// document and offers the trip back to the run; anything else opens raw.
|
||||
if (isViewerArtifact(artifact.content_type, artifact.name)) {
|
||||
rt.views.dialogs.openArtifactViewer(
|
||||
[
|
||||
{
|
||||
url: artifact.url,
|
||||
name: artifact.name,
|
||||
content_type: artifact.content_type,
|
||||
size_bytes: artifact.size_bytes,
|
||||
run_id: artifact.run_id,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -184,12 +184,13 @@ test("summaryRows is the Android order, omitting blank values", () => {
|
||||
});
|
||||
|
||||
test("the Pipeline summary row carries the pipeline and version for navigation", () => {
|
||||
const rows = summaryRows({ pipeline_id: 24, version: 6, status: "succeeded" }, 0, TIME_OPTS);
|
||||
const rows = summaryRows({ pipeline_id: 24, name: "Plan and land", version: 6, status: "succeeded" }, 0, TIME_OPTS);
|
||||
const row = rows.find((entry) => entry.kind === "pipeline");
|
||||
assert.ok(row, "a pipeline row rather than plain text");
|
||||
assert.equal(row.key, "Pipeline");
|
||||
assert.equal(row.value, "id 24 · v6");
|
||||
assert.equal(row.pipelineId, 24);
|
||||
assert.equal(row.pipelineName, "Plan and land");
|
||||
assert.equal(row.version, 6);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user