64503: Remembering previously selected harvest type + small dropdown fix

This commit is contained in:
Kristof De Langhe
2019-08-21 11:24:52 +02:00
parent bf8e2078bc
commit a3b6917aba
2 changed files with 15 additions and 3 deletions

View File

@@ -207,6 +207,13 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
*/ */
harvestTypeNone = ContentSourceHarvestType.None; 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 constructor(public objectUpdatesService: ObjectUpdatesService,
public notificationsService: NotificationsService, public notificationsService: NotificationsService,
protected location: Location, protected location: Location,
@@ -286,7 +293,11 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
this.metadataConfigIdModel.options = this.contentSource.metadataConfigs this.metadataConfigIdModel.options = this.contentSource.metadataConfigs
.map((metadataConfig: MetadataConfig) => Object.assign({ value: metadataConfig.id, label: metadataConfig.label })); .map((metadataConfig: MetadataConfig) => Object.assign({ value: metadataConfig.id, label: metadataConfig.label }));
if (this.metadataConfigIdModel.options.length > 0) { 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() { changeExternalSource() {
if (this.contentSource.harvestType === ContentSourceHarvestType.None) { if (this.contentSource.harvestType === ContentSourceHarvestType.None) {
this.contentSource.harvestType = ContentSourceHarvestType.Metadata; this.contentSource.harvestType = this.previouslySelectedHarvestType;
} else { } else {
this.previouslySelectedHarvestType = this.contentSource.harvestType;
this.contentSource.harvestType = ContentSourceHarvestType.None; this.contentSource.harvestType = ContentSourceHarvestType.None;
} }
this.updateContentSource(false); this.updateContentSource(false);

View File

@@ -38,7 +38,7 @@ export class ContentSource {
* The ID of the metadata format used * The ID of the metadata format used
*/ */
@autoserializeAs('metadata_config_id') @autoserializeAs('metadata_config_id')
metadataConfigId = 'dc'; metadataConfigId: string;
/** /**
* Type of content being harvested * Type of content being harvested