37 lines
959 B
JavaScript
37 lines
959 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { set } from '@ember/object';
|
|
|
|
export default class FormStorageBucketComponent extends Component {
|
|
// =actions
|
|
|
|
@action
|
|
updateScope(event) {
|
|
const selectedScopeId = event.target.value;
|
|
const selectedScopeModel = this.args.scopes.find(
|
|
(element) => element.model.id === selectedScopeId
|
|
).model;
|
|
this.args.model.scopeModel = selectedScopeModel;
|
|
}
|
|
|
|
@action
|
|
rollbackSecretAttrs(currentAttr) {
|
|
const changedAttrs = this.args.model.changedAttributes();
|
|
if (currentAttr in changedAttrs) {
|
|
const [oldVal] = changedAttrs[currentAttr];
|
|
set(this.args.model, currentAttr, oldVal);
|
|
}
|
|
}
|
|
|
|
@action
|
|
toggleDisableCredentialRotation() {
|
|
this.args.model.disable_credential_rotation =
|
|
!this.args.model.disable_credential_rotation;
|
|
}
|
|
}
|