-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Filter Secret Engine List view by engineType and/or name #20481
Filter Secret Engine List view by engineType and/or name #20481
Conversation
… the same type with different names
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.
update changelog text
@tracked secretEngineOptions = []; | ||
@tracked selectedEngineType = null; | ||
@tracked selectedEngineName = null; | ||
|
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.
open to suggestions on ways to make this cleaner, but for context here is the flow:
- On init, this getter returns the full list of secret engines to display on the template.
- When someone filters, either by name or engine type, this list is updated. This update is triggered because of the tracked properties that change inside the getter when someone filters by name or engine type.
- This getter is used to create the
options
param passed into the SearchSelect components.
…ub.com:hashicorp/vault into ui/VAULT-16024/filter-secret-engines-type-name
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.
this is so much cleaner! 🥲 Great work. Added a couple comments, and I'll hold approving until the filtering tests are in here!
<ul class="menu-list"> | ||
<li class="action"> | ||
<LinkTo @route="vault.cluster.secrets.backend.configuration" @model={{backend.id}} data-test-engine-config> | ||
<LinkTo @route="vault.cluster.secrets.backend.configuration" @model={{backend.id}}> |
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.
This route might be different for engines like pki and kmip, no?
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.
Good question. That is an issue when you click on the whole row, but not when you click on the menu to go to configuration. For example, for PKI when you click on the row it navigates you to the overview page. But the configuration page is the same for all. I confirmed the same behavior on this branch is seen on main.
🤦♀️ and then I approved it. Well, please ping me when the tests are written I'd love to take a look! |
Will do! I think I'll finish the tests today, but return to the tests to double check and I'll return to your comments when I have a fresh brain. For now, just so I don't accidentally press something, I'll add the don't merge label. |
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.
Thanks for the test coverage! One small comment, but otherwise 🚀
@@ -28,28 +28,20 @@ export default class VaultClusterSecretsBackendController extends Controller { | |||
if (this.selectedEngineType) { | |||
// check first if the user has also filtered by name. | |||
if (this.selectedEngineName) { | |||
return this.filterByName(sortedBackends); | |||
return sortedBackends.filter((backend) => this.selectedEngineName === backend.get('id')); |
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 don't think we need to use .get
anymore, we could instead do:
return sortedBackends.filter((backend) => this.selectedEngineName === backend.get('id')); | |
return sortedBackends.filter((backend) => this.selectedEngineName === backend.id); |
But if that doesn't work for some reason I'd like to understand why!
This PR adds two filtering options on the Secret Engine LIST view: filter by engineType (e.g. kv) and/or filter by engine name (e.g. secret). See community Issue for this request here.
LinkableItem
. TLDR: I changed the structure to match the list structure used in the Auth LIST view, backing out the contextual component. While this expanded the row count for thebackends.hbs
file, it removed 3 components, and greatly increased the page speed. This is a huge win for customers that have a lot of secret engines.isSupportedBackend
to the model and removing the two lists: supported and unsupported that were rendered in the view.{{let}}
definitions in the contextual components. This made this a lot easier to simplify and clean up the passing around of params.Screen.Recording.2023-05-05.at.11.12.52.AM.mov
In another PR:
If you want to run a script to add loads of secret engines, here is a bash script