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

UI: Allow repeat data wrapping for wrap tool #27289

Merged
merged 10 commits into from
Jun 4, 2024

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented May 30, 2024

before

After initially wrapping data, clicking "Back" and then "Wrap data" again results in the incorrect data being sent to the backend, so upon "unwrapping" we do not get {foo:"bar"} but instead {token:""}
wrap-before

after

Notice that now both generated tokens unwrapped the expected data
wrap-after

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label May 30, 2024
Copy link

github-actions bot commented May 30, 2024

CI Results:
All Go tests succeeded! ✅

@onClear={{action "onClear"}}
@codemirrorUpdated={{action "codemirrorUpdated"}}
@updateTtl={{action "updateTtl"}}
@buttonDisabled={{this.buttonDisabled}}
@errors={{this.errors}}
@data={{this.data}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

data down! ⬇️

@hellobontempo hellobontempo added this to the 1.15.9 milestone May 30, 2024
@@ -49,7 +43,6 @@ export default class ToolWrap extends Component {
codemirrorUpdated(val, codemirror) {
codemirror.performLint();
const hasErrors = codemirror?.state.lint.marked?.length > 0;
this.data = val;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead, pass to parent callback this.args.codemirrorUpdated which handles setting data as the codemirror value

import codemirror from 'vault/tests/helpers/codemirror';
import { TOOLS_SELECTORS as TS } from 'vault/tests/helpers/tools-selectors';

module('Integration | Component | tools/tool-wrap', function (hooks) {
Copy link
Contributor Author

@hellobontempo hellobontempo May 30, 2024

Choose a reason for hiding this comment

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

follow-on when glimmerizing is I'm planning to move all of the tool- components into a tools/ directory

@hellobontempo hellobontempo marked this pull request as ready for review May 30, 2024 23:38
@hellobontempo hellobontempo requested a review from a team as a code owner May 30, 2024 23:38
@@ -0,0 +1,3 @@
```release-note:improvement
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 marked this as improvement because I believe the json editor retaining the data is a regression from when we replaced partials with glimmerized child components here which made the component track the data whereas previously it was cleared and restored to all default values on back.

reset() {
if (this.isDestroyed || this.isDestroying) {
return;
}
setProperties(this, DEFAULTS);
},

However, based on the customer feedback repeatedly wrapping the same data is the desired behavior.

Copy link

Build Results:
All builds succeeded! ✅

@hellobontempo hellobontempo removed this from the 1.15.9 milestone May 31, 2024
@hellobontempo hellobontempo changed the title UI: Tools Wrap Data Allow repeat wrapping UI: Allow repeat wrapping for wrap tool May 31, 2024
@hellobontempo hellobontempo changed the title UI: Allow repeat wrapping for wrap tool UI: Allow repeat data wrapping for wrap tool May 31, 2024
@hellobontempo hellobontempo added this to the 1.15.10 milestone May 31, 2024
Copy link
Contributor

@andaley andaley left a comment

Choose a reason for hiding this comment

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

looks great, no notes. nice job tackling this bugfix and some cleanup at the same time!

@@ -13,8 +13,8 @@

{{#if @unwrap_data}}
<Hds::Tabs as |T|>
<T.Tab data-test-button-data>Data</T.Tab>
<T.Tab data-test-button-details>Wrap Details</T.Tab>
<T.Tab data-test-tab="data">Data</T.Tab>
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for all this cleanup 💅

@hellobontempo hellobontempo merged commit 1f64e6e into main Jun 4, 2024
31 of 32 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants