John Cowen fce4311f55 ui: KV Form and List Components (#8307)
* Add components for KV form, KV list and Session form

* Pass through a @label attribute for a human label + don't require error

* Ignore transition aborted errors for if you are re-transitioning

* Make old confirmation dialog more ember-like and tagless

* Make sure data-source and data-sink supports KV and sessions

* Use new components and delete all the things

* Fix up tests

* Make list component tagless

* Add component pageobject and fixup tests from that

* Add eslint warning back in
2020-07-20 17:05:20 +00:00

23 lines
689 B
JavaScript

import Service, { inject as service } from '@ember/service';
import { setProperties } from '@ember/object';
export default Service.extend({
settings: service('settings'),
intention: service('repository/intention'),
kv: service('repository/kv'),
session: service('repository/session'),
prepare: function(sink, data, instance) {
return setProperties(instance, data);
},
persist: function(sink, instance) {
const [, , , model] = sink.split('/');
const repo = this[model];
return repo.persist(instance);
},
remove: function(sink, instance) {
const [, , , model] = sink.split('/');
const repo = this[model];
return repo.remove(instance);
},
});