| angular.module('xos.diagnostic') |
| .directive('diagnosticContainer', function(){ |
| templateUrl: 'templates/diagnostic.tpl.html', |
| controller: function(ChartData, Subscribers, ServiceRelation, $rootScope, $log){ |
| const loadGlobalScope = () => { |
| Subscribers.query().$promise |
| this.subscribers = subscribers; |
| return ServiceRelation.get(); |
| .then((serviceChain) => { |
| this.serviceChain = serviceChain; |
| // loadSubscriber(this.subscribers[0]); |
| this.reloadGlobalScope = () => { |
| this.selectedSubscriber = null; |
| const loadSubscriber = (subscriber) => { |
| ServiceRelation.getBySubscriber(subscriber) |
| .then((serviceChain) => { |
| this.serviceChain = serviceChain; |
| ChartData.currentServiceChain = serviceChain; |
| return Subscribers.getWithDevices({id: subscriber.id}).$promise; |
| this.selectedSubscriber = subscriber; |
| ChartData.currentSubscriber = subscriber; |
| $rootScope.$on('subscriber.selected', (evt, subscriber) => { |
| loadSubscriber(subscriber); |