mirror of https://github.com/Budibase/budibase.git
8 changed files with 93 additions and 194 deletions
@ -1,16 +1,13 @@ |
|||
<script> |
|||
import { Popover, Button } from "@budibase/bbui" |
|||
import CreateViewPopover from "../popovers/CreateViewPopover.svelte" |
|||
import { Modal, Button } from "@budibase/bbui" |
|||
import CreateViewModal from "../modals/CreateViewModal.svelte" |
|||
|
|||
let anchor |
|||
let dropdown |
|||
let modal |
|||
</script> |
|||
|
|||
<div bind:this={anchor}> |
|||
<Button icon="CollectionAdd" primary size="S" quiet on:click={dropdown.show}> |
|||
Create New View |
|||
</Button> |
|||
</div> |
|||
<Popover bind:this={dropdown} {anchor} align="left"> |
|||
<CreateViewPopover onClosed={dropdown.hide} /> |
|||
</Popover> |
|||
<Button icon="CollectionAdd" primary size="S" quiet on:click={modal.show}> |
|||
Create New View |
|||
</Button> |
|||
<Modal bind:this={modal}> |
|||
<CreateViewModal /> |
|||
</Modal> |
|||
|
|||
@ -1,18 +1,15 @@ |
|||
<script> |
|||
import { Button, Icon, Popover } from "@budibase/bbui" |
|||
import ExportPopover from "../popovers/ExportPopover.svelte" |
|||
import { Button, Modal } from "@budibase/bbui" |
|||
import ExportModal from "../modals/ExportModal.svelte" |
|||
|
|||
export let view |
|||
|
|||
let anchor |
|||
let dropdown |
|||
let modal |
|||
</script> |
|||
|
|||
<div bind:this={anchor}> |
|||
<Button icon="Download" primary size="S" quiet on:click={dropdown.show}> |
|||
Export |
|||
</Button> |
|||
</div> |
|||
<Popover bind:this={dropdown} {anchor} align="left"> |
|||
<ExportPopover {view} onClosed={dropdown.hide} /> |
|||
</Popover> |
|||
<Button icon="Download" primary size="S" quiet on:click={modal.show}> |
|||
Export |
|||
</Button> |
|||
<Modal bind:this={modal}> |
|||
<ExportModal {view} /> |
|||
</Modal> |
|||
|
|||
@ -1,29 +1,25 @@ |
|||
<script> |
|||
import { Button, Popover } from "@budibase/bbui" |
|||
import { Button, Modal } from "@budibase/bbui" |
|||
import { permissions } from "stores/backend" |
|||
import ManageAccessPopover from "../popovers/ManageAccessPopover.svelte" |
|||
import ManageAccessModal from "../modals/ManageAccessModal.svelte" |
|||
|
|||
export let resourceId |
|||
|
|||
let anchor |
|||
let dropdown |
|||
let modal |
|||
let resourcePermissions |
|||
|
|||
async function openDropdown() { |
|||
resourcePermissions = await permissions.forResource(resourceId) |
|||
dropdown.show() |
|||
modal.show() |
|||
} |
|||
</script> |
|||
|
|||
<div bind:this={anchor}> |
|||
<Button icon="LockClosed" primary size="S" quiet on:click={openDropdown}> |
|||
Manage Access |
|||
</Button> |
|||
</div> |
|||
<Popover bind:this={dropdown} {anchor} align="left"> |
|||
<ManageAccessPopover |
|||
<Button icon="LockClosed" primary size="S" quiet on:click={openDropdown}> |
|||
Manage Access |
|||
</Button> |
|||
<Modal bind:this={modal}> |
|||
<ManageAccessModal |
|||
{resourceId} |
|||
levels={$permissions} |
|||
permissions={resourcePermissions} |
|||
onClosed={dropdown.hide} /> |
|||
</Popover> |
|||
permissions={resourcePermissions} /> |
|||
</Modal> |
|||
|
|||
@ -0,0 +1,37 @@ |
|||
<script> |
|||
import { Select, ModalContent } from "@budibase/bbui" |
|||
import download from "downloadjs" |
|||
|
|||
const FORMATS = [ |
|||
{ |
|||
name: "CSV", |
|||
key: "csv", |
|||
}, |
|||
{ |
|||
name: "JSON", |
|||
key: "json", |
|||
}, |
|||
] |
|||
|
|||
export let view |
|||
|
|||
let exportFormat = FORMATS[0].key |
|||
|
|||
async function exportView() { |
|||
download( |
|||
`/api/views/export?view=${encodeURIComponent( |
|||
view.name |
|||
)}&format=${exportFormat}` |
|||
) |
|||
} |
|||
</script> |
|||
|
|||
<ModalContent title="Export Data" confirmText="Export" onConfirm={exportView}> |
|||
<Select |
|||
label="Format" |
|||
bind:value={exportFormat} |
|||
options={FORMATS} |
|||
placeholder={null} |
|||
getOptionLabel={x => x.name} |
|||
getOptionValue={x => x.key} /> |
|||
</ModalContent> |
|||
@ -1,63 +0,0 @@ |
|||
<script> |
|||
import { Button, Select, Heading } from "@budibase/bbui" |
|||
import download from "downloadjs" |
|||
|
|||
const FORMATS = [ |
|||
{ |
|||
name: "CSV", |
|||
key: "csv", |
|||
}, |
|||
{ |
|||
name: "JSON", |
|||
key: "json", |
|||
}, |
|||
] |
|||
|
|||
export let view |
|||
export let onClosed |
|||
|
|||
let exportFormat = FORMATS[0].key |
|||
|
|||
async function exportView() { |
|||
download( |
|||
`/api/views/export?view=${encodeURIComponent( |
|||
view.name |
|||
)}&format=${exportFormat}` |
|||
) |
|||
onClosed() |
|||
} |
|||
</script> |
|||
|
|||
<div class="popover"> |
|||
<Heading s>Export Data</Heading> |
|||
<Select |
|||
label="Format" |
|||
bind:value={exportFormat} |
|||
options={FORMATS} |
|||
getOptionLabel={x => x.name} |
|||
getOptionValue={x => x.key} /> |
|||
<div class="footer"> |
|||
<Button secondary on:click={onClosed}>Cancel</Button> |
|||
<Button cta on:click={exportView}>Export</Button> |
|||
</div> |
|||
</div> |
|||
|
|||
<style> |
|||
.popover { |
|||
display: grid; |
|||
grid-gap: var(--spacing-xl); |
|||
padding: var(--spacing-xl); |
|||
width: 240px; |
|||
} |
|||
|
|||
h5 { |
|||
margin: 0; |
|||
font-weight: 500; |
|||
} |
|||
|
|||
.footer { |
|||
display: flex; |
|||
justify-content: flex-end; |
|||
gap: var(--spacing-m); |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue