2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
24 class KpiDashboardService {
25 constructor($q, $log, $http, conf, uuid) {
31 this.applicationsHomeUrl = 'kpidash';
35 let deferred = this.$q.defer();
36 this.$log.info('KpiDashboardService::kpiApiCall: '+ApiName);
39 url: this.conf.api[ApiName],
42 'X-ECOMP-RequestID':this.uuid.generate()
45 this.$log.debug("KpiDashboardService::kpiApiCall: response successfully retrieved");
46 if (Object.keys(res.data).length == 0) {
47 deferred.reject("KpiDashboardService::kpiApiCall: "+ ApiName+ " Failed");
49 deferred.resolve(res);
53 deferred.reject(status);
55 return deferred.promise;
58 getKpiUserStoriesStats(){
59 return this.kpiApiCall("getKpiDashUserStoriesStats");
62 return this.kpiApiCall("getKpiDashUserApiStats");
65 return this.kpiApiCall("getKpiDashLocStats");
68 return this.kpiApiCall("getKpiDashLocStatsCat");
70 getKpiServiceSupported(){
71 return this.kpiApiCall("getKpiDashServiceSupported");
73 getKpiPublishedDelivered(){
74 return this.kpiApiCall("getKpiDashPublishedDelivered");
77 return this.kpiApiCall("getKpiDashFeedStats");
80 return this.kpiApiCall("getKpiDashUserApis");
83 return this.kpiApiCall("getKpiDashGeoMapUrl");
86 return this.kpiApiCall("getKpiDashRCloudAUrl");
89 return this.kpiApiCall("getKpiDashGeoMapApiUrl");
96 url : this.applicationsHomeUrl,
97 state : 'root.kpidash_ECOMP'
99 return toplevelgTabs1;
102 getToplevelgTabs2() {
103 var toplevelgTabs2 = [ {
106 url : this.applicationsHomeUrl,
107 state : 'root.kpidash_AAI'
111 url : this.applicationsHomeUrl,
112 state : 'root.kpidash_APPC'
116 url : this.applicationsHomeUrl,
117 state : 'root.kpidash_ASDC'
121 url : this.applicationsHomeUrl,
122 state : 'root.kpidash_DCAE'
124 title : 'OpenECOMP Portal',
125 id : 'OpenECOMP Portal',
126 url : this.applicationsHomeUrl,
127 state : 'root.kpidash_ECOMP_Portal'
131 url : this.applicationsHomeUrl,
132 state : 'root.kpidash_InfrastructurePortal'
136 url : this.applicationsHomeUrl,
137 state : 'root.kpidash_MSO'
141 url : this.applicationsHomeUrl,
142 state : 'root.kpidash_Policy'
144 return toplevelgTabs2;
147 getToplevelgTabs3() {
148 var toplevelgTabs3 = [ {
149 title : 'Closed Loop',
151 url : this.applicationsHomeUrl,
152 state : 'root.kpidash_Closedloop'
156 url : this.applicationsHomeUrl,
157 state : 'root.kpidash_DMaaP'
159 return toplevelgTabs3;
162 getGenericTabs(activeTab) {
166 url : this.applicationsHomeUrl,
167 state : 'root.kpidash_'+activeTab+'_KPI'
169 title : 'User Defined KPI',
170 id : 'User Defined KPI',
171 url : this.applicationsHomeUrl,
172 state : 'root.kpidash_'+activeTab+'_UserDefinedKPI'
176 url : this.applicationsHomeUrl,
177 state : 'root.kpidash_'+activeTab+'_Metrics'
183 KpiDashboardService.$inject = ['$q', '$log', '$http', 'conf', 'uuid4'];
184 angular.module('ecompApp').service('KpiDashboardService', KpiDashboardService)