diff --git a/resources/i18n/en.json b/resources/i18n/en.json index ef688cf661..11c140fc70 100644 --- a/resources/i18n/en.json +++ b/resources/i18n/en.json @@ -54,6 +54,18 @@ "provider": { "required": "You must provide a set id of the target collection." } + }, + "options": { + "format": { + "dc": "Simple Dublin Core", + "qdc": "Qualified Dublin Core", + "dim": "DSpace Intermediate Metadata" + }, + "harvest": { + "1": "Harvest metadata only", + "2": "Harvest metadata and references to bitstreams (requires ORE support)", + "3": "Harvest metadata and bitstreams (requires ORE support)" + } } }, "notifications": { diff --git a/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.ts b/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.ts index 370314a2f7..c5bb327fcf 100644 --- a/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.ts +++ b/src/app/+collection-page/edit-collection-page/collection-source/collection-source.component.ts @@ -2,7 +2,7 @@ import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { AbstractTrackableComponent } from '../../../shared/trackable/abstract-trackable.component'; import { DynamicFormControlModel, DynamicFormGroupModel, DynamicFormLayout, DynamicFormService, - DynamicInputModel, DynamicRadioGroupModel, + DynamicInputModel, DynamicOptionControlModel, DynamicRadioGroupModel, DynamicSelectModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; @@ -56,6 +56,14 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem */ ERROR_KEY_PREFIX = 'collection.edit.tabs.source.form.errors.'; + /** + * @type {string} Key prefix used to generate form option labels + */ + OPTIONS_KEY_PREFIX = 'collection.edit.tabs.source.form.options.'; + + /** + * The Dynamic Input Model for the OAI Provider + */ providerModel = new DynamicInputModel({ id: 'provider', name: 'provider', @@ -68,45 +76,48 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem } }); + /** + * The Dynamic Input Model for the OAI Set + */ setModel = new DynamicInputModel({ id: 'set', name: 'set' }); + /** + * The Dynamic Input Model for the Metadata Format used + */ formatModel = new DynamicSelectModel({ id: 'format', name: 'format', options: [ { - value: 'dc', - label: 'Simple Dublin Core' + value: 'dc' }, { - value: 'qdc', - label: 'Qualified Dublin Core' + value: 'qdc' }, { - value: 'dim', - label: 'DSpace Intermediate Metadata' + value: 'dim' } ] }); + /** + * The Dynamic Input Model for the type of harvesting + */ harvestModel = new DynamicRadioGroupModel({ id: 'harvest', name: 'harvest', options: [ { - value: 1, - label: 'Harvest metadata only.' + value: 1 }, { - value: 2, - label: 'Harvest metadata and references to bitstreams (requires ORE support).' + value: 2 }, { - value: 3, - label: 'Harvest metadata and bitstreams (requires ORE support).' + value: 3 } ] }); @@ -283,6 +294,13 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem fieldModel.errorMessages[key] = this.translate.instant(this.ERROR_KEY_PREFIX + fieldModel.id + '.' + key); }); } + if (fieldModel instanceof DynamicOptionControlModel) { + if (isNotEmpty(fieldModel.options)) { + fieldModel.options.forEach((option) => { + option.label = this.translate.instant(this.OPTIONS_KEY_PREFIX + fieldModel.id + '.' + option.value); + }); + } + } } /**