diff --git a/dmp-frontend/src/app/core/model/registry/registry.ts b/dmp-frontend/src/app/core/model/registry/registry.ts index c9568466c..7cbd89c5c 100644 --- a/dmp-frontend/src/app/core/model/registry/registry.ts +++ b/dmp-frontend/src/app/core/model/registry/registry.ts @@ -3,7 +3,7 @@ export interface RegistryModel { abbreviation: String; definition: String; id: String; - label: String; + name: String; reference: String; uri: String; } diff --git a/dmp-frontend/src/app/core/model/service/service.ts b/dmp-frontend/src/app/core/model/service/service.ts index 20c8dacd4..828bc9b5f 100644 --- a/dmp-frontend/src/app/core/model/service/service.ts +++ b/dmp-frontend/src/app/core/model/service/service.ts @@ -3,7 +3,7 @@ export interface ServiceModel { abbreviation: String; definition: String; uri: String; - label: String; + name: String; reference: String; } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard-editor.model.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard-editor.model.ts index b87673359..6298f0944 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard-editor.model.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard-editor.model.ts @@ -23,7 +23,7 @@ export class DatasetWizardEditorModel { public services: ExternalServiceEditorModel[] = []; public registries: ExternalRegistryEditorModel[] = []; public dataRepositories: ExternalDataRepositoryEditorModel[] = []; - public tags: TagModel[] = []; + public tags: ExternalTagEditorModel[] = []; public externalDatasets: ExternalDatasetEditorModel[] = []; public dmp: DmpModel; public datasetProfileDefinition: DatasetDescriptionFormEditorModel; @@ -43,7 +43,7 @@ export class DatasetWizardEditorModel { if (item.externalDatasets) { this.externalDatasets = item.externalDatasets.map(x => new ExternalDatasetEditorModel().fromModel(x)); } this.dmp = item.dmp; if (item.datasetProfileDefinition) { this.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item.datasetProfileDefinition); } - this.tags = item.tags; + if (item.tags) { this.tags = item.tags.map(x => new ExternalTagEditorModel().fromModel(x)); } this.isProfileLatestVersion = item.isProfileLatestVersion; return this; } @@ -59,7 +59,7 @@ export class DatasetWizardEditorModel { description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], dmp: [{ value: this.dmp, disabled: disabled }, context.getValidation('dmp').validators], //externalDatasets: [{ value: this.externalDatasets, disabled: disabled }, context.getValidation('externalDatasets').validators], - tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators], + // tags: [{ value: this.tags, disabled: disabled }, context.getValidation('tags').validators], //registries: [{ value: this.registries, disabled: disabled }, context.getValidation('registries').validators], //dataRepositories: [{ value: this.dataRepositories, disabled: disabled }, context.getValidation('dataRepositories').validators], //services: [{ value: this.services, disabled: disabled }, context.getValidation('services').validators], @@ -116,6 +116,12 @@ export class DatasetWizardEditorModel { // } formGroup.addControl('services', formBuilder.array(servicesFormArray)); + const tagsFormArray = new Array(); + this.tags.forEach(item => { + tagsFormArray.push(item.buildForm(context.getValidation('tags').descendantValidations, disabled)); + }); + formGroup.addControl('tags', formBuilder.array(tagsFormArray)); + if (this.datasetProfileDefinition) { formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinition.buildForm()); } // formGroup.addControl('profile', this.profile.buildForm()); return formGroup; @@ -140,20 +146,47 @@ export class DatasetWizardEditorModel { } } +export class ExternalTagEditorModel { + public abbreviation: String; + public definition: String; + public id: String; + public name: String; + public reference: String; + public uri: String; + + constructor(id?: String, name?: String) { + this.id = id; + this.name = name; + } + + fromModel(item: TagModel): ExternalTagEditorModel { + this.id = item.id; + this.name = item.name; + return this; + } + + buildForm(context: ValidationContext = null, disabled: boolean = false): FormGroup { + return new FormBuilder().group({ + id: [this.id], + name: [this.name] + }); + } +} + export class ExternalServiceEditorModel { public id: String; public abbreviation: String; public definition: String; public uri: String; - public label: String; + public name: String; public reference: String; - constructor(id?: String, abbreviation?: String, definition?: String, uri?: String, label?: String, reference?: String) { + constructor(abbreviation?: String, definition?: String, id?: String, name?: String, reference?: String, uri?: String) { this.id = id; this.abbreviation = abbreviation; this.definition = definition; this.uri = uri; - this.label = label; + this.name = name; this.reference = reference; } @@ -162,7 +195,7 @@ export class ExternalServiceEditorModel { this.abbreviation = item.abbreviation; this.definition = item.definition; this.uri = item.uri; - this.label = item.label; + this.name = item.name; this.reference = item.reference; return this; } @@ -171,7 +204,7 @@ export class ExternalServiceEditorModel { return new FormBuilder().group({ id: [this.id], abbreviation: [this.abbreviation], - label: [this.label], + name: [this.name], reference: [this.reference], uri: [this.uri], definition: [this.definition] @@ -183,15 +216,15 @@ export class ExternalRegistryEditorModel { public abbreviation: String; public definition: String; public id: String; - public label: String; + public name: String; public reference: String; public uri: String; - constructor(abbreviation?: String, definition?: String, id?: String, label?: String, reference?: String, uri?: String) { + constructor(abbreviation?: String, definition?: String, id?: String, name?: String, reference?: String, uri?: String) { this.abbreviation = abbreviation; this.definition = definition; this.id = id; - this.label = label; + this.name = name; this.reference = reference; this.uri = uri; } @@ -200,7 +233,7 @@ export class ExternalRegistryEditorModel { this.abbreviation = item.abbreviation; this.definition = item.definition; this.id = item.id; - this.label = item.label; + this.name = item.name; this.reference = item.reference; this.uri = item.uri; @@ -211,7 +244,7 @@ export class ExternalRegistryEditorModel { return new FormBuilder().group({ id: [this.id], abbreviation: [this.abbreviation], - label: [this.label], + name: [this.name], reference: [this.reference], uri: [this.uri], definition: [this.definition] diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.html index 7f7c8a9e7..792a11432 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/dataset-external-references-editor.component.html @@ -94,7 +94,7 @@

- {{i+1}}) {{suggestion.get('label').value}} + {{i+1}}) {{suggestion.get('name').value}}

@@ -125,7 +125,7 @@

- {{i+1}}) {{suggestion.get('label').value}} + {{i+1}}) {{suggestion.get('name').value}}

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 e5adbbbbf..e530e2c44 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 @@ -16,7 +16,7 @@ import { ExternalSourcesConfigurationService } from '../../../../core/services/e import { ExternalSourcesService } from '../../../../core/services/external-sources/external-sources.service'; import { SingleAutoCompleteConfiguration } from '../../../../library/auto-complete/single/single-auto-complete-configuration'; import { RequestItem } from '../../../../core/query/request-item'; -import { ExternalDataRepositoryEditorModel, ExternalDatasetEditorModel, ExternalRegistryEditorModel, ExternalServiceEditorModel } from '../dataset-wizard-editor.model'; +import { ExternalDataRepositoryEditorModel, ExternalDatasetEditorModel, ExternalRegistryEditorModel, ExternalServiceEditorModel, ExternalTagEditorModel } from '../dataset-wizard-editor.model'; import { DatasetExternalDataRepositoryDialogEditorComponent } from './editors/data-repository/dataset-external-data-repository-dialog-editor.component'; import { DatasetExternalDatasetDialogEditorComponent } from './editors/external-dataset/dataset-external-dataset-dialog-editor.component'; import { DatasetExternalRegistryDialogEditorComponent } from './editors/registry/dataset-external-registry-dialog-editor.component'; @@ -64,6 +64,14 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl this.externalSourcesConfiguration.tags.push({ key: '', label: 'All' }); }); + this.dataRepositoriesAutoCompleteConfiguration = { + filterFn: this.searchDatasetExternalDataRepositories.bind(this), + initialItems: (type) => this.searchDatasetExternalDataRepositories('', type), + displayFn: (item) => item ? item.name : null, + titleFn: (item) => item ? item.name : null, + subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') + }; + this.externalDatasetAutoCompleteConfiguration = { filterFn: this.searchDatasetExternalDatasets.bind(this), initialItems: (type) => this.searchDatasetExternalDatasets('', type),//.filter(resultItem => excludedItems.map(x => x.id).indexOf(resultItem.id) === -1), @@ -80,18 +88,10 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') }; - this.dataRepositoriesAutoCompleteConfiguration = { - filterFn: this.searchDatasetExternalDataRepositories.bind(this), - initialItems: (type) => this.searchDatasetExternalDataRepositories('', type), - displayFn: (item) => item ? item.name : null, - titleFn: (item) => item ? item.name : null, - subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') - }; - this.servicesAutoCompleteConfiguration = { filterFn: this.searchDatasetExternalServices.bind(this), initialItems: (type) => this.searchDatasetExternalServices('', type), - displayFn: (item) => item ? item.label : null, + displayFn: (item) => item ? item.name : null, titleFn: (item) => item ? item.name : null, subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') }; @@ -100,7 +100,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl 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 ? item.name : null, subtitleFn: (item) => item.tag ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item.tag : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE') }; } @@ -115,18 +115,18 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl } registriesOnItemChange(event) { - const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri); + const registryModel = new ExternalRegistryEditorModel(event.abbreviation, event.definition, event.id, event.name, event.reference, event.uri); (this.formGroup.get('registries')).push(registryModel.buildForm()); } servicesOnItemChange(event) { - const serviceModel = new ExternalServiceEditorModel(event.abbreviation, event.definition, event.id, event.label, event.reference, event.uri); + const serviceModel = new ExternalServiceEditorModel(event.abbreviation, event.definition, event.id, event.name, event.reference, event.uri); (this.formGroup.get('services')).push(serviceModel.buildForm()); } tagsOnItemChange(event) { - // const serviceModel = new TagModel(event.id, event.name); - // (this.formGroup.get('tags')).push(serviceModel.buildForm()); + const tagModel = new ExternalTagEditorModel(event.id, event.name); + (this.formGroup.get('tags')).push(tagModel.buildForm()); } @@ -160,7 +160,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl .pipe(takeUntil(this._destroyed)) .subscribe(result => { if (!result) { return; } - const registryModel = new ExternalRegistryEditorModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri); + const registryModel = new ExternalRegistryEditorModel(result.abbreviation, result.definition, result.id, result.name, result.reference, result.uri); (this.formGroup.get('registries')).push(registryModel.buildForm()); }); } @@ -190,7 +190,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl .pipe(takeUntil(this._destroyed)) .subscribe(result => { if (!result) { return; } - const serviceModel = new ExternalServiceEditorModel(result.id, result.abbreviation, result.definition, result.uri, result.label, result.reference); + const serviceModel = new ExternalServiceEditorModel(result.abbreviation, result.definition, result.id, result.name, result.reference, result.uri); (this.formGroup.get('services')).push(serviceModel.buildForm()); }); } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/data-repository/dataset-external-data-repository-dialog-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/data-repository/dataset-external-data-repository-dialog-editor.component.html index a2163361a..7e23bfd1a 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/data-repository/dataset-external-data-repository-dialog-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/data-repository/dataset-external-data-repository-dialog-editor.component.html @@ -1,15 +1,15 @@

{{'DATASET-REFERENCED-MODELS.DATA-REPOSITORY.TITLE' | translate}}

- + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/external-dataset/dataset-external-dataset-dialog-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/external-dataset/dataset-external-dataset-dialog-editor.component.html index c134a53e2..ba644cbdc 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/external-dataset/dataset-external-dataset-dialog-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/external-dataset/dataset-external-dataset-dialog-editor.component.html @@ -1,11 +1,11 @@

{{'DATASET-REFERENCED-MODELS.EXTERNAL-DATASET.TITLE' | translate}}

- + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/registry/dataset-external-registry-dialog-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/registry/dataset-external-registry-dialog-editor.component.html index f9a916427..feee19354 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/registry/dataset-external-registry-dialog-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/registry/dataset-external-registry-dialog-editor.component.html @@ -1,15 +1,15 @@

{{'DATASET-REFERENCED-MODELS.REGISTRY.TITLE' | translate}}

- - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/service/dataset-external-service-dialog-editor.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/service/dataset-external-service-dialog-editor.component.html index f9aaa27c4..ceaa2bcbe 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/service/dataset-external-service-dialog-editor.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/external-references/editors/service/dataset-external-service-dialog-editor.component.html @@ -1,15 +1,15 @@

{{'DATASET-REFERENCED-MODELS.SERVICES.TITLE' | translate}}

- - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} + + + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{'GENERAL.VALIDATION.REQUIRED' | translate}} diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 6647e7faf..96c499b74 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -941,18 +941,18 @@ "URI": "Uri" }, "DATA-REPOSITORY": { - "TITLE": "Add New Service", + "TITLE": "Add New Data Repository", "LABEL": "Label", "ABBREVIATION": "Abbreviation", "URI": "Uri" }, "EXTERNAL-DATASET": { - "TITLE": "Add New Service", + "TITLE": "Add New External Dataset Description", "LABEL": "Label", "ABBREVIATION": "Abbreviation" }, "REGISTRY": { - "TITLE": "Add New Service", + "TITLE": "Add New Registry", "LABEL": "Label", "ABBREVIATION": "Abbreviation", "URI": "Uri"