2016-06-09 13:00:26 -05:00
|
|
|
// #docregion
|
2016-10-20 00:02:47 -05:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
import { Observable } from 'rxjs/Observable';
|
|
|
|
import { PreloadSelectedModules } from '../selective-preload-strategy';
|
|
|
|
|
2016-07-16 17:34:26 -05:00
|
|
|
import 'rxjs/add/operator/map';
|
2016-06-09 13:00:26 -05:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
template: `
|
2016-08-26 23:19:27 -05:00
|
|
|
<p>Dashboard</p>
|
2016-07-16 17:34:26 -05:00
|
|
|
|
|
|
|
<p>Session ID: {{ sessionId | async }}</p>
|
|
|
|
<a id="anchor"></a>
|
|
|
|
<p>Token: {{ token | async }}</p>
|
2016-10-20 00:02:47 -05:00
|
|
|
|
|
|
|
Preloaded Modules
|
|
|
|
<ul>
|
|
|
|
<li *ngFor="let module of modules">{{ module }}</li>
|
|
|
|
</ul>
|
2016-08-09 17:38:25 +01:00
|
|
|
`
|
2016-06-09 13:00:26 -05:00
|
|
|
})
|
2016-08-26 23:19:27 -05:00
|
|
|
export class AdminDashboardComponent implements OnInit {
|
2016-07-16 17:34:26 -05:00
|
|
|
sessionId: Observable<string>;
|
|
|
|
token: Observable<string>;
|
2016-10-20 00:02:47 -05:00
|
|
|
modules: string[];
|
2016-07-16 17:34:26 -05:00
|
|
|
|
2016-10-20 00:02:47 -05:00
|
|
|
constructor(
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private preloadStrategy: PreloadSelectedModules
|
|
|
|
) {
|
|
|
|
this.modules = preloadStrategy.preloadedModules;
|
|
|
|
}
|
2016-07-16 17:34:26 -05:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
// Capture the session ID if available
|
2016-08-09 17:38:25 +01:00
|
|
|
this.sessionId = this.route
|
2016-07-16 17:34:26 -05:00
|
|
|
.queryParams
|
|
|
|
.map(params => params['session_id'] || 'None');
|
2016-06-09 13:00:26 -05:00
|
|
|
|
2016-07-16 17:34:26 -05:00
|
|
|
// Capture the fragment if available
|
2016-08-09 17:38:25 +01:00
|
|
|
this.token = this.route
|
2016-07-16 17:34:26 -05:00
|
|
|
.fragment
|
|
|
|
.map(fragment => fragment || 'None');
|
|
|
|
}
|
|
|
|
}
|