From 63d3632af0b8d778bcf59b10fd610e707d946ce4 Mon Sep 17 00:00:00 2001 From: danielkryska Date: Wed, 21 Jul 2021 11:47:42 +0200 Subject: [PATCH] [#1182] Fix modal display on live mode exit --- .../map-view/state/scene/timeline.service.ts | 6 +++-- .../map-view/timeline/timeline.component.ts | 26 +++++++------------ .../view-manager.component.spec.ts | 4 +-- .../view-manager/view-manager.component.ts | 2 +- s4e-web/src/scss/_datepicker.scss | 2 +- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/s4e-web/src/app/views/map-view/state/scene/timeline.service.ts b/s4e-web/src/app/views/map-view/state/scene/timeline.service.ts index f7242d0bf..4bd7aaaa1 100644 --- a/s4e-web/src/app/views/map-view/state/scene/timeline.service.ts +++ b/s4e-web/src/app/views/map-view/state/scene/timeline.service.ts @@ -24,6 +24,7 @@ import {SceneStore} from './scene.store.service'; import {SceneQuery} from './scene.query'; import environment from '../../../../../environments/environment'; import {interval, Subscription} from 'rxjs'; +import {compareSegments} from '@angular/compiler-cli/src/ngtsc/sourcemaps/src/segment_marker'; @Injectable({providedIn: 'root'}) export class TimelineService { @@ -53,9 +54,10 @@ export class TimelineService { this._sceneStore.setLoading(false); } - async confirmTurningOfLiveMode(): Promise { - this._sceneStore.setLoading(true); + async confirmTurningOffLiveMode(): Promise { + console.trace(); + this._sceneStore.setLoading(true); const isLiveMode = this._sceneQuery.getValue().isLiveMode; if (!isLiveMode) { this._sceneStore.setLoading(false); diff --git a/s4e-web/src/app/views/map-view/timeline/timeline.component.ts b/s4e-web/src/app/views/map-view/timeline/timeline.component.ts index 0656a7589..96c5e86aa 100644 --- a/s4e-web/src/app/views/map-view/timeline/timeline.component.ts +++ b/s4e-web/src/app/views/map-view/timeline/timeline.component.ts @@ -40,7 +40,7 @@ import { of, ReplaySubject } from 'rxjs'; -import {map, switchMap, tap} from 'rxjs/operators'; +import {map, skip, switchMap, tap} from 'rxjs/operators'; import {Scene, SceneWithUI} from '../state/scene/scene.model'; import {yyyymmdd} from '../../../utils/miscellaneous/date-utils'; import {AkitaGuidService} from '../state/search-results/guid.service'; @@ -191,10 +191,9 @@ export class TimelineComponent } datepickerFc = new FormControl(); - @Input('currentDate') set _currentDate(v: string) { this.currentDate = v; - this.datepickerFc.setValue(new Date(v), {emitEvent: false}); + this.datepickerFc.setValue(new Date(v), {emitEvent: false, onlySelf: true}); } bsDatePickerUtils!: BsDatePickerUtils; @@ -221,16 +220,11 @@ export class TimelineComponent } async selectDate(date: Date) { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); - if (!turnOfLiveMode || date == null) { - return; - } - this.dateSelected.emit(yyyymmdd(date)); } async goToPreviousDay() { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -239,7 +233,7 @@ export class TimelineComponent } async goToNextDay() { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -248,7 +242,7 @@ export class TimelineComponent } async goToPreviousScene() { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -257,7 +251,7 @@ export class TimelineComponent } async goToNextScene() { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -267,7 +261,7 @@ export class TimelineComponent async setPickerOpenState(open: boolean) { if (open) { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -278,7 +272,7 @@ export class TimelineComponent } async selectScene(scene: Scene) { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -288,7 +282,7 @@ export class TimelineComponent } async goToLastAvailableScene() { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } @@ -313,7 +307,7 @@ export class TimelineComponent this.hourmarks.length < TimelineComponent.HOURMARKS_COUNT; i += this.resolution / TimelineComponent.HOURMARKS_COUNT ) { - let date = moment(this.startTime); + const date = moment(this.startTime); date.add(i, 'hours'); this.hourmarks.push(date.format('HH:mm')); } diff --git a/s4e-web/src/app/views/map-view/view-manager/view-manager.component.spec.ts b/s4e-web/src/app/views/map-view/view-manager/view-manager.component.spec.ts index bbf608991..ac6c7754a 100644 --- a/s4e-web/src/app/views/map-view/view-manager/view-manager.component.spec.ts +++ b/s4e-web/src/app/views/map-view/view-manager/view-manager.component.spec.ts @@ -59,7 +59,7 @@ describe('ViewManagerComponent', () => { const product = ProductFactory.build(); productStore.set([product]); const spy = spyOn(productService, 'setActive$').and.returnValue(of()); - spyOn(timelineService, 'confirmTurningOfLiveMode').and.returnValue( + spyOn(timelineService, 'confirmTurningOffLiveMode').and.returnValue( of(true).toPromise() ); await component.selectProduct(product.id); @@ -71,7 +71,7 @@ describe('ViewManagerComponent', () => { productStore.set([product]); productStore.setActive(product.id); const spy = spyOn(productService, 'setActive$').and.returnValue(of()); - spyOn(timelineService, 'confirmTurningOfLiveMode').and.returnValue( + spyOn(timelineService, 'confirmTurningOffLiveMode').and.returnValue( of(true).toPromise() ); await component.selectProduct(product.id); diff --git a/s4e-web/src/app/views/map-view/view-manager/view-manager.component.ts b/s4e-web/src/app/views/map-view/view-manager/view-manager.component.ts index ecb07d41c..74b644f98 100644 --- a/s4e-web/src/app/views/map-view/view-manager/view-manager.component.ts +++ b/s4e-web/src/app/views/map-view/view-manager/view-manager.component.ts @@ -118,7 +118,7 @@ export class ViewManagerComponent implements OnInit, OnDestroy { } async selectProduct(productId: number) { - const turnOfLiveMode = await this.timelineService.confirmTurningOfLiveMode(); + const turnOfLiveMode = await this.timelineService.confirmTurningOffLiveMode(); if (!turnOfLiveMode) { return; } diff --git a/s4e-web/src/scss/_datepicker.scss b/s4e-web/src/scss/_datepicker.scss index 171891b84..771bdad14 100644 --- a/s4e-web/src/scss/_datepicker.scss +++ b/s4e-web/src/scss/_datepicker.scss @@ -16,7 +16,7 @@ */ bs-datepicker-container { - z-index: 20000; + z-index: 3; } .bs-datepicker.theme-blank {