summaryrefslogtreecommitdiffstats
path: root/extsys
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-04-20 12:32:32 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-04-20 12:38:28 +0530
commit5485b05e78b1d37d64cfd8e0052ab5b59647c2c3 (patch)
treec62d7a02a5c79fa306bf805d4c71aaa008848661 /extsys
parentfd280c9c2ad1b87384f3c4e57fac4b65429ccc54 (diff)
SDN controller issues
IssueId : CLIENT-197 Change-Id: I047cd82c9c9fd2db3f63b52468e18810ec30b12a Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'extsys')
-rw-r--r--extsys/src/main/webapp/extsys/sdncontroller/index.html2
-rw-r--r--extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js80
-rw-r--r--extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html2
3 files changed, 82 insertions, 2 deletions
diff --git a/extsys/src/main/webapp/extsys/sdncontroller/index.html b/extsys/src/main/webapp/extsys/sdncontroller/index.html
index 1a0d84f1..942a86bb 100644
--- a/extsys/src/main/webapp/extsys/sdncontroller/index.html
+++ b/extsys/src/main/webapp/extsys/sdncontroller/index.html
@@ -37,7 +37,7 @@
<link href="/openoui/extsys/sdncontroller/css/style.css" rel="stylesheet"/>
<script src="/openoui/extsys/sdncontroller/js/app.js"></script>
<script src="/openoui/extsys/sdncontroller/js/rest.js"></script>
- <script src="/openoui/framework/browser/js/DataService.js"></script>
+ <script src="/openoui/extsys/sdncontroller/js/DataService.js"></script>
<script src="/openoui/thirdparty/js/mustache.js"></script>
diff --git a/extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js b/extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js
new file mode 100644
index 00000000..f374bbd8
--- /dev/null
+++ b/extsys/src/main/webapp/extsys/sdncontroller/js/DataService.js
@@ -0,0 +1,80 @@
+app.factory("DataService", function($http, $log) {
+ return {
+ /**
+ *
+ * @param url - url of the service
+ * @param data - data as an object (used as query string in url)
+ * @returns {*}
+ */
+ get: function (url, data) {
+ if(data) {
+ url += "?";
+ for(key in data){
+ url += key+ "=" + data[key];
+ }
+ }
+ return $http({
+ url: url,
+ method: 'GET',
+ data: null,
+ headers: {'Content-Type': 'application/json'}
+ }).then(function (response) {
+ return response.data;
+ });
+ },
+ /**
+ *
+ * @param url - url of the service
+ * @param data - data as an object (used for post method)
+ * @returns {*}
+ */
+ post: function (url, data) {
+ return $http({
+ url: url,
+ method: 'POST',
+ data: data,
+ headers: {'Content-Type': 'application/json '}
+ }).then(function (response) {
+ console.log("Response : ");
+ $log.info(response.data);
+ return response.data;
+ });
+ },
+ /**
+ * TODO - To Check for Delete
+ * @param url
+ * @param data
+ * @returns {*}
+ */
+ delete: function (url) {
+ return $http({
+ url: url,
+ method: 'DELETE',
+ data: null,
+ headers: {'Content-Type': 'application/json '}
+ }).then(function (response) {
+ console.log("Response : ");
+ $log.info(response.data);
+ return response.data;
+ });
+ },
+ /**
+ *
+ * @param url
+ * @param data
+ */
+ put: function (url, data) {
+ return $http({
+ url: url,
+ method: 'PUT',
+ data: data,
+ headers: {'Content-Type': 'application/json '}
+ }).then(function (response) {
+ console.log("Response : ");
+ $log.info(response.data);
+ return response.data;
+ });
+ }
+
+ }
+}) \ No newline at end of file
diff --git a/extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html b/extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html
index 3e914d0e..1aab2bdf 100644
--- a/extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html
+++ b/extsys/src/main/webapp/extsys/sdncontroller/templates/controller.html
@@ -80,7 +80,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
- <h5 class="modal-title">Modal Header</h5>
+ <h5 class="modal-title">>Add Controller</h5>
</div>
<form name="extsysForm" method="post">
<div class="modal-body">