diff options
author | talasila <talasila@research.att.com> | 2017-02-07 15:03:57 -0500 |
---|---|---|
committer | talasila <talasila@research.att.com> | 2017-02-07 15:05:15 -0500 |
commit | 4ad39a5c96dd99acf819ce189b13fec946d7506b (patch) | |
tree | a1449286441947cc3d07a45227fa0d6f978e1a7d /ecomp-portal-FE/client/app/directives/right-menu | |
parent | 5500448cbd1f374d0ac743ee2fd636fe2d3c0027 (diff) |
Initial OpenECOMP Portal commit
Change-Id: I804b80e0830c092e307da1599bd9fbb5c3e2da77
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/app/directives/right-menu')
3 files changed, 358 insertions, 0 deletions
diff --git a/ecomp-portal-FE/client/app/directives/right-menu/right-menu.directive.js b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.directive.js new file mode 100644 index 00000000..b778ce7b --- /dev/null +++ b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.directive.js @@ -0,0 +1,140 @@ +/*- + * ================================================================================ + * 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. + * ================================================================================ + */ +/** + * Created by nnaffar on 1/28/16. + */ +(function () { + class RightMenu { + constructor($rootScope,$window,$log,userbarUpdateService) { + this.templateUrl = 'app/directives/right-menu/right-menu.tpl.html'; + this.restrict = 'AE'; + this.$rootScope = $rootScope; + this.userbarUpdateService = userbarUpdateService; + this.$window = $window; + this.$log = $log; + this.link = this._link.bind(this); + this.scope = { + userList :'=' + } + } + + + + _link(scope) { + let init = () => { + scope.isOpen = true; + scope.rightSideToggleBtn = 'Collapse'; + + scope.openInNewTab = (url) => { + if(url == "self") { + alert("Cannot chat with self!"); + } else { + var win = window.open(url, '_blank'); + setCookie(url.split("chat_id=")[1], 'source', 1); + //window.localStorage.setItem(url.split("chat_id=")[1],'source'); + win.focus(); + } + }; + + }; + + function setCookie(cname,cvalue,exdays) { + var d = new Date(); + d.setTime(d.getTime() + (exdays*24*60*60*1000)); + var expires = "expires=" + d.toGMTString(); + document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; + } + + function getCookie(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; + } + + + + init(); + + /***Getting the list of the users***/ + scope.toggleSidebar = () => { + scope.isOpen = !scope.isOpen; + if(scope.isOpen){ + scope.rightSideToggleBtn = 'Collapse'; + }else{ + scope.rightSideToggleBtn = 'Expand'; + } + }; + + scope.isBrowserInternetExplorer = false; + scope.browserName = bowser.name; + + if (bowser.msie || bowser.msedge) { + scope.isBrowserInternetExplorer = true; + } else { + scope.isBrowserInternetExplorer = false; + } + + + + + scope.calculateUserBarHeight = () => { + var footerOff = $('#online-userbar').offset().top; + var headOff = $('#footer').offset().top; + var userbarHeight= parseInt($(".online-user-container").css('height'),10); + var defaultOffSet = 45; + // console.log(headOff - footerOff-defaultOffSet); + $(".online-user-container").css({ + "height" : headOff - footerOff-defaultOffSet + }); + }; + + let log = this.$log; + + this.userbarUpdateService.getWidthThresholdRightMenu().then(function (res) { + if (res.status=="ERROR") { + log.error('userbarUpdateService: failed to get window width threshold for collapsing right menu; please make sure "window_width_threshold_right_menu" is specified in system.properties file.'); + } else { + var rightMenuCollapseWidthThreshold = parseInt(res.response.windowWidth); + if ($(window).width()<rightMenuCollapseWidthThreshold) { + scope.toggleSidebar(); + } + } + })['catch'](function (err) { + log.error('LeftMenu Controller:: getWidthThresholdLeftMenu() failed: ' + err); + }); + + angular.element(this.$window).bind('resize', function(){ + scope.calculateUserBarHeight(); + }); + } + + } + angular.module('ecompApp').directive('rightMenu', ($rootScope,$window,$log,userbarUpdateService) => new RightMenu($rootScope,$window,$log,userbarUpdateService)); +})(); diff --git a/ecomp-portal-FE/client/app/directives/right-menu/right-menu.less b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.less new file mode 100644 index 00000000..bc23b614 --- /dev/null +++ b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.less @@ -0,0 +1,178 @@ +/*- + * ================================================================================ + * 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. + * ================================================================================ + */ + /** + * Created by nnaffar on 1/28/16. + */ +@sidebar-width: 200px; +@transition-duration: 0.25s; +@overlayer-opacity: 0.65; + + +.close-button { + //width: @sidebar-width; + .a24r; + //.bg_u; + font-size: 3em; + line-height: 18px; + position: absolute; + cursor: pointer; + vertical-align: middle; + top: @second-level-top; + left: 0; + -webkit-font-smoothing: antialiased; + height: 53px; + z-index: 101; + //box-shadow: 0 4px 5px rgba(0, 0, 0, .2); + +} +.ecomp-right-sidebar-container{ + position: absolute; + display: block; + left: 0; + z-index: 100; + transition: left @transition-duration; + margin-top: -15px; + + .ecomp-sidebar-main { + //background-color: ; + position: absolute; + margin-top: 65px; + width: @sidebar-width; + height: 100vh; + .bg_u;//white for 1610 + //.bg_w; // gray for 1702 + box-shadow: 0 4px 5px rgba(0, 0, 0, .2); + + padding-right: 10px; + padding-left: 10px; + + .accordion-container{ + margin-top: 45px; + } + .att-accordion-font{ + font-size: .875rem; + color: #666; + display: inline-block; + font-family: arial; + + } + + .att-accordion-active{ + color: #199DDF !important; + } + + .sub-item{ + .att-accordion-font; + cursor: pointer; + height: 37px; + line-height: 37px; + padding-left: 20px; + padding-bottom: 10px; + vertical-align: middle; + width: 100%; + } + .sub-item:hover{ + .att-accordion-active; + } + + .parent-item{ + .att-accordion-font; + border-bottom: 1px solid #bbb; + cursor: pointer; + height: 37px; + line-height: 37px; + padding-bottom: 10px; + vertical-align: middle; + width: 100%; + } + .parent-item:hover{ + .att-accordion-active; + } + + } +} + +.open-sidebar { + right: 0; + transition: right .25s ease-in-out; + -moz-transition: right .25s ease-in-out; + -webkit-transition: right .25s ease-in-out; +} + +.close-sidebar { + right: -@sidebar-width; + transition: right .25s ease-in-out; + -moz-transition: right .25s ease-in-out; + -webkit-transition: right .25s ease-in-out; +} + +.content-overlayed { + position: fixed; + top: 110px; + right: 0; + bottom: 0; + left: 0; + background: none repeat scroll 0 0 rgb(242, 242, 242); + z-index: 9999; +} +.fade-animation{ + opacity: @overlayer-opacity; + transition: opacity @transition-duration ease-in-out; +} +.fade-animation.ng-hide { + opacity:0; + transition: opacity @transition-duration ease-in-out; +} + +.activeUserIcon { + transition: all .2s ease-in-out; + display: block; + margin-left: auto; margin-right: auto; height:55px; width:55px; border-radius: 50%; + +} +.activeUserIcon:hover { transform: scale(1.5); } + +.ecomp-right-sidebar-toggle{ + position: absolute; + top: 400px; + right: 35px; +} + +.open-sidebar-toggle { + // right: 0; + transition: right .25s ease-in-out; + -moz-transition: right .25s ease-in-out; + -webkit-transition: right .25s ease-in-out; +} + +.close-sidebar-toggle { + right: -36px; + transition: right .25s ease-in-out; + -moz-transition: right .25s ease-in-out; + -webkit-transition: right .25s ease-in-out; +} + +.ecomp-right-sidebar-title{ + font-family: arial; + font-size: 14px; + color: #ef6f00; + margin-bottom:20px; + text-align: center; +}
\ No newline at end of file diff --git a/ecomp-portal-FE/client/app/directives/right-menu/right-menu.tpl.html b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.tpl.html new file mode 100644 index 00000000..39eb7087 --- /dev/null +++ b/ecomp-portal-FE/client/app/directives/right-menu/right-menu.tpl.html @@ -0,0 +1,40 @@ +<!-- + ================================================================================ + 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 id="ecomp-right-sidebar-container" class="ecomp-sidebar-container" ng-class="isOpen ? 'open-sidebar': 'close-sidebar'"> + <div id="online-userbar" class="ecomp-sidebar-main" style="right: 0px; width:75px; padding:0px;" > + <div class="online-user-container" id="online-user-container" style="margin-top:45px; overflow-y:auto; overflow-x:hidden"> + <div class="ecomp-right-sidebar-title">Online Users</div> + <div ng-repeat="user in userList"> + <div class="child-row" style="height:85px;" ui-sref-active="att-accordion-active"> + <div> + <a href="javascript:void(0)" ng-click="openInNewTab(user.linkQ)" ><img class="activeUserIcon" ng-src="assets/images/photo.png" alt="User Link" ></a> + <div style="font-family: Arial; font-size:10px; text-align: center;" >{{user.userId}}</div> + </div> + </div> + </div> + </div> + </div> +</div> +<div class="ecomp-right-sidebar-toggle" ng-class="isOpen ? 'open-sidebar-toggle': 'close-sidebar-toggle'"> + <a href="javascript:void(0)" ng-click="toggleSidebar()" style="transform: rotate(-90deg); position:relative; z-index:5" att-button btn-type="primary" size="small" att-accessibility-click="13,32"> + <span class="ion-chevron-down" ng-show="isOpen"></span> + <span class="ion-chevron-up" ng-hide="isOpen"><span style="font-family: arial">Users</span></span> + </a> +</div> |