diff --git a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete-configuration.ts b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete-configuration.ts index dad7fcf59..fbb609e3c 100644 --- a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete-configuration.ts +++ b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete-configuration.ts @@ -32,6 +32,8 @@ export interface SingleAutoCompleteConfiguration { // Selected value formating template selectedValueTemplate?: TemplateRef; + // To revert: "We set the items observable on focus to avoid the request being executed on component load." + forceFocus?: boolean; autoSelectFirstOptionOnBlur?: boolean; } diff --git a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts index ea1b767e3..a202ce1f5 100644 --- a/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts +++ b/dmp-frontend/src/app/library/auto-complete/single/single-auto-complete.component.ts @@ -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; + } } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts index 76160acb4..341cb9a9e 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-editor/dataset-editor.component.ts @@ -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); } diff --git a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts index 31338f977..f4113eac9 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dataset-editor-details/dataset-editor-details.component.ts @@ -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); } diff --git a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts index 5557e9f77..f3a6392cd 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/funding-info/funding-info.component.ts @@ -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();