diff --git a/src/app/test-controller/command.service.ts b/src/app/test-controller/command.service.ts index a3cfc93f623fe789121e82d6c37fc0e9b32c908b..8290743dc316996ec8c12baa904479bede80315c 100644 --- a/src/app/test-controller/command.service.ts +++ b/src/app/test-controller/command.service.ts @@ -132,6 +132,7 @@ export class CommandService extends WebsocketBackendService<Command[]> implement console.warn(`Unknown command: ` + CommandService.commandToString(command)); return; } - this.commandReceived$.next(command); + this.command$.next(command); + // this.commandReceived$.next(command); } } diff --git a/src/app/test-controller/test-controller.component.ts b/src/app/test-controller/test-controller.component.ts index fc073f1d29dec2a654a91dcb4fb2bd088ed3c87e..e516abb7b860e45079962101dd2680a7cdaa3f9f 100644 --- a/src/app/test-controller/test-controller.component.ts +++ b/src/app/test-controller/test-controller.component.ts @@ -664,6 +664,7 @@ export class TestControllerComponent implements OnInit, OnDestroy { break; case 'goto': this.tcs.testStatus$.next(TestStatus.RUNNING); + console.log('goto'); if (params.length > 0) { this.tcs.interruptMaxTimer(); this.tcs.setUnitNavigationRequest(params[0], true); diff --git a/src/app/test-controller/test-controller.service.ts b/src/app/test-controller/test-controller.service.ts index 0bdbc38f9b03cd4d7e95ce45e89fd7f67f663c95..1f0dca75b80f63851ba772d1ae5feee16f085db8 100644 --- a/src/app/test-controller/test-controller.service.ts +++ b/src/app/test-controller/test-controller.service.ts @@ -322,7 +322,11 @@ export class TestControllerService { this.router.navigate([`/t/${this.testId}/status`], {skipLocationChange: true, state: {force: force}}); break; case UnitNavigationTarget.MENU: - this.router.navigate([`/t/${this.testId}/menu`], {state: {force: force}}); + this.router.navigate([`/t/${this.testId}/menu`], {state: {force: force}}).then(navOk => { + if (!navOk) { + this.router.navigate([`/t/${this.testId}/status`], {skipLocationChange: true, state: {force: force}}); + } + }); break; case UnitNavigationTarget.NEXT: let startWith = this.currentUnitSequenceId; @@ -353,7 +357,22 @@ export class TestControllerService { default: this.router.navigate([`/t/${this.testId}/u/${navString}`], - {state: {force: force}}); + {state: {force: force}}).then(navOk => { + if (!navOk) { + const navTarget = Number(navString); + if (!isNaN(navTarget)) { + let startWith = this.currentUnitSequenceId; + if (startWith < this.minUnitSequenceId) { + startWith = this.minUnitSequenceId - 1; + } + const nextUnitSequenceId = this.rootTestlet.getNextUnlockedUnitSequenceId(startWith); + if (nextUnitSequenceId > 0 && nextUnitSequenceId !== navTarget) { + this.router.navigate([`/t/${this.testId}/u/${nextUnitSequenceId}`], + {state: {force: force}}); + } + } + } + }); break; } } diff --git a/src/app/test-controller/unlock-input/unlock-input.component.css b/src/app/test-controller/unlock-input/unlock-input.component.css index 5f84a87341044023c5fecd4c7f7aafdd69c742b3..3bebe70fea6f66971996abadecdb1ba0aa8e6986 100644 --- a/src/app/test-controller/unlock-input/unlock-input.component.css +++ b/src/app/test-controller/unlock-input/unlock-input.component.css @@ -6,3 +6,8 @@ mat-card { margin: 10px; } + +.prompt { + margin-bottom: 20px; + margin-top: 20px; +} diff --git a/src/app/test-controller/unlock-input/unlock-input.component.html b/src/app/test-controller/unlock-input/unlock-input.component.html index 383c83ac7e51ed975e162d744fe79b0a9af985a2..3d8a5b4370a6a9b274c48c908aefece126174425 100644 --- a/src/app/test-controller/unlock-input/unlock-input.component.html +++ b/src/app/test-controller/unlock-input/unlock-input.component.html @@ -1,25 +1,23 @@ <div class="unlock-body"> <div fxLayout="row wrap" fxLayoutAlign="center stretch"> <mat-card> - <mat-card-header>{{ 'Freigabewort' | customtext:'booklet_codeToEnterTitle':cts.updateCount }}</mat-card-header> - <mat-card-content> - - </mat-card-content> - - <form [formGroup]="startkeyform" fxLayout="column"> - <p>{{ 'Bitte Freigabewort eingeben!' | customtext:'booklet_codeToEnterPrompt':cts.updateCount }}</p> + <form [formGroup]="startkeyform" fxLayout="column" (ngSubmit)="continue()"> + <mat-card-header>{{ 'Freigabewort' | customtext:'booklet_codeToEnterTitle':cts.updateCount }}</mat-card-header> + <mat-card-content> + <div class="prompt">{{ 'Bitte Freigabewort eingeben!' | customtext:'booklet_codeToEnterPrompt':cts.updateCount }}</div> <mat-form-field *ngFor="let c of codes" fxLayout="column"> <label>{{ c.prompt }} <input matInput [formControlName]="c.testletId"> </label> </mat-form-field> + </mat-card-content> + <mat-card-actions> + <button mat-raised-button *ngIf="returnTo" (click)="return()">Zurück</button> + <button mat-raised-button color="primary" type="submit" + [disabled]="!startkeyform.valid" + *ngIf="newUnit">Weiter</button> + </mat-card-actions> </form> - <mat-card-actions> - <button mat-raised-button *ngIf="returnTo" (click)="return()">Zurück</button> - <button mat-raised-button color="primary" type="submit" - [disabled]="!startkeyform.valid" - *ngIf="newUnit" (click)="continue()">Weiter</button> - </mat-card-actions> </mat-card> </div> </div> diff --git a/src/app/test-controller/unlock-input/unlock-input.component.ts b/src/app/test-controller/unlock-input/unlock-input.component.ts index b9c7753e61e283e96b64a9e829dce06623b9d6b8..afc3f3d527fb504c7a859c1670bd381eea76b311 100644 --- a/src/app/test-controller/unlock-input/unlock-input.component.ts +++ b/src/app/test-controller/unlock-input/unlock-input.component.ts @@ -63,6 +63,8 @@ export class UnlockInputComponent implements OnInit { break; } } + console.log(this.newUnit.unitDef.sequenceId); +console.log(codesOk); if (codesOk) { this.newUnit.codeRequiringTestlets.forEach(t => { t.codeToEnter = '';