Fix bug on dmp editor that prevented request grants on funder change (change on single autocomplete component to be reviewed)
This commit is contained in:
parent
f5d5835edb
commit
06f156c687
|
@ -32,6 +32,8 @@ export interface SingleAutoCompleteConfiguration {
|
|||
// Selected value formating template
|
||||
selectedValueTemplate?: TemplateRef<any>;
|
||||
|
||||
// To revert: "We set the items observable on focus to avoid the request being executed on component load."
|
||||
forceFocus?: boolean;
|
||||
|
||||
autoSelectFirstOptionOnBlur?: boolean;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
|
|||
|
||||
_onInputFocus() {
|
||||
// We set the items observable on focus to avoid the request being executed on component load.
|
||||
if (!this._items) {
|
||||
if (!this._items || this.forceFocus) {
|
||||
this._items = this._inputSubject.pipe(
|
||||
startWith(null),
|
||||
debounceTime(this.requestDelay),
|
||||
|
@ -321,4 +321,8 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
|
|||
get autoSelectFirstOptionOnBlur(): boolean {
|
||||
return this.configuration.autoSelectFirstOptionOnBlur != null ? this.configuration.autoSelectFirstOptionOnBlur : false;
|
||||
}
|
||||
|
||||
get forceFocus(): boolean {
|
||||
return this.configuration.forceFocus != null ? this.configuration.forceFocus : false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ export class DatasetEditorComponent extends BaseComponent {
|
|||
|
||||
public restartTour(label: string): void {
|
||||
this.setDashboardTourDmp(label);
|
||||
// console.log(this.dashboardTourDmp.steps[0].selector);
|
||||
this.guidedTourService.startTour(this.dashboardTourDmp);
|
||||
|
||||
}
|
||||
|
|
|
@ -141,7 +141,6 @@ export class DatasetEditorDetailsComponent extends BaseComponent implements OnIn
|
|||
|
||||
public restartTour(label: string): void {
|
||||
this.setDashboardTourDmp(label);
|
||||
// console.log(this.dashboardTourDmp.steps[0].selector);
|
||||
this.guidedTourService.startTour(this.dashboardTourDmp);
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
isCreateNewProject = false;
|
||||
isCreateNewFunder = false;
|
||||
grant: GrantTabModel;
|
||||
forceFocus = false;
|
||||
|
||||
grantAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
projectAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
|
@ -98,8 +99,10 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
initialItems: () => this.searchGrant(''),
|
||||
displayFn: (item) => item['label'] + this.getGrantIdText(item),
|
||||
titleFn: (item) => item['label'] + this.getGrantIdText(item),
|
||||
subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE'))
|
||||
};
|
||||
subtitleFn: (item) => item['source'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')),
|
||||
forceFocus: this.forceFocus,
|
||||
}
|
||||
// this.forceFocus = false;
|
||||
|
||||
this.projectAutoCompleteConfiguration = {
|
||||
filterFn: this.searchProject.bind(this),
|
||||
|
@ -116,7 +119,6 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
grantRequestItem.criteria.like = query;
|
||||
if (this.funderFormGroup.get('existFunder').value) {
|
||||
grantRequestItem.criteria.funderReference = this.funderFormGroup.controls['existFunder'].value.reference;
|
||||
console.log(grantRequestItem);
|
||||
}
|
||||
return this.grantService.getWithExternal(grantRequestItem);
|
||||
}
|
||||
|
@ -237,8 +239,8 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
|| (funder.existFunder !== null && funder.existFunder !== undefined && funder.existFunder.id !== undefined)) {
|
||||
this.grantformGroup.reset();
|
||||
this.grantformGroup.enable();
|
||||
this.forceFocus = true;
|
||||
this.setGrantValidators();
|
||||
// this.grantformGroup.updateValueAndValidity();
|
||||
} else {
|
||||
this.grantformGroup.reset();
|
||||
this.grantformGroup.disable();
|
||||
|
|
Loading…
Reference in New Issue