81f209d71e
Adds support for ACL Roles and Service Identities CRUD, along with necessary changes to Tokens, and the CSS improvements required. Also includes refinements/improvements for easier testing of deeply nested components. 1. ember-data adapter/serializer/model triplet for Roles 2. repository, form/validations and searching filter for Roles 3. Moves potentially, repeated, or soon to to repeated functionality into a mixin (mainly for 'many policy' relationships) 4. A few styling tweaks for little edge cases around roles 5. Router additions, Route, Controller and templates for Roles Also see: * UI: ACL Roles cont. plus Service Identities (#5661 and #5720)
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import Component from '@ember/component';
|
|
import SlotsMixin from 'block-slots';
|
|
import { inject as service } from '@ember/service';
|
|
import { get } from '@ember/object';
|
|
import { alias } from '@ember/object/computed';
|
|
import WithListeners from 'consul-ui/mixins/with-listeners';
|
|
// match anything that isn't a [ or ] into multiple groups
|
|
const propRe = /([^[\]])+/g;
|
|
export default Component.extend(WithListeners, SlotsMixin, {
|
|
onreset: function() {},
|
|
onchange: function() {},
|
|
onerror: function() {},
|
|
onsuccess: function() {},
|
|
|
|
data: alias('form.data'),
|
|
item: alias('form.data'),
|
|
// TODO: Could probably alias item
|
|
// or just use data/value instead
|
|
|
|
dom: service('dom'),
|
|
container: service('form'),
|
|
|
|
actions: {
|
|
change: function(e, value, item) {
|
|
let event = get(this, 'dom').normalizeEvent(e, value);
|
|
const matches = [...event.target.name.matchAll(propRe)];
|
|
const prop = matches[matches.length - 1][0];
|
|
event = get(this, 'dom').normalizeEvent(
|
|
`${get(this, 'type')}[${prop}]`,
|
|
event.target.value,
|
|
event.target
|
|
);
|
|
const form = get(this, 'form');
|
|
try {
|
|
form.handleEvent(event);
|
|
this.onchange({ target: this });
|
|
} catch (err) {
|
|
throw err;
|
|
}
|
|
},
|
|
},
|
|
});
|