Skip to content
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

Merged
merged 26 commits into from
Jul 30, 2024

Conversation

Monkeychip
Copy link
Contributor

@Monkeychip Monkeychip commented Jul 22, 2024

  • enterprise tests pass

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:

  • Unable to use the 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).
  • Prep work for the AWS WIF work.
  • The AWS configure "save" flow is still borked. Too big of a move here to address in this pr. Will address in later PR.
  • Breadcrumbs on configure for all these cookie-cutter secret engines are still borked. Addressing in a nice-to-have PR.

Test coverage

  1. Component 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.
  2. AWS Acceptance:
    a. Prompts configuration after mounting
    b. Shows AWS configuration details.
    c. Update configuration details displays.
  3. SSH Acceptance:
    a. Prompts configuration after mounting.
    b. Displays configuration details.

Screenshots

SSH

image

AWS

image

prompt vs error handling

error
image

prompt
image

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

image

@Monkeychip Monkeychip added the ui label Jul 22, 2024
@Monkeychip Monkeychip added this to the 1.18.0-rc milestone Jul 22, 2024
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Jul 22, 2024
Copy link

github-actions bot commented Jul 22, 2024

CI Results:
All Go tests succeeded! ✅

@Monkeychip Monkeychip changed the title WIP: restructure SSH and AWS configuration screens Restructure SSH and AWS configuration screens Jul 22, 2024
@Monkeychip Monkeychip marked this pull request as ready for review July 26, 2024 18:13
@Monkeychip Monkeychip requested a review from a team as a code owner July 26, 2024 18:13
Copy link

github-actions bot commented Jul 26, 2024

Build Results:
All builds succeeded! ✅

Comment on lines 11 to 25
{{#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}}
Copy link
Contributor

@hellobontempo hellobontempo Jul 26, 2024

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>

Copy link
Contributor Author

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.

Copy link
Contributor

@hellobontempo hellobontempo Jul 26, 2024

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!

Copy link
Contributor Author

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.

@Monkeychip Monkeychip requested a review from hellobontempo July 27, 2024 21:08
Copy link
Contributor

@hashishaw hashishaw left a 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

Copy link
Contributor

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 = {
Copy link
Contributor

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);
Copy link
Contributor

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

Copy link
Contributor Author

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).

@Monkeychip Monkeychip merged commit 1f982bf into main Jul 30, 2024
31 checks passed
@Monkeychip Monkeychip deleted the ui/VAULT-28466/restructure-aws-configuration branch July 30, 2024 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants