Merge pull request #637 from hashicorp/feature-toggle-secret
feat: 🎸 Add toggle secret feature
This commit is contained in:
5 files changed
+30
-3
No files matched your search
@@ -95,12 +95,14 @@
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.rose-table-header-cell {
|
||||
p {
|
||||
color: var(--ui-gray-subtler-1);
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.rose-form-checkbox {
|
||||
margin-bottom: 0;
|
||||
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
<div class='hidden-secret'>
|
||||
<Rose::Icon
|
||||
@name={{if this.isHidden 'visibility-show' 'visibility-hide'}}
|
||||
@size='medium'
|
||||
{{on 'click' this.toggleSecretVisibility}}
|
||||
/>
|
||||
<Copyable
|
||||
@text={{@secret}}
|
||||
@buttonText={{t 'actions.copy-to-clipboard'}}
|
||||
@acknowledgeText={{t 'states.copied'}}
|
||||
>
|
||||
<span>{{this.textMask}}</span>
|
||||
{{#if this.isHidden}}
|
||||
{{@secret}}
|
||||
{{else}}
|
||||
{{this.textMask}}
|
||||
{{/if}}
|
||||
</Copyable>
|
||||
</div>
|
||||
@@ -1,5 +1,14 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
|
||||
export default class HiddenSecretComponent extends Component {
|
||||
textMask = '■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■';
|
||||
|
||||
@tracked isHidden = false;
|
||||
|
||||
@action
|
||||
toggleSecretVisibility() {
|
||||
this.isHidden = !this.isHidden;
|
||||
}
|
||||
}
|
||||
@@ -480,6 +480,11 @@ $chevron-down: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231
|
||||
align-items: center;
|
||||
color: var(--ui-gray-subtler-2);
|
||||
|
||||
.rose-icon {
|
||||
margin-top: sizing.rems(xxxs);
|
||||
margin-right: sizing.rems(s);
|
||||
}
|
||||
|
||||
.copyable {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<Rose::Table @style='condensed' as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
<row.headerCell>{{t
|
||||
<row.headerCell @shrink={{true}}>{{t
|
||||
'form.key.label'
|
||||
}}</row.headerCell>
|
||||
<row.headerCell colspan='2'>{{t
|
||||
@@ -102,7 +102,9 @@
|
||||
<table.body as |body|>
|
||||
{{#each credential.secrets as |secret|}}
|
||||
<body.row as |row|>
|
||||
<row.headerCell>{{secret.key}}</row.headerCell>
|
||||
<row.headerCell
|
||||
@shrink={{true}}
|
||||
>{{secret.key}}</row.headerCell>
|
||||
<row.cell colspan='2'>
|
||||
<HiddenSecret @secret={{secret.value}} />
|
||||
</row.cell>
|
||||
|
||||
Reference in new issue
Block a user