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
This commit is contained in:
James E. Blair 2020-02-03 15:44:29 -08:00 committed by Tobias Henkel
parent 00578d721c
commit f330fc67fd
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
3 changed files with 15 additions and 3 deletions

View File

@ -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()
}
}

View File

@ -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}
</Link>
&nbsp;&nbsp;(<a href={log_url + path + name}>raw</a>
&nbsp;&nbsp;(<a href={log_url + path + name + raw_suffix(obj)}>raw</a>
&nbsp;<span className="fa fa-external-link"/>)
</span>),
(log_url, path, name, obj) => (
<span>
{obj.name}
&nbsp;&nbsp;(<a href={log_url + path + name}>raw</a>
&nbsp;&nbsp;(<a href={log_url + path + name + raw_suffix(obj)}>raw</a>
&nbsp;<span className="fa fa-external-link"/>)
</span>
)))

View File

@ -84,9 +84,15 @@ class Summary extends React.Component {
}
if (column === 'log_url') {
label = 'log url'
if (build.manifest && build.manifest.index_links) {
value = <a href={value + 'index.html'}>{value}</a>
} else {
value = <a href={value}>{value}</a>
}
}
if (column === 'ref_url') {
label = 'ref url'
value = <a href={value}>{value}</a>
}
if (column === 'event_id') {
label = 'event id'