mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-24 12:29:05 +01:00
Fix Filters and Pagination on JobList exemplarily
This commit is contained in:
parent
53391dbf8e
commit
b8e864e6e4
@ -34,7 +34,17 @@
|
|||||||
let paging = { itemsPerPage, page };
|
let paging = { itemsPerPage, page };
|
||||||
let filter = [];
|
let filter = [];
|
||||||
|
|
||||||
const jobs = queryStore({
|
// $: {
|
||||||
|
// console.log('CHANGED FILTERS IN JOBLIST TO')
|
||||||
|
// console.log('filter:', ...filter.map(f => Object.entries(f)).flat(2))
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $: {
|
||||||
|
// console.log('CHANGED PAGING IN JOBLIST TO')
|
||||||
|
// console.log(paging)
|
||||||
|
// }
|
||||||
|
|
||||||
|
$: jobs = queryStore({
|
||||||
client: getContextClient(),
|
client: getContextClient(),
|
||||||
query: gql`
|
query: gql`
|
||||||
query (
|
query (
|
||||||
@ -81,19 +91,26 @@
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: { paging, sorting, filter },
|
variables: { paging, sorting, filter },
|
||||||
pause: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const updateConfiguration = ({ name, value }) => {
|
const configName = 'plot_list_jobsPerPage'
|
||||||
result = mutationStore({
|
let configValue = ''
|
||||||
|
|
||||||
|
$: if (configValue != '') {
|
||||||
|
mutationStore({
|
||||||
client: getContextClient(),
|
client: getContextClient(),
|
||||||
query: gql`
|
query: gql`
|
||||||
mutation ($name: String!, $value: String!) {
|
mutation ($configName: String!, $configValue: String!) {
|
||||||
updateConfiguration(name: $name, value: $value)
|
updateConfiguration(name: $configName, value: $configValue)
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: { name, value },
|
variables: { configName, configValue },
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateConfiguration = ({ value, page }) => {
|
||||||
|
configValue = value;
|
||||||
|
paging = { itemsPerPage: value, page: page };
|
||||||
};
|
};
|
||||||
|
|
||||||
// $: $jobs.variables = { ...$jobs.variables, sorting, paging }
|
// $: $jobs.variables = { ...$jobs.variables, sorting, paging }
|
||||||
@ -108,13 +125,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
filter = filters;
|
filter = filters;
|
||||||
// console.log('filters:', ...filters.map(f => Object.entries(f)).flat(2))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
page = 1;
|
page = 1;
|
||||||
paging = paging = { page, itemsPerPage };
|
paging = paging = { page, itemsPerPage };
|
||||||
jobs.resume();
|
|
||||||
// $jobs.reexecute({ requestPolicy: 'network-only' })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let tableWidth = null;
|
let tableWidth = null;
|
||||||
@ -217,14 +231,12 @@
|
|||||||
if (detail.itemsPerPage != itemsPerPage) {
|
if (detail.itemsPerPage != itemsPerPage) {
|
||||||
itemsPerPage = detail.itemsPerPage;
|
itemsPerPage = detail.itemsPerPage;
|
||||||
updateConfiguration({
|
updateConfiguration({
|
||||||
name: "plot_list_jobsPerPage",
|
|
||||||
value: itemsPerPage.toString(),
|
value: itemsPerPage.toString(),
|
||||||
}).then((res) => {
|
page: detail.page,
|
||||||
if (res.error) console.error(res.error);
|
})
|
||||||
});
|
} else {
|
||||||
|
paging = { itemsPerPage: detail.itemsPerPage, page: detail.page }
|
||||||
}
|
}
|
||||||
|
|
||||||
paging = { itemsPerPage: detail.itemsPerPage, page: detail.page };
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user