From 00db2024b87d2e8c1f5c64380f0102d1136b39cf Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 13 Jan 2022 16:47:33 +0200 Subject: [PATCH] fixing type autocomplete --- .../ISVocabularies.service.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/utils/staticAutoComplete/ISVocabularies.service.ts b/utils/staticAutoComplete/ISVocabularies.service.ts index bae49d72..98581d05 100644 --- a/utils/staticAutoComplete/ISVocabularies.service.ts +++ b/utils/staticAutoComplete/ISVocabularies.service.ts @@ -50,8 +50,7 @@ export class ISVocabulariesService { } else if (field == "type" && (entity == "software" || entity == "other")) { return of([]); } else if (field == "type" && entity == "result" ) { - //return Observable.zip(this.getVocabularyFromService("dnet:publication_resource.json", properties),this.getVocabularyFromService("dnet:dataCite_resource.json", properties)); - return zip(from(this.getVocabularyFromServiceAsync("dnet:publication_resource.json", properties)),from(this.getVocabularyFromServiceAsync("dnet:dataCite_resource.json", properties))); + return zip(this.getVocabularyFromService("dnet:publication_resource.json", properties),this.getVocabularyFromService("dnet:dataCite_resource.json", properties)); } else if (field == "access" && (entity == "publication" || entity == "dataset" || entity == "software" || entity == "other" || entity == "result")) { // file= "accessMode.json"; // return this.getVocabularyFromFile(file); @@ -64,24 +63,24 @@ export class ISVocabulariesService { vocabulary = "dnet:datasource_typologies.json"; //return this.getVocabularyFromService(vocabulary, properties); return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); - + } else if (field == "compatibility" && (entity == "dataprovider")) { // file = "dataProviderCompatibility.json"; // return this.getVocabularyFromFile(file); vocabulary = "dnet:datasourceCompatibilityLevel.json"; //return this.getVocabularyFromService(vocabulary, properties); return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); - + } else if (field == "country") { // file = "countries.json"; // return this.getVocabularyFromFile(file); vocabulary = "dnet:countries.json"; //return this.getVocabularyFromService(vocabulary, properties); return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); - + } return null; - + } async getVocabularyFromServiceAsync(vocabularyName: string, properties: EnvProperties): Promise { @@ -112,9 +111,9 @@ export class ISVocabulariesService { .pipe(map(res => res['terms'])) .pipe(map(res => this.parse(res, vocabularyName))) .pipe(catchError(this.handleError)); - + } - + parse(data: any, vocabularyName: string): AutoCompleteValue[] { var array: AutoCompleteValue[] = [] for (var i = 0; i < data.length; i++) { @@ -126,9 +125,9 @@ export class ISVocabulariesService { value.label = data[i].englishName; array.push(value); } - + return array; - + } getProvenanceActionVocabulary(properties: EnvProperties): Observable {