1
0
Fork 0
mirror of synced 2024-06-02 02:25:17 +12:00
budibase/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte

57 lines
1.3 KiB
Svelte
Raw Normal View History

2020-05-22 08:40:16 +12:00
<script>
2021-03-19 02:33:45 +13:00
import { goto } from "@roxi/routify"
2021-04-01 22:29:47 +13:00
import { database } from "stores/backend"
2021-04-07 22:33:14 +12:00
import { automationStore } from "builderStore"
import { notifications } from "@budibase/bbui"
2021-04-23 20:33:41 +12:00
import { Icon, Input, ModalContent } from "@budibase/bbui"
import analytics from "analytics"
2020-05-22 08:40:16 +12:00
let name
$: valid = !!name
$: instanceId = $database._id
async function createAutomation() {
await automationStore.actions.create({
2020-05-22 08:40:16 +12:00
name,
instanceId,
})
notifications.success(`Automation ${name} created.`)
2021-03-16 03:00:34 +13:00
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
analytics.captureEvent("Automation Created", { name })
2020-05-22 08:40:16 +12:00
}
</script>
2020-10-08 21:35:11 +13:00
<ModalContent
title="Create Automation"
confirmText="Create"
size="L"
onConfirm={createAutomation}
disabled={!valid}
>
<Input bind:value={name} label="Name" />
<a
slot="footer"
target="_blank"
href="https://docs.budibase.com/automate/introduction-to-automate"
>
2021-04-23 20:33:41 +12:00
<Icon name="InfoOutline" />
<span>Learn about automations</span>
</a>
2020-10-08 21:35:11 +13:00
</ModalContent>
2020-05-22 08:40:16 +12:00
<style>
a {
color: var(--ink);
2020-05-22 08:40:16 +12:00
font-size: 14px;
vertical-align: middle;
display: flex;
align-items: center;
text-decoration: none;
}
a span {
text-decoration: underline;
2021-04-23 20:33:41 +12:00
margin-left: var(--spectrum-alias-item-padding-s);
2020-05-22 08:40:16 +12:00
}
</style>