Conditionally add index.html to the "view log" link

If the site has configured zuul manifest generation with
"index_links" set to true, they have indicated that the zuul web
ui needs to append "index.html" to all of the directory entries
listed in the zuul manifest when generating the "Logs" tab.

The same is almost certainly true for the raw link to the log
location (appearing as "View log" in the summary area), so once
we retrieve the manifest, if index_links is set there, then
set the "View log" link to also include an index.html.

If the manifest is missing, then we will fall back to returning
just the raw URL (and seeing the actual URL returned to Zuul may
be preferable when debugging log failures anyway). For most users,
most of the time, this should produce a reasonable "View log" link.

Change-Id: Ia63943742a7a20bbf271a4de692dd41f2fe0016d
This commit is contained in:
James E. Blair
2023-10-23 17:21:01 -07:00
parent d781291dbf
commit beb4f97c13

View File

@@ -47,8 +47,11 @@ function Build({ build, tenant, timezone, user }) {
const ref = build.change ? '' : build.ref
const project = build.project
const job_name = build.job_name
const build_link = buildExternalLink(build)
const index_links = build.manifest && build.manifest.index_links
const build_log_url = build.log_url ?
(index_links ? build.log_url + 'index.html' : build.log_url)
: ''
function renderAutoholdButton() {
const value = (
@@ -252,8 +255,8 @@ function Build({ build, tenant, timezone, user }) {
WrapElement={ListItem}
icon={<FileCodeIcon />}
value={
build.log_url ? (
<ExternalLink target={build.log_url}>View log</ExternalLink>
build_log_url ? (
<ExternalLink target={build_log_url}>View log</ExternalLink>
) : (
<span
style={{