* added kanban-fixed route

This commit is contained in:
Dávid Danyi 2017-09-14 12:46:55 +02:00
parent 0d628456c4
commit 9f1d5d4d9a
2 changed files with 34 additions and 8 deletions

View File

@ -3,7 +3,7 @@ import {Subscription} from "rxjs/Subscription";
import {TimerObservable} from "rxjs/observable/TimerObservable";
import {KanbanService} from "./kanban/shared/kanban.service";
import {ActivatedRoute, Router} from "@angular/router";
import {ActivatedRoute, NavigationEnd, Router} from "@angular/router";
import {SelfUpdaterService} from "./kanban/shared/self-updater.service";
import {TspInfoService} from "./tsp-info/shared/tsp-info.service";
@ -64,12 +64,24 @@ export class AppComponent implements OnInit, OnDestroy {
this.reloadTspInfoTimer = timer2.subscribe(() => {
this.tspInfoService.reload();
});
this.activatedRoute.queryParamMap.subscribe(params => {
if (!params.has("disableAutoSwitch")) {
let timer4 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
}
});
this.router.events
.filter(e => e instanceof NavigationEnd)
.map(() => {
let route = this.activatedRoute;
while (route.firstChild) {
route = route.firstChild;
}
return route;
})
.filter((route) => route.outlet === 'primary')
.mergeMap((route) => route.data)
.subscribe(data => {
if (!data['disableAutoSwitch']) {
let timer4 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
}
});
}
public ngOnDestroy() {
@ -86,7 +98,7 @@ export class AppComponent implements OnInit, OnDestroy {
let weekDay = now.getDay();
// on weekdays
if (weekDay > 0 && weekDay < 6) {
if(now.getHours() == 10) {
if (now.getHours() == 10) {
if (this.autoSwitchEnabled && now.getMinutes() > 14) {
this.navigateToPage(PAGE_KANBAN);
this.autoSwitchEnabled = false;

View File

@ -13,6 +13,20 @@ const routes: Routes = [
kanbanBoard: KanbanService,
fun: FunService,
},
data: {
disableAutoSwitch: false
}
}, {
path: 'kanban-fixed',
children: [],
component: KanbanBoardComponent,
resolve: {
kanbanBoard: KanbanService,
fun: FunService,
},
data: {
disableAutoSwitch: true
}
}
];