From b4128529d8c409dcb33a29c4e555f35e79d474a8 Mon Sep 17 00:00:00 2001 From: mechtelm <nicht@mehr.fragen> Date: Mon, 27 Apr 2020 17:10:56 +0200 Subject: [PATCH] prepared for new booklet config xml; layout unit menu fixes --- src/app/app-root/login/login.component.html | 4 +-- src/app/app.component.html | 4 +-- src/app/app.component.ts | 14 ++++----- src/app/app.interceptor.ts | 2 +- src/app/maindata.service.ts | 2 +- src/app/test-controller/backend.service.ts | 1 - .../review-dialog.component.html | 6 ++-- src/app/test-controller/test-config.ts | 30 +++++++++++++++++++ .../test-controller.classes.ts | 8 +++-- .../test-controller.component.ts | 5 ++-- .../test-status/test-status.component.css | 6 +++- .../test-status/test-status.component.html | 6 ++-- src/environments/environment.prod.ts | 4 +-- 13 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/app/app-root/login/login.component.html b/src/app/app-root/login/login.component.html index 1ee15854..8b55f4d8 100644 --- a/src/app/app-root/login/login.component.html +++ b/src/app/app-root/login/login.component.html @@ -1,6 +1,6 @@ <div fxLayout="row wrap" fxLayoutAlign="center stretch"> <mat-card fxFlex="0 0 400px"> - <form [formGroup]="loginForm" (ngSubmit)="login()"> + <form [formGroup]="loginForm" (ngSubmit)="login()" *ngIf="mds.isApiValid"> <mat-card-title>Anmelden</mat-card-title> <mat-card-content fxLayout="column"> <mat-form-field> @@ -9,12 +9,12 @@ <mat-form-field> <input matInput #pw type="password" formControlName="pw" placeholder="Kennwort"> </mat-form-field> - <p style="color: chocolate"><b>{{ problemText }}</b></p> </mat-card-content> <mat-card-actions> <button mat-raised-button type="submit" [disabled]="loginForm.invalid" color="primary">Weiter</button> </mat-card-actions> </form> + <p style="color: chocolate" *ngIf="!mds.isApiValid"><b>Die Verbindung mit dem Server ist nicht möglich.</b></p> </mat-card> <mat-card fxFlex="0 0 400px" class="mat-card-gray"> diff --git a/src/app/app.component.html b/src/app/app.component.html index fc32adb3..d671eb9c 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -3,9 +3,9 @@ <img src="assets/IQB-LogoA.png" matTooltip="Zur Startseite" alt="IQB-logo"/> </a> </div> -<div class="error-msg" *ngIf="showError" [matTooltip]="(mds.appError$ | async)?.description" fxLayout="row" fxLayoutAlign="space-between center"> +<div class="error-msg" *ngIf="showError" [matTooltip]="errorData?.description" fxLayout="row" fxLayoutAlign="space-between center"> <mat-icon>error</mat-icon> - {{ (mds.appError$ | async)?.label }} + {{ errorData?.label }} <button mat-button (click)="closeErrorBox()" matTooltip="Fehlernachricht ausblenden" fxFlex="none"> <mat-icon>clear</mat-icon> </button> diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ace842f3..b1d9dc64 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,6 +3,7 @@ import {Component, Inject, OnDestroy, OnInit} from '@angular/core'; import { BackendService } from './backend.service'; import {CustomtextService} from 'iqb-components'; import {Subscription} from "rxjs"; +import {AppError} from "./app.interfaces"; @Component({ selector: 'tc-root', @@ -13,6 +14,7 @@ import {Subscription} from "rxjs"; export class AppComponent implements OnInit, OnDestroy { private appErrorSubscription: Subscription = null; showError = false; + errorData: AppError; constructor ( public mds: MainDataService, @@ -61,6 +63,7 @@ export class AppComponent implements OnInit, OnDestroy { this.appErrorSubscription = this.mds.appError$.subscribe(err => { if (err && !this.mds.errorReportingSilent) { + this.errorData = err; this.showError = true; } }); @@ -82,8 +85,8 @@ export class AppComponent implements OnInit, OnDestroy { if (authData) { this.cts.addCustomTexts(authData.customTexts); } - this.mds.isApiVersionValid = AppComponent.isValidVersion(this.expectedApiVersion, sc.version); - if (!this.mds.isApiVersionValid) { + this.mds.isApiValid = AppComponent.isValidVersion(this.expectedApiVersion, sc.version); + if (!this.mds.isApiValid) { this.mds.appError$.next({ label: "Server-Problem: API-Version ungültig", description: "erwartet: " + this.expectedApiVersion + ", gefunden: " + sc.version, @@ -95,12 +98,7 @@ export class AppComponent implements OnInit, OnDestroy { } this.mds.setTestConfig(sc.testConfig); } else { - this.mds.isApiVersionValid = false; - this.mds.appError$.next({ - label: "Allgemeines Server-Problem", - description: "getSysConfig lieferte null", - category: "FATAL" - }); + this.mds.isApiValid = false; } }); diff --git a/src/app/app.interceptor.ts b/src/app/app.interceptor.ts index c0679ae8..d3de6b8f 100644 --- a/src/app/app.interceptor.ts +++ b/src/app/app.interceptor.ts @@ -16,7 +16,7 @@ export class AuthInterceptor implements HttpInterceptor { private router: Router) {} intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { - if (!this.mds.isApiVersionValid) { + if (!this.mds.isApiValid) { this.mds.appError$.next({ label: "Server-Problem: API-Version ungültig", description: "Keine weiteren Server-Aufrufe erlaubt", diff --git a/src/app/maindata.service.ts b/src/app/maindata.service.ts index e079d936..9dea8b3a 100644 --- a/src/app/maindata.service.ts +++ b/src/app/maindata.service.ts @@ -20,7 +20,7 @@ export class MainDataService { public errorReportingSilent = false; public isSpinnerOn$ = new BehaviorSubject<boolean>(false); public progressVisualEnabled = true; - public isApiVersionValid = true; + public isApiValid = true; public appConfig: AppConfig = null; public sysCheckAvailable = false; diff --git a/src/app/test-controller/backend.service.ts b/src/app/test-controller/backend.service.ts index d0d5ef7b..5bc6f8cd 100644 --- a/src/app/test-controller/backend.service.ts +++ b/src/app/test-controller/backend.service.ts @@ -42,7 +42,6 @@ export class BackendService { } getTestData(testId: string): Observable<TestData | boolean> { - console.log('3 ### >' + testId + '<'); return this.http .get<TestData>(this.serverUrl + 'test/' + testId) .pipe( diff --git a/src/app/test-controller/review-dialog/review-dialog.component.html b/src/app/test-controller/review-dialog/review-dialog.component.html index ef969408..98542936 100644 --- a/src/app/test-controller/review-dialog/review-dialog.component.html +++ b/src/app/test-controller/review-dialog/review-dialog.component.html @@ -24,11 +24,11 @@ <mat-checkbox formControlName="design">Gestaltung</mat-checkbox> </div> <mat-form-field> - <textarea matInput formControlName="entry" placeholder="Kommentar" rows="15"></textarea> - <mat-icon matSuffix>mode_edit</mat-icon> + <input matInput formControlName="sender" placeholder="Mein Name"> </mat-form-field> <mat-form-field> - <input matInput formControlName="sender" placeholder="Mein Name"> + <textarea matInput formControlName="entry" placeholder="Kommentar" rows="15"></textarea> + <mat-icon matSuffix>mode_edit</mat-icon> </mat-form-field> </mat-dialog-content> diff --git a/src/app/test-controller/test-config.ts b/src/app/test-controller/test-config.ts index 7db90b27..db071678 100644 --- a/src/app/test-controller/test-config.ts +++ b/src/app/test-controller/test-config.ts @@ -76,6 +76,7 @@ export class TestConfig { for (let childIndex = 0; childIndex < bookletConfigs.length; childIndex++) { const configParameter = bookletConfigs[childIndex].getAttribute('parameter'); + // TODO remove old version switch (bookletConfigs[childIndex].nodeName) { // ---------------------- case 'NavPolicy': @@ -121,6 +122,35 @@ export class TestConfig { } } break; + case 'Config': + const configKey = bookletConfigs[childIndex].getAttribute('key'); + const configValue = bookletConfigs[childIndex].textContent; + if (configKey) { + switch (configKey) { + case 'loading_mode': + this.loading_mode = configValue; + break; + case 'log_mode': + this.log_mode = configValue; + break; + case 'page_navibuttons': + this.page_navibuttons = configValue; + break; + case 'unit_navibuttons': + this.unit_navibuttons = configValue; + break; + case 'unit_menu': + this.unit_menu = configValue; + break; + case 'force_presentation_complete': + this.force_presentation_complete = configValue; + break; + case 'force_responses_complete': + this.force_responses_complete = configValue; + break; + } + } + break; } } } diff --git a/src/app/test-controller/test-controller.classes.ts b/src/app/test-controller/test-controller.classes.ts index b43d4532..af8eea06 100644 --- a/src/app/test-controller/test-controller.classes.ts +++ b/src/app/test-controller/test-controller.classes.ts @@ -191,8 +191,12 @@ export class Testlet extends TestletContentElement { if (this.maxTimeLeft > 0) { myreturn.maxTimerRequiringTestlet = this; } - if (this.title && !isEntryPoint) { - myreturn.testletLabel = this.title + if (!isEntryPoint) { + const label = this.title.trim(); + if (label) { + myreturn.testletLabel = label + } + } } return myreturn; diff --git a/src/app/test-controller/test-controller.component.ts b/src/app/test-controller/test-controller.component.ts index 74b5e0a2..c61ed655 100644 --- a/src/app/test-controller/test-controller.component.ts +++ b/src/app/test-controller/test-controller.component.ts @@ -144,9 +144,8 @@ export class TestControllerComponent implements OnInit, OnDestroy { this.lastTestletIndex += 1; } let testletLabel: string = childElements[childIndex].getAttribute('label'); - if ((typeof testletLabel !== 'undefined') && (testletLabel !== null)) { - testletLabel = testletId; - } + testletLabel = testletLabel ? testletLabel.trim() : ''; + console.log('+ >' + testletLabel + '<'); this.addTestletContentFromBookletXml(targetTestlet.addTestlet(testletId, testletLabel), childElements[childIndex]); } diff --git a/src/app/test-controller/test-status/test-status.component.css b/src/app/test-controller/test-status/test-status.component.css index 4d4782a2..ac64082f 100644 --- a/src/app/test-controller/test-status/test-status.component.css +++ b/src/app/test-controller/test-status/test-status.component.css @@ -17,11 +17,15 @@ mat-card { .active-unit { background-color: #b2ff59; padding: 4px; + overflow: hidden; + text-overflow: ellipsis; } .non-active-unit { background-color: transparent; padding: 4px; + overflow: hidden; + text-overflow: ellipsis; } .testlet-marker-non { @@ -29,7 +33,7 @@ mat-card { } .testlet-marker-a { - background-color: mediumpurple; + background-color: royalblue; } .testlet-marker-b { diff --git a/src/app/test-controller/test-status/test-status.component.html b/src/app/test-controller/test-status/test-status.component.html index 82fb42db..c9cebb3c 100644 --- a/src/app/test-controller/test-status/test-status.component.html +++ b/src/app/test-controller/test-status/test-status.component.html @@ -7,8 +7,8 @@ <div *ngFor="let u of unitMenuButtonList" fxLayout="column" fxLayoutAlign="center stretch"> <div fxLayout="row" fxLayoutAlign="space-between stretch"> <div [class]="u.testletMarker" [matTooltip]="u.testletLabel" fxFlex="0 0 10px"></div> - <div [class]="u.isCurrent ? 'active-unit' : 'non-active-unit'" fxFlex fxLayout="column" fxLayoutAlign="center stretch"> - <button mat-raised-button (click)="tcs.setUnitNavigationRequest(u.sequenceId.toString())"> + <div [class]="u.isCurrent ? 'active-unit' : 'non-active-unit'" fxFlex fxLayout="column"> + <button mat-flat-button (click)="tcs.setUnitNavigationRequest(u.sequenceId.toString())"> {{u.label}} </button> </div> @@ -32,7 +32,7 @@ </p> </mat-card-content> <mat-card-actions> - <button mat-raised-button color="primary" (click)="terminateTest()">{{ 'Test beenden' | customtext:'login_testEndButtonLabel':cts.updateCount}}}</button> + <button mat-raised-button color="primary" (click)="terminateTest()">{{ 'Test beenden' | customtext:'login_testEndButtonLabel':cts.updateCount}}</button> </mat-card-actions> </mat-card> </div> diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 16eec199..bde86f2a 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -2,9 +2,9 @@ export const environment = { production: true, - testcenterUrl: '/', + testcenterUrl: '/api/', appName: 'IQB-Testcenter', appPublisher: 'IQB - Institut zur Qualitätsentwicklung im Bildungswesen', - appVersion: '1.5.3 - 20.2.2020', + appVersion: '2.0.0-beta.1 - 27.4.2020', apiVersionExpected: '2.0.0' }; -- GitLab