diff --git a/src/app/app.component.ts b/src/app/app.component.ts index df2819cfa505ecc02376660baed3ac4be7ac6377..d21bb55f4c92da290bfb2ba1517fd9f1533c8169 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -75,7 +75,7 @@ export class AppComponent implements OnInit, OnDestroy { this.appDelayedProcessesSubscription = this.mds.delayedProcessesCount$.pipe( debounceTime(500) ).subscribe( c => { - this.showSpinner = c > 0; + this.showSpinner = this.mds.progressVisualEnabled && c > 0; }); window.addEventListener('message', (event: MessageEvent) => { diff --git a/src/app/backend.service.ts b/src/app/backend.service.ts index 8ecf52b2d4b39f511bab36c2a2f5615af9be9047..6906fbb208ad27f385bbe4e2e89c4c5ba71a1c6d 100644 --- a/src/app/backend.service.ts +++ b/src/app/backend.service.ts @@ -118,9 +118,9 @@ export class BackendService { })); } - startTest(bookletId: string): Observable<string | number> { + startTest(bookletName: string): Observable<string | number> { return this.http - .put<number>(this.serverUrl + 'test', {bookletId}) + .put<number>(this.serverUrl + 'test', {bookletName}) .pipe( map((testId: number) => String(testId)), catchError(errCode => of(errCode)) diff --git a/src/app/maindata.service.ts b/src/app/maindata.service.ts index 23a51b925b3cb3a456d78a08f8090729d4287e3b..45151e2f90af8b98c085349329bfda3150c6fd4c 100644 --- a/src/app/maindata.service.ts +++ b/src/app/maindata.service.ts @@ -17,6 +17,7 @@ const localStorageAuthDataKey = 'iqb-tc'; export class MainDataService { public appError$ = new BehaviorSubject<AppError>(null); public delayedProcessesCount$ = new BehaviorSubject<number>(0); + public progressVisualEnabled = true; public isApiVersionValid = true; // set by app.component.ts diff --git a/src/app/test-controller/start-lock-input/start-lock-input.component.html b/src/app/test-controller/start-lock-input/start-lock-input.component.html index f9d8b6d92355c45ab1d249650eafabe54c0a9bba..3678754c112181263ad13b9d7d9843a234024c9f 100644 --- a/src/app/test-controller/start-lock-input/start-lock-input.component.html +++ b/src/app/test-controller/start-lock-input/start-lock-input.component.html @@ -13,7 +13,7 @@ <button mat-raised-button color="primary" [disabled]="!startkeyform.valid" type="submit" - [mat-dialog-close]="startkeyform">Weiter</button> + [mat-dialog-close]="startkeyform.value">Weiter</button> <button mat-raised-button [mat-dialog-close]="false">Abbrechen</button> </mat-dialog-actions> </form> diff --git a/src/app/test-controller/start-lock-input/start-lock-input.component.ts b/src/app/test-controller/start-lock-input/start-lock-input.component.ts index 6de789c7a904ab7e097964ed07a8455877ab580b..31afbaa14d97358a737fbc73ed49e43f3916bffa 100644 --- a/src/app/test-controller/start-lock-input/start-lock-input.component.ts +++ b/src/app/test-controller/start-lock-input/start-lock-input.component.ts @@ -15,7 +15,7 @@ export class StartLockInputComponent { const myFormControls = {}; this.data.codes.forEach(c => { - myFormControls[c.testletId] = new FormControl('', [Validators.required, Validators.minLength(3)]); + myFormControls[c.testletId] = new FormControl(c.value, [Validators.required, Validators.minLength(3)]); }); this.startkeyform = new FormGroup(myFormControls); } diff --git a/src/app/test-controller/test-controller.component.ts b/src/app/test-controller/test-controller.component.ts index 7523cec938c6306850162e3616dd11091a527df9..67990f0dfabd928b7dfd408040a1ef1ea6fc183a 100644 --- a/src/app/test-controller/test-controller.component.ts +++ b/src/app/test-controller/test-controller.component.ts @@ -385,6 +385,7 @@ export class TestControllerComponent implements OnInit, OnDestroy { // ##################################################################################### ngOnInit() { setTimeout(() => { + this.mds.progressVisualEnabled = false; this.routingSubscription = this.route.params.subscribe(params => { this.tcs.testId = params['t']; this.unsubscribeTestSubscriptions(); @@ -613,5 +614,6 @@ export class TestControllerComponent implements OnInit, OnDestroy { this.routingSubscription.unsubscribe(); } this.unsubscribeTestSubscriptions(); + this.mds.progressVisualEnabled = true; } } diff --git a/src/app/test-controller/unithost/unit-routing-guards.ts b/src/app/test-controller/unithost/unit-routing-guards.ts index 0a70ba93475ee022711047697a11e8545e7f9d1d..a1e3e1ad1e3832850df393d8b17d256599cb9c48 100644 --- a/src/app/test-controller/unithost/unit-routing-guards.ts +++ b/src/app/test-controller/unithost/unit-routing-guards.ts @@ -7,7 +7,7 @@ import { Injectable } from '@angular/core'; import { CanActivate, CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { Observable, of, interval } from 'rxjs'; import { UnitControllerData } from '../test-controller.classes'; -import { CodeInputData, LogEntryKey, StartLockData } from '../test-controller.interfaces'; +import {CodeInputData, LogEntryKey, RunModeKey, StartLockData} from '../test-controller.interfaces'; import { MainDataService } from 'src/app/maindata.service'; import {MatDialog} from "@angular/material/dialog"; import { MatSnackBar } from '@angular/material/snack-bar'; @@ -113,7 +113,7 @@ export class UnitActivateGuard implements CanActivate { testletId: t.id, prompt: t.codePrompt, code: t.codeToEnter.toUpperCase().trim(), - value: this.tcs.mode === 'hot' ? '' : t.codeToEnter + value: this.tcs.mode === (RunModeKey.HOT_RETURN || RunModeKey.HOT_RESTART) ? '' : t.codeToEnter }); }); @@ -128,6 +128,8 @@ export class UnitActivateGuard implements CanActivate { }); return dialogRef.afterClosed().pipe( switchMap(result => { + console.log(typeof result); + console.log(result); if ((typeof result === 'undefined') || (result === false)) { return of(false); } else { diff --git a/src/app/test-controller/unithost/unithost.component.ts b/src/app/test-controller/unithost/unithost.component.ts index 1dd0b5ca47f035791b761f9294ec325a8fa3b0fb..10eceed37830c9c0f189061cabaf06d0ccdda4bc 100644 --- a/src/app/test-controller/unithost/unithost.component.ts +++ b/src/app/test-controller/unithost/unithost.component.ts @@ -161,57 +161,59 @@ export class UnithostComponent implements OnInit, OnDestroy { // % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % ngOnInit() { - this.iFrameHostElement = <HTMLElement>document.querySelector('#iFrameHost'); + setTimeout(() => { + this.iFrameHostElement = <HTMLElement>document.querySelector('#iFrameHost'); - this.iFrameItemplayer = null; - this.leaveWarning = false; + this.iFrameItemplayer = null; + this.leaveWarning = false; - this.routingSubscription = this.route.params.subscribe(params => { - this.myUnitSequenceId = Number(params['u']); - this.tcs.currentUnitSequenceId = this.myUnitSequenceId; + this.routingSubscription = this.route.params.subscribe(params => { + this.myUnitSequenceId = Number(params['u']); + this.tcs.currentUnitSequenceId = this.myUnitSequenceId; - while (this.iFrameHostElement.hasChildNodes()) { - this.iFrameHostElement.removeChild(this.iFrameHostElement.lastChild); - } + while (this.iFrameHostElement.hasChildNodes()) { + this.iFrameHostElement.removeChild(this.iFrameHostElement.lastChild); + } - if ((this.myUnitSequenceId >= 1) && (this.myUnitSequenceId === this.myUnitSequenceId) && (this.tcs.rootTestlet !== null)) { - this.tcs.setBookletState(LastStateKey.LASTUNIT, params['u']); + if ((this.myUnitSequenceId >= 1) && (this.myUnitSequenceId === this.myUnitSequenceId) && (this.tcs.rootTestlet !== null)) { + this.tcs.setBookletState(LastStateKey.LASTUNIT, params['u']); - const currentUnit = this.tcs.rootTestlet.getUnitAt(this.myUnitSequenceId); - this.unitTitle = currentUnit.unitDef.title; - this.myUnitDbKey = currentUnit.unitDef.alias; - this.tcs.currentUnitDbKey = this.myUnitDbKey; - this.tcs.currentUnitTitle = this.unitTitle; - this.itemplayerSessionId = Math.floor(Math.random() * 20000000 + 10000000).toString(); + const currentUnit = this.tcs.rootTestlet.getUnitAt(this.myUnitSequenceId); + this.unitTitle = currentUnit.unitDef.title; + this.myUnitDbKey = currentUnit.unitDef.alias; + this.tcs.currentUnitDbKey = this.myUnitDbKey; + this.tcs.currentUnitTitle = this.unitTitle; + this.itemplayerSessionId = Math.floor(Math.random() * 20000000 + 10000000).toString(); - this.setPageList([], ''); + this.setPageList([], ''); - this.iFrameItemplayer = <HTMLIFrameElement>document.createElement('iframe'); - // this.iFrameItemplayer.setAttribute('srcdoc', this.tcs.getPlayer(currentUnit.unitDef.playerId)); - this.iFrameItemplayer.setAttribute('sandbox', 'allow-forms allow-scripts allow-same-origin'); - this.iFrameItemplayer.setAttribute('class', 'unitHost'); - this.iFrameItemplayer.setAttribute('height', String(this.iFrameHostElement.clientHeight)); + this.iFrameItemplayer = <HTMLIFrameElement>document.createElement('iframe'); + // this.iFrameItemplayer.setAttribute('srcdoc', this.tcs.getPlayer(currentUnit.unitDef.playerId)); + this.iFrameItemplayer.setAttribute('sandbox', 'allow-forms allow-scripts allow-same-origin'); + this.iFrameItemplayer.setAttribute('class', 'unitHost'); + this.iFrameItemplayer.setAttribute('height', String(this.iFrameHostElement.clientHeight)); - if (this.tcs.hasUnitRestorePoint(this.myUnitSequenceId)) { - this.pendingUnitRestorePoint = {tag: this.itemplayerSessionId, value: this.tcs.getUnitRestorePoint(this.myUnitSequenceId)}; - } else { - this.pendingUnitRestorePoint = null; - } + if (this.tcs.hasUnitRestorePoint(this.myUnitSequenceId)) { + this.pendingUnitRestorePoint = {tag: this.itemplayerSessionId, value: this.tcs.getUnitRestorePoint(this.myUnitSequenceId)}; + } else { + this.pendingUnitRestorePoint = null; + } - this.leaveWarning = false; - if (!this.tcs.pageNav) { - this.iFrameHostElement.style.bottom = '0px'; - } + this.leaveWarning = false; + if (!this.tcs.pageNav) { + this.iFrameHostElement.style.bottom = '0px'; + } - if (this.tcs.hasUnitDefinition(this.myUnitSequenceId)) { - this.pendingUnitDefinition = {tag: this.itemplayerSessionId, value: this.tcs.getUnitDefinition(this.myUnitSequenceId)}; - } else { - this.pendingUnitDefinition = null; + if (this.tcs.hasUnitDefinition(this.myUnitSequenceId)) { + this.pendingUnitDefinition = {tag: this.itemplayerSessionId, value: this.tcs.getUnitDefinition(this.myUnitSequenceId)}; + } else { + this.pendingUnitDefinition = null; + } + this.iFrameHostElement.appendChild(this.iFrameItemplayer); + srcDoc.set(this.iFrameItemplayer, this.tcs.getPlayer(currentUnit.unitDef.playerId)); } - this.iFrameHostElement.appendChild(this.iFrameItemplayer); - srcDoc.set(this.iFrameItemplayer, this.tcs.getPlayer(currentUnit.unitDef.playerId)); - } - }); + }); + }) } // ++++++++++++ page nav ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++