From f359a972a101239a478db1d6d1be397bba8ad582 Mon Sep 17 00:00:00 2001 From: seshukm Date: Mon, 17 Apr 2017 17:57:27 +0530 Subject: BRS issues IssueID: CLIENT-189 Change-Id: I50a741bf79fae68122d2143c5146f297322126eb Signed-off-by: seshukm --- resmgr/src/main/webapp/resmgr/js/app.js | 137 +++++++++++++++------ .../resmgr/nfv-resmgr/datacenter/datacenter.html | 24 +++- .../src/main/webapp/resmgr/sdn-resmgr/ne/ne.html | 19 ++- .../src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js | 10 +- 4 files changed, 143 insertions(+), 47 deletions(-) (limited to 'resmgr') diff --git a/resmgr/src/main/webapp/resmgr/js/app.js b/resmgr/src/main/webapp/resmgr/js/app.js index fea0835f..a1e63a71 100644 --- a/resmgr/src/main/webapp/resmgr/js/app.js +++ b/resmgr/src/main/webapp/resmgr/js/app.js @@ -152,8 +152,8 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var dropdownInfo = translateToDropdownInfo(dropdownResponse); document.getElementById("portdropdown").innerHTML = dropdownInfo; - var portType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.logicalType"}}; - $('#myModal #logicalType').append($compile(Mustache.to_html(text, portType.ErrMsg))($scope)); + /* var portType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.logicalType"}}; + $('#myModal #logicalType').append($compile(Mustache.to_html(text, portType.ErrMsg))($scope));*/ var portLayerRate = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.layerRate"}}; $('#myModal #layerRate').append($compile(Mustache.to_html(text, portLayerRate.ErrMsg))($scope)); @@ -174,8 +174,8 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) document.getElementById("portEdropdown").innerHTML = dropdownInfo; - var portEdgepoint = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.isEdgePoint"}}; - $('#myModal #isEdgePoint').append($compile(Mustache.to_html(text, portEdgepoint.ErrMsg))($scope)); + /* var portEdgepoint = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.isEdgePoint"}}; + $('#myModal #isEdgePoint').append($compile(Mustache.to_html(text, portEdgepoint.ErrMsg))($scope));*/ var portIndex = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"port.portIndex"}}; $('#myModal #portIndex').append($compile(Mustache.to_html(text, portIndex.ErrMsg))($scope)); @@ -195,7 +195,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }, { counts:[5, 10, 20, 50], dataset: $scope.data}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.portTableParams.data, function(item) { if (angular.isDefined(item.id)) { $scope.checkboxes.items[item.id] = value; @@ -425,7 +425,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }, { counts:[5, 10, 20, 50], dataset: $scope.data}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.siteTableParams.data, function(item) { console.log(item.id); if (angular.isDefined(item.id)) { @@ -467,11 +467,11 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var dropdownInfo = translateToDropdownInfo(dropdownResponse); document.getElementById("sitedropdown").innerHTML = dropdownInfo; - var siteType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.type"}}; + /* var siteType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.type"}}; $('#myModal #type').append($compile(Mustache.to_html(text, siteType.ErrMsg))($scope)); - - var siteTenantName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.tenantID"}}; - $('#myModal #tenantID').append($compile(Mustache.to_html(text, siteTenantName.ErrMsg))($scope)); +*/ + /* var siteTenantName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"site.tenantID"}}; + $('#myModal #tenantID').append($compile(Mustache.to_html(text, siteTenantName.ErrMsg))($scope));*/ /*var siteTenantType = {"ErrMsg" : {"errmsg" : "The tenanttype is required.", "modalVar":"site.tenanttype"}}; $('#myModal #tenanttype').append($compile(Mustache.to_html(text, siteTenantType.ErrMsg))($scope));*/ @@ -701,7 +701,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }, { counts:[5, 10, 20, 50], dataset: $scope.data.locationData}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.neTableParams.data, function(item) { if (angular.isDefined(item.Id)) { $scope.checkboxes.items[item.Id] = value; @@ -931,9 +931,9 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var dropdownInfo = translateToDropdownInfo(dropdownResponse); document.getElementById("linkdropdown").innerHTML = dropdownInfo; - var linkType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"link.logicalType"}}; + /* var linkType = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"link.logicalType"}}; $('#myModal #logicalType').append($compile(Mustache.to_html(text, linkType.ErrMsg))($scope)); - +*/ var linkLayerRate = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"link.layerRate"}}; $('#myModal #layerRate').append($compile(Mustache.to_html(text, linkLayerRate.ErrMsg))($scope)); @@ -961,7 +961,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }, { counts:[5, 10, 20, 50], dataset: $scope.data}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.linkTableParams.data, function(item) { console.log(item.id); if (angular.isDefined(item.id)) { @@ -1181,9 +1181,15 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var neName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.name", "errtag":"textboxErrName", "errfunc":"validatetextboxName","required":true}}; $('#myModal #name').append($compile(Mustache.to_html(text, neName.ErrMsg))($scope)); - var neVersion = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.version","errtag":"textboxErrVersion", "errfunc":"validatetextboxVersion","required":true}}; + var neVersion = {"ErrMsg" : {"errmsg" : "The version is required.", "modalVar":"ne.version","errtag":"textboxErrVersion", "errfunc":"validatetextboxVersion","required":true}}; $('#myModal #version').append($compile(Mustache.to_html(text, neVersion.ErrMsg))($scope)); + var neNERole = {"ErrMsg" : {"errmsg" : "The role is required.", "modalVar":"ne.role","errtag":"textboxErrRole", "errfunc":"validatetextboxRole","required":true}}; + $('#myModal #nerole').append($compile(Mustache.to_html(text, neNERole.ErrMsg))($scope)); + + var serialNumber = {"ErrMsg" : {"errmsg" : "The serialNumber is required.", "modalVar":"ne.serialNumber","errtag":"textboxErrSerial", "errfunc":"validatetextboxSerial","required":true}}; + $('#myModal #serialNumber').append($compile(Mustache.to_html(text, serialNumber.ErrMsg))($scope)); + var neProductName = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.productName" }}; $('#myModal #productName').append($compile(Mustache.to_html(text, neProductName.ErrMsg))($scope)); @@ -1200,14 +1206,13 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var dropdownInfo = translateToDropdownInfo(dropdownResponse); document.getElementById("medropdown").innerHTML = dropdownInfo; - var neController = {"ErrMsg" : {"errmsg" : "IP Address is required.", "modalVar":"ne.controller"}}; - $('#myModal #controller').append($compile(Mustache.to_html(text, neController.ErrMsg))($scope)); + /*var neController = {"ErrMsg" : {"errmsg" : "IP Address is required.", "modalVar":"ne.controller"}}; + $('#myModal #controller').append($compile(Mustache.to_html(text, neController.ErrMsg))($scope));*/ var neIPAddress = {"ErrMsg" : {"errmsg" : "IP Address is required.", "modalVar":"ne.ipAddress"}}; $('#myModal #ipAddress').append($compile(Mustache.to_html(text, neIPAddress.ErrMsg))($scope)); - var neNERole = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.nerole"}}; - $('#myModal #nerole').append($compile(Mustache.to_html(text, neNERole.ErrMsg))($scope)); + var neAdminState = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.adminState"}}; $('#myModal #adminState').append($compile(Mustache.to_html(text, neAdminState.ErrMsg))($scope)); @@ -1215,13 +1220,25 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) var neOperatingState = {"ErrMsg" : {"errmsg" : "The name is required.", "modalVar":"ne.operatingState"}}; $('#myModal #operatingState').append($compile(Mustache.to_html(text, neOperatingState.ErrMsg))($scope)); + + neDataService.getNESiteDDList() + .then(function (data) { + $scope.siteIDList = data.sites; + var dropdownInfo = translateSiteIdToDropdownInfo($scope.siteIDList); + $("#siteIdDropdown").html(dropdownInfo); + console.log("Data: "); + $log.info(data); + }, function (reason) { + $scope.message = "Error is :" + JSON.stringify(reason); + }); + $scope.checkboxes = { 'checked': false, items: {} }; $scope.neTableParams = new NgTableParams({count: 5, sorting: {name: 'asc'} //{page: 1,count: 10,filter: {name: 'M'},sorting: {name: 'desc'} }, { counts:[5, 10, 20, 50], dataset: $scope.data}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.neTableParams.data, function(item) { if (angular.isDefined(item.id)) { $scope.checkboxes.items[item.id] = value; @@ -1241,8 +1258,19 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) } return options; - } + } + + function translateSiteIdToDropdownInfo(dropdowndata) { + var options = ''; + var i; + for (i = 0; i < dropdowndata.length; i += 1) { + var option = ''; + options = options + option; + } + return options; + } $scope.validatetextboxName = function (value){ if($scope.ne.name) { @@ -1260,6 +1288,22 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) $scope.textboxErrVersion = true; } + $scope.validatetextboxRole = function (value){ + if($scope.ne.role) { + $scope.textboxErrRole = false; + } + else + $scope.textboxErrRole = true; + } + + $scope.validatetextboxSerial = function (value){ + if($scope.ne.serialNumber) { + $scope.textboxErrSerial = false; + } + else + $scope.textboxErrSerial = true; + } + $scope.closeModal = function() { console.log("Closing Modal..."); $('#myModal').modal('hide'); @@ -1284,7 +1328,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) $("#myModal").modal({}).draggable(); } $scope.saveData = function(id) { - if (!$scope.textboxErrName && !$scope.textboxErrVersion) { + if (!$scope.textboxErrName && !$scope.textboxErrVersion && !$scope.textboxErrRole && !$scope.textboxErrSerial) { var nes = {}; nes.managedElement = $scope.ne; @@ -1441,31 +1485,43 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) $('#myModal #Status').append($compile(Mustache.to_html(text, dataStatus.ErrMsg))($scope)); //$('#myModal #Country').append($compile(Mustache.to_html(dropDown, $scope.data.dropdowncountryData))($scope)); - var dropSimple_data = { + /*var dropSimple_data = { "modalVar" : "datacenter.Country", "labelField" : "itemLabel", "optionsValue" : $scope.data ? JSON.stringify($scope.data.dropdowncountryData.item) : "" }; - $('#myModal #Country').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope)); + $('#myModal #Country').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope));*/ //$('#myModal #Location').append($compile(Mustache.to_html(dropDown, $scope.data.dropdownlocationData))($scope)); - var dropSimple_data = { + /*var dropSimple_data = { "modalVar" : "datacenter.Location", "labelField" : "itemLabel", "optionsValue" : $scope.data ? JSON.stringify($scope.data.dropdownlocationData.item) : "" }; - $('#myModal #Location').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope)); + $('#myModal #Location').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope));*/ //$('#myModal #ServiceName').append($compile(Mustache.to_html(dropDown, $scope.data.dropdownserviceData))($scope)); - var dropSimple_data = { + /*var dropSimple_data = { "modalVar" : "datacenter.ServiceName", "labelField" : "itemLabel", "optionsValue" : $scope.data ? JSON.stringify($scope.data.dropdownlocationData.item) : "" }; - $('#myModal #ServiceName').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope)); + $('#myModal #ServiceName').append($compile(Mustache.to_html(dropDown, dropSimple_data))($scope));*/ + + var dropdownResponse=[{"serviceTemplateId":"Country1","templateName":"Country1"},{"serviceTemplateId":"Country2","templateName":"Country2"}]; + var dropdownInfo = translateToDropdownInfo(dropdownResponse); + document.getElementById("countrydropdown").innerHTML = dropdownInfo; + + var dropdownResponse=[{"serviceTemplateId":"Location1","templateName":"Location1"},{"serviceTemplateId":"Location2","templateName":"Location2"}]; + var dropdownInfo = translateToDropdownInfo(dropdownResponse); + document.getElementById("locationdropdown").innerHTML = dropdownInfo; + + var dropdownResponse=[{"serviceTemplateId":"ServiceName1","templateName":"ServiceName1"},{"serviceTemplateId":"ServiceName2","templateName":"ServiceName2"}]; + var dropdownInfo = translateToDropdownInfo(dropdownResponse); + document.getElementById("servicenamedropdown").innerHTML = dropdownInfo; var dataCPU = {"ErrMsg" : {"textboxErr" : "The name is required.", "modalVar":"datacenter.Cpu"}}; $('#myModal #Cpu').append($compile(Mustache.to_html(text, dataCPU.ErrMsg))($scope)); @@ -1482,7 +1538,7 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }, { counts:[5, 10, 20, 50], dataset: $scope.data.datacenterData}); $scope.$watch('checkboxes.checked', function(value) { - $scope.checkboxes.items = []; + $scope.checkboxes.items = {}; angular.forEach($scope.neTableParams.data, function(item) { @@ -1492,24 +1548,26 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) }); }); + } + + function translateToDropdownInfo(dropdowndata) { + var options = ''; + var i; + for (i = 0; i < dropdowndata.length; i += 1) { + var option = ''; + options = options + option; + } + return options; } $scope.validatetextbox = function (value){ - if($scope.data.Name) { + if($scope.datacenter.Name) { $scope.textboxErr = false; } else $scope.textboxErr = true; } - $scope.validatenumeric = function (value){ - if($scope.data.cpu) { - $scope.numericErr = false; - } - else - $scope.numericErr = true; - } - $scope.closeModal = function() { console.log("Closing Modal..."); $('#myModal').modal('hide'); @@ -1529,10 +1587,9 @@ var app = angular.module("ResourceMgrApp", ["ui.router", "ngTable"]) //$("#myModal").modal(); $("#myModal").modal({}).draggable(); $scope.textboxErr = false; - $scope.numericErr = false; } $scope.saveData = function(id) { - if (!$scope.textboxErr && !$scope.numericErr) { + if (!$scope.textboxErr) { var dcs = {} dcs.dc = $scope.datacenter; diff --git a/resmgr/src/main/webapp/resmgr/nfv-resmgr/datacenter/datacenter.html b/resmgr/src/main/webapp/resmgr/nfv-resmgr/datacenter/datacenter.html index cd0c2c38..3d6c7043 100644 --- a/resmgr/src/main/webapp/resmgr/nfv-resmgr/datacenter/datacenter.html +++ b/resmgr/src/main/webapp/resmgr/nfv-resmgr/datacenter/datacenter.html @@ -85,9 +85,15 @@
-
+ +
+
@@ -95,14 +101,26 @@
-
+ +
+
-
+ +
+
diff --git a/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/ne.html b/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/ne.html index a1422f02..5c9970ab 100644 --- a/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/ne.html +++ b/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/ne.html @@ -96,6 +96,18 @@
+
+ +
+
+
+ +
+ +
+
+
+
@@ -104,7 +116,7 @@
- +
@@ -113,8 +125,9 @@
- -
+ +
+
diff --git a/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js b/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js index f6fabb4f..f67c0fec 100644 --- a/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js +++ b/resmgr/src/main/webapp/resmgr/sdn-resmgr/ne/neRest.js @@ -13,10 +13,18 @@ * limitations under the License. */ -app.factory("neDataService", function($http, DataService, $log){ +app.factory("neDataService", function($http, DataService, $log, siteDataService){ var uri = ''; uri += "/openoapi/sdnobrs/v1/managed-elements"; return { + getNESiteDDList : function() { + return siteDataService.getAllSiteData() + .then(function(response){ + $log.info("in get data service data is :"+response); + console.log(response); + return response; + }); + }, getAllNEData : function() { /*return $http({ url: 'http://localhost:3000/meAPI/getAllNEData', -- cgit 1.2.3-korg