Skip to content

Commit

Permalink
Added Table Permission Modal in Table Card Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
vishaljoshi789 committed Dec 16, 2024
1 parent f157aed commit 01888f2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
5 changes: 4 additions & 1 deletion mathesar_ui/src/pages/schema/TableCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
Icon,
Truncate,
} from '@mathesar-component-library';
import TablePermissions from '@mathesar/systems/table-view/table-inspector/table/TablePermissions.svelte';

Check failure on line 32 in mathesar_ui/src/pages/schema/TableCard.svelte

View workflow job for this annotation

GitHub Actions / Run front end linter

`@mathesar/systems/table-view/table-inspector/table/TablePermissions.svelte` import should occur before import of `@mathesar/utils/tables`
const recordSelector = getRecordSelectorFromContext();
Expand Down Expand Up @@ -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}
Expand All @@ -148,6 +149,8 @@
>
{$_('edit_table')}
</ButtonMenuItem>
<TablePermissions {table} fromTableCard={true}/>

Check failure on line 153 in mathesar_ui/src/pages/schema/TableCard.svelte

View workflow job for this annotation

GitHub Actions / Run front end linter

Trailing spaces not allowed
{/if}
<ButtonMenuItem
on:click={handleDeleteTable}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div slot="content" class="content-container">
<TableName disabled={!$currentRoleOwns} />
<TableDescription disabled={!$currentRoleOwns} />
<TablePermissions />
<TablePermissions {table}/>
</div>
</Collapsible>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
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,
PermissionsModal,
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;

Check failure on line 28 in mathesar_ui/src/systems/table-view/table-inspector/table/TablePermissions.svelte

View workflow job for this annotation

GitHub Actions / Run front end linter

Trailing spaces not allowed
export let table: Table;
export let fromTableCard = false;
$: tablePrivileges = table.constructTablePrivilegesStore();
const databaseContext = DatabaseRouteContext.get();
Expand Down Expand Up @@ -135,14 +134,23 @@
</script>

<div>
<Button
appearance="secondary"
on:click={() => controller.open()}
size="small"
>
<Icon {...iconPermissions} />
<span>{$_('table_permissions')}</span>
</Button>
{#if fromTableCard}
<ButtonMenuItem
on:click={() => controller.open()}
icon={iconPermissions}
>
{$_('table_permissions')}
</ButtonMenuItem>
{:else}
<Button
appearance="secondary"
on:click={() => controller.open()}
size="small"
>
<Icon {...iconPermissions} />
<span>{$_('table_permissions')}</span>
</Button>
{/if}
</div>

<PermissionsModal
Expand Down

0 comments on commit 01888f2

Please sign in to comment.