This commit is contained in:
Torsten Dittmann committed 2022-10-21 15:11:00 +02:00
1 parent 30b6e2c537
commit b41d323ce9
7 files changed
+62 -66

No files matched your search

@@ -52,7 +52,5 @@
</DropList>
<User bind:show={showUser} on:create {groups} />
<Team bind:show={showTeam} on:create {groups} />
<Custom bind:show={showCustom} on:create {groups} />
@@ -105,7 +105,6 @@
}
function togglePermission(role: string, permission: PermissionsTypes): void {
console.log('test');
groups.update((n) => {
n.get(role)[permission] = !n.get(role)[permission];
@@ -187,7 +186,7 @@
type="checkbox"
class="icon-check"
aria-label="Create"
bind:checked={permission.create}
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
</TableCell>
{/if}
@@ -196,7 +195,7 @@
type="checkbox"
class="icon-check"
aria-label="Read"
bind:checked={permission.read}
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
@@ -204,7 +203,7 @@
type="checkbox"
class="icon-check"
aria-label="Update"
bind:checked={permission.update}
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
@@ -212,7 +211,7 @@
type="checkbox"
class="icon-check"
aria-label="Delete"
bind:checked={permission.delete}
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>
{/if}
+45 -50
View File
@@ -58,54 +58,49 @@
}
</script>
{#if show}
<Form noStyle noMargin on:submit={create}>
<Modal bind:show on:close={reset} size="big">
<svelte:fragment slot="header">Select users</svelte:fragment>
<InputSearch bind:value={search} />
{#if results?.users}
<div class="table-wrapper">
<table class="table is-table-layout-auto is-remove-outer-styles">
<tbody class="table-tbody">
{#each results.users as user (user.$id)}
{@const role = `user:${user.$id}`}
{@const exists = $groups.has(role)}
<tr class="table-row">
<td
class="table-col"
data-title="Enabled"
style="--p-col-width:40">
<input
id={user.$id}
type="checkbox"
class="icon-check"
aria-label="Create"
checked={exists || selected.has(role)}
disabled={exists}
on:change={(event) => onSelection(event, role)} />
</td>
<td class="table-col" data-title="User">
<label class="u-flex u-cross-center u-gap-8" for={user.$id}>
<AvatarInitials size={32} name={user.name} />
<div class="u-line-height-1-5">
<div class="body-text-2">{user.name}</div>
<div class="u-x-small">{user.$id}</div>
</div>
</label>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/if}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<Pagination limit={5} bind:offset sum={results?.total} hidePages />
<Form noStyle noMargin on:submit={create}>
<Modal bind:show on:close={reset} size="big">
<svelte:fragment slot="header">Select users</svelte:fragment>
<InputSearch bind:value={search} />
{#if results?.users}
<div class="table-wrapper">
<table class="table is-table-layout-auto is-remove-outer-styles">
<tbody class="table-tbody">
{#each results.users as user (user.$id)}
{@const role = `user:${user.$id}`}
{@const exists = $groups.has(role)}
<tr class="table-row">
<td class="table-col" data-title="Enabled" style="--p-col-width:40">
<input
id={user.$id}
type="checkbox"
class="icon-check"
aria-label="Create"
checked={exists || selected.has(role)}
disabled={exists}
on:change={(event) => onSelection(event, role)} />
</td>
<td class="table-col" data-title="User">
<label class="u-flex u-cross-center u-gap-8" for={user.$id}>
<AvatarInitials size={32} name={user.name} />
<div class="u-line-height-1-5">
<div class="body-text-2">{user.name}</div>
<div class="u-x-small">{user.$id}</div>
</div>
</label>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
</svelte:fragment>
</Modal>
</Form>
{/if}
{/if}
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {results?.total}</p>
<Pagination limit={5} bind:offset sum={results?.total} hidePages />
</div>
<svelte:fragment slot="footer">
<Button submit disabled={!hasSelection}>Create</Button>
</svelte:fragment>
</Modal>
</Form>
+1
View File
@@ -6,6 +6,7 @@ export { default as TableHeader } from './header.svelte';
export { default as TableFooter } from './footer.svelte';
export { default as TableRow } from './row.svelte';
export { default as TableRowLink } from './rowLink.svelte';
export { default as TableRowButton } from './rowButton.svelte';
export { default as TableCell } from './cell.svelte';
export { default as TableCellHead } from './cellHead.svelte';
export { default as TableCellLink } from './cellLink.svelte';
+1 -5
View File
@@ -1,7 +1,3 @@
<script lang="ts">
import { clickOnEnter } from '$lib/helpers/a11y';
</script>
<div class="table-row" role="row" on:keyup={clickOnEnter} on:click|preventDefault>
<div class="table-row" role="row">
<slot />
</div>
+7
View File
@@ -0,0 +1,7 @@
<script lang="ts">
import { clickOnEnter } from '$lib/helpers/a11y';
</script>
<div class="table-row" role="row" on:keyup={clickOnEnter} on:click|preventDefault>
<slot />
</div>
@@ -10,10 +10,10 @@
Table,
TableHeader,
TableBody,
TableRow,
TableCellHead,
TableCell,
TableCellText
TableCellText,
TableRowButton
} from '$lib/elements/table';
import { toLocaleDateTime } from '$lib/helpers/date';
import { calculateTime } from '$lib/helpers/timeConversion';
@@ -46,7 +46,7 @@
</TableHeader>
<TableBody>
{#each $executionList.executions as execution}
<TableRow
<TableRowButton
on:click={() => {
$log.show = true;
$log.func = $func;
@@ -75,7 +75,7 @@
<TableCellText title="Type">TBI</TableCellText>
<TableCellText title="Duration">
{calculateTime(execution.duration)}</TableCellText>
</TableRow>
</TableRowButton>
{/each}
</TableBody>
</Table>