Commit 00df96d4 authored by Konstantin Schulz's avatar Konstantin Schulz

introducing RxJS with its Observable/Subject syntax to make the access to...

introducing RxJS with its Observable/Subject syntax to make the access to remote data (incl. cache) more uniform and consistent
parent 71c4de41
{ {
"name": "mc_frontend", "name": "mc_frontend",
"version": "1.4.8", "version": "1.5.0",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "https://ionicframework.com/", "homepage": "https://ionicframework.com/",
"scripts": { "scripts": {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</div> </div>
</ion-buttons> </ion-buttons>
<ion-spinner *ngIf="HelperService.isLoading"></ion-spinner> <ion-spinner *ngIf="HelperService.isLoading"></ion-spinner>
<ion-title>{{ corpusService.currentAuthor?.name }}</ion-title> <ion-title *ngIf="HelperService.applicationState | async as state">{{ state.currentSetup.currentAuthor?.name }}</ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-menu-button autoHide="false"></ion-menu-button> <ion-menu-button autoHide="false"></ion-menu-button>
</ion-buttons> </ion-buttons>
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
<ion-content padding> <ion-content padding>
<ion-list *ngIf="HelperService.applicationState | async as state">
<ion-list> <ion-item *ngFor="let corpus of state.currentSetup.currentAuthor?.corpora">
<ion-item *ngFor="let corpus of corpusService.currentAuthor?.corpora">
<button (click)="showPossibleReferences(corpus)"> <button (click)="showPossibleReferences(corpus)">
<span>{{corpus.title}}</span> <span>{{corpus.title}}</span>
</button> </button>
......
...@@ -5,7 +5,6 @@ import {TranslateService} from '@ngx-translate/core'; ...@@ -5,7 +5,6 @@ import {TranslateService} from '@ngx-translate/core';
import {HelperService} from '../helper.service'; import {HelperService} from '../helper.service';
import {CorpusService} from 'src/app/corpus.service'; import {CorpusService} from 'src/app/corpus.service';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {TextRange} from 'src/app/models/textRange';
@Component({ @Component({
selector: 'app-author-detail', selector: 'app-author-detail',
...@@ -22,8 +21,7 @@ export class AuthorDetailPage { ...@@ -22,8 +21,7 @@ export class AuthorDetailPage {
} }
showPossibleReferences(corpus: CorpusMC) { showPossibleReferences(corpus: CorpusMC) {
this.corpusService.currentCorpus = corpus; this.corpusService.saveNewCorpus(corpus);
this.corpusService.currentTextRange = new TextRange({start: ['', '', ''], end: ['', '', '']});
HelperService.goToTextRangePage(this.navCtrl).then(); HelperService.goToTextRangePage(this.navCtrl).then();
} }
} }
...@@ -23,17 +23,26 @@ ...@@ -23,17 +23,26 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
<ion-row *ngIf="HelperService.mostRecentSetup?.currentCorpus && HelperService.mostRecentSetup?.currentUrn"> <div *ngIf="HelperService.applicationState | async as state">
<ion-row
*ngIf="state.mostRecentSetup && state.mostRecentSetup.currentCorpus && state.mostRecentSetup.currentUrn; else noEntryFound">
<ion-col> <ion-col>
<a (click)="restoreLastSetup()">{{ [HelperService.mostRecentSetup.currentCorpus.author, <a (click)="restoreLastSetup()">
HelperService.mostRecentSetup.currentCorpus.title, {{ [state.mostRecentSetup.currentCorpus.author, state.mostRecentSetup.currentCorpus.title,
HelperService.mostRecentSetup.currentUrn?.split(":").slice(-1)[0]].join(", ") }}</a> state.mostRecentSetup.currentUrn?.split(":").slice(-1)[0]].join(", ") }}
</a>
</ion-col> </ion-col>
</ion-row> </ion-row>
<ng-template #noEntryFound>
<ion-row>
<ion-col>{{ "NO_ENTRY_FOUND" | translate }}</ion-col>
</ion-row>
</ng-template>
</div>
<ion-row> <ion-row>
<ion-col> <ion-col>
<label> <label>
<input type="checkbox" [(ngModel)]="showOnlyTreebanks" (change)="toggleTreebankAuthors()" /> <input type="checkbox" [(ngModel)]="showOnlyTreebanks" (change)="toggleTreebankAuthors()"/>
<span class="checkbox">{{ 'AUTHOR_SHOW_ONLY_TREEBANKS' | translate}}</span> <span class="checkbox">{{ 'AUTHOR_SHOW_ONLY_TREEBANKS' | translate}}</span>
</label> </label>
</ion-col> </ion-col>
...@@ -43,7 +52,7 @@ ...@@ -43,7 +52,7 @@
<label> <label>
<ion-icon name="search" class="search"></ion-icon> <ion-icon name="search" class="search"></ion-icon>
<input type="search" (ngModelChange)="getAuthors($event.toString())" <input type="search" (ngModelChange)="getAuthors($event.toString())"
placeholder="{{ 'AUTHOR_SEARCH' | translate }}" [(ngModel)]="currentSearchValue" /> placeholder="{{ 'AUTHOR_SEARCH' | translate }}" [(ngModel)]="currentSearchValue"/>
</label> </label>
</ion-col> </ion-col>
</ion-row> </ion-row>
......
...@@ -6,6 +6,9 @@ import {CorpusService} from 'src/app/corpus.service'; ...@@ -6,6 +6,9 @@ import {CorpusService} from 'src/app/corpus.service';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {HelperService} from '../helper.service'; import {HelperService} from '../helper.service';
import {ExerciseService} from '../exercise.service'; import {ExerciseService} from '../exercise.service';
import {ApplicationState} from '../models/applicationState';
import {Observable} from 'rxjs';
import {take} from 'rxjs/operators';
/** /**
* Generated class for the AuthorPage page. * Generated class for the AuthorPage page.
...@@ -71,9 +74,11 @@ export class AuthorPage { ...@@ -71,9 +74,11 @@ export class AuthorPage {
showCorpora(author: Author) { showCorpora(author: Author) {
this.corpusService.currentAuthor = author; this.corpusService.currentAuthor = author;
HelperService.mostRecentSetup.currentAuthor = author; HelperService.applicationState.pipe(take(1)).subscribe((as: ApplicationState) => {
this.helperService.saveMostRecentSetup().then(); as.currentSetup.currentAuthor = author;
this.helperService.saveApplicationState(as).then();
this.navCtrl.navigateForward('/author-detail').then(); this.navCtrl.navigateForward('/author-detail').then();
});
} }
toggleTreebankAuthors() { toggleTreebankAuthors() {
......
...@@ -15,7 +15,7 @@ import { ...@@ -15,7 +15,7 @@ import {
DependencyValue, DependencyValue,
ExerciseType, ExerciseType,
ExerciseTypeTranslation, ExerciseTypeTranslation,
InstructionsTranslation, MoodleExerciseType, InstructionsTranslation,
PartOfSpeechTranslation, PartOfSpeechTranslation,
PartOfSpeechValue, PartOfSpeechValue,
Phenomenon Phenomenon
...@@ -27,7 +27,10 @@ import {Exercise} from 'src/app/models/exercise'; ...@@ -27,7 +27,10 @@ import {Exercise} from 'src/app/models/exercise';
import {Feedback} from 'src/app/models/feedback'; import {Feedback} from 'src/app/models/feedback';
import {PhenomenonMap, PhenomenonMapContent} from 'src/app/models/phenomenonMap'; import {PhenomenonMap, PhenomenonMapContent} from 'src/app/models/phenomenonMap';
import {FrequencyItem} from 'src/app/models/frequencyItem'; import {FrequencyItem} from 'src/app/models/frequencyItem';
import {ExerciseMC} from 'src/app/models/exerciseMC'; import {BehaviorSubject, ReplaySubject} from 'rxjs';
import {ApplicationState} from './models/applicationState';
import {take} from 'rxjs/operators';
import {TextData} from './models/textData';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
...@@ -40,9 +43,11 @@ export class CorpusService { ...@@ -40,9 +43,11 @@ export class CorpusService {
public citationsUnavailableString: string; public citationsUnavailableString: string;
public corporaUnavailableString: string; public corporaUnavailableString: string;
public currentAuthor: Author; public currentAuthor: Author;
public currentCorpus: CorpusMC; public currentCorpus: ReplaySubject<CorpusMC>;
private currentCorpusCache: CorpusMC;
public currentText = ''; public currentText = '';
public currentTextRange: TextRange = new TextRange({start: ['', '', ''], end: ['', '', '']}); public currentTextRange: ReplaySubject<TextRange>;
private currentTextRangeCache: TextRange = new TextRange({start: ['', '', ''], end: ['', '', '']});
public currentUrn: string; public currentUrn: string;
public exercise: Exercise = new Exercise({ public exercise: Exercise = new Exercise({
type: ExerciseType.cloze, type: ExerciseType.cloze,
...@@ -71,16 +76,18 @@ export class CorpusService { ...@@ -71,16 +76,18 @@ export class CorpusService {
public helperService: HelperService, public helperService: HelperService,
) { ) {
this.isMostRecentSetupLoaded = false; this.isMostRecentSetupLoaded = false;
this.helperService.initApplicationState();
this.initCurrentCorpus();
this.initCurrentTextRange();
HelperService.waitForConfig().then(() => { HelperService.waitForConfig().then(() => {
this.checkForUpdates().then(() => { this.checkForUpdates().finally(() => {
this.checkAnnisResponse().then(() => { this.checkAnnisResponse().then(() => {
this.restoreLastCorpus().then(() => { this.restoreLastCorpus().then(() => {
this.isMostRecentSetupLoaded = true; this.isMostRecentSetupLoaded = true;
}, () => {
}); });
}, () => { }, () => {
this.isMostRecentSetupLoaded = true;
}); });
}, () => {
}); });
}); });
this.initPhenomenonMap(); this.initPhenomenonMap();
...@@ -122,12 +129,16 @@ export class CorpusService { ...@@ -122,12 +129,16 @@ export class CorpusService {
if (this.annisResponse) { if (this.annisResponse) {
return outerResolve(); return outerResolve();
} }
this.helperService.loadMostRecentSetup().then(() => { HelperService.applicationState.pipe(take(1)).subscribe((state: ApplicationState) => {
this.annisResponse = HelperService.mostRecentSetup.annisResponse; if (state.mostRecentSetup) {
this.currentAuthor = HelperService.mostRecentSetup.currentAuthor; this.annisResponse = state.mostRecentSetup.annisResponse;
this.currentUrn = HelperService.mostRecentSetup.currentUrn; this.currentAuthor = state.mostRecentSetup.currentAuthor;
this.currentCorpus = HelperService.mostRecentSetup.currentCorpus; this.currentUrn = state.mostRecentSetup.currentUrn;
this.currentCorpusCache = state.mostRecentSetup.currentCorpus;
return outerResolve(); return outerResolve();
} else {
return outerReject();
}
}, () => { }, () => {
return outerReject(); return outerReject();
}); });
...@@ -212,8 +223,10 @@ export class CorpusService { ...@@ -212,8 +223,10 @@ export class CorpusService {
HelperService.makeGetRequest(this.http, this.toastCtrl, url, params).then((fis: FrequencyItem[]) => { HelperService.makeGetRequest(this.http, this.toastCtrl, url, params).then((fis: FrequencyItem[]) => {
HelperService.isLoading = false; HelperService.isLoading = false;
this.annisResponse.frequency_analysis = fis; this.annisResponse.frequency_analysis = fis;
HelperService.mostRecentSetup.annisResponse = this.annisResponse; HelperService.applicationState.pipe(take(1)).subscribe((as: ApplicationState) => {
this.helperService.saveMostRecentSetup().then(); as.mostRecentSetup.annisResponse = this.annisResponse;
this.helperService.saveApplicationState(as).then();
});
return resolve(); return resolve();
}, () => { }, () => {
return reject(); return reject();
...@@ -281,6 +294,27 @@ export class CorpusService { ...@@ -281,6 +294,27 @@ export class CorpusService {
this.translate.get('LINK_COPIED').subscribe(value => this.shareLinkCopiedString = value); this.translate.get('LINK_COPIED').subscribe(value => this.shareLinkCopiedString = value);
} }
initCurrentCorpus(): void {
this.currentCorpus = new ReplaySubject<CorpusMC>(1);
if (!this.currentCorpusCache) {
HelperService.applicationState.subscribe((as: ApplicationState) => {
const textData: TextData = as.currentSetup ? as.currentSetup : as.mostRecentSetup;
this.currentCorpusCache = textData ? textData.currentCorpus : null;
this.currentCorpus.next(this.currentCorpusCache);
});
} else {
this.currentCorpus.next(this.currentCorpusCache);
}
}
initCurrentTextRange(): void {
this.currentTextRange = new ReplaySubject<TextRange>(1);
HelperService.applicationState.pipe(take(1)).subscribe((state: ApplicationState) => {
this.currentTextRangeCache = state.currentSetup.currentTextRange;
this.currentTextRange.next(this.currentTextRangeCache);
});
}
initPhenomenonMap() { initPhenomenonMap() {
// map the different phenomena to their respective Enum for processing and display/translation // map the different phenomena to their respective Enum for processing and display/translation
Object.keys(Phenomenon).forEach((key) => { Object.keys(Phenomenon).forEach((key) => {
...@@ -336,9 +370,11 @@ export class CorpusService { ...@@ -336,9 +370,11 @@ export class CorpusService {
}); });
this.annisResponse = ar; this.annisResponse = ar;
if (saveToCache) { if (saveToCache) {
HelperService.mostRecentSetup.currentUrn = this.currentUrn; HelperService.applicationState.pipe(take(1)).subscribe((as: ApplicationState) => {
HelperService.mostRecentSetup.annisResponse = ar; as.currentSetup.currentUrn = this.currentUrn;
this.helperService.saveMostRecentSetup().then(); as.currentSetup.annisResponse = ar;
this.helperService.saveApplicationState(as).then();
});
} }
} }
...@@ -404,26 +440,54 @@ export class CorpusService { ...@@ -404,26 +440,54 @@ export class CorpusService {
restoreLastCorpus() { restoreLastCorpus() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.annisResponse = HelperService.mostRecentSetup.annisResponse; HelperService.applicationState.pipe(take(1)).subscribe((state: ApplicationState) => {
this.currentUrn = HelperService.mostRecentSetup.currentUrn; this.annisResponse = state.mostRecentSetup.annisResponse;
this.currentCorpus = HelperService.mostRecentSetup.currentCorpus; this.currentUrn = state.mostRecentSetup.currentUrn;
this.currentTextRange = HelperService.mostRecentSetup.currentTextRange; this.currentCorpusCache = state.mostRecentSetup.currentCorpus;
this.currentTextRangeCache = state.mostRecentSetup.currentTextRange;
this.isTextRangeCorrect = true; this.isTextRangeCorrect = true;
if (this.annisResponse && this.annisResponse.nodes.length) { if (this.annisResponse && this.annisResponse.nodes.length) {
this.processAnnisResponse(this.annisResponse, false); this.processAnnisResponse(this.annisResponse, false);
} return resolve();
} else if (this.currentText) {
// check if the data is already present // check if the data is already present
if (this.currentText) {
return resolve(); return resolve();
} } else {
const saveToCache: boolean = !HelperService.mostRecentSetup.annisResponse || const saveToCache: boolean = !state.mostRecentSetup.annisResponse || !state.mostRecentSetup.annisResponse.nodes.length;
!HelperService.mostRecentSetup.annisResponse.nodes.length;
this.getText(saveToCache).then(() => { this.getText(saveToCache).then(() => {
return resolve(); return resolve();
}, () => { }, () => {
return reject(); return reject();
}); });
}
}); });
});
}
saveNewCorpus(corpus: CorpusMC): void {
this.currentCorpusCache = corpus;
this.currentCorpus.next(this.currentCorpusCache);
this.setCurrentTextRange(-1, null, new TextRange({start: ['', '', ''], end: ['', '', '']}));
HelperService.applicationState.pipe(take(1)).subscribe((state: ApplicationState) => {
state.currentSetup.currentCorpus = corpus;
HelperService.applicationState.next(state);
});
}
setCurrentTextRange(inputId: number = -1, newValue: string = null, tr: TextRange = null): void {
if (tr) {
this.currentTextRangeCache = tr;
} else if (inputId >= 0) {
const isStart: boolean = inputId < 4;
const targetInputId = `input${inputId}`;
if (newValue === null) {
newValue = document.querySelector<HTMLInputElement>(`#${targetInputId}`).value;
}
const trIdx: number = inputId - (isStart ? 1 : 4);
const relevantTextRangePart: string[] = isStart ? this.currentTextRangeCache.start : this.currentTextRangeCache.end;
relevantTextRangePart[trIdx] = newValue;
}
this.currentTextRange.next(this.currentTextRangeCache);
} }
updateBaseWord(query: QueryMC, queryIndex: number) { updateBaseWord(query: QueryMC, queryIndex: number) {
......
...@@ -60,24 +60,22 @@ ...@@ -60,24 +60,22 @@
</ion-col> </ion-col>
<ion-col> <ion-col>
<ng-container <ng-container
*ngIf="[ExerciseType.matching].indexOf(corpusService.exercise.type) === -1; else matching"> *ngIf="corpusService.exercise.type === ExerciseType.matching; else notMatching">
<label> <label>
<h2 class="label">{{ 'QUERY_VALUE' | translate }}</h2> <h2 class="label">{{ 'QUERY_VALUE' | translate }}</h2>
<select [(ngModel)]="query.values" name="queryValue" multiple <select [(ngModel)]="query.values[0]" name="queryValue"
size="{{Math.min(corpusService.getSortedQueryValues(query, i).length, 20)}}"> (change)="corpusService.updateBaseWord(query, i)">
<option *ngFor="let key of corpusService.getSortedQueryValues(query, i)" <option *ngFor="let key of corpusService.getSortedQueryValues(query, i)"
[value]=key>{{ getDisplayValue(query, key, i) }} [value]=key>{{ getDisplayValue(query, key, i) }}
</option> </option>
</select> </select>
</label> </label>
</ng-container> </ng-container>
<ng-template #matching> <ng-template #notMatching>
<label> <label>
<h2 class="label"> <h2 class="label">{{ 'QUERY_VALUE' | translate }}</h2>
{{ 'QUERY_VALUE' | translate }} <select [(ngModel)]="query.values" name="queryValue" multiple
</h2> size="{{Math.min(corpusService.getSortedQueryValues(query, i).length, 20)}}">
<select [(ngModel)]="query.values[0]" name="queryValue"
(change)="corpusService.updateBaseWord(query, i)">
<option *ngFor="let key of corpusService.getSortedQueryValues(query, i)" <option *ngFor="let key of corpusService.getSortedQueryValues(query, i)"
[value]=key>{{ getDisplayValue(query, key, i) }} [value]=key>{{ getDisplayValue(query, key, i) }}
</option> </option>
...@@ -116,8 +114,7 @@ ...@@ -116,8 +114,7 @@
<ion-col> <ion-col>
<label> <label>
<input [(ngModel)]="corpusService.exercise.instructionsTranslation" <input [(ngModel)]="corpusService.exercise.instructionsTranslation"
type="text" type="text" name="instructionsTranslation"/>
name="instructionsTranslation"/>
</label> </label>
</ion-col> </ion-col>
</ion-row> </ion-row>
......
...@@ -17,6 +17,10 @@ import {CorpusService} from 'src/app/corpus.service'; ...@@ -17,6 +17,10 @@ import {CorpusService} from 'src/app/corpus.service';
import {QueryMC} from 'src/app/models/queryMC'; import {QueryMC} from 'src/app/models/queryMC';
import {PhenomenonMapContent} from 'src/app/models/phenomenonMap'; import {PhenomenonMapContent} from 'src/app/models/phenomenonMap';
import {FrequencyItem} from 'src/app/models/frequencyItem'; import {FrequencyItem} from 'src/app/models/frequencyItem';
import {CorpusMC} from '../models/corpusMC';
import {ApplicationState} from '../models/applicationState';
import {take} from 'rxjs/operators';
import {TextRange} from '../models/textRange';
@Component({ @Component({
selector: 'app-exercise-parameters', selector: 'app-exercise-parameters',
...@@ -107,10 +111,10 @@ export class ExerciseParametersPage implements OnInit { ...@@ -107,10 +111,10 @@ export class ExerciseParametersPage implements OnInit {
const values: string[] = this.corpusService.exercise.queryItems[0].values as string[]; const values: string[] = this.corpusService.exercise.queryItems[0].values as string[];
instructions += ` [${values.map(x => pmc.translationValues[x]).join(', ')}]`; instructions += ` [${values.map(x => pmc.translationValues[x]).join(', ')}]`;
} }
this.corpusService.currentCorpus.pipe(take(1)).subscribe((cc: CorpusMC) => {
this.corpusService.currentTextRange.pipe(take(1)).subscribe((tr: TextRange) => {
// TODO: change the corpus title to something meaningful, e.g. concatenate user ID and wanted exercise title // TODO: change the corpus title to something meaningful, e.g. concatenate user ID and wanted exercise title
const workTitle: string = this.corpusService.currentCorpus.title + ', ' + const workTitle: string = cc.title + ', ' + tr.start.filter(x => x).join('.') + '-' + tr.end.filter(x => x).join('.');
this.corpusService.currentTextRange.start.filter(x => x).join('.') + '-' +
this.corpusService.currentTextRange.end.filter(x => x).join('.');
formData.append('work_title', workTitle); formData.append('work_title', workTitle);
formData.append('type', MoodleExerciseType[this.corpusService.exercise.type]); formData.append('type', MoodleExerciseType[this.corpusService.exercise.type]);
formData.append('type_translation', this.corpusService.exercise.typeTranslation); formData.append('type_translation', this.corpusService.exercise.typeTranslation);
...@@ -119,8 +123,10 @@ export class ExerciseParametersPage implements OnInit { ...@@ -119,8 +123,10 @@ export class ExerciseParametersPage implements OnInit {
formData.append('partially_correct_feedback', this.corpusService.exercise.feedback.partiallyCorrect); formData.append('partially_correct_feedback', this.corpusService.exercise.feedback.partiallyCorrect);
formData.append('incorrect_feedback', this.corpusService.exercise.feedback.incorrect); formData.append('incorrect_feedback', this.corpusService.exercise.feedback.incorrect);
formData.append('general_feedback', this.corpusService.exercise.feedback.general); formData.append('general_feedback', this.corpusService.exercise.feedback.general);
formData.append('work_author', this.corpusService.currentCorpus.author); formData.append('work_author', cc.author);
this.getH5Pexercise(formData); this.getH5Pexercise(formData);
});
});
} }
getH5Pexercise(formData: FormData) { getH5Pexercise(formData: FormData) {
...@@ -131,12 +137,14 @@ export class ExerciseParametersPage implements OnInit { ...@@ -131,12 +137,14 @@ export class ExerciseParametersPage implements OnInit {
HelperService.isLoading = false; HelperService.isLoading = false;
// save the old frequency analysis in case we want to change the exercise parameters at a later time // save the old frequency analysis in case we want to change the exercise parameters at a later time
ar.frequency_analysis = this.corpusService.annisResponse.frequency_analysis; ar.frequency_analysis = this.corpusService.annisResponse.frequency_analysis;
HelperService.mostRecentSetup.annisResponse = ar; HelperService.applicationState.pipe(take(1)).subscribe((as: ApplicationState) => {
this.helperService.saveMostRecentSetup().then(); as.mostRecentSetup.annisResponse = ar;
this.helperService.saveApplicationState(as).then();
this.corpusService.annisResponse.exercise_id = ar.exercise_id; this.corpusService.annisResponse.exercise_id = ar.exercise_id;
this.corpusService.annisResponse.uri = ar.uri; this.corpusService.annisResponse.uri = ar.uri;
this.corpusService.annisResponse.solutions = ar.solutions; this.corpusService.annisResponse.solutions = ar.solutions;
HelperService.goToPreviewPage(this.navCtrl).then(); HelperService.goToPreviewPage(this.navCtrl).then();
});
}, async (error: HttpErrorResponse) => { }, async (error: HttpErrorResponse) => {
HelperService.isLoading = false; HelperService.isLoading = false;
HelperService.currentError = error; HelperService.currentError = error;
......
...@@ -16,7 +16,6 @@ window.onresize = () => { ...@@ -16,7 +16,6 @@ window.onresize = () => {
}) })
export class ExerciseService { export class ExerciseService {
public excludeOOV = false; public excludeOOV = false;
public exerciseTypePath: string;
public fillBlanksString = 'fill_blanks'; public fillBlanksString = 'fill_blanks';
public h5pIframeString = '#h5p-iframe-1'; public h5pIframeString = '#h5p-iframe-1';
public kwicGraphs: string; public kwicGraphs: string;
......
...@@ -9,6 +9,8 @@ import {HttpClient, HttpParams} from '@angular/common/http'; ...@@ -9,6 +9,8 @@ import {HttpClient, HttpParams} from '@angular/common/http';
import {AnnisResponse} from 'src/app/models/annisResponse'; import {AnnisResponse} from 'src/app/models/annisResponse';
import {ExerciseType, MoodleExerciseType} from 'src/app/models/enum'; import {ExerciseType, MoodleExerciseType} from 'src/app/models/enum';
import {CorpusService} from 'src/app/corpus.service'; import {CorpusService} from 'src/app/corpus.service';
import {ApplicationState} from '../models/applicationState';
import {take} from 'rxjs/operators';
@Component({ @Component({
selector: 'app-exercise', selector: 'app-exercise',
...@@ -38,8 +40,9 @@ export class ExercisePage implements OnInit { ...@@ -38,8 +40,9 @@ export class ExercisePage implements OnInit {
let url: string = HelperService.config['backendBaseUrl'] + HelperService.config['backendApiExercisePath']; let url: string = HelperService.config['backendBaseUrl'] + HelperService.config['backendApiExercisePath'];
const httpParams: HttpParams = new HttpParams().set('eid', params['eid']); const httpParams: HttpParams = new HttpParams().set('eid', params['eid']);