2024-07-25 17:10:00 +02:00
|
|
|
<!--
|
|
|
|
@component Admin settings wrapper
|
|
|
|
-->
|
|
|
|
|
2022-08-26 11:45:14 +02:00
|
|
|
<script>
|
2024-03-09 10:30:40 +01:00
|
|
|
import { Row, Col } from "@sveltestrap/sveltestrap";
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
import EditRole from "./admin/EditRole.svelte";
|
|
|
|
import EditProject from "./admin/EditProject.svelte";
|
|
|
|
import AddUser from "./admin/AddUser.svelte";
|
|
|
|
import ShowUsers from "./admin/ShowUsers.svelte";
|
|
|
|
import Options from "./admin/Options.svelte";
|
2022-08-26 11:45:14 +02:00
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
let users = [];
|
|
|
|
let roles = [];
|
2022-08-26 11:45:14 +02:00
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
function getUserList() {
|
2024-07-03 17:24:26 +02:00
|
|
|
fetch("/config/users/?via-ldap=false¬-just-user=true")
|
2024-03-09 10:30:40 +01:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((usersRaw) => {
|
|
|
|
users = usersRaw;
|
|
|
|
});
|
|
|
|
}
|
2022-08-26 11:45:14 +02:00
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
function getValidRoles() {
|
2024-07-03 17:24:26 +02:00
|
|
|
fetch("/config/roles/")
|
2024-03-09 10:30:40 +01:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((rolesRaw) => {
|
|
|
|
roles = rolesRaw;
|
|
|
|
});
|
|
|
|
}
|
2023-01-30 17:01:11 +01:00
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
function initAdmin() {
|
|
|
|
getUserList();
|
|
|
|
getValidRoles();
|
|
|
|
}
|
2022-08-26 11:45:14 +02:00
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
onMount(() => initAdmin());
|
2022-08-26 11:45:14 +02:00
|
|
|
</script>
|
|
|
|
|
2024-03-09 10:30:40 +01:00
|
|
|
<Row cols={2} class="p-2 g-2">
|
|
|
|
<Col class="mb-1">
|
|
|
|
<AddUser {roles} on:reload={getUserList} />
|
|
|
|
</Col>
|
|
|
|
<Col class="mb-1">
|
|
|
|
<ShowUsers on:reload={getUserList} bind:users />
|
|
|
|
</Col>
|
|
|
|
<Col>
|
|
|
|
<EditRole {roles} on:reload={getUserList} />
|
|
|
|
</Col>
|
|
|
|
<Col>
|
|
|
|
<EditProject on:reload={getUserList} />
|
|
|
|
</Col>
|
2024-09-24 11:13:39 +02:00
|
|
|
<Options />
|
2022-08-26 11:45:14 +02:00
|
|
|
</Row>
|