Skip to content

Commit

Permalink
Support updating layout settings after page navigation is completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev committed Aug 24, 2017
1 parent 9b80c51 commit f2167b6
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions saas/axops/src/ui/src/app/views/layout/layout.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as moment from 'moment';
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { RouterOutlet, Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { RouterOutlet, Router, ActivatedRoute } from '@angular/router';
import { Subject, Subscription, Observable } from 'rxjs';
import { FormControl, FormGroup, Validators } from '@angular/forms';

Expand Down Expand Up @@ -69,7 +69,6 @@ export class LayoutComponent implements OnInit, OnDestroy {
public jiraIssueCreatorPanelComponent: JiraIssueCreatorPanelComponent;
@ViewChild(JiraIssuesPanelComponent)
public jiraIssuesPanelComponent: JiraIssuesPanelComponent;
public layoutSettings: LayoutSettings = {};
public globalSearch: GlobalSearchSetting;
public hiddenScrollbar: boolean;
public openedPanelOffCanvas: boolean;
Expand Down Expand Up @@ -107,13 +106,6 @@ export class LayoutComponent implements OnInit, OnDestroy {
secret: new FormControl('', Validators.required),
});

this.subscriptions.push(router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
let component: any = this.routerOutlet.component;
this.layoutSettings = component ? component.layoutSettings || {} : {};
}
}));

this.subscriptions.push(this.slidingPanelService.panelOpened.subscribe(
isHidden => setTimeout(() => this.hiddenScrollbar = isHidden)));

Expand Down Expand Up @@ -185,6 +177,11 @@ export class LayoutComponent implements OnInit, OnDestroy {
}));
}

public get layoutSettings(): LayoutSettings {
let component: any = this.routerOutlet.isActivated ? this.routerOutlet.component : null;
return component ? component.layoutSettings || {} : {};
}

public ngOnInit() {
this.launchPanelService.initPanel(this.multipleServiceLaunchPanel);
}
Expand Down

0 comments on commit f2167b6

Please sign in to comment.