2020-05-22 08:40:16 +12:00
|
|
|
<script>
|
2020-09-22 00:49:34 +12:00
|
|
|
import { store, backendUiStore, automationStore } from "builderStore"
|
2020-06-24 23:41:26 +12:00
|
|
|
import { notifier } from "builderStore/store/notifications"
|
2020-08-19 04:14:35 +12:00
|
|
|
import { Input } from "@budibase/bbui"
|
2020-09-30 03:26:56 +13:00
|
|
|
import analytics from "analytics"
|
2020-10-05 23:13:09 +13:00
|
|
|
import { Modal } from "components/common/Modal"
|
|
|
|
|
|
|
|
export let visible
|
2020-05-22 08:40:16 +12:00
|
|
|
|
|
|
|
let name
|
|
|
|
|
|
|
|
$: valid = !!name
|
|
|
|
$: instanceId = $backendUiStore.selectedDatabase._id
|
|
|
|
$: appId = $store.appId
|
|
|
|
|
2020-10-03 07:10:37 +13:00
|
|
|
function sleep(ms) {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
setTimeout(resolve, ms)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-09-22 00:49:34 +12:00
|
|
|
async function createAutomation() {
|
|
|
|
await automationStore.actions.create({
|
2020-05-22 08:40:16 +12:00
|
|
|
name,
|
|
|
|
instanceId,
|
|
|
|
})
|
2020-09-22 00:49:34 +12:00
|
|
|
notifier.success(`Automation ${name} created.`)
|
2020-09-30 03:26:56 +13:00
|
|
|
analytics.captureEvent("Automation Created", { name })
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-10-05 23:13:09 +13:00
|
|
|
<Modal
|
|
|
|
bind:visible
|
|
|
|
title="Create Automation"
|
2020-10-03 07:10:37 +13:00
|
|
|
confirmText="Create"
|
|
|
|
onConfirm={createAutomation}
|
|
|
|
disabled={!valid}>
|
2020-10-05 23:13:09 +13:00
|
|
|
<Input bind:value={name} label="Name" />
|
2020-10-07 23:38:05 +13:00
|
|
|
<div slot="footer">
|
2020-10-05 23:13:09 +13:00
|
|
|
<a
|
|
|
|
target="_blank"
|
|
|
|
href="https://docs.budibase.com/automate/introduction-to-automate">
|
|
|
|
<i class="ri-information-line" />
|
|
|
|
<span>Learn about automations</span>
|
|
|
|
</a>
|
2020-10-07 23:38:05 +13:00
|
|
|
</div>
|
2020-10-05 23:13:09 +13:00
|
|
|
</Modal>
|
2020-05-22 08:40:16 +12:00
|
|
|
|
|
|
|
<style>
|
2020-10-03 07:10:37 +13:00
|
|
|
a {
|
2020-09-23 23:24:57 +12:00
|
|
|
color: var(--ink);
|
2020-05-22 08:40:16 +12:00
|
|
|
font-size: 14px;
|
|
|
|
vertical-align: middle;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2020-09-23 23:24:57 +12:00
|
|
|
text-decoration: none;
|
|
|
|
}
|
2020-10-03 07:10:37 +13:00
|
|
|
a span {
|
2020-09-23 23:24:57 +12:00
|
|
|
text-decoration: underline;
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
2020-10-03 07:10:37 +13:00
|
|
|
i {
|
2020-05-22 08:40:16 +12:00
|
|
|
font-size: 20px;
|
2020-09-23 23:24:57 +12:00
|
|
|
margin-right: var(--spacing-m);
|
|
|
|
text-decoration: none;
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
|
|
|
</style>
|