adds UI elements for toggling builder access
This commit is contained in:
parent
85e6472c3a
commit
3080d0a8c4
|
@ -9,6 +9,8 @@
|
||||||
Divider,
|
Divider,
|
||||||
Label,
|
Label,
|
||||||
Input,
|
Input,
|
||||||
|
Select,
|
||||||
|
Toggle,
|
||||||
Modal,
|
Modal,
|
||||||
Table,
|
Table,
|
||||||
ModalContent,
|
ModalContent,
|
||||||
|
@ -33,23 +35,25 @@
|
||||||
$: appList = Object.keys($apps?.data).map(id => ({
|
$: appList = Object.keys($apps?.data).map(id => ({
|
||||||
...$apps?.data?.[id],
|
...$apps?.data?.[id],
|
||||||
_id: id,
|
_id: id,
|
||||||
role: [$roleFetch?.data?.roles?.[id]],
|
role: [$userFetch?.data?.roles?.[id]],
|
||||||
}))
|
}))
|
||||||
let selectedApp
|
let selectedApp
|
||||||
|
|
||||||
const roleFetch = fetchData(`/api/admin/users/${userId}`)
|
const userFetch = fetchData(`/api/admin/users/${userId}`)
|
||||||
const apps = fetchData(`/api/admin/roles`)
|
const apps = fetchData(`/api/admin/roles`)
|
||||||
|
|
||||||
async function deleteUser() {
|
async function deleteUser() {
|
||||||
const res = await users.del(userId)
|
const res = await users.del(userId)
|
||||||
if (res.message) {
|
if (res.message) {
|
||||||
notifications.success(`User ${$roleFetch?.data?.email} deleted.`)
|
notifications.success(`User ${$userFetch?.data?.email} deleted.`)
|
||||||
$goto("./")
|
$goto("./")
|
||||||
} else {
|
} else {
|
||||||
notifications.error("Failed to delete user.")
|
notifications.error("Failed to delete user.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toggleBuilderAccess() {}
|
||||||
|
|
||||||
async function openUpdateRolesModal({ detail }) {
|
async function openUpdateRolesModal({ detail }) {
|
||||||
console.log(detail)
|
console.log(detail)
|
||||||
selectedApp = detail
|
selectedApp = detail
|
||||||
|
@ -65,11 +69,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="heading">
|
<div class="heading">
|
||||||
<Layout noPadding gap="XS">
|
<Layout noPadding gap="XS">
|
||||||
<Heading>User: {$roleFetch?.data?.email}</Heading>
|
<Heading>User: {$userFetch?.data?.email}</Heading>
|
||||||
<Body
|
<Body
|
||||||
>Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis porro
|
>Change user settings and update their app roles. Also contains the
|
||||||
ut nesciunt ipsam perspiciatis aliquam et hic minus alias beatae. Odit
|
ability to delete the user as well as force reset their password.
|
||||||
veritatis quos quas laborum magnam tenetur perspiciatis ex hic.
|
|
||||||
</Body>
|
</Body>
|
||||||
</Layout>
|
</Layout>
|
||||||
</div>
|
</div>
|
||||||
|
@ -79,7 +82,15 @@
|
||||||
<div class="fields">
|
<div class="fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<Label size="L">Email</Label>
|
<Label size="L">Email</Label>
|
||||||
<Input disabled thin value={$roleFetch?.data?.email} />
|
<Input disabled thin value={$userFetch?.data?.email} />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<Label size="L">Group(s)</Label>
|
||||||
|
<Select disabled options={["All users"]} value="All users" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<Label size="L">Development access?</Label>
|
||||||
|
<Toggle text="" value={$userFetch?.data?.builder?.global} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="regenerate">
|
<div class="regenerate">
|
||||||
|
@ -123,7 +134,7 @@
|
||||||
showCloseIcon={false}
|
showCloseIcon={false}
|
||||||
>
|
>
|
||||||
<Body
|
<Body
|
||||||
>Are you sure you want to delete <strong>{$roleFetch?.data?.email}</strong
|
>Are you sure you want to delete <strong>{$userFetch?.data?.email}</strong
|
||||||
></Body
|
></Body
|
||||||
>
|
>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
@ -131,8 +142,8 @@
|
||||||
<Modal bind:this={editRolesModal}>
|
<Modal bind:this={editRolesModal}>
|
||||||
<UpdateRolesModal
|
<UpdateRolesModal
|
||||||
app={selectedApp}
|
app={selectedApp}
|
||||||
user={$roleFetch.data}
|
user={$userFetch.data}
|
||||||
on:update={roleFetch.refresh}
|
on:update={userFetch.refresh}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue