* refactor: 💡 desktop display of complex nested secrets A quick solution for displaying JSON secret objects in connection modal. ✅ Closes: ICU-7409 * refactor: 💡 refactor hidden-secret.js and test Guard against null for in `typeof` return. ✅ Closes: ICU-7409 * Update ui/desktop/app/styles/app.scss Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com> * refactor: 💡 test Changed test to check for secret output after clicking on reveal * refactor: 💡 fix style for hidden-secret and test Refactor hidden-secret span styling to have content centered and refactored testing for assert.dom instead of find Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
23 lines
586 B
JavaScript
23 lines
586 B
JavaScript
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;
|
|
|
|
get displaySecretValue() {
|
|
if (typeof this.args.secret === 'object' && this.args.secret !== null) {
|
|
return JSON.stringify(this.args.secret, null, 2);
|
|
} else {
|
|
return this.args.secret;
|
|
}
|
|
}
|
|
|
|
@action
|
|
toggleSecretVisibility() {
|
|
this.isHidden = !this.isHidden;
|
|
}
|
|
}
|