Adding message when source from external fetching is null on Dataset Description.
This commit is contained in:
parent
bd6170f711
commit
9bc55bca5d
|
@ -18,6 +18,7 @@ import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-comp
|
||||||
import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration';
|
||||||
import { AddResearcherComponent } from '../add-researcher/add-researcher.component';
|
import { AddResearcherComponent } from '../add-researcher/add-researcher.component';
|
||||||
import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component';
|
import { AvailableProfilesComponent } from '../available-profiles/available-profiles.component';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-general-tab',
|
selector: 'app-general-tab',
|
||||||
|
@ -47,7 +48,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit {
|
||||||
private dmpProfileService: DmpProfileService,
|
private dmpProfileService: DmpProfileService,
|
||||||
private externalSourcesService: ExternalSourcesService,
|
private externalSourcesService: ExternalSourcesService,
|
||||||
private _service: DmpService,
|
private _service: DmpService,
|
||||||
private dialog: MatDialog
|
private dialog: MatDialog,
|
||||||
|
private language: TranslateService
|
||||||
) {
|
) {
|
||||||
super();
|
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)),
|
initialItems: (excludedItems: any[]) => this.filterOrganisations('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item['name'],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (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 = {
|
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)),
|
initialItems: (excludedItems: any[]) => this.filterResearchers('').map(result => result.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1)),
|
||||||
displayFn: (item) => item['name'],
|
displayFn: (item) => item['name'],
|
||||||
titleFn: (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')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,21 +60,21 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||||
if (!(this.form.controls['data'].value.multiAutoComplete)) {
|
if (!(this.form.controls['data'].value.multiAutoComplete)) {
|
||||||
this.singleAutoCompleteConfiguration = {
|
this.singleAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchFromAutocomplete.bind(this),
|
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'],
|
displayFn: (item) => (item != null && item.length > 1) ? JSON.parse(item).label : item['label'],
|
||||||
titleFn: (item) => item['label'],
|
titleFn: (item) => item['label'],
|
||||||
valueAssign: (item) => JSON.stringify(item),
|
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 {
|
else {
|
||||||
this.multipleAutoCompleteConfiguration = {
|
this.multipleAutoCompleteConfiguration = {
|
||||||
filterFn: this.searchFromAutocomplete.bind(this),
|
filterFn: this.searchFromAutocomplete.bind(this),
|
||||||
initialItems: (extraData) => this.searchFromAutocomplete(''),
|
initialItems: () => this.searchFromAutocomplete(''),
|
||||||
displayFn: (item) => item['label'],
|
displayFn: (item) => item['label'],
|
||||||
titleFn: (item) => item['label'],
|
titleFn: (item) => item['label'],
|
||||||
valueAssign: this._transformValue,
|
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')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,8 @@
|
||||||
"EDITOR": {
|
"EDITOR": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"EXTERNAL-DATASET-TYPE": "Type",
|
"EXTERNAL-DATASET-TYPE": "Type",
|
||||||
"EXTERNAL-AUTOCOMPLETE-SUBTITLE": "Source: "
|
"EXTERNAL-AUTOCOMPLETE-SUBTITLE": "Source: ",
|
||||||
|
"EXTERNAL-AUTOCOMPLETE-NO-SOURCE": "Source not provided"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"FIRST-STEP": {
|
"FIRST-STEP": {
|
||||||
|
@ -358,7 +359,7 @@
|
||||||
},
|
},
|
||||||
"SECOND-STEP": {
|
"SECOND-STEP": {
|
||||||
"TITLE": "External References",
|
"TITLE": "External References",
|
||||||
"EXTERNAL-HINT": "Options are fetched from an external source"
|
"EXTERNAL-HINT": "List of values provided by external source(s)"
|
||||||
},
|
},
|
||||||
"THIRD-STEP": {
|
"THIRD-STEP": {
|
||||||
"TITLE": "Description"
|
"TITLE": "Description"
|
||||||
|
|
Loading…
Reference in New Issue