chore: 🤖 Add hidden secret component

Add first iteration of hidden secret component.
This commit is contained in:
Carlos Alcaide committed 2021-06-24 12:06:25 -07:00
1 parent 295d236b35
commit 14f9635af4
6 files changed
+73 -23

No files matched your search

+25 -21
View File
@@ -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',
},
})
),
},
]
],
};
}
@@ -261,3 +261,4 @@ target:
add:
title: Add Host Sets
description: Select host sets to assign to this target.
secret: ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
@@ -0,0 +1,11 @@
<div class='hidden-secret'>
{{! TODO: The span wrap within a div because later we will add the toggle secret icon/button}}
<div>
<span>{{t 'resources.target.host-set.secret'}}</span>
</div>
<Copyable
@text={{@secret}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
/>
</div>
+11
View File
@@ -452,3 +452,14 @@ $chevron-down: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231
padding: sizing.rems(s);
}
}
.hidden-secret {
display: flex;
align-items: center;
justify-content: space-between;
color: var(--ui-gray-subtler-2);
.rose-button-ghost {
color: var(--ui-gray-subtler-1);
}
}
@@ -76,7 +76,9 @@
<table.body as |body|>
<body.row as |row|>
<row.headerCell>foo</row.headerCell>
<row.cell>Value</row.cell>
<row.cell>
<HiddenSecret @secret='AAaaBBccDDeeOTXzSMT1234BB_Z8JzG7JkSVxI' />
</row.cell>
</body.row>
<body.row as |row|>
<row.headerCell>ttl</row.headerCell>
@@ -116,4 +118,4 @@
{{/each}}
{{/each}}
{{outlet}}
{{outlet}}
@@ -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`
<HiddenSecret @secret='AAaaBBccDDeeOTXzSMT1234BB_Z8JzG7JkSVxI' />
`);
assert.ok(find('.hidden-secret'));
assert.equal(
find('.hidden-secret > div > span').textContent.trim(),
'■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■'
);
});
});