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

use lists for changelogs

parent 520bfd76
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,7 @@ export default Ember.Route.extend({
this.transitionTo(url);
},
willTransition(transition) {
this.debug('transition', transition.targetName, this.get('routeName'));
// do not disconnect if transitioning to a child route (details)
if (transition.targetName.indexOf(this.get('routeName')) !== 0) {
this.get('changelogStream').disconnect();
......
......@@ -2,9 +2,12 @@ import Ember from 'ember';
export default Ember.Service.extend({
store: Ember.inject.service(),
parse(changelog) {
parse(changelogs) {
this.debug('store', this.get('store'));
this.debug('parsing changelog', changelog);
this.debug('parsing changelogs', changelogs);
changelogs.forEach(this.parseSingle.bind(this));
},
parseSingle(changelog) {
const data = changelog.data;
const store = this.get('store');
const normalized = store.normalize('node', data); // using application serializer
......
......@@ -48,13 +48,13 @@ export default Ember.Service.extend({
this.debug('connection established');
},
onMessage(message) {
const changelogJson = message.data;
this.debug('new changelog received', changelogJson);
const changelogsJson = message.data;
this.debug('new changelog received', changelogsJson);
try {
const changelog = JSON.parse(changelogJson);
const changelog = JSON.parse(changelogsJson);
this.get('changelogParser').parse(changelog);
} catch (e) {
console.error('could not parse changelog json', e, changelogJson);
console.error('could not parse changelog json', e, changelogsJson);
}
}
}
......
......@@ -17,10 +17,8 @@ export default Ember.Service.extend({
edges: []
};
this.debug('loaded instances', serviceInstances);
nodeGroups.forEach(instance => {
const data = instance.toJSON({includeId: true});
const data = instance.serialize();
data.label = data.name;
network.nodes.push({
......@@ -28,7 +26,7 @@ export default Ember.Service.extend({
});});
nodes.forEach(instance => {
const data = instance.toJSON({includeId: true});
const data = instance.serialize();
data.label = data.name;
data.parent = data.nodeGroupId;
......@@ -37,7 +35,7 @@ export default Ember.Service.extend({
});});
serviceInstances.forEach(instance => {
const data = instance.toJSON({includeId: true});
const data = instance.serialize();
data.label = data.name;
data.parent = data.nodeId;
......@@ -46,16 +44,14 @@ export default Ember.Service.extend({
});});
communicationInstances.forEach(instance => {
const data = instance.toJSON({includeId: true});
const data = instance.serialize();
data.source = data.sourceId;
data.target = data.targetId;
data.technology = instance.store.peekRecord('communication', data.communicationId).get('technology');
data.label = data.technology;
this.debug('technology', data.technology);
network.edges.push({
data: data
});});
network.edges.push({ data });
});
return network;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment