From 99565bb6bd87cfc46591cea73985c58c3a3697dd Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Mon, 10 Jul 2017 14:04:15 -0400 Subject: [PORTAL-20,PORTAL-23,PORTAL-32] Repair defects PORTAL-20: remove mariadb client reference from be-common pom PORTAL-23: Release Portal's SDK version 1.1.0 PORTAL-32: API URL correction for onboarded Apps Change-Id: If75b54ca9202f94ce63c59343b94384da1040912 Signed-off-by: Christopher Lott (cl778h) --- .../add-catalog-dialogs/new-catalog.modal.less | 125 --- .../client/app/views/catalog/catalog.controller.js | 16 +- .../client/app/views/catalog/catalog.tpl.html | 14 +- .../app/views/catalog/information-box.tpl.html | 12 +- .../app/views/dashboard/dashboard.controller.js | 990 ++++++++++----------- .../client/app/views/header/header.controller.js | 81 +- .../client/app/views/header/header.tpl.html | 61 +- .../support/get-access/get-access.controller.js | 24 +- .../views/support/get-access/get-access.tpl.html | 4 +- .../users/new-user-dialogs/bulk-user.controller.js | 2 +- .../widget-onboarding.controller.js | 9 +- 11 files changed, 541 insertions(+), 797 deletions(-) delete mode 100644 ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less (limited to 'ecomp-portal-FE-common/client/app/views') diff --git a/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less b/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less deleted file mode 100644 index 5568ca8e..00000000 --- a/ecomp-portal-FE-common/client/app/views/catalog/add-catalog-dialogs/new-catalog.modal.less +++ /dev/null @@ -1,125 +0,0 @@ -.new-catalog-modal { - height: 430px; - - .user-catalog-roles{ - .title{ - //.n18r; - .dGray18r; //AT&T Dark Gray - border-bottom: @portalDBlue 3px solid; - } - - input:not([type="button"]) { - height: 13px; -} - .display-userApp-Catalog-Roles - { - padding-left: 16px; - padding-top: 10px; - font-family: Omnes-ECOMP-W02,Arial; - font-size: 18px; - color: #5a5a5a; - } - - #pending-checkbox{ - font-family: Omnes-ECOMP-W02,Arial; - font-size: 15px; - color: #5a5a5a; - } - .app-catalog-roles-list{ - height: 286px; - - - .app-catalog-item{ - border: 1px solid @portalLGray; - border-radius: 2px; - background-color: @funcBkgGray; - - padding: 10px; - margin-top: 8px; - //margin-right: 6px; - //margin-left: 6px; - - .app-catalog-item-left{ - padding-top: 0; - line-height: 30px; - height: 30px; - vertical-align: middle; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - margin-right: 10px; - padding-left: 4px; - background: @portalWhite; - white-space: nowrap; - - } - .app-catalog-item-right{ - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-catalog-item-right-error{ - .portalRed; - padding: 7px 7px 7px 7px; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-catalog-item-right-contacting{ - .portalGreen; - padding: 7px 7px 7px 7px; - display:inline-block; - width: 45%; - border-radius: 2px; - border: 1px solid @portalLGray; - background: @portalWhite; - vertical-align: middle; - } - - .app-select-left{ - width: 45%; - margin-right: 10px; - vertical-align: middle; - - - .select-field{ - padding-top: 0; - line-height: 30px; - height: 30px; - vertical-align: middle; - border-radius: 2px; - border: 1px solid @portalLGray; - margin-right: 10px; - padding-left: 4px; - background: @portalWhite; - display:inline-block; - } - } - - - .app-item-delete{ - .ico_trash_default; - display: inline-block; - vertical-align: 2px; - cursor: pointer; - position: relative; - top: 6px; - color: transparent; - margin-left: 8px; - - } - - } - } - - } -} diff --git a/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js b/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js index 150a305e..1685c133 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js +++ b/ecomp-portal-FE-common/client/app/views/catalog/catalog.controller.js @@ -60,6 +60,13 @@ function _classCallCheck(instance, Constructor) { getExternalAccess(); }; + this.getAccess = function(item) { + if(!item.access) + confirmBoxService.showDynamicInformation(item, + 'app/views/catalog/information-box.tpl.html','CatalogConfirmationBoxCtrl' + ).then(isConfirmed => {}); + }; + var getExternalAccess = () => { ExternalRequestAccessService.getExternalRequestAccessServiceInfo().then( function(property) { @@ -125,19 +132,18 @@ function _classCallCheck(instance, Constructor) { data = { dialogState: 2, selectedUser:{ - attuid: $scope.attuid, + orgUserId: $scope.orgUserId, firstName: $scope.firstName, lastName: $scope.lastName, headerText: item.headerText, haloAppName : item.mlAppName, item: item, - extReqValue : externalRequest } } ngDialog.open({ - templateUrl: 'app/views/catalog/add-catalog-dialogs/new-catalog.modal.html', - controller: 'NewCatalogModalCtrl', + templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html', + controller: 'ExternalRequestAccessCtrl', controllerAs: 'userInfo', data: data }).closePromise.then(needUpdate => { @@ -183,7 +189,7 @@ function _classCallCheck(instance, Constructor) { .getUserProfile() .then( function(profile) { - $scope.attuid = profile.orgUserId; + $scope.orgUserId = profile.orgUserId; $scope.firstName = profile.firstName; $scope.lastName = profile.lastName; $scope.appCatalog = []; diff --git a/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html b/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html index b4063ad6..fd71e59b 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/catalog/catalog.tpl.html @@ -58,18 +58,8 @@ - -
-
+ +
diff --git a/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html b/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html index 8a848545..2802dac4 100644 --- a/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/catalog/information-box.tpl.html @@ -21,17 +21,9 @@
- You do not have access to this application. - See the + You do not have access to this application. To request access to an application, please visit the - Get Access page and request access at MyLogins. -

- You may check this box if access is pending: - + Get Access page
diff --git a/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js b/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js index 87558fa8..8481b5ed 100644 --- a/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js +++ b/ecomp-portal-FE-common/client/app/views/dashboard/dashboard.controller.js @@ -20,506 +20,506 @@ 'use strict'; function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } } (function() { - var HTTP_PROTOCOL_RGX = /https?:\/\//; - - var DashboardCtrl = function DashboardCtrl(conf, applicationsService, $log, - $window, userProfileService, $scope, $cookies, $timeout, $interval, - $modal, $state, beReaderService, dashboardService, confirmBoxService, - auditLogService,ngDialog, $compile, widgetsCatalogService) { - - this.conf = conf; - var _this = this; - - _classCallCheck(this, DashboardCtrl); - - // activate spinner - this.isLoading = true; - this.isCommError = false; - $scope.getUserAppsIsDone = false; - this.userProfileService = userProfileService; - $scope.demoNum = 1; - $scope.event_content_show = false; - $scope.widgetData = []; - $scope.activateThis = function(ele){ - $compile(ele.contents())($scope); - $scope.$apply(); - }; - - $scope.editWidgetModalPopup = function(availableData, resourceType) { - $scope.editData = JSON.stringify(availableData); - $scope.availableDataTemp = $scope.availableData; - ngDialog.open({ - templateUrl : 'app/views/dashboard/dashboard-widget-manage.html', - controller : 'CommonWidgetController', - resolve : { - message : function message() { - var message = { - type : resourceType, - availableData : $scope.editData - }; - return message; - } - } - }).closePromise.then(needUpdate => { - if(resourceType=='NEWS'){ - $scope.updateNews(); - }else if(resourceType=='EVENTS'){ - $scope.updateEvents(); - }else if(resourceType=='IMPORTANTRESOURCES'){ - $scope.updateImportRes(); - } - }); - }; - - $scope.editWidgetParameters = function(widgetId) { - let data = { - widgetId: widgetId + var HTTP_PROTOCOL_RGX = /https?:\/\//; + + var DashboardCtrl = function DashboardCtrl(conf, applicationsService, $log, + $window, userProfileService, $scope, $cookies, $timeout, $interval, + $modal, $state, beReaderService, dashboardService, confirmBoxService, + auditLogService, ngDialog, $compile, widgetsCatalogService) { + + this.conf = conf; + var _this = this; + + _classCallCheck(this, DashboardCtrl); + + // activate spinner + this.isLoading = true; + this.isCommError = false; + $scope.getUserAppsIsDone = false; + this.userProfileService = userProfileService; + $scope.demoNum = 1; + $scope.event_content_show = false; + $scope.widgetData = []; + $scope.activateThis = function(ele) { + $compile(ele.contents())($scope); + $scope.$apply(); + }; + + $scope.editWidgetModalPopup = function(availableData, resourceType) { + $scope.editData = JSON.stringify(availableData); + $scope.availableDataTemp = $scope.availableData; + ngDialog.open({ + templateUrl: 'app/views/dashboard/dashboard-widget-manage.html', + controller: 'CommonWidgetController', + resolve: { + message: function message() { + var message = { + type: resourceType, + availableData: $scope.editData + }; + return message; + } + } + }).closePromise.then(needUpdate => { + if (resourceType == 'NEWS') { + $scope.updateNews(); + } else if (resourceType == 'EVENTS') { + $scope.updateEvents(); + } else if (resourceType == 'IMPORTANTRESOURCES') { + $scope.updateImportRes(); + } + }); + }; + + $scope.editWidgetParameters = function(widgetId) { + let data = { + widgetId: widgetId + } + ngDialog.open({ + templateUrl: 'app/views/dashboard/dashboard-widget-parameter-manage.html', + controller: 'WidgetParameterController', + data: data + }).closePromise.then(needUpdate => { + + }); + }; + + $scope.sort_options = [{ + index: 0, + value: 'N', + title: 'Name' + }, + { + index: 1, + value: 'L', + title: 'Last used' + }, + { + index: 2, + value: 'F', + title: 'Most used' + }, + { + index: 3, + value: 'M', + title: 'Manual' + } + ]; + + $scope.selectedSortTypeChanged = function(userAppSortTypePref) { + $scope.appsViewData = []; + $scope.appsView = []; + + $scope.sort_type = userAppSortTypePref; + + applicationsService + .getAppsOrderBySortPref(userAppSortTypePref) + .then(function(res) { + _this.apps = res; + $scope.applyPresentationDetailsToApps(_this.apps); + }) + applicationsService + .saveAppsSortTypePreference($scope.selectedSortType) + .then(function(res) { + // Nothing to do + }) + + } + $scope.$watch('selectedSortType.value', (newVal, oldVal) => { + for (var i = 0; i < $scope.sort_options.length; i++) { + if ($scope.sort_options[i].value == newVal) { + $scope.selectedSortType = angular.copy($scope.sort_options[i]);; + } } - ngDialog.open({ - templateUrl : 'app/views/dashboard/dashboard-widget-parameter-manage.html', - controller : 'WidgetParameterController', - data: data - }).closePromise.then(needUpdate => { - - }); - }; - - $scope.sort_options = [ - {index: 0, value: 'N', title: 'Name'}, - {index: 1, value: 'L', title: 'Last used'}, - {index: 2, value: 'F', title: 'Most used'}, - {index: 3, value: 'M', title: 'Manual'} - ]; - - $scope.selectedSortTypeChanged = function(userAppSortTypePref) { - $scope.appsViewData = []; - $scope.appsView = []; - - $scope.sort_type = userAppSortTypePref; - - applicationsService - .getAppsOrderBySortPref(userAppSortTypePref) - .then(function(res) { - _this.apps = res; - $scope.applyPresentationDetailsToApps(_this.apps); - }) - applicationsService - .saveAppsSortTypePreference($scope.selectedSortType) - .then(function(res) { - // Nothing to do - }) - - } - $scope.$watch('selectedSortType.value', (newVal, oldVal) => { - for(var i=0;i<$scope.sort_options.length;i++){ - if($scope.sort_options[i].value==newVal){ - $scope.selectedSortType=angular.copy($scope.sort_options[i]);; - } - } - }); - - $scope.restoreSortSelected = function(){ - confirmBoxService.confirm("Restore the default size and position of all widgets?").then( - function(confirmed){ - var checkConfirm = confirmed; - if(checkConfirm === true){ - applicationsService - .delWidgetsSortPref($scope.widgetsViewData).then(function(){ - $state.reload(); - }); - } - }); - /* if(confirm('Restore the default size and position of all widgets?') == true) - { - applicationsService - .delWidgetsSortPref($scope.widgetsViewData).then(function(){ - $state.reload(); - }) - }*/ - - } - - $scope.applyPresentationDetailsToApps = function(appsReturned) { - var rowNo = 0; - for (var i = 0; i < _this.apps.length; i++) { - $scope.appsView[i] = { - sizeX : 1, - sizeY : 1, - headerText : '', - subHeaderText : '', - imageLink : '', - order : '', - url : '', - appid: '', - }; - $scope.appsView[i].headerText = appsReturned[i].name; - $scope.appsView[i].subHeaderText = appsReturned[i].notes; - let imgLnk = ''; - if (appsReturned[i].imageUrl) - imgLnk = conf.api.appThumbnail.replace(':appId', appsReturned[i].id); - //$log.debug('DashboardCtlr::applyPresn: imgLink = ' + imgLnk); - $scope.appsView[i].imageLink = imgLnk; - $scope.appsView[i].order = appsReturned[i].order; - $scope.appsView[i].url = appsReturned[i].url; - $scope.appsView[i].restrictedApp = appsReturned[i].restrictedApp; - $scope.appsView[i].appid = appsReturned[i].id; - } - $scope.appsView[_this.apps.length] = { - addRemoveApps : true, - sizeX : 1, - sizeY : 1, - headerText : 'Add/Remove Applications', - subHeaderText : '', - imageLink : 'assets/images/cloud.png', - order : '', - restrictedApp : false, - url : '', - }; - if($scope.appsView.length>6){ - $(".dashboard-boarder").css({ - "height" : "400px" - }); - }else{ - $(".dashboard-boarder").css({ - "height" : "210px" - }); - } - - if ($scope.appsView != undefined - && $scope.appsView != null - && $scope.appsView.length > 0) { - $scope.appsViewData = $scope.appsView; - } - } - -$scope.widgetsView = []; - - $scope.applyPresentationDetailsToWidgets = function(widgetsReturned){ - var rowNo = 0; - for (var i = 0; i < widgetsReturned.length; i++) { - $scope.widgetsView[i] = { - sizeX : '', - sizeY :'', - headerText:'', - widgetText:'', - widgetIdentifier : '', - url : '', - widgetid: '', - attrb:'', - row:'', - col:'', - }; - $scope.widgetsView[i].widgetid = widgetsReturned[i].id; - $scope.widgetsView[i].headerText = widgetsReturned[i].headerName; - $scope.widgetsView[i].widgetText = widgetsReturned[i].name; - - if(widgetsReturned[i].headerName.toLowerCase() === 'news'){ - $scope.widgetsView[i].widgetIdentifier = 'NEWS'; - } - else - if(widgetsReturned[i].headerName.toLowerCase() === 'resources'){ - $scope.widgetsView[i].widgetIdentifier = 'IMPORTANTRESOURCES'; - } - else - if(widgetsReturned[i].headerName.toLowerCase() === 'events'){ - $scope.widgetsView[i].widgetIdentifier = 'EVENTS'; - } - - $scope.widgetsView[i].url = widgetsReturned[i].url; - $scope.widgetsView[i].attrb = widgetsReturned[i].attrs; - if(widgetsReturned[i].width === null){ - $scope.widgetsView[i].sizeX = 2; - }else{ - $scope.widgetsView[i].sizeX = widgetsReturned[i].width; - } - if(widgetsReturned[i].height === null){ - $scope.widgetsView[i].sizeY = 2; - }else{ - $scope.widgetsView[i].sizeY = widgetsReturned[i].height; - } - $scope.widgetsView[i].row = widgetsReturned[i].x; - $scope.widgetsView[i].col = widgetsReturned[i].y; - } - if ($scope.widgetsView != undefined - && $scope.widgetsView != null - && $scope.widgetsView.length > 0) { - $scope.widgetsViewData = $scope.widgetsView; - } - } - - applicationsService - .getUserAppsSortTypePreference().then(function(res) { - var resJson = {}; - resJson.value = res; - if (resJson.value==="N" || resJson.value==="") { - resJson.index = 0; - resJson.title = 'Name'; - }else if (resJson.value==="L") { - resJson.index = 1; - resJson.title = 'Last used'; - }else if(resJson.value==="F"){ - resJson.index = 2; - resJson.title = 'Most used'; - }else { - resJson.index = 3; - resJson.title = 'Manual'; - } - $scope.selectedSortType = resJson; - $scope.selectedSortTypeChanged(res); - - - }); - - $scope.widgetsList = []; - - let getUserWidgets = (loginName) => { - var conf = this.conf; - widgetsCatalogService.getUserWidgets(loginName).then(res => { - if(!(res instanceof Array)){ - this.isCommError = true; - return; - } - for(var i = 0; i < res.length; i++){ - var widget_id = res[i][0]; - var widget_name = res[i][1]; - let url = this.conf.api.widgetCommon + "/" + widget_id + "/framework.js"; - var header_name = widget_name; - if(res[i][7] == 1){ - header_name = (widget_name.length > 9) ?widget_name.substring(0, 8) + '...' : widget_name; - } - if(res[i][4] === "S" || res[i][4] === null ){ - $scope.widgetsList.push({ - id: widget_id, - headerName: header_name, - name: widget_name, - url: url, - attrs: [{attr: 'data-' + res[i][0], value: ''}], - x: res[i][3], - y: res[i][5], - height: res[i][6], - width: res[i][7] - }); - } - var script = document - .createElement('script'); - script.src = url; - script.async = false; - var entry = document - .getElementsByTagName('script')[0]; - entry.parentNode - .insertBefore(script, entry); - } - $scope.applyPresentationDetailsToWidgets($scope.widgetsList); - }).catch(err => { - $log.error('WidgetsHomeCtrl::getUserWidgets error: ' + err); - }).finally(()=> { - }); - }; - - userProfileService.getUserProfile().then( - function(profile) { - $scope.orgUserId = profile.orgUserId; - getUserWidgets($scope.orgUserId); - }); - - /* Widget Gridster Section */ - $scope.newsGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'News', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - $scope.eventsGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'Events', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - $scope.impoResGridsterItem = { - sizeX : 1, - sizeY : 1, - headerText : 'Resources', - subHeaderText : '', - imageLink : '', - order : '', - url : '' - }; - - this.gridsterAppOpts = { - columns : 6, - colWidth : 190, - rowHeight : 190, - margins : [ 20, 20 ], - outerMargin : true, - pushing : true, - floating : true, - swapping : true, - resizable: { - enabled: false, - }, - draggable : { - handle:'.icon-content-gridguide', - stop: function stop() { - $scope.defaultSortBy = function() { - var resJson = {}; - resJson.value = 'M'; - resJson.index = 3; - resJson.title = 'Manual'; - $scope.selectedSortType = resJson; - applicationsService.saveAppsSortTypeManual($scope.appsViewData) - applicationsService.saveAppsSortTypePreference($scope.selectedSortType) - } - $scope.defaultSortBy(); - } - } - }; - - this.gridsterWidgetOpts = { - columns : 6, - colWidth : 190, - rowHeight : 190, - margins : [ 20, 20 ], - outerMargin : true, - pushing : true, - floating : true, - swapping : true, - resizable: { - enabled: true, - stop: function stop(event, uiWidget, $element){ - if($element.sizeX == 1) - $element.headerText = ($element.widgetText.length > 9) ? $element.widgetText.substring(0, 8) + '...' : $element.widgetText; - if($element.sizeX >= 2) - $element.headerText = $element.widgetText; - - applicationsService - .saveWidgetsSortManual($scope.widgetsViewData) - - } - }, - draggable : { - handle:'.icon-content-gridguide', - stop: function stop(){ - applicationsService - .saveWidgetsSortManual($scope.widgetsViewData) - - } - } - }; - - this.goToCatalog = function(item) { - $state.go('root.appCatalog'); - } - - this.goToWidgetCatLog = function(item) { - $state.go('root.widgetCatalog'); - } - - // navigate to application url in new tab - this.goToPortal = function(item) { - userProfileService.getUserRolesForApplication($scope.orgUserId,item.appid) - .then(res=>{ - var count = 0; - for(var i=0;i0 && res.length == count)||res.length==0) - { - confirmBoxService.showInformation('You have no roles assigned to this application to access.').then(isConfirmed => {}); - - } - else{ - if (!item.url) { - $log.error('No URL found for this application, doing nothing!'); - return; - } - if (item.restrictedApp) { - // Link-based apps open in their own browser tab - $window.open(item.url, '_blank'); - } else { - // cache control so browsers load app page every time - var ccParam = 'cc=' + new Date().getTime(); - var urlParts = item.url.split('#'); - var appUrl = null; - if (urlParts.length < 2) { - // no # - let urlLastChar = item.url.charAt(item.url.length - 1); - if (item.url.includes("?")) - appUrl = (urlLastChar === '&' ? item.url + ccParam : item.url + '&' + ccParam); - else - appUrl = item.url + '?' + ccParam; - } else { - // has # - let urlLastChar = urlParts[0].charAt(urlParts[0].length - 1); - if (item.url.includes("?")) - appUrl = (urlLastChar === '&' ? urlParts[0] + ccParam + '#' + urlParts[1] : urlParts[0] + '&' + ccParam + '#' + urlParts[1]); - else - appUrl = urlParts[0] + '?' + ccParam + "#" + urlParts[1]; - } - // $log.debug('DashboardCtrlr::goToPortal: opening tab with URL - // ' + appUrl); - var tabContent = { - id: new Date(), - title: item.headerText, - url: appUrl, - appId: item.appId - }; - $cookies.putObject('addTab', tabContent); - } - - } - }); - - - - - }; - - this.auditLog = function(app) { - console.log(app); - auditLogService.storeAudit(app.appid,'app',app.url); - }; - - if (getParameterByName('noUserError') != null) { - if (getParameterByName('noUserError') == "Show") { - $("#errorInfo").show(); - } - } - }; - - DashboardCtrl.$inject = [ 'conf', 'applicationsService', '$log', '$window', - 'userProfileService', '$scope', '$cookies', '$timeout', '$interval', - '$modal', '$state', 'beReaderService', 'dashboardService', 'confirmBoxService', - 'auditLogService', 'ngDialog', '$compile', 'widgetsCatalogService' ]; - angular.module('ecompApp').controller('DashboardCtrl', DashboardCtrl); + + $scope.restoreSortSelected = function() { + confirmBoxService.confirm("Restore the default size and position of all widgets?").then( + function(confirmed) { + var checkConfirm = confirmed; + if (checkConfirm === true) { + applicationsService + .delWidgetsSortPref($scope.widgetsViewData).then(function() { + $state.reload(); + }); + } + }); + /* + * if(confirm('Restore the default size and position of all widgets?') == + * true) { applicationsService + * .delWidgetsSortPref($scope.widgetsViewData).then(function(){ + * $state.reload(); }) } + */ + + } + + $scope.applyPresentationDetailsToApps = function(appsReturned) { + var rowNo = 0; + for (var i = 0; i < _this.apps.length; i++) { + $scope.appsView[i] = { + sizeX: 1, + sizeY: 1, + headerText: '', + subHeaderText: '', + imageLink: '', + order: '', + url: '', + appid: '', + }; + $scope.appsView[i].headerText = appsReturned[i].name; + $scope.appsView[i].subHeaderText = appsReturned[i].notes; + let imgLnk = ''; + if (appsReturned[i].imageUrl) + imgLnk = conf.api.appThumbnail.replace(':appId', appsReturned[i].id); + // $log.debug('DashboardCtlr::applyPresn: imgLink = ' + imgLnk); + $scope.appsView[i].imageLink = imgLnk; + $scope.appsView[i].order = appsReturned[i].order; + $scope.appsView[i].url = appsReturned[i].url; + $scope.appsView[i].restrictedApp = appsReturned[i].restrictedApp; + $scope.appsView[i].appid = appsReturned[i].id; + } + $scope.appsView[_this.apps.length] = { + addRemoveApps: true, + sizeX: 1, + sizeY: 1, + headerText: 'Add/Remove Applications', + subHeaderText: '', + imageLink: 'assets/images/cloud.png', + order: '', + restrictedApp: false, + url: '', + }; + if ($scope.appsView.length > 6) { + $(".dashboard-boarder").css({ + "height": "400px" + }); + } else { + $(".dashboard-boarder").css({ + "height": "210px" + }); + } + + if ($scope.appsView != undefined && + $scope.appsView != null && + $scope.appsView.length > 0) { + $scope.appsViewData = $scope.appsView; + } + } + + $scope.widgetsView = []; + + $scope.applyPresentationDetailsToWidgets = function(widgetsReturned) { + var rowNo = 0; + for (var i = 0; i < widgetsReturned.length; i++) { + $scope.widgetsView[i] = { + sizeX: '', + sizeY: '', + headerText: '', + widgetText: '', + widgetIdentifier: '', + url: '', + widgetid: '', + attrb: '', + row: '', + col: '', + }; + $scope.widgetsView[i].widgetid = widgetsReturned[i].id; + $scope.widgetsView[i].headerText = widgetsReturned[i].headerName; + $scope.widgetsView[i].widgetText = widgetsReturned[i].name; + + if (widgetsReturned[i].headerName.toLowerCase() === 'news') { + $scope.widgetsView[i].widgetIdentifier = 'NEWS'; + } else + if (widgetsReturned[i].headerName.toLowerCase() === 'resources') { + $scope.widgetsView[i].widgetIdentifier = 'IMPORTANTRESOURCES'; + } else + if (widgetsReturned[i].headerName.toLowerCase() === 'events') { + $scope.widgetsView[i].widgetIdentifier = 'EVENTS'; + } + + $scope.widgetsView[i].url = widgetsReturned[i].url; + $scope.widgetsView[i].attrb = widgetsReturned[i].attrs; + if (widgetsReturned[i].width === null) { + $scope.widgetsView[i].sizeX = 2; + } else { + $scope.widgetsView[i].sizeX = widgetsReturned[i].width; + } + if (widgetsReturned[i].height === null) { + $scope.widgetsView[i].sizeY = 2; + } else { + $scope.widgetsView[i].sizeY = widgetsReturned[i].height; + } + $scope.widgetsView[i].row = widgetsReturned[i].x; + $scope.widgetsView[i].col = widgetsReturned[i].y; + } + if ($scope.widgetsView != undefined && + $scope.widgetsView != null && + $scope.widgetsView.length > 0) { + $scope.widgetsViewData = $scope.widgetsView; + } + } + + applicationsService + .getUserAppsSortTypePreference().then(function(res) { + var resJson = {}; + resJson.value = res; + if (resJson.value === "N" || resJson.value === "") { + resJson.index = 0; + resJson.title = 'Name'; + } else if (resJson.value === "L") { + resJson.index = 1; + resJson.title = 'Last used'; + } else if (resJson.value === "F") { + resJson.index = 2; + resJson.title = 'Most used'; + } else { + resJson.index = 3; + resJson.title = 'Manual'; + } + $scope.selectedSortType = resJson; + $scope.selectedSortTypeChanged(res); + + + }); + + $scope.widgetsList = []; + + let getUserWidgets = (loginName) => { + var conf = this.conf; + widgetsCatalogService.getUserWidgets(loginName).then(res => { + if (!(res instanceof Array)) { + this.isCommError = true; + return; + } + for (var i = 0; i < res.length; i++) { + var widget_id = res[i][0]; + var widget_name = res[i][1]; + let url = this.conf.api.widgetCommon + "/" + widget_id + "/framework.js"; + var header_name = widget_name; + if (res[i][7] == 1) { + header_name = (widget_name.length > 9) ? widget_name.substring(0, 8) + '...' : widget_name; + } + if (res[i][4] === "S" || res[i][4] === null) { + $scope.widgetsList.push({ + id: widget_id, + headerName: header_name, + name: widget_name, + url: url, + attrs: [{ + attr: 'data-' + res[i][0], + value: '' + }], + x: res[i][3], + y: res[i][5], + height: res[i][6], + width: res[i][7] + }); + } + var script = document + .createElement('script'); + script.src = url; + script.async = false; + var entry = document + .getElementsByTagName('script')[0]; + entry.parentNode + .insertBefore(script, entry); + } + $scope.applyPresentationDetailsToWidgets($scope.widgetsList); + }).catch(err => { + $log.error('WidgetsHomeCtrl::getUserWidgets error: ' + err); + }).finally(() => { + + }); + }; + + userProfileService.getUserProfile().then( + function(profile) { + $scope.orgUserId = profile.orgUserId; + getUserWidgets($scope.orgUserId); + }); + + /* Widget Gridster Section */ + $scope.newsGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'News', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + $scope.eventsGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'Events', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + $scope.impoResGridsterItem = { + sizeX: 1, + sizeY: 1, + headerText: 'Resources', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + + this.gridsterAppOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + resizable: { + enabled: false, + }, + draggable: { + handle: '.icon-content-gridguide', + stop: function stop() { + $scope.defaultSortBy = function() { + var resJson = {}; + resJson.value = 'M'; + resJson.index = 3; + resJson.title = 'Manual'; + $scope.selectedSortType = resJson; + applicationsService.saveAppsSortTypeManual($scope.appsViewData) + applicationsService.saveAppsSortTypePreference($scope.selectedSortType) + } + $scope.defaultSortBy(); + } + } + }; + + this.gridsterWidgetOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + resizable: { + enabled: true, + stop: function stop(event, uiWidget, $element) { + if ($element.sizeX == 1) + $element.headerText = ($element.widgetText.length > 9) ? $element.widgetText.substring(0, 8) + '...' : $element.widgetText; + if ($element.sizeX >= 2) + $element.headerText = $element.widgetText; + + applicationsService + .saveWidgetsSortManual($scope.widgetsViewData) + + } + }, + draggable: { + handle: '.icon-content-gridguide', + stop: function stop() { + applicationsService + .saveWidgetsSortManual($scope.widgetsViewData) + + } + } + }; + + this.goToCatalog = function(item) { + $state.go('root.appCatalog'); + } + + this.goToWidgetCatLog = function(item) { + $state.go('root.widgetCatalog'); + } + + // navigate to application url in new tab + this.goToPortal = function(item) { + + if (!item.url) { + $log.error('No URL found for this application, doing nothing!'); + return; + } + if (item.restrictedApp) { + // Link-based apps open in their own browser tab + $window.open(item.url, '_blank'); + } else { + // cache control so browsers load app page every + // time + var ccParam = 'cc=' + new Date().getTime(); + var urlParts = item.url.split('#'); + var appUrl = null; + if (urlParts.length < 2) { + // no # + let urlLastChar = item.url.charAt(item.url.length - 1); + if (item.url.includes("?")) + appUrl = (urlLastChar === '&' ? item.url + ccParam : item.url + '&' + ccParam); + else + appUrl = item.url + '?' + ccParam; + } else { + // has # + let urlLastChar = urlParts[0].charAt(urlParts[0].length - 1); + if (item.url.includes("?")) + appUrl = (urlLastChar === '&' ? urlParts[0] + ccParam + '#' + urlParts[1] : urlParts[0] + '&' + ccParam + '#' + urlParts[1]); + else + appUrl = urlParts[0] + '?' + ccParam + "#" + urlParts[1]; + } + // $log.debug('DashboardCtrlr::goToPortal: opening + // tab with URL + // ' + appUrl); + var tabContent = { + id: new Date(), + title: item.headerText, + url: appUrl, + appId: item.appId + }; + $cookies.putObject('addTab', tabContent); + } + + + }; + + this.auditLog = function(app) { + console.log(app); + auditLogService.storeAudit(app.appid, 'app', app.url); + }; + + if (getParameterByName('noUserError') != null) { + if (getParameterByName('noUserError') == "Show") { + $("#errorInfo").show(); + } + } + }; + + DashboardCtrl.$inject = ['conf', 'applicationsService', '$log', '$window', + 'userProfileService', '$scope', '$cookies', '$timeout', '$interval', + '$modal', '$state', 'beReaderService', 'dashboardService', 'confirmBoxService', + 'auditLogService', 'ngDialog', '$compile', 'widgetsCatalogService' + ]; + angular.module('ecompApp').controller('DashboardCtrl', DashboardCtrl); })(); function getParameterByName(name, url) { - if (!url) - url = window.location.href; - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex - .exec(url); - if (!results) - return ''; - if (!results[2]) - return ''; - return results[2].replace(/\+/g, " "); -} + if (!url) + url = window.location.href; + name = name.replace(/[\[\]]/g, "\\$&"); + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), + results = regex + .exec(url); + if (!results) + return ''; + if (!results[2]) + return ''; + return results[2].replace(/\+/g, " "); +} \ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/header/header.controller.js b/ecomp-portal-FE-common/client/app/views/header/header.controller.js index 33cb8454..2eba057c 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.controller.js +++ b/ecomp-portal-FE-common/client/app/views/header/header.controller.js @@ -20,7 +20,7 @@ 'use strict'; (function () { class HeaderCtrl { - constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,recommendationService,ngDialog) { + constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state,auditLogService,notificationService,ngDialog) { this.firstName = ''; this.lastName = ''; this.$log = $log; @@ -33,7 +33,6 @@ $scope.emptyFavorites = false; $scope.favoritesWindow = false; $scope.notificationCount=0; - $scope.recommendationCount=0; $scope.showNotification = true; $scope.hideMenus = false; @@ -47,7 +46,6 @@ }; $scope.megaMenuDataObject =[]; $scope.notificationCount= notificationService.notificationCount; - $scope.recommendationCount= recommendationService.recommendationCount; this.isLoading = true; this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; @@ -474,85 +472,10 @@ } } - class RecommendationCtrl{ - constructor($log, $scope, $cookies, $timeout, sessionService,recommendationService,notificationService,$interval,ngDialog) { - $scope.recommendations=[]; - var intervalPromise = null; - $scope.recommendationCount= recommendationService.recommendationCount; - console.log("$",$); - $scope.getRecommendations = function(){ - $("#recommendation-bulb").removeClass('icon-misc-bulbL').addClass('icon-misc-bulb') - recommendationService.getRecommendations() - - .then(res=> { - $("#recommendation-bulb").removeClass('icon-misc-bulb').addClass('icon-misc-bulbL') - recommendationService.decrementRefreshCount(); - var count = recommendationService.getRefreshCount(); - if ( res.data==null) { - $log.error('RecommendationCtrl::update Recommendation: failed to get recommendation'); - if (intervalPromise != null) - $interval.cancel(intervalPromise); - } else if(count>=0){ - if (intervalPromise != null) - $interval.cancel(intervalPromise); - } else { - $scope.recommendations = []; - recommendationService.setRecommendationCount(res.data.recommendations.length); - for(var i=0;i { - $log.error('RecommendationCtrl::gatRecommendations: caught exception: ' + err); - if (intervalPromise != null) - $interval.cancel(intervalPromise); - }); - } - $scope.getRecommendations(); - - function updateRecommendations() { - $scope.getRecommendations(); - } - - notificationService.getNotificationRate().then(res=> { - if (res == null || res.response == null) { - $log.error('NotificationCtrl: failed to notification update rate or duration, check system.properties file.'); - } else { - var rate = parseInt(res.response.updateRate); - var duration = parseInt(res.response.updateDuration); - notificationService.setMaxRefreshCount(parseInt(duration/rate)+1); - notificationService.setRefreshCount(notificationService.maxCount); - if (rate != NaN && duration != NaN) { - $scope.updateRate=rate; - setInterval(function(){$scope.getRecommendations();},rate); - - } - } - }).catch(err=> { - $log.error('NotificationCtrl: getNotificationRate() failed: ' + err); - }); - $scope.deleteRecommendation = function(index){ - if ($scope.recommendations[index] == null || $scope.recommendations[index] == '') { - $log.error('RecommendationCtrl: failed to delete Recommendation.'); - return; - } - $scope.recommendations.splice(index,1); - recommendationService.setRecommendationCount($scope.recommendations.length); - } - } - } NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','notificationService','$interval','ngDialog']; - RecommendationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout', 'sessionService','recommendationService','notificationService','$interval','ngDialog']; LoginSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService']; - HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','recommendationService','ngDialog']; + HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state','auditLogService','notificationService','ngDialog']; angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl); angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl); angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl); - angular.module('ecompApp').controller('recommendationCtrl', RecommendationCtrl); - })(); diff --git a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html index 3d1d3305..ea7273b9 100644 --- a/ecomp-portal-FE-common/client/app/views/header/header.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/header/header.tpl.html @@ -267,63 +267,10 @@ - - - -
  • - -
    -
    -
    - -
    -
    -
    - -
    -
    -

    Recommendations

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    No New Recommendations

    -
    - -
    -
    -
    -
      -
    • -
      - -
      -
      - - - - -
      - -
    • -
    -
    - -
    - - -
  • +
  • +
    +
  • diff --git a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js index c93d8643..0c43c1fa 100644 --- a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js +++ b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.controller.js @@ -20,36 +20,42 @@ 'use strict'; (function () { class GetAccessCtrl { - constructor($log, $scope, $stateParams, getAccessService, userProfileService, ExternalRequestAccessService, applicationsService, ngDialog) { + constructor($log, $scope, $stateParams, filterFilter, getAccessService, userProfileService, ExternalRequestAccessService, applicationsService, ngDialog) { // $log.debug('GetAccessCtrl: appService param is: ' + applicationsService.goGetAccessAppName); var resultAccessValue = null; - var externalRequest = true; - + $scope.openAppRoleModal = (itemData) => { if(resultAccessValue){ let data = null; data = { dialogState: 2, selectedUser:{ - attuid: $scope.attuid, + orgUserId: $scope.orgUserId, firstName: $scope.firstName, lastName: $scope.lastName, headerText: itemData.app_name, - extReqValue : externalRequest } } ngDialog.open({ - templateUrl: 'app/views/catalog/add-catalog-dialogs/new-catalog.modal.html', - controller: 'NewCatalogModalCtrl', + templateUrl: 'app/views/catalog/request-access-catalog-dialogs/request-access-catalog.modal.html', + controller: 'ExternalRequestAccessCtrl', controllerAs: 'userInfo', data: data }); } } + $scope.$watch('access.searchString', function (searchKey) { + var search = searchKey; + this.totalPage = filterFilter($scope.access.appTable, search); + var resultLen = this.totalPage.length; + $scope.access.totalPage = Math.ceil(resultLen/$scope.access.viewPerPage); + $scope.access.currentPage = 1; + }); + userProfileService.getUserProfile().then( function(profile) { - $scope.attuid = profile.orgUserId; + $scope.orgUserId = profile.orgUserId; $scope.firstName = profile.firstName; $scope.lastName = profile.lastName; }); @@ -120,6 +126,6 @@ init(); } } - GetAccessCtrl.$inject = ['$log', '$scope', '$stateParams', 'getAccessService', 'userProfileService', 'ExternalRequestAccessService','applicationsService', 'ngDialog']; + GetAccessCtrl.$inject = ['$log', '$scope', '$stateParams', 'filterFilter', 'getAccessService', 'userProfileService', 'ExternalRequestAccessService','applicationsService', 'ngDialog']; angular.module('ecompApp').controller('GetAccessCtrl', GetAccessCtrl); })(); diff --git a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html index 08ccbf48..ef0c2428 100644 --- a/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html +++ b/ecomp-portal-FE-common/client/app/views/support/get-access/get-access.tpl.html @@ -50,12 +50,11 @@ + row-repeat="rowData in access.appTable | filter:access.searchString | startFrom:(access.currentPage-1)*access.viewPerPage | limitTo:access.viewPerPage | orderBy:'ecomp_function'" track-by="$index">
    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 e73fe290..8c9420d4 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 @@ -340,7 +340,7 @@ if (prevRow == null || prevRow.orgUserId.toLowerCase() !== uploadRow.orgUserId.toLowerCase()) { if (debug) $log.debug('BulkUserModalCtrl::buildAppRoleChecks: create request for orgUserId ' + uploadRow.orgUserId); - let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId).promise().then( (userAppRolesResult) => { + let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId,true).promise().then( (userAppRolesResult) => { // Reply for unknown user has all defined roles with isApplied=false on each. if (typeof userAppRolesResult[0] !== "undefined") { if (debug) diff --git a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js index 661c63a3..0e7fd9fb 100644 --- a/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js +++ b/ecomp-portal-FE-common/client/app/views/widget-onboarding/widget-onboarding.controller.js @@ -189,9 +189,16 @@ } var a = document.createElement('a'); var blob = new Blob([data], {type: 'application/octet-stream'}); - a.href = URL.createObjectURL(blob); + var url = window.URL.createObjectURL(blob); + a.href = url; a.download = filename; + document.body.appendChild(a); a.click(); + + setTimeout(function(){ + document.body.removeChild(a); + window.URL.revokeObjectURL(url); + }, 100); }); }; -- cgit 1.2.3-korg