diff --git a/app/components/architecture-visualisation-cytoscape/style.js b/app/components/architecture-visualisation-cytoscape/style.js index 8427a750a2031c660031e968ceb29bc09da81c7c..4598bd7861dd2a6652454b9bef4385c2b5920d74 100644 --- a/app/components/architecture-visualisation-cytoscape/style.js +++ b/app/components/architecture-visualisation-cytoscape/style.js @@ -90,7 +90,13 @@ edge { font-weight: bold; target-arrow-shape: triangle-backcurve; curve-style: bezier; /* supports arrows */ +} +.warning { + background-color: yellow; +} +.fail { + background-color: red; } :selected { diff --git a/app/models/measurable.js b/app/models/measurable.js index a1ab382cf77e87fe3c93c04719afd196ba6f625e..d3dc7b972b4595bbaed55fe38946de898b53181d 100644 --- a/app/models/measurable.js +++ b/app/models/measurable.js @@ -3,7 +3,8 @@ import attr from 'ember-data/attr'; const Model = BaseEntity.extend({ timeSeries: attr(), - statusInformations: attr() + statusInformations: attr(), + status: attr('string') }); export default Model; diff --git a/app/models/serviceinstance.js b/app/models/serviceinstance.js index d0b2c9c57ed9bb19df84eb2601e5f9d4dbec9148..6039ee181c6c0672c27b4a30a1c214264fb074d6 100644 --- a/app/models/serviceinstance.js +++ b/app/models/serviceinstance.js @@ -17,6 +17,7 @@ Model.reopenClass({ "revisionNumber":0, "systemId":"system123", "name":"Inventory", + "status": "warning", "nodeId":"test-system123-node-2", "serviceId":"test-system123-service-4" }, diff --git a/app/services/graphing-service.js b/app/services/graphing-service.js index 0f51d099e74be8248f8ccfa81f3b1207fb95ffd9..60335c37367b6631ba254d44e57f201615fa9395 100644 --- a/app/services/graphing-service.js +++ b/app/services/graphing-service.js @@ -4,53 +4,68 @@ import Ember from 'ember'; * parses a list of models and creates stores them */ export default Ember.Service.extend({ + store: Ember.inject.service(), createGraph(models) { this.debug('loaded models', models); - const serviceInstances = models.serviceInstances; - // const services = models.services; // not used in current view - const communicationInstances = models.communicationInstances; - const nodeGroups = models.nodeGroups; - const nodes = models.nodes; + + // prepare models by serializing them + const prepared = {}; + [ + 'serviceInstances', + 'communicationInstances', + 'nodeGroups', + 'nodes' + ].forEach((key) => { + const records = models[key]; + prepared[key] = records.map(record => record.serialize()); + }); + + // services not used in current view + const {serviceInstances, communicationInstances, nodeGroups, nodes} = prepared; var network = { nodes: [], edges: [] }; - nodeGroups.forEach(instance => { - const data = instance.serialize(); + nodeGroups.forEach(data => { data.label = data.name; - network.nodes.push({ - data: data - });}); + network.nodes.push({ + data: data + }); + }); - nodes.forEach(instance => { - const data = instance.serialize(); + nodes.forEach(data => { data.label = data.name; data.parent = data.nodeGroupId; - network.nodes.push({ - data: data - });}); + network.nodes.push({ + data: data, + classes: data.status || '' + }); + }); - serviceInstances.forEach(instance => { - const data = instance.serialize(); + serviceInstances.forEach(data => { data.label = data.name; data.parent = data.nodeId; - network.nodes.push({ - data: data - });}); + network.nodes.push({ + data: data, + classes: data.status || '' + }); + }); - communicationInstances.forEach(instance => { - const data = instance.serialize(); + communicationInstances.forEach(data => { data.source = data.sourceId; data.target = data.targetId; - data.technology = instance.store.peekRecord('communication', data.communicationId).get('technology'); + data.technology = this.get('store').peekRecord('communication', data.communicationId).get('technology'); data.label = data.technology; - network.edges.push({ data }); + network.edges.push({ + data, + classes: data.status || '' + }); }); return network;