Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Table Permission Modal in Table Card Menu #4082

Merged
merged 8 commits into from
Jan 3, 2025
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
Loading