blob: 7bf337979c696be15ce40be4bc6555226430d061 [file] [log] [blame]
Matteo Scandolod2044a42017-08-07 16:08:28 -07001
2/*
3 * Copyright 2017-present Open Networking Foundation
4
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8
9 * http://www.apache.org/licenses/LICENSE-2.0
10
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18
Rizwan Haider8e5f4772016-08-17 18:04:35 -040019/**
20 * © OpenCORD
21 *
22 * Visit http://guide.xosproject.org/devguide/addview/ for more information
23 *
24 * Created by teone on 6/27/16.
25 */
26
27(function () {
28 'use strict';
29
30 angular.module('xos.ecordTopology')
31 .service('Eline', ($resource) => {
32 return $resource(`/api/service/metronetworkservice/SCA_ETH_FDFr_EC/:id`, {id: '@id'}, {
33 query: {
34 isArray: true,
35 interceptor: {
36 response: (res) => {
37 const augmentedEline = _.map(res.data, (eline, i) => {
38 //convert latlng value into array for eline.uni1
39 var latlng_val = eline.uni1.latlng;
40 var lat_val = latlng_val.substring(1, latlng_val.indexOf(',') - 1);
41 lat_val = lat_val.trim();
42 var lng_val = latlng_val.substring(latlng_val.indexOf(',') + 1, latlng_val.length - 1);
43 lng_val = lng_val.trim()
44 eline.uni1.latlng = [lat_val, lng_val];
45
46 //convert latlng value into array for eline.uni2
47 latlng_val = eline.uni2.latlng;
48 lat_val = latlng_val.substring(1, latlng_val.indexOf(',') - 1);
49 lat_val = lat_val.trim();
50 lng_val = latlng_val.substring(latlng_val.indexOf(',') + 1, latlng_val.length - 1);
51 lng_val = lng_val.trim()
52 eline.uni2.latlng = [lat_val, lng_val];
53
54 return eline;
55 });
56 return augmentedEline;
57 }
58 }
59 }
60 });
61 });
62})();
63