-
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
Restructure SSH and AWS configuration screens #27831
Restructure SSH and AWS configuration screens #27831
Conversation
CI Results: |
ui/app/components/secret-engine/configurable-secret-engine-details.ts
Outdated
Show resolved
Hide resolved
Build Results: |
ui/app/components/secret-engine/configurable-secret-engine-details.hbs
Outdated
Show resolved
Hide resolved
{{#if attr.options.sensitive}} | ||
<InfoTableRow | ||
alwaysRender={{(not (is-empty-value (get @model attr.name)))}} | ||
@label={{or attr.options.label (to-label attr.name)}} | ||
@value={{get this.configModel (or attr.options.fieldValue attr.name)}} | ||
> | ||
<MaskedInput @value={{get @model attr.name}} @name={{attr.name}} @displayOnly={{true}} @allowCopy={{true}} /> | ||
</InfoTableRow> | ||
{{else}} | ||
<InfoTableRow | ||
@alwaysRender={{(not (is-empty-value (get @model attr.name)))}} | ||
@label={{or attr.options.label (to-label attr.name)}} | ||
@value={{get this.configModel (or attr.options.fieldValue attr.name)}} | ||
/> | ||
{{/if}} |
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 think you can wrap just the MaskedInput component in the {{#if}}
block and get the same results here which would remove the need for {{else}}
<InfoTableRow
alwaysRender={{not (is-empty-value (get @model attr.name))}}
@label={{or attr.options.label (to-label attr.name)}}
@value={{get this.configModel (or attr.options.fieldValue attr.name)}}
>
{{#if attr.options.sensitive}}
<MaskedInput @value={{get @model attr.name}} @name={{attr.name}} @displayOnly={{true}} @allowCopy={{true}} />
{{/if}}
</InfoTableRow>
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 had made an inline comment about this but after several commits it was gone. Long story short, I can't. And I confirmed other instances of MaskedInput yielded inside of InfoTableRow. If I do, it does not render the non-masked Inputs. I've double checked this just to make sure I wasn't having an off day. Do a quick search for and you'll see this pattern. I also thought of adding a conditional to InfoTableRow to handle Masked inputs, but defaulted to keeping scope focused on the files at hand.
ui/app/components/secret-engine/configurable-secret-engine-details.hbs
Outdated
Show resolved
Hide resolved
ui/app/components/secret-engine/configurable-secret-engine-details.ts
Outdated
Show resolved
Hide resolved
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 noticed that this breadcrumb says Configure
but I think it should be Configuration
since Configure
is actually a separate route 🤔 I realize this is not quite what you were addressing here, just mentioning in case you wanted to update!
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.
Yep, I noticed that as well. I've got a ticket for breadcrumbs specifically, so holding off on any breadcrumb work for that one pr.
ui/app/components/secret-engine/configurable-secret-engine-details.ts
Outdated
Show resolved
Hide resolved
ui/app/templates/vault/cluster/secrets/backend/configuration.hbs
Outdated
Show resolved
Hide resolved
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.
Great extra test coverage! Some non-blocking comments, just things to think about
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.
👏
const { model } = this.args; | ||
// Should not be able to get here without a model, but in case an upstream change allows it, catching the failure. | ||
if (!model) { | ||
this.configError = { |
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 would think that if we do not expect this component to handle the error screen (it's handled upstream) then no model would default to the empty state. In that case, we could just return here without setting a tracked configError value
// Fetch the config for the engine type. | ||
switch (type) { | ||
case 'aws': | ||
this.fetchAwsRootConfig(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 wonder if the fetchConfig method could be passed from the parent, and then this component would be extensible without needing to know about all the types of secret engines
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 had a similar question and still go back and forth.
If you're okay with it, I'll make a separate ticket for this change. There are some changes to the parent that I'd also liked to make (it currently does some kvv2 magic that I'd want to integrate).
Description
The AWS and SSH secret engines are the only secret engines within the reused secret-engine workflow that allow configuration. To match other engines (like LDAP, PKI, etc) that allow configuration this PR displays: configuration details, or a prompt to configure or an error message.
It also moves the
mount-configuration
details inside a toggle "Show mount configuration."Implementation notes:
fetchSecretEngineConfig
decorator to show AWS and SSH configuration details. The secrets.backend.configuration route is reused across multiple models, and it's not possible for me to know ahead of time both the model name and the mount path before I enter the route (e.g.secretMountPath
service is required for the decorator but is unable to fetch currentPath for a dynamic model situation).Test coverage
configurable-secret-engine-details
:a. Shows EmptyState prompt to configure when no error API error.
b. Shows error when API error.
c. Shows configuration details when engine has been configured.
a. Prompts configuration after mounting
b. Shows AWS configuration details.
c. Update configuration details displays.
a. Prompts configuration after mounting.
b. Displays configuration details.
Screenshots
SSH
AWS
prompt vs error handling
error

prompt

non-configurable Secret Engine (Cubbyhole): nothing will have changed.