mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 02:54:13 +00:00
fixes for replacing/moving
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
} from '../json-patch-operations.actions';
|
||||
import { JsonPatchOperationPathObject } from './json-patch-operation-path-combiner';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { isEmpty, isNotEmpty } from '../../../shared/empty.util';
|
||||
import { hasNoValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
|
||||
import { dateToISOFormat } from '../../../shared/date.util';
|
||||
import { AuthorityValue } from '../../integration/models/authority.value';
|
||||
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
@@ -53,12 +53,16 @@ export class JsonPatchOperationsBuilder {
|
||||
* a boolean representing if the value to be added is a plain text value
|
||||
*/
|
||||
replace(path: JsonPatchOperationPathObject, value, plain = false) {
|
||||
this.store.dispatch(
|
||||
new NewPatchReplaceOperationAction(
|
||||
path.rootElement,
|
||||
path.subRootElement,
|
||||
path.path,
|
||||
this.prepareValue(value, plain, false)));
|
||||
if (hasNoValue(value) || (typeof value === 'object' && hasNoValue(value.value))) {
|
||||
this.remove(path);
|
||||
} else {
|
||||
this.store.dispatch(
|
||||
new NewPatchReplaceOperationAction(
|
||||
path.rootElement,
|
||||
path.subRootElement,
|
||||
path.path,
|
||||
this.prepareValue(value, plain, false)));
|
||||
}
|
||||
}
|
||||
|
||||
move(path: JsonPatchOperationPathObject, prevPath: string) {
|
||||
|
Reference in New Issue
Block a user