From a3b6917abac248969f385b0ddf15d9db44ce7133 Mon Sep 17 00:00:00 2001 From: Kristof De Langhe Date: Wed, 21 Aug 2019 11:24:52 +0200 Subject: [PATCH] 64503: Remembering previously selected harvest type + small dropdown fix --- .../collection-source.component.ts | 16 ++++++++++++++-- src/app/core/shared/content-source.model.ts | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) 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 5a1f40a1e2..d4d551d61d 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 @@ -207,6 +207,13 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem */ harvestTypeNone = ContentSourceHarvestType.None; + /** + * The previously selected harvesting type + * Used for switching between ContentSourceHarvestType.None and the previously selected value when enabling / disabling harvesting + * Defaults to ContentSourceHarvestType.Metadata + */ + previouslySelectedHarvestType = ContentSourceHarvestType.Metadata; + public constructor(public objectUpdatesService: ObjectUpdatesService, public notificationsService: NotificationsService, protected location: Location, @@ -286,7 +293,11 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem this.metadataConfigIdModel.options = this.contentSource.metadataConfigs .map((metadataConfig: MetadataConfig) => Object.assign({ value: metadataConfig.id, label: metadataConfig.label })); if (this.metadataConfigIdModel.options.length > 0) { - this.metadataConfigIdModel.value = this.metadataConfigIdModel.options[0].value; + this.formGroup.patchValue({ + oaiSetContainer: { + metadataConfigId: this.metadataConfigIdModel.options[0].value + } + }); } } @@ -367,8 +378,9 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem */ changeExternalSource() { if (this.contentSource.harvestType === ContentSourceHarvestType.None) { - this.contentSource.harvestType = ContentSourceHarvestType.Metadata; + this.contentSource.harvestType = this.previouslySelectedHarvestType; } else { + this.previouslySelectedHarvestType = this.contentSource.harvestType; this.contentSource.harvestType = ContentSourceHarvestType.None; } this.updateContentSource(false); diff --git a/src/app/core/shared/content-source.model.ts b/src/app/core/shared/content-source.model.ts index a2df90027f..cd53c2d81e 100644 --- a/src/app/core/shared/content-source.model.ts +++ b/src/app/core/shared/content-source.model.ts @@ -38,7 +38,7 @@ export class ContentSource { * The ID of the metadata format used */ @autoserializeAs('metadata_config_id') - metadataConfigId = 'dc'; + metadataConfigId: string; /** * Type of content being harvested