adds working automation routing

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-15 15:23:22 +01:00
parent 2900704a4c
commit 230f871e83
2 changed files with 13 additions and 38 deletions

View File

@ -1,22 +1,6 @@
<script>
import { onMount } from 'svelte'
import { automationStore } from "builderStore"
import AutomationBuilder from "components/automation/AutomationBuilder/AutomationBuilder.svelte"
import AutomationBuilder from "components/automation/AutomationBuilder/AutomationBuilder.svelte"
</script>
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 />
<AutomationBuilder />

View File

@ -1,22 +1,20 @@
<script>
import { goto, leftover } from "@sveltech/routify"
import { onMount } from 'svelte'
import { automationStore } from "builderStore"
$: automationCount = $automationStore.automations?.length ?? 0
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}`)
// }
})
// navigate to first automation in list, if not already selected
if (
!$leftover &&
$automationStore.automations.length > 0 &&
(!$automationStore.selectedAutomation || !$automationStore.selectedAutomation?.automation?._id)
) {
$goto(`../${$automationStore.automations[0]._id}`)
}
})
</script>
@ -24,10 +22,3 @@
<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>