* [COMPLIANCE] Add Copyright and License Headers * chore: 🤖 update Copyright headers to satisfy our lint rules --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { action } from '@ember/object';
|
|
|
|
export default class FormFieldJsonSecretComponent extends Component {
|
|
// =properties
|
|
|
|
/**
|
|
* Tracks when editor should be displayed
|
|
* @type {boolean}
|
|
*/
|
|
@tracked editing = false;
|
|
|
|
/**
|
|
* True if viewing the resource after it has been created but not editing it
|
|
* and displays as a read only state. Since this is a secret editor the secret
|
|
* value is not displayed and a skeleton view is shown.
|
|
* @type {boolean}
|
|
*/
|
|
get isDisabled() {
|
|
return this.args.disabled;
|
|
}
|
|
|
|
/**
|
|
* True if editing the resource after it has been created but not editing
|
|
* the secret value in the Secret Editor. This will present the Secret
|
|
* Editor as a read only state even when the form is editing the resource.
|
|
* @type {boolean}
|
|
*/
|
|
get isActionable() {
|
|
return this.args.showEditButton && !this.editing;
|
|
}
|
|
|
|
// =actions
|
|
|
|
/**
|
|
* Sets editing to true when Secret Editor
|
|
* button is clicked in Actionable view
|
|
*/
|
|
@action
|
|
enableEditing() {
|
|
if (!this.args.disabled) this.editing = true;
|
|
}
|
|
}
|