summaryrefslogtreecommitdiffstats
path: root/esr/src/main/webapp/extsys/sdncontroller/js/rest.js
diff options
context:
space:
mode:
authorlizi00164331 <li.zi30@zte.com.cn>2017-08-07 11:39:39 +0800
committerlizi00164331 <li.zi30@zte.com.cn>2017-08-07 11:39:39 +0800
commit21d72c4a80fe2937d0c4ddd20624b27adbcd989b (patch)
treee5013ee12f74f8452e01cbff16e7b0158bc456cb /esr/src/main/webapp/extsys/sdncontroller/js/rest.js
parentf533e73e2ae32e010b16abdcf7985abaf31ab843 (diff)
Upload the ESR GUI seed code
Issue-ID: AAI-68 Change-Id: Ia50ce0570c2fabecd77199d4e8454f56fe587c4e Signed-off-by: lizi00164331 <li.zi30@zte.com.cn>
Diffstat (limited to 'esr/src/main/webapp/extsys/sdncontroller/js/rest.js')
-rw-r--r--esr/src/main/webapp/extsys/sdncontroller/js/rest.js95
1 files changed, 95 insertions, 0 deletions
diff --git a/esr/src/main/webapp/extsys/sdncontroller/js/rest.js b/esr/src/main/webapp/extsys/sdncontroller/js/rest.js
new file mode 100644
index 0000000..1279c42
--- /dev/null
+++ b/esr/src/main/webapp/extsys/sdncontroller/js/rest.js
@@ -0,0 +1,95 @@
+/*
+
+ Copyright 2017, Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+
+
+app.factory("controllerDataService", function($http, DataService, $log){
+ var uri = '';
+ return {
+ getControllerData : function() {
+ /*return $http({
+ url: 'http://localhost:3000/api/getControllerData',
+ method: 'GET',
+ headers: {'Content-Type': 'application/json'}
+ }).then(function(response){
+ //$log.info(response);
+ return response.data;
+ });*/
+ return DataService.get(uri+'/openoapi/extsys/v1/sdncontrollers')
+ .then(function(response){
+ $log.info("in get data service data is :"+response);
+ console.log(response);
+ return response;
+ });
+ },
+ addControllerData : function(controllerData) {
+ /*return $http({
+ url: 'http://localhost:3000/api/addProvinceData',
+ method: 'POST',
+ data: provinceDetail,
+ headers: {'Content-Type': 'application/json '}
+ }).then(function(response){
+ console.log("Response : ");
+ $log.info(response.data);
+ return response.data;
+ });*/
+ return DataService.post(uri+'/openoapi/extsys/v1/sdncontrollers', controllerData)
+ .then(function(response){
+ console.log("Successfully added.. Data returned in DataService is");
+ console.log(response.data);
+ return response.data;
+ });
+ },
+ deleteControllerData : function(id) {
+ /*return $http({
+ url: 'http://localhost:3000/api/deleteProvinceData',
+ method: 'POST',
+ data: {'idList':idList},
+ headers: {'Content-Type': 'application/json'}
+ }).then(function(response){
+ console.log("Successfully Deleted..");
+ $log.info(response);
+ return response.data;
+ });*/
+ return DataService.delete(uri+'/openoapi/extsys/v1/sdncontrollers/'+id)
+ .then(function(response){
+ $log.info("in delete data service data is :"+response);
+ console.log(response);
+ return response;
+ });
+ },
+ editControllerData : function(controllerData) {
+ /*return $http({
+ url: 'http://localhost:3000/api/editProvinceData',
+ method: 'POST',
+ data: provinceDetail,
+ headers: {'Content-Type': 'application/json'}
+ }).then(function(response){
+ console.log("Successfully Edited...");
+ $log.info(response);
+ return response.data;
+ });*/
+
+ return DataService.put(uri+'/openoapi/extsys/v1/sdncontrollers', controllerData)
+ .then(function(response){
+ console.log("Successfully edited.. Data returned in DataService is");
+ console.log(response.data);
+ return response.data;
+ });
+ }
+ }
+}); \ No newline at end of file