From f541224e028551159ed846eb1f51fb17e642710f Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Sat, 9 Jul 2016 15:09:05 +0200 Subject: [PATCH] simplify route data loading using Ember.RSVP.hash() --- app/routes/deployments/single.js | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/app/routes/deployments/single.js b/app/routes/deployments/single.js index 7ef6e2b..344ef5b 100644 --- a/app/routes/deployments/single.js +++ b/app/routes/deployments/single.js @@ -14,22 +14,14 @@ export default Ember.Route.extend({ const createGraph = graphingService.createGraph.bind(graphingService); this.set('loading', true); - return Ember.RSVP.Promise.all([ - this.store.findAll('node'), - this.store.findAll('nodegroup'), - this.store.findAll('service'), - this.store.findAll('serviceinstance'), - this.store.findAll('communication'), - this.store.findAll('communicationinstance') - ]).then(responses => { - return { - nodes: responses.get(0), - nodeGroups: responses.get(1), - services: responses.get(2), - serviceInstances: responses.get(3), - communications: responses.get(4), - communicationInstances: responses.get(5) - };}).then(createGraph).then((graph) => { + return Ember.RSVP.hash({ + nodes: this.store.findAll('node'), + nodeGroups: this.store.findAll('nodegroup'), + services: this.store.findAll('service'), + serviceInstances: this.store.findAll('serviceinstance'), + communications: this.store.findAll('communication'), + communicationInstances: this.store.findAll('communicationinstance') + }).then(createGraph).then((graph) => { this.set('loading', false); return graph; }); -- GitLab