mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
fix tagManagement condition
This commit is contained in:
parent
06f24e988f
commit
bf1bff9ace
@ -120,10 +120,13 @@
|
|||||||
|
|
||||||
function matchJobTags(tags, availableTags, type, isAdmin, isSupport) {
|
function matchJobTags(tags, availableTags, type, isAdmin, isSupport) {
|
||||||
const jobTagIds = tags.map((t) => t.id)
|
const jobTagIds = tags.map((t) => t.id)
|
||||||
if (isAdmin || type == 'used') { // Always show used tags, admin also show all unused
|
|
||||||
|
if (type == 'used') { // Always show used tags
|
||||||
return availableTags.filter((at) => jobTagIds.includes(at.id))
|
return availableTags.filter((at) => jobTagIds.includes(at.id))
|
||||||
} else { // ... for unused
|
} else { // ... for unused
|
||||||
if (isSupport) { // ... show global tags for support
|
if (isAdmin) { // ... show all tags for admin
|
||||||
|
return availableTags.filter((at) => !jobTagIds.includes(at.id))
|
||||||
|
} else if (isSupport) { // ... show global tags for support
|
||||||
return availableTags.filter((at) => !jobTagIds.includes(at.id) && at.scope !== "admin")
|
return availableTags.filter((at) => !jobTagIds.includes(at.id) && at.scope !== "admin")
|
||||||
} else { // ... show only private tags for user, manager
|
} else { // ... show only private tags for user, manager
|
||||||
return availableTags.filter((at) => !jobTagIds.includes(at.id) && at.scope !== "admin" && at.scope !== "global")
|
return availableTags.filter((at) => !jobTagIds.includes(at.id) && at.scope !== "admin" && at.scope !== "global")
|
||||||
|
Loading…
Reference in New Issue
Block a user