mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
deprecate profile resolver (#686)
* resolve profile at startup * remove profile resolver, load profile on app ready * dispose subscriptions
This commit is contained in:
@@ -31,7 +31,7 @@ import {
|
||||
PageTitleService,
|
||||
UploadService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppExtensionService } from './extensions/extension.service';
|
||||
@@ -40,24 +40,28 @@ import {
|
||||
SetCurrentUrlAction,
|
||||
SetInitialStateAction,
|
||||
CloseModalDialogsAction,
|
||||
SetRepositoryStatusAction
|
||||
SetRepositoryStatusAction,
|
||||
SetUserProfileAction
|
||||
} from './store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
AppState,
|
||||
INITIAL_APP_STATE
|
||||
} from './store/states/app.state';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { ContentApiService } from './services/content-api.service';
|
||||
import { DiscoveryEntry } from 'alfresco-js-api';
|
||||
import { AppService } from './services/app.service';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@@ -83,11 +87,6 @@ export class AppComponent implements OnInit {
|
||||
|
||||
this.store.dispatch(new CloseModalDialogsAction());
|
||||
this.router.navigate(['/login']);
|
||||
|
||||
this.appService.waitForAuth().subscribe(() => {
|
||||
this.loadRepositoryStatus();
|
||||
// todo: load external auth-enabled plugins here
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -119,12 +118,18 @@ export class AppComponent implements OnInit {
|
||||
this.onFileUploadedError(error)
|
||||
);
|
||||
|
||||
this.appService.waitForAuth().subscribe(() => {
|
||||
this.appService.ready$.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
this.loadRepositoryStatus();
|
||||
this.loadUserProfile();
|
||||
// todo: load external auth-enabled plugins here
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
private loadRepositoryStatus() {
|
||||
this.contentApi
|
||||
.getRepositoryInformation()
|
||||
@@ -135,6 +140,12 @@ export class AppComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private loadUserProfile() {
|
||||
this.contentApi.getPerson('-me-').subscribe(person => {
|
||||
this.store.dispatch(new SetUserProfileAction(person.entry));
|
||||
});
|
||||
}
|
||||
|
||||
private loadAppSettings() {
|
||||
const baseShareUrl =
|
||||
this.config.get<string>('baseShareUrl') ||
|
||||
|
Reference in New Issue
Block a user