blob: 63ab420064445aec26583ef00c50776dc47cb5ee [file] [log] [blame]
Matteo Scandoloda19dff2016-02-08 16:55:44 -08001(function () {
2 'use strict';
3
4 angular.module('xos.serviceTopology')
5 .directive('diagnostic', function(){
6 return {
7 restrict: 'E',
8 templateUrl: 'templates/diagnostic.tpl.html',
9 controllerAs: 'vm',
10 controller: function(Subscribers, ServiceRelation){
Matteo Scandolo17dc11d2016-02-22 09:16:46 -080011 this.loader = true;
12 this.error = false;
Matteo Scandoloba2d63d2016-02-17 13:54:11 -080013 Subscribers.query().$promise
Matteo Scandoloda19dff2016-02-08 16:55:44 -080014 .then((subscribers) => {
15 this.subscribers = subscribers;
Matteo Scandolo657d1322016-02-16 17:43:00 -080016 return ServiceRelation.get();
Matteo Scandoloda19dff2016-02-08 16:55:44 -080017 })
18 .then((serviceChain) => {
19 this.serviceChain = serviceChain;
Matteo Scandolo17dc11d2016-02-22 09:16:46 -080020 })
21 .catch(e => {
22 throw new Error(e);
23 this.error = e;
24 })
25 .finally(() => {
26 this.loader = false;
Matteo Scandoloda19dff2016-02-08 16:55:44 -080027 });
28 }
29 }
30 });
31})();