diff options
author | st782s <statta@research.att.com> | 2017-05-04 07:48:42 -0400 |
---|---|---|
committer | st782s <statta@research.att.com> | 2017-05-04 12:28:17 -0400 |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE/client/app/views/home | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/app/views/home')
8 files changed, 0 insertions, 1089 deletions
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 deleted file mode 100644 index 2071f4cc..00000000 --- a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.js +++ /dev/null @@ -1,244 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index e3782ab2..00000000 --- a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.controller.spec.js +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index d91acc17..00000000 --- a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.less +++ /dev/null @@ -1,164 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 645807f6..00000000 --- a/ecomp-portal-FE/client/app/views/home/applications-home/applications-home.tpl.html +++ /dev/null @@ -1,59 +0,0 @@ -<!-- - ================================================================================ - 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. - ================================================================================ - --> -<div class="w-ecomp-applications-home" ng-style="{bottom: tabBottom}"> - <div class="applications-home-container"> - <div id="app-home-title" class="applications-home-title" >Applications</div> - <div align="center" id="errorInfo" style="display:none;font-size:12px;margin-left:5px"> - <span style="color:red">You don't have user account in that application.Please ask system administrator </span></div> - <div class="portals-list"> - <div class="gridster-container override_background"> - <span class="ecomp-spinner" ng-show="applicationsHome.isLoading" ></span> - <div att-gridster att-gridster-options="applicationsHome.gridsterOpts" > - <div att-gridster-item='item' ng-repeat="item in appsViewData" id="app-{{item.headerText.split(' ').join('-')}}" > - <div id="grips-{{item.headerText.split(' ').join('-')}}" ng-hide="users.isLoadingTable && !users.getUserAppsIsDone" - att-gridster-item-header grips-img-path="assets/images/grips.png" - header-text="{{item.headerText | elipsis: 33}}" sub-header-text="{{item.subHeaderText | elipsis: 56}}" class="app-gridster-header"> - </div> - <div id="app-image-{{item.headerText.split(' ').join('-')}}"att-gridster-item-body - ng-style="{'cursor':'pointer', - 'background-image': 'url('+(item.imageLink)+')', - 'order': item.order, - 'background-repeat': 'no-repeat'}" - ng-click="applicationsHome.goToPortal(item)" ng-hide="users.isLoadingTable && !users.getUserAppsIsDone"> - </div> - <div att-gridster-item-footer class="app-gridster-footer" ng-hide="users.isLoadingTable && !users.getUserAppsIsDone"> - <span id="go-{{item.headerText.split(' ').join('-')}}" class="go-button" ng-click="applicationsHome.goToPortal(item)" >GO</span> - </div> - </div> - </div> - </div> - <div> - <div id="app-home-disclaimer" class="w-ecomp-main-error" ng-if="appsViewData.length==0" ng-hide="users.isLoadingTable && !users.getUserAppsIsDone"> - You do not have access to any application/functionality within OpenECOMP Portal. Please contact your administrator to get access to ECOMP Portal</a><br> - </div> - </div> - </div> - <div id="app-home-disclaimer-mylogins" class="w-ecomp-main-disclaimer"> - - <p id="build-number" class="build-number" ng-bind-html="buildNumber"></p> - </div> - - </div> -</div> 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 deleted file mode 100644 index 3f624117..00000000 --- a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.js +++ /dev/null @@ -1,284 +0,0 @@ -'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 deleted file mode 100644 index 8b137891..00000000 --- a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.controller.spec.js +++ /dev/null @@ -1 +0,0 @@ - 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 deleted file mode 100644 index 46e5b1fd..00000000 --- a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.less +++ /dev/null @@ -1,137 +0,0 @@ -.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 deleted file mode 100644 index 8e385c1e..00000000 --- a/ecomp-portal-FE/client/app/views/home/widgets-home/widgets-home.tpl.html +++ /dev/null @@ -1,123 +0,0 @@ -<div class="w-ecomp-widgets-home" id="contentId"> - <div class="widgets-home-container"> - <div id="widgets-home-title" class="widgets-home-title">Widgets</div> - - - <div class="portals-list"> - <div class="gridster-container override_background"> - <span class="ecomp-spinner" ng-show="widgetsHome.isLoading"></span> - <div ng-hide="widgetsHome.isEnlarged" att-gridster - att-gridster-options="widgetsHome.gridsterOpts" > - <div att-gridster-item='item' ng-repeat="item in widgetsViewData"> - <div id="widget-grips-{{item.headerText.split(' ').join('-')}}" - att-gridster-item-header - grips-img-path="assets/images/grips.png" - header-text={{item.headerText}} - class="widget-gridster-header"> - </div> - <div att-gridster-item-body ng-if="item.headerText=='News'"> - <div id="newsContainer" class="information-section-gridsterContent"> - <div class="news"> - <ul id="newsContent" ng-show="newsData.length!=0"> - <li ng-repeat="news in newsData"><a href="{{news.href}}" target="_blank" ng-bind="news.title"></a></li> - </ul> - <div ng-hide="newsData.length!=0"> - <div class="activity-error-container" style="background: rgb(255, 255, 255); overflow: auto!important; width: 100%;"> - <div class="activity-error-block"> - <i class="ion-information-circled full-linear-ion-information-circled" style="margin-left:125px; font-size: 90px"></i> <br> - <div class="activity-error-msg1">There's currently no news available.</div> - </div> - </div> - </div> - </div> - </div> - </div> - <div att-gridster-item-body ng-if="item.headerText=='Events'"> - <div class="information-section-gridsterContent"> - <div class="events"> - <ul ng-show="eventData.length!=0"> - <li ng-repeat="event in eventData"> - <div ng-click="event_content_show=!event_content_show"> - <div class="events-date">{{event.mon}}/{{event.day}}/{{event.year}} </div> - <div> - <div class="event-title-div"> - <p ng-bind="event.title"></p> - </div> - <div> - <span class="ion-ios-arrow-up" ng-if="event_content_show" style="color: #888; font-size: 22px;"></span> - <span class="ion-ios-arrow-down" ng-if="!event_content_show" style="color: #888; font-size: 22px;"></span> - - </div> - <div style="clear: both;"></div> - </div> - </div> - <div class="events-content" ng-show="event_content_show"> - <div class="events-content-body"> - <a class="events-link" ng-href="{{event.href}}" target="_blank"> - <span ng-bind="event.content"></span> - </a> - </div> - <div></div> - </div> - </li> - - - </ul> - <div ng-hide="eventData.length!=0"> - <div class="activity-error-container" style="background: rgb(255, 255, 255); overflow: hidden!important; width: 100%;"> - <div class="activity-error-block"> - <i class="ion-information-circled full-linear-ion-information-circled" style="margin-left:125px; font-size: 90px"></i> <br> - <div class="activity-error-msg1">There's currently no event available.</div> - </div> - </div> - </div> - </div> - </div> - </div> - - <div att-gridster-item-body ng-if="item.headerText=='Resources'"> - <div class=""> - <div class="resources"> - <ul ng-show="importResData.length!=0"> - <li ng-repeat="item in importResData"><a href="{{item.href}}" target="_blanl">{{item.title}}</a></li> - </ul> - <div ng-hide="importResData.length!=0"> - <div class="activity-error-container" style="background: rgb(255, 255, 255); overflow: hidden!important; width: 100%;"> - <div class="activity-error-block"> - <i class="ion-information-circled full-linear-ion-information-circled" style="margin-left:125px; font-size: 90px"></i> <br> - <div class="activity-error-msg1">There's currently no links available.</div> - </div> - </div> - </div> - </div> - </div> - </div> - - <div att-gridster-item-body ng-if="item.headerText!='News' && item.headerText!='Events' && item.headerText!='Resources'"> - <iframe id="widget-iframe-{{item.headerText.split(' ').join('-')}}" - class="widget-iframe" - ng-src="{{item.url | trusted}}" - refresh-iframe - is-enlarged="{{widgetsHome.isEnlarged}}"> - </iframe> - </div> - <div id="widget-footer-{{item.headerText.split(' ').join('-')}}" - att-gridster-item-footer class="widget-gridster-footer"> - </div> - </div> - </div> - </div> - <div ng-show="widgetsHome.isEnlarged" > - <div id="widgets-button-enlarge-close" class="enlarge-close-button" ng-click="widgetsHome.isEnlarged=false">X</div> - <iframe id="iframe-widget-enlarge-close" ng-src="{{widgetsHome.enlargeURL | trusted}}" class="enlarge-content" > - </iframe> - </div> - - </div> - - <div id="widgets-disclaimer" class="w-ecomp-main-disclaimer"> - To request access to an application, please visit the <a - ng-href="getAccess">Get Access</a> page. - </div> - </div> -</div> |