Undo store usage

This commit is contained in:
Adria Navarro 2023-11-20 13:41:48 +01:00
parent d8590caa24
commit 0a289f508e
2 changed files with 13 additions and 11 deletions

View File

@ -31,7 +31,7 @@
$datasources, $datasources,
$params, $params,
$isActive, $isActive,
$tables.selected?._id, $tables,
$queries, $queries,
$views, $views,
$viewsV2, $viewsV2,

View File

@ -1,3 +1,5 @@
import { TableNames } from "constants"
const showDatasourceOpen = ({ const showDatasourceOpen = ({
selected, selected,
containsSelected, containsSelected,
@ -26,7 +28,7 @@ const containsActiveEntity = (
datasource, datasource,
params, params,
isActive, isActive,
selectedTableId, tables,
queries, queries,
views, views,
viewsV2 viewsV2
@ -69,7 +71,8 @@ const containsActiveEntity = (
// Check for a matching table // Check for a matching table
if (params.tableId) { if (params.tableId) {
return options.find(x => x._id === selectedTableId) != null const selectedTable = tables.selected?._id
return options.find(x => x._id === selectedTable) != null
} }
// Check for a matching view // Check for a matching view
@ -90,7 +93,7 @@ export const enrichDatasources = (
datasources, datasources,
params, params,
isActive, isActive,
selectedTableId, tables,
queries, queries,
views, views,
viewsV2, viewsV2,
@ -110,19 +113,18 @@ export const enrichDatasources = (
datasource, datasource,
params, params,
isActive, isActive,
selectedTableId, tables,
queries, queries,
views, views,
viewsV2 viewsV2
) )
const entities = Array.isArray(datasource.entities) const dsTables = tables.list.filter(
? datasource.entities
: Object.values(datasource.entities || {})
const dsTables = entities.filter(
table => table =>
!searchTerm || table.sourceId === datasource._id &&
table.name?.toLowerCase()?.indexOf(searchTerm.toLowerCase()) > -1 table._id !== TableNames.USERS &&
(!searchTerm ||
table.name?.toLowerCase()?.indexOf(searchTerm.toLowerCase()) > -1)
) )
const dsQueries = queries.list.filter( const dsQueries = queries.list.filter(
query => query =>