From 018674a798cd5de325e302c2e457f1abd299d406 Mon Sep 17 00:00:00 2001 From: "Shannon Roberts (Beagin)" Date: Thu, 27 Feb 2025 10:42:07 -0800 Subject: [PATCH] [VAULT-33969] UI: replace readonly JsonEditor with Hds::CodeBlock (#29720) * http://localhost:4200/ui/vault/secrets/kubernetes/kubernetes/roles/test/details readOnly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/policies/acl/create readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/policy/acl/default readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/access/oidc/scopes/test/details readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/access/oidc/scopes/create readonly JsonEditor to Hds::CodeBlock * fix (some) tests * fix remaining tests * add changelog --- changelog/29720.txt | 3 +++ .../templates/components/oidc/scope-form.hbs | 2 +- .../access/oidc/scopes/scope/details.hbs | 13 +++++------- .../templates/vault/cluster/policy/show.hbs | 21 +++++++++++-------- .../core/addon/components/policy-example.hbs | 9 +------- .../addon/components/page/role/details.hbs | 13 +++++------- .../components/oidc/scope-form-test.js | 20 ++---------------- .../components/policy-example-test.js | 2 +- 8 files changed, 30 insertions(+), 53 deletions(-) create mode 100644 changelog/29720.txt diff --git a/changelog/29720.txt b/changelog/29720.txt new file mode 100644 index 0000000000..9748c332a3 --- /dev/null +++ b/changelog/29720.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Use Hds::CodeBlock component to replace readonly JsonEditor instances +``` \ No newline at end of file diff --git a/ui/app/templates/components/oidc/scope-form.hbs b/ui/app/templates/components/oidc/scope-form.hbs index 5d14013a2f..1e77ed17e8 100644 --- a/ui/app/templates/components/oidc/scope-form.hbs +++ b/ui/app/templates/components/oidc/scope-form.hbs @@ -82,7 +82,7 @@

Example of a JSON template for scopes:

- +

The full list of template parameters can be found diff --git a/ui/app/templates/vault/cluster/access/oidc/scopes/scope/details.hbs b/ui/app/templates/vault/cluster/access/oidc/scopes/scope/details.hbs index 343afaa83d..f4ad8f3c99 100644 --- a/ui/app/templates/vault/cluster/access/oidc/scopes/scope/details.hbs +++ b/ui/app/templates/vault/cluster/access/oidc/scopes/scope/details.hbs @@ -56,12 +56,9 @@

- + + + JSON Template + +
\ No newline at end of file diff --git a/ui/app/templates/vault/cluster/policy/show.hbs b/ui/app/templates/vault/cluster/policy/show.hbs index 4e5106108a..69a6319baa 100644 --- a/ui/app/templates/vault/cluster/policy/show.hbs +++ b/ui/app/templates/vault/cluster/policy/show.hbs @@ -46,15 +46,18 @@
-
- -
+ {{#if this.model.policy}} +
+ + + Policy + + + ({{if (eq this.policyType "acl") (concat this.uppercase this.model.format " format")}}) + + +
+ {{/if}} {{#if this.model.paths}}

Paths

diff --git a/ui/lib/core/addon/components/policy-example.hbs b/ui/lib/core/addon/components/policy-example.hbs index e57859fd6c..a63ecf13a1 100644 --- a/ui/lib/core/addon/components/policy-example.hbs +++ b/ui/lib/core/addon/components/policy-example.hbs @@ -54,14 +54,7 @@

{{/if}}
- +

More information about diff --git a/ui/lib/kubernetes/addon/components/page/role/details.hbs b/ui/lib/kubernetes/addon/components/page/role/details.hbs index 1693464733..0ce251acf0 100644 --- a/ui/lib/kubernetes/addon/components/page/role/details.hbs +++ b/ui/lib/kubernetes/addon/components/page/role/details.hbs @@ -52,14 +52,11 @@ {{#if @model.generatedRoleRules}}

Generated role rules

- + + + Role rules + +
{{/if}} diff --git a/ui/tests/integration/components/oidc/scope-form-test.js b/ui/tests/integration/components/oidc/scope-form-test.js index b14bfd8146..a2454434d1 100644 --- a/ui/tests/integration/components/oidc/scope-form-test.js +++ b/ui/tests/integration/components/oidc/scope-form-test.js @@ -155,16 +155,6 @@ module('Integration | Component | oidc/scope-form', function (hooks) { const MODAL = (e) => `[data-test-scope-modal="${e}"]`; this.model = this.store.createRecord('oidc/scope'); - // formatting here is purposeful so that it matches formatting in the template modal - const exampleTemplate = `{ - "username": {{identity.entity.aliases.$MOUNT_ACCESSOR.name}}, - "contact": { - "email": {{identity.entity.metadata.email}}, - "phone_number": {{identity.entity.metadata.phone_number}} - }, - "groups": {{identity.entity.groups.names}} -}`; - await render(hbs` `[data-test-example-modal-text=${type}]`, - jsonText: '[data-test-component="code-mirror-modifier"]', + jsonText: '.hds-code-block', informationLink: '[data-test-example-modal-information-link]', };