From 46e62b01df30ddffad13ab1f6c7dd6546f644942 Mon Sep 17 00:00:00 2001 From: apapachristou Date: Fri, 30 Aug 2019 18:06:12 +0300 Subject: [PATCH] Adds subtitles and hint on external data autocomplete --- .../dataset-external-references-editor.component.ts | 12 +++++++----- .../ui/dmp/editor/grant-tab/grant-tab.component.ts | 10 +++++++--- .../listing/external-item-listing.component.html | 1 + dmp-frontend/src/assets/i18n/en.json | 4 +++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts index eb950d7ba..34d1056ae 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.ts @@ -21,6 +21,7 @@ import { DatasetExternalDataRepositoryDialogEditorComponent } from './editors/da import { DatasetExternalDatasetDialogEditorComponent } from './editors/external-dataset/dataset-external-dataset-dialog-editor.component'; import { DatasetExternalRegistryDialogEditorComponent } from './editors/registry/dataset-external-registry-dialog-editor.component'; import { DatasetExternalServiceDialogEditorComponent } from './editors/service/dataset-external-service-dialog-editor.component'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-dataset-external-references-editor-component', @@ -45,6 +46,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl constructor( private dialog: MatDialog, private router: Router, + private language: TranslateService, private externalSourcesService: ExternalSourcesService, private externalSourcesConfigurationService: ExternalSourcesConfigurationService ) { super(); } @@ -67,7 +69,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl initialItems: (type) => this.searchDatasetExternalDatasets('', type),//.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1), displayFn: (item) => item ? item.label : null, titleFn: (item) => item ? item.label : null, - subtitleFn: (item) => item ? item.tag : null, + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : null, }; this.registriesAutoCompleteConfiguration = { @@ -75,7 +77,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl initialItems: (type) => this.searchDatasetExternalRegistries('', type), displayFn: (item) => item ? item.label : null, titleFn: (item) => item ? item.label : null, - subtitleFn: (item) => item ? item.tag : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : null }; this.dataRepositoriesAutoCompleteConfiguration = { @@ -83,7 +85,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl initialItems: (type) => this.searchDatasetExternalDataRepositories('', type), displayFn: (item) => item ? item.name : null, titleFn: (item) => item ? item.name : null, - subtitleFn: (item) => item ? item.tag : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : null }; this.servicesAutoCompleteConfiguration = { @@ -91,14 +93,14 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl initialItems: (type) => this.searchDatasetExternalServices('', type), displayFn: (item) => item ? item.label : null, titleFn: (item) => item ? item.label : null, - subtitleFn: (item) => item ? item.tag : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : null }; this.tagsAutoCompleteConfiguration = { filterFn: this.searchDatasetTags.bind(this), initialItems: (type) => this.searchDatasetTags('', type), displayFn: (item) => item ? item.name : null, - titleFn: (item) => item ? item.name : null + titleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.name : null }; } diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts index d356001c3..08f208f2e 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts @@ -10,6 +10,7 @@ import { ProjectService } from '../../../../core/services/project/project.servic import { FunderService } from '../../../../core/services/funder/funder.service'; import { FunderCriteria } from '../../../../core/query/funder/funder-criteria'; import { ProjectCriteria } from '../../../../core/query/project/project-criteria'; +import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'app-grant-tab', @@ -35,6 +36,7 @@ export class GrantTabComponent implements OnInit { private grantService: GrantService, private projectService: ProjectService, private funderService: FunderService, + private language: TranslateService, public languageResolverService: LanguageResolverService ) { } @@ -48,21 +50,23 @@ export class GrantTabComponent implements OnInit { initialItems: (extraData) => this.searchGrant(''), displayFn: (item) => item['label'], titleFn: (item) => item['label'], - subtitleFn: (item) => item ? item['source'] : null + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : null }; this.projectAutoCompleteConfiguration = { filterFn: this.searchProject.bind(this), initialItems: (extraData) => this.searchProject(''), displayFn: (item) => item['label'], - titleFn: (item) => item['label'] + titleFn: (item) => item['label'], + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : null } this.funderAutoCompleteConfiguration = { filterFn: this.searchFunder.bind(this), initialItems: (extraData) => this.searchFunder(''), displayFn: (item) => item['label'], - titleFn: (item) => item['label'] + titleFn: (item) => item['label'], + subtitleFn: (item) => item ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['source'] : null } this.isCreateNew = (this.grantformGroup.get('label').value != null && this.grantformGroup.get('label').value.length > 0); diff --git a/dmp-frontend/src/app/ui/misc/external-sources/listing/external-item-listing.component.html b/dmp-frontend/src/app/ui/misc/external-sources/listing/external-item-listing.component.html index f9232bb3e..3d094ebad 100644 --- a/dmp-frontend/src/app/ui/misc/external-sources/listing/external-item-listing.component.html +++ b/dmp-frontend/src/app/ui/misc/external-sources/listing/external-item-listing.component.html @@ -9,6 +9,7 @@ + {{ 'DATASET-WIZARD.SECOND-STEP.EXTERNAL-HINT' | translate }}
diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index dc08d8ef0..923c1d9e4 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -356,7 +356,8 @@ "PROFILE": "Dataset Description Template" }, "SECOND-STEP": { - "TITLE": "External References" + "TITLE": "External References", + "EXTERNAL-HINT": "Options are fetched from an external source" }, "THIRD-STEP": { "TITLE": "Description" @@ -763,6 +764,7 @@ "EXTERNAL-DATASET-TYPE": { "SOURCE": "Source", "SOURCES": "Sources", + "SOURCE:": "Source: ", "OUTPUT": "Output" }, "DMP": {