From 2a2215f48514b35f11339d94f257f7eb406e5da3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 26 Jun 2023 10:50:54 +0100 Subject: [PATCH] Display users table as its own option at the very top of the datasource list --- .../DatasourceNavigator.svelte | 20 +++++++++++++++++-- .../TableNavigator/TableNavigator.svelte | 12 ++++------- .../data/datasource/bb_internal/index.svelte | 5 ++++- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte index c7723f2bc0..e2dd1b4cc3 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte @@ -12,8 +12,10 @@ customQueryText, } from "helpers/data/utils" import IntegrationIcon from "./IntegrationIcon.svelte" + import { TableNames } from "constants" let openDataSources = [] + $: enrichedDataSources = enrichDatasources( $datasources, $params, @@ -71,6 +73,13 @@ $goto(`./datasource/${datasource._id}`) } + const selectTable = tableId => { + tables.select(tableId) + if (!$isActive("./table/:tableId")) { + $goto(`./table/${tableId}`) + } + } + function closeNode(datasource) { openDataSources = openDataSources.filter(id => datasource._id !== id) } @@ -151,9 +160,16 @@ {#if $database?._id}
+ selectTable(TableNames.USERS)} + /> {#each enrichedDataSources as datasource, idx} 0} + border text={datasource.name} opened={datasource.open} selected={$isActive("./datasource") && datasource.selected} @@ -174,7 +190,7 @@ {#if datasource.open} - + {#each $queries.list.filter(query => query.datasourceId === datasource._id) as query} b.name?.toLowerCase() ? 1 : -1 export let sourceId + export let selectTable $: sortedTables = $tables.list - .filter(table => table.sourceId === sourceId) + .filter( + table => table.sourceId === sourceId && table._id !== TableNames.USERS + ) .sort(alphabetical) - - const selectTable = tableId => { - tables.select(tableId) - if (!$isActive("./table/:tableId")) { - $goto(`./table/${tableId}`) - } - } {#if $database?._id} diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte index 33f3b626a2..a2ee0cf19b 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/index.svelte @@ -6,12 +6,15 @@ import { goto } from "@roxi/routify" import { onMount } from "svelte" import { BUDIBASE_INTERNAL_DB_ID } from "constants/backend" + import { TableNames } from "constants" let modal $: internalTablesBySourceId = $tables.list.filter( table => - table.type !== "external" && table.sourceId === BUDIBASE_INTERNAL_DB_ID + table.type !== "external" && + table.sourceId === BUDIBASE_INTERNAL_DB_ID && + table._id !== TableNames.USERS ) onMount(() => {