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>
|
class="fas fa-undo-alt"></i>
|
||||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
||||||
</button>
|
</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
|
(click)="onSubmit()"><i
|
||||||
class="fas fa-save"></i>
|
class="fas fa-save"></i>
|
||||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
class="fas fa-undo-alt"></i>
|
class="fas fa-undo-alt"></i>
|
||||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
<span class="d-none d-sm-inline"> {{"item.edit.metadata.reinstate-button" | translate}}</span>
|
||||||
</button>
|
</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
|
(click)="onSubmit()"><i
|
||||||
class="fas fa-save"></i>
|
class="fas fa-save"></i>
|
||||||
<span class="d-none d-sm-inline"> {{"item.edit.metadata.save-button" | translate}}</span>
|
<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>;
|
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
|
* @type {string} Key prefix used to generate form labels
|
||||||
*/
|
*/
|
||||||
@@ -268,6 +274,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
*/
|
*/
|
||||||
initializeOriginalContentSource(contentSource: ContentSource) {
|
initializeOriginalContentSource(contentSource: ContentSource) {
|
||||||
this.contentSource = contentSource;
|
this.contentSource = contentSource;
|
||||||
|
this.initialHarvestType = contentSource.harvestType;
|
||||||
this.initializeMetadataConfigs();
|
this.initializeMetadataConfigs();
|
||||||
const initialContentSource = cloneDeep(this.contentSource);
|
const initialContentSource = cloneDeep(this.contentSource);
|
||||||
this.objectUpdatesService.initialize(this.url, [initialContentSource], new Date());
|
this.objectUpdatesService.initialize(this.url, [initialContentSource], new Date());
|
||||||
@@ -281,19 +288,21 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
if (hasValue(this.contentSource) && isNotEmpty(this.contentSource.metadataConfigs)) {
|
if (hasValue(this.contentSource) && isNotEmpty(this.contentSource.metadataConfigs)) {
|
||||||
defaultConfigId = this.contentSource.metadataConfigs[0].id;
|
defaultConfigId = this.contentSource.metadataConfigs[0].id;
|
||||||
}
|
}
|
||||||
this.formGroup.patchValue({
|
if (hasValue(field)) {
|
||||||
oaiSourceContainer: {
|
this.formGroup.patchValue({
|
||||||
oaiSource: field.oaiSource
|
oaiSourceContainer: {
|
||||||
},
|
oaiSource: field.oaiSource
|
||||||
oaiSetContainer: {
|
},
|
||||||
oaiSetId: field.oaiSetId,
|
oaiSetContainer: {
|
||||||
metadataConfigId: field.metadataConfigId || defaultConfigId
|
oaiSetId: field.oaiSetId,
|
||||||
},
|
metadataConfigId: field.metadataConfigId || defaultConfigId
|
||||||
harvestTypeContainer: {
|
},
|
||||||
harvestType: field.harvestType
|
harvestTypeContainer: {
|
||||||
}
|
harvestType: field.harvestType
|
||||||
});
|
}
|
||||||
this.contentSource = cloneDeep(field);
|
});
|
||||||
|
this.contentSource = cloneDeep(field);
|
||||||
|
}
|
||||||
this.contentSource.metadataConfigId = defaultConfigId;
|
this.contentSource.metadataConfigId = defaultConfigId;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user