fixing type autocomplete

This commit is contained in:
argirok 2022-01-13 16:47:33 +02:00
parent 9c014f8f0b
commit 00db2024b8
1 changed files with 9 additions and 10 deletions

View File

@ -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<AutoCompleteValue[]> {
@ -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<any> {