From a70761c096192e38800bf38d6c7f61f52bf72007 Mon Sep 17 00:00:00 2001 From: hb123f Date: Wed, 20 Mar 2019 12:20:44 -0400 Subject: CADI AAF Integration and merging the code Issue-ID: PORTAL-319 CADI AAF Integration and code merge Change-Id: I6e44f3b2741858d8d403b77a49ec9a0153084801 Signed-off-by: hb123f --- .../services/applications/applications.service.js | 4 +-- .../client/app/services/users/users.service.js | 4 +-- .../account-add-details/account-add-details.html | 6 +++- .../account-add-details/account-add-details.js | 6 ++-- .../account-onboarding/account-onboarding.tpl.html | 8 ++--- .../bulk-upload-role-functions-controller.js | 13 ++++++-- .../client/app/views/role/role-list-controller.js | 12 ++++--- .../users/new-user-dialogs/bulk-user.controller.js | 13 ++++++-- .../users/new-user-dialogs/bulk-user.modal.html | 2 +- .../users/new-user-dialogs/new-user.controller.js | 2 +- .../widget-details.controller.js | 38 ++++++++++++++++++++-- .../widget-details.modal.html | 9 +++-- 12 files changed, 91 insertions(+), 26 deletions(-) (limited to 'ecomp-portal-FE-common') diff --git a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js index 75fc7fec..c595c71a 100644 --- a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js +++ b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js @@ -639,8 +639,8 @@ }).then( res => { // If response comes back as a redirected HTML page which IS NOT a success // But don't declare an empty list to be an error. - if (res == null || res.data == null || _this13.utilsService.isValidJSON(res.data) == false) { - deferred.reject("ApplicationsService::syncRolesEcompFromExtAuthSystem Failed"); + if (res == null || res.data == null || _this13.utilsService.isValidJSON(res.data) == false || res.data.status == 'ERROR') { + deferred.reject("ApplicationsService::syncRolesEcompFromExtAuthSystem Failed" + res.data.message); } else { deferred.resolve(res); } diff --git a/ecomp-portal-FE-common/client/app/services/users/users.service.js b/ecomp-portal-FE-common/client/app/services/users/users.service.js index dc415c43..9e062713 100644 --- a/ecomp-portal-FE-common/client/app/services/users/users.service.js +++ b/ecomp-portal-FE-common/client/app/services/users/users.service.js @@ -200,8 +200,8 @@ }).then( res => { // this.$log.debug('getUserAppRoles response: ', JSON.stringify(res)) // If response comes back as a redirected HTML page which IS NOT a success - if (this.utilsService.isValidJSON(res)== false) { - deferred.reject('UsersService::updateUserAppRoles: Failed'); + if (this.utilsService.isValidJSON(res)== false || res.data.httpStatusCode == '500' || res.data.status == 'ERROR') { + deferred.reject('UsersService::updateUserAppRoles: Failed' + res.data.message); } else { // this.$log.info('UsersService::updateUserAppRoles: Succeeded'); deferred.resolve(res.data); diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html index 03d7d1c4..6e20703b 100644 --- a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-add-details/account-add-details.html @@ -61,6 +61,10 @@ padding-bottom:15px; .account-property{ padding-top:10px; } + +.add-label-right{ +opacity: 0.6 +}
@@ -147,7 +151,7 @@ padding-top:10px;
Add Endpoint
+ ng-click="accountAddDetails.addEndpoint()" ng-disabled="true">
{ - this.account.endpointList.push({ + confirmBoxService.showInformation('Please add the roles to this Username/MechId through AAF Screen ').then(isConfirmed => {}); + return; + /* this.account.endpointList.push({ valid: true - }); + }); */ } let init = () => { this.account = []; diff --git a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html index 2dd4f98f..e4df68ed 100644 --- a/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/account-onboarding/account-onboarding.tpl.html @@ -67,8 +67,8 @@ b2b-table-header key="{{header.value}}" sortable="{{header.isSortable}}">{{header.name}} - Endpoints + Delete @@ -85,7 +85,7 @@ ng-bind="rowData[header.value]">
-
@@ -95,7 +95,7 @@
All endpoints
- + -->
{ - this.fileSelected = true; - this.fileToRead = files[0]; + var fileName = files[0].name; + var validFormats = ['csv', 'txt']; + //Get file extension + var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); + //Check for valid format + if(validFormats.indexOf(ext) == -1){ + this.fileSelected = false; + }else{ + this.fileSelected = true; + this.fileToRead = files[0]; + } if (debug) $log.debug("BulkRoleAndFunctionsModalCtrl::fileChangeHandler: file is ", this.fileToRead); }; // file change handler diff --git a/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js b/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js index 0ae218c4..6f280313 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js +++ b/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js @@ -170,14 +170,16 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS $scope.syncRolesFromExternalAuthSystem = function(appId){ applicationsService.syncRolesEcompFromExtAuthSystem(appId).then(function(res){ - if(res.status == 200){ + if(res.data != null || res.data.status != null || res.data.status == 'OK'){ confirmBoxService.showInformation('Sync operation completed successfully!').then(isConfirmed => { $scope.getRolesForSelectedCentralizedApp(appId); }); } else{ - confirmBoxService.showInformation('Sync operation failed for '+app).then(isConfirmed => {}); + confirmBoxService.showInformation('Sync operation failed for '+app + res.data.message).then(isConfirmed => {}); } - }); + }).catch(err=> { + confirmBoxService.showInformation("Sync operation failed for: " + err); + }); }; @@ -218,7 +220,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS // edit Role $scope.editRoleModalPopup = function(appId, availableRole) { if(!availableRole.active) - return confirmBoxService.showInformation('Edit is disabled! Please toggle the role to activate it.').then(isConfirmed => {}); + return confirmBoxService.showInformation('Edit is diabled! Please toggle the role to activate it.').then(isConfirmed => {}); $scope.editRole = availableRole; if(appId != undefined && availableRole.id != undefined){ RoleService.getRole(appId, availableRole.id).then(function(data){ @@ -259,7 +261,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS // add Role $scope.addRoleModalPopup = function(appId) { if(appId){ - var roleId = 0; + var roleId = -1; RoleService.getRole(appId, roleId).then(function(data){ var response = JSON.parse(data.data); var role = JSON.parse(response.role); diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js index 2e8018ec..718879a0 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js @@ -134,8 +134,17 @@ // Caches the file name supplied by the event handler. $scope.fileChangeHandler = (event, files) => { - this.fileSelected = true; - this.fileToRead = files[0]; + var fileName = files[0].name; + var validFormats = ['csv', 'txt']; + //Get file extension + var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); + //Check for valid format + if(validFormats.indexOf(ext) == -1){ + this.fileSelected = false; + }else{ + this.fileSelected = true; + this.fileToRead = files[0]; + } if (debug) $log.debug("BulkUserModalCtrl::fileChangeHandler: file is ", this.fileToRead); }; // file change handler diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.modal.html b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.modal.html index e32497bf..88524466 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.modal.html +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.modal.html @@ -67,7 +67,7 @@ ng-model="fileModel" /> Browse... {{selectedFile}} -
File must have one entry per line with this format: +
File must be .csv or .txt and have one entry per line with this format:
orgUserId, role name
diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js index 79cc8d36..512c3a0c 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js @@ -193,7 +193,7 @@ this.numberAppsSucceeded++; }).catch(err => { $log.error(err); - var errorMessage = 'Failed to update the user application roles: ' + err.status; + var errorMessage = 'Failed to update the user application roles: ' + err; if(err.status == 504){ this.numberAppsSucceeded++; errorMessage = 'Request is being processed, please check back later!'; diff --git a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.controller.js b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.controller.js index b6429015..bf0df9f0 100644 --- a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.controller.js +++ b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.controller.js @@ -38,7 +38,7 @@ 'use strict'; (function () { class WidgetOnboardingDetailsModalCtrl { - constructor($scope, $log, $interval, applicationsService, adminsService, microserviceService, widgetsCatalogService, errorMessageByCode, ECOMP_URL_REGEX, $window,userProfileService, confirmBoxService, $cookies,items) { + constructor($scope, $timeout, $log, $interval, applicationsService, adminsService, microserviceService, widgetsCatalogService, errorMessageByCode, ECOMP_URL_REGEX, $window,userProfileService, confirmBoxService, $cookies,items) { this.appUpdate = function(){ this.hasSelectedApp = false; @@ -398,12 +398,46 @@ }); } }; + // Caches the file name supplied by the event handler. + $scope.widgetFileHandler = (event, files) => { + if(files[0]){ + var fileName = files[0].name; + var validFormats = ['zip']; + //Get file extension + var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); + //Check for valid format + if(validFormats.indexOf(ext) == -1){ + document.getElementById('widget-onboarding-details-upload-file').value = null; + $scope.widgetFileTypeError=true; + $timeout(function(){ + $scope.widgetFileTypeError=false; + }, 5000); + } + } + }; // file change handler + init(); $scope.$on('$stateChangeStart', e => { e.preventDefault(); }); } } - WidgetOnboardingDetailsModalCtrl.$inject = ['$scope', '$log', '$interval', 'applicationsService', 'adminsService', 'microserviceService', 'widgetsCatalogService', 'errorMessageByCode', 'ECOMP_URL_REGEX', '$window','userProfileService', 'confirmBoxService', '$cookies','items']; + WidgetOnboardingDetailsModalCtrl.$inject = ['$scope', '$timeout', '$log', '$interval', 'applicationsService', 'adminsService', 'microserviceService', 'widgetsCatalogService', 'errorMessageByCode', 'ECOMP_URL_REGEX', '$window','userProfileService', 'confirmBoxService', '$cookies','items']; angular.module('ecompApp').controller('WidgetOnboardingDetailsModalCtrl', WidgetOnboardingDetailsModalCtrl); + + angular.module('ecompApp').directive('fileChange', ['$parse', function($parse){ + return { + require: 'ngModel', + restrict: 'A', + link : function($scope, element, attrs, ngModel) { + var attrHandler = $parse(attrs['fileChange']); + var handler=function(e) { + $scope.$apply(function() { + attrHandler($scope, { $event:e, files:e.target.files } ); + }); + }; + element[0].addEventListener('change',handler,false); + } + } + }]); })(); diff --git a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.modal.html b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.modal.html index ade07b95..3526ce0c 100644 --- a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.modal.html +++ b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-details-dialog/widget-details.modal.html @@ -150,8 +150,13 @@
- + class="widget-onboarding-details-upload-file ht" + ng-model="widgetDetails.widgetFile" + file-change="widgetFileHandler($event,files)"/> +
+
File must be .zip
+
-- cgit 1.2.3-korg