mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
64503: Prevent submit when harvest type is NONE and not changed
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
class="fas fa-undo-alt"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || !isValid()"
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || !isValid() || (initialHarvestType === harvestTypeNone && contentSource.harvestType === initialHarvestType)"
|
||||
(click)="onSubmit()"><i
|
||||
class="fas fa-save"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
||||
@@ -47,7 +47,7 @@
|
||||
class="fas fa-undo-alt"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
||||
</button>
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || !isValid()"
|
||||
<button class="btn btn-primary" [disabled]="!(hasChanges() | async) || !isValid() || (initialHarvestType === harvestTypeNone && contentSource.harvestType === initialHarvestType)"
|
||||
(click)="onSubmit()"><i
|
||||
class="fas fa-save"></i>
|
||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
||||
|
@@ -55,6 +55,12 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
||||
*/
|
||||
update$: Observable<FieldUpdate>;
|
||||
|
||||
/**
|
||||
* The initial harvest type we started off with
|
||||
* Used to compare changes
|
||||
*/
|
||||
initialHarvestType: ContentSourceHarvestType;
|
||||
|
||||
/**
|
||||
* @type {string} Key prefix used to generate form labels
|
||||
*/
|
||||
@@ -268,6 +274,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
||||
*/
|
||||
initializeOriginalContentSource(contentSource: ContentSource) {
|
||||
this.contentSource = contentSource;
|
||||
this.initialHarvestType = contentSource.harvestType;
|
||||
this.initializeMetadataConfigs();
|
||||
const initialContentSource = cloneDeep(this.contentSource);
|
||||
this.objectUpdatesService.initialize(this.url, [initialContentSource], new Date());
|
||||
@@ -281,6 +288,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
||||
if (hasValue(this.contentSource) && isNotEmpty(this.contentSource.metadataConfigs)) {
|
||||
defaultConfigId = this.contentSource.metadataConfigs[0].id;
|
||||
}
|
||||
if (hasValue(field)) {
|
||||
this.formGroup.patchValue({
|
||||
oaiSourceContainer: {
|
||||
oaiSource: field.oaiSource
|
||||
@@ -294,6 +302,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
||||
}
|
||||
});
|
||||
this.contentSource = cloneDeep(field);
|
||||
}
|
||||
this.contentSource.metadataConfigId = defaultConfigId;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user