Add comments

This commit is contained in:
Adria Navarro 2023-11-10 10:49:55 +01:00
parent 64c63e9e7f
commit 977f81c412
1 changed files with 11 additions and 9 deletions

View File

@ -23,7 +23,7 @@
import { userSelectedResourceMap } from "builderStore" import { userSelectedResourceMap } from "builderStore"
export let searchTerm export let searchTerm
let dataSourcesVisibility = {} let toggledDatasources = {}
$: enrichedDataSources = enrichDatasources( $: enrichedDataSources = enrichDatasources(
$datasources, $datasources,
@ -33,23 +33,25 @@
$queries, $queries,
$views, $views,
$viewsV2, $viewsV2,
dataSourcesVisibility, toggledDatasources,
searchTerm searchTerm
) )
const showDatasourceOpen = ({ const showDatasourceOpen = ({
selected, selected,
containsSelected, containsSelected,
dataSourceVisibility, dsToggledStatus,
searchTerm, searchTerm,
onlyOneSource, onlyOneSource,
}) => { }) => {
// We want to display all the ds expanded while filtering ds
if (searchTerm) { if (searchTerm) {
return true return true
} }
if (dataSourceVisibility !== undefined) { // If the toggle status has been a value
return dataSourceVisibility if (dsToggledStatus !== undefined) {
return dsToggledStatus
} }
if (onlyOneSource) { if (onlyOneSource) {
@ -67,7 +69,7 @@
queries, queries,
views, views,
viewsV2, viewsV2,
dataSourcesVisibility, toggledDatasources,
searchTerm searchTerm
) => { ) => {
if (!datasources?.list?.length) { if (!datasources?.list?.length) {
@ -105,7 +107,7 @@
const open = showDatasourceOpen({ const open = showDatasourceOpen({
selected, selected,
containsSelected, containsSelected,
dataSourceVisibility: dataSourcesVisibility[datasource._id], dsToggledStatus: toggledDatasources[datasource._id],
searchTerm, searchTerm,
onlyOneSource: onlySource, onlyOneSource: onlySource,
}) })
@ -133,11 +135,11 @@
} }
function openNode(datasource) { function openNode(datasource) {
dataSourcesVisibility[datasource._id] = true toggledDatasources[datasource._id] = true
} }
function toggleNode(datasource) { function toggleNode(datasource) {
dataSourcesVisibility[datasource._id] = !datasource.open toggledDatasources[datasource._id] = !datasource.open
} }
const containsActiveEntity = ( const containsActiveEntity = (