Skip to content
Snippets Groups Projects
Commit 9dc90ebd authored by Mathis Neumann's avatar Mathis Neumann
Browse files

also render changes via UPDATE operations

parent d94d2e34
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,9 @@ export default Ember.Controller.extend({
init() {
this.debug('initializing controller');
},
// gets automatically updated when any of the instances changes (updated from changelog stream)
graphModel: Ember.computed(`model.instances.{${observables.join(',')}}.[]`, function() {
// gets automatically updated when any of the instances changes, changes are notified via a pseudo property 'updated'
// using @each will also listen if the array itself changes. Can be quite expensive.
graphModel: Ember.computed(`model.instances.{${observables.join(',')}}.@each._updated`, function() {
const systemId = this.get('model.systemId');
const instances = this.get('model.instances');
/*
......
import Ember from 'ember';
// TODO: update cytoscape instead of complete rerender
export default Ember.Service.extend({
store: Ember.inject.service(),
parse(changelogs) {
......@@ -21,7 +22,7 @@ export default Ember.Service.extend({
const normalized = store.normalize(data.type, data); // using application serializer
store.push(normalized);
},
UPDATE(changelog) { // FIXME: does not update view!
UPDATE(changelog) {
const data = changelog.data;
const oldRecord = this.get('store').peekRecord(data.type, data.id);
this.debug('oldRecord', oldRecord);
......@@ -29,6 +30,7 @@ export default Ember.Service.extend({
throw new Error(`old record for update operation not found! Id: ${data.id}`);
}
oldRecord.setProperties(data);
oldRecord.notifyPropertyChange('_updated'); // notify about pseudo property, can be listened on (see deployments/single controller)
},
DELETE(changelog) {
const data = changelog.data;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment