From 01888f2538c5648755eb115f79dd37fad5514aff Mon Sep 17 00:00:00 2001 From: Vishal Joshi Date: Mon, 16 Dec 2024 21:03:37 +0530 Subject: [PATCH] Added Table Permission Modal in Table Card Menu --- mathesar_ui/src/pages/schema/TableCard.svelte | 5 ++- .../table-inspector/table/TableMode.svelte | 2 +- .../table/TablePermissions.svelte | 34 ++++++++++++------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/mathesar_ui/src/pages/schema/TableCard.svelte b/mathesar_ui/src/pages/schema/TableCard.svelte index 0b9afb3a33..5cf452d85c 100644 --- a/mathesar_ui/src/pages/schema/TableCard.svelte +++ b/mathesar_ui/src/pages/schema/TableCard.svelte @@ -29,6 +29,7 @@ Icon, Truncate, } from '@mathesar-component-library'; + import TablePermissions from '@mathesar/systems/table-view/table-inspector/table/TablePermissions.svelte'; const recordSelector = getRecordSelectorFromContext(); @@ -127,7 +128,7 @@ showArrow={false} triggerAppearance="ghost" triggerClass="dropdown-menu-button" - closeOnInnerClick={true} + closeOnInnerClick={false} placements={['bottom-end', 'right-start', 'left-start']} label="" icon={iconMoreActions} @@ -148,6 +149,8 @@ > {$_('edit_table')} + + {/if} - + diff --git a/mathesar_ui/src/systems/table-view/table-inspector/table/TablePermissions.svelte b/mathesar_ui/src/systems/table-view/table-inspector/table/TablePermissions.svelte index 5695cd4a6f..acf94409db 100644 --- a/mathesar_ui/src/systems/table-view/table-inspector/table/TablePermissions.svelte +++ b/mathesar_ui/src/systems/table-view/table-inspector/table/TablePermissions.svelte @@ -15,7 +15,6 @@ import AsyncRpcApiStore from '@mathesar/stores/AsyncRpcApiStore'; import { AsyncStoreValue } from '@mathesar/stores/AsyncStore'; import { modal } from '@mathesar/stores/modal'; - import { getTabularDataStoreFromContext } from '@mathesar/stores/table-data'; import { toast } from '@mathesar/stores/toast'; import { type AccessControlConfig, @@ -23,12 +22,12 @@ PermissionsOverview, TransferOwnership, } from '@mathesar/systems/permissions'; - import { Button, ImmutableMap } from '@mathesar-component-library'; + import { Button, ButtonMenuItem, ImmutableMap } from '@mathesar-component-library'; const controller = modal.spawnModalController(); - const tabularData = getTabularDataStoreFromContext(); - - $: table = $tabularData.table; + + export let table: Table; + export let fromTableCard = false; $: tablePrivileges = table.constructTablePrivilegesStore(); const databaseContext = DatabaseRouteContext.get(); @@ -135,14 +134,23 @@
- + {#if fromTableCard} + controller.open()} + icon={iconPermissions} + > + {$_('table_permissions')} + + {:else} + + {/if}