From a93a7f8f994659aeb01c69ed97519b558517bf2e Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 26 Apr 2021 15:57:17 +0100 Subject: [PATCH] Update all table popovers to be modals and fix edit roles modal --- .../DataTable/buttons/CreateViewButton.svelte | 21 +++---- .../DataTable/buttons/ExportButton.svelte | 21 +++---- .../buttons/ManageAccessButton.svelte | 26 ++++---- .../CreateViewModal.svelte} | 35 ++--------- .../backend/DataTable/modals/EditRoles.svelte | 42 +++++-------- .../DataTable/modals/ExportModal.svelte | 37 +++++++++++ .../ManageAccessModal.svelte} | 42 ++----------- .../DataTable/popovers/ExportPopover.svelte | 63 ------------------- 8 files changed, 93 insertions(+), 194 deletions(-) rename packages/builder/src/components/backend/DataTable/{popovers/CreateViewPopover.svelte => modals/CreateViewModal.svelte} (55%) create mode 100644 packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte rename packages/builder/src/components/backend/DataTable/{popovers/ManageAccessPopover.svelte => modals/ManageAccessModal.svelte} (65%) delete mode 100644 packages/builder/src/components/backend/DataTable/popovers/ExportPopover.svelte diff --git a/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte index aca1f3001e..285323c6d7 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/CreateViewButton.svelte @@ -1,16 +1,13 @@ -
- -
- - - + + + + diff --git a/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte index 7b5d93cf86..9ec0a86131 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/ExportButton.svelte @@ -1,18 +1,15 @@ -
- -
- - - + + + + diff --git a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte index 996396d9d3..8af3f3f3f1 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/ManageAccessButton.svelte @@ -1,29 +1,25 @@ -
- -
- - + Manage Access + + + - \ No newline at end of file + permissions={resourcePermissions} /> + diff --git a/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte similarity index 55% rename from packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte rename to packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte index 3e1e97e756..d70b51f4c5 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CreateViewPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte @@ -1,5 +1,5 @@ -
- Create View + - -
- - + diff --git a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte index 7ee70efe21..5cf33f8d3d 100644 --- a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte @@ -21,7 +21,7 @@ // Changes the selected role const changeRole = event => { - const id = event?.target?.value + const id = event?.detail const role = $roles.find(role => role._id === id) if (role) { selectedRole = { @@ -94,42 +94,34 @@ secondary label="Role" value={selectedRoleId} - on:change={changeRole}> - - {#each $roles as role} - - {/each} - + on:change={changeRole} + options={$roles} + placeholder="Create new role" + getOptionValue={role => role._id} + getOptionLabel={role => role.name} /> {#if selectedRole} + bind:value={selectedRole.inherits} + options={otherRoles} + getOptionValue={role => role._id} + getOptionLabel={role => role.name} + placeholder="None" /> + bind:value={selectedRole.permissionId} + options={basePermissions} + getOptionValue={x => x._id} + getOptionLabel={x => x.name} + placeholder="Choose permissions" /> {/if}
{#if !isCreating} - + {/if}
diff --git a/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte new file mode 100644 index 0000000000..0344b3a925 --- /dev/null +++ b/packages/builder/src/components/backend/DataTable/modals/ExportModal.svelte @@ -0,0 +1,37 @@ + + + + x.name} - getOptionValue={x => x.key} /> - - - -