diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d0efc9eeb300ef9886c72d307271edd438fbb8f2..062ef7edd04c4886a2f1f2ea681557fa4861ea18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ coverage: stage: test script: - docker-compose build - - docker-compose run mc_frontend npm run test + - docker-compose run --entrypoint="npm run test" mc_frontend coverage: '/Statements.*?(\d+(?:\.\d+)?)%/' tags: - node diff --git a/Dockerfile b/Dockerfile index 428de622a918c234402958aae6ce0aee0b9bdaac..467125a34e79359212f1e71b72780e1cc346794f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN ng analytics off RUN npm install COPY . . +COPY ./config.xml ./www/config.xml # workaround to fix the missing binding issue for node-sass RUN npm rebuild node-sass diff --git a/docker-compose.yml b/docker-compose.yml index d84ece0aa4e1ee1c5e342b9594b28d12d2c59b78..ff24eff4ad9495463dac3d67844b419c9634c02a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: build: context: . dockerfile: Dockerfile - entrypoint: ng build --prod + entrypoint: ng build --prod app environment: - CHROME_BIN=google-chrome restart: always @@ -25,7 +25,6 @@ services: volumes: - $PWD/www:/usr/share/nginx/html - ./nginx.conf:/etc/nginx/nginx.conf - - ./config.xml:/usr/share/nginx/html/config.xml depends_on: - mc_frontend networks: diff --git a/package.json b/package.json index d12f4d5424432a42283a4b7650c6820478b64ded..ba2b3e3d2e5baf0b675c7d82e7981a66af28f799 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mc_frontend", - "version": "1.7.3", + "version": "1.7.4", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { diff --git a/src/app/corpus.service.spec.ts b/src/app/corpus.service.spec.ts index 4daddf4fb9c112556b9005762021d39017d0795a..53cacb8d38bfd10cd80e27ceff5f2cb5393bdf84 100644 --- a/src/app/corpus.service.spec.ts +++ b/src/app/corpus.service.spec.ts @@ -271,15 +271,16 @@ describe('CorpusService', () => { })); it('should initialize the update information', (done) => { - corpusService.storage.set(configMC.localStorageKeyUpdateInfo, null).then(() => { - corpusService.initUpdateInfo().then(() => { - corpusService.storage.get(configMC.localStorageKeyUpdateInfo).then((jsonString: string) => { - expect(jsonString).toBeTruthy(); - const setSpy: Spy = spyOn(corpusService.storage, 'set').and.returnValue(Promise.resolve()); - corpusService.initUpdateInfo().then(() => { - expect(setSpy).toHaveBeenCalledTimes(0); - done(); - }); + const updateInfoSpy: Spy = spyOn(corpusService.storage, 'get').withArgs(configMC.localStorageKeyUpdateInfo); + updateInfoSpy.and.returnValue(Promise.resolve('')); + corpusService.initUpdateInfo().then(() => { + updateInfoSpy.and.callThrough(); + corpusService.storage.get(configMC.localStorageKeyUpdateInfo).then((jsonString: string) => { + expect(jsonString).toBeTruthy(); + const setSpy: Spy = spyOn(corpusService.storage, 'set').and.returnValue(Promise.resolve()); + corpusService.initUpdateInfo().then(() => { + expect(setSpy).toHaveBeenCalledTimes(0); + done(); }); }); }); diff --git a/src/app/exercise-parameters/exercise-parameters.page.html b/src/app/exercise-parameters/exercise-parameters.page.html index b91977dbfc9c82a79d4326a3e3a9b1115a8daf74..4c13f21dbe90a4dc0ef664015824e3b7c9b1b47a 100644 --- a/src/app/exercise-parameters/exercise-parameters.page.html +++ b/src/app/exercise-parameters/exercise-parameters.page.html @@ -89,85 +89,102 @@ - - - - - - - - - -
-

- {{ 'INSTRUCTIONS' | translate }} - + {{ 'EXERCISE_FEEDBACK' | translate }}

-
-
-
- - - - - - - - - - - {{ 'EXERCISE_FEEDBACK' | translate }}: - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + +
+

+ {{ 'INSTRUCTIONS' | translate }} + + {{ 'EXERCISE_FEEDBACK' | translate }}

+
+
+
+ + + + + + + + + + + {{ 'EXERCISE_FEEDBACK' | translate }}: + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
{{ 'PREVIEW' | translate }} diff --git a/src/app/exercise-parameters/exercise-parameters.page.ts b/src/app/exercise-parameters/exercise-parameters.page.ts index 8bf323b523e47f442f81c291ef0626b22f131cc5..9e5fdd3322ce2825e1486a9bf07aec942c9bd754 100644 --- a/src/app/exercise-parameters/exercise-parameters.page.ts +++ b/src/app/exercise-parameters/exercise-parameters.page.ts @@ -8,7 +8,7 @@ import { } from '../models/enum'; import {AnnisResponse} from 'src/app/models/annisResponse'; import {NavController, ToastController} from '@ionic/angular'; -import {HttpClient, HttpErrorResponse} from '@angular/common/http'; +import {HttpClient} from '@angular/common/http'; import {Component, OnInit} from '@angular/core'; import {TranslateService} from '@ngx-translate/core'; import {ExerciseService} from 'src/app/exercise.service'; @@ -31,12 +31,13 @@ import configMC from '../../configMC'; export class ExerciseParametersPage implements OnInit { public ExerciseType = ExerciseType; ExerciseTypeTranslation = ExerciseTypeTranslation; + public leftContextSize = 5; public Math = Math; ObjectKeys = Object.keys; Phenomenon = Phenomenon; PhenomenonTranslation = PhenomenonTranslation; + public rightContextSize = 5; showFeedback = false; - textTooLongString: string; constructor(public navCtrl: NavController, public toastCtrl: ToastController, @@ -142,6 +143,8 @@ export class ExerciseParametersPage implements OnInit { getKwicExercise(formData: FormData): Promise { return new Promise((resolve, reject) => { + formData.append('ctx_left', (Math.max(Math.round(this.leftContextSize), 1)).toString()); + formData.append('ctx_right', (Math.max(Math.round(this.rightContextSize), 1)).toString()); const kwicUrl: string = configMC.backendBaseUrl + configMC.backendApiKwicPath; this.helperService.makePostRequest(this.http, this.toastCtrl, kwicUrl, formData).then((svgString: string) => { this.exerciseService.kwicGraphs = svgString; diff --git a/src/app/semantics/semantics.page.ts b/src/app/semantics/semantics.page.ts index 1463c8d998d15277f134501e83dc18bf44d9bcf5..3e9a194c27f4a9c413df6a85dd26c8784902b82c 100644 --- a/src/app/semantics/semantics.page.ts +++ b/src/app/semantics/semantics.page.ts @@ -37,14 +37,9 @@ export class SemanticsPage implements OnInit { return new Promise(resolve => { this.activatedRoute.queryParams.subscribe((params: any) => { if (Object.keys(params).length) { - const paramSearchRegex: string = params.searchRegex; - this.searchRegex = paramSearchRegex ? paramSearchRegex : this.searchRegex; - const paramMinCount: string = params.minCount; - this.minCount = paramMinCount ? +paramMinCount : this.minCount; - const paramNearestNeighborCount: string = params.nearestNeighborCount; - this.nearestNeighborCount = paramNearestNeighborCount ? +paramNearestNeighborCount : this.nearestNeighborCount; - const paramHighlightRegex: string = params.highlightRegex; - this.highlightRegex = paramHighlightRegex ? paramHighlightRegex : this.highlightRegex; + Object.keys(params).forEach((key: string) => { + this[key] = typeof this[key] === 'number' ? +params[key] : params[key]; + }); // dirty hack to get the loading spinner displayed correctly setTimeout(this.updateVectorNetwork.bind(this), 500); } diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 08e975eadafcb3e5cb3cd021c5eba7b4452819ca..ea465e15ac834378c7437d0690da372fd9beb04e 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -226,6 +226,7 @@ "INVALID_TEXT_RANGE": "Ungültige Textauswahl", "KWIC": "Beispielkontexte", "LANGUAGE_CHANGE": "Sprache wählen", + "LEFT_CONTEXT_SIZE": "Kontextwörter links", "LINK_COPIED": "Link kopiert", "MACHINA_CALLIDA": "Machina Callida", "MACHINA_CALLIDA_BACKEND": "Machina Callida Backend", @@ -278,6 +279,7 @@ "RESEARCH_STUDIES_3": "im Lateinunterricht der älteren Fortgeschrittenen (Oberstufe) ebenfalls die Studien zu Ovid und Cicero", "RESEARCH_STUDIES_4": "eine Testung der computergestützten Übungsformate (MC) durch Studierende der Klassischen Philologie (Dez. 2018)", "RESULT": "Ergebnis", + "RIGHT_CONTEXT_SIZE": "Kontextwörter rechts", "SEARCH": "Suche", "SEARCH_REGEX_MISSING": "Bitte Suchanfrage eingeben...", "SEMANTICS": "Semantik", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index b3b11371a0ab57f868ac20a4094657107e447935..40370cae3fa5844572958401cc34f5d840718203 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -226,6 +226,7 @@ "INVALID_TEXT_RANGE": "Invalid text range", "KWIC": "Keyword in context", "LANGUAGE_CHANGE": "Choose language", + "LEFT_CONTEXT_SIZE": "Context words left", "LINK_COPIED": "Link copied", "MACHINA_CALLIDA": "Machina Callida", "MACHINA_CALLIDA_BACKEND": "Machina Callida Backend", @@ -278,6 +279,7 @@ "RESEARCH_STUDIES_3": "in the Latin classes of the older advanced students (upper level) also the studies to Ovid and Cicero", "RESEARCH_STUDIES_4": "a test of the computer-aided exercise formats (MC) by students of classical philology (Dec. 2018)", "RESULT": "Result", + "RIGHT_CONTEXT_SIZE": "Context words right", "SEARCH": "Search", "SEARCH_REGEX_MISSING": "Please provide search query...", "SEMANTICS": "Semantics",