| /******************************************************************************** |
| * Copyright (c) 2015-2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| ********************************************************************************/ |
| |
| |
| import {Component, AfterViewInit} from '@angular/core'; |
| import {Router} from '@angular/router'; |
| import Split from 'split.js'; |
| import { TRANSLATE } from '../core/mdm-core.module'; |
| |
| @Component({ |
| selector: 'admin-modules', |
| templateUrl: 'admin-modules.component.html', |
| styleUrls: ['./admin-modules.component.css'], |
| providers: [] |
| }) |
| export class AdminModulesComponent implements AfterViewInit { |
| |
| div: any; |
| scrollBtnVisible = false; |
| |
| split: Split; |
| |
| links = [ |
| { name: TRANSLATE('administration.admin-modules.preferences'), path: 'preferences'}, |
| { name: TRANSLATE('administration.admin-modules.extsystems'), path: 'extsystems'} |
| ]; |
| constructor(private router: Router) { } |
| |
| |
| minWidthLeft() { |
| return 180; |
| } |
| |
| minWidthRight() { |
| return 0.20 * window.innerWidth; |
| } |
| |
| initRatio() { |
| return Math.floor(Math.max(250 / window.innerWidth, 0.20) * 100); |
| } |
| initRatioRight() { |
| return 100 - this.initRatio(); |
| } |
| ngAfterViewInit(): void { |
| this.split = Split(['#leftsidenav', '#rightsidenav'], { |
| sizes: [this.initRatio(), this.initRatioRight()], |
| minSize: this.minWidthLeft(), |
| gutterSize: 10, |
| gutterStyle: function (dimension, gutterSize) { |
| return { |
| 'width': gutterSize + 'px', |
| 'height': (document.getElementById('leftsidenav').clientHeight - 5) + 'px' |
| }; |
| }, |
| }); |
| } |
| |
| onScrollTop() { |
| this.div.scrollTop = 0; |
| } |
| |
| onScroll(event: any) { |
| if (event.target.scrollTop > 0) { |
| this.scrollBtnVisible = true; |
| } else { |
| this.scrollBtnVisible = false; |
| } |
| this.div = event.target; |
| } |
| } |