* refactor: 💡 use secret input component for secret access key use new component and update test files ✅ Closes: ICU-8645 * Update ui/admin/app/components/form/storage-bucket/index.hbs Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * refactor: 💡 revise translation wording * style: 💄 fix linting space issue * refactor: 💡 only rollback changes for specific attribute * style: 💄 change button text color in dark mode for a11yAudit * refactor: 💡 add function to cancel changes to secrets * Update ui/admin/app/components/form/storage-bucket/index.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
31 lines
804 B
JavaScript
31 lines
804 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);
|
|
}
|
|
}
|
|
}
|