diff --git a/saas/axops/src/ui/src/app/services/index.ts b/saas/axops/src/ui/src/app/services/index.ts index 1eeb505d2e1a..522842172169 100644 --- a/saas/axops/src/ui/src/app/services/index.ts +++ b/saas/axops/src/ui/src/app/services/index.ts @@ -44,4 +44,3 @@ export { SlackService } from './slack.service'; export * from './playground-info.service'; export * from './system-request.service'; export * from './retention-policy.service'; -export * from './shared.service'; diff --git a/saas/axops/src/ui/src/app/services/services.module.ts b/saas/axops/src/ui/src/app/services/services.module.ts index 33f01a9568f6..abf68c5600b3 100644 --- a/saas/axops/src/ui/src/app/services/services.module.ts +++ b/saas/axops/src/ui/src/app/services/services.module.ts @@ -50,7 +50,6 @@ import { PlaygroundInfoService } from './playground-info.service'; import { TrackingService } from './tracking.service'; import { SlackService } from './slack.service'; import { SystemRequestService } from './system-request.service'; -import { SharedService } from './shared.service'; @NgModule({ providers: [ @@ -98,7 +97,6 @@ import { SharedService } from './shared.service'; GlobalSearchService, SecretService, TrackingService, - SharedService, PlaygroundInfoService, { provide: ContentService, diff --git a/saas/axops/src/ui/src/app/services/shared.service.ts b/saas/axops/src/ui/src/app/services/shared.service.ts deleted file mode 100644 index c3a7390f34db..000000000000 --- a/saas/axops/src/ui/src/app/services/shared.service.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Injectable } from '@angular/core'; -import {BehaviorSubject} from 'rxjs/BehaviorSubject'; - -@Injectable() -export class SharedService { - - updateSource: BehaviorSubject = new BehaviorSubject({}); - - // tslint:disable-next-line:no-empty - constructor() {} -} diff --git a/saas/axops/src/ui/src/app/views/+user-management/user-profile/user-profile.component.ts b/saas/axops/src/ui/src/app/views/+user-management/user-profile/user-profile.component.ts index 7912c774d430..db73cbe3c913 100644 --- a/saas/axops/src/ui/src/app/views/+user-management/user-profile/user-profile.component.ts +++ b/saas/axops/src/ui/src/app/views/+user-management/user-profile/user-profile.component.ts @@ -3,7 +3,7 @@ import { Router, ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs'; import { User } from '../../../model'; -import { UsersService, AuthenticationService, SharedService } from '../../../services'; +import { UsersService, AuthenticationService } from '../../../services'; import { LayoutSettings, HasLayoutSettings } from '../../layout'; import { UserUtils } from '../user-utils'; @@ -27,8 +27,7 @@ export class UserProfileComponent implements OnInit, OnDestroy, LayoutSettings, private usersService: UsersService, private authenticationService: AuthenticationService, private activatedRoute: ActivatedRoute, - private utils: UserUtils, - private sharedService: SharedService) { + private utils: UserUtils) { } public get layoutSettings(): LayoutSettings { @@ -84,15 +83,11 @@ export class UserProfileComponent implements OnInit, OnDestroy, LayoutSettings, } private async loadUser() { - let emitToLayout = !this.user.id; await this.usersService.getUser(this.username).subscribe(result => { this.user = result; if (this.username === this.authenticationService.getUsername()) { this.isCurrentLoggedInUser = true; } - if (emitToLayout) { - this.sharedService.updateSource.next(this.layoutSettings); - } }); } } diff --git a/saas/axops/src/ui/src/app/views/layout/layout.component.ts b/saas/axops/src/ui/src/app/views/layout/layout.component.ts index 8393ee51535a..bd02859df638 100644 --- a/saas/axops/src/ui/src/app/views/layout/layout.component.ts +++ b/saas/axops/src/ui/src/app/views/layout/layout.component.ts @@ -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'; @@ -15,7 +15,6 @@ import { SecretService, ViewPreferencesService, AuthenticationService, - SharedService } from '../../services'; import { Task, Application } from '../../model'; @@ -70,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; @@ -101,21 +99,13 @@ export class LayoutComponent implements OnInit, OnDestroy { private playgroundInfoService: PlaygroundInfoService, private notificationService: NotificationService, private viewPreferencesService: ViewPreferencesService, - private authenticationService: AuthenticationService, - private sharedService: SharedService) { + private authenticationService: AuthenticationService) { this.encryptForm = new FormGroup({ repo: new FormControl('', Validators.required), 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))); @@ -144,10 +134,6 @@ export class LayoutComponent implements OnInit, OnDestroy { this.playgroundTask = info; })); - this.subscriptions.push(this.sharedService.updateSource.subscribe((layout) => { - this.layoutSettings = layout; - })); - this.authenticationService.getCurrentUser().then(user => { this.subscriptions.push(Observable.merge( this.notificationService.getEventsStream(user.username), @@ -191,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); }