open-vault/ui/lib/kmip/addon/components/edit-form-kmip-role.js
Matthew Irish b0dfbde741
UI kmip scope delete and role form (#7169)
* always use ?force for kmip scope delete

* update the delete message when deleting a scope

* support disabling and not showing help text for checkboxes

* group TLS fields and render new allowed operations widget

* add operation-field-display component for kmip roles

* use operation-field-display component

* switch glyph for false value in info-table-row

* divvy up roles and tls

* fix JSDoc - showHelpText defaults to true

* fix tests and linting

* rename vars in operation-field-display component

* make the action name clearer re: what it's actually doing

* align the allowed-ops header

* show all operations as checked if you check to allow all
2019-07-23 16:00:00 -05:00

39 lines
1.1 KiB
JavaScript

import EditForm from 'core/components/edit-form';
import layout from '../templates/components/edit-form-kmip-role';
export default EditForm.extend({
layout,
model: null,
init() {
this._super(...arguments);
if (this.model.isNew) {
this.model.set('operationAll', true);
}
},
actions: {
toggleOperationSpecial(checked) {
this.model.set('operationNone', !checked);
this.model.set('operationAll', checked);
},
// when operationAll is true, we want all of the items
// to appear checked, but we don't want to override what items
// a user has selected - so this action creates an object that we
// pass to the FormField component as the model instead of the real model
placeholderOrModel(isOperationAll, attr) {
return isOperationAll ? { [attr.name]: true } : this.model;
},
preSave(model) {
// if we have operationAll or operationNone, we want to clear
// out the others so that display shows the right data
if (model.operationAll || model.operationNone) {
model.operationFieldsWithoutSpecial.forEach(field => model.set(field, null));
}
},
},
});