-
Notifications
You must be signed in to change notification settings - Fork 252
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
services: filter by labels ux enhancement #160
Conversation
@dctalbot That's something currently app-wide that I've brought up a few times (stripping out ugly stuff from error messages). It's something I definitely want to to do, but where we do it would affect the errors app-wide, so it would be best to scope that to its own issue. We could certainly hard code it for this particular section to not show "Graphql", but I think it would be best to wait until we can follow through. |
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.
@Auchindoun @dctalbot Doesn't that message have a field name prop? It should show up as an inline validation error on the key field/select, rather than the value.
@mastercactapus I wasn't aware of any queries we have having field name errors. I thought this was just in our mutations. |
@Auchindoun all errors from the validation package will have a field name set, even if it's a query |
Looks like all errors are rendered through
and not using a FormHelper to display under the field. This applies to all of our QuerySelects, not just labels. The above will show in the options field if there is an invalid key being set as the variable. (e.g. someone types "asdf=" in the search field, opens the filter container, opens the value select, and tries to start typing. This can also happen if the user directly inputs "asdf=" as the search parameter in the URL box. There's no real way around it with current implementation, as we pass the value of the key to the select as is, since we don't perform any client side validation in instances such as these. Alternatively, we can always have the key's value in the select field default to null, so we would never get in this situation. |
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.
Just a couple of small things left code wise.
Functionally, the filter icon seems to break on widescreen until refresh if the mobile version is rendered (try resizing the window to mobile and back, then clicking on it). It might be a React useRef
bug though, not sure that it's anything we're doing wrong, it looks like it should work.
Can anyone else reproduce?
@Auchindoun Ah, that makes sense. We'll need to look for a key error on the value select and raise it to the key field so it shows up correctly for the user. Though, alternatively (and maybe a better route), we could consider if we really even need to validate it's a key -- we could validate it as "Search" input inside the SearchValues method. Hard That would get rid of the odd error state and if it's an "invalid" key, you would just get no results, which should work fine. |
I don't know if this should be the correct approach, as the key will have already been in an error state for some time, and a random error message would show in a field different from what the user is currently typing in. Could you elaborate on your second thought? Not sure I know what you mean. What type of validation do you want to add to the key select query? |
For the first, we'd have to have some way of passing the error from the value field to the key field -- which feels messy. For the second, we'd just change this to Since there's actually no requirement that it be a key (it's read-only and only needs to be safe text). That also makes it use the same validation as the key search so there would never be a discrepancy. |
@mastercactapus Gotcha. I'll add that validation in there and see how it plays out in the UI |
So how it would play out right now is that they would just see no results if they were to do |
@Auchindoun I think that works. If it's a valid key or not, it's ok. If it's a valid key with no results, or and invalid one with no results, I think we can display it the same. It might be worth making the same validation change to service search so we don't show an error for invalid keys when searching. Validating the key really only needs to happen when we're putting data in the DB. But if they want to search for the key "foo" they will just get no results since there isn't a key named "foo". It's like if you entered |
Sounds good. I'll update validation on both so the same result set is always expected no matter the source |
make check
to catch common errors. Fixed any that came up.Description:
This PR allows individuals to filter services by labels with more ease. When a user selects a label key, it will show all services for that key (and populate the search field with the generated search query). From there, they can then select a label value to further refine those results.
Out of Scope:
Screenshots:
Describe any introduced user-facing changes:
Describe any introduced API changes:
uniqueValues
option to thelabels
query
. This acts similarly to the preexisting optionuniqueKeys
.Additional Info:
PaginatedList
.