mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-08-29 21:32:59 +02:00
Add 'project' to user table, add 'manager' role, conditional web render
- Addresses issues #40 #45 #82 - Reworked Navigation Header for all roles - 'Manager' role added, can be assigned a project-id in config by admins - BREAKING! -> Added 'project' column in SQLite3 table 'user' - Manager-Assigned project will be added to all graphql filters: Only show Jobs and Users of given project - 'My Jobs' Tab for all Roles - Switched from Bool "isAdmin" to integer authLevels - Removed critical data frontend logging - Reworked repo.query.SecurityCheck()
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!--
|
||||
<!--
|
||||
@component List of users or projects
|
||||
-->
|
||||
<script>
|
||||
@@ -14,9 +14,19 @@
|
||||
|
||||
export let type
|
||||
export let filterPresets
|
||||
export let project = false
|
||||
export let isManager = false
|
||||
|
||||
console.assert(type == 'USER' || type == 'PROJECT', 'Invalid list type provided!')
|
||||
|
||||
let projectFilter = 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"} }
|
||||
}
|
||||
|
||||
const stats = operationStore(`query($filter: [JobFilter!]!) {
|
||||
rows: jobsStatistics(filter: $filter, groupBy: ${type}) {
|
||||
id
|
||||
@@ -54,7 +64,7 @@
|
||||
: (sorting.direction == 'up'
|
||||
? (a, b) => a[sorting.field] - b[sorting.field]
|
||||
: (a, b) => b[sorting.field] - a[sorting.field])
|
||||
|
||||
|
||||
return stats.filter(u => u.id.includes(nameFilter)).sort(cmp)
|
||||
}
|
||||
|
||||
@@ -78,6 +88,9 @@
|
||||
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)
|
||||
}
|
||||
$stats.context.pause = false
|
||||
$stats.reexecute()
|
||||
}} />
|
||||
@@ -148,4 +161,4 @@
|
||||
{/each}
|
||||
{/if}
|
||||
</tbody>
|
||||
</Table>
|
||||
</Table>
|
||||
|
Reference in New Issue
Block a user