Add support for multiple projects per manager

- Handled like roles in admin view
- !! NEW COLUMN CHANGED TO "projects"
This commit is contained in:
Christoph Kluge
2023-02-17 15:45:31 +01:00
parent a2ebebd7f6
commit 397ab08b3b
27 changed files with 354 additions and 170 deletions

View File

@@ -14,17 +14,19 @@
export let type
export let filterPresets
export let project = false
export let projects = []
export let isManager = false
console.assert(type == 'USER' || type == 'PROJECT', 'Invalid list type provided!')
let projectFilter = null
let projectsFilter = null
//Setup default filter
if (type == 'USER' && isManager == true && project != '') {
projectFilter = { project: {eq: project} }
} else if (type == 'USER' && isManager == true && project == '') {
projectFilter = { project: {eq: "noProjectForManager"} }
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!]!) {
@@ -88,8 +90,8 @@
menuText="Only {type.toLowerCase()}s with jobs that match the filters will show up"
on:update={({ detail }) => {
$stats.variables = { filter: detail.filters }
if (projectFilter != null) {
$stats.variables.filter.push(projectFilter)
if (projectsFilter != null) {
$stats.variables.filter.push(projectsFilter)
}
$stats.context.pause = false
$stats.reexecute()