web ui: fix buildset display when no builds
This corrects a problem in the error handler when some request variables are undefined. This also handles the case of a buildset with no builds; currently the REST API omits the builds value in that case, so this updates usages to handle it. Change-Id: Ifa09990d08257244f17e77e5c8141bfd8c1cc4d7
This commit is contained in:
parent
a25bab2f3c
commit
48040f229a
|
@ -332,9 +332,11 @@ const fetchBuildset = (tenant, buildset) => dispatch => {
|
|||
dispatch(requestBuildset())
|
||||
return API.fetchBuildset(tenant.apiPrefix, buildset)
|
||||
.then(response => {
|
||||
if (response.data.builds) {
|
||||
response.data.builds.forEach(build => {
|
||||
dispatch(receiveBuild(build.uuid, build))
|
||||
})
|
||||
}
|
||||
dispatch(receiveBuildset(buildset, response.data))
|
||||
})
|
||||
.catch(error => dispatch(failedBuildset(error)))
|
||||
|
|
|
@ -26,7 +26,7 @@ export const addError = error => ({
|
|||
|
||||
export const addApiError = error => {
|
||||
const d = {
|
||||
url: error.request.responseURL || error.url
|
||||
url: (error && error.request && error.request.responseURL) || error.url
|
||||
}
|
||||
if (error.response) {
|
||||
d.text = error.response.statusText
|
||||
|
|
|
@ -56,6 +56,7 @@ class Buildset extends React.Component {
|
|||
}
|
||||
})
|
||||
|
||||
if (buildset.builds) {
|
||||
buildset.builds.forEach(build => {
|
||||
const row = []
|
||||
buildColumns.forEach(column => {
|
||||
|
@ -77,6 +78,7 @@ class Buildset extends React.Component {
|
|||
})
|
||||
buildRows.push(row)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
@ -95,6 +97,7 @@ class Buildset extends React.Component {
|
|||
</table>
|
||||
</Panel.Body>
|
||||
</Panel>
|
||||
{buildset.builds &&
|
||||
<Panel>
|
||||
<Panel.Heading>Builds</Panel.Heading>
|
||||
<Panel.Body>
|
||||
|
@ -118,7 +121,7 @@ class Buildset extends React.Component {
|
|||
</table>
|
||||
</Panel.Body>
|
||||
</Panel>
|
||||
|
||||
}
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue