Merge pull request #354 from appwrite/fix/permissions-overflow

fix: permissions overflow
This commit is contained in:
Christy Jacob authored and GitHub committed 2023-08-08 19:55:07 +04:00
commit 75a8298923
4 files changed
+76 -65

No files matched your search

+7
View File
@@ -19,3 +19,10 @@
</div>
{/if}
</Card>
<style lang="scss">
.grid-1-2 > * {
width: 100%;
overflow: hidden;
}
</style>
+3 -1
View File
@@ -14,7 +14,9 @@
export let fullWidth = false;
export let fixed = false;
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher<{
blur: undefined;
}>();
let element: HTMLDivElement;
let tooltip: HTMLDivElement;
@@ -20,7 +20,7 @@
}
</script>
<DropList bind:show={showDropdown} placement="bottom-end">
<DropList bind:show={showDropdown} placement="bottom-end" fixed>
<slot />
<svelte:fragment slot="list">
<DropListItem disabled={$groups.has('any')} on:click={() => dispatch('create', ['any'])}>
@@ -12,7 +12,6 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import {
Table,
TableBody,
TableCell,
TableCellHead,
@@ -24,6 +23,7 @@
import { writable, type Unsubscriber } from 'svelte/store';
import Actions from './actions.svelte';
import Row from './row.svelte';
import Table from '$lib/elements/table/table.svelte';
export let withCreate = false;
export let permissions: string[] = [];
@@ -142,74 +142,76 @@
</script>
{#if [...$groups]?.length}
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={70}>Role</TableCellHead>
{#if withCreate}
<TableCellHead width={70}>Create</TableCellHead>
{/if}
<TableCellHead width={70}>Read</TableCellHead>
<TableCellHead width={70}>Update</TableCellHead>
<TableCellHead width={70}>Delete</TableCellHead>
<TableCellHead width={40} />
</TableHeader>
<TableBody>
{#each [...$groups].sort(sortRoles) as [role, permission] (role)}
<TableRow>
<TableCell title="Role">
<Row {role} />
</TableCell>
<div class="table-wrapper">
<Table noMargin noStyles>
<TableHeader>
<TableCellHead width={140}>Role</TableCellHead>
{#if withCreate}
<TableCellHead width={60}>Create</TableCellHead>
{/if}
<TableCellHead width={50}>Read</TableCellHead>
<TableCellHead width={60}>Update</TableCellHead>
<TableCellHead width={60}>Delete</TableCellHead>
<TableCellHead width={32} />
</TableHeader>
<TableBody>
{#each [...$groups].sort(sortRoles) as [role, permission] (role)}
<TableRow>
<TableCell title="Role">
<Row {role} />
</TableCell>
{#if withCreate}
<TableCell title="Create">
{#if withCreate}
<TableCell title="Create">
<input
type="checkbox"
class="icon-check"
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
</TableCell>
{/if}
<TableCell title="Read">
<input
type="checkbox"
class="icon-check"
aria-label="Create"
checked={permission.create}
on:change={() => togglePermission(role, 'create')} />
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>
{/if}
<TableCell title="Read">
<input
type="checkbox"
class="icon-check"
aria-label="Read"
checked={permission.read}
on:change={() => togglePermission(role, 'read')} />
</TableCell>
<TableCell title="Update">
<input
type="checkbox"
class="icon-check"
aria-label="Update"
checked={permission.update}
on:change={() => togglePermission(role, 'update')} />
</TableCell>
<TableCell title="Delete">
<input
type="checkbox"
class="icon-check"
aria-label="Delete"
checked={permission.delete}
on:change={() => togglePermission(role, 'delete')} />
</TableCell>
<TableCell title="Remove" width={40}>
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCell>
</TableRow>
{/each}
</TableBody>
</Table>
<TableCell title="Remove" width={40}>
<div class="u-flex">
<button
class="button is-text is-only-icon"
type="button"
aria-label="delete"
on:click={() => deleteRole(role)}>
<span class="icon-x" aria-hidden="true" />
</button>
</div>
</TableCell>
</TableRow>
{/each}
</TableBody>
</Table>
</div>
<Actions
bind:showCustom