Merge pull request #6936 from jlmitch5/defaultsInQS

add defaults to qs instead of passing as additional params to api requests

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-05-11 18:30:35 +00:00 committed by GitHub
commit 6a003919c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 15 deletions

View File

@ -23,17 +23,19 @@ import {
WorkflowJobsAPI,
} from '@api';
const QS_CONFIG = getQSConfig(
'job',
{
page: 1,
page_size: 20,
order_by: '-finished',
},
['page', 'page_size']
);
function JobList({ i18n, defaultParams, showTypeColumn = false }) {
const QS_CONFIG = getQSConfig(
'job',
{
page: 1,
page_size: 20,
order_by: '-finished',
not__launch_type: 'sync',
...defaultParams,
},
['page', 'page_size']
);
const [selected, setSelected] = useState([]);
const location = useLocation();
@ -48,7 +50,7 @@ function JobList({ i18n, defaultParams, showTypeColumn = false }) {
const {
data: { count, results },
} = await UnifiedJobsAPI.read({ ...params, ...defaultParams });
} = await UnifiedJobsAPI.read({ ...params });
return {
itemCount: count,

View File

@ -53,10 +53,7 @@ function Jobs({ i18n }) {
<Switch>
<Route exact path={match.path}>
<PageSection>
<JobList
showTypeColumn
defaultParams={{ not__launch_type: 'sync' }}
/>
<JobList showTypeColumn />
</PageSection>
</Route>
<Route path={`${match.path}/:id/details`}>