diff --git a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.html b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.html index 4d74c6c63..0b12f3c2e 100644 --- a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.html +++ b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.html @@ -35,7 +35,7 @@ - No results found! + No results found! diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component.ts index c0b206553..3d21e286e 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/prefill-dataset/prefill-dataset.component.ts @@ -1,10 +1,10 @@ import {Component, Inject, OnInit} from "@angular/core"; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; -import {takeUntil} from "rxjs/operators"; +import {map, takeUntil} from "rxjs/operators"; import {ProgressIndicationService} from "@app/core/services/progress-indication/progress-indication-service"; import {BaseComponent} from "@common/base/base.component"; import {SingleAutoCompleteConfiguration} from "@app/library/auto-complete/single/single-auto-complete-configuration"; -import {Observable} from "rxjs"; +import {Observable, of} from "rxjs"; import {Prefilling} from "@app/core/model/dataset/prefilling"; import {PrefillingService} from "@app/core/services/prefilling.service"; import {FormBuilder, FormGroup, Validators} from "@angular/forms"; @@ -44,7 +44,7 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit { } this.prefillAutoCompleteConfiguration = { filterFn: this.searchDatasets.bind(this), - initialItems: (extraData) => this.searchDatasets(''), + loadDataOnStart: false, displayFn: (item) => (item['name'].length > 60)?(item['name'].substr(0, 60) + "..." ):item['name'], titleFn: (item) => item['name'], subtitleFn: (item) => item['pid'] @@ -56,7 +56,15 @@ export class PrefillDatasetComponent extends BaseComponent implements OnInit { } searchDatasets(query: string): Observable { - return this.prefillingService.getPrefillingList(query, this.configId); + return this.prefillingService.getPrefillingList(query, this.configId).pipe(map(prefilling => prefilling.sort((a, b) => { + if(a.name > b.name) { + return 1; + } else if(a.name < b.name) { + return -1; + } else { + return 0; + } + }))); } next() {