Add role editing to access popover
This commit is contained in:
parent
acb3893730
commit
8a84a79651
|
@ -1,13 +1,15 @@
|
||||||
<script>
|
<script>
|
||||||
import { ActionButton, Modal } from "@budibase/bbui"
|
import { Button, Modal } from "@budibase/bbui"
|
||||||
import EditRolesModal from "../modals/EditRoles.svelte"
|
import EditRolesModal from "../modals/EditRoles.svelte"
|
||||||
|
|
||||||
let modal
|
let modal
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ActionButton icon="UsersLock" quiet on:click={modal.show}>
|
<div>
|
||||||
|
<Button secondary icon="UsersLock" on:click on:click={modal.show}>
|
||||||
Edit roles
|
Edit roles
|
||||||
</ActionButton>
|
</Button>
|
||||||
<Modal bind:this={modal}>
|
</div>
|
||||||
|
<Modal bind:this={modal} on:show on:hide>
|
||||||
<EditRolesModal />
|
<EditRolesModal />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
import { permissions } from "stores/builder"
|
import { permissions } from "stores/builder"
|
||||||
import ManageAccessModal from "../modals/ManageAccessModal.svelte"
|
import ManageAccessModal from "../modals/ManageAccessModal.svelte"
|
||||||
import DetailPopover from "components/common/DetailPopover.svelte"
|
import DetailPopover from "components/common/DetailPopover.svelte"
|
||||||
|
import EditRolesButton from "./EditRolesButton.svelte"
|
||||||
|
|
||||||
export let resourceId
|
export let resourceId
|
||||||
|
|
||||||
let resourcePermissions
|
let resourcePermissions
|
||||||
|
let showPopover = true
|
||||||
|
|
||||||
$: fetchPermissions(resourceId)
|
$: fetchPermissions(resourceId)
|
||||||
|
|
||||||
|
@ -15,11 +17,15 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DetailPopover title="Manage access">
|
<DetailPopover title="Manage access" {showPopover}>
|
||||||
<svelte:fragment slot="anchor" let:open>
|
<svelte:fragment slot="anchor" let:open>
|
||||||
<ActionButton icon="LockClosed" selected={open} quiet>Access</ActionButton>
|
<ActionButton icon="LockClosed" selected={open} quiet>Access</ActionButton>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
{#if resourcePermissions}
|
{#if resourcePermissions}
|
||||||
<ManageAccessModal {resourceId} permissions={resourcePermissions} />
|
<ManageAccessModal {resourceId} permissions={resourcePermissions} />
|
||||||
{/if}
|
{/if}
|
||||||
|
<EditRolesButton
|
||||||
|
on:show={() => (showPopover = false)}
|
||||||
|
on:hide={() => (showPopover = true)}
|
||||||
|
/>
|
||||||
</DetailPopover>
|
</DetailPopover>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
$: tableId = ds?.tableId
|
$: tableId = ds?.tableId
|
||||||
$: isView = ds?.type === "viewV2"
|
$: isView = ds?.type === "viewV2"
|
||||||
$: fetchRowActions(tableId)
|
$: fetchRowActions(tableId)
|
||||||
$: console.log(rowActions)
|
|
||||||
$: activeCount = 0
|
$: activeCount = 0
|
||||||
$: suffix = isView ? activeCount : rowActions.length
|
$: suffix = isView ? activeCount : rowActions.length
|
||||||
|
|
||||||
|
@ -51,12 +50,12 @@
|
||||||
name,
|
name,
|
||||||
tableId,
|
tableId,
|
||||||
})
|
})
|
||||||
console.log(res)
|
|
||||||
await automationStore.actions.fetch()
|
await automationStore.actions.fetch()
|
||||||
notifications.success("Row action created successfully")
|
notifications.success("Row action created successfully")
|
||||||
$goto($rowActionUrl(res))
|
$goto($rowActionUrl(res))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
|
notifications.error("Error creating row action")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,13 +11,10 @@
|
||||||
$: connectedScreens = findConnectedScreens($screenStore.screens, resourceId)
|
$: connectedScreens = findConnectedScreens($screenStore.screens, resourceId)
|
||||||
|
|
||||||
const findConnectedScreens = (screens, resourceId) => {
|
const findConnectedScreens = (screens, resourceId) => {
|
||||||
console.log(resourceId)
|
|
||||||
return screens.filter(screen => {
|
return screens.filter(screen => {
|
||||||
return JSON.stringify(screen).includes(`"${resourceId}"`)
|
return JSON.stringify(screen).includes(`"${resourceId}"`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$: console.log(connectedScreens)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DetailPopover title="Screens" minWidth={400}>
|
<DetailPopover title="Screens" minWidth={400}>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
export let align = "left"
|
export let align = "left"
|
||||||
export let minWidth
|
export let minWidth
|
||||||
export let maxWidth
|
export let maxWidth
|
||||||
|
export let showPopover
|
||||||
|
|
||||||
let popover
|
let popover
|
||||||
let anchor
|
let anchor
|
||||||
|
@ -23,10 +24,11 @@
|
||||||
<Popover
|
<Popover
|
||||||
bind:this={popover}
|
bind:this={popover}
|
||||||
bind:open
|
bind:open
|
||||||
|
minWidth={minWidth || 300}
|
||||||
{anchor}
|
{anchor}
|
||||||
{align}
|
{align}
|
||||||
minWidth={minWidth || 300}
|
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
|
{showPopover}
|
||||||
>
|
>
|
||||||
<div class="detail-popover">
|
<div class="detail-popover">
|
||||||
<div class="detail-popover__header">
|
<div class="detail-popover__header">
|
||||||
|
|
Loading…
Reference in New Issue