Converts datasources dropdowns to use ActionMenu
This commit is contained in:
parent
65d6ca6b5d
commit
d8d01e56d5
|
@ -2,13 +2,12 @@
|
|||
import { goto } from "@roxi/routify"
|
||||
import { datasources } from "stores/backend"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Icon, Popover } from "@budibase/bbui"
|
||||
import { ActionMenu, MenuItem, Icon, Popover } from "@budibase/bbui"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import { DropdownContainer, DropdownItem } from "components/common/Dropdowns"
|
||||
|
||||
export let datasource
|
||||
|
||||
let anchor
|
||||
let dropdown
|
||||
let confirmDeleteDialog
|
||||
|
||||
|
@ -23,8 +22,6 @@
|
|||
|
||||
async function deleteDatasource() {
|
||||
const wasSelectedSource = $datasources.selected
|
||||
console.log(wasSelectedSource)
|
||||
console.log(datasource)
|
||||
await datasources.delete(datasource)
|
||||
notifications.success("Datasource deleted")
|
||||
// navigate to first index page if the source you are deleting is selected
|
||||
|
@ -35,21 +32,13 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div on:click|stopPropagation>
|
||||
<div bind:this={anchor} class="icon" on:click={dropdown.show}>
|
||||
<ActionMenu bind:this={dropdown}>
|
||||
<div slot="button" class="icon" on:click={dropdown.show}>
|
||||
<Icon s hoverable name="MoreSmallList" />
|
||||
</div>
|
||||
<Popover align="left" {anchor} bind:this={dropdown}>
|
||||
<DropdownContainer>
|
||||
<DropdownItem
|
||||
icon="ri-delete-bin-line"
|
||||
title="Delete"
|
||||
on:click={showModal}
|
||||
data-cy="delete-datasource"
|
||||
/>
|
||||
</DropdownContainer>
|
||||
</Popover>
|
||||
</div>
|
||||
<MenuItem icon="Delete" on:click={showModal}>Delete</MenuItem>
|
||||
</ActionMenu>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:this={confirmDeleteDialog}
|
||||
okText="Delete Datasource"
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<script>
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { Icon, Popover } from "@budibase/bbui"
|
||||
import { ActionMenu, MenuItem, Icon, Popover } from "@budibase/bbui"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import { DropdownContainer, DropdownItem } from "components/common/Dropdowns"
|
||||
|
||||
export let query
|
||||
|
||||
let anchor
|
||||
let dropdown
|
||||
let confirmDeleteDialog
|
||||
|
||||
|
@ -26,21 +25,13 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div on:click|stopPropagation>
|
||||
<div bind:this={anchor} class="icon" on:click={dropdown.show}>
|
||||
<ActionMenu bind:this={dropdown}>
|
||||
<div slot="button" class="icon" on:click={dropdown.show}>
|
||||
<Icon s hoverable name="MoreSmallList" />
|
||||
</div>
|
||||
<Popover align="left" {anchor} bind:this={dropdown}>
|
||||
<DropdownContainer>
|
||||
<DropdownItem
|
||||
icon="ri-delete-bin-line"
|
||||
title="Delete"
|
||||
on:click={showModal}
|
||||
data-cy="delete-datasource"
|
||||
/>
|
||||
</DropdownContainer>
|
||||
</Popover>
|
||||
</div>
|
||||
<MenuItem icon="Delete" on:click={showModal}>Delete</MenuItem>
|
||||
</ActionMenu>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:this={confirmDeleteDialog}
|
||||
okText="Delete Query"
|
||||
|
|
Loading…
Reference in New Issue