-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Designer user side panel UX updates. #10468
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2f091ca
Initial commit of filter UX behaviour
deanhannigan 56149c8
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan a8134d7
On focus search behaviour renders to 100 invites, all groups and the …
deanhannigan 10e2f0e
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan 3888abc
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan 29ef871
Feedback updates
deanhannigan c823b12
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan 7ff29fd
Feedback updates and a fix pass the current query after updating a us…
deanhannigan 0499239
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan 8a5729c
Merge remote-tracking branch 'origin/develop' into feature/user-side-…
deanhannigan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,13 +28,16 @@ | |
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 = [] | ||
let filteredGroups = [] | ||
let selectedGroup | ||
let userOnboardResponse = null | ||
|
||
let userLimitReachedModal | ||
|
||
$: queryIsEmail = emailValidator(query) === true | ||
|
@@ -52,15 +55,32 @@ | |
} | ||
|
||
const filterInvites = async query => { | ||
if (!prodAppId) { | ||
return | ||
} | ||
|
||
appInvites = await getInvites() | ||
if (!query || query == "") { | ||
filteredInvites = appInvites | ||
|
||
//On Focus behaviour | ||
if (!filterByAppAccess && (!query || query == "")) { | ||
filteredInvites = | ||
appInvites.length > 100 ? appInvites.slice(0, 100) : [...appInvites] | ||
return | ||
} | ||
filteredInvites = appInvites.filter(invite => invite.email.includes(query)) | ||
|
||
filteredInvites = appInvites.filter(invite => { | ||
const inviteInfo = invite.info?.apps | ||
if ((!query || query == "") && inviteInfo && prodAppId) { | ||
return Object.keys(inviteInfo).includes(prodAppId) | ||
} | ||
return invite.email.includes(query) | ||
}) | ||
} | ||
|
||
$: filterInvites(query) | ||
$: filterByAppAccess, prodAppId, filterInvites(query) | ||
$: if (searchFocus === true) { | ||
filterByAppAccess = false | ||
} | ||
|
||
const usersFetch = fetchData({ | ||
API, | ||
|
@@ -79,9 +99,9 @@ | |
} | ||
await usersFetch.update({ | ||
query: { | ||
appId: query ? null : prodAppId, | ||
appId: query || !filterByAppAccess ? null : prodAppId, | ||
email: query, | ||
paginated: query ? null : false, | ||
paginated: query || !filterByAppAccess ? null : false, | ||
}, | ||
}) | ||
await usersFetch.refresh() | ||
|
@@ -107,7 +127,12 @@ | |
} | ||
|
||
const debouncedUpdateFetch = Utils.debounce(searchUsers, 250) | ||
$: debouncedUpdateFetch(query, $store.builderSidePanel, loaded) | ||
$: debouncedUpdateFetch( | ||
query, | ||
$store.builderSidePanel, | ||
loaded, | ||
filterByAppAccess | ||
) | ||
|
||
const updateAppUser = async (user, role) => { | ||
if (!prodAppId) { | ||
|
@@ -182,9 +207,10 @@ | |
} | ||
|
||
const searchGroups = (userGroups, query) => { | ||
let filterGroups = query?.length | ||
? userGroups | ||
: getAppGroups(userGroups, prodAppId) | ||
let filterGroups = | ||
query?.length || !filterByAppAccess | ||
? userGroups | ||
: getAppGroups(userGroups, prodAppId) | ||
return filterGroups | ||
.filter(group => { | ||
if (!query?.length) { | ||
|
@@ -214,7 +240,7 @@ | |
} | ||
|
||
// Adds the 'role' attribute and sets it to the current app. | ||
$: enrichedGroups = getEnrichedGroups($groups) | ||
$: enrichedGroups = getEnrichedGroups($groups, filterByAppAccess) | ||
$: filteredGroups = searchGroups(enrichedGroups, query) | ||
$: groupUsers = buildGroupUsers(filteredGroups, filteredUsers) | ||
$: allUsers = [...filteredUsers, ...groupUsers] | ||
|
@@ -226,7 +252,7 @@ | |
specific roles for the app. | ||
*/ | ||
const buildGroupUsers = (userGroups, filteredUsers) => { | ||
if (query) { | ||
if (query || !filterByAppAccess) { | ||
return [] | ||
} | ||
// Must exclude users who have explicit privileges | ||
|
@@ -351,7 +377,6 @@ | |
|
||
onMount(() => { | ||
rendered = true | ||
searchFocus = true | ||
}) | ||
|
||
function handleKeyDown(evt) { | ||
|
@@ -417,7 +442,6 @@ | |
autocomplete="off" | ||
disabled={inviting} | ||
value={query} | ||
autofocus | ||
on:input={e => { | ||
query = e.target.value.trim() | ||
}} | ||
|
@@ -428,16 +452,20 @@ | |
|
||
<span | ||
class="search-input-icon" | ||
class:searching={query} | ||
class:searching={query || !filterByAppAccess} | ||
on:click={() => { | ||
if (!filterByAppAccess) { | ||
filterByAppAccess = true | ||
} | ||
if (!query) { | ||
return | ||
} | ||
query = null | ||
userOnboardResponse = null | ||
filterByAppAccess = true | ||
}} | ||
> | ||
<Icon name={query ? "Close" : "Search"} /> | ||
<Icon name={!filterByAppAccess || query ? "Close" : "Search"} /> | ||
</span> | ||
</div> | ||
|
||
|
@@ -481,6 +509,8 @@ | |
</div> | ||
</div> | ||
<div class="auth-entity-access"> | ||
<!-- {#key filteredInvites} --> | ||
<!-- {invite.info.apps?.[prodAppId]} --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some commented out code left over. |
||
<RoleSelect | ||
placeholder={false} | ||
value={invite.info.apps?.[prodAppId]} | ||
|
@@ -496,6 +526,7 @@ | |
autoWidth | ||
align="right" | ||
/> | ||
<!-- {/key} --> | ||
</div> | ||
</div> | ||
{/each} | ||
|
@@ -555,7 +586,7 @@ | |
|
||
{#if filteredUsers?.length} | ||
<div class="auth-entity-section"> | ||
<div class="auth-entity-header "> | ||
<div class="auth-entity-header"> | ||
<div class="auth-entity-title">Users</div> | ||
<div class="auth-entity-access-title">Access</div> | ||
</div> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB but just a quick FYI that
(!query || query == "")
is redundant -!query
by itself will already account for empty strings.