blob: 63bf71d3dcf79e087af49524632aee3f85327dfc [file] [log] [blame]
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001/**
2 * API utilities service
3 *
4 * @module app/common/services/api-utils
5 * @exports APIUtils
6 * @name APIUtils
7 * @version 0.0.1
8 */
9
10window.angular && (function (angular) {
11 'use strict';
12 angular
13 .module('app.common.services')
Iftekharul Islam1acb4122017-11-02 13:20:32 -050014 .factory('APIUtils', ['$http', 'Constants', '$q', 'dataService',function($http, Constants, $q, DataService){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050015 var SERVICE = {
16 LOGIN_CREDENTIALS: Constants.LOGIN_CREDENTIALS,
17 API_CREDENTIALS: Constants.API_CREDENTIALS,
18 API_RESPONSE: Constants.API_RESPONSE,
19 CHASSIS_POWER_STATE: Constants.CHASSIS_POWER_STATE,
20 HOST_STATE_TEXT: Constants.HOST_STATE,
21 HOST_STATE: Constants.HOST_STATE,
Iftekharul Islamcd789502017-04-19 14:37:55 -050022 LED_STATE: Constants.LED_STATE,
23 LED_STATE_TEXT: Constants.LED_STATE_TEXT,
Iftekharul Islam1acb4122017-11-02 13:20:32 -050024 HOST_SESSION_STORAGE_KEY: Constants.API_CREDENTIALS.host_storage_key,
Iftekharul Islam99d199f2017-03-24 15:28:25 -050025 getChassisState: function(callback){
26 $http({
27 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -050028 url: DataService.getHost() + "/xyz/openbmc_project/state/chassis0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -050029 headers: {
30 'Accept': 'application/json',
31 'Content-Type': 'application/json'
32 },
33 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -070034 }).then(function(response){
35 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050036 var content = JSON.parse(json);
37 callback(content.data.CurrentPowerState);
Ed Tanousbbcf6702017-10-06 13:53:06 -070038 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050039 console.log(error);
40 });
41 },
42 getHostState: function(callback){
43 $http({
44 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -050045 url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -050046 headers: {
47 'Accept': 'application/json',
48 'Content-Type': 'application/json'
49 },
50 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -070051 }).then(function(response){
52 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -050053 var content = JSON.parse(json);
54 callback(content.data.CurrentHostState);
Ed Tanousbbcf6702017-10-06 13:53:06 -070055 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -050056 console.log(error);
57 });
58 },
Iftekharul Islam171c6a12017-08-11 08:35:47 -050059 getNetworkInfo: function(){
60 var deferred = $q.defer();
61 $http({
62 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -050063 url: DataService.getHost() + "/xyz/openbmc_project/network/enumerate",
Iftekharul Islam171c6a12017-08-11 08:35:47 -050064 headers: {
65 'Accept': 'application/json',
66 'Content-Type': 'application/json'
67 },
68 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -070069 }).then(function(response){
70 var json = JSON.stringify(response.data);
Iftekharul Islam171c6a12017-08-11 08:35:47 -050071 var content = JSON.parse(json);
72 var hostname = "";
73 var macAddress = "";
74
Iftekharul Islam2a489552017-11-02 13:23:08 -050075 function parseNetworkData(content){
76 var data = {
77 interface_ids: [],
78 interfaces: {
79 }
80 };
81 var interfaceId = '', keyParts = [], interfaceHash = '', interfaceType = '';
82 for(var key in content.data){
83 if(key.match(/network\/eth\d+$/ig)){
84 interfaceId = key.split("/").pop();
85 if(data.interface_ids.indexOf(interfaceId) == -1){
86 data.interface_ids.push(interfaceId);
87 data.interfaces[interfaceId] = {
88 interfaceIname: '',
89 domainName:'',
90 MACAddress:'',
91 Nameservers: [],
92 DHCPEnabled: 0,
93 ipv4:
94 {
95 ids: [],
96 values: []
97 },
98 ipv6:
99 {
100 ids: [],
101 values: []
102 }
103 };
104 data.interfaces[interfaceId].MACAddress = content.data[key].MACAddress;
105 data.interfaces[interfaceId].DomainName = content.data[key].DomainName.join(" ");
106 data.interfaces[interfaceId].Nameservers = content.data[key].Nameservers;
107 data.interfaces[interfaceId].DHCPEnabled = content.data[key].DHCPEnabled;
108 }
109 }else if(key.match(/network\/eth\d+\/ipv[4|6]\/[a-z0-9]+$/ig)){
110 keyParts = key.split("/");
111 interfaceHash = keyParts.pop();
112 interfaceType = keyParts.pop();
113 interfaceId = keyParts.pop();
114
115 if(data.interfaces[interfaceId][interfaceType].ids.indexOf(interfaceHash) == -1){
116 data.interfaces[interfaceId][interfaceType].ids.push(interfaceHash);
117 data.interfaces[interfaceId][interfaceType].values.push(content.data[key]);
118 }
119 }
120 }
121 return data;
122 }
123
Iftekharul Islam171c6a12017-08-11 08:35:47 -0500124 if(content.data.hasOwnProperty('/xyz/openbmc_project/network/config') &&
125 content.data['/xyz/openbmc_project/network/config'].hasOwnProperty('HostName')
126 ){
127 hostname = content.data['/xyz/openbmc_project/network/config'].HostName;
128 }
129
130 if(content.data.hasOwnProperty('/xyz/openbmc_project/network/eth0') &&
131 content.data['/xyz/openbmc_project/network/eth0'].hasOwnProperty('MACAddress')
132 ){
133 macAddress = content.data['/xyz/openbmc_project/network/eth0'].MACAddress;
134 }
135
136 deferred.resolve({
137 data: content.data,
138 hostname: hostname,
139 mac_address: macAddress,
Iftekharul Islam2a489552017-11-02 13:23:08 -0500140 formatted_data: parseNetworkData(content)
Iftekharul Islam171c6a12017-08-11 08:35:47 -0500141 });
Ed Tanousbbcf6702017-10-06 13:53:06 -0700142 }, function(error){
Iftekharul Islam171c6a12017-08-11 08:35:47 -0500143 console.log(error);
144 deferred.reject(error);
145 });
146 return deferred.promise;
147 },
Michael Davisdf3bd122017-08-10 11:03:42 -0500148 getLEDState: function(){
149 var deferred = $q.defer();
Iftekharul Islamcd789502017-04-19 14:37:55 -0500150 $http({
151 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500152 url: DataService.getHost() + "/xyz/openbmc_project/led/groups/enclosure_identify",
Iftekharul Islamcd789502017-04-19 14:37:55 -0500153 headers: {
154 'Accept': 'application/json',
155 'Content-Type': 'application/json'
156 },
157 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700158 }).then(function(response){
159 var json = JSON.stringify(response.data);
Michael Davisdf3bd122017-08-10 11:03:42 -0500160 var content = JSON.parse(json);
161 deferred.resolve(content.data.Asserted);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700162 }, function(error){
Iftekharul Islamcd789502017-04-19 14:37:55 -0500163 console.log(error);
Michael Davisdf3bd122017-08-10 11:03:42 -0500164 deferred.reject(error);
Iftekharul Islamcd789502017-04-19 14:37:55 -0500165 });
Michael Davisdf3bd122017-08-10 11:03:42 -0500166 return deferred.promise;
Iftekharul Islamcd789502017-04-19 14:37:55 -0500167 },
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500168 login: function(username, password, callback){
169 $http({
170 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500171 url: DataService.getHost() + "/login",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500172 headers: {
173 'Accept': 'application/json',
174 'Content-Type': 'application/json'
175 },
176 withCredentials: true,
177 data: JSON.stringify({"data": [username, password]})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700178 }).then(function(response){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500179 if(callback){
Ed Tanousbbcf6702017-10-06 13:53:06 -0700180 callback(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500181 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700182 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500183 if(callback){
Iftekharul Islamcd789502017-04-19 14:37:55 -0500184 if(error && error.status && error.status == 'error'){
185 callback(error);
186 }else{
187 callback(error, true);
188 }
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500189 }
190 console.log(error);
191 });
192 },
193 logout: function(callback){
194 $http({
195 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500196 url: DataService.getHost() + "/logout",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500197 headers: {
198 'Accept': 'application/json',
199 'Content-Type': 'application/json'
200 },
201 withCredentials: true,
202 data: JSON.stringify({"data": []})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700203 }).then(function(response){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500204 if(callback){
Iftekharul Islamde883402018-02-05 11:16:21 -0600205 callback(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500206 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700207 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500208 if(callback){
209 callback(null, error);
210 }
211 console.log(error);
212 });
213 },
214 chassisPowerOn: function(callback){
215 $http({
216 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500217 url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500218 headers: {
219 'Accept': 'application/json',
220 'Content-Type': 'application/json'
221 },
222 withCredentials: true,
223 data: JSON.stringify({"data": []})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700224 }).then(function(response){
225 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500226 var content = JSON.parse(json);
227 if(callback){
228 return callback(content.data.CurrentPowerState);
229 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700230 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500231 if(callback){
232 callback(error);
233 }else{
234 console.log(error);
235 }
236 });
237 },
238 chassisPowerOff: function(callback){
239 $http({
240 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500241 url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500242 headers: {
243 'Accept': 'application/json',
244 'Content-Type': 'application/json'
245 },
246 withCredentials: true,
247 data: JSON.stringify({"data": []})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700248 }).then(function(response){
249 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500250 var content = JSON.parse(json);
251 if(callback){
252 return callback(content.data.CurrentPowerState);
253 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700254 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500255 if(callback){
256 callback(error);
257 }else{
258 console.log(error);
259 }
260 });
261 },
Iftekharul Islamcd789502017-04-19 14:37:55 -0500262 setLEDState: function(state, callback){
263 $http({
264 method: 'PUT',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500265 url: DataService.getHost() + "/xyz/openbmc_project/led/groups/enclosure_identify/attr/Asserted",
Iftekharul Islamcd789502017-04-19 14:37:55 -0500266 headers: {
267 'Accept': 'application/json',
268 'Content-Type': 'application/json'
269 },
270 withCredentials: true,
271 data: JSON.stringify({"data": state})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700272 }).then(function(response){
273 var json = JSON.stringify(response.data);
Iftekharul Islamcd789502017-04-19 14:37:55 -0500274 var content = JSON.parse(json);
275 if(callback){
276 return callback(content.status);
277 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700278 }, function(error){
Iftekharul Islamcd789502017-04-19 14:37:55 -0500279 if(callback){
280 callback(error);
281 }else{
282 console.log(error);
283 }
284 });
285 },
Iftekharul Islam55368122017-03-27 09:46:50 -0500286 bmcReboot: function(callback){
287 $http({
288 method: 'PUT',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500289 url: DataService.getHost() + "/xyz/openbmc_project/state/bmc0/attr/RequestedBmcTransition",
Iftekharul Islam55368122017-03-27 09:46:50 -0500290 headers: {
291 'Accept': 'application/json',
292 'Content-Type': 'application/json'
293 },
294 withCredentials: true,
295 data: JSON.stringify({"data": "xyz.openbmc_project.State.BMC.Transition.Reboot"})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700296 }).then(function(response){
297 var json = JSON.stringify(response.data);
Iftekharul Islam55368122017-03-27 09:46:50 -0500298 var content = JSON.parse(json);
299 if(callback){
300 return callback(content.status);
301 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700302 }, function(error){
Iftekharul Islam55368122017-03-27 09:46:50 -0500303 if(callback){
304 callback(error);
305 }else{
306 console.log(error);
307 }
308 });
309 },
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500310 hostPowerOn: function(callback){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500311 $http({
312 method: 'PUT',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500313 url: DataService.getHost() + "/xyz/openbmc_project/state/host0/attr/RequestedHostTransition",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500314 headers: {
315 'Accept': 'application/json',
316 'Content-Type': 'application/json'
317 },
318 withCredentials: true,
319 data: JSON.stringify({"data": "xyz.openbmc_project.State.Host.Transition.On"})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700320 }).then(function(response){
321 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500322 var content = JSON.parse(json);
323 if(callback){
324 return callback(content.status);
325 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700326 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500327 if(callback){
328 callback(error);
329 }else{
330 console.log(error);
331 }
332 });
333 },
334 hostPowerOff: function(callback){
335 $http({
336 method: 'PUT',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500337 url: DataService.getHost() + "/xyz/openbmc_project/state/host0/attr/RequestedHostTransition",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500338 headers: {
339 'Accept': 'application/json',
340 'Content-Type': 'application/json'
341 },
342 withCredentials: true,
343 data: JSON.stringify({"data": "xyz.openbmc_project.State.Host.Transition.Off"})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700344 }).then(function(response){
345 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500346 var content = JSON.parse(json);
347 if(callback){
348 return callback(content.status);
349 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700350 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500351 if(callback){
352 callback(error);
353 }else{
354 console.log(error);
355 }
356 });
357 },
358 hostReboot: function(callback){
359 $http({
360 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500361 url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500362 headers: {
363 'Accept': 'application/json',
364 'Content-Type': 'application/json'
365 },
366 withCredentials: true,
367 data: JSON.stringify({"data": []}),
Ed Tanousbbcf6702017-10-06 13:53:06 -0700368 }).then(function(response){
369 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500370 var content = JSON.parse(json);
371 if(callback){
372 return callback(content);
373 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700374 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500375 if(callback){
376 callback(error);
377 }else{
378 console.log(error);
379 }
380 });
381 },
382 hostShutdown: function(callback){
383 $http({
384 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500385 url: DataService.getHost() + "/xyz/openbmc_project/state/host0",
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500386 headers: {
387 'Accept': 'application/json',
388 'Content-Type': 'application/json'
389 },
390 withCredentials: true,
391 data: JSON.stringify({"data": []})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700392 }).then(function(response){
393 var json = JSON.stringify(response.data);
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500394 var content = JSON.parse(json);
395 if(callback){
396 return callback(content);
397 }
Ed Tanousbbcf6702017-10-06 13:53:06 -0700398 }, function(error){
Iftekharul Islam99d199f2017-03-24 15:28:25 -0500399 if(callback){
400 callback(error);
401 }else{
402 console.log(error);
403 }
404 });
Iftekharul Islamcd789502017-04-19 14:37:55 -0500405 },
Michael Davisdf3bd122017-08-10 11:03:42 -0500406 getLogs: function(){
407 var deferred = $q.defer();
Iftekharul Islamcd789502017-04-19 14:37:55 -0500408 $http({
409 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500410 url: DataService.getHost() + "/xyz/openbmc_project/logging/enumerate",
Iftekharul Islamcd789502017-04-19 14:37:55 -0500411 headers: {
412 'Accept': 'application/json',
413 'Content-Type': 'application/json'
414 },
415 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700416 }).then(function(response){
417 var json = JSON.stringify(response.data);
Iftekharul Islamcd789502017-04-19 14:37:55 -0500418 var content = JSON.parse(json);
419 var dataClone = JSON.parse(JSON.stringify(content.data));
420 var data = [];
421 var severityCode = '';
422 var priority = '';
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500423 var health = '';
Iftekharul Islamcd789502017-04-19 14:37:55 -0500424 var relatedItems = [];
425
426 for(var key in content.data){
427 if(content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Id')){
428 var severityFlags = {low: false, medium: false, high: false};
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500429 var healthFlags = {critical: false, warning: false, good: false};
Iftekharul Islamcd789502017-04-19 14:37:55 -0500430 severityCode = content.data[key].Severity.split(".").pop();
431 priority = Constants.SEVERITY_TO_PRIORITY_MAP[severityCode];
432 severityFlags[priority.toLowerCase()] = true;
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500433 health = Constants.SEVERITY_TO_HEALTH_MAP[severityCode];
434 healthFlags[health.toLowerCase()] = true;
Iftekharul Islamcd789502017-04-19 14:37:55 -0500435 relatedItems = [];
436 content.data[key].associations.forEach(function(item){
Iftekharul Islam532763f2017-04-25 09:44:40 -0500437 relatedItems.push(item[2]);
Iftekharul Islamcd789502017-04-19 14:37:55 -0500438 });
439
440 data.push(Object.assign({
441 path: key,
442 copied: false,
443 priority: priority,
444 severity_code: severityCode,
445 severity_flags: severityFlags,
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500446 health_flags: healthFlags,
Iftekharul Islamcd789502017-04-19 14:37:55 -0500447 additional_data: content.data[key].AdditionalData.join("\n"),
448 selected: false,
Iftekharul Islam8b4828a2017-04-19 14:37:55 -0500449 search_text: ("#" + content.data[key].Id + " " + severityCode + " " + content.data[key].Severity + " " + content.data[key].AdditionalData.join(" ")).toLowerCase(),
Iftekharul Islamcd789502017-04-19 14:37:55 -0500450 meta: false,
451 confirm: false,
452 related_items: relatedItems,
453 data: {key: key, value: content.data[key]}
454 }, content.data[key]));
455 }
456 }
Michael Davisdf3bd122017-08-10 11:03:42 -0500457 deferred.resolve({data: data, original: dataClone});
Ed Tanousbbcf6702017-10-06 13:53:06 -0700458 }, function(error){
Iftekharul Islamcd789502017-04-19 14:37:55 -0500459 console.log(error);
Michael Davisdf3bd122017-08-10 11:03:42 -0500460 deferred.reject(error);
Iftekharul Islamcd789502017-04-19 14:37:55 -0500461 });
Michael Davisdf3bd122017-08-10 11:03:42 -0500462
463 return deferred.promise;
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500464 },
465 getAllSensorStatus: function(callback){
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500466 $http({
467 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500468 url: DataService.getHost() + "/xyz/openbmc_project/sensors/enumerate",
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500469 headers: {
470 'Accept': 'application/json',
471 'Content-Type': 'application/json'
472 },
473 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700474 }).then(function(response){
475 var json = JSON.stringify(response.data);
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500476 var content = JSON.parse(json);
477 var dataClone = JSON.parse(JSON.stringify(content.data));
478 var sensorData = [];
Iftekharul Islam8947e702017-07-27 10:28:07 -0500479 var severity = {};
480 var title = "";
481 var tempKeyParts = [];
482 var order = 0;
Iftekharul Islam8a122842017-09-11 10:58:16 -0500483 var customOrder = 0;
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500484
Iftekharul Islam96bbf312017-08-22 13:44:38 -0500485 function getScaledValue(value, scale){
486 scale = scale + "";
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500487 scale = parseInt(scale, 10);
488 var power = Math.abs(parseInt(scale,10));
Iftekharul Islam96bbf312017-08-22 13:44:38 -0500489
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500490 if(scale > 0){
Iftekharul Islam96bbf312017-08-22 13:44:38 -0500491 value = value * Math.pow(10, power);
Iftekharul Islamec6bcd12017-09-06 10:49:07 -0500492 }else if(scale < 0){
Iftekharul Islam96bbf312017-08-22 13:44:38 -0500493 value = value / Math.pow(10, power);
494 }
495 return value;
496 }
497
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500498 function getSensorStatus(reading){
Iftekharul Islam8947e702017-07-27 10:28:07 -0500499 var severityFlags = {critical: false, warning: false, normal: false}, severityText = '', order = 0;
500
501 if(reading.hasOwnProperty('CriticalLow') &&
502 reading.Value < reading.CriticalLow
503 ){
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500504 severityFlags.critical = true;
505 severityText = 'critical';
Iftekharul Islam8947e702017-07-27 10:28:07 -0500506 order = 2;
507 }else if(reading.hasOwnProperty('CriticalHigh') &&
508 reading.Value > reading.CriticalHigh
509 ){
510 severityFlags.critical = true;
511 severityText = 'critical';
512 order = 2;
513 }else if(reading.hasOwnProperty('CriticalLow') &&
514 reading.hasOwnProperty('WarningLow') &&
515 reading.Value >= reading.CriticalLow && reading.Value <= reading.WarningLow){
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500516 severityFlags.warning = true;
517 severityText = 'warning';
Iftekharul Islam8947e702017-07-27 10:28:07 -0500518 order = 1;
519 }else if(reading.hasOwnProperty('WarningHigh') &&
520 reading.hasOwnProperty('CriticalHigh') &&
521 reading.Value >= reading.WarningHigh && reading.Value <= reading.CriticalHigh){
522 severityFlags.warning = true;
523 severityText = 'warning';
524 order = 1;
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500525 }else{
526 severityFlags.normal = true;
527 severityText = 'normal';
528 }
Iftekharul Islam8947e702017-07-27 10:28:07 -0500529 return { flags: severityFlags, severityText: severityText, order: order};
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500530 }
531
532 for(var key in content.data){
533 if(content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Unit')){
Iftekharul Islam8947e702017-07-27 10:28:07 -0500534
535 severity = getSensorStatus(content.data[key]);
536
537 if(!content.data[key].hasOwnProperty('CriticalLow')){
538 content.data[key].CriticalLow = "--";
539 content.data[key].CriticalHigh = "--";
540 }
541
542 if(!content.data[key].hasOwnProperty('WarningLow')){
543 content.data[key].WarningLow = "--";
544 content.data[key].WarningHigh = "--";
545 }
546
547 tempKeyParts = key.split("/");
548 title = tempKeyParts.pop();
549 title = tempKeyParts.pop() + '_' + title;
550 title = title.split("_").map(function(item){
551 return item.toLowerCase().charAt(0).toUpperCase() + item.slice(1);
552 }).reduce(function(prev, el){
553 return prev + " " + el;
554 });
555
Iftekharul Islam96bbf312017-08-22 13:44:38 -0500556 content.data[key].Value = getScaledValue(content.data[key].Value, content.data[key].Scale);
557
Iftekharul Islam8a122842017-09-11 10:58:16 -0500558 if(Constants.SENSOR_SORT_ORDER.indexOf(content.data[key].Unit) > -1){
559 customOrder = Constants.SENSOR_SORT_ORDER.indexOf(content.data[key].Unit);
560 }else{
561 customOrder = Constants.SENSOR_SORT_ORDER_DEFAULT;
562 }
563
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500564 sensorData.push(Object.assign({
565 path: key,
566 selected: false,
567 confirm: false,
568 copied: false,
Iftekharul Islam8947e702017-07-27 10:28:07 -0500569 title: title,
570 unit: Constants.SENSOR_UNIT_MAP[content.data[key].Unit],
571 severity_flags: severity.flags,
572 status: severity.severityText,
573 order: severity.order,
Iftekharul Islam8a122842017-09-11 10:58:16 -0500574 custom_order: customOrder,
Iftekharul Islam8947e702017-07-27 10:28:07 -0500575 search_text: (title + " " + content.data[key].Value + " " +
576 Constants.SENSOR_UNIT_MAP[content.data[key].Unit] + " " +
577 severity.severityText + " " +
578 content.data[key].CriticalLow + " " +
579 content.data[key].CriticalHigh + " " +
580 content.data[key].WarningLow + " " +
581 content.data[key].WarningHigh + " "
582 ).toLowerCase(),
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500583 original_data: {key: key, value: content.data[key]}
584 }, content.data[key]));
585 }
586 }
587
Iftekharul Islam8947e702017-07-27 10:28:07 -0500588 callback(sensorData, dataClone);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700589 }, function(error){
Iftekharul Islamd2269e22017-05-02 09:32:45 -0500590 console.log(error);
591 });
Iftekharul Islamc0161392017-06-14 15:46:15 -0500592 },
Michael Davisdf3bd122017-08-10 11:03:42 -0500593 getFirmwares: function(){
594 var deferred = $q.defer();
Iftekharul Islamc0161392017-06-14 15:46:15 -0500595 $http({
596 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500597 url: DataService.getHost() + "/xyz/openbmc_project/software/enumerate",
Iftekharul Islamc0161392017-06-14 15:46:15 -0500598 headers: {
599 'Accept': 'application/json',
600 'Content-Type': 'application/json'
601 },
602 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700603 }).then(function(response){
604 var json = JSON.stringify(response.data);
Iftekharul Islamc0161392017-06-14 15:46:15 -0500605 var content = JSON.parse(json);
606 var data = [];
607 var active = false;
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500608 var functional = false;
609 var ready = false;
610 var activationStatus = {active: false, ready: false, functional: false};
Iftekharul Islamc0161392017-06-14 15:46:15 -0500611 var isExtended = false;
612 var bmcActiveVersion = "";
613 var hostActiveVersion = "";
614 var imageType = "";
615 var extendedVersions = [];
616
617 function getFormatedExtendedVersions(extendedVersion){
618 var versions = [];
619 extendedVersion = extendedVersion.split(",");
620
621 extendedVersion.forEach(function(item){
622 var parts = item.split("-");
623 var numberIndex = 0;
624 for(var i = 0; i < parts.length; i++){
625 if(/[0-9]/.test(parts[i])){
626 numberIndex = i;
627 break;
628 }
629 }
630 var titlePart = parts.splice(0, numberIndex);
631 titlePart = titlePart.join("");
632 titlePart = titlePart[0].toUpperCase() + titlePart.substr(1, titlePart.length);
633 var versionPart = parts.join("-");
634 versions.push({
635 title: titlePart,
636 version: versionPart
637 });
638 });
639
640 return versions;
641 }
642
643 for(var key in content.data){
644 if(content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Version')){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500645
646 functional = (content.data[key].Priority == 0);
Iftekharul Islam2a489552017-11-02 13:23:08 -0500647 active = !functional && (/\.Active$/).test(content.data[key].Activation);
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500648 ready = (/\.Ready$/).test(content.data[key].Activation);
649 activationStatus = {functional: functional, active: active, ready: ready};
Iftekharul Islamc0161392017-06-14 15:46:15 -0500650 imageType = content.data[key].Purpose.split(".").pop();
651 isExtended = content.data[key].hasOwnProperty('ExtendedVersion') && content.data[key].ExtendedVersion != "";
652 if(isExtended){
653 extendedVersions = getFormatedExtendedVersions(content.data[key].ExtendedVersion);
654 }
655 data.push(Object.assign({
656 path: key,
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500657 functional: functional,
658 activationFlags: activationStatus,
Iftekharul Islamc0161392017-06-14 15:46:15 -0500659 imageId: key.split("/").pop(),
660 imageType: imageType,
661 isExtended: isExtended,
662 extended: {
663 show: false,
664 versions: extendedVersions
665 },
666 data: {key: key, value: content.data[key]}
667 }, content.data[key]));
668
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500669 if(functional && imageType == 'BMC'){
Iftekharul Islamc0161392017-06-14 15:46:15 -0500670 bmcActiveVersion = content.data[key].Version;
671 }
672
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500673 if(functional && imageType == 'Host'){
Iftekharul Islamc0161392017-06-14 15:46:15 -0500674 hostActiveVersion = content.data[key].Version;
675 }
676 }
677 }
Michael Davisdf3bd122017-08-10 11:03:42 -0500678
679 deferred.resolve({
680 data: data,
681 bmcActiveVersion: bmcActiveVersion,
682 hostActiveVersion: hostActiveVersion
683 });
Ed Tanousbbcf6702017-10-06 13:53:06 -0700684 }, function(error){
Iftekharul Islamc0161392017-06-14 15:46:15 -0500685 console.log(error);
Michael Davisdf3bd122017-08-10 11:03:42 -0500686 deferred.reject(error);
Iftekharul Islamc0161392017-06-14 15:46:15 -0500687 });
Michael Davisdf3bd122017-08-10 11:03:42 -0500688
689 return deferred.promise;
Iftekharul Islamc0161392017-06-14 15:46:15 -0500690 },
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500691 changePriority: function(imageId, priority){
692 var deferred = $q.defer();
693 $http({
694 method: 'PUT',
695 url: DataService.getHost() + "/xyz/openbmc_project/software/" + imageId + "/attr/Priority",
696 headers: {
Iftekharul Islam2a489552017-11-02 13:23:08 -0500697 'Accept': 'application/json',
698 'Content-Type': 'application/json'
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500699 },
700 withCredentials: true,
701 data: JSON.stringify({"data": priority})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700702 }).then(function(response){
703 var json = JSON.stringify(response.data);
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500704 var content = JSON.parse(json);
705 deferred.resolve(content);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700706 }, function(error){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500707 console.log(error);
708 deferred.reject(error);
709 });
710
711 return deferred.promise;
712 },
Iftekharul Islam2a489552017-11-02 13:23:08 -0500713 deleteImage: function(imageId){
714 var deferred = $q.defer();
715 $http({
716 method: 'POST',
717 url: DataService.getHost() + "/xyz/openbmc_project/software/" + imageId + "/action/Delete",
718 headers: {
719 'Accept': 'application/json',
720 'Content-Type': 'application/json'
721 },
722 withCredentials: true,
723 data: JSON.stringify({"data": []})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700724 }).then(function(response){
725 var json = JSON.stringify(response.data);
Iftekharul Islam2a489552017-11-02 13:23:08 -0500726 var content = JSON.parse(json);
727 deferred.resolve(content);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700728 }, function(error){
Iftekharul Islam2a489552017-11-02 13:23:08 -0500729 console.log(error);
730 deferred.reject(error);
731 });
732
733 return deferred.promise;
734 },
735 activateImage: function(imageId){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500736 var deferred = $q.defer();
Iftekharul Islamc0161392017-06-14 15:46:15 -0500737 $http({
738 method: 'PUT',
Iftekharul Islam2a489552017-11-02 13:23:08 -0500739 url: DataService.getHost() + "/xyz/openbmc_project/software/" + imageId + "/attr/RequestedActivation",
740 headers: {
741 'Accept': 'application/json',
742 'Content-Type': 'application/json'
743 },
744 withCredentials: true,
745 data: JSON.stringify({"data": Constants.FIRMWARE.ACTIVATE_FIRMWARE})
Ed Tanousbbcf6702017-10-06 13:53:06 -0700746 }).then(function(response){
747 var json = JSON.stringify(response.data);
Iftekharul Islam2a489552017-11-02 13:23:08 -0500748 var content = JSON.parse(json);
749 deferred.resolve(content);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700750 }, function(error){
Iftekharul Islam2a489552017-11-02 13:23:08 -0500751 console.log(error);
752 deferred.reject(error);
753 });
754
755 return deferred.promise;
756 },
757 uploadImage: function(file){
758 var deferred = $q.defer();
759 $http({
760 method: 'POST',
Iftekharul Islamc0161392017-06-14 15:46:15 -0500761 timeout: 5 * 60 * 1000,
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500762 url: DataService.getHost() + "/upload/image/",
Iftekharul Islamc0161392017-06-14 15:46:15 -0500763 headers: {
Iftekharul Islam2a489552017-11-02 13:23:08 -0500764 'Content-Type': 'application/octet-stream'
Iftekharul Islamc0161392017-06-14 15:46:15 -0500765 },
766 withCredentials: true,
767 data: file
Ed Tanousbbcf6702017-10-06 13:53:06 -0700768 }).then(function(response){
769 var json = JSON.stringify(response.data);
Iftekharul Islamc0161392017-06-14 15:46:15 -0500770 var content = JSON.parse(json);
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500771 deferred.resolve(content);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700772 }, function(error){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500773 console.log(error);
774 deferred.reject(error);
Iftekharul Islamc0161392017-06-14 15:46:15 -0500775 });
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500776
777 return deferred.promise;
778 },
779 downloadImage: function(host, filename){
780 var deferred = $q.defer();
781 $http({
782 method: 'POST',
783 url: DataService.getHost() + "/org/openbmc/control/flash/bmc/action/updateViaTftp",
784 headers: {
785 'Accept': 'application/json',
786 'Content-Type': 'application/json'
787 },
788 withCredentials: true,
789 data: JSON.stringify({"data": [host, filename]}),
790 responseType: 'arraybuffer'
Ed Tanousbbcf6702017-10-06 13:53:06 -0700791 }).then(function(response, status, headers){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500792 deferred.resolve({
793 data: response,
794 status: status,
795 headers: headers
796 });
Ed Tanousbbcf6702017-10-06 13:53:06 -0700797 }, function(error){
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500798 console.log(error);
799 deferred.reject(error);
800 });
801
802 return deferred.promise;
Iftekharul Islamc0161392017-06-14 15:46:15 -0500803 },
Michael Davisdf3bd122017-08-10 11:03:42 -0500804 getBMCEthernetInfo: function(){
805 var deferred = $q.defer();
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500806 $http({
807 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500808 url: DataService.getHost() + "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet",
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500809 headers: {
810 'Accept': 'application/json',
811 'Content-Type': 'application/json'
812 },
813 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700814 }).then(function(response){
815 var json = JSON.stringify(response.data);
Michael Davisdf3bd122017-08-10 11:03:42 -0500816 var content = JSON.parse(json);
817 deferred.resolve(content.data);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700818 }, function(error){
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500819 console.log(error);
Michael Davisdf3bd122017-08-10 11:03:42 -0500820 deferred.reject(error);
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500821 });
Michael Davisdf3bd122017-08-10 11:03:42 -0500822
823 return deferred.promise;
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500824 },
825 getBMCInfo: function(callback){
Michael Davisdf3bd122017-08-10 11:03:42 -0500826 var deferred = $q.defer();
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500827 $http({
828 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500829 url: DataService.getHost() + "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc",
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500830 headers: {
831 'Accept': 'application/json',
832 'Content-Type': 'application/json'
833 },
834 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700835 }).then(function(response){
836 var json = JSON.stringify(response.data);
Michael Davisdf3bd122017-08-10 11:03:42 -0500837 var content = JSON.parse(json);
838 deferred.resolve(content.data);
Ed Tanousbbcf6702017-10-06 13:53:06 -0700839 }, function(error){
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500840 console.log(error);
Michael Davisdf3bd122017-08-10 11:03:42 -0500841 deferred.reject(error);
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500842 });
Michael Davisdf3bd122017-08-10 11:03:42 -0500843 return deferred.promise;
Iftekharul Islam54c22e42017-06-28 11:06:16 -0500844 },
Iftekharul Islamee27d752017-07-05 15:54:31 -0500845 getHardwares: function(callback){
846 $http({
847 method: 'GET',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500848 url: DataService.getHost() + "/xyz/openbmc_project/inventory/enumerate",
Iftekharul Islamee27d752017-07-05 15:54:31 -0500849 headers: {
850 'Accept': 'application/json',
851 'Content-Type': 'application/json'
852 },
853 withCredentials: true
Ed Tanousbbcf6702017-10-06 13:53:06 -0700854 }).then(function(response){
855 var json = JSON.stringify(response.data);
Iftekharul Islamee27d752017-07-05 15:54:31 -0500856 var content = JSON.parse(json);
857 var hardwareData = [];
858 var keyIndexMap = {};
859 var title = "";
860 var data = [];
861 var searchText = "";
862 var componentIndex = -1;
863 var tempParts = [];
864
865
866 function isSubComponent(key){
867
868 for(var i = 0; i < Constants.HARDWARE.parent_components.length; i++){
869 if(key.split(Constants.HARDWARE.parent_components[i]).length == 2) return true;
870 }
871
872 return false;
873 }
874
875 function titlelize(title){
876 title = title.replace(/([A-Z0-9]+)/g, " $1").replace(/^\s+/, "");
877 for(var i = 0; i < Constants.HARDWARE.uppercase_titles.length; i++){
878 if(title.toLowerCase().indexOf((Constants.HARDWARE.uppercase_titles[i] + " ")) > -1){
879 return title.toUpperCase();
880 }
881 }
882
883 return title;
884 }
885
886 function camelcaseToLabel(obj){
Iftekharul Islam8947e702017-07-27 10:28:07 -0500887 var transformed = [], label = "", value = "";
Iftekharul Islamee27d752017-07-05 15:54:31 -0500888 for(var key in obj){
889 label = key.replace(/([A-Z0-9]+)/g, " $1").replace(/^\s+/, "");
890 if(obj[key] !== ""){
Iftekharul Islam8947e702017-07-27 10:28:07 -0500891 value = obj[key];
892 if(value == 1 || value == 0){
893 value = (value == 1) ? 'Yes' : 'No';
894 }
895 transformed.push({key:label, value: value});
Iftekharul Islamee27d752017-07-05 15:54:31 -0500896 }
897 }
898
899 return transformed;
900 }
901
902 function getSearchText(data){
903 var searchText = "";
904 for(var i = 0; i < data.length; i++){
905 searchText += " " + data[i].key + " " + data[i].value;
906 }
907
908 return searchText;
909 }
910
911 for(var key in content.data){
912 if(content.data.hasOwnProperty(key) &&
913 key.indexOf(Constants.HARDWARE.component_key_filter) == 0){
914
915 data = camelcaseToLabel(content.data[key]);
916 searchText = getSearchText(data);
917 title = key.split("/").pop();
918
919 title = titlelize(title);
920
921 if(!isSubComponent(key)){
922 hardwareData.push(Object.assign({
923 path: key,
924 title: title,
925 selected: false,
926 expanded: false,
927 search_text: title.toLowerCase() + " " + searchText.toLowerCase(),
928 sub_components: [],
929 original_data: {key: key, value: content.data[key]}
930 }, {items: data}));
931
932 keyIndexMap[key] = hardwareData.length - 1;
933 }else{
934 var tempParts = key.split("/");
935 tempParts.pop();
936 tempParts = tempParts.join("/");
937 componentIndex = keyIndexMap[tempParts];
938 data = content.data[key];
939 data.title = title;
940 hardwareData[componentIndex].sub_components.push(data);
941 hardwareData[componentIndex].search_text += " " + title.toLowerCase();
942 }
943 }
944 }
945
946 if(callback){
947 callback(hardwareData, content.data);
948 }else{
949 return { data: hardwareData, original_data: content.data};
950 }
951 });
952 },
Iftekharul Islamf2d74642017-07-10 16:42:14 -0500953 deleteLogs: function(logs) {
954 var defer = $q.defer();
955 var promises = [];
956
957 function finished(){
958 defer.resolve();
959 }
960
961 logs.forEach(function(item){
962 promises.push($http({
963 method: 'POST',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500964 url: DataService.getHost() + "/xyz/openbmc_project/logging/entry/"+item.Id+"/action/Delete",
Iftekharul Islamf2d74642017-07-10 16:42:14 -0500965 headers: {
966 'Accept': 'application/json',
967 'Content-Type': 'application/json'
968 },
969 withCredentials: true,
970 data: JSON.stringify({"data": []})
971 }));
972 });
973
974 $q.all(promises).then(finished);
975
976 return defer.promise;
977 },
978 resolveLogs: function(logs) {
979 var defer = $q.defer();
980 var promises = [];
981
982 function finished(){
983 defer.resolve();
984 }
985
986 logs.forEach(function(item){
987 promises.push($http({
988 method: 'PUT',
Iftekharul Islam1acb4122017-11-02 13:20:32 -0500989 url: DataService.getHost() + "/xyz/openbmc_project/logging/entry/"+item.Id+"/attr/Resolved",
Iftekharul Islamf2d74642017-07-10 16:42:14 -0500990 headers: {
991 'Accept': 'application/json',
992 'Content-Type': 'application/json'
993 },
994 withCredentials: true,
995 data: JSON.stringify({"data": "1"})
996 }));
997 });
998
999 $q.all(promises).then(finished);
1000
1001 return defer.promise;
1002 },
Iftekharul Islam99d199f2017-03-24 15:28:25 -05001003 };
1004 return SERVICE;
1005 }]);
1006
1007 })(window.angular);