Grant actions card (#3246)

* chore: 🤖 Add initial page layout for code editor + sidebar (#3180)

* chore: 🤖 Add initial page layout for code editor + sidebar

* test: 💍 add missing a11y ignores for exisitng color issue

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-18460

* Replace `Rose::CodeEditor` with `Hds::CodeEditor` (#2679)

* chore: 🤖 replace Rose::CodeEditor with Hds::CodeEditor

- Remove CodeEditor 5 dependency

* chore: 🤖 Replace CodeMirror5 dep

remove CodeMirror5 and replace existing editors with HDS::CodeEditor

* chore: 🤖 deleting old codeeditor styles

* feat: 🎸 changing code editor

changing code editor

✅ Closes: 0

* removed unused export

* pr cleanup

* updating tests for new code editor

* responding to PR feedback

* added whitespace

* fixing linting violations

* chore: 🤖 self-review PR

self-review PR in the course of switching to new HDS code editor

* fix: 🐛 fix linting bug

* fix: 🐛 unneeded dependency

remove jslint dependency as this is handled in the new code editor from
HDS

* fix: 🐛 Fixing import bug

Fix import bug caused by importing scss modules that no longer exist

* Fix and refactor code editor acceptance test

* Fix and refactor code editor acceptance test

* chore: 🤖 remove codemirror dependency

* refactor: 💡 fix merge conflict issues

* test: 💍 update e2e test selectors

* test: 💍 fix target spec click event

* refactor: 💡 clean up test selectors for code editor

* refactor: 💡 clean up storage bucket test selectors

* chore: 🤖 remove code mirror modifiers

---------

Co-authored-by: calcaide <ccorvo@hashicorp.com>
Co-authored-by: cameronperera <cameron.perera@hashicorp.com>

* feat: 🎸 Create string formats component (#3191)

* feat: 🎸 Create string formats component

* Add missing copyright headers

* fix: 🐛 change to readonly

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-18458

* feat: 🎸 add grant schema to mirage (#3196)

* feat: 🎸 add grant schema to mirage

* refactor: 💡 update grant schema mirage data

* refactor: 💡 fix route name in mirage

* feat: 🎸 add export options flyout (#3198)

* feat: 🎸 add export options flyout

* fix: 🐛 update id to be ids

* test: 💍 add a11y ignores

* test: 💍 fix tests for grant string format

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-18524

* feat: 🎸 Add autocompletion to code editor (#3207)

* feat: 🎸 create grant actions component

* feat: 🎸 add description to actions

* feat: 🎸 update default logic to not show all actions

* feat: 🎸 show invalid id and type message

* test: 💍 create const for test selectors

* feat: 🎸 trigger action suggestion when cursor moves

* refactor: 💡 add createGrantLineHelpers func

* refactor: 💡 small refactors

* feat: 🎸 Add CSP nonce to code editors (#3230)

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>

* refactor: 💡 small refactor

* test: 💍 add more tests

* refactor: 💡 fix merge conflicts issues

* refactor: 💡 updates from PR feedback

* refactor: 💡 updates for completions and linting

* test: 💍 fix test issue with translations

* test: 💍 fix test issue that was already fixed once

* refactor: 💡 address PR feedback

---------

Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>
Co-authored-by: Zack Moore <zack.moore@hashicorp.com>
Co-authored-by: calcaide <ccorvo@hashicorp.com>
Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
Co-authored-by: Bharath Gajjala <120367134+bgajjala8@users.noreply.github.com>
This commit is contained in:
authored and Zhihe Li committed 2026-05-14 15:21:29 -04:00
1 parent 1a8c895ea9
commit 08b8b03fed
12 files changed
+880 -29

No files matched your search

@@ -21,7 +21,6 @@
@hasFullScreenButton={{true}}
@ariaLabel={{t 'form.secret-editor.label'}}
@value={{this.grantStringsText}}
@onInput={{this.onInput}}
@onSetup={{this.onSetup}}
@customExtensions={{this.customExtensions}}
@cspNonce={{(csp-nonce)}}
@@ -68,6 +67,17 @@
<GrantStringFormats />
</:content>
</A.Item>
<A.Item @isOpen={{true}} @isStatic={{true}} data-test-grant-actions>
<:toggle>{{t 'titles.actions'}}</:toggle>
<:content>
<div class='grant-actions-scroll-container'>
<GrantActions
@grantsSchema={{@grantsSchema}}
@grantString={{this.currentLineText}}
/>
</div>
</:content>
</A.Item>
</Hds::Accordion>
</Hds::Layout::Grid>
@@ -11,6 +11,7 @@ import {
autocompletion,
completionKeymap,
keymap,
EditorView,
linter,
lintGutter,
lintKeymap,
@@ -172,6 +173,15 @@ export default class FormRoleEditGrantsComponent extends Component {
// Trigger autocompletion when the user completes a grant field (which we labeled as keywords)
activateOnCompletion: (completion) => completion.type === 'keyword',
}),
EditorView.updateListener.of((update) => {
if (update.docChanged || update.selectionSet) {
const line = update.state.doc.lineAt(update.state.selection.main.head);
this.currentLineText = line.text;
if (update.docChanged) {
this.grantStringsText = update.state.doc.toString();
}
}
}),
linter(this.linterSource),
lintGutter(),
keymap.of([...completionKeymap, ...lintKeymap]),
@@ -233,14 +243,6 @@ export default class FormRoleEditGrantsComponent extends Component {
this.#editorView = view;
}
@action
onInput(value, view) {
this.grantStringsText = value;
const line = view.state.doc.lineAt(view.state.selection.main.head);
this.currentLineText = line.text;
}
/**
* Toggles the export options flyout open and closed.
*/