2022-08-26 11:45:14 +02:00
|
|
|
<script>
|
|
|
|
import { Row, Col } from 'sveltestrap'
|
|
|
|
import { onMount } from 'svelte'
|
2022-08-26 15:15:36 +02:00
|
|
|
import EditRole from './admin/EditRole.svelte'
|
2023-01-27 18:36:58 +01:00
|
|
|
import EditProject from './admin/EditProject.svelte'
|
2022-08-26 11:45:14 +02:00
|
|
|
import AddUser from './admin/AddUser.svelte'
|
|
|
|
import ShowUsers from './admin/ShowUsers.svelte'
|
|
|
|
import Options from './admin/Options.svelte'
|
|
|
|
|
|
|
|
let users = []
|
2023-01-30 17:01:11 +01:00
|
|
|
let roles = []
|
2022-08-26 11:45:14 +02:00
|
|
|
|
|
|
|
function getUserList() {
|
|
|
|
fetch('/api/users/?via-ldap=false¬-just-user=true')
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(usersRaw => {
|
|
|
|
users = usersRaw
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-01-30 17:01:11 +01:00
|
|
|
function getValidRoles() {
|
|
|
|
fetch('/api/roles/')
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(rolesRaw => {
|
|
|
|
roles = rolesRaw
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function initAdmin() {
|
|
|
|
getUserList()
|
|
|
|
getValidRoles()
|
|
|
|
}
|
|
|
|
|
|
|
|
onMount(() => initAdmin())
|
2022-08-26 11:45:14 +02:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<Row cols={2} class="p-2 g-2" >
|
|
|
|
<Col class="mb-1">
|
2023-01-30 17:01:11 +01:00
|
|
|
<AddUser roles={roles} on:reload={getUserList}/>
|
2022-08-26 11:45:14 +02:00
|
|
|
</Col>
|
|
|
|
<Col class="mb-1">
|
|
|
|
<ShowUsers on:reload={getUserList} bind:users={users}/>
|
|
|
|
</Col>
|
|
|
|
<Col>
|
2023-01-30 17:01:11 +01:00
|
|
|
<EditRole roles={roles} on:reload={getUserList}/>
|
2022-08-26 11:45:14 +02:00
|
|
|
</Col>
|
2023-01-27 18:36:58 +01:00
|
|
|
<Col>
|
|
|
|
<EditProject on:reload={getUserList}/>
|
|
|
|
</Col>
|
2022-08-26 11:45:14 +02:00
|
|
|
<Col>
|
|
|
|
<Options/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|