Handle open/close
This commit is contained in:
parent
cdc41c41e8
commit
3049f7b376
|
@ -33,15 +33,9 @@
|
||||||
$queries,
|
$queries,
|
||||||
$views,
|
$views,
|
||||||
$viewsV2,
|
$viewsV2,
|
||||||
openDataSources
|
openDataSources,
|
||||||
|
searchTerm
|
||||||
)
|
)
|
||||||
$: openDataSource = enrichedDataSources.find(x => x.open)
|
|
||||||
$: {
|
|
||||||
// Ensure the open datasource is always actually open
|
|
||||||
if (openDataSource) {
|
|
||||||
openNode(openDataSource)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const enrichDatasources = (
|
const enrichDatasources = (
|
||||||
datasources,
|
datasources,
|
||||||
|
@ -51,11 +45,13 @@
|
||||||
queries,
|
queries,
|
||||||
views,
|
views,
|
||||||
viewsV2,
|
viewsV2,
|
||||||
openDataSources
|
openDataSources,
|
||||||
|
searchTerm
|
||||||
) => {
|
) => {
|
||||||
if (!datasources?.list?.length) {
|
if (!datasources?.list?.length) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
const onlySource = datasources.list.length === 1
|
||||||
return datasources.list.map(datasource => {
|
return datasources.list.map(datasource => {
|
||||||
const selected =
|
const selected =
|
||||||
isActive("./datasource") &&
|
isActive("./datasource") &&
|
||||||
|
@ -70,12 +66,11 @@
|
||||||
views,
|
views,
|
||||||
viewsV2
|
viewsV2
|
||||||
)
|
)
|
||||||
const onlySource = datasources.list.length === 1
|
|
||||||
return {
|
return {
|
||||||
...datasource,
|
...datasource,
|
||||||
selected,
|
selected,
|
||||||
containsSelected,
|
containsSelected,
|
||||||
open: open || onlySource,
|
open: open || onlySource || !!searchTerm,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -210,7 +205,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</NavItem>
|
</NavItem>
|
||||||
|
|
||||||
{#if datasource.open || searchTerm}
|
{#if datasource.open}
|
||||||
<TableNavigator sourceId={datasource._id} {selectTable} />
|
<TableNavigator sourceId={datasource._id} {selectTable} />
|
||||||
{#each $queries.list.filter(query => query.datasourceId === datasource._id && (!searchTerm || query.name
|
{#each $queries.list.filter(query => query.datasourceId === datasource._id && (!searchTerm || query.name
|
||||||
?.toLowerCase()
|
?.toLowerCase()
|
||||||
|
|
Loading…
Reference in New Issue