-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Advanced search #7739
Advanced search #7739
Conversation
Build failed.
|
Build failed.
|
Build succeeded.
|
This comment has been minimized.
This comment has been minimized.
recheck |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@jlmitch5 should I be able to see this Keytype on JTs? When using typeahead, should I see the last option to create the typeahead value? Should refreshing a JT Advanced filter page include the original filter or clear all filters? Is there a working or/not query I could generate? Unable to perform advanced search on Credentials, Users, Credential Types, Instance Groups 500 Error when attempting to perform organization.id__iexact=0 |
Build succeeded.
|
@@ -0,0 +1,156 @@ | |||
import React, { useCallback, useEffect } from 'react'; |
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 recently removed InventoryScripts here: #7577
This file probably snuck in during a rebase, so we should remove it.
Build succeeded.
|
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.
Awesome stuff. I really like the direction advanced search is going and it'll be exciting to get this into the UI 🎉
Merge Failed. This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset. |
- make set type and lookup prefixes/suffixes on searchColumns explicitly defined - send possible search keys from options requests on (most) lists
…helpful error message to tell you this is the issue
Build succeeded.
|
Build succeeded (gate pipeline).
|
This PR adds advanced search support to the lists in UI next.
To access advanced search, it is the last key in the search key dropdown of any list, just click on it:
When you do so, the search input group will change to 3 typeahead selects and a text input
All search-component related updates are in the first commit of this PR
The first typeahead is the optional set type selector. you can choose these different set types to change the set of results returned. for example if you search for
or__foo: bar
andor__foo: baz
, it will return results where the foo key is either foo or baz. While the api doesn't explicitly support typingand__
(it is the default set type when no set type prefix is entered), it didn't really make sense to not include it in the descriptions here, so if the user adds it, it will get stripped out when sent to the api. It would be better if the api allowed it (like they do for the__exact
default lookup), but I think it works for now.The second typeahead is the key selector. It allows you to select from a set of keys which are returned from the options request for the list, as well type in a key that is not listed. It is required, and when a key is selected the value text input is enabled.
#7741 -- Currently, there are two sets of keys displayed in the options for this typeahead--the direct keys of the resource, and the related search fields. Since there is currently a bug with PF support ( pr open so should be fixed soon -- patternfly/patternfly-react#4622 ) of select groups with typeaheads, I have to concat and dedup these two together. The related search fields are special in that when no prefix or lookup is specified, we want to allow the user to access the fuzzy search for these related resources, so I append the __search lookup when that is the case. Because there are some cases where a related key is both a direct key (usually the id of which resource it is connected to), as well as a related search key with which you can search the fields of that resource, I do not do the __search appending if it is in both sets of options.
The third typeahead are the lookups, which allows you to set specific ways to check the value against the key.
All list changes across the app are in the second commit of this pr
I had to make a couple of adjustments to the simple search implementation to help things make sense now that advanced search results are possible.
The first is that the UX-enhancement of adding the i18n'd, sentence-cased name of the search keys for simple search'd tags could get a bit confusing when there are also chip groups of these keys but with different modifiers. @trahman73 and I came up with the idea of including this i18n'd label, but also including what specific key is being searched so that it feels a bit more clear. For example:
The second is a bit of magic that I couldn't figure out how to keep without really complicating the code. Basically the icontains and or modifiers were added to text and select keys implicitly based on the qsConfig. with the addition of the new advanced search keys the way I was making the groups of chips based on the keys because super complicated, and I couldn't figure out how to save this bit of magic without making things super brittle. So I added these modifiers explicitly to the searchColumn keys cross ui_next. I don't love that I had to do this, and if anyone could figure out a nicer way that we could do this, I'm definitely for adding back in this developer experience improvement.
#7740 -- There are a handful of screens that don't have anything populated in the options for the key typeahead, as they don’t use the useRequest hook yet. In terms of work, I think it makes sense that they should be converted first so that they can grab the options request to get possible advanced keys.
*these actually need to be passed an additional options request from the places they are called, they have useRequest in use right now, so bit of a different conversion
A note on responsiveness
The only thing left is figuring out mid-size screen responsiveness. I've got things looking nice for desktop view:
and mobile view:
but the spacing gets bad for middle-width views:
Did figure out a workaround for this (https://stackoverflow.com/questions/35578404/giving-wrapped-flexbox-items-vertical-spacing/44523788) but I'm not adding it now in hopes it is fixed on the PF side. @marshmalien made the discovery that flexbox will allow for a wrapping row gap (hopefully common place soon!) which would solve the problems:
https://developer.mozilla.org/en-US/docs/Web/CSS/gap#Browser_compatibility
The hack that works is: