adds routing to the automation tab

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

View File

@ -1,12 +1,9 @@
<script>
import { automationStore, backendUiStore } from "builderStore"
import { automationStore } from "builderStore"
import Flowchart from "./FlowChart/FlowChart.svelte"
import BlockList from "./BlockList.svelte"
$: automation = $automationStore.selectedAutomation?.automation
$: automationLive = automation?.live
$: instanceId = $backendUiStore.selectedDatabase._id
$: automationCount = $automationStore.automations?.length ?? 0
function onSelect(block) {
automationStore.update(state => {
@ -19,14 +16,4 @@
{#if automation}
<BlockList />
<Flowchart {automation} {onSelect} />
{:else 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>
{/if}

View File

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

View File

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

View File

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

View File

@ -4,7 +4,6 @@
import { TableNames } from "constants"
import EditTablePopover from "./popovers/EditTablePopover.svelte"
import EditViewPopover from "./popovers/EditViewPopover.svelte"
import { Switcher } from "@budibase/bbui"
import NavItem from "components/common/NavItem.svelte"
$: 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>
import { onMount } from 'svelte'
import { automationStore } from "builderStore"
import AutomationBuilder from "components/automation/AutomationBuilder/AutomationBuilder.svelte"
$: automationCount = $automationStore.automations?.length ?? 0
onMount(async () => {
console.log('Automation Store: ', $automationStore)
@ -18,4 +19,15 @@
})
</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>