-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Change availability filter to a toggle #44182
Conversation
availabilityFilter.mode === 'requestable' || | ||
availabilityFilter.mode === 'all' |
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.
It would be nice if these were enums
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.
(it's a union at least)
But it seems that we should get rid of the now unused none
option.
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.
we'll have to keep none around for a little bit to ensure users who had it selected will still work correctly
@@ -140,7 +140,7 @@ export function FilterPanel({ | |||
kindsFromParams={kinds || []} | |||
/> | |||
{ClusterDropdown} | |||
{availabilityFilter && ( | |||
{availabilityFilter && availabilityFilter.canRequestAll && ( |
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.
What if canRequestAll
is false
? Previously we could choose between accessible
and requestable
.
I think we should still allow this.
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.
Ok sure. I originally programmed this as "if the feature is off, just dont show it at all", but i'll udpate to still show it and use requestable
return ( | ||
availabilityFilter.mode === option || availabilityFilter.mode === 'all' | ||
); | ||
onChange('all'); |
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.
Hmm, shouldn't we set all
or accessible
depending on canRequestAll
?
availabilityFilter.mode === 'requestable' || | ||
availabilityFilter.mode === 'all' | ||
} | ||
onToggle={handleToggle} |
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.
The popover closes as soon as the user clicks the toggle, this is unexpected.
I think clicking on the toggle should update the unified view, but not close the popover.
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.
The popup doesn't close for me. Am i using it weird?
5a2b8062aaa9984db71529f6dcb5150a.mp4
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.
I tested it in Connect:
https://github.com/user-attachments/assets/a82b2cb8-7d69-408c-98c2-39a1d2a898ff
This happens because when params change, we remount the component so it can re-fetch the list.
I don't have a good idea how to fix it, if you don't have either, we can keep it as is :(
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.
I can't think of anything quick. We'll keep as is and see if anyone complains
availabilityFilter.mode === 'requestable' || | ||
availabilityFilter.mode === 'all' |
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.
(it's a union at least)
But it seems that we should get rid of the now unused none
option.
This PR will remove the radio/checkbox options for the availability filter and instead use a toggle to "show requestable resources or not" The default option for new users is still "toggled on" to show requestable resources.
b5972ab
to
8c5e740
Compare
<ChevronDown ml={2} size="small" color="text.slightlyMuted" /> | ||
{availabilityFilter.canRequestAll === true && | ||
availabilityFilter.mode !== 'none' && <FiltersExistIndicator />} | ||
{availabilityFilter.mode === 'accessible' && ( |
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.
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.
The default state is "on" so the indicator should show when accessible
is the value
availabilityFilter.mode === 'requestable' || | ||
availabilityFilter.mode === 'all' | ||
} | ||
onToggle={handleToggle} |
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.
I tested it in Connect:
https://github.com/user-attachments/assets/a82b2cb8-7d69-408c-98c2-39a1d2a898ff
This happens because when params change, we remount the component so it can re-fetch the list.
I don't have a good idea how to fix it, if you don't have either, we can keep it as is :(
This PR will remove the radio/checkbox options for the availability filter and instead use a toggle to "show requestable resources or not"
This takes into account if users have the
requestable
option toggled in their user prefs still so everything should work for them in the new versionThe default option for new users is still to show requestable resources, aka "toggled on".
changelog: the availability filter is now a toggle to show (or hide) requestable resources