diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts index 4d8000c4b..d5dcb8a95 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts @@ -18,6 +18,7 @@ import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-comp import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration'; import { AddResearcherComponent } from '../add-researcher/add-researcher.component'; import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-general-tab', @@ -47,7 +48,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { private dmpProfileService: DmpProfileService, private externalSourcesService: ExternalSourcesService, private _service: DmpService, - private dialog: MatDialog + private dialog: MatDialog, + private language: TranslateService ) { super(); } @@ -81,7 +83,7 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)), displayFn: (item) => item['name'], titleFn: (item) => item['name'], - subtitleFn: (item) => item ? item['tag'] : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') }; this.researchersAutoCompleteConfiguration = { @@ -89,7 +91,7 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)), displayFn: (item) => item['name'], titleFn: (item) => item['name'], - subtitleFn: (item) => item ? item['tag'] : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') }; } diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts index a51576f1f..160955cb6 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/components/form-field/form-field.component.ts @@ -60,21 +60,21 @@ export class FormFieldComponent extends BaseComponent implements OnInit { if (!(this.form.controls['data'].value.multiAutoComplete)) { this.singleAutoCompleteConfiguration = { filterFn: this.searchFromAutocomplete.bind(this), - initialItems: (extraData) => this.searchFromAutocomplete(''), + initialItems: () => this.searchFromAutocomplete(''), displayFn: (item) => (item != null && item.length > 1) ? JSON.parse(item).label : item['label'], titleFn: (item) => item['label'], valueAssign: (item) => JSON.stringify(item), - subtitleFn: (item) => this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] + subtitleFn: (item) => item['source'] ? this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] : this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-NO-SOURCE') }; } else { this.multipleAutoCompleteConfiguration = { filterFn: this.searchFromAutocomplete.bind(this), - initialItems: (extraData) => this.searchFromAutocomplete(''), + initialItems: () => this.searchFromAutocomplete(''), displayFn: (item) => item['label'], titleFn: (item) => item['label'], valueAssign: this._transformValue, - subtitleFn: (item) => this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] + subtitleFn: (item) => item['source'] ? this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-SUBTITLE') + item['source'] : this.language.instant('DATASET-WIZARD.EDITOR.FIELDS.EXTERNAL-AUTOCOMPLETE-NO-SOURCE') } } } diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 9a8086c55..086358a28 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -348,7 +348,8 @@ "EDITOR": { "FIELDS": { "EXTERNAL-DATASET-TYPE": "Type", - "EXTERNAL-AUTOCOMPLETE-SUBTITLE": "Source: " + "EXTERNAL-AUTOCOMPLETE-SUBTITLE": "Source: ", + "EXTERNAL-AUTOCOMPLETE-NO-SOURCE": "Source not provided" } }, "FIRST-STEP": { @@ -358,7 +359,7 @@ }, "SECOND-STEP": { "TITLE": "External References", - "EXTERNAL-HINT": "Options are fetched from an external source" + "EXTERNAL-HINT": "List of values provided by external source(s)" }, "THIRD-STEP": { "TITLE": "Description"