| /******************************************************************************** |
| * Copyright (c) 2015-2018 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 } from '@angular/core'; |
| import { Router, ActivatedRoute } from '@angular/router'; |
| |
| import { Node } from '@navigator/node'; |
| import { NavigatorService } from '@navigator/navigator.service'; |
| |
| @Component({ |
| selector: 'mdm-detail', |
| templateUrl: 'mdm-detail.component.html', |
| providers: [] |
| }) |
| export class MDMDetailComponent { |
| |
| visible = false; |
| |
| constructor(private route: ActivatedRoute, |
| private router: Router, |
| private navigatorService: NavigatorService) { |
| |
| this.refreshVisibility(this.navigatorService.getSelectedNode()); |
| |
| this.navigatorService.selectedNodeChanged |
| .subscribe(node => this.refreshVisibility(node)); |
| } |
| |
| refreshVisibility(node: Node) { |
| this.visible = false; |
| if (node != undefined && node.type != undefined && (node.type.toLowerCase() === 'measurement' |
| || node.type.toLowerCase() === 'teststep' || node.type.toLowerCase() === 'test')) { |
| this.visible = true; |
| } |
| |
| // check if we are in the general node and if the context tabs are visible |
| if (!this.visible && this.router.url !== '/navigator/details/general') { |
| // redirect to correct router path |
| this.router.navigate(['/navigator/details/general']); |
| } |
| } |
| |
| isVisible() { |
| return this.visible; |
| } |
| |
| } |