Remove duplicated modals
This commit is contained in:
parent
dab38265db
commit
2868c840e6
|
@ -17,7 +17,6 @@
|
|||
|
||||
let confirmDeleteDialog
|
||||
let updateAutomationDialog
|
||||
let updateRowActionDialog
|
||||
|
||||
$: isRowAction = sdk.automations.isRowAction(automation)
|
||||
|
||||
|
@ -92,7 +91,7 @@
|
|||
name: "Edit",
|
||||
keyBind: null,
|
||||
visible: true,
|
||||
callback: updateRowActionDialog.show,
|
||||
callback: updateAutomationDialog.show,
|
||||
},
|
||||
del,
|
||||
]
|
||||
|
@ -135,8 +134,4 @@
|
|||
This action cannot be undone.
|
||||
</ConfirmDialog>
|
||||
|
||||
{#if isRowAction}
|
||||
<UpdateRowActionModal {automation} bind:this={updateRowActionDialog} />
|
||||
{:else}
|
||||
<UpdateAutomationModal {automation} bind:this={updateAutomationDialog} />
|
||||
{/if}
|
||||
<UpdateAutomationModal {automation} bind:this={updateAutomationDialog} />
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<script>
|
||||
import { rowActions } from "stores/builder"
|
||||
import {
|
||||
notifications,
|
||||
Icon,
|
||||
Input,
|
||||
ModalContent,
|
||||
Modal,
|
||||
} from "@budibase/bbui"
|
||||
|
||||
export let automation
|
||||
export let onCancel = undefined
|
||||
|
||||
let name
|
||||
let error = ""
|
||||
let modal
|
||||
|
||||
export const show = () => {
|
||||
name = automation?.displayName
|
||||
modal.show()
|
||||
}
|
||||
export const hide = () => {
|
||||
modal.hide()
|
||||
}
|
||||
|
||||
async function saveAutomation() {
|
||||
try {
|
||||
await rowActions.rename(
|
||||
automation.definition.trigger.inputs.tableId,
|
||||
automation.definition.trigger.inputs.rowActionId,
|
||||
name
|
||||
)
|
||||
notifications.success(`Row action updated successfully`)
|
||||
hide()
|
||||
} catch (error) {
|
||||
notifications.error("Error saving row action")
|
||||
}
|
||||
}
|
||||
|
||||
function checkValid(evt) {
|
||||
name = evt.target.value
|
||||
if (!name) {
|
||||
error = "Name is required"
|
||||
return
|
||||
}
|
||||
error = ""
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:this={modal} on:hide={onCancel}>
|
||||
<ModalContent
|
||||
title="Edit Row Action"
|
||||
confirmText="Save"
|
||||
size="L"
|
||||
onConfirm={saveAutomation}
|
||||
disabled={error}
|
||||
>
|
||||
<Input bind:value={name} label="Name" on:input={checkValid} {error} />
|
||||
<a
|
||||
slot="footer"
|
||||
target="_blank"
|
||||
href="https://docs.budibase.com/docs/automation-steps"
|
||||
>
|
||||
<Icon name="InfoOutline" />
|
||||
<span>Learn about automations</span>
|
||||
</a>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
a {
|
||||
color: var(--ink);
|
||||
font-size: 14px;
|
||||
vertical-align: middle;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
a span {
|
||||
text-decoration: underline;
|
||||
margin-left: var(--spectrum-alias-item-padding-s);
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue