* route name change, there seems to be a bug involving dashes in the route name

This commit is contained in:
Dávid Danyi 2017-09-08 15:42:27 +02:00
parent 97d946a324
commit d37a6f68c6
4 changed files with 21 additions and 12 deletions

View File

@ -4,7 +4,7 @@ import {Routes, RouterModule} from '@angular/router';
const routes: Routes = [
{
path: '',
redirectTo: '/kanban',
redirectTo: '/tspinfopage',
pathMatch: 'full',
}
];

View File

@ -5,10 +5,12 @@ import {TimerObservable} from "rxjs/observable/TimerObservable";
import {KanbanService} from "./kanban/shared/kanban.service";
import {ActivatedRoute, Router} from "@angular/router";
import {SelfUpdaterService} from "./kanban/shared/self-updater.service";
import {TspInfoService} from "./tsp-info/shared/tsp-info.service";
const TIMER_DEPLOY_REFRESH = 30000;
const TIMER_JIRA_REFRESH = 60000;
const TIMER_TSPINFO_REFRESH = 60000;
const TIMER_PAGE_SWITCH_TICK = 1000;
/**
@ -16,10 +18,10 @@ const TIMER_PAGE_SWITCH_TICK = 1000;
* @type {number}
*/
const TIMESPENT_KANBAN = 120000;
const TIMESPENT_TSPINFO = 60000;
const TIMESPENT_TSPINFO = 30000;
const PAGE_KANBAN = '/kanban';
const PAGE_TSPINFO = '/tsp-info-page';
const PAGE_TSPINFO = '/tspinfopage';
@Component({
selector: 'app-root',
@ -32,11 +34,13 @@ export class AppComponent implements OnInit, OnDestroy {
private autoSwitchEnabled: boolean = true;
private selfUpdateCheckerTimer: Subscription;
private reloadJiraIssueTimer: Subscription;
private reloadKanbanTimer: Subscription;
private reloadTspInfoTimer: Subscription;
private pageSwitchTimer: Subscription;
constructor(private selfUpdaterService: SelfUpdaterService,
private kanbanService: KanbanService,
private tspInfoService: TspInfoService,
private router: Router,
private activatedRoute: ActivatedRoute) {
}
@ -44,7 +48,7 @@ export class AppComponent implements OnInit, OnDestroy {
/**
* Initialize application timers:
* - selfUpdateCheckerTimer is used to see if there is a newer revision deployed on the server
* - reloadJiraIssueTimer is used to refresh the status of the jira board
* - reloadKanbanTimer is used to refresh the status of the jira board
* - pageSwitchTimer handles switching back and forth between page views
*/
public ngOnInit() {
@ -53,22 +57,27 @@ export class AppComponent implements OnInit, OnDestroy {
this.selfUpdaterService.checkAndReloadIfNecessary();
});
let timer1 = TimerObservable.create(TIMER_JIRA_REFRESH, TIMER_JIRA_REFRESH);
this.reloadJiraIssueTimer = timer1.subscribe(() => {
this.reloadKanbanTimer = timer1.subscribe(() => {
this.kanbanService.reload();
});
let timer2 = TimerObservable.create(TIMER_TSPINFO_REFRESH, TIMER_TSPINFO_REFRESH);
this.reloadTspInfoTimer = timer2.subscribe(() => {
this.tspInfoService.reload();
});
this.activatedRoute.queryParamMap.subscribe(params => {
if (!params.has("disableAutoSwitch")) {
let timer2 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
// this.pageSwitchTimer = timer2.subscribe(this.switchSubscriber.bind(this));
let timer4 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
}
});
}
public ngOnDestroy() {
this.selfUpdateCheckerTimer.unsubscribe();
this.reloadJiraIssueTimer.unsubscribe();
this.reloadKanbanTimer.unsubscribe();
this.reloadTspInfoTimer.unsubscribe();
if (this.pageSwitchTimer) {
// this.pageSwitchTimer.unsubscribe();
this.pageSwitchTimer.unsubscribe();
}
}

View File

@ -14,7 +14,7 @@ import { TspInfoModule } from "./tsp-info/tsp-info.module";
BrowserModule,
AppRoutingModule,
KanbanModule,
TspInfoModule
TspInfoModule,
],
providers: [],
bootstrap: [AppComponent]

View File

@ -5,7 +5,7 @@ import {TspInfoService} from "./shared/tsp-info.service";
const routes: Routes = [
{
path: 'tsp-info-page',
path: 'tspinfopage',
children: [],
component: InfoPageComponent,
resolve: {