adds routing to the automation tab

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-15 15:00:34 +01:00
parent ce59aab7f8
commit de4f77fcb5
7 changed files with 43 additions and 20 deletions

View File

@ -1,12 +1,9 @@
<script> <script>
import { automationStore, backendUiStore } from "builderStore" import { automationStore } from "builderStore"
import Flowchart from "./FlowChart/FlowChart.svelte" import Flowchart from "./FlowChart/FlowChart.svelte"
import BlockList from "./BlockList.svelte" import BlockList from "./BlockList.svelte"
$: automation = $automationStore.selectedAutomation?.automation $: automation = $automationStore.selectedAutomation?.automation
$: automationLive = automation?.live
$: instanceId = $backendUiStore.selectedDatabase._id
$: automationCount = $automationStore.automations?.length ?? 0
function onSelect(block) { function onSelect(block) {
automationStore.update(state => { automationStore.update(state => {
@ -19,14 +16,4 @@
{#if automation} {#if automation}
<BlockList /> <BlockList />
<Flowchart {automation} {onSelect} /> <Flowchart {automation} {onSelect} />
{:else if automationCount === 0} {/if}
<i>Create your first automation to get started</i>
{:else}<i>Select an automation to edit</i>{/if}
<style>
i {
font-size: var(--font-size-m);
color: var(--grey-5);
margin-top: 2px;
}
</style>

View File

@ -3,7 +3,6 @@
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import { DropdownMenu, Modal } from "@budibase/bbui" import { DropdownMenu, Modal } from "@budibase/bbui"
import { DropdownContainer, DropdownItem } from "components/common/Dropdowns" import { DropdownContainer, DropdownItem } from "components/common/Dropdowns"
import analytics from "analytics"
import CreateWebhookModal from "../Shared/CreateWebhookModal.svelte" import CreateWebhookModal from "../Shared/CreateWebhookModal.svelte"
$: hasTrigger = $automationStore.selectedAutomation.hasTrigger() $: hasTrigger = $automationStore.selectedAutomation.hasTrigger()

View File

@ -1,5 +1,6 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { goto } from "@sveltech/routify"
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
import EditAutomationPopover from "./EditAutomationPopover.svelte" import EditAutomationPopover from "./EditAutomationPopover.svelte"
@ -11,6 +12,7 @@
}) })
function selectAutomation(automation) { function selectAutomation(automation) {
automationStore.actions.select(automation) automationStore.actions.select(automation)
$goto(`./${automation._id}`)
} }
</script> </script>

View File

@ -1,5 +1,6 @@
<script> <script>
import { store, backendUiStore, automationStore } from "builderStore" import { backendUiStore, automationStore } from "builderStore"
import { goto } from "@sveltech/routify"
import { notifier } from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import { Input, ModalContent } from "@budibase/bbui" import { Input, ModalContent } from "@budibase/bbui"
import analytics from "analytics" import analytics from "analytics"
@ -15,6 +16,7 @@
instanceId, instanceId,
}) })
notifier.success(`Automation ${name} created.`) notifier.success(`Automation ${name} created.`)
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
analytics.captureEvent("Automation Created", { name }) analytics.captureEvent("Automation Created", { name })
} }
</script> </script>

View File

@ -4,7 +4,6 @@
import { TableNames } from "constants" import { TableNames } from "constants"
import EditTablePopover from "./popovers/EditTablePopover.svelte" import EditTablePopover from "./popovers/EditTablePopover.svelte"
import EditViewPopover from "./popovers/EditViewPopover.svelte" import EditViewPopover from "./popovers/EditViewPopover.svelte"
import { Switcher } from "@budibase/bbui"
import NavItem from "components/common/NavItem.svelte" import NavItem from "components/common/NavItem.svelte"
$: selectedView = $: selectedView =

View File

@ -0,0 +1,22 @@
<script>
import { onMount } from 'svelte'
import { automationStore } from "builderStore"
import AutomationBuilder from "components/automation/AutomationBuilder/AutomationBuilder.svelte"
onMount(async () => {
console.log('Automation Store: ', $automationStore)
console.log('Automation Store Methods: ', automationStore)
// navigate to first automation in list, if not already selected
// if (
// !$leftover &&
// $backendUiStore.tables.length > 0 &&
// (!$backendUiStore.selectedTable || !$backendUiStore.selectedTable._id)
// ) {
// // this file routes as .../tables/index, so, go up one.
// $goto(`../${$backendUiStore.tables[0]._id}`)
// }
})
</script>
<AutomationBuilder />

View File

@ -1,7 +1,8 @@
<script> <script>
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import AutomationBuilder from "components/automation/AutomationBuilder/AutomationBuilder.svelte"
$: automationCount = $automationStore.automations?.length ?? 0
onMount(async () => { onMount(async () => {
console.log('Automation Store: ', $automationStore) console.log('Automation Store: ', $automationStore)
@ -18,4 +19,15 @@
}) })
</script> </script>
<AutomationBuilder />
{#if automationCount === 0}
<i>Create your first automation to get started</i>
{:else}<i>Select an automation to edit</i>{/if}
<style>
i {
font-size: var(--font-size-m);
color: var(--grey-5);
margin-top: 2px;
}
</style>