From 14f9635af44e322ab99c9e3c271ff58d58e94ef2 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 24 Jun 2021 12:06:25 -0700 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Add=20hidden=20secr?= =?UTF-8?q?et=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add first iteration of hidden secret component. --- addons/api/mirage/scenarios/ipc.js | 46 ++++++++++--------- addons/core/translations/resources/en-us.yaml | 1 + .../app/components/hidden-secret/index.hbs | 11 +++++ ui/desktop/app/styles/app.scss | 11 +++++ .../scopes/scope/projects/targets.hbs | 6 ++- .../components/hidden-secret-test.js | 21 +++++++++ 6 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 ui/desktop/app/components/hidden-secret/index.hbs create mode 100644 ui/desktop/tests/integration/components/hidden-secret-test.js diff --git a/addons/api/mirage/scenarios/ipc.js b/addons/api/mirage/scenarios/ipc.js index 0920fd963..729b9fa25 100644 --- a/addons/api/mirage/scenarios/ipc.js +++ b/addons/api/mirage/scenarios/ipc.js @@ -65,10 +65,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -76,16 +76,18 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'ingress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, { credential_library: { @@ -93,10 +95,10 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'application', - secret: btoa('just-a-random-string') + secret: btoa('just-a-random-string'), }, { credential_library: { @@ -104,18 +106,20 @@ export default function initializeMockIPC(server) { name: 'Library Name', description: 'Library Description', credential_store_id: 'csvlt_Q1HFGt7Jpm', - type: 'vault' + type: 'vault', }, purpose: 'egress', - secret: btoa(JSON.stringify({ - key1: 'value 1', - key2: true, - key3: { - description: 'nested values' - } - })) + secret: btoa( + JSON.stringify({ + key1: 'value 1', + key2: true, + key3: { + description: 'nested values', + }, + }) + ), }, - ] + ], }; } diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index fc4fa2c65..c5f48f0c8 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -261,3 +261,4 @@ target: add: title: Add Host Sets description: Select host sets to assign to this target. + secret: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ diff --git a/ui/desktop/app/components/hidden-secret/index.hbs b/ui/desktop/app/components/hidden-secret/index.hbs new file mode 100644 index 000000000..6bdd9972e --- /dev/null +++ b/ui/desktop/app/components/hidden-secret/index.hbs @@ -0,0 +1,11 @@ +
+ {{! TODO: The span wrap within a div because later we will add the toggle secret icon/button}} +
+ {{t 'resources.target.host-set.secret'}} +
+ +
\ No newline at end of file diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index 4abf9c368..a35ab2cb9 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -452,3 +452,14 @@ $chevron-down: url("data:image/svg+xml;utf-8, + ttl @@ -116,4 +118,4 @@ {{/each}} {{/each}} -{{outlet}} +{{outlet}} \ No newline at end of file diff --git a/ui/desktop/tests/integration/components/hidden-secret-test.js b/ui/desktop/tests/integration/components/hidden-secret-test.js new file mode 100644 index 000000000..87e33a329 --- /dev/null +++ b/ui/desktop/tests/integration/components/hidden-secret-test.js @@ -0,0 +1,21 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render, find } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | hidden-secret', function (hooks) { + setupRenderingTest(hooks); + + test('it renders with a secret', async function (assert) { + assert.expect(2); + await render(hbs` + + `); + + assert.ok(find('.hidden-secret')); + assert.equal( + find('.hidden-secret > div > span').textContent.trim(), + '■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■' + ); + }); +}); From 4daa09ca7b496a7dd5a76fcbf2187c8f5d466739 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 24 Jun 2021 12:15:34 -0700 Subject: [PATCH 2/2] Revert "Comment code with plain strings" This reverts commit a83e6af6de52e6e87e304a3e96ba69be2d1e87f8. --- ui/desktop/app/templates/scopes/scope/projects/targets.hbs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs index d62990141..6f146c374 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/targets.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/targets.hbs @@ -1,3 +1,5 @@ +{{! template-lint-disable no-bare-strings }} + {{page-title (t 'resources.target.title_plural')}} {{#each @model as |target|}} @@ -36,7 +38,7 @@ {{! TODO: Conditional for when credentials aren't available older versions of cli }}

{{t 'resources.session.credential.title_plural'}}

- {{!-- @@ -100,7 +102,7 @@ - --}} + <:footer>