From f330fc67fd112f74ff90a468e2ef3214cb3ae5bd Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 3 Feb 2020 15:44:29 -0800 Subject: [PATCH] web: link to index.html if index_links is set If the deployer has indicated that they would prefer the dashboard to link to index.html files rather than bare directories, do so. This is in aid of object storage systems where index.html is not automatically returned for directories. Change-Id: Iacbc016396f9e6681dd6c945224c5f63af24c5df --- web/src/actions/build.js | 3 ++- web/src/containers/build/Manifest.jsx | 9 +++++++-- web/src/containers/build/Summary.jsx | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/web/src/actions/build.js b/web/src/actions/build.js index afb8813778..6898f84d82 100644 --- a/web/src/actions/build.js +++ b/web/src/actions/build.js @@ -235,7 +235,8 @@ const receiveBuildManifest = (buildId, manifest) => { return { type: BUILD_MANIFEST_SUCCESS, buildId: buildId, - manifest: {tree: manifest.tree, index: index}, + manifest: {tree: manifest.tree, index: index, + index_links: manifest.index_links}, receivedAt: Date.now() } } diff --git a/web/src/containers/build/Manifest.jsx b/web/src/containers/build/Manifest.jsx index f922bdeb18..701e7dd09f 100644 --- a/web/src/containers/build/Manifest.jsx +++ b/web/src/containers/build/Manifest.jsx @@ -31,6 +31,11 @@ class Manifest extends React.Component { render() { const { tenant, build } = this.props + const raw_suffix = (obj) => { + return (obj.mimetype === 'application/directory' && + build.manifest.index_links) ? 'index.html' : '' + } + const nodes = build.manifest.tree.map( n => renderTree( tenant, build, '/', n, @@ -40,13 +45,13 @@ class Manifest extends React.Component { to={tenant.linkPrefix + '/build/' + build.uuid + '/log' + path + name}> {obj.name} -   (raw +   (raw  ) ), (log_url, path, name, obj) => ( {obj.name} -   (raw +   (raw  ) ))) diff --git a/web/src/containers/build/Summary.jsx b/web/src/containers/build/Summary.jsx index 805c5d3d0a..c03f24c3c6 100644 --- a/web/src/containers/build/Summary.jsx +++ b/web/src/containers/build/Summary.jsx @@ -84,9 +84,15 @@ class Summary extends React.Component { } if (column === 'log_url') { label = 'log url' + if (build.manifest && build.manifest.index_links) { + value = {value} + } else { + value = {value} + } } if (column === 'ref_url') { label = 'ref url' + value = {value} } if (column === 'event_id') { label = 'event id'