Add exclude_results to web UI buildset filtering
Building on the previous change to add exclude_results to the api, this change adds implicit filtering of buildsets with results of NO_JOBS or DEQUEUED. If a user explicitly filters for results, the implicit exclusions are dropped so that a user may still see a list of DEQUEUED results if desired. The feature to drop the implicit exclusion of SKIPPED results was broken; this change fixes that as well. Change-Id: I5319edb2546a93e3a62e21a76f330e5f8e81548b
This commit is contained in:
parent
0376a8f1d1
commit
3467fca4f7
@ -15,21 +15,24 @@
|
||||
|
||||
import { makeQueryString } from './FilterToolbar'
|
||||
|
||||
function makeBuildQueryString(filters, excludeResults) {
|
||||
function makeBuildQueryString(filters) {
|
||||
let queryString = makeQueryString(filters)
|
||||
let resultFilter = false
|
||||
if (filters) {
|
||||
Object.keys(filters).forEach((key) => {
|
||||
if (filters[key] === 'result') {
|
||||
resultFilter = true
|
||||
}
|
||||
})
|
||||
}
|
||||
if (excludeResults && !resultFilter) {
|
||||
queryString += '&exclude_result=SKIPPED'
|
||||
const resultFilter = filters && filters['result'].length > 0
|
||||
if (!resultFilter) {
|
||||
queryString += '&exclude_result=SKIPPED'
|
||||
}
|
||||
queryString += '&complete=true'
|
||||
return queryString
|
||||
}
|
||||
|
||||
export { makeBuildQueryString }
|
||||
function makeBuildsetQueryString(filters) {
|
||||
let queryString = makeQueryString(filters)
|
||||
const resultFilter = filters && filters['result'].length > 0
|
||||
if (!resultFilter) {
|
||||
queryString += '&exclude_result=NO_JOBS&exclude_result=DEQUEUED'
|
||||
}
|
||||
queryString += '&complete=true'
|
||||
return queryString
|
||||
}
|
||||
|
||||
export { makeBuildQueryString, makeBuildsetQueryString }
|
||||
|
@ -158,7 +158,7 @@ class BuildsPage extends React.Component {
|
||||
limit: filters.limit.length > 0 ? filters.limit : [50,]
|
||||
}
|
||||
let _filters = { ...filters, ...paginationOptions }
|
||||
const queryString = makeBuildQueryString(_filters, true)
|
||||
const queryString = makeBuildQueryString(_filters)
|
||||
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
|
||||
|
@ -24,7 +24,7 @@ import {
|
||||
getFiltersFromUrl,
|
||||
writeFiltersToUrl,
|
||||
} from '../containers/FilterToolbar'
|
||||
import { makeBuildQueryString } from '../containers/BuildQuery'
|
||||
import { makeBuildsetQueryString } from '../containers/BuildQuery'
|
||||
import BuildsetTable from '../containers/build/BuildsetTable'
|
||||
|
||||
class BuildsetsPage extends React.Component {
|
||||
@ -67,13 +67,14 @@ class BuildsetsPage extends React.Component {
|
||||
title: 'Result',
|
||||
placeholder: 'Filter by Result...',
|
||||
type: 'select',
|
||||
// are there more?
|
||||
options: [
|
||||
'SUCCESS',
|
||||
'FAILURE',
|
||||
'MERGE_CONFLICT',
|
||||
'MERGE_FAILURE',
|
||||
'DEQUEUED',
|
||||
'CONFIG_ERROR',
|
||||
'NO_JOBS',
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -115,7 +116,7 @@ class BuildsetsPage extends React.Component {
|
||||
limit: filters.limit.length > 0 ? filters.limit : [50,]
|
||||
}
|
||||
let _filters = { ...filters, ...paginationOptions }
|
||||
const queryString = makeBuildQueryString(_filters)
|
||||
const queryString = makeBuildsetQueryString(_filters)
|
||||
this.setState({ fetching: true })
|
||||
fetchBuildsets(this.props.tenant.apiPrefix, queryString).then(
|
||||
(response) => {
|
||||
|
Loading…
Reference in New Issue
Block a user