diff options
author | 2018-07-25 13:25:43 -0400 | |
---|---|---|
committer | 2018-07-30 11:49:36 -0400 | |
commit | aa9b320ff93511280cf51b03d38fb9254af6b530 (patch) | |
tree | 434819201ead235fad2e7fb663b0480695156db4 /ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs | |
parent | fe3a67c11b65d7989a6ef648c3f34eee8abe7394 (diff) |
JUnits for coverage
Issue-ID: PORTAL-273
JUnits for sonar coverage
Change-Id: Icb88d8563164281d29877bbc2de9c8f1f780aa0c
Signed-off-by: sa282w <sa282w@att.com>
Diffstat (limited to 'ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs')
7 files changed, 83 insertions, 34 deletions
diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html index cf24e9f5..cc6ade8d 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-functions-confirm.html @@ -33,7 +33,7 @@ ============LICENSE_END============================================ - ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> <div> <div class="b2b-modal-header"> @@ -50,8 +50,13 @@ <div class="upload-instructions" ng-show="isProcessing"> {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span> </div> + + <div class="upload-instructions" + ng-show="isProcessedRecords"> + {{conformMsg}} + </div> - <div ng-hide="isProcessing"> + <div ng-hide="isProcessing || isProcessedRecords"> <div class="upload-instructions">Click OK to upload the valid functions. Invalid or existing functions will be ignored.</div> <p> @@ -77,7 +82,7 @@ characters, spaces, hyphens(-), dots(.) and underscores(_) </p> </div> - <div class="c-ecomp-portal-abs-table default" + <div ng-hide="isProcessing || isProcessedRecords" class="c-ecomp-portal-abs-table default" style="height: 250px !important"> <table b2b-table table-data="uploadFile" search-string="bulkRoleAndFunctions.searchString" @@ -127,7 +132,7 @@ <div class="b2b-modal-footer"> <div class="cta-button-group in"> <button id="bulk-user-ok-button" class="btn btn-alt btn-small" - ng-class="{disabled: isValidating}" ng-click="updateFunctionsInDB()">Ok</button> + ng-disabled="isProcessedRecords" ng-class="{disabled: isValidating}" ng-click="updateFunctionsInDB()">Ok</button> <button id="bulk-user-cancel-button" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</button> </div> diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html index 4b173fd3..9690ad48 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-global-role-functions-confirm.html @@ -33,7 +33,7 @@ ============LICENSE_END============================================ - ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> <div> <div class="b2b-modal-header"> @@ -50,8 +50,13 @@ <div class="upload-instructions" ng-show="isProcessing"> {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span> </div> + + <div class="upload-instructions" + ng-show="isProcessedRecords"> + {{conformMsg}} + </div> - <div ng-hide="isProcessing"> + <div ng-hide="isProcessing || isProcessedRecords"> <div class="upload-instructions">Click OK to upload the valid requests. Invalid requests will be ignored.</div> <div class="c-ecomp-portal-abs-table default" @@ -109,6 +114,7 @@ <div class="cta-button-group in"> <button id="bulk-user-ok-button" class="btn btn-alt btn-small" ng-class="{disabled: isValidating}" + ng-disabled="isProcessedRecords" ng-click="updateGlobalRoleFunctionsInDB()">Ok</button> <button id="bulk-user-cancel-button" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</button> diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html index dce8e99e..a9a00b90 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-confirm.html @@ -33,7 +33,7 @@ ============LICENSE_END============================================ - ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> <div> <div class="b2b-modal-header"> @@ -50,8 +50,13 @@ <div class="upload-instructions" ng-show="isProcessing"> {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span> </div> + + <div class="upload-instructions" + ng-show="isProcessedRecords"> + {{conformMsg}} + </div> - <div ng-hide="isProcessing"> + <div ng-hide="isProcessing || isProcessedRecords"> <div class="upload-instructions">Click OK to upload the valid requests. Invalid requests will be ignored.</div> <div class="c-ecomp-portal-abs-table default" @@ -114,6 +119,7 @@ <div class="cta-button-group in"> <button id="bulk-user-ok-button" class="btn btn-alt btn-small" ng-class="{disabled: isValidating}" + ng-disabled="isProcessedRecords" ng-click="updateRoleFunctionsInDB()">Ok</button> <button id="bulk-user-cancel-button" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</button> diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js index 41af0bc6..340e3e56 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js @@ -33,7 +33,7 @@ * * ============LICENSE_END============================================ * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ /** * bulk upload role-functions controller @@ -86,7 +86,9 @@ // Enable modal controls this.step1 = true; - this.fileSelected = false; + this.fileSelected = false; + + $scope.isProcessedRecords = false; }; // init // Answers a function that compares properties with the specified name. @@ -124,6 +126,8 @@ */ $scope.readValidateFile = (typeUpload) => { $scope.isProcessing = true; + $scope.conformMsg = ''; + $scope.isProcessedRecords = true; $scope.progressMsg = 'Reading upload file...'; var reader = new FileReader(); reader.onload = function(event) { @@ -148,9 +152,11 @@ $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends'); $scope.progressMsg = 'Done.'; $scope.isProcessing = false; + $scope.isProcessedRecords = false; }, function(error) { $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info'); $scope.isProcessing = false; + $scope.isProcessedRecords = false; }); } else if (typeUpload === 'roleFunctions'){ $scope.uploadFile = $filter('csvToRoleFuncObj')(reader.result); @@ -179,9 +185,11 @@ $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends'); $scope.progressMsg = 'Done.'; $scope.isProcessing = false; + $scope.isProcessedRecords = false; }, function(error) { $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info'); $scope.isProcessing = false; + $scope.isProcessedRecords = false; }); }, function(error) { @@ -210,10 +218,12 @@ $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends'); $scope.progressMsg = 'Done.'; $scope.isProcessing = false; + $scope.isProcessedRecords = false; }, function(error) { $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app functions info'); $scope.isProcessing = false; + $scope.isProcessedRecords = false; } ); } else if(typeUpload === 'globalRoleFunctions'){ @@ -248,9 +258,11 @@ $log.debug('BulkRoleAndFunctionsModalCtrl::readValidateFile inner-then ends'); $scope.progressMsg = 'Done.'; $scope.isProcessing = false; + $scope.isProcessedRecords = false; }, function(error) { $log.error('BulkUserModalCtrl::readValidateFile: failed retrieving app roles info'); $scope.isProcessing = false; + $scope.isProcessedRecords = false; }); }, function(error) { @@ -478,6 +490,8 @@ */ $scope.updateFunctionsInDB = () => { $scope.isProcessing = true; + $scope.conformMsg = ''; + $scope.isProcessedRecords = true; $scope.progressMsg = 'Sending requests to application..'; if (debug) $log.debug('BulkRoleAndFunctionsModalCtrl::updateFunctionsInDB: request length is ' + appUserRolesRequest.length); @@ -514,11 +528,10 @@ // Run all the promises $q.all(promises).then(function(){ + $scope.conformMsg = 'Processed ' + numberFunctionsSucceeded + ' records.'; $scope.isProcessing = false; - confirmBoxService.showInformation('Processed ' + numberFunctionsSucceeded + ' records.').then(isConfirmed => { - // Close the upload-confirm dialog - ngDialog.close(); - }); + $scope.isProcessedRecords = true; + $scope.uploadFile = []; }); }; // updateFunctionsInDB @@ -530,6 +543,8 @@ */ $scope.updateRolesInDB = () => { $scope.isProcessing = true; + $scope.conformMsg = ''; + $scope.isProcessedRecords = true; $scope.progressMsg = 'Sending requests to application..'; if (debug) $log.debug('BulkRoleAndFunctionsModalCtrl::updateRolesInDB: request length is ' + appUserRolesRequest.length); @@ -579,11 +594,13 @@ // Run all the promises $q.all(promises).then(function(){ - $scope.isProcessing = false; - confirmBoxService.showInformation('Processed ' + numberRolesSucceeded + ' records. Please sync roles').then(isConfirmed => { - // Close the upload-confirm dialog - ngDialog.close(); - }); + if(numberRolesSucceeded == 0){ + $scope.conformMsg = 'Processed ' + numberRolesSucceeded + ' records'; + }else{ + $scope.conformMsg = 'Processed ' + numberRolesSucceeded + ' records. Please sync roles to reflect in portal'; + } $scope.isProcessing = false; + $scope.isProcessedRecords = true; + $scope.uploadFile = []; }); }; // updateRolesInDB @@ -594,6 +611,8 @@ */ $scope.updateRoleFunctionsInDB = () => { $scope.isProcessing = true; + $scope.conformMsg = ''; + $scope.isProcessedRecords = true; $scope.progressMsg = 'Sending requests to application..'; if (debug) $log.debug('BulkRoleAndFunctionsModalCtrl::updateRoleFunctionsInDB: request length is ' + appUserRolesRequest.length); @@ -632,11 +651,13 @@ // Run all the promises $q.all(promises).then(function(){ - $scope.isProcessing = false; - confirmBoxService.showInformation('Processed ' + numberRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal').then(isConfirmed => { - // Close the upload-confirm dialog - ngDialog.close(); - }); + if(numberRoleFunctionSucceeded == 0){ + $scope.conformMsg = 'Processed ' + numberRoleFunctionSucceeded + ' records'; + }else{ + $scope.conformMsg = 'Processed ' + numberRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal'; + } $scope.isProcessing = false; + $scope.isProcessedRecords = true; + $scope.uploadFile = []; }); }; // updateRoleFunctionsInDB @@ -647,6 +668,8 @@ */ $scope.updateGlobalRoleFunctionsInDB = () => { $scope.isProcessing = true; + $scope.conformMsg = ''; + $scope.isProcessedRecords = true; $scope.progressMsg = 'Sending requests to application..'; if (debug) $log.debug('BulkRoleAndFunctionsModalCtrl::updateGlobalRoleFunctionsInDB: request length is ' + appUserRolesRequest.length); @@ -685,11 +708,14 @@ // Run all the promises $q.all(promises).then(function(){ - $scope.isProcessing = false; - confirmBoxService.showInformation('Processed ' + numberGlobalRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal').then(isConfirmed => { - // Close the upload-confirm dialog - ngDialog.close(); - }); + if(numberGlobalRoleFunctionSucceeded == 0){ + $scope.conformMsg = 'Processed ' + numberGlobalRoleFunctionSucceeded + ' records'; + }else{ + $scope.conformMsg = 'Processed ' + numberGlobalRoleFunctionSucceeded + ' records. Please sync roles to reflect in portal'; + } + $scope.isProcessing = false; + $scope.isProcessedRecords = true; + $scope.uploadFile = []; }); }; // updateGlobalRoleFunctionsInDB diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html index 6c6a4e73..bca96d1d 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html @@ -33,7 +33,7 @@ ============LICENSE_END============================================ - ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> <div> <div class="b2b-modal-header"> diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less index 8ab5603f..aa6354e1 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.less @@ -33,7 +33,7 @@ * * ============LICENSE_END============================================ * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ .bulk-user-modal { height: 430px; diff --git a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html index e5e4a86b..fce0f1e0 100644 --- a/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html +++ b/ecomp-portal-FE-common/client/app/views/role/bulk-upload-dialogs/bulk-upload-roles-confirm.html @@ -33,7 +33,7 @@ ============LICENSE_END============================================ - ECOMP is a trademark and service mark of AT&T Intellectual Property. + --> <div> <div class="b2b-modal-header"> @@ -51,7 +51,12 @@ {{progressMsg}} <br> <br> <span class="ecomp-spinner"></span> </div> - <div ng-hide="isProcessing"> + <div class="upload-instructions" + ng-show="isProcessedRecords"> + {{conformMsg}} + </div> + + <div ng-hide="isProcessing || isProcessedRecords"> <div class="upload-instructions">Click OK to upload the valid roles. Invalid or existing roles will be ignored.</div> <p> @@ -60,7 +65,7 @@ characters, dots(.), forward slashes(/), and underscores(_) </p> </div> - <div class="c-ecomp-portal-abs-table default" + <div ng-hide="isProcessing || isProcessedRecords" class="c-ecomp-portal-abs-table default" style="height: 250px !important"> <table b2b-table table-data="uploadFile" search-string="bulkRoleAndFunctions.searchString" @@ -102,6 +107,7 @@ <div class="b2b-modal-footer"> <div class="cta-button-group in"> <button id="bulk-user-ok-button" class="btn btn-alt btn-small" + ng-disabled="isProcessedRecords" ng-class="{disabled: isValidating}" ng-click="updateRolesInDB()">Ok</button> <button id="bulk-user-cancel-button" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')">Cancel</button> |