Skip to content

UI: Add KV view for wrap tool#29677

Merged
lane-wetmore merged 13 commits intomainfrom
ui/VAULT-33463-add-kv-view-in-wrap
Feb 25, 2025
Merged

UI: Add KV view for wrap tool#29677
lane-wetmore merged 13 commits intomainfrom
ui/VAULT-33463-add-kv-view-in-wrap

Conversation

@lane-wetmore
Copy link
Copy Markdown
Contributor

@lane-wetmore lane-wetmore commented Feb 19, 2025

Description

This PR adds a KV view to the wrap tool based off the existing pattern when creating KV secrets. This resolves #28579. The default view is the still the JSON editor, but can be toggled between the two views while retaining input.

This also shifts from disabling the wrap button when there are errors to displaying a warning message while leaving the button enabled.

Previous:
image

Current:
image
image
Current with Warning:
image

TODO only if you're a HashiCorp employee

  • Backport Labels: If this fix needs to be backported, use the appropriate backport/ label that matches the desired release branch. Note that in the CE repo, the latest release branch will look like backport/x.x.x, but older release branches will be backport/ent/x.x.x+ent.
    • LTS: If this fixes a critical security vulnerability or severity 1 bug, it will also need to be backported to the current LTS versions of Vault. To ensure this, use all available enterprise labels.
  • ENT Breakage: If this PR either 1) removes a public function OR 2) changes the signature
    of a public function, even if that change is in a CE file, double check that
    applying the patch for this PR to the ENT repo and running tests doesn't
    break any tests. Sometimes ENT only tests rely on public functions in CE
    files.
  • Jira: If this change has an associated Jira, it's referenced either
    in the PR description, commit message, or branch name.
  • RFC: If this change has an associated RFC, please link it in the description.
  • ENT PR: If this change has an associated ENT PR, please link it in the
    description. Also, make sure the changelog is in this PR, not in your ENT PR.

@lane-wetmore lane-wetmore self-assigned this Feb 19, 2025
@lane-wetmore lane-wetmore requested a review from a team as a code owner February 19, 2025 22:44
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Feb 19, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 19, 2025

Build Results:
All builds succeeded! ✅

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 19, 2025

CI Results:
All Go tests succeeded! ✅

@lane-wetmore lane-wetmore added this to the 1.20.0-rc milestone Feb 20, 2025
@lane-wetmore lane-wetmore requested a review from a team as a code owner February 20, 2025 17:30
@lane-wetmore lane-wetmore requested a review from mladlow February 20, 2025 17:30
Copy link
Copy Markdown
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Excellent PR description, thanks for including screenshots. 📸

I think this is nearly there! There is a bug when there's a linting error and the user toggles to the key/value view. The wrap data button is disabled and the linting errors get a little wonky. We also want to be consistent with the type for this.wrapData. I offered a couple suggestions of either initializing it as null or an {}. Let me know if you want to discuss more at all or have any questions 😄

@lane-wetmore lane-wetmore removed the request for review from mladlow February 24, 2025 18:41
Copy link
Copy Markdown
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! 👏 Just a small ember syntax fix and a couple test changes.

that contains
some seriously important config`;
const flashSpy = sinon.spy(this.owner.lookup('service:flash-messages'), 'success');
const updatedWrapData = JSON.stringify({
Copy link
Copy Markdown
Contributor

@hellobontempo hellobontempo Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to stringify? We can just compare the two objects below, right? (Instead of need to call JSON.parse() on 145)

Copy link
Copy Markdown
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my gosh - i didn't realize the end of the GIF said "REVERT" 🙈 I'm so sorry about that - removing!

@lane-wetmore lane-wetmore merged commit 13d302d into main Feb 25, 2025
33 checks passed
@lane-wetmore lane-wetmore deleted the ui/VAULT-33463-add-kv-view-in-wrap branch February 25, 2025 02:21
@Himura2la
Copy link
Copy Markdown

🤩 thank you!!

drivera258 pushed a commit that referenced this pull request Feb 25, 2025
* add kv view for wrap tool

* add changelog entry

* update toggle  and tests

* update changelog, style updates, fix linting error bug

* update tests

* update test to include multiline input

* clean up

* test improvements and clean up

* shift away from disabling button on error

* update test for json lint warning

* add check after back

* move assertions to a better test for them
hellobontempo pushed a commit that referenced this pull request May 21, 2025
* add kv view for wrap tool

* add changelog entry

* update toggle  and tests

* update changelog, style updates, fix linting error bug

* update tests

* update test to include multiline input

* clean up

* test improvements and clean up

* shift away from disabling button on error

* update test for json lint warning

* add check after back

* move assertions to a better test for them
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.

Wrap/Unwrap: Use the same GUI as in KV view to support multiline strings

3 participants