Skip to content

Replace codemirror 6 code editor with HDS CodeEditor component#30188

Merged
lane-wetmore merged 37 commits into
mainfrom
zamoore/hds-4340/code-editor
Jul 23, 2025
Merged

Replace codemirror 6 code editor with HDS CodeEditor component#30188
lane-wetmore merged 37 commits into
mainfrom
zamoore/hds-4340/code-editor

Conversation

@zamoore
Copy link
Copy Markdown
Collaborator

@zamoore zamoore commented Apr 4, 2025

Description

This PR will update the use of the Code Mirror 5 code editor to the new Hds::CodeEditor
component.

This changes the internals of the JsonEditor component to use the Hds::CodeBlock component for readonly views and the new Hds::CodeEditor component for editing code.

Screenshots

Create/Edit Policy - ACL (also applies to RGP and EDL) Before: image After: image
Create/Edit Secret - Cubbyhole Before: image After: image
Wrap Data Before: image After: image
Sign Key - SSH Before: image After: image
Web REPL Before: image After: image
Control Group Success Before:
image
After:
image
OIDC - Create Scope Before: image After: image
Form field - KV - Create New Version (also applies to Patching) Before: image After: image

TODO

  • Add changelog

  • Screenshots for each instance and smoke test them.

  • Enterprise tests run on -server and on headless
    image
    (Current to latest test updates on 07/16)

  • Then get the version of this PR to a point where we can "easily" backport to 1.19.x. Only 1.19.x as that is LTS.

  • Once we backport, then do clean up PR that does not need to be backported. Specifically test clean up using selectors and newer patterns.

@github-actions github-actions Bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Apr 4, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2025

CI Results:
All Go tests succeeded! ✅

@zamoore zamoore force-pushed the zamoore/hds-4340/code-editor branch 2 times, most recently from c054a3c to c400092 Compare April 15, 2025 16:39
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We no longer prevent tab from changing focus within the editor as this behavior has accessibility concerns.

@zamoore zamoore force-pushed the zamoore/hds-4340/code-editor branch 2 times, most recently from d7ce5a6 to 3b16d45 Compare April 18, 2025 00:30
Comment thread ui/tests/integration/components/json-editor-test.js
@zamoore zamoore force-pushed the zamoore/hds-4340/code-editor branch from 0ddfaa9 to 746c217 Compare April 21, 2025 18:37
@zamoore zamoore changed the title Completed initial replacement of editor Replace codemirror 6 code editor with HDS CodeEditor component Apr 21, 2025
@zamoore zamoore force-pushed the zamoore/hds-4340/code-editor branch from fe8b386 to a5ebc41 Compare April 21, 2025 21:39
@Monkeychip Monkeychip modified the milestones: 1.20.0-rc, 1.19.3 Apr 22, 2025
@Monkeychip Monkeychip added the ui label Apr 22, 2025
@anwittin anwittin modified the milestones: 1.19.3, 1.19.4 Apr 29, 2025
@zamoore zamoore marked this pull request as ready for review April 29, 2025 16:16
@zamoore zamoore requested a review from a team as a code owner April 29, 2025 16:16
@zamoore zamoore marked this pull request as draft April 29, 2025 16:16
beagins
beagins previously approved these changes Jul 16, 2025
Copy link
Copy Markdown
Contributor

@beagins beagins left a comment

Choose a reason for hiding this comment

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

looks good to me! great work!! 🎉

@lane-wetmore lane-wetmore enabled auto-merge (squash) July 22, 2025 16:34
@lane-wetmore lane-wetmore requested a review from beagins July 22, 2025 16:34
Copy link
Copy Markdown
Contributor

@beagins beagins left a comment

Choose a reason for hiding this comment

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

Just one outstanding question, otherwise looks good! :)

await click(GENERAL.ttl.toggle('Automate secret deletion'));
await fillIn(GENERAL.selectByAttr('ttl-unit'), 's');
await fillIn(GENERAL.ttl.input('Automate secret deletion'), '1');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎉

Comment thread ui/tests/acceptance/tools-test.js Outdated
await click(GENERAL.submitButton);
await waitUntil(() => find('.CodeMirror'));
/* eslint-disable-next-line ember/no-settled-after-test-helper */
await settled();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe that we are trying to avoid await settled() where possible. I can see that waitUntil wasn't working for some reason, would using a assert.dom('.CodeMirror').exists(); instead work?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch! I think the await settled() might have been overkill. There is another waitUntil further down that seems to work just fine.

await click(SS.secretLink('1/2/3/'));
assert.dom('[data-test-component="navigate-input"]').hasValue('1/2/3/');
assert.dom('[data-test-secret-link]').exists({ count: 2 });
assert.dom(SS.secretLink()).exists({ count: 2 });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR is already big, so I wouldn't address this here - but it would be nice if we could replace all instances of the SECRET_ENGINE_SELECTORS (SS) with general selectors in a follow up pr.

@lane-wetmore lane-wetmore requested a review from beagins July 23, 2025 18:05
@lane-wetmore lane-wetmore merged commit e6ce95a into main Jul 23, 2025
32 checks passed
@lane-wetmore lane-wetmore deleted the zamoore/hds-4340/code-editor branch July 23, 2025 18:12
lane-wetmore added a commit that referenced this pull request Aug 4, 2025
* Completed initial replacement of editor

* fixing ts issues

* removing codemirror modifier and deps

* working on replacing the code editor

* addressing linting concerns

* cleaning up policy-form editor

* fixing linting issues

* fixing linting issues

* fixing tests

* fixing tests

* fixing tests

* fixing tests

* fixing failing tests

* cleaning up PR

* fixing tests

* remove outdated message for navigating editor

* fix linting in tests

* add changelog

* fix tests

* update naming

* remove unused lint param + name changes

* update test selector usage

* update test selector usage

* update test selector usage

* lint fixes

* replace page object selectors

* lint fix

* fix lint

* fix lint after merge

* update tests

* remove import

---------

Co-authored-by: Lane Wetmore <lane.wetmore@hashicorp.com>
lane-wetmore added a commit that referenced this pull request Aug 7, 2025
* Replace codemirror 6 code editor with HDS CodeEditor component (#30188)

* Completed initial replacement of editor

* fixing ts issues

* removing codemirror modifier and deps

* working on replacing the code editor

* addressing linting concerns

* cleaning up policy-form editor

* fixing linting issues

* fixing linting issues

* fixing tests

* fixing tests

* fixing tests

* fixing tests

* fixing failing tests

* cleaning up PR

* fixing tests

* remove outdated message for navigating editor

* fix linting in tests

* add changelog

* fix tests

* update naming

* remove unused lint param + name changes

* update test selector usage

* update test selector usage

* update test selector usage

* lint fixes

* replace page object selectors

* lint fix

* fix lint

* fix lint after merge

* update tests

* remove import

---------

Co-authored-by: Lane Wetmore <lane.wetmore@hashicorp.com>

* add import

* fix test selector mismatches

* lint fix

* fix timing issue

* lint

* lint + fix flake

---------

Co-authored-by: Zack Moore <zack.moore89@gmail.com>
Erfankam pushed a commit to Erfankam/vault that referenced this pull request Sep 1, 2025
…corp#30188)

* Completed initial replacement of editor

* fixing ts issues

* removing codemirror modifier and deps

* working on replacing the code editor

* addressing linting concerns

* cleaning up policy-form editor

* fixing linting issues

* fixing linting issues

* fixing tests

* fixing tests

* fixing tests

* fixing tests

* fixing failing tests

* cleaning up PR

* fixing tests

* remove outdated message for navigating editor

* fix linting in tests

* add changelog

* fix tests

* update naming

* remove unused lint param + name changes

* update test selector usage

* update test selector usage

* update test selector usage

* lint fixes

* replace page object selectors

* lint fix

* fix lint

* fix lint after merge

* update tests

* remove import

---------

Co-authored-by: Lane Wetmore <lane.wetmore@hashicorp.com>
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.

7 participants