From 20885a708d56969502c4c4505f95a32f3c8eeabd Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 3 May 2023 12:23:21 +0100 Subject: [PATCH] Feedback updates --- .../_components/BuilderSidePanel.svelte | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index 7341dcd35c..5b35e65ed9 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -28,10 +28,6 @@ let inviting = false let searchFocus = false - // Initially filter entities without app access - // Show all when false - let filterByAppAccess = true - let appInvites = [] let filteredInvites = [] let filteredUsers = [] @@ -62,7 +58,7 @@ appInvites = await getInvites() //On Focus behaviour - if (!filterByAppAccess && (!query || query == "")) { + if (searchFocus && !query) { filteredInvites = appInvites.length > 100 ? appInvites.slice(0, 100) : [...appInvites] return @@ -77,10 +73,7 @@ }) } - $: filterByAppAccess, prodAppId, filterInvites(query) - $: if (searchFocus === true) { - filterByAppAccess = false - } + $: searchFocus, prodAppId, filterInvites(query) const usersFetch = fetchData({ API, @@ -99,9 +92,9 @@ } await usersFetch.update({ query: { - appId: query || !filterByAppAccess ? null : prodAppId, + appId: query || searchFocus ? null : prodAppId, email: query, - paginated: query || !filterByAppAccess ? null : false, + paginated: query || searchFocus ? null : false, }, }) await usersFetch.refresh() @@ -127,12 +120,7 @@ } const debouncedUpdateFetch = Utils.debounce(searchUsers, 250) - $: debouncedUpdateFetch( - query, - $store.builderSidePanel, - loaded, - filterByAppAccess - ) + $: debouncedUpdateFetch(query, $store.builderSidePanel, loaded, searchFocus) const updateAppUser = async (user, role) => { if (!prodAppId) { @@ -208,7 +196,7 @@ const searchGroups = (userGroups, query) => { let filterGroups = - query?.length || !filterByAppAccess + query?.length || searchFocus ? userGroups : getAppGroups(userGroups, prodAppId) return filterGroups @@ -240,7 +228,7 @@ } // Adds the 'role' attribute and sets it to the current app. - $: enrichedGroups = getEnrichedGroups($groups, filterByAppAccess) + $: enrichedGroups = getEnrichedGroups($groups, searchFocus) $: filteredGroups = searchGroups(enrichedGroups, query) $: groupUsers = buildGroupUsers(filteredGroups, filteredUsers) $: allUsers = [...filteredUsers, ...groupUsers] @@ -252,7 +240,7 @@ specific roles for the app. */ const buildGroupUsers = (userGroups, filteredUsers) => { - if (query || !filterByAppAccess) { + if (query || searchFocus) { return [] } // Must exclude users who have explicit privileges @@ -452,20 +440,19 @@ { - if (!filterByAppAccess) { - filterByAppAccess = true + if (searchFocus) { + searchFocus = false } if (!query) { return } query = null userOnboardResponse = null - filterByAppAccess = true }} > - + @@ -509,8 +496,6 @@
- - -
{/each}