Fix skipped builds filter in web ui

The change to automatically filter out skipped builds inadvertently
affected the buildsets tab as well since they share the query builder.
This caused the buildsets tab to automatically append a filter which
is invalid for buildsets and therefore return a 404.

This change adds an argument to the query builder to indicate whether
it should include the automatic filter.

Additionally, the query builder had an error which caused it to
append the query in all cases (which affects the otherwise working
builds tab).  This change corrects that as well.

Change-Id: Id03eee51b3551c4b32ae3c6b784b0993c4a3779c
This commit is contained in:
James E. Blair 2022-11-01 14:40:17 -07:00
parent 3c8d460bf8
commit f9b0cca24d
3 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- |
An error which prevented results from appearing in the web UI on
the "Buildsets" tab has been corrected.

View File

@ -317,13 +317,13 @@ function writeFiltersToUrl(filters, location, history) {
})
}
function buildQueryString(filters) {
function buildQueryString(filters, excludeResults) {
let queryString = '&complete=true'
let resultFilter = false
if (filters) {
Object.keys(filters).map((key) => {
filters[key].forEach((value) => {
if (value === 'result') {
if (key === 'result') {
resultFilter = true
}
queryString += '&' + key + '=' + value
@ -331,7 +331,7 @@ function buildQueryString(filters) {
return queryString
})
}
if (!resultFilter) {
if (excludeResults && !resultFilter) {
queryString += '&exclude_result=SKIPPED'
}
return queryString

View File

@ -158,7 +158,7 @@ class BuildsPage extends React.Component {
limit: filters.limit.length > 0 ? filters.limit : [50,]
}
let _filters = { ...filters, ...paginationOptions }
const queryString = buildQueryString(_filters)
const queryString = buildQueryString(_filters, true)
this.setState({ fetching: true })
// TODO (felix): What happens in case of a broken network connection? Is the
// fetching shows infinitely or can we catch this and show an erro state in