Centralize project filter for manager role

- Remove all unnecessary frontend code for managerfilters
This commit is contained in:
Christoph Kluge
2023-02-20 11:24:18 +01:00
parent 397ab08b3b
commit 68efe871c7
15 changed files with 14 additions and 121 deletions

View File

@@ -14,21 +14,9 @@
export let type
export let filterPresets
export let projects = []
export let isManager = false
console.assert(type == 'USER' || type == 'PROJECT', 'Invalid list type provided!')
let projectsFilter = null
//Setup default filter
if (type == 'USER' && isManager == true && projects.length == 0) {
projectsFilter = { project: {eq: "noProjectForManager"} }
} else if (type == 'USER' && isManager == true && projects.length == 1) {
projectsFilter = { project: {eq: projects[0]} }
} else {
projectsFilter = { multiProject: projects }
}
const stats = operationStore(`query($filter: [JobFilter!]!) {
rows: jobsStatistics(filter: $filter, groupBy: ${type}) {
id
@@ -90,9 +78,6 @@
menuText="Only {type.toLowerCase()}s with jobs that match the filters will show up"
on:update={({ detail }) => {
$stats.variables = { filter: detail.filters }
if (projectsFilter != null) {
$stats.variables.filter.push(projectsFilter)
}
$stats.context.pause = false
$stats.reexecute()
}} />