more conversions

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-26 14:56:55 +02:00
parent c4b6e30391
commit 63dfede85a
2 changed files with 14 additions and 35 deletions

View File

@ -2,26 +2,14 @@
import { goto } from "@roxi/routify" import { goto } from "@roxi/routify"
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import { database } from "stores/backend" import { database } from "stores/backend"
import { notifications } from "@budibase/bbui" import { ActionMenu, MenuItem, notifications, Icon } from "@budibase/bbui"
import { Icon, Popover } from "@budibase/bbui"
import {
DropdownContainer,
DropdownItem,
} from "components/common/Dropdowns"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
export let automation export let automation
let anchor
let dropdown
let confirmDeleteDialog let confirmDeleteDialog
$: instanceId = $database._id $: instanceId = $database._id
function showModal() {
dropdown.hide()
confirmDeleteDialog.show()
}
async function deleteAutomation() { async function deleteAutomation() {
await automationStore.actions.delete({ await automationStore.actions.delete({
instanceId, instanceId,
@ -32,20 +20,15 @@
} }
</script> </script>
<div on:click|stopPropagation> <ActionMenu let:open let:closeOnClick>
<div bind:this={anchor} class="icon" on:click={dropdown.show}> <div slot="button" class="icon" on:click={open}>
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
<Popover align="left" {anchor} bind:this={dropdown}> <MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}
<DropdownContainer> >Delete</MenuItem
<DropdownItem >
icon="ri-delete-bin-line" </ActionMenu>
title="Delete"
on:click={showModal}
/>
</DropdownContainer>
</Popover>
</div>
<ConfirmDialog <ConfirmDialog
bind:this={confirmDeleteDialog} bind:this={confirmDeleteDialog}
okText="Delete Automation" okText="Delete Automation"

View File

@ -1,29 +1,25 @@
<script> <script>
import { ActionMenu, MenuItem, Icon, Popover, notifications } from "@budibase/bbui" import { ActionMenu, MenuItem, Icon, notifications } from "@budibase/bbui"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { queries } from "stores/backend" import { queries } from "stores/backend"
export let query export let query
let dropdown
let confirmDeleteDialog let confirmDeleteDialog
function hideEditor() {
dropdown?.hide()
}
async function deleteQuery() { async function deleteQuery() {
await queries.delete(query) await queries.delete(query)
notifications.success("Query deleted") notifications.success("Query deleted")
hideEditor()
} }
</script> </script>
<ActionMenu bind:this={dropdown} let:open let:closeOnClick> <ActionMenu let:open let:closeOnClick>
<div slot="button" class="icon" on:click={open}> <div slot="button" class="icon" on:click={open}>
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
<MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}>Delete</MenuItem> <MenuItem icon="Delete" on:click={closeOnClick(confirmDeleteDialog.show)}
>Delete</MenuItem
>
</ActionMenu> </ActionMenu>
<ConfirmDialog <ConfirmDialog