Filter tables

This commit is contained in:
Adria Navarro 2023-11-09 16:31:10 +01:00
parent b908287223
commit 72c415e72c
3 changed files with 8 additions and 2 deletions

View File

@ -206,7 +206,7 @@
</NavItem>
{#if datasource.open}
<TableNavigator sourceId={datasource._id} {selectTable} />
<TableNavigator sourceId={datasource._id} {selectTable} {searchTerm} />
{#each $queries.list.filter(query => query.datasourceId === datasource._id && (!searchTerm || query.name
?.toLowerCase()
?.indexOf(searchTerm.toLowerCase()) > -1)) as query}

View File

@ -7,6 +7,7 @@
import { goto, isActive } from "@roxi/routify"
import { userSelectedResourceMap } from "builderStore"
export let searchTerm
export let sourceId
export let selectTable
@ -14,6 +15,11 @@
.filter(
table => table.sourceId === sourceId && table._id !== TableNames.USERS
)
.filter(
table =>
!searchTerm ||
table.name.toLowerCase()?.indexOf(searchTerm.toLowerCase()) > -1
)
.sort(alphabetical)
const alphabetical = (a, b) => {

View File

@ -1,5 +1,5 @@
<script>
import { Button, Layout } from "@budibase/bbui"
import { Layout } from "@budibase/bbui"
import DatasourceNavigator from "components/backend/DatasourceNavigator/DatasourceNavigator.svelte"
import Panel from "components/design/Panel.svelte"
import { isActive, redirect, goto, params } from "@roxi/routify"