adds working automation routing

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

View File

@ -1,21 +1,5 @@
<script> <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"
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> </script>
<AutomationBuilder /> <AutomationBuilder />

View File

@ -1,21 +1,19 @@
<script> <script>
import { goto, leftover } from "@sveltech/routify"
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
$: automationCount = $automationStore.automations?.length ?? 0 $: automationCount = $automationStore.automations?.length ?? 0
onMount(async () => { onMount(async () => {
console.log('Automation Store: ', $automationStore)
console.log('Automation Store Methods: ', automationStore)
// navigate to first automation in list, if not already selected // navigate to first automation in list, if not already selected
// if ( if (
// !$leftover && !$leftover &&
// $backendUiStore.tables.length > 0 && $automationStore.automations.length > 0 &&
// (!$backendUiStore.selectedTable || !$backendUiStore.selectedTable._id) (!$automationStore.selectedAutomation || !$automationStore.selectedAutomation?.automation?._id)
// ) { ) {
// // this file routes as .../tables/index, so, go up one. $goto(`../${$automationStore.automations[0]._id}`)
// $goto(`../${$backendUiStore.tables[0]._id}`) }
// }
}) })
</script> </script>
@ -24,10 +22,3 @@
<i>Create your first automation to get started</i> <i>Create your first automation to get started</i>
{:else}<i>Select an automation to edit</i>{/if} {: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>