Resource Manager Site
authorSeshu-Kumar-M <seshu.kumar.m@huawei.com>
Fri, 17 Feb 2017 05:51:29 +0000 (11:21 +0530)
committerSeshu-Kumar-M <seshu.kumar.m@huawei.com>
Fri, 17 Feb 2017 05:51:29 +0000 (11:21 +0530)
Template file with the resmgr site.

Issue-Id : SDNO-1204

Change-Id: I2e8ab9907738d19096cf27f642c87e272c830b1e
Signed-off-by: Seshu-Kumar-M <seshu.kumar.m@huawei.com>
resmgr/src/main/webapp/sdn-resmgr/site/site.html [new file with mode: 0644]
resmgr/src/main/webapp/sdn-resmgr/site/siteRest.js [new file with mode: 0644]

diff --git a/resmgr/src/main/webapp/sdn-resmgr/site/site.html b/resmgr/src/main/webapp/sdn-resmgr/site/site.html
new file mode 100644 (file)
index 0000000..c6f2039
--- /dev/null
@@ -0,0 +1,100 @@
+<!--/* Copyright 2017, Huawei Technologies Co., Ltd.\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*    http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*/-->\r
+\r
+\r
+<h4>{{title}}</h4>\r
+<br><br>\r
+<div id="siteAction" ng-init="init()">\r
+\r
+</div>\r
+<br>\r
+<br>\r
+\r
+\r
+<table ng-table="siteTableParams" class="table table-bordered table-striped customtable" show-filter="true">\r
+    <tr ng-repeat="siteData in $data">\r
+        <td header="'ng-table/headers/checkbox.html'">\r
+            <input type="checkbox" ng-model="checkboxes.items[siteData.id]" />\r
+        </td>\r
+        <td title="'Name'" filter="{ name: 'text'}" sortable="'name'">\r
+            {{siteData.name}}\r
+        </td>\r
+        <td title="'Type'" filter="{ type: 'text'}" sortable="'type'">\r
+            {{siteData.type}}\r
+        </td>\r
+        <td title="'Tenant Name'" filter="{ tenantName: 'text'}" sortable="'tenantName'">\r
+            {{siteData.tenantName}}\r
+        </td>\r
+        </td>\r
+        <td title="'Tenant Type'" filter="{ tenantType: 'text'}" sortable="'tenantType'">\r
+            {{siteData.tenantType}}\r
+        </td>\r
+        <td title="'Location'" filter="{ location: 'text'}" sortable="'location'">\r
+            {{siteData.location}}\r
+        </td>\r
+        <td title="'Action'">\r
+            <span  ng-click="editData(siteData.id)" style="cursor: pointer;margin: 0 5px"> <img src="framework/images/edit.png" height="15" align="left"/></span>\r
+            <span  ng-click="deleteData(siteData.id)" style="cursor: pointer;margin: 0 5px"><img src="framework/images/delete.png" height="15" align="middle"/></span>\r
+\r
+\r
+        </td>\r
+    </tr>\r
+</table>\r
+\r
+\r
+<script type="text/ng-template" id="ng-table/headers/checkbox.html">\r
+    <input type="checkbox" ng-model="checkboxes.checked" name="filter-checkbox" value="" />\r
+</script>\r
+\r
+<div id="myTable"></div>\r
+\r
+\r
+<!-- Modal -->\r
+<div id="myModal" class="modal fade" role="dialog">\r
+    <div class="modal-dialog">\r
+\r
+        <!-- Modal content-->\r
+        <div class="modal-content">\r
+            <div class="modal-header">\r
+                <button type="button" class="close" data-dismiss="modal">&times;</button>\r
+                <h5 class="modal-title">Modal Header</h5>\r
+            </div>\r
+            <form  name="siteForm" method="post">\r
+                <div class="modal-body">\r
+                    <div class="form-group row">\r
+                        <label class="col-xs-4 col-form-label">Name</label>\r
+                        <div id="name" class="col-xs-8">\r
+                        </div>\r
+                    </div>\r
+                    <div class="form-group row">\r
+                        <label class="col-xs-4 col-form-label">Type</label>\r
+                        <div id="type" class="col-xs-8" >\r
+                        </div>\r
+                    </div>\r
+                    <div class="form-group row">\r
+                        <label class="col-xs-4 col-form-label">Location</label>\r
+                        <div id="location" class="col-xs-8" >\r
+                        </div>\r
+                    </div>\r
+                </div>\r
+\r
+                <div id="footerBtns" class="modal-footer">\r
+                </div>\r
+            </form>\r
+        </div>\r
+\r
+\r
+    </div>\r
+</div>
\ No newline at end of file
diff --git a/resmgr/src/main/webapp/sdn-resmgr/site/siteRest.js b/resmgr/src/main/webapp/sdn-resmgr/site/siteRest.js
new file mode 100644 (file)
index 0000000..c407f7f
--- /dev/null
@@ -0,0 +1,93 @@
+/* Copyright 2017, Huawei Technologies Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *    http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+app.factory("siteDataService", function($http, DataService, $log){\r
+    var uri = 'http://192.168.9.13:18008';\r
+    return {\r
+        getAllSiteData : function() {\r
+            /*return $http({\r
+                url: 'http://localhost:3000/siteAPI/getAllSiteData',\r
+                method: 'GET',\r
+                data: null,\r
+                headers: {'Content-Type': 'application/json'}\r
+            }).then(function(response){\r
+                $log.info("in get data service data is  :"+response);\r
+                console.log(response.data);\r
+                return response.data;\r
+             });*/\r
+            return DataService.get(uri+'/openoapi/sdnobrs/v1/sites')\r
+                .then(function(response){\r
+                    $log.info("in get data service data is  :"+response);\r
+                    console.log(response);\r
+                    return response;\r
+                });\r
+        },\r
+        deleteSiteData : function(id) {\r
+            /*return $http({\r
+                url: 'http://localhost:3000/siteAPI/deleteSiteData',\r
+                method: 'POST',\r
+                data: {'nameList':nameList},\r
+                headers: {'Content-Type': 'application/json'}\r
+            }).then(function(response){\r
+                console.log("Successfully Deleted.. Data returned in DataService is");\r
+                console.log(response.data);\r
+                return response.data;\r
+            });*/\r
+            return DataService.delete(uri+'/openoapi/sdnobrs/v1/sites/'+id)\r
+                .then(function(response){\r
+                    $log.info("in delete data service data is  :"+response);\r
+                    console.log(response);\r
+                    return response;\r
+                });\r
+        },\r
+        editSiteData : function(siteData) {\r
+            /*return $http({\r
+                url: 'http://localhost:3000/siteAPI/editSiteData',\r
+                method: 'POST',\r
+                data: {'siteData':siteData},\r
+                headers: {'Content-Type': 'application/json'}\r
+            }).then(function(response){\r
+                console.log("Successfully edited.. Data returned in DataService is");\r
+                console.log(response.data);\r
+                return response.data;\r
+            });*/\r
+\r
+            return DataService.put(uri+'/openoapi/sdnobrs/v1/sites', siteData)\r
+                .then(function(response){\r
+                    console.log("Successfully added.. Data returned in DataService is");\r
+                    console.log(response.data);\r
+                    return response.data;\r
+                });\r
+        },\r
+        addSiteData : function(siteData) {\r
+            /*return $http({\r
+                url: 'http://localhost:3000/siteAPI/addSiteData',\r
+                method: 'POST',\r
+                data: {'siteData':siteData},\r
+                headers: {'Content-Type': 'application/json'}\r
+            }).then(function(response){\r
+                console.log("Successfully edited.. Data returned in DataService is");\r
+                console.log(response.data);\r
+                return response.data;\r
+            });*/\r
+            return DataService.post(uri+'/openoapi/sdnobrs/v1/sites', siteData)\r
+                .then(function(response){\r
+                    console.log("Successfully added.. Data returned in DataService is");\r
+                    console.log(response.data);\r
+                    return response.data;\r
+                });\r
+        }\r
+    }\r
+});\r