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())
|
dispatch(requestBuildset())
|
||||||
return API.fetchBuildset(tenant.apiPrefix, buildset)
|
return API.fetchBuildset(tenant.apiPrefix, buildset)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
if (response.data.builds) {
|
||||||
response.data.builds.forEach(build => {
|
response.data.builds.forEach(build => {
|
||||||
dispatch(receiveBuild(build.uuid, build))
|
dispatch(receiveBuild(build.uuid, build))
|
||||||
})
|
})
|
||||||
|
}
|
||||||
dispatch(receiveBuildset(buildset, response.data))
|
dispatch(receiveBuildset(buildset, response.data))
|
||||||
})
|
})
|
||||||
.catch(error => dispatch(failedBuildset(error)))
|
.catch(error => dispatch(failedBuildset(error)))
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const addError = error => ({
|
||||||
|
|
||||||
export const addApiError = error => {
|
export const addApiError = error => {
|
||||||
const d = {
|
const d = {
|
||||||
url: error.request.responseURL || error.url
|
url: (error && error.request && error.request.responseURL) || error.url
|
||||||
}
|
}
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
d.text = error.response.statusText
|
d.text = error.response.statusText
|
||||||
|
|
|
@ -56,6 +56,7 @@ class Buildset extends React.Component {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (buildset.builds) {
|
||||||
buildset.builds.forEach(build => {
|
buildset.builds.forEach(build => {
|
||||||
const row = []
|
const row = []
|
||||||
buildColumns.forEach(column => {
|
buildColumns.forEach(column => {
|
||||||
|
@ -77,6 +78,7 @@ class Buildset extends React.Component {
|
||||||
})
|
})
|
||||||
buildRows.push(row)
|
buildRows.push(row)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
@ -95,6 +97,7 @@ class Buildset extends React.Component {
|
||||||
</table>
|
</table>
|
||||||
</Panel.Body>
|
</Panel.Body>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
{buildset.builds &&
|
||||||
<Panel>
|
<Panel>
|
||||||
<Panel.Heading>Builds</Panel.Heading>
|
<Panel.Heading>Builds</Panel.Heading>
|
||||||
<Panel.Body>
|
<Panel.Body>
|
||||||
|
@ -118,7 +121,7 @@ class Buildset extends React.Component {
|
||||||
</table>
|
</table>
|
||||||
</Panel.Body>
|
</Panel.Body>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue