mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-08-29 21:32:59 +02:00
Add support for multiple projects per manager
- Handled like roles in admin view - !! NEW COLUMN CHANGED TO "projects"
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user