* 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 = [ const routes: Routes = [
{ {
path: '', path: '',
redirectTo: '/kanban', redirectTo: '/tspinfopage',
pathMatch: 'full', pathMatch: 'full',
} }
]; ];

View File

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

View File

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

View File

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