From 062149af7e71799828dadf30de3ac6c9e2d201d9 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 21 Jan 2025 14:12:31 +0100 Subject: [PATCH] Move from store to utils --- .../DataSourceSelect/DataSourceSelect.svelte | 8 ++- .../settings/controls/TableSelect.svelte | 11 ++- packages/builder/src/helpers/data/format.js | 36 ++++++++++ .../src/stores/builder/friendlyNames.ts | 71 ------------------- packages/builder/src/stores/builder/index.js | 3 - 5 files changed, 49 insertions(+), 80 deletions(-) delete mode 100644 packages/builder/src/stores/builder/friendlyNames.ts diff --git a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte index f5f7c3ed9d..e47cf1df3e 100644 --- a/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/DataSourceSelect/DataSourceSelect.svelte @@ -18,13 +18,14 @@ } from "@budibase/bbui" import { createEventDispatcher } from "svelte" import { + tables as tablesStore, queries as queriesStore, + viewsV2 as viewsV2Store, views as viewsStore, selectedScreen, componentStore, datasources, integrations, - friendlyNamesStore, } from "@/stores/builder" import BindingBuilder from "@/components/integration/QueryBindingBuilder.svelte" import IntegrationQueryEditor from "@/components/integration/index.svelte" @@ -33,6 +34,7 @@ import ClientBindingPanel from "@/components/common/bindings/ClientBindingPanel.svelte" import DataSourceCategory from "@/components/design/settings/controls/DataSourceSelect/DataSourceCategory.svelte" import { API } from "@/api" + import { sortAndFormat } from "@/helpers/data/format" export let value = {} export let otherSources @@ -49,13 +51,13 @@ let modal $: text = value?.label ?? "Choose an option" - $: tables = $friendlyNamesStore.tables + $: tables = sortAndFormat.tables($tablesStore.list, $datasources.list) $: viewsV1 = $viewsStore.list.map(view => ({ ...view, label: view.name, type: "view", })) - $: viewsV2 = $friendlyNamesStore.viewsV2 + $: viewsV2 = sortAndFormat.viewsV2($viewsV2Store.list, $datasources.list) $: views = [...(viewsV1 || []), ...(viewsV2 || [])] $: queries = $queriesStore.list .filter(q => showAllQueries || q.queryVerb === "read" || q.readable) diff --git a/packages/builder/src/components/design/settings/controls/TableSelect.svelte b/packages/builder/src/components/design/settings/controls/TableSelect.svelte index 067b34a38f..146decda91 100644 --- a/packages/builder/src/components/design/settings/controls/TableSelect.svelte +++ b/packages/builder/src/components/design/settings/controls/TableSelect.svelte @@ -1,8 +1,13 @@