From f916e338a21ed566260d13e93182ffe49bba9556 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 30 Sep 2021 14:08:18 +0100 Subject: [PATCH 1/2] app list search bar --- .../src/pages/builder/portal/apps/index.svelte | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index d84b327e90..661f43d464 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -12,6 +12,7 @@ Page, notifications, Body, + Search, } from "@budibase/bbui" import CreateAppModal from "components/start/CreateAppModal.svelte" import UpdateAppModal from "components/start/UpdateAppModal.svelte" @@ -35,8 +36,12 @@ let unpublishModal let creatingApp = false let loaded = false + let searchTerm = "" $: enrichedApps = enrichApps($apps, $auth.user, sortBy) + $: filteredApps = enrichedApps.filter(app => + new RegExp(searchTerm, "ig").test(app?.name) + ) const enrichApps = (apps, user, sortBy) => { const enrichedApps = apps.map(app => ({ @@ -45,6 +50,7 @@ lockedYou: app.lockedBy && app.lockedBy.email === user?.email, lockedOther: app.lockedBy && app.lockedBy.email !== user?.email, })) + if (sortBy === "status") { return enrichedApps.sort((a, b) => { if (a.status === b.status) { @@ -205,6 +211,7 @@ { label: "Sort by status", value: "status" }, ]} /> + - {#each enrichedApps as app (app.appId)} + {#each filteredApps as app (app.appId)} Date: Thu, 30 Sep 2021 15:08:29 +0100 Subject: [PATCH 2/2] switch from regex to includes --- packages/builder/src/pages/builder/portal/apps/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 661f43d464..c1f06329e5 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -40,7 +40,7 @@ $: enrichedApps = enrichApps($apps, $auth.user, sortBy) $: filteredApps = enrichedApps.filter(app => - new RegExp(searchTerm, "ig").test(app?.name) + app?.name?.toLowerCase().includes(searchTerm.toLowerCase()) ) const enrichApps = (apps, user, sortBy) => {