blob: 8a732a28ad2abd3b6297e511bca3645fdbf2aa1a [file] [log] [blame]
Matteo Scandolo83d0ee12016-05-06 16:52:58 -07001(function() {
2 'use strict';
3
4 /**
5 * @ngdoc service
6 * @name xos.helpers.ServiceGraph
7 * @description This factory define a set of helper function to query the service tenancy graph
8 **/
9
10 angular
11 .module('xos.helpers')
12 .service('GraphService', function($q, Tenants, Services) {
13
14 this.loadCoarseData = () => {
15
16 let services;
17
18 let deferred = $q.defer();
19
20 Services.query().$promise
21 .then((res) => {
22 services = res;
23 return Tenants.query({kind: 'coarse'}).$promise;
24 })
25 .then((tenants) => {
26 deferred.resolve({
27 tenants: tenants,
28 services: services
29 });
30 })
31
32 return deferred.promise;
33 }
34
35 this.getCoarseGraph = () => {
36 this.loadCoarseData()
37 .then((res) => {
38 console.log(res);
39 })
40 return 'ciao';
41 };
42
43 })
44})();