changing between Internal/External now selects the first table/source in each tab

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-15 11:38:43 +01:00
parent e4817983a4
commit 4e003a1066
1 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
import { params, isActive } from "@sveltech/routify" import { isActive, goto } from "@sveltech/routify"
import { Switcher, Modal } from "@budibase/bbui" import { Switcher, Modal } from "@budibase/bbui"
import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte" import TableNavigator from "components/backend/TableNavigator/TableNavigator.svelte"
import DatasourceNavigator from "components/backend/DatasourceNavigator/DatasourceNavigator.svelte" import DatasourceNavigator from "components/backend/DatasourceNavigator/DatasourceNavigator.svelte"
@ -17,7 +17,16 @@
}, },
] ]
let tab = $isActive('./datasource') || $params.selectedDatasource ? "datasource" : "table" let tab = $isActive('./datasource') ? "datasource" : "table"
function selectFirstTableOrSource({ detail }) {
const type = detail.heading.key
if (type === 'datasource') {
$goto("./datasource")
} else {
$goto("./table")
}
}
let modal let modal
</script> </script>
@ -25,7 +34,7 @@
<!-- routify:options index=0 --> <!-- routify:options index=0 -->
<div class="root"> <div class="root">
<div class="nav"> <div class="nav">
<Switcher headings={tabs} bind:value={tab}> <Switcher headings={tabs} bind:value={tab} on:change={selectFirstTableOrSource}>
<div class="title"> <div class="title">
<i <i
data-cy={`new-${tab}`} data-cy={`new-${tab}`}