Skip to content
Snippets Groups Projects
Verified Commit e1f55ba0 authored by Alexander-Krause's avatar Alexander-Krause
Browse files

refactoring

parent 2dac9a62
No related branches found
No related tags found
No related merge requests found
......@@ -31,64 +31,20 @@ export default Component.extend(AlertifyHandler, {
// @Override
/**
* This overridden Ember Component lifecycle hook enables calling
* custom addon-related setup code on initial component setup
* It is only called once per component lifecycle and differs
* from didRender
*
* @method init
*/
init() {
this._super(...arguments);
const self = this;
console.log(this.get('initDone'));
this.get('agentRepo').on('updated', function(newAgentList) {
if(self.get('initDone')) {
self.updateCytoscapeGraph(newAgentList);
} else {
console.log("da");
// force re-render on initial list
self.set('showCytoscape', true);
}
});
// there already might be a list
// this occurs, when a user transitions
// to another route and comes back
//console.log(this.get('agentRepo.agentList'));
if(this.get('agentRepo.agentListAA.length') > 0) {
self.set('showCytoscape', true);
}
},
// @Override
/**
* This overridden Ember Component lifecycle hook enables calling
* custom addon-related setup code
* This overridden Ember Component lifecycle hook is used
* to render the actual cytoscapeGraph
*
* @method didRender
*/
didRender(){
this._super(...arguments);
console.log("didrender");
if(this.get('agentRepo.agentListAA.length') > 0 && !this.get('initDone') && this.get('showCytoscape')) {
console.log("hier");
if(!this.get('initDone') && this.get('agentRepo.agentList.length') > 0) {
this.initCytoscape();
this.setupListener();
this.set('initDone', true);
//this.rerender();
// manually call once, so there won't be
// a downtime until next update
this.updateCytoscapeGraph(this.get('agentRepo.agentListAA'));
}
}
this.updateCytoscapeGraph(this.get('agentRepo.agentList'));
},
......@@ -244,8 +200,6 @@ export default Component.extend(AlertifyHandler, {
updateCytoscapeGraph(newAgentList) {
console.log("update", newAgentList);
const cy = this.get('cytoscapeGraph');
const layout = this.get('cytoscapeLayout');
......
......@@ -43,8 +43,7 @@ export default Reload.extend(AlertifyHandler, {
//--------------inner functions--------------
function success(agentList){
self.debug("end agents-request");
console.log(agentList);
self.get('agentRepo').updateAgentList(agentList);
self.set('agentRepo.agentList', agentList);
}
function failure(e){
......
......@@ -10,18 +10,6 @@ import { observer } from '@ember/object';
*/
export default Service.extend(Evented, {
agentListAA: null,
observer: observer("agentListAA.procezzList.length", function(){
console.log("updated");
this.trigger("updated", this.get("agentListAA"));
}),
updateAgentList(test) {
//if(!this.isDestroyed) {
this.set('agentListAA', test);
//this.trigger("updated", this.get("agentListAA"));
//}
}
agentList: null
});
\ No newline at end of file
......@@ -13,7 +13,7 @@
{{else}}
{{#if showCytoscape}}
{{#if agentRepo.agentList}}
<div id="cy" class="container-fluid cytoscape-container"></div>
......
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