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 3b4353bd6a
commit de56953d70
1 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script>
import { params, isActive } from "@sveltech/routify"
import { isActive, goto } from "@sveltech/routify"
import { Switcher, Modal } from "@budibase/bbui"
import TableNavigator from "components/backend/TableNavigator/TableNavigator.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
</script>
@ -25,7 +34,7 @@
<!-- routify:options index=0 -->
<div class="root">
<div class="nav">
<Switcher headings={tabs} bind:value={tab}>
<Switcher headings={tabs} bind:value={tab} on:change={selectFirstTableOrSource}>
<div class="title">
<i
data-cy={`new-${tab}`}