mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
fix issue where editing template rows caused invald patch requests
This commit is contained in:
@@ -11,7 +11,7 @@ import { FormComponent } from '../../../shared/form/form.component';
|
|||||||
import { FormService } from '../../../shared/form/form.service';
|
import { FormService } from '../../../shared/form/form.service';
|
||||||
import { SectionModelComponent } from '../models/section.model';
|
import { SectionModelComponent } from '../models/section.model';
|
||||||
import { SubmissionFormsConfigService } from '../../../core/config/submission-forms-config.service';
|
import { SubmissionFormsConfigService } from '../../../core/config/submission-forms-config.service';
|
||||||
import { hasValue, isNotEmpty, isUndefined } from '../../../shared/empty.util';
|
import { hasValue, isNotEmpty, isUndefined, hasNoValue } from '../../../shared/empty.util';
|
||||||
import { ConfigData } from '../../../core/config/config-data';
|
import { ConfigData } from '../../../core/config/config-data';
|
||||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||||
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
||||||
@@ -344,6 +344,8 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
|||||||
* the [[DynamicFormControlEvent]] emitted
|
* the [[DynamicFormControlEvent]] emitted
|
||||||
*/
|
*/
|
||||||
onChange(event: DynamicFormControlEvent): void {
|
onChange(event: DynamicFormControlEvent): void {
|
||||||
|
// don't handle change events for things with an index < 0, those are template rows.
|
||||||
|
if (hasNoValue(event.context) || hasNoValue(event.context.index) || event.context.index >= 0) {
|
||||||
this.formOperationsService.dispatchOperationsFromEvent(
|
this.formOperationsService.dispatchOperationsFromEvent(
|
||||||
this.pathCombiner,
|
this.pathCombiner,
|
||||||
event,
|
event,
|
||||||
@@ -356,6 +358,7 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
|||||||
this.submissionService.dispatchSave(this.submissionId);
|
this.submissionService.dispatchSave(this.submissionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method called when a form dfFocus event is fired.
|
* Method called when a form dfFocus event is fired.
|
||||||
|
Reference in New Issue
Block a user