|
|
|
@ -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<Prefilling[]> {
|
|
|
|
|
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() {
|
|
|
|
|