* added kanban-fixed route
This commit is contained in:
parent
0d628456c4
commit
9f1d5d4d9a
@ -3,7 +3,7 @@ import {Subscription} from "rxjs/Subscription";
|
|||||||
import {TimerObservable} from "rxjs/observable/TimerObservable";
|
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, NavigationEnd, 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";
|
import {TspInfoService} from "./tsp-info/shared/tsp-info.service";
|
||||||
|
|
||||||
@ -64,8 +64,20 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
this.reloadTspInfoTimer = timer2.subscribe(() => {
|
this.reloadTspInfoTimer = timer2.subscribe(() => {
|
||||||
this.tspInfoService.reload();
|
this.tspInfoService.reload();
|
||||||
});
|
});
|
||||||
this.activatedRoute.queryParamMap.subscribe(params => {
|
|
||||||
if (!params.has("disableAutoSwitch")) {
|
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);
|
let timer4 = TimerObservable.create(TIMER_PAGE_SWITCH_TICK, TIMER_PAGE_SWITCH_TICK);
|
||||||
this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
|
this.pageSwitchTimer = timer4.subscribe(this.switchSubscriber.bind(this));
|
||||||
}
|
}
|
||||||
@ -86,7 +98,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
let weekDay = now.getDay();
|
let weekDay = now.getDay();
|
||||||
// on weekdays
|
// on weekdays
|
||||||
if (weekDay > 0 && weekDay < 6) {
|
if (weekDay > 0 && weekDay < 6) {
|
||||||
if(now.getHours() == 10) {
|
if (now.getHours() == 10) {
|
||||||
if (this.autoSwitchEnabled && now.getMinutes() > 14) {
|
if (this.autoSwitchEnabled && now.getMinutes() > 14) {
|
||||||
this.navigateToPage(PAGE_KANBAN);
|
this.navigateToPage(PAGE_KANBAN);
|
||||||
this.autoSwitchEnabled = false;
|
this.autoSwitchEnabled = false;
|
||||||
|
|||||||
@ -13,6 +13,20 @@ const routes: Routes = [
|
|||||||
kanbanBoard: KanbanService,
|
kanbanBoard: KanbanService,
|
||||||
fun: FunService,
|
fun: FunService,
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
disableAutoSwitch: false
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
path: 'kanban-fixed',
|
||||||
|
children: [],
|
||||||
|
component: KanbanBoardComponent,
|
||||||
|
resolve: {
|
||||||
|
kanbanBoard: KanbanService,
|
||||||
|
fun: FunService,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
disableAutoSwitch: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user