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-05-22 08:40:16 +12:00
|
|
|
import ActionButton from "components/common/ActionButton.svelte"
|
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-05-22 08:40:16 +12:00
|
|
|
|
|
|
|
export let onClosed
|
|
|
|
|
|
|
|
let name
|
|
|
|
|
|
|
|
$: valid = !!name
|
|
|
|
$: instanceId = $backendUiStore.selectedDatabase._id
|
|
|
|
$: appId = $store.appId
|
|
|
|
|
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,
|
|
|
|
})
|
|
|
|
onClosed()
|
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-09-23 23:24:57 +12:00
|
|
|
<div class="container">
|
|
|
|
<header>
|
|
|
|
<i class="ri-stackshare-line" />
|
2020-09-30 22:24:43 +13:00
|
|
|
<h3>Create Automation</h3>
|
2020-09-23 23:24:57 +12:00
|
|
|
</header>
|
|
|
|
<div class="content">
|
|
|
|
<Input bind:value={name} label="Name" />
|
|
|
|
</div>
|
|
|
|
<footer>
|
|
|
|
<a href="https://docs.budibase.com">
|
|
|
|
<i class="ri-information-line" />
|
|
|
|
<span>Learn about automations</span>
|
|
|
|
</a>
|
|
|
|
<ActionButton secondary on:click={onClosed}>Cancel</ActionButton>
|
|
|
|
<ActionButton disabled={!valid} on:click={createAutomation}>
|
|
|
|
Save
|
|
|
|
</ActionButton>
|
|
|
|
</footer>
|
2020-05-22 08:40:16 +12:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2020-09-23 23:24:57 +12:00
|
|
|
.container {
|
|
|
|
padding: var(--spacing-xl);
|
|
|
|
}
|
|
|
|
|
2020-05-22 08:40:16 +12:00
|
|
|
header {
|
2020-09-23 23:24:57 +12:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
2020-09-30 22:24:43 +13:00
|
|
|
header h3 {
|
|
|
|
font-size: var(--font-size-xl);
|
|
|
|
color: var(--ink);
|
|
|
|
font-weight: 600;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2020-05-22 08:40:16 +12:00
|
|
|
header i {
|
2020-09-23 23:24:57 +12:00
|
|
|
margin-right: var(--spacing-m);
|
2020-09-30 22:24:43 +13:00
|
|
|
font-size: 28px;
|
|
|
|
color: var(--grey-6);
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
|
|
|
|
2020-09-23 23:24:57 +12:00
|
|
|
.content {
|
|
|
|
padding: var(--spacing-xl) 0;
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
footer {
|
|
|
|
display: grid;
|
|
|
|
grid-auto-flow: column;
|
2020-09-23 23:24:57 +12:00
|
|
|
grid-gap: var(--spacing-m);
|
2020-05-22 08:40:16 +12:00
|
|
|
grid-auto-columns: 3fr 1fr 1fr;
|
|
|
|
}
|
|
|
|
footer 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;
|
|
|
|
}
|
|
|
|
footer a span {
|
|
|
|
text-decoration: underline;
|
2020-05-22 08:40:16 +12:00
|
|
|
}
|
|
|
|
footer i {
|
|
|
|
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>
|