Handle artifacts without metadata on build page

This corrects a fatal error when attempting to dereference
artifact.metadata when rendering the metadata table.  To correct
this, we remove the expansion option from the tree if the artifact
has no metadata.

Change-Id: Ic156bad79a29c1815d7e18c0e0076ed3b85c6509
This commit is contained in:
James E. Blair 2019-07-31 08:55:38 -07:00
parent 86a8eee33f
commit 18f8175b41
1 changed files with 9 additions and 6 deletions

View File

@ -49,12 +49,15 @@ class ArtifactList extends React.Component {
render() {
const { build } = this.props
const nodes = build.artifacts.map((artifact, index) => (
{text: <a href={artifact.url}>{artifact.name}</a>,
icon: null,
nodes: [{text: <Artifact key={index} artifact={artifact}/>,
icon: ''}]}
))
const nodes = build.artifacts.map((artifact, index) => {
const node = {text: <a href={artifact.url}>{artifact.name}</a>,
icon: null}
if (artifact.metadata) {
node['nodes']= [{text: <Artifact key={index} artifact={artifact}/>,
icon: ''}]
}
return node
})
return (
<div className="tree-view-container">