From 4ad39a5c96dd99acf819ce189b13fec946d7506b Mon Sep 17 00:00:00 2001 From: talasila Date: Tue, 7 Feb 2017 15:03:57 -0500 Subject: Initial OpenECOMP Portal commit Change-Id: I804b80e0830c092e307da1599bd9fbb5c3e2da77 Signed-off-by: talasila --- .../add-admin-dialogs/new-admin.controller.js | 214 ++++++ .../add-admin-dialogs/new-admin.controller.spec.js | 130 ++++ .../admins/add-admin-dialogs/new-admin.modal.html | 66 ++ .../admins/add-admin-dialogs/new-admin.modal.less | 99 +++ .../client/app/views/admins/admins.controller.js | 151 ++++ .../app/views/admins/admins.controller.spec.js | 19 + .../client/app/views/admins/admins.less | 47 ++ .../client/app/views/admins/admins.tpl.html | 82 +++ .../application-details.controller.js | 244 +++++++ .../application-details.controller.spec.js | 19 + .../application-details.modal.html | 183 +++++ .../application-details.modal.less | 122 ++++ .../views/applications/applications.controller.js | 111 +++ .../applications/applications.controller.spec.js | 19 + .../app/views/applications/applications.less | 45 ++ .../app/views/applications/applications.tpl.html | 100 +++ .../client/app/views/catalog/catalog.controller.js | 166 +++++ .../client/app/views/catalog/catalog.less | 439 ++++++++++++ .../client/app/views/catalog/catalog.tpl.html | 91 +++ .../catalog/catalogconfirmation.controller.js | 62 ++ .../app/views/catalog/information-box.tpl.html | 42 ++ .../admin-confirmation-box.tpl.html | 31 + .../confirmation-box.controller.js | 41 ++ .../views/confirmation-box/confirmation-box.less | 53 ++ .../confirmation-box/confirmation-box.tpl.html | 28 + .../dragdrop-confirmation-box.tpl.html | 31 + .../confirmation-box/information-box.tpl.html | 27 + .../views/dashboard/dashboard-widget-manage.html | 152 ++++ .../views/dashboard/dashboard-widget.controller.js | 422 ++++++++++++ .../dashboard/dashboard-widget.controller.less | 101 +++ .../app/views/dashboard/dashboard.controller.js | 312 +++++++++ .../views/dashboard/dashboard.controller.spec.js | 78 +++ .../client/app/views/dashboard/dashboard.less | 766 +++++++++++++++++++++ .../client/app/views/dashboard/dashboard.tpl.html | 346 ++++++++++ .../app/views/dashboard/newsticker.controller.js | 47 ++ .../client/app/views/errors/error.404.tpl.html | 31 + .../client/app/views/errors/error.controller.js | 36 + .../client/app/views/errors/error.tpl.html | 26 + .../client/app/views/footer/footer.controller.js | 49 ++ .../app/views/footer/footer.controller.spec.js | 19 + .../client/app/views/footer/footer.less | 53 ++ .../client/app/views/footer/footer.tpl.html | 36 + .../menu-details.controller.js | 384 +++++++++++ .../menu-details.delete.modal.html | 35 + .../functionalMenu-dialog/menu-details.modal.html | 106 +++ .../functionalMenu-dialog/modal-details.modal.less | 103 +++ .../functionalMenu/functionalMenu.controller.js | 331 +++++++++ .../app/views/functionalMenu/functionalMenu.less | 70 ++ .../views/functionalMenu/functionalMenu.tpl.html | 48 ++ .../app/views/functionalMenu/jqTreeContextMenu.js | 192 ++++++ .../client/app/views/header/header.controller.js | 419 +++++++++++ .../app/views/header/header.controller.spec.js | 19 + .../client/app/views/header/header.less | 380 ++++++++++ .../client/app/views/header/header.tpl.html | 277 ++++++++ .../views/header/user-edit/edit-user.controller.js | 134 ++++ .../app/views/header/user-edit/edit-user.less | 61 ++ .../app/views/header/user-edit/edit-user.tpl.html | 69 ++ .../applications-home.controller.js | 244 +++++++ .../applications-home.controller.spec.js | 77 +++ .../home/applications-home/applications-home.less | 164 +++++ .../applications-home/applications-home.tpl.html | 59 ++ .../home/widgets-home/widgets-home.controller.js | 284 ++++++++ .../widgets-home/widgets-home.controller.spec.js | 1 + .../app/views/home/widgets-home/widgets-home.less | 137 ++++ .../views/home/widgets-home/widgets-home.tpl.html | 123 ++++ .../new-portal-admin.controller.js | 85 +++ .../new-portal-admin.controller.spec.js | 19 + .../new-portal-admin/new-portal-admin.modal.html | 32 + .../new-portal-admin/new-portal-admin.modal.less | 99 +++ .../views/portal-admin/portal-admin-controller.js | 127 ++++ .../app/views/portal-admin/portal-admin.tpl.html | 73 ++ .../app/views/portal-admin/portal-admins.less | 56 ++ .../client/app/views/search/search.controller.js | 184 +++++ .../app/views/search/search.controller.spec.js | 19 + .../client/app/views/search/search.less | 55 ++ .../client/app/views/search/search.tpl.html | 82 +++ .../client/app/views/sidebar/sidebar.controller.js | 143 ++++ .../client/app/views/sidebar/sidebar.less | 37 + .../client/app/views/sidebar/sidebar.tpl.html | 20 + .../contact-us-manage.controller.js | 194 ++++++ .../contact-us-manage.controller.less | 159 +++++ .../contact-us-manage/contact-us-manage.html | 136 ++++ .../support/contact-us/contact-us.controller.js | 166 +++++ .../contact-us/contact-us.controller.spec.js | 19 + .../app/views/support/contact-us/contact-us.less | 104 +++ .../views/support/contact-us/contact-us.tpl.html | 125 ++++ .../support/get-access/get-access.controller.js | 70 ++ .../get-access/get-access.controller.spec.js | 19 + .../app/views/support/get-access/get-access.less | 67 ++ .../views/support/get-access/get-access.tpl.html | 88 +++ .../client/app/views/tabs/tabframe.html | 22 + .../client/app/views/tabs/tabs.controller.js | 231 +++++++ .../client/app/views/tabs/tabs.controller.spec.js | 80 +++ ecomp-portal-FE/client/app/views/tabs/tabs.less | 658 ++++++++++++++++++ .../client/app/views/tabs/tabs.tpl.html | 46 ++ .../client/app/views/userbar/userbar.controller.js | 262 +++++++ .../client/app/views/userbar/userbar.less | 41 ++ .../client/app/views/userbar/userbar.tpl.html | 20 + .../users/new-user-dialogs/new-user.controller.js | 211 ++++++ .../new-user-dialogs/new-user.controller.spec.js | 222 ++++++ .../users/new-user-dialogs/new-user.modal.html | 70 ++ .../users/new-user-dialogs/new-user.modal.less | 126 ++++ .../client/app/views/users/users.controller.js | 187 +++++ .../app/views/users/users.controller.spec.js | 19 + ecomp-portal-FE/client/app/views/users/users.less | 59 ++ .../client/app/views/users/users.tpl.html | 105 +++ .../widget-details.controller.js | 202 ++++++ .../widget-details.controller.spec.js | 19 + .../widget-details.modal.html | 132 ++++ .../widget-details.modal.less | 94 +++ .../client/app/views/widgets/widgets.controller.js | 151 ++++ .../app/views/widgets/widgets.controller.spec.js | 19 + .../client/app/views/widgets/widgets.less | 60 ++ .../client/app/views/widgets/widgets.tpl.html | 77 +++ 114 files changed, 14144 insertions(+) create mode 100644 ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.js create mode 100644 ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.html create mode 100644 ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.less create mode 100644 ecomp-portal-FE/client/app/views/admins/admins.controller.js create mode 100644 ecomp-portal-FE/client/app/views/admins/admins.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/admins/admins.less create mode 100644 ecomp-portal-FE/client/app/views/admins/admins.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.js create mode 100644 ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.html create mode 100644 ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.less create mode 100644 ecomp-portal-FE/client/app/views/applications/applications.controller.js create mode 100644 ecomp-portal-FE/client/app/views/applications/applications.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/applications/applications.less create mode 100644 ecomp-portal-FE/client/app/views/applications/applications.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/catalog/catalog.controller.js create mode 100644 ecomp-portal-FE/client/app/views/catalog/catalog.less create mode 100644 ecomp-portal-FE/client/app/views/catalog/catalog.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/catalog/catalogconfirmation.controller.js create mode 100644 ecomp-portal-FE/client/app/views/catalog/information-box.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/admin-confirmation-box.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.controller.js create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.less create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/dragdrop-confirmation-box.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/confirmation-box/information-box.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard-widget-manage.html create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard-widget.controller.js create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard-widget.controller.less create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard.controller.js create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard.less create mode 100644 ecomp-portal-FE/client/app/views/dashboard/dashboard.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/dashboard/newsticker.controller.js create mode 100644 ecomp-portal-FE/client/app/views/errors/error.404.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/errors/error.controller.js create mode 100644 ecomp-portal-FE/client/app/views/errors/error.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/footer/footer.controller.js create mode 100644 ecomp-portal-FE/client/app/views/footer/footer.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/footer/footer.less create mode 100644 ecomp-portal-FE/client/app/views/footer/footer.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.controller.js create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.delete.modal.html create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/modal-details.modal.less create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.controller.js create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.less create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/functionalMenu/jqTreeContextMenu.js create mode 100644 ecomp-portal-FE/client/app/views/header/header.controller.js create mode 100644 ecomp-portal-FE/client/app/views/header/header.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/header/header.less create mode 100644 ecomp-portal-FE/client/app/views/header/header.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/header/user-edit/edit-user.controller.js create mode 100644 ecomp-portal-FE/client/app/views/header/user-edit/edit-user.less create mode 100644 ecomp-portal-FE/client/app/views/header/user-edit/edit-user.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.js create mode 100644 ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/home/applications-home/applications-home.less create mode 100644 ecomp-portal-FE/client/app/views/home/applications-home/applications-home.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.js create mode 100644 ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.less create mode 100644 ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.js create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.html create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.less create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/portal-admin-controller.js create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/portal-admin.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/portal-admin/portal-admins.less create mode 100644 ecomp-portal-FE/client/app/views/search/search.controller.js create mode 100644 ecomp-portal-FE/client/app/views/search/search.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/search/search.less create mode 100644 ecomp-portal-FE/client/app/views/search/search.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/sidebar/sidebar.controller.js create mode 100644 ecomp-portal-FE/client/app/views/sidebar/sidebar.less create mode 100644 ecomp-portal-FE/client/app/views/sidebar/sidebar.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.js create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us.less create mode 100644 ecomp-portal-FE/client/app/views/support/contact-us/contact-us.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.js create mode 100644 ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/support/get-access/get-access.less create mode 100644 ecomp-portal-FE/client/app/views/support/get-access/get-access.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/tabs/tabframe.html create mode 100644 ecomp-portal-FE/client/app/views/tabs/tabs.controller.js create mode 100644 ecomp-portal-FE/client/app/views/tabs/tabs.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/tabs/tabs.less create mode 100644 ecomp-portal-FE/client/app/views/tabs/tabs.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/userbar/userbar.controller.js create mode 100644 ecomp-portal-FE/client/app/views/userbar/userbar.less create mode 100644 ecomp-portal-FE/client/app/views/userbar/userbar.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.js create mode 100644 ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.html create mode 100644 ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.less create mode 100644 ecomp-portal-FE/client/app/views/users/users.controller.js create mode 100644 ecomp-portal-FE/client/app/views/users/users.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/users/users.less create mode 100644 ecomp-portal-FE/client/app/views/users/users.tpl.html create mode 100644 ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.js create mode 100644 ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.html create mode 100644 ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.less create mode 100644 ecomp-portal-FE/client/app/views/widgets/widgets.controller.js create mode 100644 ecomp-portal-FE/client/app/views/widgets/widgets.controller.spec.js create mode 100644 ecomp-portal-FE/client/app/views/widgets/widgets.less create mode 100644 ecomp-portal-FE/client/app/views/widgets/widgets.tpl.html (limited to 'ecomp-portal-FE/client/app/views') diff --git a/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.js b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.js new file mode 100644 index 00000000..4d77a97c --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.js @@ -0,0 +1,214 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; +(function () { + class NewAdminModalCtrl { + constructor($log, adminsService, $scope, confirmBoxService, utilsService, $location) { + + let init = () => { + this.isSaving = false; + this.originalApps = []; + /* istanbul ignore if */ + if ($scope.ngDialogData && $scope.ngDialogData.selectedUser && $scope.ngDialogData.dialogState) { + this.selectedUser = $scope.ngDialogData.selectedUser; + this.dialogState = $scope.ngDialogData.dialogState; + this.isShowBack = false; + if (this.dialogState === 2) { + this.getAdminAppsRoles(); + } + } else { + this.isShowBack = true; + this.selectedUser = null; + this.dialogState = 1; + } + + $log.info('NewAdminModalCtrl::initiated'); + this.appsOrder = []; + }; + + let orderList = (apps) => { + this.appsOrder = []; + for (var i = 0; i < apps.length; i++) { + if (apps[i].isAdmin) { + this.appsOrder.push(apps[i].id); + } + } + }; + + this.orderFilter = app => { + if (!app || !app.id || !this.appsOrder.length) { + return; + } + return this.appsOrder.indexOf(app.id); + }; + + this.getAdminAppsRoles = () => { + if (!this.selectedUser || !this.selectedUser.orgUserId) { + $log.error('No user is selected / searchUsers is InProgress'); + this.dialogState = 1; + return; + } + adminsService.getAdminAppsRoles(this.selectedUser.orgUserId).then(roles => { + $log.debug('apps roles res: ', JSON.stringify(roles)); + if (!roles.appsRoles) { + return; + } + + this.adminAppsRoles = []; + for (var i = 0; i < roles.appsRoles.length; i++) { + if (!roles.appsRoles[i].restrictedApp) { + $log.debug('pushing: {id: ', roles.appsRoles[i].id, + 'name: ', roles.appsRoles[i].appName, + 'restrictedApp: ', roles.appsRoles[i].restrictedApp, + 'isAdmin: ', roles.appsRoles[i].isAdmin, '}'); + this.adminAppsRoles.push({ + id: roles.appsRoles[i].id, + appName: roles.appsRoles[i].appName, + isAdmin: roles.appsRoles[i].isAdmin, + restrictedApp: roles.appsRoles[i].restrictedApp + }); + } + } + this.dialogState = 2; + this.adminAppsRoles = this.adminAppsRoles.sort(getSortOrder("appName")); + + orderList(roles.appsRoles); + if (this.appsOrder != null) { + for (var j = 0; j < this.appsOrder.length; j++) { + this.originalApps.push(this.appsOrder[j]); + } + } + }).catch(err => { + $log.error(err); + }); + }; + + let getSortOrder = (prop) => { + return function (a, b) { + if (a[prop].toLowerCase() > b[prop].toLowerCase()) { + return 1; + } else if (a[prop].toLowerCase() < b[prop].toLowerCase()) { + return -1; + } + return 0; + } + } + + this.setSelectedUser = (user) => { + $log.debug('selected user: ', user); + this.selectedUser = user; + }; + + this.unadminApp = (app) => { + confirmBoxService.deleteItem(app.appName).then(confirmed => { + if (confirmed === true) { + app.isAdmin = false; + this.appsOrder.splice(this.appsOrder.indexOf(app.id), 1); + } + }).catch(err => { + $log(err); + }); + }; + + this.updateAdminAppsRoles = () => { + if (!this.selectedUser || !this.selectedUser.orgUserId || !this.adminAppsRoles) { + return; + } + this.isSaving = true; + $log.debug('going to update user: ' + this.selectedUser.orgUserId + ' with app roles: ' + JSON.stringify(this.adminAppsRoles)); + confirmBoxService.makeAdminChanges('Are you sure you want to make these admin changes?') + .then(confirmed => { + adminsService.updateAdminAppsRoles({ + orgUserId: this.selectedUser.orgUserId, + appsRoles: this.adminAppsRoles + }) + .then(res => { + $log.debug('Admin apps roles updated successfully!', res); + this.remindToAddUserIfNecessary(); + $scope.closeThisDialog(true); + }).catch(err => { + $log.error('NewAdminModalCtrl.updateAdminAppsRoles:: Failed - ' + err); + }).finally(()=> { + this.isSaving = false; + }) + }); + }; + + this.navigateBack = () => { + if (this.dialogState === 1) { + } + if (this.dialogState === 2) { + this.dialogState = 1; + } + }; + + init(); + + $scope.$watch('newAdmin.selectedNewApp', (newVal) => { + if (!newVal || newVal.isAdmin === undefined) { + return; + } + let app = _.find(this.adminAppsRoles, {id: newVal.id}); + if (app) { + app.isAdmin = true; + this.appsOrder.push(app.id); + } + this.selectedNewApp = null; + }); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + + this.remindToAddUserIfNecessary = () => { + var adminAddedToNewApp = false; + if ((this.originalApps != null) && (this.originalApps.length > 0)) { + for (var i = 0; i < this.appsOrder.length; i++) { + var foundApp = false; + for (var j = 0; j < this.originalApps.length; j++) { + if (this.originalApps[j] == this.appsOrder[i]) { + foundApp = true; + } + } + if (foundApp == false) { + adminAddedToNewApp = true; + break; + } + } + } else { + adminAddedToNewApp = true; + } + + if (adminAddedToNewApp == true) { + confirmBoxService.confirm('Add this person as an application user? This allows them to access the application from OpenECOMP Portal. Press OK to go to the Add Users page.') + .then(confirmed => { + if (confirmed == true) { + $location.path('/users'); + } + }); + } + } + + } + } + NewAdminModalCtrl.$inject = ['$log', 'adminsService', '$scope', 'confirmBoxService', 'utilsService', '$location']; + angular.module('ecompApp').controller('NewAdminModalCtrl', NewAdminModalCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.spec.js b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.spec.js new file mode 100644 index 00000000..c0f73078 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.controller.spec.js @@ -0,0 +1,130 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; + +describe('Controller: NewAdminCtrl ', () => { + beforeEach(module('ecompApp')); + + beforeEach(inject((_CacheFactory_)=> { + _CacheFactory_.destroyAll(); + })); + + + let newCtrl, $controller, $q, $rootScope, $log; + + beforeEach(inject((_$controller_, _$q_, _$rootScope_, _$log_)=> { + [$controller, $q, $rootScope, $log] = [_$controller_, _$q_, _$rootScope_, _$log_]; + })); + + let deferredAdminAppsRoles, deferredUpdateRolesRes; + let adminsServiceMock; + beforeEach(()=> { + [deferredAdminAppsRoles, deferredUpdateRolesRes] = [$q.defer(), $q.defer()]; + + adminsServiceMock = jasmine.createSpyObj('adminsServiceMock', ['getAdminAppsRoles', 'updateAdminAppsRoles']); + + adminsServiceMock.getAdminAppsRoles.and.returnValue(deferredAdminAppsRoles.promise); + adminsServiceMock.updateAdminAppsRoles.and.returnValue(deferredUpdateRolesRes.promise); + + newCtrl = $controller('NewAdminModalCtrl', { + $log: $log, + adminsService: adminsServiceMock, + $scope: $rootScope + }); + }); + + it('should init default values when loading the controller', ()=> { + expect(newCtrl.dialogState).toBe(1); + expect(newCtrl.selectedUser).toBe(null); + }); + + it('should populate admin apps roles and move to the next screen when adminsService.getAdminAppsRoles succeeded', ()=> { + let userApps = {appsRoles: [{id: 1, isAdmin: false}, {id: 2, isAdmin: true}]}; + deferredAdminAppsRoles.resolve(userApps); + + newCtrl.selectedUser = {orgUserId: 'orgUserId'}; + + newCtrl.getAdminAppsRoles(); + $rootScope.$apply(); + + expect(adminsServiceMock.getAdminAppsRoles).toHaveBeenCalledWith(newCtrl.selectedUser.userId); + expect(newCtrl.adminAppsRoles).toEqual(userApps.appsRoles); + expect(newCtrl.dialogState).toBe(2); + }); + + it('should log the error when adminsService.getAdminAppsRoles fails', ()=> { + spyOn($log, 'error'); + deferredAdminAppsRoles.reject('some error'); + + newCtrl.searchUsersInProgress = false; + newCtrl.selectedUser = {orgUserId: 'orgUserId'}; + + newCtrl.getAdminAppsRoles(); + $rootScope.$apply(); + + expect($log.error).toHaveBeenCalled(); + }); + it('should log the error when trying to getAdminAppsRoles without selecting user ', ()=> { + spyOn($log, 'error'); + + newCtrl.searchUsersInProgress = false; + newCtrl.selectedUser = null; + + newCtrl.getAdminAppsRoles(); + $rootScope.$apply(); + + expect($log.error).toHaveBeenCalled(); + }); + + it('should set isAdmin as true when adding app via the dropdown menu', ()=> { + newCtrl.adminAppsRoles = [{id: 1, isAdmin: false},{id: 2, isAdmin: true}]; + $rootScope.$apply('newAdmin.selectedNewApp = null'); + $rootScope.$apply('newAdmin.selectedNewApp = {id: 1, isAdmin: true}'); + + expect(newCtrl.adminAppsRoles[0].isAdmin).toBe(true); + expect(newCtrl.selectedNewApp).toBe(null); + }); + + it('should close the modal when updating apps roles succeeded', ()=> { + $rootScope.closeThisDialog = () => {}; + spyOn($rootScope,'closeThisDialog'); + + newCtrl.selectedUser = {orgUserId: 'orgUserId'}; + newCtrl.adminAppsRoles = [{id: 1}]; + + deferredUpdateRolesRes.resolve(); + newCtrl.updateAdminAppsRoles(); + $rootScope.$apply(); + + expect(adminsServiceMock.updateAdminAppsRoles).toHaveBeenCalledWith({userId: newCtrl.selectedUser.userId, appsRoles: newCtrl.adminAppsRoles}); + expect($rootScope.closeThisDialog).toHaveBeenCalled(); + }); + it('should log the error when updating apps roles fails', ()=> { + newCtrl.selectedUser = {orgUserId: 'orgUserId'}; + newCtrl.adminAppsRoles = [{id: 1}]; + + spyOn($log,'error'); + deferredUpdateRolesRes.reject(); + newCtrl.updateAdminAppsRoles(); + $rootScope.$apply(); + expect($log.error).toHaveBeenCalled(); + }); +}); diff --git a/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.html b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.html new file mode 100644 index 00000000..0a8fc727 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.html @@ -0,0 +1,66 @@ + +
+
+ +
+
Next +
+
Cancel
+
+
+
+
+
+
+ Administrates: +
+ +
+
+
+ +
+
+
+ +
Back
+
Save +
+
Cancel
+
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.less b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.less new file mode 100644 index 00000000..b992c928 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/add-admin-dialogs/new-admin.modal.less @@ -0,0 +1,99 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .new-admin-modal { + display:block; + overflow:auto; + min-height: 450px; + + .search-users { + } + + .admin-app-roles { + .title { + .n18r; + border-bottom: @a 3px solid; + + } + + .app-roles-main { + margin-top: 16px; + .app-roles-main-title { + .n14r; + margin-bottom: 8px; + .left { + display: inline-block; + } + .right { + display: inline-block; + color: @a; + float: right; + cursor: pointer; + } + } + + .select-input{ + width: 460px; + } + + .new-administrated-app { + height: 30px; + line-height: 30px; + + border: 1px solid @p; + margin-bottom: 8px; + border-radius: 2px; + padding-left: 6px; + padding-top: 0; + .o14r; + } + + .admin-roles-list { + height: 240px; + overflow-y: auto; + } + + .administrated-application { + width: 460px; + height: 30px; + border: 1px solid @p; + margin-bottom: 8px; + border-radius: 2px; + padding: 6px; + .o14r; + display: inline-block; + + } + + .delete-application { + .ico_trash_default; + display: inline-block; + vertical-align: 4px; + cursor: pointer; + position: relative; + top: 6px; + color: transparent; + margin-left: 8px; + } + + } + + } +} + diff --git a/ecomp-portal-FE/client/app/views/admins/admins.controller.js b/ecomp-portal-FE/client/app/views/admins/admins.controller.js new file mode 100644 index 00000000..402ff9d6 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/admins.controller.js @@ -0,0 +1,151 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class AdminsCtrl { + constructor($log, adminsService, applicationsService, ngDialog) { + + let allPortalsFilterObject = {index: 0, title: 'All applications', value: ''}; + + let updateTableData = () => { + this.isLoadingTable = true; + adminsService.getAccountAdmins().then(res=> { + if (!res || !res.length) { + $log.info('AdminsCtrl::updateTableData: no admins err handling'); + this.adminsTableData = []; + return; + } + this.adminsTableData = res; + }).catch(err=> { + $log.error('AdminsCtrl::updateTableData error: ', err); + }).finally(() => { + this.isLoadingTable = false; + }); + }; + + let init = () => { + $log.info('AdminsCtrl:: ::initializing...'); + this.isLoadingTable = false; + this.availableApps = [allPortalsFilterObject]; + this.filterByApp = this.availableApps[0]; + + /* Table general configuration params*/ + this.searchString= ''; + /*Table data*/ + this.adminsTableHeaders = ['First Name', 'Last Name', 'User ID', 'Applications']; + this.adminsTableData = []; + updateTableData(); + }; + + applicationsService.getAvailableApps().then(res=> { + this.availableApps = [allPortalsFilterObject]; + var res1 = res.sort(getSortOrder("title")); + var realAppIndex = 1; + for(let i=1; i<=res1.length; i++){ + if (!res1[i-1].restrictedApp) { + $log.debug('AdminsCtrl:getAvailableApps:: pushing: {index: ', realAppIndex, 'title: ', res1[i - 1].title, + '| value: ', res1[i -1].value, '}'); + this.availableApps.push({ + index: realAppIndex, + title: res1[i - 1].title, + value: res1[i - 1].value + }); + realAppIndex = realAppIndex + 1; + } else { + $log.debug('AdminsCtrl:getAvailableApps:: Restricted/URL only App will not be used = ' + res1[i - 1].title); + } + } + }).catch(err=> { + $log.error(err); + this.availableApps = [allPortalsFilterObject]; + }); + + let getSortOrder = (prop) => { + return function(a, b) { + if (a[prop].toLowerCase() > b[prop].toLowerCase()) { + return 1; + } else if (a[prop].toLowerCase() < b[prop].toLowerCase()) { + return -1; + } + return 0; + } + } + + init(); + + this.portalsRowFilter = (input) => { + if (this.filterByApp.value === '') { + return true; + } + return _.find(input.apps, {appName: this.filterByApp.value}) !== undefined; + }; + + this.openAddNewAdminModal = (user) => { + let data = null; + if(user){ + data = { + dialogState: 2, + selectedUser:{ + orgUserId: user.orgUserId, + firstName: user.firstName, + lastName: user.lastName + } + } + } + ngDialog.open({ + templateUrl: 'app/views/admins/add-admin-dialogs/new-admin.modal.html', + controller: 'NewAdminModalCtrl', + controllerAs: 'newAdmin', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + $log.debug('AdminsCtrl:openAddNewAdminModal:: updating table data...'); + updateTableData(); + } + }); + }; + + this.openEditUserModal = (loginId) => { + var data = { + loginId : loginId, + updateRemoteApp : false, + appId : this.selectedApp!=null?this.selectedApp.id:'' + } + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/header/user-edit/edit-user.tpl.html', + controller: 'editUserController', + data: data, + resolve: { + message: function message() { + var message = { + type: 'Contact', + }; + return message; + } + } + }).closePromise.then(needUpdate => { + updateTableData(); + }); + } + } + } + AdminsCtrl.$inject = ['$log', 'adminsService', 'applicationsService', 'ngDialog']; + angular.module('ecompApp').controller('AdminsCtrl', AdminsCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/admins/admins.controller.spec.js b/ecomp-portal-FE/client/app/views/admins/admins.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/admins.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/admins/admins.less b/ecomp-portal-FE/client/app/views/admins/admins.less new file mode 100644 index 00000000..cdf0c0f5 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/admins.less @@ -0,0 +1,47 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .admins-page-main { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .admins-table { + width: @table-width; + margin: @table-margin; + + .table-control { + .table-dropdown-filter{ + width: @table-dropdown-filter-width; + display: @table-dropdown-filter-display; + } + } + + .table-body { + cursor: pointer; + } + } +} + diff --git a/ecomp-portal-FE/client/app/views/admins/admins.tpl.html b/ecomp-portal-FE/client/app/views/admins/admins.tpl.html new file mode 100644 index 00000000..543b9ead --- /dev/null +++ b/ecomp-portal-FE/client/app/views/admins/admins.tpl.html @@ -0,0 +1,82 @@ + +
+
+
+
Admins
+
+
+
+
+ +
+
+ +
Add Admin
+
+ +
+ + + + + + + + + + + + + + + + + +
{{admins.adminsTableHeaders[0]}}{{admins.adminsTableHeaders[1]}}{{admins.adminsTableHeaders[2]}}{{admins.adminsTableHeaders[3]}}
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
diff --git a/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.js b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.js new file mode 100644 index 00000000..8c6ffe48 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.js @@ -0,0 +1,244 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class AppDetailsModalCtrl { + constructor($scope, $log, applicationsService, errorMessageByCode, + ECOMP_URL_REGEX,userProfileService, $cookies, confirmBoxService) { + let emptyImg = null; + this.emptyImgForPreview = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='; + + let newAppModel = { + 'id': null, + 'name': null, + 'imageUrl': null, + 'description': null, + 'notes': null, + 'url': null, + 'alternateUrl': null, + 'restUrl': null, + 'isOpen': false, + 'username': null, + 'appPassword': null, + 'thumbnail': emptyImg, + 'isEnabled': true, + 'restrictedApp': false + }; + + let init = () => { + $log.info('AppDetailsModalCtrl::init'); + this.isSaving = false; + if($scope.ngDialogData && $scope.ngDialogData.app){ + $log.debug('AppDetailsModalCtrl:init:: Edit app mode for', $scope.ngDialogData.app); + this.isEditMode = true; + this.app = _.clone($scope.ngDialogData.app); + }else{ + $log.debug('AppDetailsModalCtrl:init:: New app mode'); + this.isEditMode = false; + this.app = _.clone(newAppModel); + } + this.originalImage = null + }; + + this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; + + this.imageApi = {}; + this.removeImage = () => { + $log.debug('AppDetailsModalCtrl:removeImage:: entering removeImage'); + + confirmBoxService.confirm("Are you sure you want to remove the image?").then(isConfirmed => { + if(isConfirmed){ + this.imageApi.clearFile(); + this.app.thumbnail = emptyImg; + this.originalImage = null; + this.app.imageUrl = null; + } + }).catch(err => { + $log.error('AppDetailsModalCtrl:removeImage error:: ',err); + }); + }; + + this.conflictMessages = {}; + this.scrollApi = {}; + let handleConflictErrors = err => { + if(!err.data){ + return; + } + if(!err.data.length){ + err.data = [err.data] + } + _.forEach(err.data, item => { + _.forEach(item.fields, field => { + this.conflictMessages[field.name] = errorMessageByCode[item.errorCode]; + $scope.appForm[field.name].$setValidity('conflict', false); + watchOnce[field.name](); + }); + }); + this.scrollApi.scrollTop(); + }; + + let resetConflict = fieldName => { + delete this.conflictMessages[fieldName]; + if($scope.appForm[fieldName]){ + $scope.appForm[fieldName].$setValidity('conflict', true); + } + }; + + + let emptyCookies = () => { + $log.debug('AppDetailsModalCtrl:emptyCookies:: entering emptyCookies'); + userProfileService.getUserProfile() + .then(profile=> { + $scope.userId = profile.orgUserId; + $log.debug('AppDetailsModalCtrl:emptyCookies for the following userId: ' + profile.orgUserId); + if ($cookies.getObject($scope.userId + '_apps') != undefined && $cookies.getObject($scope.userId + '_apps') != null) { + $cookies.remove($scope.userId + '_apps'); + $log.debug('AppDetailsModalCtrl:emptyCookies removed: ' + $scope.userId + '_apps'); + } + if ($cookies.getObject($scope.userId + '_widget') != undefined && $cookies.getObject($scope.userId + '_widget') != null) { + $cookies.remove($scope.userId + '_widget'); + $log.debug('AppDetailsModalCtrl:emptyCookies removed: ' + $scope.userId + '_widget'); + } + }).catch(err => { + $log.error('AppDetailsModalCtrl:emptyCookies error:: '+ JSON.stringify(err)); + }); + }; + + + let watchOnce = { + name: () => { + let unregisterName = $scope.$watch('appDetails.app.name', (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()){ + resetConflict('name'); + unregisterName(); + } + }); + }, + url: () => { + let unregisterUrl = $scope.$watch('appDetails.app.url', (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()) { + resetConflict('url'); + unregisterUrl(); + } + }); + } + }; + + this.saveChanges = () => { + if($scope.appForm.$invalid){ + return; + } + this.isSaving = true; + + if (this.app.restrictedApp) { + this.app.restUrl = null; + this.app.isOpen = true; + this.app.username = null; + this.app.appPassword = null; + this.app.uebTopicName = null; + this.app.uebKey = null; + this.app.uebSecret = null; + } + if(this.isEditMode){ + applicationsService.updateOnboardingApp(this.app) + .then(() => { + $log.debug('AppDetailsModalCtrl:updateOnboardingApp:: App update succeeded!'); + $scope.closeThisDialog(true); + emptyCookies(); + }).catch(err => { + if(err.status === 409){ + handleConflictErrors(err); + } + if(err.status === 500){ + confirmBoxService.showInformation('There was a problem updating the application changes. ' + + 'Please try again later.').then(isConfirmed => {}); + } + if(err.status === 403){ + confirmBoxService.showInformation('There was a problem updating the application changes. ' + + 'Please try again. If the problem persists, then try again later.').then(isConfirmed => {}); + } + $log.error('applicationsService:updateOnboardingApp error status:: '+ err.status); + $log.error('applicationsService:updateOnboardingApp error:: '+ JSON.stringify(err)); + }).finally(()=>{ + this.isSaving = false; + var objOffsetVersion = objAgent.indexOf("MSIE"); + if (objOffsetVersion != -1) { + $log.debug('AppDetailsModalCtrl:updateOnboardingApp:: Browser is IE, forcing Refresh'); + $window.location.reload(); + } + }); + }else{ + applicationsService.addOnboardingApp(this.app) + .then(() => { + $log.debug('App creation succeeded!'); + $scope.closeThisDialog(true); + emptyCookies(); + }).catch(err => { + if(err.status === 409){ + handleConflictErrors(err); + } + if(err.status === 500){ + confirmBoxService.showInformation('There was a problem adding the application information. ' + + 'Please try again later.').then(isConfirmed => {}); + } + $log.error('applicationsService:addOnboardingApp error status:: '+ err.status); + $log.error('applicationsService:addOnboardingApp error:: '+ JSON.stringify(err)); + }).finally(()=>{ + this.isSaving = false; + var objOffsetVersion = objAgent.indexOf("MSIE"); + if (objOffsetVersion != -1) { + $log.debug('applicationsService:addOnboardingApp:: Browser is IE, forcing Refresh'); + $window.location.reload(); + } + }); + } + }; + + + init(); + + $scope.$watch('appDetails.originalImage', (newVal, oldVal) => { + if((!newVal || !newVal.resized) && !this.app.imageUrl){ + if (!newVal) { + $log.debug('applicationsService:$scope.$watch:: originalImage: newVal is null'); + } else { + $log.debug('applicationsService:$scope.$watch:: originalImage: newVal is not resized and no imageUrl'); + } + this.app.imageUrl = null; + this.app.thumbnail = emptyImg; + return; + } + + if(!(_.isEqual(newVal, oldVal))){ + $log.debug('applicationsService:$scope.$watch:: thumbnail updated!'); + this.app.imageUrl = null; + this.app.thumbnail = newVal.resized.dataURL; + } + }); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + AppDetailsModalCtrl.$inject = ['$scope', '$log', 'applicationsService', 'errorMessageByCode', + 'ECOMP_URL_REGEX','userProfileService','$cookies', 'confirmBoxService']; + angular.module('ecompApp').controller('AppDetailsModalCtrl', AppDetailsModalCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.spec.js b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.html b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.html new file mode 100644 index 00000000..57f4e61d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.html @@ -0,0 +1,183 @@ + +
+
Application Details
+
+
+ +
+
+ +
Hyperlink only application
+
+
+
Application Name
+ +
+ +
+
+
+ Application name is required + Application name must be alphanumeric +
+
+
+
+
URL
+ +
+ +
+
+
+ Application URL is required + Application URL must be a valid URL +
+
+
+ +
+
Rest API URL
+ +
+
+ Application REST URL must be a valid URL +
+
+
+ +
+
Username
+ +
+
+ Rest Api Username is required +
+
+
+ +
+
Password
+ +
+
+ Rest Api Password is required +
+
+
+ + +
+
Communication Inbox
+ +
+
+
Communication Key
+ +
+
+
Communication Secret
+ +
+ +
+
+
+
Upload Image
+ + +
+
+ Uploaded file must be an image + Image file must be smaller than 1MB +
+
+
+ Preview + Remove +
+ + +
+ +
Allow guest access
+
+
+ +
Active
+
+
+
+
+
+
+ +
Save
+
Cancel
+
+
+ + diff --git a/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.less b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.less new file mode 100644 index 00000000..6db4845a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/application-details-dialog/application-details.modal.less @@ -0,0 +1,122 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .application-details-modal { + height: 700px; + + .title { + .n18r; + border-bottom: @a 3px solid; + + } + + .app-properties-main{ + padding-left: 16px; + padding-top: 16px; + padding-bottom: 16px; + height: 630px; + overflow-y: auto; + + + .left-container{ + display: inline-block; + width: 48%; + + } + .right-container{ + display: inline-block; + width: 48%; + float: right; + + + } + + .property{ + position: relative; + margin-bottom: 18px; + .property-label{ + .o14r; + } + .checkbox-label{ + display: inline-block; + padding-left: 3px; + } + .checkbox-field{ + padding: 0; + margin: 0; + vertical-align: middle; + position: relative; + top: -1px; + } + .preview{ + width: 220px; + margin-top: 22px; + display: block; + + .left-label{ + display:inline-block; + float: left; + } + .remove{ + cursor: pointer; + display: inline-block; + float: right; + .a14r; + } + } + + .input-field{ + .custom-input-field; + width: 220px; + } + + .input-file-field{ + width: 220px; + } + .select-field { + .custom-select-field; + } + + .image-preview{ + background: #f0f0f0; + background-size: cover; + width: 220px; + height: 184px; + margin-top: 10px; + border: 2px solid #e8e8e8; + border-radius: 4px; + } + + .error-container{ + position: absolute; + width: 220px; + display: block; + height: 12px; + line-height: 12px; + + .err-message{ + color: red; + font-size: 10px; + } + } + } + + } + +} diff --git a/ecomp-portal-FE/client/app/views/applications/applications.controller.js b/ecomp-portal-FE/client/app/views/applications/applications.controller.js new file mode 100644 index 00000000..7214fd2d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/applications.controller.js @@ -0,0 +1,111 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class ApplicationsCtrl { + constructor($log, applicationsService, confirmBoxService, ngDialog,userProfileService,$cookies) { + $log.info('ApplicationsCtrl::init: Starting up'); + + this.emptyImgForPreview = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='; + let getOnboardingApps = () => { + this.isLoadingTable = true; + applicationsService.getOnboardingApps() + .then(appsList => { + this.appsList = appsList; + }).catch(err => { + $log.error(err); + }).finally(()=> { + this.isLoadingTable = false; + }); + }; + + let init = () => { + this.isLoadingTable = false; + getOnboardingApps(); + + this.searchString = ''; + this.appsTableHeaders = [ + {name: 'Application Name', value: 'name', isSortable: true}, + {name: 'Active', value: 'isEnabled', isSortable: true}, + {name: 'Integration Type', value: 'restrictedApp', isSortable: true}, + {name: 'Guest Access', value: 'isOpen', isSortable: true}, + {name: 'URL', value: 'url', isSortable: true}, + {name: 'REST URL', value: 'restUrl', isSortable: true}, + {name: 'Communication Topic', value: 'uebTopicName', isSortable: true}, + {name: 'Communication Key', value: 'uebKey', isSortable: true}, + {name: 'Communication Secret', value: 'uebSecret', isSortable: true}, + ]; + this.appsList = []; + }; + + init(); + + this.openAddNewAppModal = (selectedApp) => { + let data = null; + if (selectedApp) { + if (!selectedApp.id) { + $log.error('App id not found'); + return; + } + data = { + app: selectedApp + } + } + ngDialog.open({ + templateUrl: 'app/views/applications/application-details-dialog/application-details.modal.html', + controller: 'AppDetailsModalCtrl', + controllerAs: 'appDetails', + data: data + }).closePromise.then(needUpdate => { + if (needUpdate.value === true) { + $log.debug('ApplicationsCtrl:openAddNewAppModal:: updating table data...'); + getOnboardingApps(); + } + }); + + + }; + + this.deleteApp = application => { + $log.debug('ApplicationsCtrl:deleteApp:: ', application.name); + + confirmBoxService.deleteItem(application.name).then(isConfirmed => { + if(isConfirmed){ + if(!application || !application.id){ + $log.error('ApplicationsCtrl:deleteApp:: No application or ID... cannot delete'); + return; + } + applicationsService.deleteOnboardingApp(application.id).then(() => { + this.appsList.splice(this.appsList.indexOf(application), 1); + }).catch(err => { + $log.error(err); + }); + } + }).catch(err => { + $log.error('ApplicationsCtrl:deleteApp error:: ', err); + }); + + }; + + } + } + ApplicationsCtrl.$inject = ['$log', 'applicationsService', 'confirmBoxService', 'ngDialog','userProfileService','$cookies']; + angular.module('ecompApp').controller('ApplicationsCtrl', ApplicationsCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/applications/applications.controller.spec.js b/ecomp-portal-FE/client/app/views/applications/applications.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/applications.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/applications/applications.less b/ecomp-portal-FE/client/app/views/applications/applications.less new file mode 100644 index 00000000..eed77ac2 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/applications.less @@ -0,0 +1,45 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .applications-page-main{ + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .apps-table { + width: @table-width; + margin: @table-margin; + + .delete-app{ + .ico_trash_default; + } + .small-thumbnail{ + width: 72px; + height: 60px; + border: 1px solid #d8d8d8; + border-radius: 2px; + } + } +} diff --git a/ecomp-portal-FE/client/app/views/applications/applications.tpl.html b/ecomp-portal-FE/client/app/views/applications/applications.tpl.html new file mode 100644 index 00000000..a27821b1 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/applications/applications.tpl.html @@ -0,0 +1,100 @@ + +
+
+
+
Application Onboarding
+
+
+ +
Add App
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DeleteThumbnailApplication NameActive?Integration TypeGuest AccessURLREST URLCommunication TopicCommunication KeyCommunication Secret
+
+
+ + +
{{rowData.name}}
+
+
{{(rowData.isEnabled) ? 'yes' : 'no'}}
+
+
{{(rowData.restrictedApp) ? 'link' : 'standard'}}
+
+
{{(rowData.isOpen) ? 'yes' : 'no'}}
+
+
{{rowData.url | elipsis: 27}}
+
+
{{rowData.restUrl | elipsis: 27}}
+
+
{{rowData.uebTopicName}}
+
+
{{rowData.uebKey}}
+
+
{{rowData.uebSecret}}
+
+
+
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/catalog/catalog.controller.js b/ecomp-portal-FE/client/app/views/catalog/catalog.controller.js new file mode 100644 index 00000000..652c0886 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/catalog/catalog.controller.js @@ -0,0 +1,166 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; + +function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } +} + +(function() { + var HTTP_PROTOCOL_RGX = /https?:\/\//; + + var CatalogCtrl = function CatalogCtrl(catalogService, confirmBoxService, + $log, $window, userProfileService, $scope, $timeout, $interval, + $modal, ngDialog) { + + var _this = this; + + _classCallCheck(this, CatalogCtrl); + + // activate spinner + this.isLoading = true; + $scope.getAppCatalogIsDone = false; + $scope.radioValue = 'All'; + $scope.$watch('radioValue', function(newValue, oldValue) { + var appCatalog = $scope.appCatalog; + $scope.appCatalog = []; + $scope.appCatalog = appCatalog; + + + }); + + this.catalogService = catalogService; + this.userProfileService = userProfileService; + $scope.demoNum = 1; + + this.getAccess = function(item) { + if(!item.access) + confirmBoxService.showDynamicInformation(item, + 'app/views/catalog/information-box.tpl.html','CatalogConfirmationBoxCtrl' + ).then(isConfirmed => {}); + }; + + // Run this function when user clicks on checkbox. + this.storeSelection = function(item) { + // $log.debug('CatalogCtrl:storeSelection: item.id is ' + item.id + ', select is ' + item.select); + var pendingFlag = false; + + if(item.access) + pendingFlag = false; + else + pendingFlag = item.pending; + + + + + var appData = { + appId : item.id, + select : item.select, + pending : pendingFlag // TODO + }; + catalogService.updateAppCatalog(appData).then( + function(result) { + // $log.debug('CatalogCtrl:storeSelection result is ', result); + })['catch'](function(err) { + $log.error('CatalogCtrl:storeSelection: exception: ', err); + }); + }; + + userProfileService + .getUserProfile() + .then( + function(profile) { + $scope.attuid = profile.attuid; + $scope.appCatalog = []; + + // applicationsService.getUserApps() + catalogService + .getAppCatalog() + .then( + function(res) { + // $log.info(res); + _this.apps = res; + var rowNo = 0; + for (var i = 0; i < _this.apps.length; i++) { + $scope.appCatalog[i] = { + sizeX : 2, + sizeY : 2, + id : _this.apps[i].id, + headerText : _this.apps[i].name, + imageLink : _this.apps[i].thumbnail + || _this.apps[i].imageUrl, + url : _this.apps[i].url, + restricted : _this.apps[i].restricted, + select : (_this.apps[i].select || (_this.apps[i].access && _this.apps[i].pending)), + access : _this.apps[i].access, + pending: _this.apps[i].pending + }; + } + //$log.debug('CatalogCtrl: getAppCatalog count : ' + // + $scope.appCatalog.length); + _this.isLoading = false; + $scope.getAppCatalogIsDone = true; + })['catch'](function(err) { + $log.error('CatalogCtrl: failed to get app list: ', err); + _this.isLoading = false; + $scope.getAppCatalogIsDone = true; + }); + }); + + this.gridsterOpts = { + columns : 12, + colWidth : 95, + rowHeight : 95, + margins : [ 20, 20 ], + outerMargin : true, + pushing : true, + floating : true, + swapping : true, + }; + + if (getParameterByName('noUserError') != null) { + if (getParameterByName('noUserError') == "Show") { + $("#errorInfo").show(); + } + + } + }; + + CatalogCtrl.$inject = [ 'catalogService', 'confirmBoxService', '$log', + '$window', 'userProfileService', '$scope', '$timeout', '$interval', + '$modal', 'ngDialog' ]; + angular.module('ecompApp').controller('CatalogCtrl', CatalogCtrl); +})(); + +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, " "); +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/catalog/catalog.less b/ecomp-portal-FE/client/app/views/catalog/catalog.less new file mode 100644 index 00000000..9385c8c5 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/catalog/catalog.less @@ -0,0 +1,439 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +.w-ecomp-app-catalog { + //.bg_u;//white for 1702 + .bg_w; // gray for 1610 + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .gridster-item-container .gridster-item-body { + overflow-y:auto; + overflow-x:hidden; + } + + .app-catalog-container { + .content_justify; + position: relative; + padding: 0 0 32px 0; + width: 100%; + + .app-catalog-title { + .a24r; + margin: auto; + .content_justify; + } + .app-catalog-list { + min-height: 90vh; + //display: flex; + justify-content: center; + flex-flow: row wrap; + width: 1170px; + + margin: auto; + margin-bottom: 63px; + + .app-gridster-header { + background-color: @u; + font-size:12px; + overflow:hidden + } + + .app-gridster-footer { + background-color: @u; + } + + } + } +} + +.build-number { + .o12i; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +.slide.ng-hide-add, +.slide.ng-hide-remove, +.slide.ng-enter, +.slide.ng-leave { + transition: all 0.5s ease; +} +.slide.ng-hide, +.slide.ng-enter { + transform: translate(-100%, 0); +} +.slide.ng-enter-active { + transform: translate(0, 0); +} +.slide.ng-leave { + transform: translate(0, 0); +} +.slide.ng-leave-active { + transform: translate(+100%, 0); +} +.appCatalogue-boarder{ + // border: 2px solid #ccc!important; + // border-radius: 16px!important; + height: 800px; + overflow: auto; +} +.app-visibility.false { + opacity: 0.5; +} + +.dock ul{ +display: inline-block; + +width: auto; +margin: 0px; +padding: 0px; +list-style: none; + +} +.dock ul li { +width: auto; +height: auto; +display: inline-block; +bottom: 0; +vertical-align: bottom; +margin-top: -43px; +} +.dock ul li a { +display: block; +height: 150px; +width: 150px; +position: relative; +-webkit-transition-property: width, height,margin-top; +-webkit-transition-duration: 0.5s; +-o-transition-property: width, height,margin-top; +-o-transition-duration: 0.5s; +-moz-transition-property: width, height,margin-top; +-moz-transition-duration: 0.5s; +} +.dock ul li a:hover { +width: 200px; +height: 200px; +margin-top: -50px; +} +.dock ul li a img { +width: 100%; +position: absolute; +bottom: 0; +left: 0; +border: none; +padding: 0px 0px 0px 30px; +} +.dock_left{ +width: 31px; +-webkit-transform: rotate(33deg); +-moz-transform: rotate(33deg); +-o-transform: rotate(33deg); +position: relative; +background: #EEE; +overflow: hidden; +float: left; +height: 100px; +z-index: 2; +margin: -18px; +} +.dock_right{ +width: 36px; +-webkit-transform: rotate(-33deg); +-moz-transform: rotate(-33deg); +-o-transform: rotate(-33deg); +position: relative; +background: #EEE; +overflow: hidden; +float: left; +height: 100px; +z-index: 2; +margin: -18px; +} + + + + +/*Time for the CSS*/ +* {margin: 0; padding: 0;} +body {background: #ccc;} + +.slider{ + width: 640px; /*Same as width of the large image*/ + position: relative; + /*Instead of height we will use padding*/ + padding-top: 320px; /*That helps bring the labels down*/ + + margin: 50px auto; + + /*Lets add a shadow*/ + box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.75); +} + + +/*Last thing remaining is to add transitions*/ +.slider>img{ + position: absolute; + left: 0; top: 0; + transition: all 0.5s; +} + +.slider input[name='slide_switch'] { + display: none; +} + +.slider label { + /*Lets add some spacing for the thumbnails*/ + margin: 18px 0 0 18px; + border: 3px solid #999; + + float: left; + cursor: pointer; + transition: all 0.5s; + + /*Default style = low opacity*/ + opacity: 0.6; +} + +.slider label img{ + display: block; +} + +/*Time to add the click effects*/ +.slider input[name='slide_switch']:checked+label { + border-color: #666; + opacity: 1; +} +/*Clicking any thumbnail now should change its opacity(style)*/ +/*Time to work on the main images*/ +.slider input[name='slide_switch'] ~ img { + opacity: 0; + transform: scale(1.1); +} +/*That hides all main images at a 110% size +On click the images will be displayed at normal size to complete the effect +*/ +.slider input[name='slide_switch']:checked+label+img { + opacity: 1; + transform: scale(1); +} +/*Clicking on any thumbnail now should activate the image related to it*/ + +.caption { + background: rgba(0, 0, 0, 0.5); + position: absolute; + bottom: 0; + width: 640px +} + +.caption a { + display: block; + color: #fff; + text-decoration: none; + font: normal 16px 'Lato', Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + padding: 15px; +} + + +/*widgets*/ +.singleBtnBorder { + border-radius: 6px 6px 6px 6px; +} + +.icon-anchor { + color: #888; +} + +.widgetHeaderBtn:hover, .widgetHeaderBtn:focus { + background: rgba(0, 0, 0, 0); + color: #3a7999; + box-shadow: inset 0 0 0 2px #3a7999; +} + +.box-one { + -webkit-transition:all linear 0.4s; + transition:all linear 0.4s; + height:100px; width:200px; background:white; border: 2px solid #ccc!important; + border-radius: 16px!important; +} +.box-one.ng-hide { +display: block!important; + opacity:0; +} + +.gridsterContent{ + height:120px; +} +.gridsterAppContent{ + height:120px; + +} + + .gridsterImage{ + height:84px; + width:168px; + } + .grider-content-ecomp{ + transition: transform 0.5s ease-out; + } + .grider-content-ecomp:hover{ + transform: scale(1.1); +} + +/*application empty div*/ +.app-error-block { + padding-top: 10px; +} + +.text-center { text-align: center; } + +.text-right { text-align: right; } + +.text-justify { text-align: justify; } + +/*widget header*/ +.optionsMenu{ + position: absolute; + list-style: none; + top: 25px; + right: 10px; + border: 1px solid #067ab4; + display: none; + z-index: 2; + border-radius: 6px 0px 6px 6px; + background: #fff; + width: 130px; +} + +.optionsMenuLink { + position: relative; + padding-left: 8px; + padding-right: 2px; + font-size: 12px; + line-height: 30px; + color: #444444; +} +.optionsMenu > li:hover a { + color: #ffffff !important; +} +.optionsMenu > li { + width: 100%; + text-align: left; +} +.optionsMenu > li:hover { + background-color: #0faaf7; + border-color: none !important; + cursor: pointer; +} + +.simulateCatGridHeader{ + position: relative; + height: 70px !important; + border: 1px solid #d3d3d3; + border-bottom: 0; + background-color: #E5E5E5; + white-space: nowrap; + text-overflow: ellipsis; + z-index: 1; +} + +.simulateCatGridHeaderTitle{ + line-height: 20px; + margin-top: 10px; + margin-left: 26px; + font-family: arial; + font-size: 18px; + color: #444444; + float: left; +} + +.simulateCatGridHeaderRadio{ + line-height: 20px; + margin-top: 10px; + margin-left: 10px; + font-family: arial; + font-size: 12px; + color: #444444; + float: left; +} + +.simulateCatGridHeaderDetails{ + line-height: 20px; + margin-left: 10px; + font-family: arial; + font-size: 12px; + color: #444444; + float: left; +} + +.simulateGridHeaderHandle{ + cursor: move; + margin: 12px; + position: absolute; + top: 0; + left: 0; + border: 0; + vertical-align: middle; + -ms-interpolation-mode: bicubic; + display: block; +} + +.att-checkbox--on .att-checkbox__indicator, .att-radio--on .att-radio__indicator { + opacity: 1; +} + +.animate-enter, +.animate-leave +{ + -webkit-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; + -moz-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; + -ms-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; + -o-transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; + transition: 400ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all; + position: relative; + display: block; +} + +.animate-enter.animate-enter-active, +.animate-leave { + opacity: 1; + top: 0; + height: 30px; +} + +.animate-leave.animate-leave-active, +.animate-enter { + opacity: 0; + top: -50px; + height: 0px; +} diff --git a/ecomp-portal-FE/client/app/views/catalog/catalog.tpl.html b/ecomp-portal-FE/client/app/views/catalog/catalog.tpl.html new file mode 100644 index 00000000..e169afa9 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/catalog/catalog.tpl.html @@ -0,0 +1,91 @@ + +
+
+
Application Catalog
+
+
+ Click the check + boxes below to choose which applications are shown on the home page. +
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ Pending Access +
+
+
+
+
+
+
+
+
+ +
+ To request access to an application, please visit the Get Access page. +
+ +
+
+ +
+
\ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/catalog/catalogconfirmation.controller.js b/ecomp-portal-FE/client/app/views/catalog/catalogconfirmation.controller.js new file mode 100644 index 00000000..83438e9c --- /dev/null +++ b/ecomp-portal-FE/client/app/views/catalog/catalogconfirmation.controller.js @@ -0,0 +1,62 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; +(function () { + class CatalogConfirmationBoxCtrl { + constructor($scope,$state,catalogService) { + + let init = () => { + let item = ($scope.ngDialogData && $scope.ngDialogData.item) || 'this'; + this.message = $scope.ngDialogData.message ? $scope.ngDialogData.message : `Are you sure you want to delete "${item}"?`; + this.title = $scope.ngDialogData.title ? $scope.ngDialogData.title : ''; + }; + + this.closeBox = isConfirmed => { + $scope.closeThisDialog(isConfirmed); + }; + + this.goTo = (state, params) => { + $scope.closeThisDialog(false); + $state.go(state,params); + + }; + + this.storeSelection = function(item) { + // $log.debug('CatalogCtrl:storeSelection: item.id is ' + item.id + ', select is ' + item.select); + var appData = { + appId : item.id, + select : item.select, + pending : item.pending + }; + catalogService.updateAppCatalog(appData).then( + function(result) { + // $log.debug('CatalogCtrl:storeSelection result is ', result); + })['catch'](function(err) { + $log.error('CatalogCtrl:storeSelection: exception: ', err); + }); + }; + + init(); + } + } + CatalogConfirmationBoxCtrl.$inject = ['$scope','$state','catalogService']; + angular.module('ecompApp').controller('CatalogConfirmationBoxCtrl', CatalogConfirmationBoxCtrl); +})(); \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/catalog/information-box.tpl.html b/ecomp-portal-FE/client/app/views/catalog/information-box.tpl.html new file mode 100644 index 00000000..ccc0a9f5 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/catalog/information-box.tpl.html @@ -0,0 +1,42 @@ + +
+
+
+
+ You do not have access to this application. + See the + + Get Access page and request access. +

+ You may check this box if access is pending: + +
+ +
+
+
+
Close
+
+
\ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/admin-confirmation-box.tpl.html b/ecomp-portal-FE/client/app/views/confirmation-box/admin-confirmation-box.tpl.html new file mode 100644 index 00000000..61a812bc --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/admin-confirmation-box.tpl.html @@ -0,0 +1,31 @@ + +
+
+
+
+
+
+
+
+
Confirm
+
Cancel
+
+
diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.controller.js b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.controller.js new file mode 100644 index 00000000..4f5e14b3 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.controller.js @@ -0,0 +1,41 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; +(function () { + class ConfirmationBoxCtrl { + constructor($scope) { + + let init = () => { + let item = ($scope.ngDialogData && $scope.ngDialogData.item) || 'this'; + this.message = $scope.ngDialogData.message ? $scope.ngDialogData.message : `Are you sure you want to delete "${item}"?`; + this.title = $scope.ngDialogData.title ? $scope.ngDialogData.title : ''; + }; + + this.closeBox = isConfirmed => { + $scope.closeThisDialog(isConfirmed); + }; + + init(); + } + } + ConfirmationBoxCtrl.$inject = ['$scope']; + angular.module('ecompApp').controller('ConfirmationBoxCtrl', ConfirmationBoxCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.less b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.less new file mode 100644 index 00000000..410d3967 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.less @@ -0,0 +1,53 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .confirmation-box-container { + .confirmation-message-wrap { + display: table; + height: 60px; + width: 100%; + + .confirmation-message { + .n14r; + display: table-cell; + vertical-align: middle; + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + } + } + + .confirmation-title-wrap { + display: table; + height: 20px; + width: 100%; + + .confirmation-title { + .n14r; + display: table-cell; + vertical-align: middle; + text-align: center; + font-weight: bold; + max-width: 100px; + overflow: hidden; + padding-bottom: 2px; + text-overflow: ellipsis; + } + } +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.tpl.html b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.tpl.html new file mode 100644 index 00000000..759bf137 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/confirmation-box.tpl.html @@ -0,0 +1,28 @@ + +
+
+
+
+
+
OK
+
Cancel
+
+
diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/dragdrop-confirmation-box.tpl.html b/ecomp-portal-FE/client/app/views/confirmation-box/dragdrop-confirmation-box.tpl.html new file mode 100644 index 00000000..61a812bc --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/dragdrop-confirmation-box.tpl.html @@ -0,0 +1,31 @@ + +
+
+
+
+
+
+
+
+
Confirm
+
Cancel
+
+
diff --git a/ecomp-portal-FE/client/app/views/confirmation-box/information-box.tpl.html b/ecomp-portal-FE/client/app/views/confirmation-box/information-box.tpl.html new file mode 100644 index 00000000..1e17e50a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/confirmation-box/information-box.tpl.html @@ -0,0 +1,27 @@ + +
+
+
+
+
+
Close
+
+
diff --git a/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget-manage.html b/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget-manage.html new file mode 100644 index 00000000..84ac2a44 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget-manage.html @@ -0,0 +1,152 @@ + +
+

+
+
+ +
+
Manage {{widgetTypeDisplay}} Widgets
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
TitleURLDateContentOrderEditDelete
+
+ +
+
+ +
+
+ +
+
{{rowData.content | cut:true:20:' ...'}}
+ +
+
+ +
+
+ +
+ + Save + +
+
+ +
+
+
+ +
+
+
+
+

Add

+
{{errMsg}}
+
+
+
+
+
+
+
Title
+ +
+
+
URL
+ +
+
+
Sort Order
+ +
+
+
+

Event Date

+
+
+

+ +

+
+
+
+ +
+
Content
+ +
+
+
+ Add New + +
+ +
+ +
+
+
+
+ Close +
+
+
+
+
+ + diff --git a/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget.controller.js b/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget.controller.js new file mode 100644 index 00000000..d489ac42 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/dashboard-widget.controller.js @@ -0,0 +1,422 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +(function () { + class CommonWidgetController { + constructor(dashboardService, $scope, message, $q, $http, conf, $filter,confirmBoxService,$log) { + $scope.widgetType = message.type; + $scope.widgetTypeDisplay = message.type; + $scope.modflag = false; + + switch (message.type) { + case 'EVENTS': + $scope.widgetTypeDisplay = 'Events' + break; + case 'NEWS': + $scope.widgetTypeDisplay = 'News' + break; + case 'IMPORTANTRESOURCES': + $scope.widgetTypeDisplay = 'Resources' + break; + } + + $scope.widgetData = []; + dashboardService.getCommonWidgetData(message.type) + .then(function (res) { + // console.log('CommonWidgetController: result is ' + res); + $scope.widgetData = res.response.items; + }); + + + + $scope.setEdit = function(index) { + + //for(var i=0; i<$scope.widgetData ) + + if($scope.modflag === false){ + $scope.widgetData[index].showEdit = true; + $scope.modflag = true; + } + } + + $scope.modify = function(index) { + + $scope.widgetObject = {}; + $scope.widgetObject.id = $scope.widgetData[parseInt(index)].id; + $scope.widgetObject.category = $scope.widgetData[parseInt(index)].category; + $scope.widgetObject.title = $scope.widgetData[parseInt(index)].title; + $scope.widgetObject.href = $scope.widgetData[parseInt(index)].href; + $scope.widgetObject.eventDate = $scope.widgetData[parseInt(index)].eventDate; + $scope.widgetObject.content = $scope.widgetData[parseInt(index)].content; + $scope.widgetObject.sortOrder = $scope.widgetData[parseInt(index)].sortOrder; + + var validateMsg = $scope.validateWidgetObject($scope.widgetObject); + if (validateMsg) { + confirmBoxService.showInformation(validateMsg).then(isConfirmed => {return;}); + return; + } + + dashboardService.saveCommonWidgetData($scope.widgetObject) + .then(function(res){ + if (res.status == 'OK') { + dashboardService.getCommonWidgetData(message.type) + .then(function(res){ + $scope.widgetData = res.response.items; + $scope.modflag = false; + $scope.cancelEdit(index); + }); + } + else { + // Save failed + confirmBoxService.showInformation("Save failed").then(isConfirmed => {return;}); + return; + } + }); + + }; + + $scope.newWidgetObject = {}; + + // Answers string error if validation fails; + // answers null if all is well. + $scope.validateWidgetObject = function(wo) { + if (wo.title == null || wo.title == '') + return "Please enter a title."; + if (wo.href == null || wo.href == '' || !validateUrl(wo.href)) + return "Please enter a valid URL that starts with http."; + if (wo.sortOrder == null || wo.sortOrder == '' || isNaN(parseInt(wo.sortOrder))) + return "Please enter a number for the sort order."; + if (wo.category=='EVENTS') { + if (wo.eventDate == null || wo.eventDate == '') + return "Please enter a date for the event."; + // Parses and normalizes the date with rollover. + var filteredDate = $filter('date')(wo.eventDate, "yyyy-MM-dd"); + // $log.debug('dashboard-widget-controller: date filter yields ' + filteredDate); + // The date picker shows mm/dd/yy. + if (filteredDate == null || filteredDate.length != 10) + return "Please enter a valid date as YYYY-MM-DD"; + if (wo.content==null || wo.content=='') + return "Please enter content for the event."; + } + return null; + }; + + $scope.saveNew = function() { + $scope.newWidgetObject.category = message.type; + // $log.info($scope.newWidgetObject); + var validateMsg = $scope.validateWidgetObject($scope.newWidgetObject); + if (validateMsg) { + confirmBoxService.showInformation(validateMsg).then(isConfirmed => {return;}); + return; + } + // Transform date into expected storage format + $scope.newWidgetObject.eventDate = $filter('date')($scope.newWidgetObject.eventDate, "yyyy-MM-dd"); + + dashboardService.saveCommonWidgetData($scope.newWidgetObject) + .then(function(res){ + if (res.status == 'OK') { + $scope.widgetForm.$setPristine(); + confirmBoxService.showInformation('You have added a new item').then(isConfirmed => { + }); + dashboardService.getCommonWidgetData(message.type) + .then(function(res){ + $scope.widgetData = res.response.items; + $scope.newWidgetObject = {}; + }); + } + else { + confirmBoxService.showInformation("Save failed").then(isConfirmed => {return;}); + return; + } + }); + }; + + $scope.remove = function(index) { + var confirmMsg = 'Are you sure you want to delete this item from the list?' + ' Press OK to delete.'; + confirmBoxService.confirm(confirmMsg).then(function (confirmed) { + if (confirmed == true) { + $scope.widgetObject = {}; + $scope.widgetObject.id = $scope.widgetData[parseInt(index)].id; + $scope.widgetObject.category = $scope.widgetData[parseInt(index)].category; + $scope.widgetObject.title = $scope.widgetData[parseInt(index)].title; + $scope.widgetObject.href = $scope.widgetData[parseInt(index)].href; + $scope.widgetObject.sortOrder = $scope.widgetData[parseInt(index)].sortOrder; + + + dashboardService.removeCommonWidgetData($scope.widgetObject) + .then(function(res){ + dashboardService.getCommonWidgetData(message.type) + .then(function(res){ + $scope.widgetData = res.response.items; + $scope.cancelEdit(index); + }); + }); + } + }); + + }; + $scope.closeDialog = function(){ + $scope.closeThisDialog( $scope.widgetData); + } + $scope.deleteSpeedDial = function(widget){ + + } + + $scope.manage = function(index) { + $scope.modflag = true; + + var thisdata = $scope.widgetData[index]; + $scope.editMode=true; + var category = "#category"+index; + var categoryEdit = "#categoryEdit"+index; + + var title = "#title"+index; + var titleEdit = "#titleEdit"+index; + + var url = "#href"+index; + var urlEdit = "#hrefEdit"+index; + + var order = "#order"+index; + var orderEdit = "#orderEdit"+index; + + var eventDate = "#eventDate"+index; + var eventDateEdit = "#eventDateEdit"+index; + + + var dsavebutton ="#savebutton"+index; + var dremovebutton="#removebutton"+index; + var dmanagebutton="#managebutton"+index; + var deditRbutton="#editRbutton"+index; + + $(title).css('display', 'none'); + $(titleEdit).css('display', 'inherit'); + $(url).css('display', 'none'); + $(urlEdit).css('display', 'inherit'); + $(order).css('display', 'none'); + $(orderEdit).css('display', 'inherit'); + $(eventDate).css('display', 'none'); + $(eventDateEdit).css('display', 'inherit'); + + $(dsavebutton).css('display', 'inherit'); + $(dremovebutton).css('display', 'inherit'); + $(dmanagebutton).css('display', 'none'); + $(deditRbutton).css('display', 'inherit'); + + }; + + $scope.cancelEdit = function(index) { + + $scope.editMode=false; + var category = "#category"+index; + var categoryEdit = "#categoryEdit"+index; + + var title = "#title"+index; + var titleEdit = "#titleEdit"+index; + + var url = "#href"+index; + var urlEdit = "#hrefEdit"+index; + + var order = "#order"+index; + var orderEdit = "#orderEdit"+index; + + var eventDate = "#eventDate"+index; + var eventDateEdit = "#eventDateEdit"+index; + + var dsavebutton ="#savebutton"+index; + var dremovebutton ="#removebutton"+index; + var dmanagebutton="#managebutton"+index; + var deditRbutton="#editRbutton"+index; + + $(title).css('display', 'inherit'); + $(titleEdit).css('display', 'none'); + + $(url).css('display', 'inherit'); + $(urlEdit).css('display', 'none'); + + $(order).css('display', 'inherit'); + $(orderEdit).css('display', 'none'); + + $(eventDate).css('display', 'inherit'); + $(eventDateEdit).css('display', 'none'); + + $(dsavebutton).css('display', 'none'); + $(dremovebutton).css('display', 'none'); + $(dmanagebutton).css('display', 'inherit'); + $(deditRbutton).css('display', 'none'); + + }; + + $scope.popupConfirmWin = function(title, msgBody, callback){ + modalService.popupConfirmWin.apply(null, arguments); + }; + } + } + CommonWidgetController.$inject = ['dashboardService', '$scope', 'message', '$q', '$http', 'conf', '$filter','confirmBoxService','$log']; + angular.module('ecompApp').controller('CommonWidgetController', CommonWidgetController); +})(); + +angular.module('ecompApp').filter('cut', function () { + return function (value, wordwise, max, tail) { + if (!value) return ''; + + max = parseInt(max, 10); + if (!max) return value; + if (value.length <= max) return value; + + value = value.substr(0, max); + if (wordwise) { + var lastspace = value.lastIndexOf(' '); + if (lastspace != -1) { + //Also remove . and , so its gives a cleaner result. + if (value.charAt(lastspace-1) == '.' || value.charAt(lastspace-1) == ',') { + lastspace = lastspace - 1; + } + value = value.substr(0, lastspace); + } + } + + return value + (tail || ' …'); + }; +}); + +angular.module('ecompApp').controller('DatePickerController', function ($scope, uibDateParser) { + $scope.today = function() { + $scope.dt = new Date(); + }; + $scope.today(); + + $scope.clear = function() { + $scope.dt = null; + }; + + $scope.inlineOptions = { + customClass: getDayClass, + minDate: new Date(), + showWeeks: true + }; + + $scope.dateOptions = { + dateDisabled: disabled, + formatYear: 'yy', + minDate: new Date(), + startingDay: 1 + }; + + // Disable weekend selection + function disabled(data) { + var date = data.date, + mode = data.mode; + return mode === 'day' && (date.getDay() === 0 || date.getDay() === 6); + } + + $scope.toggleMin = function() { + $scope.inlineOptions.minDate = $scope.inlineOptions.minDate ? null : new Date(); + $scope.dateOptions.minDate = $scope.inlineOptions.minDate; + }; + + $scope.toggleMin(); + + $scope.open1 = function() { + // console.log('In open1'); + $scope.popup1.opened = true; + }; + + $scope.open2 = function() { + // console.log('In open2'); + $scope.popup2.opened = true; + }; + + + $scope.setDate = function(year, month, day) { + $scope.dt = new Date(year, month, day); + }; + + $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; + $scope.format = $scope.formats[3]; + $scope.altInputFormats = ['M!/d!/yyyy']; + + $scope.popup1 = { + opened: false + }; + + $scope.popup2 = { + opened: false + }; + + var tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); + var afterTomorrow = new Date(); + afterTomorrow.setDate(tomorrow.getDate() + 1); + $scope.events = [ + { + date: tomorrow, + status: 'full' + }, + { + date: afterTomorrow, + status: 'partially' + } + ]; + + function getDayClass(data) { + var date = data.date, + mode = data.mode; + if (mode === 'day') { + var dayToCheck = new Date(date).setHours(0,0,0,0); + + for (var i = 0; i < $scope.events.length; i++) { + var currentDay = new Date($scope.events[i].date).setHours(0,0,0,0); + + if (dayToCheck === currentDay) { + return $scope.events[i].status; + } + } + } + + return ''; + } +}); + + + +function toggleCollapsible(id, clickedIconId, subtitutingIconId){ + $("#"+id).toggle(); + $("#"+clickedIconId).toggle(); + $("#"+subtitutingIconId).toggle(); + setTimeout(function(){focusFirstEle(id);}, 1000); +} + +function focusFirstEle(id){ + var focusItems = $("#"+id).find(":focusable"); + for(var i=0; i { + if(resourceType=='NEWS'){ + $scope.updateNews(); + }else if(resourceType=='EVENTS'){ + $scope.updateEvents(); + }else if(resourceType=='IMPORTANTRESOURCES'){ + $scope.updateImportRes(); + } + }); + }; + + userProfileService.getUserProfile() + .then( + function(profile) { + // $log.info(profile); + $scope.attuid = profile.attuid; + // $log.info('user has the following attuid: ' + + // profile.attuid); + $scope.appsView = []; + + applicationsService.getPersUserApps() + .then( + function(res) { + // $log.info(res); + _this.apps = res; + + for (var i = 0; i < _this.apps.length; i++) { + $scope.appsView[i] = { + sizeX : 2, + sizeY : 2, + headerText : _this.apps[i].name, + subHeaderText : _this.apps[i].notes, + imageLink : _this.apps[i].thumbnail || _this.apps[i].imageUrl, + order : _this.apps[i].order, + restrictedApp : _this.apps[i].restrictedApp, + url : _this.apps[i].url + }; + } + + // Append the show add/remove applications tile + $scope.appsView[_this.apps.length] = { + addRemoveApps : true, + sizeX : 2, + sizeY : 2, + headerText : 'Add/Remove Applications', + subHeaderText : '', + imageLink : 'assets/images/cloud.png', + order : '', + restrictedApp : false, + url : '' + }; + + // $log.info('getUserApps apps count : ' + + // $scope.appsView.length); + // Show 2 rows in the gridster if needed + if ($scope.appsView.length > 6) { + $(".dashboard-boarder").css({ + "height" : "400px" + }); + }else{ + $(".dashboard-boarder").css({ + "height" : "210px" + }); + } + _this.isLoading = false; + $scope.getUserAppsIsDone = true; + })['catch'] + (function(err) { + $log.error('DashboardCtlr: failed to get applications list', err); + _this.isLoading = false; + $scope.getUserAppsIsDone = true; + }); + }); + + + /* Widget Gridster Section */ + $scope.newsGridsterItem = { + sizeX : 4, + sizeY : 4, + headerText : 'News', + subHeaderText : '', + imageLink : '', + order : '', + url : '' + }; + + $scope.eventsGridsterItem = { + sizeX : 4, + sizeY : 4, + headerText : 'Calendar Events', + subHeaderText : '', + imageLink : '', + order : '', + url : '' + }; + + $scope.impoResGridsterItem = { + sizeX : 4, + sizeY : 4, + headerText : 'Resources', + subHeaderText : '', + imageLink : '', + order : '', + url : '' + }; + this.gridsterOpts = { + columns : 12, + colWidth : 95, + rowHeight : 95, + margins : [ 20, 20 ], + outerMargin : true, + pushing : true, + floating : true, + swapping : true, + draggable : { + handle: 'img' + } + }; + + this.emptyGridsterOpts = { + columns : 24, + colWidth : 190, + rowHeight : 190, + margins : [ 20, 20 ], + outerMargin : true, + pushing : true, + floating : true, + swapping : true, + draggable : { + handle: 'img' + } + }; + + this.goToCatalog = function(item) { + $state.go('root.appCatalog'); + } + + // 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 appUrl = null; + var urlParts = item.url.split('#'); + if (urlParts.length < 2) + appUrl = item.url + ccParam; + 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 + }; + $cookies.putObject('addTab', tabContent); + } + }; + + /* News data */ + $scope.newsData = []; + $scope.updateNews = function() { + $scope.newsData.length=0; + dashboardService.getCommonWidgetData('NEWS').then(function(res) { + // $log.info(res.message); + var newsDataJsonArray = res.response.items; + for (var i = 0; i < newsDataJsonArray.length; i++) { + $scope.newsData.push(newsDataJsonArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get news list', err); + _this.isLoading = false; + }); + } + $scope.updateNews(); + + /* Events data */ + $scope.eventData = []; + $scope.updateEvents = function() { + $scope.eventData.length=0; + dashboardService.getCommonWidgetData('EVENTS').then(function(res) { + var eventDataJsonArray = res.response.items; + for (var i = 0; i < eventDataJsonArray.length; i++) { + if(eventDataJsonArray[i].eventDate !=null) { + // yyyy-mm-dd + eventDataJsonArray[i].year = eventDataJsonArray[i].eventDate.substring(2,4); + eventDataJsonArray[i].mon = eventDataJsonArray[i].eventDate.substring(5,7); + eventDataJsonArray[i].day = eventDataJsonArray[i].eventDate.substring(8,10); + } + $scope.eventData.push(eventDataJsonArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get Events list', err); + _this.isLoading = false; + }); + } + $scope.updateEvents(); + + /* Important Resources data */ + $scope.importResData = []; + $scope.updateImportRes = function() { + $scope.importResData.length=0; + dashboardService.getCommonWidgetData('IMPORTANTRESOURCES').then( + function(res) { + // $log.error('couldnt get important list...', + // res.response.dataBlob); + // $log.info(res); + var importResDataJSONArray = res.response.items; + for (var i = 0; i < importResDataJSONArray.length; i++) { + $scope.importResData.push(importResDataJSONArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get resources list...', err); + _this.isLoading = false; + }); + } + $scope.updateImportRes(); + + if (getParameterByName('noUserError') != null) { + if (getParameterByName('noUserError') == "Show") { + $("#errorInfo").show(); + } + } + + }; + + DashboardCtrl.$inject = [ 'applicationsService', '$log', '$window', + 'userProfileService', '$scope', '$cookies', '$timeout', + '$interval', '$modal', '$state', 'dashboardService','ngDialog']; + 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, " "); +} diff --git a/ecomp-portal-FE/client/app/views/dashboard/dashboard.controller.spec.js b/ecomp-portal-FE/client/app/views/dashboard/dashboard.controller.spec.js new file mode 100644 index 00000000..0a2ddd3a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/dashboard.controller.spec.js @@ -0,0 +1,78 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +describe('Controller: DashboardCtrl ', function() { + beforeEach(module('ecompApp')); + + let DashboardCtrl, $controller, $q, rootScope, $log, $window, $cookies, scope; + let deferredApps, deferredUserProfile, applicationsServiceMock, userProfileServiceMock; + + + beforeEach(inject( (_$controller_, _$q_, _$rootScope_, _$log_, _$window_, _$cookies_, _CacheFactory_)=>{ + rootScope = _$rootScope_; + scope = rootScope.$new(); + $q = _$q_; + $controller = _$controller_; + $log = _$log_; + $window = _$window_; + $cookies = _$cookies_; + + _CacheFactory_.destroyAll(); + + deferredApps = $q.defer(); + deferredUserProfile = $q.defer(); + applicationsServiceMock = jasmine.createSpyObj('applicationsServiceMock', ['getUserApps']); + applicationsServiceMock.getUserApps.and.returnValue(deferredApps.promise); + + userProfileServiceMock = jasmine.createSpyObj('userProfileServiceMock',['getUserProfile']); + userProfileServiceMock.getUserProfile.and.returnValue(deferredUserProfile.promise); + + DashboardCtrl = $controller('DashboardCtrl', { + applicationsService: applicationsServiceMock, + $log: $log, + $window: $window, + userProfileService: userProfileServiceMock, + $scope: scope, + $cookies: $cookies + }); + scope.$digest(); + })); + + it('should populate this.apps with data from portals service getUserApps', inject(function ( _$q_) { + $q = _$q_; + + let profile = {roles: 'superAdmin', userId: 'userid'}; + + deferredUserProfile.resolve(profile) + deferredApps.resolve([{name: 'portal1'},{name: 'portal2'},{name: 'portal3'}]); + scope.$digest(); + expect(scope.appsViewData.length).toBe(3); + })); + + it('should call $log error when getAllPortals fail', inject(function ( _$q_) { + $q = _$q_; + spyOn($log, 'error'); + deferredUserProfile.reject('something happened!'); + scope.$digest(); + expect($log.error).toHaveBeenCalled(); + })); + +}); diff --git a/ecomp-portal-FE/client/app/views/dashboard/dashboard.less b/ecomp-portal-FE/client/app/views/dashboard/dashboard.less new file mode 100644 index 00000000..4dc1a6c8 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/dashboard.less @@ -0,0 +1,766 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-applications-home { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .gridster-item-container .gridster-item-body { + overflow-y:auto; + overflow-x:hidden; + } + + .go-button { + .btn-green; + width: 96px; + position: absolute; + border-radius: 0px; + } + + .applications-home-container { + .content_justify; + position: relative; + padding: 15px 0 32px 0; + width: 100%; + + .applications-home-title { + .a24r; + margin: auto; + .content_justify; + } + .portals-list { + min-height: 70vh; + //display: flex; + justify-content: center; + flex-flow: row wrap; + width: 1170px; + + margin: auto; + margin-bottom: 63px; + + .app-gridster-header { + background-color: @u; + font-size:12px; + overflow:hidden + } + + .app-gridster-footer { + background-color: @u; + } + + .portals-list-item { + background-color: @u; + border-radius: 2px; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + display: inline-block; + width: 360px; + height: 300px; + background-size: cover; + cursor: pointer; + margin: 15px; + overflow: hidden; + + .portals-item-info { + background-color: @u; + height: 120px; + top: 180px; + position: relative; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + padding: 16px; + + .info-title { + .a24r; + margin-bottom: 4px; + + text-overflow: ellipsis; + overflow: hidden; + } + .info-description { + .c16r; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + .info-button { + .btn-green; + width: 96px; + position: absolute; + bottom: 16px; + left: 16px; + } + + &:hover { + opacity: .93; + z-index: 3; + } + } + } + } + } +} +.w-ecomp-main-error{ + .o14r; + position: absolute; + width: 100%; + line-height: 1.5em; +} +.w-ecomp-main-disclaimer { + text-align: center; + .o14r; + //position: absolute; + bottom: -75px; + line-height: 1.5em; + margin: 0 auto; + width:1170px; + position: relative; + +} +.build-number { + .o12i; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +.slide.ng-hide-add, +.slide.ng-hide-remove, +.slide.ng-enter, +.slide.ng-leave { + transition: all 0.5s ease; +} +.slide.ng-hide, +.slide.ng-enter { + transform: translate(-100%, 0); +} +.slide.ng-enter-active { + transform: translate(0, 0); +} +.slide.ng-leave { + transform: translate(0, 0); +} +.slide.ng-leave-active { + transform: translate(+100%, 0); +} +.dashboard-boarder{ + height: 210px; + overflow: auto; +} +.dashboard-information-boarder{ + border: 2px solid #ccc!important; + border-radius: 16px!important; +} + +#information-section { + margin-top:50px; +} + +.information-section-title{ + color: #0574ac; + font-family: arial; + font-size: 25px; + margin: 20px; + width: 1170px; +} +#left { + float: left; + width: 33%; + height:300px; + background-color:white; +} + +#center { + float: right; + width: 33%; + height:300px; + background: white; +} +#right { + margin-left:34%; + margin-right:34%; + height:300px; + background:white; +} + + +.dock ul{ +display: inline-block; + +width: auto; +margin: 0px; +padding: 0px; +list-style: none; + +} +.dock ul li { +width: auto; +height: auto; +display: inline-block; +bottom: 0; +vertical-align: bottom; +margin-top: -43px; +} +.dock ul li a { +display: block; +height: 150px; +width: 150px; +position: relative; +-webkit-transition-property: width, height,margin-top; +-webkit-transition-duration: 0.5s; +-o-transition-property: width, height,margin-top; +-o-transition-duration: 0.5s; +-moz-transition-property: width, height,margin-top; +-moz-transition-duration: 0.5s; +} +.dock ul li a:hover { +width: 200px; +height: 200px; +margin-top: -50px; +} +.dock ul li a img { +width: 100%; +position: absolute; +bottom: 0; +left: 0; +border: none; +padding: 0px 0px 0px 30px; +} +.dock_left{ +width: 31px; +-webkit-transform: rotate(33deg); +-moz-transform: rotate(33deg); +-o-transform: rotate(33deg); +position: relative; +background: #EEE; +overflow: hidden; +float: left; +height: 100px; +z-index: 2; +margin: -18px; +} +.dock_right{ +width: 36px; +-webkit-transform: rotate(-33deg); +-moz-transform: rotate(-33deg); +-o-transform: rotate(-33deg); +position: relative; +background: #EEE; +overflow: hidden; +float: left; +height: 100px; +z-index: 2; +margin: -18px; +} + + + + +* {margin: 0; padding: 0;} +body {background: #ccc;} + +.slider{ + width: 640px; + position: relative; + padding-top: 320px; + + margin: 50px auto; + + box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.75); +} + +.slider>img{ + position: absolute; + left: 0; top: 0; + transition: all 0.5s; +} + +.slider input[name='slide_switch'] { + display: none; +} + +.slider label { + margin: 18px 0 0 18px; + border: 3px solid #999; + + float: left; + cursor: pointer; + transition: all 0.5s; + + opacity: 0.6; +} + +.slider label img{ + display: block; +} + +.slider input[name='slide_switch']:checked+label { + border-color: #666; + opacity: 1; +} + +.slider input[name='slide_switch'] ~ img { + opacity: 0; + transform: scale(1.1); +} +/*That hides all main images at a 110% size +On click the images will be displayed at normal size to complete the effect +*/ +.slider input[name='slide_switch']:checked+label+img { + opacity: 1; + transform: scale(1); +} + +.accordion { + width: 895px; height: 320px; + overflow: hidden; + box-shadow: 0 10px 6px -6px #111; + margin: 20px auto +} +.accordion ul { width: 200% } + +.accordion li { + position: relative; + display: block; + width: 160px; + float: left; + box-shadow: 0 0 30px 8px #222; + transition: all 0.4s ease .300ms; +} + +.accordion ul:hover li {width: 40px } +.accordion ul li:hover {width: 640px } + +.caption { + background: rgba(0, 0, 0, 0.5); + position: absolute; + bottom: 0; + width: 640px +} + +.caption a { + display: block; + color: #fff; + text-decoration: none; + font: normal 16px 'Lato', Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + padding: 15px; +} + + + +/*events*/ +.events-date{ + margin-left: 10px; + float:left; + white-space: normal; + display: inline-block; + vertical-align: middle; + width: 55px; +} +.event-title-div{ + float: left; + width: 235px; + line-height: 20px; + padding: 5px; + font-size: 14px; + margin-left: 4px; +} +.events-date{ + height: 20px; + margin-left: 4px; + font-size: 14px; +} +.events-content{ + font-size: 14px; + color: #444; + margin-right: 10px; +} +.events-content-body{ + margin-top:5px; + color:#444; + margin-left:12px; + line-height:1.5; +} +.events { + border-radius: 4px; + padding: 3px; + -webkit-user-select: none; +} +.events ul { + float: left; + width:100%; + -webkit-user-select: none +} +.events ul li { + line-height: 30px; + list-style: none; + border-bottom: 2px solid grey; + height: 100%; + min-height: 42px; +} +.events ul li:hover { + background: #ddd; + cursor: pointer; +} +.events ul li a { + color: black; + text-decoration: none; + font: 14px Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + -webkit-user-select: none; + font-family: arial; +} +.events-link{ + color: #067ab4 !important; +} + + + +/*widgets*/ +.singleBtnBorder { + border-radius: 6px 6px 6px 6px; +} + +.widgetHeaderBtn{ + + height: 30px; + background-color: #FFFFFF; + position: relative; + display: inline-block; + -moz-background-clip: padding-box; + -webkit-background-clip: padding-box; + background-clip: padding-box; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 8px 20px; + font-size: 14px; + line-height: 14px; + min-width: 60px; + border: none; + border-radius: 6px; + background-color: #ffffff; + background-image: none; + color: #ffffff; + vertical-align: middle; + text-align: center; + text-decoration: none; + text-transform: capitalize; + text-shadow: none; + white-space: nowrap; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + -webkit-transition: background-color 0.3s ease-out; + -moz-transition: background-color 0.3s ease-out; + transition: background-color 0.3s ease-out; + } + +.widgetHeaderBtnPosition { + width: 30px; + min-width: 0px; + border: 1px solid #AAAAAA; + padding-left: 5px; + padding-right: 5px; + } + +.icon-anchor { + color: #888; +} + +.widgetHeaderBtn:hover, .widgetHeaderBtn:focus { + background: rgba(0, 0, 0, 0); + color: #3a7999; + box-shadow: inset 0 0 0 2px #3a7999; +} + +@keyframes ticker { + 0% {margin-top: 0} + 25% {margin-top: -55px} + 50% {margin-top: -110px} + 75% {margin-top: -165px} + 100% {margin-top: 0} +} + +body { background: #333; width: 100%; height: 100% } + +.news { + + width: 350px; + height: 250px; + margin: 0px auto; + border-radius: 4px; + padding: 3px; + -webkit-user-select: none; + +} + + + +.news ul { + float: left; + width:100%; + -webkit-user-select: none +} + +.news ul li {line-height: 30px; list-style: none; + border-bottom: 2px solid grey; + min-height: 42px; + } + +.news ul li:hover { + background: #ddd; + cursor: pointer; +} + +.news ul li a { + color: black; + text-decoration: none; + font-size: 14px; + line-height: 1.5; + display: inline-block; + width:100%; + min-height:40px; + padding-top: 5px; + padding-bottom: 5px; + -webkit-font-smoothing: antialiased; + -webkit-user-select: none; + + /* font-family: arial;*/ +} + +.news ul:hover { animation-play-state: paused } +.news span:hover+ul { animation-play-state: paused } +.resources { + + width: 350px; + height: 200px; + margin-left: 5px; + border-radius: 4px; + padding: 3px; + -webkit-user-select: none; + +} + + + +.resources ul { + float: left; + width:100%; + + -webkit-user-select: none +} + +.resources ul li {line-height: 30px; list-style: none; + border-bottom: 2px solid grey; + min-height: 42px; + } + +.resources ul li:hover { + background: #ddd; + cursor: pointer; +} + +.resources ul li a { + color: black; + text-decoration: none; + font-size: 14px; + line-height: 1.5; + width:100%; + min-height:40px; + display: inline-block; + padding-top: 5px; + padding-bottom: 5px; + -webkit-font-smoothing: antialiased; + -webkit-user-select: none; +} + + +.blue { background: #347fd0 } +.blue span { background: #2c66be } +.red { background: #d23435 } +.red span { background: #c22b2c } +.green { background: #699B67 } +.green span { background: #547d52 } +.magenta { background: #b63ace } +.magenta span { background: #842696 } + + +.box-one { + -webkit-transition:all linear 0.4s; + transition:all linear 0.4s; + height:100px; width:200px; background:white; border: 2px solid #ccc!important; + border-radius: 16px!important; +} +.box-one.ng-hide { +display: block!important; + opacity:0; +} + +.gridsterContent{ + height:120px; +} +.gridsterAppContent{ + height:120px; + +} + + .gridsterImage{ + height:84px; + width:168px; + } + .grider-content-ecomp{ + transition: transform 0.5s ease-out; + } + .grider-content-ecomp:hover{ + transform: scale(1.1); +} + + +.information-section{ + /*margin-top:25px;*/ +} +.information-section-gridsterContent{ + height:300px; +} +.information-sections-gridster-header{ + color: #0574ac; + font-family: arial; + font-size: 25px; + +} +/*application empty div*/ +.app-error-block { + padding-top: 10px; + +} +.activity-error-block { + padding-top: 60px; + +} + +.activity-error-msg1{ + text-align: center; + margin-top: 20px; + font-family: arial; + color: #444; + font-size: 20px; + +} + +.newstape { + background: white; + color: black; + height: 400px; + overflow: hidden; +} + +.newstape-content { + position: relative; + padding: 15px; +} + +.newstape-drag { cursor: ns-resize; } + +.text-center { text-align: center; } + +.text-right { text-align: right; } + +.text-justify { text-align: justify; } + +.optionsMenu{ + position: absolute; + list-style: none; + top: 25px; + right: 10px; + border: 1px solid #067ab4; + display: none; + z-index: 2; + border-radius: 6px 0px 6px 6px; + background: #fff; + width: 130px; +} + +.optionsMenuLink { + position: relative; + padding-left: 8px; + padding-right: 2px; + font-size: 12px; + line-height: 30px; + color: #444444; +} +.optionsMenu > li:hover a { + color: #ffffff !important; +} +.optionsMenu > li { + width: 100%; + text-align: left; +} +.optionsMenu > li:hover { + background-color: #0faaf7; + border-color: none !important; + cursor: pointer; +} + +.simulateGridHeader{ + position: relative; + height: 50px !important; + border: 1px solid #d3d3d3; + border-bottom: 0; + background-color: #E5E5E5; + white-space: nowrap; + text-overflow: ellipsis; + z-index: 1; +} + +.simulateGridHeaderTitle{ + line-height: 44px; + margin-left: 26px; + font-family: arial; + font-size: 18px; + color: #444444; + float: left; +} + +.simulateGridHeaderHandle{ + cursor: move; + margin: 12px; + position: absolute; + top: 0; + left: 0; + border: 0; + vertical-align: middle; + -ms-interpolation-mode: bicubic; + display: block; +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/dashboard/dashboard.tpl.html b/ecomp-portal-FE/client/app/views/dashboard/dashboard.tpl.html new file mode 100644 index 00000000..0d96a585 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/dashboard.tpl.html @@ -0,0 +1,346 @@ + +
+
+ +
+
+
+ Applications +
+
+
+ +
+ +
+
+
+ Click on the tile at the left to personalize your applications. +
+
+ +
+ +
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+ + + + + +
+ +
+
+
+
    +
  • +
+
+
+
+
+
There's currently no + news available.
+
+
+
+
+
+
+ +
+
+
+ + + + +
+
+
+
+
    +
  • +
    +
    {{event.mon}}/{{event.day}}/{{event.year}} +
    +
    +
    +

    +
    +
    + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
  • + + +
+
+
+
+
+
There's currently no + event available.
+
+
+
+
+
+
+ + +
+
+ +
+ + + +
    + +
  • + Edit +
  • + + +
+
+
+
+
+ +
+
+
+
+
There's currently no + links available.
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+ +
+ +
+ +
+
\ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/dashboard/newsticker.controller.js b/ecomp-portal-FE/client/app/views/dashboard/newsticker.controller.js new file mode 100644 index 00000000..88e6942e --- /dev/null +++ b/ecomp-portal-FE/client/app/views/dashboard/newsticker.controller.js @@ -0,0 +1,47 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class NewsTickerController { + constructor($scope) { + $scope.newstape = function(){ + jQuery('.newstape').newstape({ + + period: 30, + + offset: 1, + + mousewheel: true, + + mousewheelRate: 30, + + dragable: true, + + heightSpy: true + + }); + }; + $scope.newstape(); + + } + } + NewsTickerController.$inject = ['$scope']; + angular.module('ecompApp').controller('NewsTickerController', NewsTickerController); +})(); diff --git a/ecomp-portal-FE/client/app/views/errors/error.404.tpl.html b/ecomp-portal-FE/client/app/views/errors/error.404.tpl.html new file mode 100644 index 00000000..255bfe36 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/errors/error.404.tpl.html @@ -0,0 +1,31 @@ + +
+
+
+
Page Not Found
+
+ The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please select from the + menu on the left to navigate to a valid page. + +
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/errors/error.controller.js b/ecomp-portal-FE/client/app/views/errors/error.controller.js new file mode 100644 index 00000000..7bf86c24 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/errors/error.controller.js @@ -0,0 +1,36 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class ErrorCtrl { + constructor($scope, $window) { + + $scope.errorMsg = ''; + + if(window.location.href.indexOf('noUserError') !== -1){ + $scope.errorMsg = 'You do not have a user account for this application. Please contact your system administrator'; + } else if(window.location.href.indexOf('unKnownError') !== -1){ + $scope.errorMsg = 'An unknown error has occurred. Please contact your system administrator'; + } + } + } + ErrorCtrl.$inject = ['$scope','$window']; + angular.module('ecompApp').controller('ErrorCtrl', ErrorCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/errors/error.tpl.html b/ecomp-portal-FE/client/app/views/errors/error.tpl.html new file mode 100644 index 00000000..9de8084a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/errors/error.tpl.html @@ -0,0 +1,26 @@ + +
+
+
+
{{errorMsg}}
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/footer/footer.controller.js b/ecomp-portal-FE/client/app/views/footer/footer.controller.js new file mode 100644 index 00000000..adcd470a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/footer/footer.controller.js @@ -0,0 +1,49 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class FooterCtrl { + constructor($scope, $rootScope, manifestService, $log) { + this.manifestService = manifestService; + this.$log = $log; + this.$scope = $scope; + this.$rootScope = $rootScope; + + $scope.buildinfo = null; + + $rootScope.showFooter = true; + $scope.date = new Date(); + + $scope.portalName = "OpenECOMP Portal Version: "; + + manifestService.getManifest().then( jsonObj => { + // $log.debug('FooterCtrl.getManifest: ', JSON.stringify(jsonObj)); + $scope.buildInfo = jsonObj; + + }).catch(err=> { + $log.error('FooterCtrl::updateTableData error :',err); + }); + }; + + } + + FooterCtrl.$inject = ['$scope', '$rootScope', 'manifestService', '$log']; + angular.module('ecompApp').controller('FooterCtrl', FooterCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/footer/footer.controller.spec.js b/ecomp-portal-FE/client/app/views/footer/footer.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/footer/footer.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/footer/footer.less b/ecomp-portal-FE/client/app/views/footer/footer.less new file mode 100644 index 00000000..f8eee07d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/footer/footer.less @@ -0,0 +1,53 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-footer { + z-index: 101; + background-color: rgb(6, 122, 180); + position: absolute; + bottom: 0; + width: 100%; + height: @footer-height; + .o12r; + color: white; + + a { + color: white; + } + + .footer-image { + margin: auto; + + } + + .build-number { + float: right; + padding: 5px; + color: white; + } + .footer-content { + align-items: center; + text-align: center; + vertical-align: middle; + display: flex; + justify-content: center; + //width: @table-width; + margin: auto; + } +} diff --git a/ecomp-portal-FE/client/app/views/footer/footer.tpl.html b/ecomp-portal-FE/client/app/views/footer/footer.tpl.html new file mode 100644 index 00000000..a1788a3a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/footer/footer.tpl.html @@ -0,0 +1,36 @@ + + diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.controller.js b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.controller.js new file mode 100644 index 00000000..0d27d868 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.controller.js @@ -0,0 +1,384 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class MenuDetailsModalCtrl { + constructor($scope, $log, functionalMenuService, errorMessageByCode, ECOMP_URL_REGEX,$rootScope,confirmBoxService) { + let newMenuModel = { + name: null, + menuId: null, + parentMenuId: null, + url: null + }; + + let getAvailableRoles = (appid) => { + this.isSaving = true; + if (appid != null) { + $log.debug("MenuDetailsModalCtrl::getAvailableRoles: About to call getManagedRolesMenu"); + functionalMenuService.getManagedRolesMenu(appid).then(rolesObj => { + $log.debug("MenuDetailsModalCtrl::getAvailableRoles: Roles returned = " + JSON.stringify(rolesObj)) + this.availableRoles = rolesObj; + this.preSelectedRoles = {roles:[]}; + + if(($scope.ngDialogData.source=='edit') && this.isMidLevelMenuItem()){ + this.preSelectedRoles = {roles:[]}; + }else if(!angular.isUndefined(this.menuItem.menuDetails) && + $scope.ngDialogData.source=='edit' && this.isLeafMenuItem() && + this.menuItem.menuDetails.appid!=appid) { + this.preSelectedRoles = {roles:[]}; + }else{ + if((!angular.isUndefined(this.menuItem.menuDetails)) && + (!angular.isUndefined(this.menuItem.menuDetails.roles))){ + $log.debug('menuDetails.roles: ' + this.menuItem.menuDetails.roles); + for(var i=0; i { + $log.error("MenuDetailsModalCtrl::getAvailableRoles: error: " + err); + }); + } else { + $log.debug("MenuDetailsModalCtrl::getAvailableRoles: appid was null"); + } + }; + + let getAvailableApps = () => { + functionalMenuService.getAvailableApplications().then(apps => { + $log.debug("MenuDetailsModalCtrl::getAvailableApps: Apps returned = " + JSON.stringify(apps)) + this.availableApps = apps; + if (angular.isDefined(this.selectedApp) && angular.isDefined(this.selectedApp.index)) { + for (var i = 0; i < apps.length; i++) { + if (apps[i].index === this.selectedApp.index) { + $log.debug("MenuDetailsModalCtrl::getAvailableApps: found app with index: " + this.selectedApp.index); + $log.debug("MenuDetailsModalCtrl::getAvailableApps: setting isDisabled to: " + !apps[i].enabled); + this.selectedApp.isDisabled = !apps[i].enabled; + break; + } + } + $log.debug("didn't find index: " + this.selectedApp.index); + } + })['catch'](function (err) { + $log.error("MenuDetailsModalCtrl::getAvailableApps: getAvailableApps error: " + err); + }).finally(()=>{ + this.isSaving = false; + }); + }; + + let init = () => { + $log.info('MenuDetailsModalCtrl::init'); + this.saveOrContinueBtnText = "Save"; + this.isSaving = false; + this.displayRoles = $scope.ngDialogData.source=='view' ? true : false; + this.formEditable = $scope.ngDialogData.source=='view' ? false : true; + this.selectedRole = []; + this.availableRoles = []; + this.menuItem = _.clone($scope.ngDialogData.menuItem); + $log.info('MenuDetailsModalCtrl::getAvailableApps: Within init, about to check menuDetails for defined'); + if(!angular.isUndefined(this.menuItem.menuDetails) && + ($scope.ngDialogData.source=='view' || + ($scope.ngDialogData.source=='edit') && this.isLeafMenuItem() )){ + + $log.debug("MenuDetailsModalCtrl::init: menuItem: "); + $log.debug('MenuDetailsModalCtrl::init: ',this.menuItem); + this.menuItem.menu.url = this.menuItem.menuDetails.url; + this.selectedApp={}; + this.selectedApp.index = this.menuItem.menuDetails.appid; + getAvailableRoles(this.selectedApp.index); + + } + + if($scope.ngDialogData.source=='view' || $scope.ngDialogData.source=='edit'){ + this.menutitle = this.menuItem.menu.name; + this.menuLocation = this.isParentMenuItem() ? this.menuItem.menu.name : this.menuItem.menu.parent.name; + }else{ + this.menutitle = ''; + this.menuLocation = this.menuItem.menu.name; + } + getAvailableApps(); + $log.debug("MenuDetailsModalCtrl::init: Menu details: " + JSON.stringify(this.menuItem.menuDetails)); + }; + + + this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; + + this.conflictMessages = {}; + this.scrollApi = {}; + let handleConflictErrors = err => { + if(!err.data){ + return; + } + if(!err.data.length){ + err.data = [err.data] + } + $log.debug('MenuDetailsModalCtrl::handleConflictErrors: err.data = ' + JSON.stringify(err.data)); + _.forEach(err.data, item => { + _.forEach(item.fields, field => { + this.conflictMessages[field.name] = errorMessageByCode[item.errorCode]; + $log.debug('MenuDetailsModalCtrl::handleConflictErrors: fieldName = ' + field.name); + $scope.functionalMenuForm[field.name].$setValidity('conflict', false); + watchOnce[field.name](); + }); + }); + this.scrollApi.scrollTop(); + }; + + let resetConflict = fieldName => { + delete this.conflictMessages[fieldName]; + $log.debug('MenuDetailsModalCtrl::resetConflict: $setValidity(true) = ' + fieldName); + if($scope.functionalMenuForm[fieldName]){ + $scope.functionalMenuForm[fieldName].$setValidity('conflict', true); + } + }; + + let watchOnce = { + text: () => { + let unregisterName = $scope.$watch('functionalMenuDetails.menutitle', (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()){ + resetConflict('text'); + unregisterName(); + } + }); + }, + url: () => { + let unregisterUrl = $scope.$watch('functionalMenuDetails.menuItem.menu.url', (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()){ + resetConflict('url'); + unregisterUrl(); + } + }); + } + }; + + //*************************** + + this.isLeafMenuItem = () => { + return this.menuItem.menu.children.length>0 ? false : true; + }; + + this.isMidLevelMenuItem = () => { + return this.menuItem.menu.parentMenuId!=null && this.menuItem.menu.children.length>0 ? true : false; + }; + + this.isParentMenuItem = () => { + return this.menuItem.menu.parentMenuId!=null ? false : true; + }; + + this.updateSelectedApp = (appItem) => { + if (!appItem) { + return; + } + $log.debug('MenuDetailsModalCtrl::updateSelectedApp: drop down app item = ' + JSON.stringify(appItem.index)); + $log.debug("MenuDetailsModalCtrl::updateSelectedApp: appItem in updateSelectedApp: "); + $log.debug('MenuDetailsModalCtrl::updateSelectedApp: ',appItem); + this.selectedApp.isDisabled = ! appItem.enabled; + $log.debug("MenuDetailsModalCtrl::updateSelectedApp: isDisabled: "+this.selectedApp.isDisabled); + getAvailableRoles(appItem.index); + }; + + this.continue = () => { + this.displayRoles = true; + this.formEditable = false; + }; + + this.saveChanges = () => { + + if(!!this.menuItem.menu.url && (angular.isUndefined(this.selectedApp) || !this.selectedApp.index>0)) { + confirmBoxService.showInformation('Please select the appropriate app, or remove the url').then(isConfirmed => {}); + return; + }else if(!this.menuItem.menu.url && !angular.isUndefined(this.selectedApp) && this.selectedApp.index>0){ + confirmBoxService.showInformation('Please enter url, or select "No Application"').then(isConfirmed => {}); + return; + }else if(!this.menutitle){ + confirmBoxService.showInformation('Please enter the Menu title').then(isConfirmed => {}); + return; + } + + this.isSaving = true; + var activeMenuItem = {}; + + if ($scope.ngDialogData.source == 'edit') { + $log.debug('MenuDetailsModalCtrl::saveChanges: Will be saving an edit menu item'); + activeMenuItem = { + menuId:this.menuItem.menu.menuId, + column:this.menuItem.menu.column, + text:this.menutitle, + parentMenuId:this.menuItem.menu.parentMenuId, + url:this.menuItem.menu.url, + appid: angular.isUndefined(this.selectedApp) ? null:this.selectedApp.index, + roles:this.selectedRole + }; + if (!activeMenuItem.appid && !activeMenuItem.url) { + activeMenuItem.roles = null; + } + functionalMenuService.saveEditedMenuItem(activeMenuItem) + .then(() => { + $log.debug('MenuDetailsModalCtrl::saveChanges: Menu Item saved'); + $scope.closeThisDialog(true); + }).catch(err => { + if(err.status === 409){ + handleConflictErrors(err); + } + $log.error('MenuDetailsModalCtrl::saveChanges: error - ',err); + }).finally(()=>{ + this.isSaving = false; + }); + + $log.debug("MenuDetailsModalCtrl::saveChanges: Edit Menu output will be: " + JSON.stringify(activeMenuItem)); + } else { + $log.debug('MenuDetailsModalCtrl::saveChanges: Will be saving a New menu item'); + var newMenuItem = { + menuId:null, + column:this.menuItem.menu.column, + text:this.menutitle, + parentMenuId:this.menuItem.menu.menuId, + url:this.menuItem.menu.url, + appid: angular.isUndefined(this.selectedApp) ? null:this.selectedApp.index, + roles:this.selectedRole + }; + + $log.debug("MenuDetailsModalCtrl::saveChanges: New Menu output will be: " + JSON.stringify(newMenuItem)); + functionalMenuService.saveMenuItem(newMenuItem) + .then(() => { + $log.debug('MenuDetailsModalCtrl::saveChanges: Menu Item saved'); + $scope.closeThisDialog(true); + }).catch(err => { + if(err.status === 409){//Conflict + handleConflictErrors(err); + } + $log.error('MenuDetailsModalCtrl::saveChanges error: ', err); + }).finally(()=>{ + this.isSaving = false; + }); + + } + }; + + init(); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + MenuDetailsModalCtrl.$inject = ['$scope', '$log', 'functionalMenuService', 'errorMessageByCode', 'ECOMP_URL_REGEX','$rootScope','confirmBoxService']; + angular.module('ecompApp').controller('MenuDetailsModalCtrl', MenuDetailsModalCtrl); + + angular.module('ecompApp').directive('dropdownMultiselect', ['functionalMenuService',function(){ + return { + restrict: 'E', + scope: { + model: '=', + options: '=', + populated_roles: '=preSelected', + dropdownTitle: '@', + source: '=' + }, + template: "
" + + "" + + "" + + "" + + "
", + controller: function ($scope) { + $scope.selectedItems = {}; + $scope.checkAll = false; + $scope.$on('availableRolesReady', function() { + init(); + }); + + function init() { + console.log('dropdownMultiselect init'); + $scope.dropdownTitle = $scope.source =='view' ? 'View Roles' : 'Select Roles'; + console.log('$scope.populated_roles = ' + $scope.populated_roles); + } + + $scope.$watch('populated_roles', function(){ + if ($scope.populated_roles && $scope.populated_roles.length>0) { + for (var i = 0; i < $scope.populated_roles.length; i++) { + $scope.model.push($scope.populated_roles[i].roleId); + $scope.selectedItems[$scope.populated_roles[i].roleId] = true; + } + if ($scope.populated_roles.length == $scope.options.length) { + $scope.checkAll = true; + } + }else{ + deselectAll(); + } + }); + + $scope.openDropDown = function () { + + }; + + $scope.checkAllClicked = function () { + if ($scope.checkAll) { + selectAll(); + } else { + deselectAll(); + } + }; + + function selectAll() { + $scope.model = []; + $scope.selectedItems = {}; + angular.forEach($scope.options, function (option) { + $scope.model.push(option.roleId); + }); + angular.forEach($scope.model, function (id) { + $scope.selectedItems[id] = true; + }); + console.log($scope.model); + }; + + function deselectAll() { + $scope.model = []; + $scope.selectedItems = {}; + console.log($scope.model); + }; + + $scope.setSelectedItem = function (id) { + var filteredArray = []; + if ($scope.selectedItems[id] == true) { + $scope.model.push(id); + } else { + filteredArray = $scope.model.filter(function (value) { + return value != id; + }); + $scope.model = filteredArray; + $scope.checkAll = false; + } + console.log(filteredArray); + return false; + }; + + $scope.setDisable = function(source){ + return source =='view' ? true : false; + } + } + } + }]); + +})(); diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.delete.modal.html b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.delete.modal.html new file mode 100644 index 00000000..7157886b --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.delete.modal.html @@ -0,0 +1,35 @@ + +
+
Delete Menu Item
+
+
+
+
+
+
+
+
+ + +
Cancel
+
+
diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html new file mode 100644 index 00000000..58588ce5 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html @@ -0,0 +1,106 @@ + +
+
{{ngDialogData.title}}
+
+
+
+
Parent
+ +
+
+
Title
+ +
+ +
+
+
+
+
URL
+ + Not valid URL! +
+
+
App
+
+ +
+
+
+
+
Roles
+ + +
+
Application is disabled
+
+
+
+
+ + + + + + + + + + +
+
+
Close
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/modal-details.modal.less b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/modal-details.modal.less new file mode 100644 index 00000000..c322f453 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu-dialog/modal-details.modal.less @@ -0,0 +1,103 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .functionalMenu-details-modal { + height: 430px; + + .title { + .n18r; + border-bottom: @a 3px solid; + + } + + .btn-medium{ + width:216px; + } + .dropdown-menu-medium{ + width:236px; + max-height: 200px; + overflow-y: auto; + } + + .functionalMenu-properties-main { + padding: 16px; + height: 306px; + overflow-y: visible; + + .item{ + position: relative; + margin-bottom: 18px; + + .input-field{ + .custom-input-field; + width: 100%; + &.url{ + width: 78%; + display: inline-block; + } + } + + .select-field { + .custom-select-field; + } + + .item-label{ + .o14r; + } + + .right-item{ + position: relative; + display: inline-block; + width: 48%; + float: right; + } + .left-item{ + display: inline-block; + width: 48%; + } + + .url-validation-button{ + .btn-blue; + width: 20%; + display: inline-block; + float: right; + } + + .error-container{ + position: absolute; + width: 220px; + display: block; + height: 12px; + line-height: 12px; + + .err-message{ + color: red; + font-size: 9px; + } + .valid-message{ + color: green; + font-size: 9px; + } + } + + } + + } + +} diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.controller.js b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.controller.js new file mode 100644 index 00000000..d17c4ab8 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.controller.js @@ -0,0 +1,331 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class FunctionalMenuCtrl { + constructor($log, functionalMenuService, $scope,ngDialog, confirmBoxService) { + $log.info('FunctionalMenuCtrl init'); + + $scope.invokeDialog = () => { + alert("click dialog"); + }; + + this.regenerateFunctionalMenuAncestors = () => { + functionalMenuService.regenerateFunctionalMenuAncestors().then(res => { + $log.debug("FunctionalMenuCtrl:regenerateFunctionalMenuAncestors::returned from regenerateFunctionalMenuAncestors API call"); + confirmBoxService.showInformation('You have successfully regenerated the menu.').then(isConfirmed => { + }); + })['catch'](function (err) { + $log.error("FunctionalMenuCtrl:regenerateFunctionalMenuAncestors:: error: " + err); + confirmBoxService.showInformation('There was an error while regenerating the menu.').then(isConfirmed => { + }); + }); + }; + + let getFunctionalMenu = () => { + this.isLoadingTable = true; + functionalMenuService.getManagedFunctionalMenu().then(res => { + + let actualData=[]; + + for(let i = 0; i < res.length; i++){ + res[i].children=[]; + res[i].label=res[i].text; + res[i].id=res[i].text; + + } + + for(let i = 0; i < res.length; i++){ + + let parentId=res[i].menuId; + for(let j = 0; j < res.length; j++){ + let childId=res[j].parentMenuId; + if(parentId==childId){ + res[i].children.push(res[j]); + + } + } + } + + res.sort(function(a, b) { + return a.column-b.column; + }) + + for(let i = 0; i < res.length; i++){ + res[i].children.sort(function(a, b){ + return a.column-b.column; + }) + } + + for(let i = 0; i < res.length; i++){ + let parentId=res[i].parentMenuId; + if(parentId==null){ + actualData.push(res[i]); + } + } + + $scope.treedata = actualData; + + }).catch(err => { + $log.error('FunctionalMenuCtrl:getFunctionalMenu:: error ',err); + }).finally(()=> { + this.isLoadingTable = false; + }); + + }; + + + let init = () => { + this.isLoadingTable = false; + this.functionalMenu = []; + getFunctionalMenu(); + this.searchString = ''; + }; + + this.filterByDropdownValue = item => { + if(this.filterByApp.value === ''){ + return true; + } + return item.appName === this.filterByApp.value; + }; + + let getDialogTitle = (source) => { + switch (source) { + case 'edit': + return "Functional Menu - Edit"; + case 'view': + return "Functional Menu - View"; + case 'add': + return "Functional Menu - Add"; + default: + return "Functional Menu"; + } + } + + $scope.reloadTreeStructure = (selectedItem,source) => { + getFunctionalMenu(); + }; + $scope.openMenuDetailsModal = (selectedItem,source) => { + let data = null; + let selectedMenuDetails = null; + console.log('selectedItem: ', selectedItem); + + functionalMenuService.getMenuDetails(selectedItem.menuId) + .then(function( resp ){ + selectedMenuDetails = resp; + $log.info('FunctionalMenuCtrl::openMenuDetailsModal: getMenuDetails: ', resp ); + + if(selectedItem){ + data = { + menuItem: {menu: _.clone(selectedItem),menuDetails:_.clone(selectedMenuDetails)}, + source: source, + title: getDialogTitle(source) + } + } + ngDialog.open({ + templateUrl: 'app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html', + controller: 'MenuDetailsModalCtrl', + controllerAs: 'functionalMenuDetails', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + $log.debug('FunctionalMenuCtrl::openMenuDetailsModal: updating table data...'); + if(source=="edit") + init(); + } + }); + }); + }; + + + $scope.createNewMenuItem = (selectedItem,source) => { + + if(selectedItem != null && selectedItem.getLevel() >= 4){ + confirmBoxService.showInformation('You are not allowed to have a menu item at a level greater than 4.').then(isConfirmed => { + + }); + return ; + } + + let data = null; + let selectedMenuDetails = null; + functionalMenuService.getMenuDetails(selectedItem.menuId) + .then(function( resp ){ + selectedMenuDetails = resp; + + if((selectedItem.children==null || !selectedItem.children.length>0) && + (!!selectedMenuDetails.url || !!selectedMenuDetails.appid || !!selectedMenuDetails.roles)){ + confirmBoxService.showInformation('Warning: the child menu item "' + selectedItem.name + '" is already configured with an application. You can create a new mid-level menu item, and move this item under it.').then(isConfirmed => { + return; + }); + }else{ + if(selectedItem){ + data = { + menuItem: {menu: _.clone(selectedItem)}, + source:source, + title: getDialogTitle(source) + } + } + + ngDialog.open({ + templateUrl: 'app/views/functionalMenu/functionalMenu-dialog/menu-details.modal.html', + controller: 'MenuDetailsModalCtrl', + controllerAs: 'functionalMenuDetails', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + $log.debug('FunctionalMenuCtrl::getMenuDetails: updating table data...'); + init(); + } + }); + } + }); + }; + + $scope.deleteMenuItem = (selectedItem,source) => { + $log.info('FunctionalMenuCtrl:deleteMenuItem:: delete selectedItem: ', selectedItem); + + if(selectedItem.children!=null && selectedItem.children.length>0){ + confirmBoxService.showInformation('You are not allowed to delete a menu item that has children. You can only delete leaf menu items.').then(isConfirmed => { + + }); + }else{ + confirmBoxService.deleteItem(selectedItem.name).then(isConfirmed => { + if(isConfirmed){ + $log.info('FunctionalMenuCtrl:deleteMenuItem:: Deleting Menu Item :: name: '+selectedItem.name+'; menuId: '+selectedItem.menuId); + $log.info('FunctionalMenuCtrl:deleteMenuItem:: selectedItem: ', selectedItem); + + functionalMenuService.deleteMenuItem(selectedItem.menuId).then(() => { + $log.info('FunctionalMenuCtrl:deleteMenuItem:: Removed Menu Item :: '+selectedItem.name); + init(); + }).catch(err => { + $log.error(err); + }); + } + }).catch(err => { + $log.error(err); + }); + } + }; + + init(); + } + } + FunctionalMenuCtrl.$inject = ['$log', 'functionalMenuService','$scope', 'ngDialog', 'confirmBoxService']; + angular.module('ecompApp').controller('FunctionalMenuCtrl', FunctionalMenuCtrl); + + angular.module('ecompApp').directive('jqTree', ['functionalMenuService','$log','confirmBoxService',function(functionalMenuService,$log,confirmBoxService){ + return { + templateUrl: 'jqtree-tmpl.html', + link: function(scope, el, attrs){ + + var $jqTree = el.find('#jqTree').tree({ + data: scope.treedata, + autoOpen: false, + dragAndDrop: true, + onCreateLi: function(node, $li) { + $li.attr('id', node.id.replace(/\s+/g,"_")); + } + }); + + el.find('#jqTree').bind('tree.move', function(event){ + event.preventDefault(); + console.log('moved_node', event.move_info.moved_node); + console.log('target_node', event.move_info.target_node); + console.log('position', event.move_info.position); + console.log('previous_parent', event.move_info.previous_parent); + + + + if(event.move_info.target_node != null && + ((event.move_info.position == 'after' && event.move_info.target_node.getLevel() > 4) || + (event.move_info.position == 'inside' && event.move_info.target_node.getLevel() > 3))){ + confirmBoxService.showInformation('You are not allowed to have a menu item at a level greater than 4.').then(isConfirmed => { + + }); + return ; + } + + var confMsg = 'Are you sure you want to move "'+event.move_info.moved_node.name+'" ?'; + if ((event.move_info.position == "inside") && (event.move_info.target_node.url != "")) { + confMsg = 'Warning: You are moving "'+event.move_info.moved_node.name+'" under "'+event.move_info.target_node.name+'", which has application information associated with it. This will cause all the application information from "'+event.move_info.target_node.name+'" to be deleted.'; + } + confirmBoxService.moveMenuItem(confMsg).then(isConfirmed => { + if(isConfirmed){ + var new_column = event.move_info.target_node.column; + var old_column = event.move_info.moved_node.column; + if ((event.move_info.moved_node.parentMenuId != + event.move_info.target_node.parentMenuId) || + (new_column < old_column) + ) { + new_column += 1; + } + var activeMenuItem = { + menuId:event.move_info.moved_node.menuId, + column:new_column, + text:"", + parentMenuId:event.move_info.target_node.parentMenuId, + url:"", + appid: null, + roles:null + }; + + if (event.move_info.position == "inside") { + console.log("special case: target_node is parent"); + activeMenuItem.column = 1; + activeMenuItem.parentMenuId = event.move_info.target_node.menuId; + } + + functionalMenuService.saveEditedMenuItem(activeMenuItem) + .then(() => { + $log.debug(' Menu Item moved'); + scope.reloadTreeStructure(); + }).catch(err => { + $log.error(err); + }).finally(()=>{ + }); + } + }).catch(err => { + $log.error(err); + }); + }); + + + $jqTree.jqTreeContextMenu(el.find('ul.dropdown-menu'), { + "view": function (node) {scope.openMenuDetailsModal(node,'view'); }, + "edit": function (node) {scope.openMenuDetailsModal(node,'edit'); }, + "delete": function (node) { scope.deleteMenuItem(node,'delete') }, + "add": function (node) { scope.createNewMenuItem(node,'add') } + }); + + scope.$watch('treedata', function(oldValue, newValue){ + if(oldValue !== newValue){ + console.log('FunctionalMenuCtrl:: Tree value has changed in some way'); + $jqTree.tree('loadData', scope.treedata); + $jqTree.tree('reload', function() { + console.log('FunctionalMenuCtrl:: Tree is reloaded'); + }); + } + }) + } + } + }]); + +})(); diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.less b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.less new file mode 100644 index 00000000..24a91287 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.less @@ -0,0 +1,70 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .functional-admin-page-main{ + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + .u16r; + + .functional-admin-container { + .content_justify; + position: relative; + padding: 0 0 32px; + width: 1170px; + + .functional-admin-home-title { + .a24r; + padding-bottom: 20px; + .content_justify; + } + .tree{ + } + .functional-admin-button-container { + padding-top: 10px; + .btn-blue{ + height: 35px; + width: 140px; + } + } + } + .error-text { + width: 1170px; + margin: auto; + padding: 20px; + left: 20px; + font-weight: bold; + font-size: 16px; + text-align: left; + color: @err; + background-color: @u; + + .error-help { + color: @o; + font-weight: normal; + } + } + +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.tpl.html b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.tpl.html new file mode 100644 index 00000000..a04cfe4c --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/functionalMenu.tpl.html @@ -0,0 +1,48 @@ + +
+
+
+
+
Edit Functional Menu
+
+
+
+
+ +
+ + Click when you are done with your changes +
+
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/functionalMenu/jqTreeContextMenu.js b/ecomp-portal-FE/client/app/views/functionalMenu/jqTreeContextMenu.js new file mode 100644 index 00000000..21e8454d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/functionalMenu/jqTreeContextMenu.js @@ -0,0 +1,192 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +(function ($) { + if (!$.fn.tree) { + throw "Error jqTree is not loaded."; + } + + $.fn.jqTreeContextMenu = function (menuElement, callbacks) { + + var self = this; + var $el = this; + + var $menuEl = menuElement; + + var nodeToDisabledMenuItems = {}; + + $menuEl.hide(); + + $el.bind("contextmenu", function (e) { + e.preventDefault(); + return false; + }); + + $el.bind('tree.contextmenu', function (event) { + var x = event.click_event.pageX; + var y = event.click_event.pageY; + var yPadding = 5; + var xPadding = 5; + var menuHeight = $menuEl.height(); + var menuWidth = $menuEl.width(); + var windowHeight = $(window).height(); + var windowWidth = $(window).width(); + + if (menuHeight + y + yPadding > windowHeight) { + y = y - menuHeight; + } + if (menuWidth + x + xPadding > windowWidth) { + x = x - menuWidth; + } + + if (Object.keys(nodeToDisabledMenuItems).length > 0) { + if (event.node.name in nodeToDisabledMenuItems) { + var nodeName = event.node.name; + var items = nodeToDisabledMenuItems[nodeName]; + if (items.length === 0) { + $menuEl.find('li').addClass('disabled'); + $menuEl.find('li > a').unbind('click'); + } else { + $menuEl.find('li > a').each(function () { + $(this).closest('li').removeClass('disabled'); + var hrefValue = $(this).attr('href'); + var value = hrefValue.slice(hrefValue.indexOf("#") + 1, hrefValue.length) + if ($.inArray(value, items) > -1) { + $(this).closest('li').addClass('disabled'); + $(this).unbind('click'); + } + }); + } + } else { + $menuEl.find('li.disabled').removeClass('disabled'); + } + } + + $menuEl.show(); + + $menuEl.offset({ left: x, top: y }); + + var dismissContextMenu = function () { + $(document).unbind('click.jqtreecontextmenu'); + $el.unbind('tree.click.jqtreecontextmenu'); + $menuEl.hide(); + } + + $(document).bind('click.jqtreecontextmenu', function () { + dismissContextMenu(); + }); + + $el.bind('tree.click.jqtreecontextmenu', function (e) { + dismissContextMenu(); + }); + + var selectedNode = $el.tree('getSelectedNode'); + if (selectedNode !== event.node) { + $el.tree('selectNode', event.node); + } + + var menuItems = $menuEl.find('li:not(.disabled) a'); + if (menuItems.length !== 0) { + menuItems.unbind('click'); + menuItems.click(function (e) { + e.stopImmediatePropagation(); + dismissContextMenu(); + var hrefAnchor = e.currentTarget.attributes.href.nodeValue; + var funcKey = hrefAnchor.slice(hrefAnchor.indexOf("#") + 1, hrefAnchor.length) + var callbackFn = callbacks[funcKey]; + if (callbackFn) { + callbackFn(event.node); + } + return false; + }); + } + }); + + this.disable = function () { + if (arguments.length === 0) { + $menuEl.find('li:not(.disabled)').addClass('disabled'); + $menuEl.find('li a').unbind('click'); + nodeToDisabledMenuItems = {}; + } else if (arguments.length === 1) { + var items = arguments[0]; + if (typeof items !== 'object') { + return; + } + $menuEl.find('li > a').each(function () { + var hrefValue = $(this).attr('href'); + var value = hrefValue.slice(hrefValue.indexOf("#") + 1, hrefValue.length) + if ($.inArray(value, items) > -1) { + $(this).closest('li').addClass('disabled'); + $(this).unbind('click'); + } + }); + nodeToDisabledMenuItems = {}; + } else if (arguments.length === 2) { + var nodeName = arguments[0]; + var items = arguments[1]; + nodeToDisabledMenuItems[nodeName] = items; + } + }; + + this.enable = function () { + if (arguments.length === 0) { + $menuEl.find('li.disabled').removeClass('disabled'); + nodeToDisabledMenuItems = {}; + } else if (arguments.length === 1) { + var items = arguments[0]; + if (typeof items !== 'object') { + return; + } + + $menuEl.find('li > a').each(function () { + var hrefValue = $(this).attr('href'); + var value = hrefValue.slice(hrefValue.indexOf("#") + 1, hrefValue.length) + if ($.inArray(value, items) > -1) { + $(this).closest('li').removeClass('disabled'); + } + }); + + nodeToDisabledMenuItems = {}; + } else if (arguments.length === 2) { + var nodeName = arguments[0]; + var items = arguments[1]; + if (items.length === 0) { + delete nodeToDisabledMenuItems[nodeName]; + } else { + var disabledItems = nodeToDisabledMenuItems[nodeName]; + for (var i = 0; i < items.length; i++) { + var idx = disabledItems.indexOf(items[i]); + if (idx > -1) { + disabledItems.splice(idx, 1); + } + } + if (disabledItems.length === 0) { + delete nodeToDisabledMenuItems[nodeName]; + } else { + nodeToDisabledMenuItems[nodeName] = disabledItems; + } + } + if (Object.keys(nodeToDisabledMenuItems).length === 0) { + $menuEl.find('li.disabled').removeClass('disabled'); + } + } + }; + return this; + }; +} (jQuery)); diff --git a/ecomp-portal-FE/client/app/views/header/header.controller.js b/ecomp-portal-FE/client/app/views/header/header.controller.js new file mode 100644 index 00000000..8d3cab29 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/header.controller.js @@ -0,0 +1,419 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class HeaderCtrl { + constructor($log, $window, userProfileService, menusService, $scope, ECOMP_URL_REGEX, $cookies, $state) { + this.firstName = ''; + this.lastName = ''; + this.$log = $log; + this.menusService = menusService; + this.$scope = $scope; + this.favoritesMenuItems = ''; + $scope.favoriteItemsCount = 0; + $scope.favoritesMenuItems = ''; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + $scope.favoritesWindow = false; + + $scope.showNotification = true; + + $scope.hideMenus = false; + + $scope.menuItems = []; + $scope.activeClickSubMenu = { + x: '' + }; + $scope.activeClickMenu = { + x: '' + }; + $scope.megaMenuDataObject =[]; + + this.isLoading = true; + this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; + + var menuStructureConvert = function(menuItems) { + $scope.megaMenuDataObjectTemp = [ + { + text: "Manage/Functions", + children: [], + }, + { + text: "Help", + children: [{ + restrictedApp: true, + text:"Contact Us", + url:"" + }, + { + text:"Get Access", + url:"root.access" + }] + } + + ]; + return $scope.megaMenuDataObjectTemp; + }; + + var unflatten = function( array, parent, tree ){ + + tree = typeof tree !== 'undefined' ? tree : []; + parent = typeof parent !== 'undefined' ? parent : { menuId: null }; + var children = _.filter( array, function(child){ return child.parentMenuId == parent.menuId; }); + + if( !_.isEmpty( children ) ){ + if( parent.menuId === null ){ + tree = children; + }else{ + parent['children'] = children + } + _.each( children, function( child ){ unflatten( array, child ) } ); + } + + return tree; + } + + var self = this; + $scope.$on('handleUpdateUserInfo', function () { + userProfileService.resetFunctionalMenuStaticInfo() + .then(reset_res=> { + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info init'); + if(res==null || res.firstName==null || res.firstName=='' || res.lastName==null || res.lastName=='' ){ + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: failed getting userinfo from shared context.. '); + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting userinfo from session '); + userProfileService.getUserProfile() + .then(profile=> { + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting userinfo from session success'); + self.firstName = profile.firstName; + self.lastName = profile.lastName; + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: user has the following roles: ' + profile.roles); + }).catch(err=> { + $log.error('Header Controller:: getUserProfile() failed: ' + err); + }); + }else{ + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info successfully',res); + self.firstName = res.firstName; + self.lastName = res.lastName; + $scope.contactUsURL = res.contact_us_link; + } + + menusService.GetFunctionalMenuForUser() + .then(jsonHeaderMenu=> { + $scope.menuItems = unflatten( jsonHeaderMenu ); + $scope.megaMenuDataObject = $scope.menuItems; + }).catch(err=> { + $scope.megaMenuDataObject = menuStructureConvert(''); + $log.error('HeaderCtrl::GetFunctionalMenuForUser: HeaderCtrl json returned: ' + err); + }); + + userProfileService.refreshUserBusinessCard(); + + }).catch(err=> { + $log.error('HeaderCtrl::getFunctionalMenuStaticInfo failed: ' + err); + }); + }).catch(err=> { + $log.error('HeaderCtrl::resetFunctionalMenuStaticInfo failed: ' + err); + }) + + + }); + + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info init'); + if(res==null || res.firstName==null || res.firstName=='' || res.lastName==null || res.lastName=='' ){ + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: failed getting userinfo from shared context.. '); + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting userinfo from session '); + userProfileService.getUserProfile() + .then(profile=> { + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting userinfo from session success'); + this.firstName = profile.firstName; + this.lastName = profile.lastName; + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: user has the following roles: ' + profile.roles); + }).catch(err=> { + $log.error('Header Controller:: getUserProfile() failed: ' + err); + }); + }else{ + $log.info('HeaderCtrl::getFunctionalMenuStaticInfo: getting Functional Menu Static Info successfully',res); + this.firstName = res.firstName; + this.lastName = res.lastName; + $scope.contactUsURL = res.contact_us_link; + } + + menusService.GetFunctionalMenuForUser() + .then(jsonHeaderMenu=> { + $scope.menuItems = unflatten( jsonHeaderMenu ); + $scope.megaMenuDataObject = $scope.menuItems; + }).catch(err=> { + $scope.megaMenuDataObject = menuStructureConvert(''); + $log.error('HeaderCtrl::GetFunctionalMenuForUser: HeaderCtrl json returned: ' + err); + }); + + }).catch(err=> { + $log.error('HeaderCtrl::getFunctionalMenuStaticInfo failed: ' + err); + }); + + + $scope.loadFavorites = function () { + $scope.hideMenus = false; + $log.debug('HeaderCtrl::loadFavorites: loadFavorites has happened.'); + if ($scope.favoritesMenuItems == '') { + generateFavoriteItems(); + $log.debug('HeaderCtrl::loadFavorites: loadFavorites is calling generateFavoriteItems()'); + } else { + $log.debug('HeaderCtrl::loadFavorites: loadFavorites is NOT calling generateFavoriteItems()'); + } + } + + $scope.goToUrl = (item) => { + $log.info('HeaderCtrl::goToUrl has started'); + let url = item.url; + let restrictedApp = item.restrictedApp; + if (!url) { + $log.info('HeaderCtrl::goToUrl: No url found for this application, doing nothing..'); + return; + } + if (restrictedApp) { + $window.open(url, '_blank'); + } else { + if(item.url=="getAccess" || item.url=="contactUs"){ + // if (url = window.location.href) + $state.go("root."+url); + var tabContent = { id: new Date(), title: 'Home', url: item.url }; + $cookies.putObject('addTab', tabContent ); + } else { + var tabContent = { id: new Date(), title: item.text, url: item.url }; + $cookies.putObject('addTab', tabContent ); + } + $log.debug('HeaderCtrl::goToUrl: url = ', url); + } + $scope.hideMenus = true; + } + + + + $scope.submenuLevelAction = function(index, column) { + if ($scope.favoritesMenuItems == '') { + generateFavoriteItems(); + $log.debug('HeaderCtrl::submenuLevelAction: submenuLevelAction is calling generateFavoriteItems()'); + } + if (index=='Favorites' && $scope.favoriteItemsCount != 0) { + $log.debug('HeaderCtrl::submenuLevelAction: Showing Favorites window'); + $scope.favoritesWindow = true; + $scope.showFavorites = true; + $scope.emptyFavorites = false; + } + if (index=='Favorites' && $scope.favoriteItemsCount == 0) { + $log.debug('HeaderCtrl::submenuLevelAction: Hiding Favorites window in favor of No Favorites Window'); + $scope.favoritesWindow = true; + $scope.showFavorites = false; + $scope.emptyFavorites = true; + } + if (index!='Favorites' ) { + $scope.favoritesWindow = false; + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + + }; + + $scope.hideFavoritesWindow = function() { + $scope.showFavorites = false; + $scope.emptyFavorites = false; + } + + $scope.isUrlFavorite = function (menuId) { + var jsonMenu = JSON.stringify($scope.favoritesMenuItems); + var isMenuFavorite = jsonMenu.indexOf('menuId\":' + menuId); + if (isMenuFavorite==-1) { + return false; + } else { + return true; + } + + } + + let generateFavoriteItems = () => { + menusService.getFavoriteItems() + .then(favorites=> { + $scope.favoritesMenuItems = favorites; + $scope.favoriteItemsCount = Object.keys(favorites).length; + $log.info('HeaderCtrl.getFavoriteItems:: number of favorite menus: ' + $scope.favoriteItemsCount); + }).catch(err=> { + $log.error('HeaderCtrl.getFavoriteItems:: Error retrieving Favorites menus: ' + err); + }); + } + + $scope.setAsFavoriteItem = function(event, menuId){ + var jsonMenuID = angular.toJson({'menuId': + menuId }); + $log.debug('HeaderCtrl::setFavoriteItems: ' + jsonMenuID + " - " + event.target.id); + + menusService.setFavoriteItem(jsonMenuID) + .then(() => { + angular.element('#' + event.target.id).css('color', '#fbb313'); + generateFavoriteItems(); + }).catch(err=> { + $log.error('HeaderCtrl::setFavoriteItems:: API setFavoriteItem error: ' + err); + }); + }; + + $scope.removeAsFavoriteItem = function(event, menuId){ + $log.debug('-----------------------------removeAsFavoriteItem: ' + menuId + " - " + event.target.id); + menusService.removeFavoriteItem(menuId) + .then(() => { + angular.element('#' + event.target.id).css('color', '#666666'); + generateFavoriteItems(); + }).catch(err=> { + $log.error('HeaderCtrl::removeAsFavoriteItem: API removeFavoriteItem error: ' + err); + }); + }; + + $scope.goToPortal = (headerText, url) => { + if (!url) { + $log.info('HeaderCtrl::goToPortal: No url found for this application, doing nothing..'); + return; + } + if (!ECOMP_URL_REGEX.test(url)) { + url = 'http://' + url; + } + + if(headerText.startsWith("vUSP")) { + window.open(url, '_blank'); + } + else { + var tabContent = { id: new Date(), title: headerText, url: url }; + $cookies.putObject('addTab', tabContent ); + } + }; + + } + } + class LoginSnippetCtrl { + constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService,ngDialog) { + $scope.firstName=""; + $scope.lastName=""; + + $scope.allAppsLogout = function(){ + + var cookieTabs = $cookies.getObject('visInVisCookieTabs'); + if(cookieTabs!=null){ + for(var t in cookieTabs){ + + var url = cookieTabs[t].content; + if(url != "") { + sessionService.logout(url); + } + } + } + // wait for individular applications to logoutout before the portal logout + $timeout(function() { + window.location = "logout.htm"; + }, 2000); + } + + $scope.openEditUserModal = function(){ + + var data = { + loginId : $scope.loginSnippetUserId, + updateRemoteApp : false, + appId : $scope.selectedApp!=null?$scope.selectedApp.id:'' + } + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/header/user-edit/edit-user.tpl.html', + controller: 'editUserController', + data: data, + resolve: { + message: function message() { + var message = { + type: 'Contact', + }; + return message; + } + } + }).closePromise.then(needUpdate => { + //updateContactUsTable(); + }); + + } + + try { + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + $log.info('HeaderCtrl::LoginSnippetCtrl: Login information: ' + JSON.stringify(res)); + $scope.firstName = res.firstName; + $scope.lastName = res.lastName; + $scope.loginSnippetEmail = res.email; + $scope.loginSnippetUserId = res.userId; + $scope.lastLogin = res.last_login; + }).catch(err=> { + $log.error('HeaderCtrl::LoginSnippetCtrl: User Profile error: ' + err); + }); + } catch (err) { + $log.error('HeaderCtrl::LoginSnippetCtrl:getFunctionalMenuStaticInfo failed: ' + err); + } + + $scope.$on('refreshUserBusinessCard', function () { + try { + userProfileService.getFunctionalMenuStaticInfo() + .then(res=> { + $log.info('HeaderCtrl::LoginSnippetCtrl: Login information: ' + JSON.stringify(res)); + $scope.firstName = res.firstName; + $scope.lastName = res.lastName; + $scope.loginSnippetEmail = res.email; + $scope.loginSnippetUserId = res.userId; + $scope.lastLogin = res.last_login; + }).catch(err=> { + $log.error('HeaderCtrl::LoginSnippetCtrl: User Profile error: ' + err); + }); + } catch (err) { + $log.error('HeaderCtrl::LoginSnippetCtrl:getFunctionalMenuStaticInfo failed: ' + err); + } + }); + + + } + } + class NotificationCtrl{ + constructor($log, $scope, $cookies, $timeout, sessionService) { + $scope.notifications=[]; + for(var i=0;i<6;i++){ + var data ={ + content:'Notification '+i, + time:'10:0'+i+'AM' + }; + $scope.notifications.push(data); + } + + $scope.deleteNotification = function(index){ + + $scope.notifications.splice(index,1); + } + } + } + NotificationCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService']; + LoginSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService','ngDialog']; + HeaderCtrl.$inject = ['$log', '$window', 'userProfileService', 'menusService', '$scope', 'ECOMP_URL_REGEX','$cookies','$state']; + angular.module('ecompApp').controller('HeaderCtrl', HeaderCtrl); + angular.module('ecompApp').controller('loginSnippetCtrl', LoginSnippetCtrl); + angular.module('ecompApp').controller('notificationCtrl', NotificationCtrl); + +})(); diff --git a/ecomp-portal-FE/client/app/views/header/header.controller.spec.js b/ecomp-portal-FE/client/app/views/header/header.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/header.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/header/header.less b/ecomp-portal-FE/client/app/views/header/header.less new file mode 100644 index 00000000..19ea467a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/header.less @@ -0,0 +1,380 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .header-section { + position: relative; + z-index: 999; +} + +.logo-image { + .ecomp-logo; + display: inline-block; + vertical-align: middle; + margin-top: -3px; + } + +.portal-title { + font-weight: 400; + font-family: arial !important; + font-size: 18px; +} + + +.megamenu-tabs .megamenu__item { + padding: 0 0; +} +.megamenu-tabs .megamenu__item span { + font-size: 18px; +} + +.submenu-tabs { + line-height:50px; +} +.submenu-tabs .sub__menu{ + top:54px; + padding-top: 10px; + + padding-left: 20px; + + .third-level-title{ + padding-left: 10px; + margin-bottom: 10px; + } +} + +.submenu-tabs .sub__menu .tabsbid__item{ + width:100% +} + +.top-megamenu .megamenu-tabs ul{ + width:98%; + list-style: none; +} + +.megaMenuContainer { + margin-top: 0; + min-height: 50px; + overflow: visible; +} + +.megaMenuDataObject { + float: left; + width: 100%; +} + +.parentmenu-tabs { + height: 55px; +} + +.menu-section { + float: left; +} + +.controlCls{ + font-size: .975rem; + color: #666; + display: inline-block; + font-family: arial; + cursor: pointer; + height: 37px; + line-height: 37px; + padding-bottom: 10px; + vertical-align: middle; + width: 100%; +} + + +.controlCls:hover{ + color:#199DDF !important; +} + +.login-section { + float: right; + min-width:150px; +} + +.login-snippet-text { + display: inline-block; + font-size: 12px; + font-weight: bold; + margin-left: 5px; + overflow: hidden; + max-height: 60px; + max-width: 120px; + padding-top: 20px; + margin-top: 0; + white-space: nowrap; +} + +.megamenu__item { + width: 100px; +} + +.megamenu-item-top { + line-height:55px; +} + + +.newrow { + clear: left; +} + +.header-columns{ + -webkit-column-count:4; + -moz-column-rule: 1px outset #D3D3D3; + -moz-column-count:4; + column-count: 4; + line-height: 12px; + max-height: 500px; + overflow-x: hidden; + overflow-y:hidden; + column-gap: 13px; + column-rule: 1px outset #D3D3D3; + + +} + +.header-columns li{ + -webkit-column-break-inside: avoid; + break-inside: avoid; + //-webkit-page-break-inside: avoid; + page-break-inside: avoid; + + margin-top: 0px !important; + +} + +.header-columns-div{ + width:100%; + margin-left: 12px; + margin-top: 12px; + &:hover{ + .level3-favorites-icon-inactive { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + -moz-opacity: 1; + -khtml-opacity: 1; + } + } +} + + +.header-level4-div{ + width:100%; + margin-left: 12px; + margin-top: 12px; + &:hover{ + .level4-favorites-icon-inactive { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + -moz-opacity: 1; + -khtml-opacity: 1; + } + } +} + +.favorites-icon-active { + position: relative; + margin-top: 5px; + margin-left: 5px; + top: 3px; + color: @i; +} + +.level3-favorites-icon-inactive { + .favorites-icon-inactive; + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + -moz-opacity: 0; + -khtml-opacity: 0; +} + +.level4-favorites-icon-inactive { + .favorites-icon-inactive; + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + -moz-opacity: 0; + -khtml-opacity: 0; +} + +.favorites-icon-inactive { + position: relative; + margin-top: 5px; + margin-left: 5px; + top: 3px; + color: @o; +} + +.favorites-window-empty { + width: 100%; + height: auto; + display:flex; + justify-content:center; + align-items:center; + margin: auto; + text-align: center; + + .largeText { + font-weight: 400; + font-family: arial !important; + font-size: 18px; + text-align: center; + color: @o; + } + + .normal { + color: @o; + font-size: 14px; + text-align: center; + } + + +} +.favorites-window { + width: 100%; + height: auto; + //margin: auto; + font-size: 14px !important; + display: flex; + font-family: arial; + margin-top: 25px; + margin-left: 25px; + z-index: 1000; + + .fav-links { + margin-right: 25px; + } + + .largeText { + font-weight: 400; + font-family: arial !important; + font-size: 18px; + text-align: center; + color: @o; + } + + a:link, a:active, a:hover { + margin-left: 3px; + margin-right: 20px; + text-decoration: none; + } + + a:hover { + color: @z; + } +} + + + + .notifications-count + { + .border-radius(50%); + background:#db3434; + color: @colorWhite; + font: normal .85em 'Lato'; + height: 16px; + + position: absolute; + right: -7px; + text-align: center; + top: -8px; + width: 16px; + } + + .notification-header{ + border-bottom: 1px solid #b4b4b4; + padding: 10px 40px 0px 40px; + } + .notification-heading{ + font-family: arial; + font-size: 24px; + padding-top: 15px; + margin-bottom: 1rem; + } + .notificationBox{ + border-bottom: 1px solid #b4b4b4; + + } + + .notification-info-icon{ + padding-top: 41px; + font-size: 47px; + } + .notification-text { + line-height: 15px; + margin: 0; + padding: 0 0 24px 0; + text-align: center; + font-family: arial; + font-size: 16px; + } + +#icon-user-small{ + display: inline-block; + vertical-align: middle; + width: 20px; + padding-top: 20px; +} + +.notificationBox .icon-circle-action-close { + cursor: pointer; + font-size: 16px; + } + + .notification-close { + padding: 2px 2px 0px 0px; + float: right; + } + + #fav-icon{ + color: #ffb81c; + font-size: 80px; + } + + .edit-user-button{ + margin-top:5px; + display: inline; + margin-left:2px; + width: 20px; + } + + .log-out-button{ + margin-top:5px; + display: inline; + margin-left:10px; + width: 20px; + } + + .new-button { + margin-left:5px; + float: left; + display: block; + width: 80px; + height: 25px; + background: #0574ac!important; + padding: 6px; + text-align: center; + border-radius: 5px; + color: white; + font-size:13px; +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/header/header.tpl.html b/ecomp-portal-FE/client/app/views/header/header.tpl.html new file mode 100644 index 00000000..1928cb64 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/header.tpl.html @@ -0,0 +1,277 @@ + + +
+
+
+
+ + +
+
+
+ + + +
+
+
+
+
+
+
+
+ + diff --git a/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.controller.js b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.controller.js new file mode 100644 index 00000000..507b3a0e --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.controller.js @@ -0,0 +1,134 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +(function () { + class EditUserController { + constructor($scope,$log, message, $q, $http, conf,contactUsService,confirmBoxService,userProfileService,adminsService) { + + $scope.newUser ={ + firstName:'', + lastName:'', + emailAddress:'', + middleName:'', + loginId:'', + loginPwd:'', + }; + + $scope.userId = $scope.ngDialogData.loginId; + $scope.updateRemoteApp = $scope.ngDialogData.updateRemoteApp; + try { + userProfileService.getCurrentUserProfile($scope.userId) + .then(res=> { + $scope.newUser.firstName = res.firstName; + $scope.newUser.lastName = res.lastName; + $scope.newUser.emailAddress = res.email; + $scope.newUser.middleName = res.middleInitial; + $scope.newUser.loginId = res.loginId; + $scope.newUser.loginPwd = res.loginPwd; + $scope.newUser.loginPwdCheck = res.loginPwd; + + }).catch(err=> { + $log.error('HeaderCtrl::LoginSnippetCtrl:get Current User Profile error: ' + err); + }); + } catch (err) { + $log.error('HeaderCtrl::LoginSnippetCtrl:getFunctionalMenuStaticInfo failed: ' + err); + } + + $scope.changePwdText = function(){ + $scope.newUser.loginPwdCheck = ''; + } + + $scope.closeDialog = function(){ + $scope.closeThisDialog( $scope.widgetData); + } + + $scope.updateUserFun = function(){ + + if ($scope.newUser.firstName==''||$scope.newUser.lastName==''||$scope.newUser.loginPwd=='') { + var warningMsg = "Please enter missing values"; + confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;}); + return; + } else if ($scope.newUser.loginPwd != $scope.newUser.loginPwdCheck) { + var warningMsg = "Passwords do not match, please try again."; + confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;}); + return; + } else { + + // check password length complexity. + var warningMsg = adminsService.isComplexPassword($scope.newUser.loginPwd); + if (warningMsg != null) { + confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;}); + return; + } + + adminsService.addNewUser($scope.newUser,'No').then(res=> { + + $scope.closeThisDialog(); + + confirmBoxService.showInformation('Update User Info successfully'); + userProfileService.broadCastUpdatedUserInfo(); + + + if($scope.updateRemoteApp){ + //need update remote app's database + var remoteAppId = $scope.ngDialogData.appId; + if(remoteAppId!=null){ + + userProfileService.updateRemoteUserProfile($scope.userId,remoteAppId).then(res=> { + + + }).catch(err=> { + $log.error('userProfileService: update user profile in remote app error:: ', err); + confirmBoxService.showInformation('Update User in remote app failed: ' + err); + + }).finally(() => { + + }); + + + } + + } + + }).catch(err=> { + $log.error('adminsService: addNewUser error:: ', err); + // $scope.errMsg=err; + confirmBoxService.showInformation('Add New User failed: ' + err); + + }).finally(() => { + //this.isLoadingTable = false; + + }); + + } + } + + + } + } + EditUserController.$inject = ['$scope','$log', 'message', '$q', '$http', 'conf','contactUsService','confirmBoxService','userProfileService','adminsService']; + angular.module('ecompApp').controller('editUserController', EditUserController); + + +})(); +function validateUrl(value){ + return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); + } \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.less b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.less new file mode 100644 index 00000000..853e48db --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.less @@ -0,0 +1,61 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + + .main{ + padding:10px; + margin-left: 40px; + + } + .manage-user-home-title{ + + margin-top:15px; + color: #067ab4; + font-family: arial; + font-size: 24px; + margin-left: 0px; + width: 250px; + + } + + .input-text-edit-user { + font-style: italic; + padding: 7px 10px; + width: 200px !important; + display: inline-block; + position: relative; + margin-bottom: 10px; + border-radius: 6px; + border: 1px solid #d8d8d8; + height: 32px; + border-color: slategrey !important; + } + + .input-edit-user-div{ + float: left; + width: 300px; + } + + .edit-user-section{ + + margin-top:5px; + margin-left:10px; + + } + \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.tpl.html b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.tpl.html new file mode 100644 index 00000000..719f8bde --- /dev/null +++ b/ecomp-portal-FE/client/app/views/header/user-edit/edit-user.tpl.html @@ -0,0 +1,69 @@ + +
+
Profile
+ +
+
+
*First Name
+ +
+
+
Middle Name
+ +
+
+
*Last Name
+ +
+
+
*Email Address ID
+ +
+
+
*Login ID
+ +
+
+
*Login Password
+ +
+
+
*Confirm Login Password
+ +
+
+
+
+
Save +
+
Cancel
+
+
+ + +
+ + \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.js b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.js new file mode 100644 index 00000000..2071f4cc --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.js @@ -0,0 +1,244 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + const HTTP_PROTOCOL_RGX = /https?:\/\//; + class ApplicationsHomeCtrl { + constructor(applicationsService, $log, $window, userProfileService, $scope,$cookies, utilsService) { + //activate spinner + this.isLoading = true; + $scope.getUserAppsIsDone = false; + this.userProfileService = userProfileService; + //get all user's applications on init + $scope.buildNumber = "OpenECOMP Portal Version: 1.0.0" + + userProfileService.getUserProfile() + .then(profile=> { + $log.info('ApplicationsHomeCtrl::getUserProfile', profile); + $scope.userId = profile.orgUserId; + //$scope.appsViewData = ['notempty']; // initialize with length != 0 + $scope.appsViewData = []; + $scope.appsView = []; + + //redirect to login.htm, if the EPService cookie is missing and logged in user is not a guest. + if (!$cookies.get('EPService') && !profile.guestSession) { + this.isLoading = false; + var myHostName; + myHostName = location.host; + $log.info("EPService cookie is missing, so attempting to redirecting to login page."); + if (utilsService.isRunningInLocalDevEnv()) { + $log.info("Portal is running in local development and redirecting to 'http://localhost:8080/ecompportal/login.htm'."); + $window.location.href = "http://localhost:8080/ecompportal/login.htm"; + } else { + $log.info("Redirecting to 'login.htm'."); + $window.location.href = "login.htm"; + } + } + + applicationsService.getUserApps() + .then(res => { + $log.info('ApplicationsHomeCtrl::getUserApps: ', res); + this.apps = res; + let rowNo = 0; + for (let i = 0; i < this.apps.length; i++) { + $scope.appsView[i] = { + sizeX: 2, + sizeY: 2, + headerText: '', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + $scope.appsView[i].headerText = this.apps[i].name; + $scope.appsView[i].subHeaderText = this.apps[i].notes; + $scope.appsView[i].imageLink = this.apps[i].thumbnail || this.apps[i].imageUrl; + $scope.appsView[i].order = this.apps[i].order; + $scope.appsView[i].url = this.apps[i].url; + $scope.appsView[i].restrictedApp = this.apps[i].restrictedApp; + } + $log.info('ApplicationsHomeCtrl::getUserApps: apps count : ' + $scope.appsView.length); + + if ($cookies.getObject($scope.userId+'_apps') == undefined || $cookies.getObject($scope.userId+'_apps') == null || $cookies.getObject($scope.userId+'_apps').length == 0) { + if (($scope.appsView != undefined) && ($scope.appsView != null) && ($scope.appsView.length > 0)){ + $scope.appsViewData = $scope.appsView; + $cookies.putObject($scope.userId + '_apps', $scope.appsView); + } + } + else{ + this.listChanged = false; + this.appsListFromCookie = $cookies.getObject($scope.userId+'_apps'); + this.finalAppsList = []; + // + // If an app is still valid for this user from backend(appsView) and + // it was in the cookie already, put it in the list in the same order + // it was in within the cookie. + // + let finalCount = 0; + for (let i = 0; i < this.appsListFromCookie.length; i++) { + this.foundAppInListFromBackend = false; + for (let j = 0; j < $scope.appsView.length; j++) { + if (this.appsListFromCookie[i].url == $scope.appsView[j].url) { + this.finalAppsList[finalCount] = { + sizeX: 2, + sizeY: 2, + headerText: '', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + this.finalAppsList[finalCount].headerText = this.appsListFromCookie[i].headerText; + this.finalAppsList[finalCount].subHeaderText = this.appsListFromCookie[i].subHeaderText; + this.finalAppsList[finalCount].imageLink = this.appsListFromCookie[i].imageLink; + this.finalAppsList[finalCount].order = this.appsListFromCookie[i].order; + this.finalAppsList[finalCount].url = this.appsListFromCookie[i].url; + this.finalAppsList[finalCount].restrictedApp = this.appsListFromCookie[i].restrictedApp; + finalCount++; + this.foundAppInListFromBackend = true; + break; + } + } + if (this.foundAppInListFromBackend == false) { + this.listChanged = true; + } + } + + // + // Fill in the rest of the list with the Apps retrieved from the backend that we did not already add. There could have been + // new Apps configured for the user that are not in the cookie. + // + for (let i = 0; i < $scope.appsView.length; i++) { + this.found = false; + for (let j = 0; j < this.finalAppsList.length; j++) { + if ($scope.appsView[i].url == this.finalAppsList[j].url) { + // already present + this.found = true; + break; + } + } + if (this.found == false) { + this.finalAppsList[finalCount] = { + sizeX: 2, + sizeY: 2, + headerText: '', + subHeaderText: '', + imageLink: '', + order: '', + url: '' + }; + this.finalAppsList[finalCount].headerText = $scope.appsView[i].headerText; + this.finalAppsList[finalCount].subHeaderText = $scope.appsView[i].subHeaderText; + this.finalAppsList[finalCount].imageLink = $scope.appsView[i].imageLink; + this.finalAppsList[finalCount].order = $scope.appsView[i].order; + this.finalAppsList[finalCount].url = $scope.appsView[i].url; + this.finalAppsList[finalCount].restrictedApp = $scope.appsView[i].restrictedApp; + finalCount++; + this.listChanged = true; + } + } + + if ((this.finalAppsList != undefined) && (this.finalAppsList != null) && (this.finalAppsList.length > 0)) { + if (this.listChanged) { + $scope.appsViewData = this.finalAppsList; + $cookies.putObject($scope.userId + '_apps', this.finalAppsList); + } else { + $scope.appsViewData = $cookies.getObject($scope.userId+'_apps'); + } + } + this.isLoading = false; + $scope.getUserAppsIsDone = true; + } + }).catch(err => { + $log.error('oh no! couldnt get applications list...', err); + this.isLoading = false; + $scope.getUserAppsIsDone = true; + }); + }); + + + this.gridsterOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + draggable : { + stop: function () { + $cookies.putObject($scope.userId + '_apps', $scope.appsViewData); + } + } + }; + + //navigate to application url in new tab + this.goToPortal = (item) => { + $log.info("goToPortal called with item: " + item); + let url = item.url; + let restrictedApp = item.restrictedApp; + if (!url) { + $log.info('No url found for this application, doing nothing..'); + return; + } + if (!HTTP_PROTOCOL_RGX.test(url)) { + url = 'http://' + url; + } + if (restrictedApp) { + $window.open(url, '_blank'); + } else { + var tabContent = { id: new Date(), title: item.headerText, url:item.url.split('#')[0] + '?' + (new Date).getTime() + "#" + item.url.split('#')[1]}; + $cookies.putObject('addTab', tabContent ); + } + + }; + // try { + // userProfileService.getUserProfile() + // .then(profile=> { + // if (profile.roles.indexOf('superAdmin') > -1) { + // $scope.buildNumber = "ECOMP Portal Version: 1610.0.2058" + // } + // }).catch(err=> { + // $log.error('Applications Home:: getUserProfile() failed: ' + err); + // }); + // } catch (err) { + // $log.error('Applications Home:: getUserProfile() failed: ' + err); + // } + if(getParameterByName('noUserError')!=null){ + if(getParameterByName('noUserError')=="Show"){ + $("#errorInfo").show(); + } + } + } + } + ApplicationsHomeCtrl.$inject = ['applicationsService', '$log', '$window', 'userProfileService', '$scope','$cookies', 'utilsService']; + angular.module('ecompApp').controller('ApplicationsHomeCtrl', ApplicationsHomeCtrl); +})(); + +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, " ")); +} diff --git a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.spec.js b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.spec.js new file mode 100644 index 00000000..e3782ab2 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.spec.js @@ -0,0 +1,77 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +describe('Controller: ApplicationsHomeCtrl ', function() { + beforeEach(module('ecompApp')); + + let ApplicationsHomeCtrl, $controller, $q, rootScope, $log, $window, $cookies, scope; + let deferredApps, deferredUserProfile, applicationsServiceMock, userProfileServiceMock; + + + beforeEach(inject( (_$controller_, _$q_, _$rootScope_, _$log_, _$window_, _$cookies_, _CacheFactory_)=>{ + rootScope = _$rootScope_; + scope = rootScope.$new(); + $q = _$q_; + $controller = _$controller_; + $log = _$log_; + $window = _$window_; + $cookies = _$cookies_; + + _CacheFactory_.destroyAll(); + + deferredApps = $q.defer(); + deferredUserProfile = $q.defer(); + applicationsServiceMock = jasmine.createSpyObj('applicationsServiceMock', ['getUserApps']); + applicationsServiceMock.getUserApps.and.returnValue(deferredApps.promise); + + userProfileServiceMock = jasmine.createSpyObj('userProfileServiceMock',['getUserProfile']); + userProfileServiceMock.getUserProfile.and.returnValue(deferredUserProfile.promise); + + ApplicationsHomeCtrl = $controller('ApplicationsHomeCtrl', { + applicationsService: applicationsServiceMock, + $log: $log, + $window: $window, + userProfileService: userProfileServiceMock, + $scope: scope, + $cookies: $cookies + }); + scope.$digest(); + })); + + it('should populate this.apps with data from portals service getUserApps', inject(function ( _$q_) { + $q = _$q_; + + let profile = {roles: 'superAdmin', userId: 'userid'}; + + deferredUserProfile.resolve(profile) + deferredApps.resolve([{name: 'portal1'},{name: 'portal2'},{name: 'portal3'}]); + scope.$digest(); + expect(scope.appsViewData.length).toBe(3); + })); + + it('should call $log error when getAllPortals fail', inject(function ( _$q_) { + $q = _$q_; + spyOn($log, 'error'); + deferredUserProfile.reject('something happened!'); + scope.$digest(); + expect($log.error).toHaveBeenCalled(); + })); + +}); diff --git a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.less b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.less new file mode 100644 index 00000000..d91acc17 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.less @@ -0,0 +1,164 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-applications-home { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .go-button { + .btn-green; + width: 96px; + position: absolute; + border-radius: 0px; + } + + .applications-home-container { + .content_justify; + position: relative; + padding: 15px 0 32px 0; + width: 100%; + + .applications-home-title { + .a24r; + margin: auto; + .content_justify; + } + .portals-list { + min-height: 70vh; + justify-content: center; + flex-flow: row wrap; + width: 1170px; + + margin: auto; + margin-bottom: 63px; + + .app-gridster-header { + background-color: @u; + } + + .app-gridster-footer { + background-color: @u; + } + + .portals-list-item { + background-color: @u; + border-radius: 2px; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + display: inline-block; + width: 360px; + height: 300px; + background-size: cover; + cursor: pointer; + margin: 15px; + overflow: hidden; + + .portals-item-info { + background-color: @u; + height: 120px; + top: 180px; + position: relative; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + padding: 16px; + + .info-title { + .a24r; + margin-bottom: 4px; + + text-overflow: ellipsis; + overflow: hidden; + } + .info-description { + .c16r; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + .info-button { + .btn-green; + width: 96px; + position: absolute; + bottom: 16px; + left: 16px; + } + + &:hover { + opacity: .93; + z-index: 3; + } + } + } + } + } +} +.w-ecomp-main-error{ + .o14r; + position: absolute; + width: 100%; + line-height: 1.5em; +} +.w-ecomp-main-disclaimer { + text-align: center; + .o14r; + //position: absolute; + bottom: -75px; + line-height: 1.5em; + margin: 0 auto; + width:1170px; + position: relative; + +} +.build-number { + .o12i; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + +.slide.ng-hide-add, +.slide.ng-hide-remove, +.slide.ng-enter, +.slide.ng-leave { + transition: all 0.5s ease; +} +.slide.ng-hide, +.slide.ng-enter { + transform: translate(-100%, 0); +} +.slide.ng-enter-active { + transform: translate(0, 0); +} +.slide.ng-leave { + transform: translate(0, 0); +} +.slide.ng-leave-active { + transform: translate(+100%, 0); +} diff --git a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.tpl.html b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.tpl.html new file mode 100644 index 00000000..645807f6 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.tpl.html @@ -0,0 +1,59 @@ + +
+
+
Applications
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ You do not have access to any application/functionality within OpenECOMP Portal. Please contact your administrator to get access to ECOMP Portal
+
+
+
+
+ +

+
+ +
+
diff --git a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.js b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.js new file mode 100644 index 00000000..3f624117 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.js @@ -0,0 +1,284 @@ +'use strict'; +(function () { + + class WidgetsHomeCtrl { + constructor(widgetsService, $log, $cookies, $scope, userProfileService,dashboardService) { + this.userProfileService = userProfileService; + this.isLoading = true; + + userProfileService.getUserProfile() + .then(profile=> { + $log.info('WidgetsHomeCtrl::getUserProfile: ', profile); + $scope.attuid = profile.attuid; + $log.info('WidgetsHomeCtrl::getUserProfile: user has the following attuid: ' + profile.attuid); + $scope.widgetsViewData = []; + $scope.widgetsView = []; + + widgetsService.getUserWidgets() + .then(widgets => { + $log.info('WidgetsHomeCtrl::getUserWidgets', widgets); + this.widgets = widgets; + this.enlargeURL = ""; + this.isEnlarged = false; + let rowNo = 0; + for (let i = 0; i < this.widgets.length; i++) { + $scope.widgetsView[i] = { + sizeX: 2, + sizeY: 2, + headerText: '', + width: '', + height: '', + url: '', + selected:false + }; + $scope.widgetsView[i].headerText = this.widgets[i].name; + $scope.widgetsView[i].url = this.widgets[i].url; + //$scope.widgetsView[i].width = this.widgets[i].width; + //$scope.widgetsView[i].height = this.widgets[i].height; + //$scope.widgetsView[i].sizeX = this.widgets[i].width/180; + //$scope.widgetsView[i].sizeY = this.widgets[i].height/150; + } + /*News Events Resources*/ + $scope.widgetsView[this.widgets.length] = { + sizeX: 2, + sizeY: 2, + headerText: 'News', + width: '', + height: '', + url: '', + selected:true + }; + $scope.widgetsView[this.widgets.length+1] = { + sizeX: 2, + sizeY: 2, + headerText: 'Events', + width: '', + height: '', + url: '', + selected:true + }; + $scope.widgetsView[this.widgets.length+2] = { + sizeX: 2, + sizeY: 2, + headerText: 'Resources', + width: '', + height: '', + url: '', + selected:true + }; + + /*Setting News data*/ + $scope.newsData = []; + $scope.updateNews = function() { + $scope.newsData.length=0; + dashboardService.getCommonWidgetData('NEWS').then(function(res) { + // $log.info(res.message); + var newsDataJsonArray = res.response.items; + for (var i = 0; i < newsDataJsonArray.length; i++) { + $scope.newsData.push(newsDataJsonArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get news list', err); + _this.isLoading = false; + }); + } + $scope.updateNews(); + /*Setting Events data*/ + + $scope.eventData = []; + + $scope.updateEvents = function() { + $scope.eventData.length=0; + dashboardService.getCommonWidgetData('EVENTS').then(function(res) { + var eventDataJsonArray = res.response.items; + for (var i = 0; i < eventDataJsonArray.length; i++) { + if(eventDataJsonArray[i].eventDate !=null) { + // yyyy-mm-dd + eventDataJsonArray[i].year = eventDataJsonArray[i].eventDate.substring(2,4); + eventDataJsonArray[i].mon = eventDataJsonArray[i].eventDate.substring(5,7); + eventDataJsonArray[i].day = eventDataJsonArray[i].eventDate.substring(8,10); + } + $scope.eventData.push(eventDataJsonArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get Events list', err); + _this.isLoading = false; + }); + } + $scope.updateEvents(); + /*Setting Important Resources data*/ + + $scope.importResData = []; + $scope.updateImportRes = function() { + $scope.importResData.length=0; + dashboardService.getCommonWidgetData('IMPORTANTRESOURCES').then( + function(res) { + // $log.error('couldnt get important list...', res.response.dataBlob); + $log.info(res); + var importResDataJSONArray = res.response.items; + for (var i = 0; i < importResDataJSONArray.length; i++) { + $scope.importResData.push(importResDataJSONArray[i]); + } + })['catch'](function(err) { + $log.error('dashboard controller: failed to get resources list...', err); + _this.isLoading = false; + }); + } + $scope.updateImportRes(); + + /********End hardcoded news events and resources****************/ + + + $log.info('WidgetsHomeCtrl::getUserWidgets count : ' + $scope.widgetsView.length); + + if ($cookies.getObject($scope.attuid + '_widget') == undefined || $cookies.getObject($scope.attuid + '_widget') == null || $cookies.getObject($scope.attuid + '_widget').length == 0) { + if (($scope.widgetsView != undefined) && ($scope.widgetsView != null) && ($scope.widgetsView.length > 0)) { + $scope.widgetsViewData = $scope.widgetsView; + //$cookies.putObject($scope.attuid + '_widget', $scope.widgetsView); + } + } + else { + this.listChanged = false; + this.listFromCookie = $cookies.getObject($scope.attuid + '_widget'); + this.finalList = []; + // + // If a widget is still valid for this user from backend and + // it was in the cookie already, put it in the list in the same order + // it was in within the cookie. + // + let finalCount = 0; + for (let i = 0; i < this.listFromCookie.length; i++) { + this.foundInListFromBackend = false; + for (let j = 0; j < $scope.widgetsView.length; j++) { + if ((this.listFromCookie[i].url == $scope.widgetsView[j].url) && + (this.listFromCookie[i].headerText == $scope.widgetsView[j].headerText)) { + this.finalList[finalCount] = { + sizeX: 2, + sizeY: 2, + headerText: '', + width: '', + height: '', + url: '', + selected:false + }; + this.finalList[finalCount].headerText = this.listFromCookie[i].headerText; + //this.finalList[finalCount].width = this.listFromCookie[i].width; + //this.finalList[finalCount].height = this.listFromCookie[i].height; + this.finalList[finalCount].url = this.listFromCookie[i].url; + //this.finalList[finalCount].sizeX = this.listFromCookie[i].width/180; + //this.finalList[finalCount].sizeY = this.listFromCookie[i].height/150; + finalCount++; + this.foundInListFromBackend = true; + break; + } + } + if (this.foundInListFromBackend == false) { + this.listChanged = true; + } + } + + // + // Fill in the rest of the list with the widgets retrieved from the backend that we did + // not already add. There could have been + // new widgets configured for the user that are not in the cookie. + // + for (let i = 0; i < $scope.widgetsView.length; i++) { + this.found = false; + for (let j = 0; j < this.finalList.length; j++) { + if (($scope.widgetsView[i].url == this.finalList[j].url) && + ($scope.widgetsView[i].headerText == this.finalList[j].headerText)){ + // already present + this.found = true; + break; + } + } + if (this.found == false) { + this.finalList[finalCount] = { + sizeX: 2, + sizeY: 2, + headerText: '', + width: '', + height: '', + url: '', + selected:false + }; + this.finalList[finalCount].headerText = $scope.widgetsView[i].headerText; + //this.finalList[finalCount].width = $scope.widgetsView[i].width; + //this.finalList[finalCount].height = $scope.widgetsView[i].height; + this.finalList[finalCount].url = $scope.widgetsView[i].url; + //this.finalList[finalCount].sizeX = $scope.widgetsView[i].width/180; + //this.finalList[finalCount].sizeY = $scope.widgetsView[i].height/150; + finalCount++; + this.listChanged = true; + } + } + + if ((this.finalList != undefined) && (this.finalList != null) && (this.finalList.length > 0)) { + if (this.listChanged) { + $scope.widgetsViewData = this.finalList; + $cookies.putObject($scope.attuid + '_widget', this.finalList); + } else { + $scope.widgetsViewData = $cookies.getObject($scope.attuid + '_widget'); + } + } + this.isLoading = false; + } + }).catch(err => { + $log.error('WidgetsHomeCtrl::getUserWidgets: oh no! couldnt get widgets list...', err); + this.isLoading = false; + }); + }); + + + this.gridsterOpts = { + columns: 6, + colWidth: 190, + rowHeight: 190, + margins: [20, 20], + outerMargin: true, + pushing: true, + floating: true, + swapping: true, + draggable: { + handle: 'img', + stop: function () { + $cookies.putObject($scope.attuid + '_widget', $scope.widgetsViewData); + } + } + }; + } + } + + WidgetsHomeCtrl.$inject = ['widgetsService', '$log', '$cookies', '$scope', 'userProfileService','dashboardService']; + angular.module('ecompApp').controller('WidgetsHomeCtrl', WidgetsHomeCtrl); + + angular.module('ecompApp').constant('refreshInterval', '30000'); + + angular.module('ecompApp').directive('refreshIframe', ['$interval', 'refreshInterval', function ($interval, refreshInterval) { + + function link(scope, element, attrs) { + var timeoutId; + + function updateIframe() { + if(attrs.isEnlarged == "false") + { + element.attr('src', element.attr('src')); + } + } + + element.on('$destroy', function () { + $interval.cancel(timeoutId); + }); + + // start the UI update process; save the timeoutId for cancelling + /*timeoutId = $interval(function () { + updateIframe(); // update DOM + }, refreshInterval);*/ + } + + return { + link: link + }; + } ]); + +})(); diff --git a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.spec.js b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.spec.js new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.spec.js @@ -0,0 +1 @@ + diff --git a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.less b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.less new file mode 100644 index 00000000..46e5b1fd --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.less @@ -0,0 +1,137 @@ +.w-ecomp-widgets-home{ + //.bg_u;//white for 1702 + .bg_w; // gray for 1610 + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .widget-gridster-header { + background-color:#ffffff; + } + + .widget-gridster-footer { + background-color:#ffffff + } + + .widget-iframe { + width: 100%; + height: 90%; + } + + .widget-image { + cursor: pointer; + width: 20px; + height: 25px; + } + + .enlarge-content{ + top: 120px; + left: 400px; + width:1170px; + height:600px; + right: 0; + bottom: 0; + left: 0; + background: none repeat scroll 0 0 #f2f2f2; + } + + .enlarge-close-button{ + .btn-blue; + position: relative; + top : -20px; + left : 1145px; + width : 25px; + } + + .widgets-home-container { + .content_justify; + position: relative; + padding-right: 0; + padding-left: 0; + padding-bottom: 32px; + width: 100%; + + .widgets-home-title { + .a24r; + margin: auto; + .content_justify; + } + .portals-list { + min-height: 70vh; + //display: flex; + justify-content: center; + flex-flow: row wrap; + width: 1170px; + + margin: auto; + margin-bottom: 63px; + + .portals-list-item { + background-color: @u; + border-radius: 2px; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + display: inline-block; + width: 360px; + height: 300px; + background-size: cover; + cursor: pointer; + margin: 15px; + overflow: hidden; + + .portals-item-info { + background-color: @u; + height: 50px; + top: 180px; + // position: relative; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + padding: 16px; + + .info-title { + .a24r; + margin-bottom: 4px; + + text-overflow: ellipsis; + overflow: hidden; + } + .info-description { + .c16r; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + .info-button { + .btn-green; + width: 96px; + // position: absolute; + bottom: 16px; + left: 16px; + } + + &:hover { + opacity: .93; + z-index: 3; + } + } + } + } + } +} + +.gridster-item-container .gridster-item-body{ + bottom:0px; + overflow:hidden; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} diff --git a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.tpl.html b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.tpl.html new file mode 100644 index 00000000..8e385c1e --- /dev/null +++ b/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.tpl.html @@ -0,0 +1,123 @@ +
+
+
Widgets
+ + +
+
+ +
+
+
+
+
+
+
+
    +
  • +
+
+
+
+
+
There's currently no news available.
+
+
+
+
+
+
+
+
+
+
    +
  • +
    +
    {{event.mon}}/{{event.day}}/{{event.year}}
    +
    +
    +

    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
  • + + +
+
+
+
+
+
There's currently no event available.
+
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+
There's currently no links available.
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
X
+ +
+ +
+ +
+ To request access to an application, please visit the Get Access page. +
+
+
diff --git a/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.js b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.js new file mode 100644 index 00000000..b5216101 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.js @@ -0,0 +1,85 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class NewPortalAdminModalCtrl { + constructor($log, portalAdminsService, $scope, confirmBoxService) { + + let init = () => { + this.isSaving = false; + if($scope.ngDialogData && $scope.ngDialogData.selectedUser && $scope.ngDialogData.dialogState){ + this.selectedUser = $scope.ngDialogData.selectedUser; + this.dialogState = $scope.ngDialogData.dialogState; + }else{ + this.selectedUser = null; + this.dialogState = 1; + } + $log.info('NewPortalAdminModalCtrl:: initiated'); + }; + + this.addNewPortalAdmin = () => { + portalAdminsService.getPortalAdmins().then(result=> { + var dupNameCheck = JSON.stringify(result).search(this.selectedUser.orgUserId); + if (dupNameCheck != -1) { + $log.error("NewPortalAdminModalCtrl::addNewPortalAdmin: userId already exists as a portal admin! dupNameCheck=",dupNameCheck); + confirmBoxService.showInformation('This user already exists as a portal admin!').then(function (isConfirmed) { + $scope.closeThisDialog(true); + }); + } else { + confirmBoxService.makeAdminChanges('Are you sure you want to add "' + this.selectedUser.firstName + ' ' + this.selectedUser.lastName + '" as a Portal Admin?') + .then(isConfirmed => { + if(isConfirmed) { + if (!this.selectedUser || !this.selectedUser.orgUserId) { + $log.error('NewPortalAdminModalCtrl::makeAdminChanges: No portal admin or ID... cannot add'); + return; + } + portalAdminsService.addPortalAdmin(this.selectedUser.orgUserId) + .then(() => { + $log.debug("NewPortalAdminModalCtrl::addNewPortalAdmin: portal admin added successfully"); + $scope.closeThisDialog(true); + }).catch(err => { + $log.error('NewPortalAdminModalCtrl::addNewPortalAdmin error status: ' + err.status); + confirmBoxService.showInformation('There was a unknown problem adding the portal admin. ' + 'Please try again later. Error Status: '+ err.status).then(function (isConfirmed) {}); + }); + } + }).catch(err => { + $log.error('portalAdminsService.addPortalAdmin error status: '+ err.status); + }); + } + }).catch(err=> { + $log.error('NewPortalAdminModalCtrl::addNewPortalAdmin error getting portal admins list:',err); + }); + }; + + this.setSelectedUser = (user) => { + $log.debug('NewPortalAdminModalCtrl::setSelectedUser: selected user: ', user); + this.selectedUser = user; + }; + + init(); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + NewPortalAdminModalCtrl.$inject = ['$log', 'portalAdminsService', '$scope', 'confirmBoxService']; + angular.module('ecompApp').controller('NewPortalAdminModalCtrl', NewPortalAdminModalCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.spec.js b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.html b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.html new file mode 100644 index 00000000..f235b391 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.html @@ -0,0 +1,32 @@ + +
+
+ +
+
Save +
+
Cancel
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.less b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.less new file mode 100644 index 00000000..dcc4fc52 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/new-portal-admin/new-portal-admin.modal.less @@ -0,0 +1,99 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .new-portal-admin-modal { + display:block; + overflow:auto; + min-height: 450px; + + .search-users { + } + + .admin-app-roles { + .title { + .n18r; + border-bottom: @a 3px solid; + + } + + .app-roles-main { + margin-top: 16px; + .app-roles-main-title { + .n14r; + margin-bottom: 8px; + .left { + display: inline-block; + } + .right { + display: inline-block; + color: @a; + float: right; + cursor: pointer; + } + } + + .select-input{ + width: 460px; + } + + .new-administrated-app { + height: 30px; + line-height: 30px; + + border: 1px solid @p; + margin-bottom: 8px; + border-radius: 2px; + padding-left: 6px; + padding-top: 0; + .o14r; + } + + .admin-roles-list { + height: 240px; + overflow-y: auto; + } + + .administrated-application { + width: 460px; + height: 30px; + border: 1px solid @p; + margin-bottom: 8px; + border-radius: 2px; + padding: 6px; + .o14r; + display: inline-block; + + } + + .delete-application { + .ico_trash_default; + display: inline-block; + vertical-align: 4px; + cursor: pointer; + position: relative; + top: 6px; + color: transparent; + margin-left: 8px; + } + + } + + } +} + diff --git a/ecomp-portal-FE/client/app/views/portal-admin/portal-admin-controller.js b/ecomp-portal-FE/client/app/views/portal-admin/portal-admin-controller.js new file mode 100644 index 00000000..10043005 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/portal-admin-controller.js @@ -0,0 +1,127 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class PortalAdminsCtrl { + constructor($log, portalAdminsService, ngDialog, confirmBoxService) { + + let updateTableData = () => { + this.isLoadingTable = true; + portalAdminsService.getPortalAdmins().then(result=> { + $log.debug('PortalAdminsCtrl::updateTableData: result: ' + JSON.stringify(result)); + if (!result || !result.length) { + $log.info('PortalAdminsCtrl::updateTableData: no Portal Admins err handling'); + this.portalAdminsTableData = []; + return; + } + this.portalAdminsTableData = result; + }).catch(err=> { + $log.error('PortalAdminsCtrl::updateTableData error :',err); + }).finally(() => { + this.isLoadingTable = false; + }); + }; + + let init = () => { + $log.info('portalAdminsService.getPortalAdmins::initializing...'); + this.isLoadingTable = false; + + this.searchString= ''; + this.portalAdminsTableHeaders = ['First Name', 'Last Name', 'User ID', 'Delete']; + this.portalAdminsTableData = []; + updateTableData(); + }; + + init(); + + this.removePortalAdmin = pAdmin => { + $log.debug('pAdmin = ' + JSON.stringify(pAdmin)); + confirmBoxService.deleteItem(pAdmin.firstName + ' ' + pAdmin.lastName ) + .then(isConfirmed => { + if(isConfirmed){ + if(!pAdmin || !pAdmin.userId){ + $log.error('PortalAdminsCtrl::removePortalAdmin No portal admin or ID... cannot delete'); + return; + } + portalAdminsService.removePortalAdmin(pAdmin.userId).then(() => { + $log.info("PortalAdminsCtrl::removePortalAdmin removed admin"); + init(); + }).catch(err => { + $log.error('PortalAdminsCtrl::removePortalAdmin.deleteItem error: '+ err); + }); + } + }).catch(err => { + $log.error('PortalAdminsCtrl::removePortalAdmin.deleteItem error: '+ err); + }); + }; + + this.openAddNewPortalAdminModal = (user) => { + let data = null; + if(user){ + data = { + dialogState: 2, + selectedUser:{ + userId: user.orgUserId, + firstName: user.firstName, + lastName: user.lastName + } + } + } + ngDialog.open({ + templateUrl: 'app/views/portal-admin/new-portal-admin/new-portal-admin.modal.html', + controller: 'NewPortalAdminModalCtrl', + controllerAs: 'newPortalAdmin', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + $log.debug('PortalAdminsCtrl::openAddNewPortalAdminModal: updating Portal Admin table data...'); + updateTableData(); + } + }); + }; + + this.openEditUserModal = (loginId) => { + var data = { + loginId : loginId, + updateRemoteApp : false, + appId : this.selectedApp!=null?this.selectedApp.id:'' + } + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/header/user-edit/edit-user.tpl.html', + controller: 'editUserController', + data: data, + resolve: { + message: function message() { + var message = { + type: 'Contact', + }; + return message; + } + } + }).closePromise.then(needUpdate => { + updateTableData(); + }); + } + + } + } + PortalAdminsCtrl.$inject = ['$log', 'portalAdminsService', 'ngDialog', 'confirmBoxService']; + angular.module('ecompApp').controller('PortalAdminsCtrl', PortalAdminsCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/portal-admin/portal-admin.tpl.html b/ecomp-portal-FE/client/app/views/portal-admin/portal-admin.tpl.html new file mode 100644 index 00000000..05216f34 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/portal-admin.tpl.html @@ -0,0 +1,73 @@ + +
+
+
+
Portal Admins
+
+
+ +
Add Portal Admin
+
+ +
+ + + + + + + + + + + + + + + + + +
{{portalAdmin.portalAdminsTableHeaders[0]}}{{portalAdmin.portalAdminsTableHeaders[1]}}{{portalAdmin.portalAdminsTableHeaders[2]}}{{portalAdmin.portalAdminsTableHeaders[3]}}
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/portal-admin/portal-admins.less b/ecomp-portal-FE/client/app/views/portal-admin/portal-admins.less new file mode 100644 index 00000000..29fd9e32 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/portal-admin/portal-admins.less @@ -0,0 +1,56 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .portal-admins-page-main { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + + .portal-admins-table { + width: @table-width; + margin: @table-margin; + + .table-control { + .table-dropdown-filter{ + width: @table-dropdown-filter-width; + display: @table-dropdown-filter-display; + } + } + + .table-body { + cursor: pointer; + } + } + + .delete-user{ + .ico_trash_default; + } + + .portal-add-button { + width: 160px; + } +} + diff --git a/ecomp-portal-FE/client/app/views/search/search.controller.js b/ecomp-portal-FE/client/app/views/search/search.controller.js new file mode 100644 index 00000000..60e27593 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/search/search.controller.js @@ -0,0 +1,184 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + + class SearchCtrl { + constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService, dashboardService) { + $scope.firstName=""; + $scope.lastName=""; + + function showHideSearchSnippet() { + + setTimeout(function() { + jQuery("#mainSearchSnippet").click(); + },500); + + setTimeout(function() { + jQuery("#mainSearchText").focus(); + },1000); + } + + jQuery("#mainSearchDiv").keyup(function(event){ + if(event.keyCode == 13){ + // there is a watch on this variable which will trigger the database pull + dashboardService.searchString = jQuery("#mainSearchText").val(); + + // opens the popup + var popupDomObj = jQuery("[content='searchSnippet.html']"); + if(popupDomObj.length == 0) { + showHideSearchSnippet(); + } else { + jQuery("#mainSearchSnippet").click(); + showHideSearchSnippet(); + } + + + + } + }); + + + + } + + + } + + + class SearchSnippetCtrl { + constructor($log, $scope, $cookies, $timeout, userProfileService, sessionService, dashboardService,applicationsService, $window, $state) { + $scope.firstName=""; + $scope.lastName=""; + $scope.goToUrl = goToUrl; + $scope.dService = dashboardService; + + + + function goToUrl (item, type) { + $log.info("goToUrl called") + $log.info(item + "/" + type); + + + if(type == 'intra') { + + var intraSearcLink = "http://to_do_link.com"; + var intraSpecSearcLink = intraSearcLink + encodeURIComponent(dashboardService.searchString); + $window.open(intraSpecSearcLink, '_blank'); + + } else if (type == 'extra') { + var extraSearcLink = "https://to_do_link.com"; + var extraSpecSearcLink = extraSearcLink + encodeURIComponent(dashboardService.searchString); + $window.open(extraSpecSearcLink, '_blank'); + } + + let url = item.target; + let restrictedApp = item.uuid; + let getAccessState = "root.getAccess" + if (!url) { + + applicationsService.goGetAccessAppName = item.name; + if($state.current.name == getAccessState) + $state.reload(); + else + $state.go(getAccessState); + //$log.info('No url found for this application, doing nothing..'); + return; + } + + if (restrictedApp != "true") { + $window.open(url, '_blank'); + } else { + if(item.url=="root.access"){ + $state.go(url); + var tabContent = { id: new Date(), title: 'Home', url: url }; + $cookies.putObject('addTab', tabContent ); + } else { + var tabContent = { id: new Date(), title: item.name, url: url }; + $cookies.putObject('addTab', tabContent ); + } + } + + } + + function getItems(searchString) { + + var items; + var itemMap = dashboardService.getSearchAllByStringResults(searchString) + .then(res => { + $scope.items = res; + + + }).catch(err => { + $scope.items = []; + $log.error('Couldnt get search results...', err) + }); + + } + + $scope.$watch('dService.searchString', function(searchString) { + if(searchString != undefined ) + getItems(searchString); + + }); + + + + } + + + + } + + + + SearchCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService', 'dashboardService']; + SearchSnippetCtrl.$inject = ['$log', '$scope', '$cookies', '$timeout','userProfileService', 'sessionService', 'dashboardService','applicationsService', '$window','$state']; + angular.module('ecompApp').controller('searchCtrl', SearchCtrl); + angular.module('ecompApp').controller('searchSnippetCtrl', SearchSnippetCtrl); + angular.module('ecompApp').directive('searchBox', function() { + return { + restrict: "E", + templateUrl: 'app/views/search/search.tpl.html', + link: function(scope, element) { + + //var iframeId = "#tabframe-" + scope.$parent.tab.title.split(' ').join('-'); + // jQuery(iframeId).load(function() { + // alert("hello"); + // }); //.attr("src",'{{tab.content | trusted}}' ); //src='{{tab.content | trusted}}' + // jQuery(iframeId).attr('src', '{{tab.content | trusted}}'); + + //element.childNodes[0].on('load', function() { + // alert('hello'); + //}); + } + } + }); + angular.module( 'ecompApp' ).config( [ + '$compileProvider', + function( $compileProvider ) + { + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|qto):/); + } + ]); + +})(); + + diff --git a/ecomp-portal-FE/client/app/views/search/search.controller.spec.js b/ecomp-portal-FE/client/app/views/search/search.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/search/search.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/search/search.less b/ecomp-portal-FE/client/app/views/search/search.less new file mode 100644 index 00000000..a21559ec --- /dev/null +++ b/ecomp-portal-FE/client/app/views/search/search.less @@ -0,0 +1,55 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .searchLiHeader { +font-weight: bold; +color: #0574ac; +font-size: 16px; +padding-bottom: 10px; +line-height: 1.5; +font-family: arial; + +} + +.searchLiItems{ +cursor: pointer; +font-weight: normal; +font-size: 12px; +color: #444444; +font-family: arial; +} + +.searchUl { +list-style: none; +border-bottom: 1px solid #bbb; +padding-bottom: 20px; +} + +#contentVertical { + height: 300px; + width: 250px; + } + +#contentVertical .scroll-viewport { + height: 300px; + width: 250px; + } +#mainSearchText::-ms-clear{ + display:none; +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/search/search.tpl.html b/ecomp-portal-FE/client/app/views/search/search.tpl.html new file mode 100644 index 00000000..bd37f772 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/search/search.tpl.html @@ -0,0 +1,82 @@ + + +
+
+ +   + +
+
+
+ +
+ + + + + diff --git a/ecomp-portal-FE/client/app/views/sidebar/sidebar.controller.js b/ecomp-portal-FE/client/app/views/sidebar/sidebar.controller.js new file mode 100644 index 00000000..76d5301c --- /dev/null +++ b/ecomp-portal-FE/client/app/views/sidebar/sidebar.controller.js @@ -0,0 +1,143 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class SidebarCtrl { + constructor(userProfileService, $log, $rootScope) { + this.$log = $log; + this.userProfileService = userProfileService; + this.$rootScope = $rootScope; + $rootScope.isAdminPortalAdmin = false; + + //if (bowser.msie || bowser.msedge) + // $log.debug('SidebarCtrl::init: Browser is: Internet Explorer or Edge'); + // else + // $log.debug('SidebarCtrl::init: Browser is: ' + bowser.name + ': ' + bowser.version); + + userProfileService.getUserProfile() + .then(profile=> { + // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(superAdmin) = ' + profile.roles.indexOf('superAdmin')); + // $log.debug('SidebarCtrl::getUserProfile: profile.roles.indexOf(admin) = ' + profile.roles.indexOf('admin')); + if (profile.roles.indexOf('superAdmin') > -1) { + $rootScope.isAdminPortalAdmin = true; + // this.$log.debug('SidebarCtrl::getUserProfile: user has the superAdmin role'); + this.sidebarModel = { + label: 'ECOMP portal', + navItems: [ + { + name: 'Home', + state: 'root.applicationsHome', + imageSrc : 'ion-home' + }, { + name: 'Application Catalog', + state: 'root.appCatalog', + imageSrc : 'ion-grid' + }, { + name: 'Widgets', + state: 'root.widgetsHome', + imageSrc : 'ion-android-apps' + }, { + name: 'Admins', + state: 'root.admins', + imageSrc : 'ion-android-star' + }, { + name: 'Users', + state: 'root.users', + imageSrc : 'ion-person' + },{ + name: 'Portal Admins', + state: 'root.portalAdmins', + imageSrc : 'ion-gear-a' + }, { + name: 'Application Onboarding', + state: 'root.applications', + imageSrc : 'ion-ios-upload-outline' + }, { + name: 'Widget Onboarding', + state: 'root.widgets', + imageSrc : 'ion-ios-upload-outline' + },{ + name: 'Edit Functional Menu', + state: 'root.functionalMenu', + imageSrc : 'ion-compose' + } + ] + }; + } + else if (profile.roles.indexOf('admin') > -1) { + // this.$log.debug('SidebarCtrl::getUserProfile: user has the admin role'); + this.sidebarModel = { + label: 'ECOMP portal', + navItems: [ + { + name: 'Home', + state: 'root.applicationsHome', + imageSrc : 'ion-home' + }, { + name: 'Application Catalog', + state: 'root.appCatalog', + imageSrc : 'ion-grid' + }, { + name: 'Widgets', + state: 'root.widgetsHome', + imageSrc : 'ion-grid' + }, { + name: 'Users', + state: 'root.users', + imageSrc : 'ion-person' + }, { + name: 'Widget Onboarding', + state: 'root.widgets', + imageSrc : 'ion-grid' + } + ] + }; + } + else { + $rootScope.isAdminPortalAdmin = false; + // this.$log.debug('SidebarCtrl::getUserProfile: user is not superAdmin nor admin'); + this.sidebarModel = { + label: 'ECOMP portal', + navItems: [ + { + name: 'Home', + state: 'root.applicationsHome', + imageSrc : 'ion-home' + }, { + name: 'Application Catalog', + state: 'root.appCatalog', + imageSrc : 'ion-grid' + }, { + name: 'Widgets', + state: 'root.widgetsHome', + imageSrc : 'ion-grid' + } + ] + }; + } + }).catch(err=> { + $log.error('SidebarCtrl: failed to get user profile: ' + err); + }); + + } + } + SidebarCtrl.$inject = ['userProfileService', '$log', '$rootScope']; + angular.module('ecompApp').controller('SidebarCtrl', SidebarCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/sidebar/sidebar.less b/ecomp-portal-FE/client/app/views/sidebar/sidebar.less new file mode 100644 index 00000000..97650fed --- /dev/null +++ b/ecomp-portal-FE/client/app/views/sidebar/sidebar.less @@ -0,0 +1,37 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-sidebar { + position: relative; + left: 0; + right: 0; + top: 5px; + padding-left: 0; +} + + @media screen and (-webkit-min-device-pixel-ratio:0) +{ + .w-ecomp-sidebar { + position: relative; + left: 0; + right: 0; + top: -5px; + padding-left: 0; + } +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/sidebar/sidebar.tpl.html b/ecomp-portal-FE/client/app/views/sidebar/sidebar.tpl.html new file mode 100644 index 00000000..a5cbf8ff --- /dev/null +++ b/ecomp-portal-FE/client/app/views/sidebar/sidebar.tpl.html @@ -0,0 +1,20 @@ + + diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js new file mode 100644 index 00000000..368f2fe3 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.js @@ -0,0 +1,194 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +(function () { + class ContactUsManageController { + constructor($scope,$log, message, $q, $http, conf,contactUsService,confirmBoxService) { + $scope.contactUsList=[]; + $scope.contactUsAllAppList=[]; + $scope.errMsg=''; + $scope.newContactUs ={ + app:'', + name:'', + email:'', + url:'', + desc:'' + }; + /*Get the existing contact us first, then based on the existing, filter from all apps*/ + $scope.getContactUsList = function(){ + contactUsService.getContactUs().then(res=> { + // $log.info('getting getContactUs',res.response); + if(res!=null && res.response!=null){ + for(var i=0; i { + var tableData=[]; + $scope.contactUsAllAppListTemp=[]; + // $log.info('contactUsService::getListOfApp: getting res'); + var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null; + // $log.info('contactUsService::getListOfApp: result',result); + var res1 = result; + var realAppIndex = 0; + $scope.contactUsAllAppList.length=0; + for (var i = 1; i <= res1.length; i++) { + if (!res1[i - 1].restrictedApp) { + var okToAdd = true; + for(var j =0; j<$scope.contactUsList.length;j++){ + if(res1[i - 1].title==$scope.contactUsList[j].appName) + okToAdd=false; + } + // not allowed to add(duplicate) another entry if the app is already available in the table + if(okToAdd){ + if(res1[i - 1].title){ + $scope.contactUsAllAppList.push({ + index: realAppIndex, + title: res1[i - 1].title, + value: res1[i - 1].index + }); + } + realAppIndex = realAppIndex + 1; + } + } else { + // $log.debug('contactUsService:getAvailableApps:: Restricted/URL only App will not be used = ' + res1[i - 1].title); + } + } + }).catch(err=> { + $log.error('contactUsService:error:: ', err); + + + }).finally(() => { + //this.isLoadingTable = false; + }); + }); + } + + $scope.getContactUsList(); + + $scope.closeDialog = function(){ + $scope.closeThisDialog( $scope.widgetData); + } + + /*Add new Contact Us*/ + $scope.newContactUsFun = function(){ + if($scope.newContactUs.app.title==null || $scope.newContactUs.app.title=='' ){ + confirmBoxService.showInformation('Please select an App to add').then(isConfirmed => { + return; + }); + } + + if($scope.newContactUs.url !=null && $scope.newContactUs.url != '' && !validateUrl($scope.newContactUs.url)){ + var warningMsg = "Please enter a valid URL"; + confirmBoxService.showInformation(warningMsg).then(isConfirmed => {return;}); + return; + } + + contactUsService.addContactUs($scope.newContactUs).then(res=> { + // $log.info('contactUsService: add ContactUs successfully'); + $scope.contactUsList.length=0; + // $log.info('contactUsService: refreshing the Contact US table'); + $scope.getContactUsList(); + $scope.errMsg=''; + /* confirmBoxService.showInformation('You have added a new Contact Us item').then(isConfirmed => { });*/ + var defaultSel={ + index: 0, + title: '', + value: '' + } + $scope.newContactUs ={ + app:defaultSel, + name:'', + email:'', + url:'', + desc:'' + }; + + }).catch(err=> { + $log.error('contactUsService: addContactUs error:: ', err); + // $scope.errMsg=err; + confirmBoxService.showInformation('Add Contact Us list failed: ' + err); + + }).finally(() => { + //this.isLoadingTable = false; + }); + } + /* Edit Contact Us*/ + $scope.editContactUsFun = function(contactObj){ + // $log.info('contactUsService: edit ContactUs save successfully', contactObj); + var contactUsObj={ + appId:contactObj.appId, + appName:contactObj.appName, + description:contactObj.description, + contactName:contactObj.contactName, + contactEmail:contactObj.contactEmail, + url:contactObj.url, + }; + + contactUsService.modifyContactUs(contactUsObj).then(res=> { + // $log.info('contactUsService: edit ContactUs successfully'); + // confirmBoxService.showInformation('You have saved the changes').then(isConfirmed => {}); + $scope.errMsg=''; + + }).catch(err=> { + $log.error('contactUsService: editContactUs error:: ', err); + confirmBoxService.showInformation('Edit Contact Us list failed: ' + err); + // $scope.errMsg=err; + }).finally(() => { + //this.isLoadingTable = false; + }); + + } + /*del Contact Us*/ + $scope.delContactUsFun = function(appObj){ + var confirmMsg = 'Are you sure you want to delete '+appObj.appName +' from the list?' + ' Press OK to delete.'; + confirmBoxService.confirm(confirmMsg).then(function (confirmed) { + if (confirmed == true) { + contactUsService.removeContactUs(appObj.appId).then(res=> { + // $log.info('delContactUsFun: delete ContactUs successfully',res); + $scope.errMsg=''; + $scope.contactUsList.length=0; + $scope.getContactUsList(); + confirmBoxService.showInformation('Item has been deleted').then(isConfirmed => {}); + }).catch(err=> { + $log.error('contactUsService: addContactUs error:: ', err); + confirmBoxService.showInformation('Deletion failed: ' + err); + // $scope.errMsg=err; + }).finally(() => { + //this.isLoadingTable = false; + }); + } + }); + + } + + } + } + ContactUsManageController.$inject = ['$scope','$log', 'message', '$q', '$http', 'conf','contactUsService','confirmBoxService']; + angular.module('ecompApp').controller('ContactUsManageController', ContactUsManageController); + + +})(); +function validateUrl(value){ + return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); + } diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less new file mode 100644 index 00000000..ef8c88df --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.controller.less @@ -0,0 +1,159 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .searchLiHeader { +font-weight: bold; +color: #0574ac; +font-size: 16px; +padding-bottom: 10px; +line-height: 1.5; +font-family: arial; + +} + +.searchLiItems{ +cursor: pointer; +font-weight: normal; +font-size: 12px; +color: #444444; +font-family: arial; +} + +.searchUl { +list-style: none; +border-bottom: 1px solid #bbb; +padding-bottom: 20px; +} + +.manage-contactUs-home-title{ + color: #067ab4; + font-family: arial; + font-size: 24px; + margin-left: 78px; + width: 1170px; + } + +.manage-contactUs-home-manageWidgets-title{ + color: #067ab4; + font-family: arial; + font-size: 24px; + margin-left: 30px; + width: 1170px; + } + +#editWidgetsContent { + height: 300px; + width: 1250px; + } + +#editWidgetsContent .scroll-viewport { + height: 300px; + width: 1250px; + } + + .add-contact-us-field{ + width:250px; + display: inline-block; + margin:10px; + } + .add-contact-us-field-des{ + width:800px; + margin:10px; + } + +.errMsg{ + color:red; +} +.sucessMsg{ + color:green; +} +.contact-us-margin{ + margin-left: 80px; + margin-right: 120px; +} +.contact-us-manage-table { + + + .delete-contact-us{ + font-size:20px; + } + + .portal-add-button { + width: 160px; + } +} + +.select2-container .select2-chosen, .select2-container .select2-container input{ + line-height:39px; +} +.select2-container .select2-choice{ + -webkit-transition: border-color .2s ease-out; + -moz-transition: border-color .2s ease-out; + transition: border-color .2s ease-out; + background: #fff; + border-radius: 6px; + display: block; + border: 1px solid #888; + box-shadow: none; + filter: none; + height: 32px !important; + padding: 0; + position: relative; + z-index: 5; + cursor: pointer; +} + +.c-ecomp-att-abs-table .contactUs{ + + height:300px; + +} + +.ngdialog-overlay { + pointer-events: none !important; +} + +.input-text-area { + font-style: italic; + padding: 7px 10px; + width: 250px; + display: inline-block; + position: relative; + margin-bottom: 10px; + border-radius: 6px; + border: 1px solid #d8d8d8; + height: 32px !important; + border-color: slategrey !important; +} +.input-inline-edit-text { + font-style: italic; + padding: 7px 10px; + display: inline-block; + position: relative; + margin-bottom: 10px; + border-radius: 6px; + border: 1px solid #d8d8d8; + height: 32px; + border-color: slategrey !important; + width:100%; + } +.glyphicon { + position: relative !important; + line-height: 0 !important; +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html new file mode 100644 index 00000000..257226a0 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us-manage/contact-us-manage.html @@ -0,0 +1,136 @@ + +
+ +
+
+ +
+
Manage Contact Us
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
App NameContact NameContact EmailContact URLDescriptionEditDelete
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + Save + +
+
+ +
+
+
+ +
+
+
+

Add Application Contact Information

+ +
+
+
+
+
App Name
+
+
+
+
+
Contact Name
+ +
+
+
Contact Email
+ +
+
+
Contact URL
+ +
+
+
Description
+ +
+
+
+ Add New +
+ +
+ +
+ Close +
+ +
+ +
+ +
+
+
+
+ + \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.js b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.js new file mode 100644 index 00000000..63e38a48 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.js @@ -0,0 +1,166 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +(function () { + + class ContactUsCtrl { + constructor($log, contactUsService, applicationsService, $modal, ngDialog, $state) { + + contactUsService.getContactUSPortalDetails().then(res => { + // $log.info('ContactUsCtrl:: contactUsService getContactUSPortalDetails res',res); + // $log.info('getting res',res); + var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null; + // $log.info('result',result); + // $log.info('done'); + var source = JSON.parse(result); + // $log.info(source); + this.ush_TicketInfoUrl = source.ush_ticket_url; + this.portalInfo_Address = source.feedback_email_address; + this.feedback_Url = source.portal_info_url; + }).catch(err=> { + $log.error('ContactUsCtrl:error:: ', err); + }).finally(() => { + }); + + let init = () => { + // $log.info('ecomp app::contact-us-controller::initializing...'); + this.appTable=[]; + this.functionalTableData=[]; + }; + init(); + + let updateContactUsTable = () => { + contactUsService.getAppsAndContacts().then(res=> { + // $log.info('ContactUsCtrl:: contactUsService getAppsAndContacts res',res); + var tableData=[]; + // $log.info('getting res',res); + var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null; + // $log.info('result',result); + // $log.info('done'); + var source = result; + // $log.info(source); + // Drop Portal app, empty name entries + for(var i=0;i { + $log.error('ContactUsCtrl.updateContactUsTable:error:: ', err); + }) + }; + + contactUsService.getAppCategoryFunctions().then(res=> { + // $log.info('ContactUsCtrl:: contactUsService getAppCategoryFunctionsthen res',res); + var tablefunctionalData=[]; + // $log.info('getting res',res); + var result = (typeof(res.response) != "undefined" && res.response!=null)?res.response:null; + // $log.info('result',result); + // $log.info('done'); + var source = result; + // $log.info(source); + for(var i=0;i { + $log.error('ContactUsCtrl:error:: ', err); + }) + + updateContactUsTable(); + this.editContactUsModalPopup = () => { + // $log.debug('ContactUsCtrl::editContactUsModalPopup updating table data...'); + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/support/contact-us/contact-us-manage/contact-us-manage.html', + controller: 'ContactUsManageController', + resolve: { + message: function message() { + var message = { + type: 'Contact', + }; + return message; + } + } + }).closePromise.then(needUpdate => { + updateContactUsTable(); + }); + }; + + this.goToSection = (id) => { + var targetDiv = document.getElementById(id); + var offSetHeight = 0; + for(var i=0;i d.showFlag = false); + // let index = this.appTable.findIndex(a => a.app_Id == id); + var index =-1; + for(var i=0; i -1) { + // setting the showFlag to true based on index comparing with the app_Id + this.appTable[index].showFlag = true; + $('#contentId').animate({ + scrollTop: targetDiv.offsetTop-offSetHeight + 'px' + }, 'fast'); + } + + }; + + // Take the user to the application on the get access page. + this.goGetAccess = (appName) => { + // $log.debug('ContactUsCtrl::goGetAccess received name ' + appName); + applicationsService.goGetAccessAppName = appName; + $state.go('root.getAccess'); + }; + + } + } + ContactUsCtrl.$inject = ['$log','contactUsService', 'applicationsService', '$modal', 'ngDialog', '$state']; + angular.module('ecompApp').controller('ContactUsCtrl', ContactUsCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.spec.js b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.less b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.less new file mode 100644 index 00000000..b0c0af4f --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.less @@ -0,0 +1,104 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-contactUs-home { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + padding-left: @padding-left-side; + + .contactUs-home-container { + .content_justify; + position: relative; + //padding-top: 15px; + padding-right: 0; + padding-left: 0; + padding-bottom: 32px; + width: 100%; + + .contactUs-home-title { + .a24r; + margin: auto; + .content_justify; + } + + .contactUs-general-div { + margin: auto; + padding-top: 15px; + padding-bottom: 15px; + .content_justify; + } + } + +.collapsibleArrow { + width: 30px; + height: 30px; + margin-left: 10px; + } + +.contactUs-collapsible-panel { + margin: auto; + width: 1170px; + + } + + .contactUs-collapsible-table { + margin: auto; + width: 1170px; + } + + .contactUs-txt { + font-weight: normal; + color: #666666; + font-size: 15px; + font-family: arial; + margin:10px; + } + +.contactUs-panel-header { + font-weight: normal; + color: #666666; + font-size: 18px; + font-family: sans-serif; + border-top: 1px solid #ccc; + outline : none; + height: 35px; + width: 1050px; + } + + .contactUs-panel-header:hover{ + color: #428bca; + background: #eae8e8; + cursor: pointer; cursor: hand; + } + +.contactUs-panel-labels { + font-weight: normal; + color: #666666; + font-size: 15px; + font-family: sans-serif; + padding-top: 5px; + padding-bottom: 5px; +} + +} diff --git a/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.tpl.html b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.tpl.html new file mode 100644 index 00000000..0b403ece --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/contact-us/contact-us.tpl.html @@ -0,0 +1,125 @@ + +
+
+
+
Contact Us + +
+ +
+ To give feedback or report an issue to the OpenECOMP Portal team, send email to {{contact.portalInfo_Address}}. +
+ +
+ +
Application Functions +
+
+ + + + + + + + + + + + + + + + + +
CategoryECOMP FunctionsECOMP Application
+
+
+
+
+
+ {{rowData.app_Name}} +
+
+
+
+
+ +
+
All Applications +
+
+
+ + + + + + +
+ +
+
+ No application information is available. Please use the links above to contact the OpenECOMP Portal team. +
+
+ + + + + + + + + + + + + + + + + + + + + +
Contact:{{rowData.contact_name}}
Email:{{rowData.contact_email}}
Info URL:{{rowData.url_Info}}
Description:{{rowData.desc}}
Get access:Click for application and role information
+
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.js b/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.js new file mode 100644 index 00000000..b9b254ac --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.js @@ -0,0 +1,70 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class GetAccessCtrl { + constructor($log, $stateParams, getAccessService,applicationsService, ngDialog) { + // $log.debug('GetAccessCtrl: appService param is: ' + applicationsService.goGetAccessAppName); + + this.updateAppsList = () => { + getAccessService.getListOfApp().then(res=> { + var tableData=[]; + // $log.info('GetAccessCtrl::updateAppsList: getting res'); + var result = (typeof(res.data) != "undefined" && res.data!=null)?res.data:null; + // $log.info('GetAccessCtrl::updateAppsList: result',result); + // $log.info('GetAccessCtrl::updateAppsList: done'); + var source = result; + // $log.info('GetAccessCtrl::updateAppsList source: ', source); + for(var i=0;i { + $log.error('GetAccessCtrl:error:: ', err); + }).finally(() => { + this.isLoadingTable = false; + }); + }; + let init = () => { + // $log.info('GetAccessCtrl:: initializing...'); + this.searchString = ''; + this.getAccessTableHeaders = ['ECOMP Function', 'Application Name', 'Role Name']; + this.appTable=[]; + this.updateAppsList(); + }; + init(); + } + } + GetAccessCtrl.$inject = ['$log', '$stateParams', 'getAccessService', 'applicationsService', 'ngDialog']; + angular.module('ecompApp').controller('GetAccessCtrl', GetAccessCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.spec.js b/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/get-access/get-access.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/support/get-access/get-access.less b/ecomp-portal-FE/client/app/views/support/get-access/get-access.less new file mode 100644 index 00000000..20b406e9 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/get-access/get-access.less @@ -0,0 +1,67 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-get-access-home { + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + padding-left: @padding-left-side; + + .get-access-home-container { + .content_justify; + position: relative; + padding-right: 0; + padding-left: 0; + padding-bottom: 32px; + width: 100%; + + .get-access-home-title { + .a24r; + margin: auto; + .content_justify; + } + + .get-access-general-div { + margin: auto; + padding-top: 15px; + padding-bottom: 15px; + .content_justify; + } + } + + .get-access-table { + width: @table-width; + margin: @table-margin; + + .table-control { + .table-dropdown-filter { + width: @table-dropdown-filter-width; + display: @table-dropdown-filter-display; + } + } + + .table-body { + cursor: pointer; + } + } +} diff --git a/ecomp-portal-FE/client/app/views/support/get-access/get-access.tpl.html b/ecomp-portal-FE/client/app/views/support/get-access/get-access.tpl.html new file mode 100644 index 00000000..3ed92f14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/support/get-access/get-access.tpl.html @@ -0,0 +1,88 @@ + +
+
+
+
Get Access
+
+ + Request access for following functions by sending email to the Application's Admin. For Admin contact details, please click here. + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + +
{{access.getAccessTableHeaders[0]}}{{access.getAccessTableHeaders[1]}}{{access.getAccessTableHeaders[2]}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ diff --git a/ecomp-portal-FE/client/app/views/tabs/tabframe.html b/ecomp-portal-FE/client/app/views/tabs/tabframe.html new file mode 100644 index 00000000..bc428832 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/tabs/tabframe.html @@ -0,0 +1,22 @@ + + diff --git a/ecomp-portal-FE/client/app/views/tabs/tabs.controller.js b/ecomp-portal-FE/client/app/views/tabs/tabs.controller.js new file mode 100644 index 00000000..0c970f0e --- /dev/null +++ b/ecomp-portal-FE/client/app/views/tabs/tabs.controller.js @@ -0,0 +1,231 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + const HTTP_PROTOCOL_RGX = /https?:\/\//; + class TabsCtrl { + constructor(applicationsService, $log, $window, conf, userProfileService, $scope,$cookies,$rootScope,confirmBoxService) { + + var counter = 1; + var tabLimit = 6; + this.conf = conf; + var cookieDomain = this.conf.cookieDomain; + $scope.tabs = []; + $scope.notificationShow=true; + $rootScope.showFooter = ""; + console.log("****************** get cookie domain from config json file " + this.conf.cookieDomain); + $cookies.putObject('show_app_header', false,{domain: cookieDomain, path : '/'}); + + + let noRefresh = function () { + window.onbeforeunload = function(e) { + + var isQtoHref = false; + try{ + isQtoHref = e.srcElement.activeElement.href.includes("mailto"); + } catch(err) { + + } + + if ($scope.tabs.length > 1 && isQtoHref == false) { + return "Changes you made may not be saved. Are you sure you want to refresh?"; + } else { + return null; + } + } + } + var addTab = function (title, content) { + if($scope.tabs.length==tabLimit){ + confirmBoxService.showInformation('You have reached your maximum limit of tabs allowed.').then(isConfirmed => {}); + } else { + if(title!=='Home' && content.indexOf('https') == -1){ + console.log('App URL: '+content+'. The application URL you are trying to open is not HTTPS. We recommend to use secured HTTPS URL while on-boarding the application.'); + } + + $scope.tabs.push({ title: title, content: content }); + counter++; + $scope.selectedIndex = $scope.tabs.length - 1; + if ($scope.tabs.length > 1) { + noRefresh(); + } + $cookies.putObject('cookieTabs', $scope.tabs,{domain: cookieDomain, path : '/'}); + $cookies.putObject('visInVisCookieTabs', $scope.tabs,{domain: cookieDomain, path : '/'}); + } + }; + + var adjustTitle = function (title) { + var index = 15; + var nonEmptyCharPattern = /(\s|\w)/; + var adjustedTitle = title.substring(0,index); + var ext = title.charAt(index).replace(nonEmptyCharPattern,'...'); + return adjustedTitle.concat(ext); + + + }; + + var removeTab = function (event, index) { + event.preventDefault(); + event.stopPropagation(); + $scope.tabs.splice(index, 1); + $cookies.putObject('cookieTabs', $scope.tabs,{domain: cookieDomain, path : '/'}); + }; + + var selectTab = function (title) { + if(title=='Home') { + $rootScope.ContentModel.IsVisible=true; + $rootScope.showFooter = true; + $rootScope.tabBottom = 75; + } + else { + $rootScope.ContentModel.IsVisible=false; + $rootScope.showFooter = false; + $rootScope.tabBottom = 0; + } + }; + + $scope.addTab = addTab; + $scope.removeTab = removeTab; + $scope.selectTab = selectTab; + $scope.adjustTitle = adjustTitle; + + + $rootScope.ContentModel = { + IsVisible : false, + ViewUrl : null, + }; + + + var sessionActive = applicationsService.ping() + .then(sessionActive => { + $log.debug('TabsCtrl::addTab: applicationsService.ping() = ' + JSON.stringify(sessionActive)); + + var cookieTabs = $cookies.getObject('cookieTabs'); + if(cookieTabs!=null){ + for(var t in cookieTabs){ + console.log('TabsCtrl::addTab: cookieTabs title: '+cookieTabs[t].title); + if(cookieTabs[t].title!=null && cookieTabs[t].title==='Home'){ + cookieTabs[t].content = ""; + $rootScope.ContentModel.IsVisible=true; + } + + addTab( cookieTabs[t].title, cookieTabs[t].content) ; + } + } else { + for (var i = 0; i < 1; i++) { + var content=""; + var title=""; + if(i==0){ + title="Home"; + $rootScope.ContentModel.IsVisible=true; + } + addTab(title, content); + } + } + + $scope.selectedIndex = 0; + }); + + $scope.$watchCollection(function() { return $cookies.getObject('addTab'); }, function(newValue) { + var tabContent = $cookies.getObject('addTab'); + if(tabContent!=null && tabContent.url!=null){ + var tabExists = false; + for(var x in $scope.tabs){ + console.log($scope.tabs[x].content); + if($scope.tabs[x].title==tabContent.title){ + tabExists = true; + $scope.selectedIndex = x; + } + } + if(!tabExists){ + addTab( tabContent.title, tabContent.url) ; + } + $cookies.remove('addTab'); + } + }); + + + } + + + } + + TabsCtrl.$inject = ['applicationsService', '$log', '$window', 'conf','userProfileService', '$scope','$cookies','$rootScope','confirmBoxService']; + angular.module('ecompApp').controller('TabsCtrl', TabsCtrl); + + angular.module('ecompApp').directive('mainArea', function() { + return { + restrict: "E", + templateUrl: 'app/views/tabs/tabframe.html', + link: function(scope, element) { + + } + } + }); + + + + angular.module('ecompApp').directive('tabHighlight', [function () { + return { + restrict: 'A', + link: function (scope, element) { + var x, y, initial_background = '#c3d5e6'; + + element + .removeAttr('style') + .mousemove(function (e) { + if(!element.hasClass('md-active')) + { + x = e.pageX - this.offsetLeft; + y = e.pageY - this.offsetTop; + + element + .css({ background: '-moz-radial-gradient(circle at ' + x + 'px ' + y + 'px, rgba(255,255,255,0.4) 0px, rgba(255,255,255,0.0) 45px), ' + initial_background }) + .css({ background: '-webkit-radial-gradient(circle at ' + x + 'px ' + y + 'px, rgba(255,255,255,0.4) 0px, rgba(255,255,255,0.0) 45px), ' + initial_background }) + .css({ background: 'radial-gradient(circle at ' + x + 'px ' + y + 'px, rgba(255,255,255,0.4) 0px, rgba(255,255,255,0.0) 45px), ' + initial_background }); + } + }) + .mouseout(function () { + element.removeAttr('style'); + }); + } + }; + }]); + + + +})(); + +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, " ")); +} + +function isCascadeFrame(ref) { + if (self != top) { + var e = document.body; + e.parentNode.removeChild(e); + window.location = "unKnownError"; + } +} diff --git a/ecomp-portal-FE/client/app/views/tabs/tabs.controller.spec.js b/ecomp-portal-FE/client/app/views/tabs/tabs.controller.spec.js new file mode 100644 index 00000000..44aea239 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/tabs/tabs.controller.spec.js @@ -0,0 +1,80 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +describe('Controller: TabsCtrl ',() => { + beforeEach(module('ecompApp')); + + beforeEach(inject((_CacheFactory_)=>{ + _CacheFactory_.destroyAll(); + })); + + let TabsCtrl, $controller, $q, $rootScope, $log, $window, $cookies,$scope; + + beforeEach(inject((_$controller_, _$q_, _$rootScope_, _$log_, _$window_, _$cookies_)=>{ + [$controller, $q, $rootScope, $log, $window, $cookies] = [_$controller_, _$q_, _$rootScope_, _$log_, _$window_, _$cookies_]; + })); + + var deferredApps, deferredUserProfile; + beforeEach(()=>{ + deferredApps = $q.defer(); + deferredUserProfile = $q.defer(); + let applicationsServiceMock = jasmine.createSpyObj('applicationsServiceMock', ['getUserApps']); + applicationsServiceMock.getUserApps.and.returnValue(deferredApps.promise); + + let userProfileServiceMock = jasmine.createSpyObj('userProfileServiceMock',['getUserProfile']); + userProfileServiceMock.getUserProfile.and.returnValue(deferredUserProfile.promise); + + $scope = $rootScope.$new(); + TabsCtrl = $controller('TabsCtrl', { + applicationsService: applicationsServiceMock, + $log: $log, + $window: $window, + userProfileService: userProfileServiceMock, + $scope: $scope, + $cookies: $cookies, + $rootScope: $rootScope + }); + }); + + it('should populate this.apps with data from portals service getUserApps', ()=>{ + var profile = {roles:'superAdmin',userId:'userid'}; + deferredUserProfile.resolve(profile); + deferredApps.resolve([{name: 'portal1'},{name: 'portal2'},{name: 'portal3'}]); + $rootScope.$apply(); + expect($scope.appsViewData.length).toBe(3); + }); + + it('should call $log error when getAllPortals fail', ()=>{ + spyOn($log, 'error'); + deferredUserProfile.reject('something happened!'); + $rootScope.$apply(); + expect($log.error).toHaveBeenCalled(); + }); + + it('should open link in a new window when clicking app thumbnail', () => { + spyOn($window, 'open'); + let someUrl = 'http://some/url/'; + TabsCtrl.goToPortal(someUrl); + expect($window.open).toHaveBeenCalledWith(someUrl, '_self'); + }); + + +}); diff --git a/ecomp-portal-FE/client/app/views/tabs/tabs.less b/ecomp-portal-FE/client/app/views/tabs/tabs.less new file mode 100644 index 00000000..0247e3d0 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/tabs/tabs.less @@ -0,0 +1,658 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-tabs { + .bg_s; + + position: fixed; + left: 0; + right: 0; + bottom: @footer-height; + overflow-y: hidden; + top: @header-height; + padding-left: 0; + + .go-button { + .btn-green; + width: 96px; + position: absolute; + border-radius: 0px; + } + + .tabs-container { + .content_justify; + position: relative; + padding: 15px 0 32px 0; + width: 100%; + + .tabs-title { + .a24r; + margin: auto; + .content_justify; + } + .portals-list { + min-height: 70vh; + justify-content: center; + flex-flow: row wrap; + width: 1170px; + + margin: auto; + margin-bottom: 63px; + + .app-gridster-header { + background-color: @u; + } + + .app-gridster-footer { + background-color: @u; + } + + .portals-list-item { + background-color: @u; + border-radius: 2px; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + display: inline-block; + width: 360px; + height: 300px; + background-size: cover; + cursor: pointer; + margin: 15px; + overflow: hidden; + + .portals-item-info { + background-color: @u; + height: 120px; + top: 180px; + position: relative; + box-shadow: 0px -1px 2px 0px rgba(0, 0, 0, 0.1); + padding: 16px; + + .info-title { + .a24r; + margin-bottom: 4px; + + text-overflow: ellipsis; + overflow: hidden; + } + .info-description { + .c16r; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + .info-button { + .btn-green; + width: 96px; + position: absolute; + bottom: 16px; + left: 16px; + } + + &:hover { + opacity: .93; + z-index: 3; + } + } + } + } + } +} + + +.build-number { + .o12i; +} + +@keyframes fadein { + from { + opacity: 0; + } + to { + opacity: 1; + } +} + + + +.tab-container { + background: #8dc8fb; + margin: 0; + padding: 0; + max-height: 40px; +} +.tab-container ul.nav-tabs { + margin: 0; + list-style-type: none; + line-height: 40px; + max-height: 40px; + overflow: hidden; + display: inline-block; + display: -webkit-flex; + display: flex; + padding-right: 20px; + border-bottom: 5px solid #f7f7f7; +} +.tab-container ul.nav-tabs > li { + margin: 5px -14px 0; + -moz-border-radius-topleft: 28px 145px; + -webkit-border-top-left-radius: 28px 145px; + border-top-left-radius: 28px 145px; + -moz-border-radius-topright: 28px 145px; + -webkit-border-top-right-radius: 28px 145px; + border-top-right-radius: 28px 145px; + padding: 0 30px 0 25px; + height: 170px; + background: #c3d5e6; + position: relative; + -moz-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); + width: 200px; + max-width: 200px; + min-width: 20px; + border: 1px solid #aaa; +} +.tab-container ul.nav-tabs > li:first-child { + margin-left: 0; +} +.tab-container ul.nav-tabs > li:last-of-type { + margin-right: 0; +} +.tab-container ul.nav-tabs > li > a { + display: block; + max-width: 100%; + text-decoration: none; + color: #222; + padding: 3px 7px; +} +.tab-container ul.nav-tabs > li > a span { + overflow: hidden; + white-space: nowrap; + display: block; +} +.tab-container ul.nav-tabs > li > a:focus, .tab-container ul.nav-tabs > li > a:hover { + background-color: transparent; + border-color: transparent; +} +.tab-container ul.nav-tabs > li > a .glyphicon-remove { + color: #777; + display: inline-block; + padding: 3px; + font-size: 10px; + position: absolute; + z-index: 10; + top: 7px; + right: -10px; + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; +} +.tab-container ul.nav-tabs > li > a .glyphicon-remove:hover { + background: #d39ea3; + color: white; + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25); + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25); +} +.tab-container ul.nav-tabs > li.active { + z-index: 4; + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2Y3ZjdmNyIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 30, color-stop(0%, #ffffff), color-stop(100%, #f7f7f7)); + background-image: -moz-linear-gradient(#ffffff, #f7f7f7 30px); + background-image: -webkit-linear-gradient(#ffffff, #f7f7f7 30px); + background-image: linear-gradient(#ffffff, #f7f7f7 30px); +} +.tab-container ul.nav-tabs > li.active > a { + background-color: transparent; + border-color: transparent; + border-bottom-color: transparent; +} +.tab-container ul.nav-tabs > li.active > a:focus, .tab-container ul.nav-tabs > li.active > a:hover { + background-color: transparent; + border-color: transparent; + border-bottom-color: transparent; +} +.tab-container ul.nav-tabs .btn { + float: left; + height: 20px; + width: 35px; + min-width: 35px; + max-width: 35px; + margin: 10px 0 0 0; + border-color: #71a0c9; + outline: none; + -moz-transform: skew(30deg); + -ms-transform: skew(30deg); + -webkit-transform: skew(30deg); + transform: skew(30deg); +} +.tab-container ul.nav-tabs .btn.btn-default { + background: #c3d5e6; +} +.tab-container ul.nav-tabs .btn.btn-default:hover { + background: #d2deeb; +} +.tab-container ul.nav-tabs .btn.btn-default:active { + background: #9cb5cc; +} +.tab-container .tab-pane { + padding: 0px 0px; + text-align: center; +} +.tab-container .tab-pane.active { + border-top: 1px solid #ddd; +} + +.tab-container md-content { + background-color: transparent !important; } + .tab-container md-content md-tabs { + border: 1px solid #e1e1e1; } + .tab-container md-content md-tabs md-tab-content { + background: #f6f6f6; } + .tab-container md-content md-tabs md-tabs-canvas { + background: white; } + .tab-container md-content h1:first-child { + margin-top: 0; } +.tab-container md-input-container { + padding-bottom: 0; } +.tab-container .remove-tab { + margin-bottom: 40px; } +.tab-container .demo-tab > div > div { + padding: 25px; + box-sizing: border-box; } +.tab-container .edit-form input { + width: 100%; } +.tab-container md-tabs { + border-bottom: 1px solid rgba(0, 0, 0, 0.12); } +.tab-container md-tab[disabled] { + opacity: 0.5; } +.tab-container label { + text-align: left; } +.tab-container .long > input { + width: 264px; } +.tab-container .md-button.add-tab { + transform: translateY(5px); } + +.md-tab{ + font-size: 13px; + line-height: 30px; + margin: 5px -3px 0; + border-top-left-radius: 88px 205px; + border-top-right-radius: 88px 205px; + padding: 0 30px 0 25px; + height: 40px; + background: #c3d5e6; + position: relative; + box-shadow: 0 4px 6px rgba(0,0,0,.5); + width: 180px; + max-width: 200px; + min-width: 20px; + border: 1px solid #aaa; + text-transform: capitalize; + text-align: left; +} + +md-tabs .md-tab { + color: #222; +} + +md-tabs-canvas { + border-bottom: 5px solid #f7f7f7; + height: 40px; +} +.md-tab.md-active { + z-index: 4; + background-color: #f5f5f5 !important; +} +.md-tab:first-child{ + margin-left: 10px; +} +md-ink-bar{ + z-index: 5 !important; +} + +.glyphicon { + position: fixed; + line-height: 4; +} +.close_button { + font-size: x-small;width: 10px;margin-left: 130px; +} +@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { + .close_button { + font-size: x-small;width: 10px;margin-left: 130px;margin-top: 55px; + } +} + +*, +*:after, +*:before +{ + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + + +.button-default +{ + .transition(@transitionDefault color); + background: transparent; + border: none; + cursor: pointer; + margin: 0; + outline: none; + position: relative; +} + +.show-notifications +{ + position: relative; + + &:hover, + &:focus, + &.active + { + #icon-bell + { + fill: @colorWetAsphalt; + } + } + + #icon-bell + { + fill: @colorAsbestos; + } + + + + &.active ~ .notifications + { + opacity: 1; + top: 35px; + } +} +.notifications_li{ + border-top: 1px solid #bdc3c7; + color: #7f8c8d; + cursor: default; + display: block; + padding: 10px; + position: relative; + white-space: nowrap; + width: 350px; +} +.notifications_li:hover{ + background:#eee; +} +.notifications_detail{ + margin-left: 10px; + white-space: normal; + width: 280px; + display: inline-block; + vertical-align: middle; +} + +.notifications_empty{ + display: none; + text-align: center; +} +.notifications_title{ + display: block; +} + +.notifications_date{ + color: #95a5a6; + font-size: .85em; + margin-top: 3px; +} +.notifications +{ + .border-radius(@borderRadius); + .transition(@transitionDefault opacity); + background: @colorClouds; + border: 1px solid @colorSilver; + left: 10px; + opacity: 0; + + &:after + { + border: 10px solid transparent; + border-bottom-color: @colorPeterRiver; + content: ''; + display: block; + height: 0; + left: 10px; + position: absolute; + top: -20px; + width: 0; + } + + h3, + .show-all + { + background: @colorPeterRiver; + color: @colorWhite; + margin: 0; + padding: 10px; + width: 350px; + } + + h3 + { + cursor: default; + font-size: 1.05em; + font-weight: normal; + } + + .show-all + { + display: block; + text-align: center; + text-decoration: none; + + &:hover, + &:focus + { + text-decoration: underline; + } + } + + .notifications-list + { + list-style: none; + margin: 0; + overflow: hidden; + padding: 0; + + .item + { + .transition-transform(@transitionDefault); + border-top: 1px solid @colorSilver; + color: @colorAsbestos; + cursor: default; + display: block; + padding: 10px; + position: relative; + white-space: nowrap; + width: 350px; + + &:before, + .details, + .button-dismiss + { + display: inline-block; + vertical-align: middle; + } + + &:before + { + .border-radius(50%); + background: @colorPeterRiver; + content: ''; + height: 8px; + width: 8px; + } + + .details + { + margin-left: 10px; + white-space: normal; + width: 280px; + + .title, + .date + { + display: block; + } + + .date + { + color: @colorConcrete; + font-size: .85em; + margin-top: 3px; + } + } + + .button-dismiss + { + color: @colorSilver; + font-size: 2.25em; + + &:hover, + &:focus + { + color: @colorConcrete; + } + } + + &.no-data + { + display: none; + text-align: center; + + &:before + { + display: none; + } + } + + &.expired + { + color: @colorSilver; + + &:before + { + background: @colorSilver; + } + + .details + { + .date + { + color: @colorSilver; + } + } + } + + &.dismissed + { + .transform(translateX(100%)); + } + } + } + + &.empty + { + .notifications-list + { + .no-data + { + display: block; + padding: 10px; + } + } + } +} + +/* variables */ +@colorClouds: #ecf0f1; +@colorSilver: #bdc3c7; +@colorWhite: #fefefe; +@colorPeterRiver: #3498db; +@colorConcrete: #95a5a6; +@colorAsbestos: #7f8c8d; +@colorWetAsphalt: #34495e; + +@borderRadius: 2px; + +@transitionDefault: 0.25s ease-out 0.10s; + +/* mixins */ +.background-clip(@value: border-box) +{ + -moz-background-clip: @value; + -webkit-background-clip: @value; + background-clip: @value; +} + +.border-radius(@value: 5px) +{ + -moz-border-radius: @value; + -webkit-border-radius: @value; + border-radius: @value; + .background-clip(padding-box); +} + +.transform(@value) +{ + -webkit-transform: @value; + -moz-transform: @value; + -ms-transform: @value; + -o-transform: @value; + transform: @value; +} + +.transition(@value: all 0.25s ease-out) +{ + -webkit-transition: @value; + -moz-transition: @value; + -o-transition: @value; + transition: @value; +} + +.transition-transform(@transition: 0.25s ease-out) +{ + -webkit-transition: -webkit-transform @transition; + -moz-transition: -moz-transform @transition; + -o-transition: -o-transform @transition; + transition: transform @transition; +} + +.tab-cross-sign{ + position:relative; + margin-left:130px; + font-size:9px; + top:-30px; + @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { + top:-70px; + } +} diff --git a/ecomp-portal-FE/client/app/views/tabs/tabs.tpl.html b/ecomp-portal-FE/client/app/views/tabs/tabs.tpl.html new file mode 100644 index 00000000..62af73e9 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/tabs/tabs.tpl.html @@ -0,0 +1,46 @@ + +
+
+ + + + + {{adjustTitle(tab.title)}} + + + + + + + + + + +
+
+ +
+
+ +
+
diff --git a/ecomp-portal-FE/client/app/views/userbar/userbar.controller.js b/ecomp-portal-FE/client/app/views/userbar/userbar.controller.js new file mode 100644 index 00000000..5dae2f86 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/userbar/userbar.controller.js @@ -0,0 +1,262 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; + +(function () { + + class UserbarCtrl { + constructor(userProfileService,userbarUpdateService, $log, $rootScope , $interval,$scope,$timeout,dashboardService) { + this.$log = $log; + this.userProfileService = userProfileService; + this.$rootScope = $rootScope; + $rootScope.isAdminPortalAdmin = false; + $scope.updateRate = 10000; //default online user bar refreshing rate + var intervalPromise = null; + $scope.myservice = userbarUpdateService; + $scope.userList=this.userLists; + var websocket = ''; + var currentUser = ''; + var remoteUser = ''; + var f = ''; + + + function socketSetup(initialPageVisit,_currentUser, _remoteUser, _f) { + + + + if( true) { + + var href = window.location.href; + var hostPatt = new RegExp(window.location.host +"/[^/]*"); + var res = hostPatt.exec(href); + var protocol = window.location.protocol.replace("http","ws"); + var signalingServerPath = protocol + "//" + res + "/opencontact"; + var wsUri = signalingServerPath; + console.log("Connecting to " + wsUri); + websocket = new WebSocket(wsUri); + //localStorage.notifySocket = JSON.stringify(websocket); + //window.top.notifySocket = websocket; + + currentUser = _currentUser; + remoteUser = _remoteUser; + f = socketSend; + + + } + + //var websocket = JSON.parse(localStorage.notifySocket || "{}") ; + if( websocket != null) { + websocket.onopen = function(evt) { onOpen(evt); }; + websocket.onmessage = function(evt) { onMessage(evt); }; + websocket.onerror = function(evt) { onError(evt); }; + + } + + //if(f != undefined) + // f(); + + //window.top.notifySocket.send(""); + } + + function socketSend(currentUser, remoteUser) { + + + + websocket.send(JSON.stringify({ + from: currentUser, + to: remoteUser + })); + + //window.top.notifySocket.send(""); + } + + + + + function onOpen(evt) { + console.log("onOpen"); + //writeToScreen("CONNECTED"); + + if(f != undefined) + f(currentUser, remoteUser); + + } + + function onMessage(evt) { + if (typeof evt.data == "string") { + writeToScreen("RECEIVED (text): " + evt.data); + var chatObject = JSON.parse(evt.data); + if(confirm("User " + chatObject.from + " is requesting a chat session with you. Please click ok to accept")== true) { + + var url = userProfileService.getSortedUserIdCombination(chatObject.from, chatObject.to); + var win = window.open(url, '_blank'); + win.focus(); + } else { + // + } + + + } else { + writeToScreen("RECEIVED (binary): " + evt.data); + } + } + + function onError(evt) { + writeToScreen('ERROR: ' + evt.data); + } + + function writeToScreen(message) { + console.log(message); + } + + function callAtInterval() { + userProfileService.getActiveUser() + .then(res=> { + $log.info('sasasasasa getting userinfo from shared context.. '); + if(res==null){ + $log.info('failed getting userinfo from shared context.. '); + $log.info('getting userinfo from session '); + }else{ + $log.info('getting ActiveUser successfully',res); + $scope.userList = []; + for(var i=0;i { + var footerOff = $('#online-userbar').offset().top; + var headOff = $('#footer').offset().top; + var userbarHeight= parseInt($(".online-user-container").css('height'),10); + var defaultOffSet = 45; + $(".online-user-container").css({ + "height" : headOff - footerOff-defaultOffSet + }); + }); + } + + + var intervalPromise; + dashboardService.getOnlineUserUpdateRate().then(res=> { + // $log.info('getting Online User Update Rate init***********************', res); + if (res == null || res.response == null) { + $log.error('UserbarCtlr: failed to get online user update rate!'); + } else { + // $log.debug('UserbarCtlr: got online User Update Rate ' + res.response); + var rate = parseInt(res.response.onlineUserUpdateRate); + // var updateRate = parseInt(res.response.onlineUserUpdateRate); + var duration = parseInt(res.response.onlineUserUpdateDuration); + userbarUpdateService.setMaxRefreshCount(parseInt(duration/rate)+1); + userbarUpdateService.setRefreshCount(userbarUpdateService.maxCount); + // $scope.refreshCount = userbarUpdateService.getRefreshCount(); + + if (rate != NaN && duration != NaN) { + // $log.debug('UserbarCtlr: scheduling function at interval ' + millis); + $scope.updateRate=rate; + $scope.start($scope.updateRate); + } + } + }).catch(err=> { + $log.error('Header Controller:: getOnlineUserUpdateRate() failed: ' + err); + }); + + $scope.start = function(rate) { + // stops any running interval to avoid two intervals running at the same time + $scope.stop(); + // store the interval promise + intervalPromise = $interval(updateActiveUsers, rate); + }; + + $scope.stop = function() { + $interval.cancel(intervalPromise); + }; + + $scope.$watch('myservice.getRefreshCount()', function (newVal,oldVal) { + //$log.info("refresh "+$scope.myservice.refreshCount + " more time(s)"); + if (newVal<=0) { + // $log.info("UserbarCtrl: stopped refreshing online users"); + $scope.stop(); + } else if (newVal== $scope.myservice.maxCount){ + // $log.info("UserbarCtrl: start refreshing online users at every "+($scope.updateRate/1000)+" sec"); + // initial update of activate users + userProfileService.getUserProfile().then(res=> { + if (res == null || res.orgUserId == null) { + $log.error('UserbarCtlr: failed to get profile of the user!'); + } + else { + updateActiveUsers(); + $scope.start($scope.updateRate); + socketSetup(null, res.orgUserId, null, "socketSend"); + } + }); + + + } + }); + function updateActiveUsers() { + userProfileService.getActiveUser() + .then(res=> { + $log.info('getting Active User init***********************'); + // decrement the counter every time updateActiveUser is called; + userbarUpdateService.decrementRefreshCount(); + + if(res==null ||res.status!='OK'){ + $log.error('failed updateActiveUsers res is null.. '); + + }else{ + $log.info('getting ActiveUser successfully',res); + $scope.userList = []; + var maxItems = 10; + var users = res.response; + if (users.length < maxItems) + maxItems = users.length; + for(var i=0;i { + var footerOff = $('#online-userbar').offset().top; + var headOff = $('#footer').offset().top; + var userbarHeight= parseInt($(".online-user-container").css('height'),10); + var defaultOffSet = 45; + $(".online-user-container").css({ + "height" : headOff - footerOff-defaultOffSet + }); + }); + } + } + } + UserbarCtrl.$inject = ['userProfileService', 'userbarUpdateService', '$log', '$rootScope','$interval','$scope','$timeout','dashboardService']; + angular.module('ecompApp').controller('UserbarCtrl', UserbarCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/userbar/userbar.less b/ecomp-portal-FE/client/app/views/userbar/userbar.less new file mode 100644 index 00000000..489185f7 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/userbar/userbar.less @@ -0,0 +1,41 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .w-ecomp-sidebar { + + position: relative; + left: 0; + right: 0; + top: 5px; + padding-left: 0; + + } + + @media screen and (-webkit-min-device-pixel-ratio:0) +{ + .w-ecomp-sidebar { + + position: relative; + left: 0; + right: 0; + top: -5px; + padding-left: 0; + + } +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/userbar/userbar.tpl.html b/ecomp-portal-FE/client/app/views/userbar/userbar.tpl.html new file mode 100644 index 00000000..dab62910 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/userbar/userbar.tpl.html @@ -0,0 +1,20 @@ + + diff --git a/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.js b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.js new file mode 100644 index 00000000..182ffe8f --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.js @@ -0,0 +1,211 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; +(function () { + class NewUserModalCtrl { + constructor($scope, $log, usersService, applicationsService, confirmBoxService) { + let init = () => { + $log.info('NewUserModalCtrl::init'); + this.isSaving = false; + this.anyChanges = false; + this.isGettingAdminApps = false; + if($scope.ngDialogData && $scope.ngDialogData.selectedUser && $scope.ngDialogData.dialogState){ + this.selectedUser = $scope.ngDialogData.selectedUser; + this.dialogState = $scope.ngDialogData.dialogState; + this.isShowBack = false; + if(this.dialogState === 3){ + this.getUserAppsRoles(); + } + }else{ + this.isShowBack = true; + this.selectedUser = null; + this.dialogState = 1; + } + }; + + this.appChanged = (index) => { + let myApp = this.adminApps[index]; + $log.debug('NewUserModalCtrl::appChanged: index: ', index, '; app id: ', myApp.id, 'app name: ',myApp.name); + myApp.isChanged = true; + this.anyChanges = true; + } + + this.deleteApp = (app) => { + let appMessage = this.selectedUser.firstName + ' ' + this.selectedUser.lastName; + confirmBoxService.deleteItem(appMessage).then(isConfirmed => { + if(isConfirmed){ + app.isChanged = true; + this.anyChanges = true; + app.isDeleted = true; + app.appRoles.forEach(function(role){ + role.isApplied = false; + }); + } + }).catch(err => { + $log.error('NewUserModalCtrl::deleteApp error: ',err); + }); + }; + + this.getUserAppsRoles = () => { + if (!this.selectedUser || !this.selectedUser.orgUserId) { + $log.error('NewUserModalCtrl::getUserAppsRoles error: No user is selected'); + this.dialogState = 1; + return; + } + $log.debug('NewUserModalCtrl::getUserAppsRoles: about to call getAdminAppsSimpler'); + this.isGettingAdminApps = true; + applicationsService.getAdminAppsSimpler().then((apps) => { + $log.debug('NewUserModalCtrl::getUserAppsRoles: beginning of then for getAdminAppsSimpler'); + this.isGettingAdminApps = false; + if (!apps || !apps.length) { + $log.error('NewUserModalCtrl::getUserAppsRoles error: no apps found'); + return null; + } + $log.debug('NewUserModalCtrl::getUserAppsRoles: then for getAdminAppsSimpler: step 2'); + $log.debug('NewUserModalCtrl::getUserAppsRoles: admin apps: ', apps); + this.adminApps = apps; + this.dialogState = 3; + this.userAppRoles = {}; + this.numberAppsProcessed = 0; + this.isLoading = true; + apps.forEach(app => { + $log.debug('NewUserModalCtrl::getUserAppsRoles: app: id: ', app.id, 'name: ',app.name); + app.isChanged = false; + app.isLoading = true; + app.isError = false; + app.isDeleted = false; + app.printNoChanges = false; + app.isUpdating = false; + app.isErrorUpdating = false; + app.isDoneUpdating = false; + app.errorMessage = ""; + usersService.getUserAppRoles(app.id, this.selectedUser.orgUserId).then((userAppRolesResult) => { + $log.debug('NewUserModalCtrl::getUserAppsRoles: got a result for app: ',app.id,': ',app.name,': ',userAppRolesResult); + app.appRoles = userAppRolesResult; + app.isLoading = false; + + }).catch(err => { + $log.error(err); + app.isError = true; + app.isLoading = false; + app.errorMessage = err.headers('FEErrorString'); + $log.debug('NewUserModalCtrl::getUserAppsRoles: in new-user.controller: response header: '+err.headers('FEErrorString')); + }).finally(()=>{ + this.numberAppsProcessed++; + if (this.numberAppsProcessed == this.adminApps.length) { + this.isLoading = false; + } + }); + }) + return; + }).catch(err => { + $log.error(err); + }) + + } + + this.getAdminApps = () => { + if (!this.selectedUser || !this.selectedUserorgUserId) { + $log.error('NewUserModalCtrl::getAdminApps: No user is selected'); + this.dialogState = 1; + return; + } + applicationsService.getAdminApps().promise().then(apps => { + if (!apps || !apps.length) { + $log.error('NewUserModalCtrl::getAdminApps: no apps found'); + return null; + } + $log.debug('NewUserModalCtrl::getAdminApps: admin apps: ', apps); + this.adminApps = apps; + this.dialogState = 3; + return; + }).catch(err => { + $log.error('NewUserModalCtrl::getAdminApps: ', err); + }) + + } + + this.updateUserAppsRoles = () => { + $log.debug('NewUserModalCtrl::updateUserAppsRoles: entering updateUserAppsRoles'); + if(!this.selectedUser || !this.selectedUser.orgUserId || !this.adminApps){ + $log.debug('NewUserModalCtrl::updateUserAppsRoles: returning early'); + return; + } + this.isSaving = true; + $log.debug('NewUserModalCtrl::updateUserAppsRoles: going to update user: ' + this.selectedUser.orgUserId); + this.numberAppsProcessed = 0; + this.numberAppsSucceeded = 0; + this.adminApps.forEach(app => { + if (app.isChanged) { + $log.debug('NewUserModalCtrl::updateUserAppsRoles: app roles have changed; going to update: id: ', app.id, '; name: ', app.name); + app.isUpdating = true; + usersService.updateUserAppRoles({orgUserId: this.selectedUser.orgUserId, appId: app.id, appRoles: app.appRoles}) + .then(res => { + $log.debug('NewUserModalCtrl::updateUserAppsRoles: User app roles updated successfully on app: ',app.id); + app.isUpdating = false; + app.isDoneUpdating = true; + this.numberAppsSucceeded++; + }).catch(err => { + $log.error(err); + app.isErrorUpdating = true; + }).finally(()=>{ + this.numberAppsProcessed++; + if (this.numberAppsProcessed == this.adminApps.length) { + this.isSaving = false; + } + if (this.numberAppsSucceeded == this.adminApps.length) { + $scope.closeThisDialog(true); + } + }) + } else { + $log.debug('NewUserModalCtrl::updateUserAppsRoles: app roles have NOT changed; NOT going to update: id: ', app.id, '; name: ', app.name); + app.noChanges = true; + app.isError = false; + this.numberAppsProcessed++; + this.numberAppsSucceeded++; + if (this.numberAppsProcessed == this.adminApps.length) { + this.isSaving = false; + } + if (this.numberAppsSucceeded == this.adminApps.length) { + $scope.closeThisDialog(true); + } + } + }); + }; + + this.navigateBack = () => { + if (this.dialogState === 1) { + } + if (this.dialogState === 3) { + this.dialogState = 1; + } + }; + + init(); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + NewUserModalCtrl.$inject = ['$scope', '$log', 'usersService', 'applicationsService', 'confirmBoxService']; + angular.module('ecompApp').controller('NewUserModalCtrl', NewUserModalCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.spec.js b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.spec.js new file mode 100644 index 00000000..54c564b7 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.controller.spec.js @@ -0,0 +1,222 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; + +describe('Controller: NewUserModalCtrl ', () => { + beforeEach(module('testUtils')); + beforeEach(module('ecompApp')); + + let promisesTestUtils; + beforeEach(inject((_CacheFactory_, _promisesTestUtils_)=> { + _CacheFactory_.destroyAll(); + promisesTestUtils = _promisesTestUtils_; + })); + + let newUser, $controller, $q, $rootScope, $log, $scope; + + let applicationsServiceMock, usersServiceMock, confirmBoxServiceMock; + let deferredAdminApps, deferredUsersAccounts, deferredUsersAppRoles, deferredUsersAppRoleUpdate; + + beforeEach(inject((_$controller_, _$q_, _$rootScope_, _$log_)=> { + $rootScope = _$rootScope_; + $q = _$q_; + $controller = _$controller_; + $log = _$log_; + })); + + beforeEach(()=> { + [deferredAdminApps, deferredUsersAccounts, deferredUsersAppRoles, deferredUsersAppRoleUpdate] = [$q.defer(),$q.defer(), $q.defer(), $q.defer()]; + + /*applicationsServiceMock = { + getAdminApps: () => { + var promise = () => {return deferredAdminApps.promise}; + var cancel = jasmine.createSpy(); + return { + promise: promise, + cancel: cancel + } + } + };*/ + + confirmBoxServiceMock = { + deleteItem: () => { + var promise = () => {return deferredAdminApps.promise}; + var cancel = jasmine.createSpy(); + return { + promise: promise, + cancel: cancel + } + } + }; + + applicationsServiceMock = jasmine.createSpyObj('applicationsServiceMock', ['getAdminAppsSimpler']); + applicationsServiceMock.getAdminAppsSimpler.and.returnValue(deferredAdminApps.promise); + + usersServiceMock = jasmine.createSpyObj('usersServiceMock', ['getAccountUsers','getUserAppRoles','updateUserAppsRoles']); + + usersServiceMock.getAccountUsers.and.returnValue(deferredUsersAccounts.promise); + usersServiceMock.getUserAppRoles.and.returnValue(deferredUsersAppRoles.promise); + usersServiceMock.updateUserAppsRoles.and.returnValue(deferredUsersAppRoleUpdate.promise); + + $scope = $rootScope.$new(); + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + }); + + it('should open modal window without user when no user is selected', ()=> { + expect(newUser.selectedUser).toBe(null); + }); + + it('should open modal window with selectedUser apps roles when user is selected', ()=> { + let roles = {apps: [{id: 1, appRoles: [{id: 3, isApplied: true}]}]}; + let someUser = {userId: 'asdfjl'}; + + deferredUsersAppRoles.resolve(roles); + deferredAdminApps.resolve(roles.apps); + + $scope.ngDialogData = { + selectedUser: someUser, + dialogState: 2 + }; + + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + + newUser.getUserAppsRoles(); + $scope.$apply(); + + expect(newUser.selectedUser).toBe(someUser); + expect(newUser.adminApps).toEqual(roles.apps); + }); + + it('should push to apps order list only apps that has applied roles when initializing', () => { + let roles = {apps: [{appId: 13, appRoles: [{id: 3, isApplied: true}]},{appId: 20, appRoles: [{id: 3, isApplied: false}]}]}; + let someUser = {userId: 'asdfjl'}; + + deferredUsersAppRoles.resolve(roles); + + $scope.ngDialogData = { + selectedUser: someUser, + dialogState: 2 + }; + + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + + $scope.$apply(); + + }); + + it('should push app to apps order list when applying at least one role to user from app', () => { + let roles = {apps: [{appId: 13, appRoles: [{id: 3, isApplied: true}]},{appId: 20, appRoles: [{id: 3, isApplied: false}]}]}; + let someUser = {userId: 'asdfjl'}; + + deferredUsersAppRoles.resolve(roles); + + $scope.ngDialogData = { + selectedUser: someUser, + dialogState: 2 + }; + + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + + $scope.$apply(); + + }); + + + it('should remove app from list when removing all user roles in it', () => { + let roles = {apps: [{appName: 'aaa', appId: 13, appRoles: [{id: 3, isApplied: true}]},{appName: 'vvv', appId: 20, appRoles: [{id: 3, isApplied: true}]}]}; + let someUser = {userId: 'asdfjl'}; + + promisesTestUtils.resolvePromise(confirmBoxServiceMock, 'deleteItem', true); + + deferredUsersAppRoles.resolve(roles); + + $scope.ngDialogData = { + selectedUser: someUser, + dialogState: 2 + }; + + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + + $scope.$apply(); + newUser.deleteApp(roles.apps[0]); + $scope.$apply(); + + }); + + it('should close the modal when update changes succeeded', () => { + let roles = {apps: [{appName: 'aaa', appId: 13, appRoles: [{id: 3, isApplied: true}]},{appName: 'vvv', appId: 20, appRoles: [{id: 3, isApplied: true}]}]}; + let someUser = {userId: 'asdfjl'}; + deferredUsersAppRoles.resolve(roles); + deferredUsersAppRoleUpdate.resolve(); + deferredAdminApps.resolve(roles.apps); + + $scope.ngDialogData = { + selectedUser: someUser, + dialogState: 2 + }; + + newUser = $controller('NewUserModalCtrl', { + $scope: $scope, + $log: $log, + usersService: usersServiceMock, + applicationsService: applicationsServiceMock, + confirmBoxService: confirmBoxServiceMock + }); + $scope.closeThisDialog = function(){}; + spyOn($scope, 'closeThisDialog'); + + newUser.getUserAppsRoles(); + $scope.$apply(); + newUser.updateUserAppsRoles(); + $scope.$apply(); + expect($scope.closeThisDialog).toHaveBeenCalledWith(true); + }); + }); diff --git a/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.html b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.html new file mode 100644 index 00000000..e50c9d4a --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.html @@ -0,0 +1,70 @@ + +
+
+ +
+
Next +
+
Cancel
+
+
+
+
+
+
+ Access and roles: +
+
+
+
{{app.name | elipsis: 27}}
+
+ +
+
{{app.errorMessage}}
+
Contacting application...
+
No changes
+
Updating application...
+
Finished updating application
+
Could not update application...
+ +
+
+
+
+ +
Back
+
Save +
+
Cancel
+
+
+
+
diff --git a/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.less b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.less new file mode 100644 index 00000000..9f86b022 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/new-user-dialogs/new-user.modal.less @@ -0,0 +1,126 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .new-user-modal { + display:block; + overflow:auto; + min-height: 450px; + + .user-apps-roles{ + .title{ + .n18r; + border-bottom: @a 3px solid; + } + + .app-roles-list{ + height: 286px; + overflow-y: auto; + + .app-item{ + border: 1px solid #d8d8d8; + border-radius: 2px; + background-color: #f8f8f8; + + padding: 10px; + margin-top: 8px; + + .app-item-left{ + padding-top: 0; + line-height: 30px; + height: 30px; + vertical-align: middle; + display:inline-block; + width: 45%; + border-radius: 2px; + border: 1px solid #d8d8d8; + margin-right: 10px; + padding-left: 4px; + background: #fff; + white-space: nowrap; + + } + .app-item-right{ + display:inline-block; + width: 45%; + border-radius: 2px; + border: 1px solid #d8d8d8; + background: #fff; + vertical-align: middle; + } + + .app-item-right-error{ + .k; + padding: 7px 7px 7px 7px; + display:inline-block; + width: 45%; + border-radius: 2px; + border: 1px solid #d8d8d8; + background: #fff; + vertical-align: middle; + } + + .app-item-right-contacting{ + .e; + padding: 7px 7px 7px 7px; + display:inline-block; + width: 45%; + border-radius: 2px; + border: 1px solid #d8d8d8; + background: #fff; + 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 #d8d8d8; + margin-right: 10px; + padding-left: 4px; + background: #fff; + 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/client/app/views/users/users.controller.js b/ecomp-portal-FE/client/app/views/users/users.controller.js new file mode 100644 index 00000000..433b24e4 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/users.controller.js @@ -0,0 +1,187 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class UsersCtrl { + constructor($log, applicationsService, usersService, $scope, ngDialog,$timeout) { + this.$log = $log; + $scope.adminAppsIsNull = false; + $scope.appsIsDown = false; + + $log.info('UsersCtrl:: initializing...'); + let activeRequests = []; + let clearReq = (req) => { + activeRequests.splice(activeRequests.indexOf(req), 1); + }; + + let getAdminApps = () => { + $log.debug('UsersCtrl::getAdminApps: - Starting getAdminApps'); + try { + this.isLoadingTable = true; + var adminAppsReq = applicationsService.getAdminApps(); + + activeRequests.push(adminAppsReq); + adminAppsReq.promise().then(apps => { + $log.debug('UsersCtrl::getAdminApps: Apps for this user are: ' + JSON.stringify(apps)); + $log.debug('UsersCtrl::getAdminApps: Apps length: ' + apps.length); + var res1 = apps.sort(getSortOrder("name")); + if (!res1 || !res1.length) { + $log.error('UsersCtrl::getAdminApps: - no apps found'); + return null; + } + for (let i = 0; i < apps.length; i++) { + res1[i].index = i; + res1[i].value = apps[i].name; + res1[i].title = apps[i].name; + } + + this.adminApps = apps; + this.selectedApp = apps[0]; + clearReq(adminAppsReq); + $scope.adminAppsIsNull = false; + }).catch(e => { + $scope.adminAppsIsNull = true; + $log.error('UsersCtrl::getAdminApps: - getAdminApps() failed = '+ e.message); + clearReq(adminAppsReq); + }).finally(() => { + this.isLoadingTable = false; + }); + } catch (e) { + $scope.adminAppsIsNull = true; + $log.error('UsersCtrl::getAdminApps: - getAdminApps() failed!'); + this.isLoadingTable = false; + } + }; + + let getSortOrder = (prop) => { + return function(a, b) { + if (a[prop] > b[prop]) { + return 1; + } else if (a[prop] < b[prop]) { + return -1; + } + return 0; + } + } + + this.updateUsersList = () => { + $scope.appsIsDown = false; + $log.debug('UsersCtrl::updateUsersList: Starting updateUsersList'); + this.searchString = ''; + this.isAppSelectDisabled = true; + this.isLoadingTable = true; + usersService.getAccountUsers(this.selectedApp.id) + .then(accountUsers => { + $log.debug('UsersCtrl::updateUsersList length: '+ Object.keys(accountUsers).length); + this.isAppSelectDisabled = false; + this.accountUsers = accountUsers; + }).catch(err => { + this.isAppSelectDisabled = false; + $log.error('UsersCtrl::updateUsersList: ' + err); + $scope.appsIsDown = true; + }).finally(() => { + this.isLoadingTable = false; + }); + }; + + + let init = () => { + this.isLoadingTable = false; + this.selectedApp = null; + this.isAppSelectDisabled = false; + getAdminApps(); + + this.searchString = ''; + this.usersTableHeaders = ['First Name', 'Last Name', 'User ID', 'Roles']; + this.accountUsers = []; + }; + + this.openAddNewUserModal = (user) => { + let data = null; + if (user) { + data = { + dialogState: 3, + selectedUser: { + orgUserId: user.orgUserId, + firstName: user.firstName, + lastName: user.lastName + } + } + } + ngDialog.open({ + templateUrl: 'app/views/users/new-user-dialogs/new-user.modal.html', + controller: 'NewUserModalCtrl', + controllerAs: 'newUser', + data: data + }).closePromise.then(needUpdate => { + if (needUpdate.value === true) { + $log.debug('UsersCtrl::openAddNewUserModal updating table data...'); + this.updateUsersList(); + } + }); + }; + + this.openEditUserModal = (loginId) => { + var data = { + loginId : loginId, + updateRemoteApp : true, + appId : this.selectedApp!=null?this.selectedApp.id:'' + } + var modalInstance = ngDialog.open({ + templateUrl: 'app/views/header/user-edit/edit-user.tpl.html', + controller: 'editUserController', + data: data, + resolve: { + message: function message() { + var message = { + type: 'Contact', + }; + return message; + } + } + }).closePromise.then(needUpdate => { + //update selected app's database for this user. + console.log("'''''''''''''''''' now updating user list after update remote server"); + $timeout(this.updateUsersList, 1500); + }); + } + + + $scope.$watch('users.selectedApp', (newVal, oldVal) => { + if (!newVal || _.isEqual(newVal, oldVal)) { + return; + } + $log.debug('UsersCtrl::openAddNewUserModal:$watch selectedApp -> Fire with: ', newVal); + this.accountUsers = []; + this.updateUsersList(); + }); + + $scope.$on('$destroy', () => { + activeRequests.forEach(req => { + req.cancel(); + }); + }); + + init(); + } + } + UsersCtrl.$inject = ['$log', 'applicationsService', 'usersService', '$scope', 'ngDialog','$timeout']; + angular.module('ecompApp').controller('UsersCtrl', UsersCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/users/users.controller.spec.js b/ecomp-portal-FE/client/app/views/users/users.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/users.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/users/users.less b/ecomp-portal-FE/client/app/views/users/users.less new file mode 100644 index 00000000..ff2d815f --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/users.less @@ -0,0 +1,59 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .users-page-main{ + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .users-table { + width: @table-width; + margin: @table-margin; + + } + + .error-text { + width: 1170px; + margin: auto; + padding: 20px; + left: 20px; + font-weight: bold; + font-size: 16px; + text-align: left; + color: @err; + background-color: @u; + + .error-help { + color: @o; + font-weight: normal; + } + + .error-help-bold { + color: @o; + font-weight: bold; + } + + } +} diff --git a/ecomp-portal-FE/client/app/views/users/users.tpl.html b/ecomp-portal-FE/client/app/views/users/users.tpl.html new file mode 100644 index 00000000..88a3b62d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/users/users.tpl.html @@ -0,0 +1,105 @@ + +
+
+
+
Users
+
+ + +
+
+
+
+ + +
Add User
+
+
+
+

Attention:

+

 

+

Select "Add User" in order to add User and Roles to the '{{users.selectedApp.name}}' Application.

+
+
+ +
+ + + + + + + + + + + + + + + + + +
{{users.usersTableHeaders[0]}}{{users.usersTableHeaders[1]}}{{users.usersTableHeaders[2]}}{{users.usersTableHeaders[3]}}
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

Attention:

+

 

+

It appears that you have not been added as an admin yet to an application.

+

 

+

Click on the Admins link to the left and check and see if you are listed as an admin for an application. + If not, you can add yourself to the appropriate application.

+
+
+
+ +
diff --git a/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.js b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.js new file mode 100644 index 00000000..f50e4683 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.js @@ -0,0 +1,202 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + +'use strict'; +(function () { + class WidgetDetailsModalCtrl { + constructor($scope, $log, applicationsService, widgetsService, errorMessageByCode, ECOMP_URL_REGEX, $window,userProfileService,$cookies) { + + let newWidgetModel = { + name: null, + appId: null, + appName: null, + width: 360, + height: 300, + url: null + }; + + let getAvailableApps = () => { + applicationsService.getAppsForSuperAdminAndAccountAdmin().then(apps => { + this.availableApps=[]; + for(var i=0;i { + $log.error(err); + }); + }; + /**/ + + let init = () => { + $log.info('AppDetailsModalCtrl::init'); + this.isSaving = false; + if ($scope.ngDialogData && $scope.ngDialogData.widget) { + $log.debug('WidgetDetailsModalCtrl::getAvailableApps: Edit widget mode for', $scope.ngDialogData.widget); + this.isEditMode = true; + this.widget = _.clone($scope.ngDialogData.widget); + } else { + $log.debug('WidgetDetailsModalCtrl::init: New app mode'); + this.isEditMode = false; + this.widget = _.clone(newWidgetModel); + } + getAvailableApps(); + }; + + this.ECOMP_URL_REGEX = ECOMP_URL_REGEX; + + this.conflictMessages = {}; + this.scrollApi = {}; + let handleConflictErrors = err => { + if(!err.data){ + return; + } + if(!err.data.length){ + err.data = [err.data] + } + _.forEach(err.data, item => { + _.forEach(item.fields, field => { + this.conflictMessages[field.name] = errorMessageByCode[item.errorCode]; + $scope.widgetForm[field.name].$setValidity('conflict', false); + watchOnce[field.name](); + }); + }); + this.scrollApi.scrollTop(); + }; + + let resetConflict = fieldName => { + delete this.conflictMessages[fieldName]; + if($scope.widgetForm[fieldName]){ + $scope.widgetForm[fieldName].$setValidity('conflict', true); + } + }; + + let watchOnce = { + name: () => { + let unregisterName = $scope.$watchGroup(['widgetDetails.selectedApp','widgetDetails.widget.name'], (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()){ + resetConflict('name'); + unregisterName(); + } + }); + }, + url: () => { + let unregisterUrl = $scope.$watch('widgetDetails.widget.url', (newVal, oldVal) => { + if(newVal.toLowerCase() !== oldVal.toLowerCase()) { + resetConflict('url'); + unregisterUrl(); + } + }); + } + }; + + this.updateSelectedApp = () => { + if (!this.selectedApp) { + return; + } + this.widget.appId = this.selectedApp.id; + this.widget.appName = this.selectedApp.name; + }; + + let emptyCookies = () => { + userProfileService.getUserProfile() + .then(profile=> { + $log.info('AppDetailsModalCtrl::emptyCookies profile: ', profile); + $scope.userId = profile.orgUserId; + $log.info('user has the following userId: ' + profile.userId); + if ($cookies.getObject($scope.userId + '_widget') != undefined && $cookies.getObject($scope.userId + '_widget') != null) { + $cookies.remove($scope.userId + '_widget'); + } + }); + }; + + this.saveChanges = () => { + if($scope.widgetForm.$invalid){ + return; + } + this.isSaving = true; + if(this.isEditMode){ + widgetsService.updateWidget(this.widget.id, this.widget) + .then(() => { + $log.debug('WidgetDetailsModalCtrl::saveChanges: Widget update succeeded!'); + $scope.closeThisDialog(true); + emptyCookies(); + }).catch(err => { + if(err.status === 409){ + handleConflictErrors(err); + } + $log.error(err); + }).finally(()=>{ + this.isSaving = false; + var objOffsetVersion = objAgent.indexOf("MSIE"); + if (objOffsetVersion != -1) { + $log.debug('WidgetDetailsModalCtrl::saveChanges: Browser is IE, forcing Refresh'); + $window.location.reload(); + } + }); + }else{ + widgetsService.createWidget(this.widget) + .then(() => { + $log.debug('WidgetDetailsModalCtrl::createWidget: Widget creation succeeded!'); + $scope.closeThisDialog(true); + emptyCookies(); + }).catch(err => { + if(err.status === 409){ + handleConflictErrors('WidgetDetailsModalCtrl::createWidget error: ',err); + } + $log.error('WidgetDetailsModalCtrl::createWidget error: ',err); + }).finally(()=>{ + this.isSaving = false; + var objOffsetVersion = objAgent.indexOf("MSIE"); + if (objOffsetVersion != -1) { + $log.debug('WidgetDetailsModalCtrl::createWidget: Browser is IE, forcing Refresh'); + $window.location.reload(); + } + }); + } + }; + + init(); + + $scope.$on('$stateChangeStart', e => { + e.preventDefault(); + }); + } + } + WidgetDetailsModalCtrl.$inject = ['$scope', '$log', 'applicationsService', 'widgetsService', 'errorMessageByCode', 'ECOMP_URL_REGEX', '$window','userProfileService','$cookies']; + angular.module('ecompApp').controller('WidgetDetailsModalCtrl', WidgetDetailsModalCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.spec.js b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.html b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.html new file mode 100644 index 00000000..87be6f15 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.html @@ -0,0 +1,132 @@ + +
+
Widget Details
+
+
+ +
+
Application Name
+
+ +
+
+
+ Application is required +
+
+
+
+
Widget Name
+ +
+ +
+
+
+ Widget Name is required + Widget Name must be letters, numbers, or underscore +
+
+
+
+
+
Width
+ +
+
+ Widget width is required + Minimum width is 300 +
+
+
+
+
Height
+ +
+
+ Widget height is required + Minimum height is 200 +
+
+
+
+
+
URL
+ +
+ +
+
+
+ Widget URL is required + Incorrect URL pattern +
+
+ +
+
+
+
+ +
Save
+
Cancel
+
+
diff --git a/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.less b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.less new file mode 100644 index 00000000..6e031b1d --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widget-details-dialog/widget-details.modal.less @@ -0,0 +1,94 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .widget-details-modal { + height: 430px; + + .title { + .n18r; + border-bottom: @a 3px solid; + + } + + .widget-properties-main { + padding: 16px; + height: 306px; + overflow-y: auto; + + .item{ + position: relative; + margin-bottom: 18px; + + .input-field{ + .custom-input-field; + width: 100%; + &.url{ + width: 78%; + display: inline-block; + } + } + + .select-field { + .custom-select-field; + } + + .item-label{ + .o14r; + } + + .right-item{ + position: relative; + display: inline-block; + width: 48%; + float: right; + } + .left-item{ + display: inline-block; + width: 48%; + } + + .url-validation-button{ + .btn-blue; + width: 20%; + display: inline-block; + float: right; + } + + .error-container{ + position: absolute; + width: 280px; + display: block; + height: 12px; + line-height: 12px; + + .err-message{ + color: red; + font-size: 9px; + } + .valid-message{ + color: green; + font-size: 9px; + } + } + + } + + } + +} diff --git a/ecomp-portal-FE/client/app/views/widgets/widgets.controller.js b/ecomp-portal-FE/client/app/views/widgets/widgets.controller.js new file mode 100644 index 00000000..c24f49cd --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widgets.controller.js @@ -0,0 +1,151 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ +'use strict'; +(function () { + class WidgetsCtrl { + constructor($log, applicationsService, widgetsService, ngDialog, confirmBoxService, + userProfileService, $cookies, $scope) { + $log.info('WidgetsCtrl::init: Starting Up'); + $scope.infoMessage = true; + + let populateAvailableApps = widgets => { + let allPortalsFilterObject = {index: 0, title: 'All applications', value: ''}; + this.availableApps = [allPortalsFilterObject]; + this.filterByApp = this.availableApps[0]; + applicationsService.getAppsForSuperAdminAndAccountAdmin().then(myApps => { + var reSortedApp = myApps.sort(getSortOrder("name")); + var realAppIndex = 1; + for (let i = 1; i <= reSortedApp.length; i++) { + if (!reSortedApp[i-1].restrictedApp) { + $log.debug('WidgetsCtrl::populateAvailableApps: pushing {index: ', realAppIndex, 'title: ', reSortedApp[i - 1].name, + 'value: ', reSortedApp[i - 1].name, '}'); + this.availableApps.push({ + index: realAppIndex, + title: reSortedApp[i - 1].name, + value: reSortedApp[i - 1].name + }) + realAppIndex = realAppIndex + 1; + } + } + }).catch(err => { + $log.error(err); + }); + }; + + let getOnboardingWidgets = () => { + this.isLoadingTable = true; + widgetsService.getManagedWidgets().then(res => { + var reSortedWidget = res.sort(getSortOrder("name")); + this.widgetsList = reSortedWidget; + populateAvailableApps(reSortedWidget); + }).catch(err => { + $log.error('WidgetsCtrl::getOnboardingWidgets error: ' + err); + }).finally(()=> { + this.isLoadingTable = false; + }); + }; + + let getSortOrder = (prop) => { + return function(a, b) { + if (a[prop].toLowerCase() > b[prop].toLowerCase()) { + return 1; + } else if (a[prop].toLowerCase() < b[prop].toLowerCase()) { + return -1; + } + return 0; + } + } + + $scope.hideMe = function () { + $scope.infoMessage = false; + } + + let init = () => { + this.isLoadingTable = false; + getOnboardingWidgets(); + + + this.searchString = ''; + + this.widgetsTableHeaders = [ + {name: 'Widget Name', value: 'name', isSortable: false}, + {name: 'Application', value: 'appName', isSortable: true}, + {name: 'Width', value: 'width', isSortable: false}, + {name: 'Height', value: 'height', isSortable: false} + ]; + this.widgetsList = []; + }; + + this.filterByDropdownValue = item => { + if(this.filterByApp.value === ''){ + return true; + } + return item.appName === this.filterByApp.value; + }; + + this.openWidgetDetailsModal = (selectedWidget) => { + let data = null; + if(selectedWidget){ + if(!selectedWidget.id){ + $log.error('Widget id not found'); + return; + } + data = { + widget: selectedWidget + } + } + ngDialog.open({ + templateUrl: 'app/views/widgets/widget-details-dialog/widget-details.modal.html', + controller: 'WidgetDetailsModalCtrl', + controllerAs: 'widgetDetails', + data: data + }).closePromise.then(needUpdate => { + if(needUpdate.value === true){ + $log.debug('WidgetsCtrl::openWidgetDetailsModal: updating table data...'); + getOnboardingWidgets(); + } + }); + }; + + this.deleteWidget = widget => { + confirmBoxService.deleteItem(widget.name).then(isConfirmed => { + if(isConfirmed){ + if(!widget || !widget.id){ + $log.error('WidgetsCtrl::deleteWidget: No widget or ID... cannot delete'); + return; + } + widgetsService.deleteWidget(widget.id).then(() => { + this.widgetsList.splice(this.widgetsList.indexOf(widget), 1); + }).catch(err => { + $log.error('WidgetsCtrl::deleteWidget error:',err); + }); + } + }).catch(err => { + $log.error('WidgetsCtrl::deleteWidget error:',err); + }); + }; + + init(); + } + } + WidgetsCtrl.$inject = ['$log', 'applicationsService', 'widgetsService', 'ngDialog', 'confirmBoxService', + 'userProfileService','$cookies', '$scope']; + angular.module('ecompApp').controller('WidgetsCtrl', WidgetsCtrl); +})(); diff --git a/ecomp-portal-FE/client/app/views/widgets/widgets.controller.spec.js b/ecomp-portal-FE/client/app/views/widgets/widgets.controller.spec.js new file mode 100644 index 00000000..34042c14 --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widgets.controller.spec.js @@ -0,0 +1,19 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ diff --git a/ecomp-portal-FE/client/app/views/widgets/widgets.less b/ecomp-portal-FE/client/app/views/widgets/widgets.less new file mode 100644 index 00000000..4b83b66f --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widgets.less @@ -0,0 +1,60 @@ +/*- + * ================================================================================ + * eCOMP Portal + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ================================================================================ + */ + .widgets-page-main{ + .bg_w; + position: @page-main-position; + top: @page-main-top; + left: @page-main-left; + right: @page-main-right; + bottom: @page-main-bottom; + padding-top: @padding-top; + overflow-y: @page-main-overflow-y; + padding-left: @padding-left-side; + + .widgets-table{ + width: @table-width; + margin: @table-margin; + + .table-control{ + + } + + .delete-widget{ + .ico_trash_default; + } + } + .error-text { + width: 1170px; + margin: auto; + padding: 20px; + left: 20px; + font-weight: bold; + font-size: 16px; + text-align: left; + color: @err; + background-color: @u; + + .error-help { + color: @o; + font-weight: normal; + } + } + +} \ No newline at end of file diff --git a/ecomp-portal-FE/client/app/views/widgets/widgets.tpl.html b/ecomp-portal-FE/client/app/views/widgets/widgets.tpl.html new file mode 100644 index 00000000..d255174f --- /dev/null +++ b/ecomp-portal-FE/client/app/views/widgets/widgets.tpl.html @@ -0,0 +1,77 @@ + +
+
+
+
Widget Onboarding
+
+
+
+
+
+ + +
Add Widget
+
+
+ Only widgets for active applications are displayed. + +
+ + +
+ + + + + + + + + + + + + + + +
{{header.name}}URLDelete
+
+
+
+
+
+
+
+
+
+
+
-- cgit 1.2.3-korg