diff options
Diffstat (limited to 'ecomp-portal-FE-os/client')
5 files changed, 74 insertions, 20 deletions
diff --git a/ecomp-portal-FE-os/client/configurations/dev.json b/ecomp-portal-FE-os/client/configurations/dev.json index ec7ca82d..c60e9bcd 100644 --- a/ecomp-portal-FE-os/client/configurations/dev.json +++ b/ecomp-portal-FE-os/client/configurations/dev.json @@ -97,7 +97,7 @@ "ecompTitle":"http://localhost:8080/ecompportal/portalApi/ecompTitle", "loggedinUser" : "http://localhost:8080/ecompportal/portalApi/loggedinUser", "modifyLoggedinUser" : "http://localhost:8080/ecompportal/portalApi/modifyLoggedinUser", - "centralizedApps": "http:/localhost:8080/ecompportal/portalApi/centralizedApps", + "centralizedApps": "http://localhost:8080/ecompportal/portalApi/centralizedApps", "uploadRoleFunction":"http://localhost:8080/ecompportal/portalApi/uploadRoleFunction/:appId" }, "cookieDomain": "onap.org" diff --git a/ecomp-portal-FE-os/client/index.html b/ecomp-portal-FE-os/client/index.html index dc2ec2dd..14a36033 100644 --- a/ecomp-portal-FE-os/client/index.html +++ b/ecomp-portal-FE-os/client/index.html @@ -70,6 +70,8 @@ <!-- endbower --> <!-- endbuild --> +<script src="bower_components_external/utils/purify.js"></script> + <!-- kpi dashboard related styles --> <!-- kpi start --> <!-- kpi end --> @@ -120,6 +122,7 @@ var base = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)+1); document.write("<base href='" + base + "' />"); + document.write("<base href='" + DOMPurify.sanitize(base) + "' />"); @@ -163,12 +166,14 @@ <!-- build:js({client,node_modules}) app/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> +<script src="bower_components/es5-shim/es5-shim.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-animate/angular-animate.js"></script> <script src="bower_components/angular-route/angular-route.js"></script> <script src="bower_components/angular-aria/angular-aria.js"></script> <script src="bower_components/angular-messages/angular-messages.js"></script> <script src="bower_components/angular-material/angular-material.js"></script> +<script src="bower_components/json3/lib/json3.js"></script> <script src="bower_components/angular-resource/angular-resource.js"></script> <script src="bower_components/angular-cookies/angular-cookies.js"></script> <script src="bower_components/angular-sanitize/angular-sanitize.js"></script> @@ -282,6 +287,7 @@ <script src="app/views/notification-history/notificationhistory.controller.js"></script> <script src="app/views/portal-admin/new-portal-admin/new-portal-admin.controller.js"></script> <script src="app/views/portal-admin/portal-admin-controller.js"></script> + <script src="app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-controller.js"></script> <script src="app/views/role/role-controller.js"></script> <script src="app/views/role/role-create-edit-popup-controller.js"></script> <script src="app/views/role/role-function-list-controller.js"></script> diff --git a/ecomp-portal-FE-os/client/src/app.js b/ecomp-portal-FE-os/client/src/app.js index a481d867..ec531846 100644 --- a/ecomp-portal-FE-os/client/src/app.js +++ b/ecomp-portal-FE-os/client/src/app.js @@ -55,7 +55,7 @@ var app = angular.module('ecompApp', [ 'oc.lazyLoad', 'b2b.att' ]) - .config(($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider, ngDialogProvider, $controllerProvider, hammerDefaultOptsProvider) => { + .config(($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider, ngDialogProvider, $controllerProvider, hammerDefaultOptsProvider, $sanitizeProvider) => { app.controllerProvider = $controllerProvider; $urlRouterProvider.otherwise('/error404'); $locationProvider.html5Mode(true); @@ -102,13 +102,14 @@ var app = angular.module('ecompApp', [ 'responseError': function (rejection) { $log.error('Interceptor rejection: ' + JSON.stringify(rejection)); var $state = $injector.get('$state'); + var $sanitize = $injector.get('$sanitize'); switch (rejection.status) { case 401: var globalLoginUrl = rejection.headers()['global-login-url']; if (globalLoginUrl) { - window.location = globalLoginUrl + + window.location = $sanitize(globalLoginUrl + (globalLoginUrl.indexOf('?') === -1 ? '?' : '') + - '&retUrl=' + encodeURI(window.location); + '&retUrl=' + encodeURI(window.location)); return; } break; diff --git a/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.controller.js b/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.controller.js index 1a6c5b1a..efd5165a 100644 --- a/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.controller.js +++ b/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.controller.js @@ -38,7 +38,7 @@ 'use strict'; (function () { class AppDetailsModalCtrl { - constructor($scope, $log, applicationsService, errorMessageByCode, + constructor($scope, $log, $timeout, applicationsService, errorMessageByCode, ECOMP_URL_REGEX,userProfileService, $cookies, confirmBoxService,items) { // let emptyImg = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='; // empty image should really be empty, or it causes problems for the back end @@ -173,14 +173,26 @@ this.saveChanges = () => { //if valid.. - if(((angular.isUndefined(this.app.name) || !this.app.name)&&(angular.isUndefined(this.app.url) || !this.app.url) - &&(angular.isUndefined(this.app.username) || !this.app.username)&&(angular.isUndefined(this.app.appPassword) || !this.app.appPassword))) { - confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {}); - return; - }else if(!((angular.isUndefined(this.app.name) || !!this.app.name)&&(angular.isUndefined(this.app.url) || !!this.app.url))){ - confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {}); - return; - } + if(this.app.isCentralAuth){ + //if valid.. + if(((angular.isUndefined(this.app.myLoginsAppName) || !this.app.myLoginsAppName)&&(angular.isUndefined(this.app.myLoginsAppOwner) || !this.app.myLoginsAppOwner)&&(angular.isUndefined(this.app.name) || !this.app.name)&&(angular.isUndefined(this.app.url) || !this.app.url) + &&(angular.isUndefined(this.app.username) || !this.app.username))) { + confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {}); + return; + }else if(!((angular.isUndefined(this.app.name) || !!this.app.name)&&(angular.isUndefined(this.app.url) || !!this.app.url))){ + confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {}); + return; + } + }else{ + if(((angular.isUndefined(this.app.myLoginsAppName) || !this.app.myLoginsAppName)||(angular.isUndefined(this.app.myLoginsAppOwner) || !this.app.myLoginsAppOwner)||(angular.isUndefined(this.app.name) || !this.app.name)||(angular.isUndefined(this.app.url) || !this.app.url) + ||(angular.isUndefined(this.app.username) || !this.app.username)||(angular.isUndefined(this.app.appPassword) || !this.app.appPassword))) { + confirmBoxService.showInformation('Please fill in all required fields along with password as the app is not centralized').then(isConfirmed => {}); + return; + }else if(!((angular.isUndefined(this.app.name) || !!this.app.name)&&(angular.isUndefined(this.app.url) || !!this.app.url))){ + confirmBoxService.showInformation('Please fill in all required fields').then(isConfirmed => {}); + return; + } + } this.isSaving = true; // For a restricted app, null out all irrelevant fields if (this.app.restrictedApp) { @@ -263,6 +275,23 @@ } }; + + // Caches the file name supplied by the event handler. + $scope.appImageHandler = (event, files) => { + if(files[0]){ + var fileName = files[0].name; + var validFormats = ['jpg', 'jpeg', 'bmp', 'gif', 'png']; + //Get file extension + var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); + //Check for valid format + if(validFormats.indexOf(ext) == -1){ + $scope.appImageTypeError=true; + $timeout(function(){ + $scope.appImageTypeError=false; + }, 5000); + } + } + }; // file change handler init(); @@ -293,7 +322,7 @@ }); } } - AppDetailsModalCtrl.$inject = ['$scope', '$log', 'applicationsService', 'errorMessageByCode', + AppDetailsModalCtrl.$inject = ['$scope', '$log', '$timeout', 'applicationsService', 'errorMessageByCode', 'ECOMP_URL_REGEX','userProfileService','$cookies', 'confirmBoxService','items']; angular.module('ecompApp').controller('AppDetailsModalCtrl', AppDetailsModalCtrl); -})();
\ No newline at end of file +})(); diff --git a/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.modal.html b/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.modal.html index 959bb90d..b4251f15 100644 --- a/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.modal.html +++ b/ecomp-portal-FE-os/client/src/views/applications/application-details-dialog/application-details.modal.html @@ -138,7 +138,7 @@ </div> </div> </div> - <div class="property required" + <!-- <div class="property required" ng-show="!appDetails.app.restrictedApp"> <div id="pwd-property-label" class="property-label">Password</div> <input type="password" id="input-mylogins-password" @@ -154,6 +154,12 @@ required</small> </div> </div> + </div> --> + <div class="property" ng-show="!appDetails.app.restrictedApp"> + <div id="pwd-property-label" class="property-label">Password</div> + <input type="password" id="input-mylogins-password" + ng-model="appDetails.app.appPassword" autocomplete="new-password" + name="appPassword" maxlength="256"/> </div> <div class="property" ng-show="!appDetails.app.restrictedApp"> <div id="pwd-property-label" class="property-label">Name @@ -173,15 +179,27 @@ image-upload-resize-max-height="300" image-upload-resize-max-width="360" image-upload-resize-quality="0.7" - image-upload-api="appDetails.imageApi" style="height: 24px;" /> + image-upload-api="appDetails.imageApi" style="height: 24px;" + file-change="appImageHandler($event,files)" /> + <div id="app-error-image-upload-type" class="error-container" + ng-show="appImageTypeError" class="ng-hide"> + <div class="error-container"> + <small id="error-app-invalid-image-size" class="err-message">File must be an image</small> + </div> + </div> + file-change="appImageHandler($event,files)" /> + <div id="app-error-image-upload-type" class="error-container" + ng-show="appImageTypeError" class="ng-hide"> + <div class="error-container"> + <small id="error-app-invalid-image-size" class="err-message">File must be an image</small> + </div> + </div> <div id="app-error-image-upload" class="error-container" ng-show="appForm.appImage.$dirty"> <div ng-messages="appForm.appImage.$error" class="error-container"> - <small id="error-app-invalid-image" class="err-message" - ng-message="mimeType">Uploaded file must be an image</small> <small - id="error-app-invalid-image-size" class="err-message" + <small id="error-app-invalid-image-size" class="err-message" ng-message="imageSize">Image file must be smaller than 1MB</small> </div> |