diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
2 files changed, 122 insertions, 18 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js index 0d95e72a..a8b89757 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js @@ -1,4 +1,4 @@ -appDS2.controller('adminController', function($scope, $http,AdminService, $modal, $routeParams, $rootScope){ +appDS2.controller('adminController', function($scope, $http,AdminService, $modal, $routeParams, $rootScope){ $scope.totalPages = 5; $scope.viewPerPage = 8; @@ -71,8 +71,63 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal }); } - $scope.addRoleFunction = function(roleData){ + if(/[^a-zA-Z0-9\-\.\_]/.test(roleData.type)){ + errorMsg = 'Type can only contain alphanumeric characters, dots(.) and underscores(_)'; + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + return errorMsg; + } + } + }); + return; + } + if(roleData.action !== '*' && /[^a-zA-Z0-9\-\.\_]/.test(roleData.action)){ + errorMsg = 'Action can only contain alphanumeric characters, hyphens(-), dots(.) and underscores(_) and single asterisk character(*)'; + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + return errorMsg; + } + } + }); + return; + } + if(/[^a-zA-Z0-9\-\:\_\./*]/.test(roleData.code)){ + errorMsg = 'Code can only contain alphanumeric characters, hyphens(-), dots(.), colons(:), forwardSlash(/) , asterisk(*) and underscores(_)'; + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + return errorMsg; + } + } + }); + return; + } + if(/[^a-zA-Z0-9\-\_ \.]/.test(roleData.name)){ + errorMsg = 'Name can only contain alphanumeric characters, spaces, hyphens(-), dots(.) and underscores(_)'; + var modalInstance = $modal.open({ + templateUrl: 'app/fusion/scripts/DS2-modal/error_modal.html', + controller: ModalInstanceCtrl, + sizeClass: 'modal-small', + resolve: { + items: function () { + return errorMsg; + } + } + }); + return; + } AdminService.addRoleFunctionList(roleData).then(function(msg){ var message = msg; if(message.data!=null && message.data!=''){ @@ -100,6 +155,22 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal $scope.roleFun=items; $scope.msg=items; + $scope.ngRepeatDemo = [ + {id: 'menuradiobutton1', value: 'menu', labelvalue: 'menu'}, + {id: 'urlradiobutton2', value: 'url', labelvalue: 'url'}, + {id: 'otherradiobutton3', value: 'other', labelvalue: 'other'} + ] + $scope.selectedvalueradioButtonGroup = { + type: 'menu' + } + $scope.roleFun = { + action: '*' + } + + $scope.selectedvalueradioButtonOther = { + type: '' + } + // remove role function associated to a role on Role Edit page $scope.roleFunRemoveRole = function (roleFunction) { AdminService.removeRoleFunction(roleFunction, $routeParams.roleId).then(function(msg){ @@ -324,7 +395,12 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal }); } - $scope.save = function (data) { + $scope.save = function (data,type) { + if(type !== 'other'){ + data.type = type ; + } else{ + data.type = $scope.selectedvalueradioButtonOther.type ; + } $modalInstance.close(data); }; @@ -419,8 +495,8 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal } }); - modalInstance.result.then(function (data) { - $scope.addRoleFunction(data); + modalInstance.result.then(function (data,type) { + $scope.addRoleFunction(data,type); }); } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-function-add.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-function-add.html index 5752a278..ad3d538b 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-function-add.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-admin/modals/role-function-add.html @@ -1,4 +1,4 @@ -<div> +<div class = "ng-scope" style= "height: 710px"" > <div class="b2b-modal-header ng-scope in"> <h2 id="myModalLabel" modal-title="">Role Function Create</h2> <div class="corner-button in"> @@ -6,13 +6,14 @@ ng-click="$dismiss('cancel')"></button> </div> </div> - + <div class="b2b-modal-body ng-scope ng-isolate-scope in" tabindex="0" role="region" aria-label="Modal header text content" style="height: 280px;"> <div class="field-group"> - <span ID="required" style="color: Red;" visible="false"> *</span>Name <input id="textinputID-2a" ddh-reset ng-model="roleFun['name']" + <span ID="required" style="color: Red;" visible="false"> *</span>Name + <input id="textinputID-2a" ddh-reset ng-model="roleFun['name']" placeholder="Name" class="span12" type="text"> </div> <div class="error-container" @@ -21,31 +22,58 @@ </div> <br> <div class="field-group"> - <span ID="required" style="color: Red;" visible="false"> *</span>Code <input id="textinputID-2a" ddh-reset ng-model="roleFun['code']" + <span ID="required" style="color: Red;" visible="false"> *</span>Code + <input id="textinputID-2a" ddh-reset ng-model="roleFun['code']" placeholder="Code" class="span12" type="text"> </div> <div class="error-container" ng-show="!roleFun['code']||roleFun['code']==0"> - <small id="code-required" class="err-message">Code is Required</small> + <small id="code-required" class="err-message">Code is + Required</small> </div> - <br> + <br> <div class="field-group"> - Type <input id="textinputID-2b" ddh-reset ng-model="roleFun['type']" - placeholder="Type" class="span12" type="text"> + <span ID="required" style="color: Red;" visible="false"> *</span> + Type + <div ng-repeat="radioObj in ngRepeatDemo" class="form-row" + role="radio"> + + <label for="{{radioObj.id}}" class="radio"> <input + type="radio" ng-model="selectedvalueradioButtonGroup.type" + ng-disabled="disableCd" name="nameradioButton" + value="{{radioObj.value}}" id="{{radioObj.id}}" + name="nameradioButton" ddh-reset> <i class="skin"></i> <span>{{radioObj.labelvalue}}</span> + </label> <br> + </div> + <br> <input + ng-show="selectedvalueradioButtonGroup.type === 'other'" + id="type-property-input" class="adminForm-name-property-input" + ng-model= "selectedvalueradioButtonOther.type" ng-disabled="disableCd" type="text" + maxlength="30" /> + </div> + <div class="error-container" + ng-show="selectedvalueradioButtonGroup.type === 'other'"> + <small id="microservices-details-input-url-required" + class="err-message">Type is Required</small> </div> <br> <div class="field-group"> - Action <input id="textinputID-2c" ddh-reset ng-model="roleFun['action']" + <span ID="required" style="color: Red;" visible="false"> *</span>Action + <input id="textinputID-2c" ddh-reset ng-model="roleFun['action']" placeholder="Action" class="span12" type="text"> </div> - + <div class="error-container" + ng-show="!roleFun['action']||roleFun['action']==0"> + <small id="action-required" class="err-message">Action is Required</small> + </div> </div> <br> - <div class="b2b-modal-footer ng-scope ng-isolate-scope in"> + + <div class="b2b-modal-footer ng-scope ng-isolate-scope in" style = "top: 200px"> <div class="cta-button-group in"> - <button class="btn btn-alt btn-medium" type="button" ng-disabled= "(!roleFun['name']||roleFun['name']==0)|| (!roleFun['code']||roleFun['code']==0)" - ng-click="save(roleFun);">Create</button> + <button class="btn btn-alt btn-medium" type="button" ng-disabled= "(!roleFun['name']||roleFun['name']==0)|| (!roleFun['code']||roleFun['code']==0) || (!selectedvalueradioButtonGroup.type||selectedvalueradioButtonGroup.type.length==0)||(selectedvalueradioButtonGroup.type ==='other'&&(!selectedvalueradioButtonOther.type||selectedvalueradioButtonOther.type.length==0)) || (!roleFun['action']||roleFun['action']==0)" + ng-click="save(roleFun,selectedvalueradioButtonGroup.type)">Create</button> <button class="btn btn-medium" type="button" ng-click="$dismiss('cancel')">Cancel</button> </div> |