Web: Add filters and pinning support for Enroll Resources page#51893
Web: Add filters and pinning support for Enroll Resources page#51893
Conversation
|
The expected behavior is that it should respect the user's choices and if they unpin everything not to re-pin things. The default pins are meant for new users coming in to the system to draw attention to good places to start. If they are not new users, know what they want, and have elected to remove those, I think putting them back would be frustrating. |
|
Why does there seem to be a full-page refresh if you remove the last pin? |
@zmb3 it was manual refresh, to demonstrate that default pins came back on reload, after unpinning everything. but i'll be changing this behavior (which will be a backend change and will be in another PR) |
d049177 to
3761d0b
Compare
ab7f856 to
504abbf
Compare
gzdunek
left a comment
There was a problem hiding this comment.
I will test it tomorrow.
| <StyledInput | ||
| {updateDiscoverPreferenceAttempt.status === 'error' && ( | ||
| <Danger mt={5} details={updateDiscoverPreferenceAttempt.statusText}> | ||
| Could not update pinned resources: |
There was a problem hiding this comment.
(the details are rendered in a separate line)
| Could not update pinned resources: | |
| Could not update pinned resources |
There was a problem hiding this comment.
I believe it's a leftover from time when Alert couldn't display a title, so we needed a colon to separate it from the content. Now it can be removed.
| }, | ||
| } as UserPreferences; | ||
|
|
||
| if (setPreferenceAfterSuccess) { |
There was a problem hiding this comment.
Why do we need it? Is updating pins here different from updating them in unified resources?
There was a problem hiding this comment.
it was to prevent any render change when fetch failed, without this flag the function updated local preference despite error which would make it appear to have been successful
I could define another function similarly done for unified resources. Let me know what you prefer, i thought the flag made it more obvious that behavior can be different
also the pinned resources works a bit differently for unified resources, it keeps pinned resources in a cluster preference object which is a ref and it calls its own function to update, but the end behavior is the same though which is to render updated pinned state only after success
There was a problem hiding this comment.
I'm not sure if this is worth making updatePreferences logic more complex. This function is used in many places, and the current behavior has worked fine so far - maybe it can stay the same here? My main concern is that it might not be obvious when setPreferenceAfterSuccess should be set.
There was a problem hiding this comment.
sure, i reverted the change and made a new function just for updating discover resource preference
e6833b3 to
a30b299
Compare
| </Grid> | ||
| </Box> | ||
| )} | ||
| {filteredResources && filteredResources.length > 0 && ( |
There was a problem hiding this comment.
| {filteredResources && filteredResources.length > 0 && ( | |
| {filteredResources.length > 0 && ( |
| onChangeShowApp(showApp: boolean): void; | ||
| onSelectResource(selectedResourceSpec: SelectResourceSpec): void; | ||
| pinningSupport: PinningSupport; | ||
| onChangePinGuide(guideId: string): void; |
There was a problem hiding this comment.
We don't use guide in other props.
| onChangePinGuide(guideId: string): void; | |
| onChangePin(guideId: string): void; |
| <Flex alignItems="center" gap={2}> | ||
| <StyledText wantLargeTile={wantLargeTile}>{title}</StyledText> | ||
| {resourceSpec.hasAccess && ( | ||
| <NewTabIcon color="text.muted" size={16} /> |
There was a problem hiding this comment.
Let's use a predefined value ('small' in this case).
| @@ -90,61 +111,125 @@ export function Tile({ | |||
| // popup modal where it shows user to add app manually or automatically. | |||
| return ( | |||
| <ResourceCard | |||
There was a problem hiding this comment.
We can add tabIndex={0} to make it navigable with keyboard.
| }, | ||
| } as UserPreferences; | ||
|
|
||
| if (setPreferenceAfterSuccess) { |
There was a problem hiding this comment.
I'm not sure if this is worth making updatePreferences logic more complex. This function is used in many places, and the current behavior has worked fine so far - maybe it can stay the same here? My main concern is that it might not be obvious when setPreferenceAfterSuccess should be set.
| <StyledInput | ||
| {updateDiscoverPreferenceAttempt.status === 'error' && ( | ||
| <Danger mt={5} details={updateDiscoverPreferenceAttempt.statusText}> | ||
| Could not update pinned resources: |
There was a problem hiding this comment.
I believe it's a leftover from time when Alert couldn't display a title, so we needed a colon to separate it from the content. Now it can be removed.
- Stop propagation and default behavior when clicking on pin button - Add small or large icon option for discover icons
f72ebb1 to
53fce72
Compare
* Minor changes - Stop propagation and default behavior when clicking on pin button - Add small or large icon option for discover icons * Add pinning guide support * Fix lint
…tational#51893) * Minor changes - Stop propagation and default behavior when clicking on pin button - Add small or large icon option for discover icons * Add pinning guide support * Fix lint
…52176) * Web: make SelectResource.tsx component leaner (#51698) * Web: Move resource specs into resource directory * Web: move code out into separate files * Web: define discover resource guide ids and add discover user preference field (#51672) * Add discover resource preferences to user preferences * Define hard coded guide id consts * Set guide ids for resources * Add test * Address CRs * Define a new type just for SelectResource.tsx which requires id field * Wrap discover guide preference "pinned" field inside a proto message (#52017) This allows us to use "nil" value to mean no discover guide preferences set (which is used to set default values in the web UI). * Web: Add filters and pinning support for Enroll Resources page (#51893) * Minor changes - Stop propagation and default behavior when clicking on pin button - Add small or large icon option for discover icons * Add pinning guide support * Fix lint

RFD that also links to figma
requires Wrap discover guide preference "pinned" field inside a proto message #52017
converted search bar to be
type and enterlike it is everywhere elseadded filter dropdowns to filter by
resource kindandhosting platformadded pinning support where users can pin any guides and it will be saved in user preference
default pinsplay with filter in story: https://localhost:9002/?path=/story/teleport-discover-selectresource--all-access
demo:
double checking if that's the intended behavior (where it resets to default if you remove all pins)Screen.Recording.2025-02-05.at.12.29.37.PM.mov
changelog: Add filter drop-downs and pinning support for the "Enroll a New Resource" page in the web UI
TODO in another PR:
url loc state