mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 06:23:03 +00:00
Fixed an issue with place property removal from object that represent metadata section field on rest side
This commit is contained in:
@@ -27,16 +27,16 @@ export function isServerFormValue(obj: any): boolean {
|
|||||||
&& obj.hasOwnProperty('value')
|
&& obj.hasOwnProperty('value')
|
||||||
&& obj.hasOwnProperty('language')
|
&& obj.hasOwnProperty('language')
|
||||||
&& obj.hasOwnProperty('authority')
|
&& obj.hasOwnProperty('authority')
|
||||||
&& obj.hasOwnProperty('confidence')
|
&& obj.hasOwnProperty('confidence'))
|
||||||
&& obj.hasOwnProperty('place'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export a function to normalize sections object of the server response
|
* Export a function to normalize sections object of the server response
|
||||||
*
|
*
|
||||||
* @param obj
|
* @param obj
|
||||||
|
* @param objIndex
|
||||||
*/
|
*/
|
||||||
export function normalizeSectionData(obj: any) {
|
export function normalizeSectionData(obj: any, objIndex?: number) {
|
||||||
let result: any = obj;
|
let result: any = obj;
|
||||||
if (isNotNull(obj)) {
|
if (isNotNull(obj)) {
|
||||||
// If is an Instance of FormFieldMetadataValueObject normalize it
|
// If is an Instance of FormFieldMetadataValueObject normalize it
|
||||||
@@ -49,14 +49,14 @@ export function normalizeSectionData(obj: any) {
|
|||||||
obj.language,
|
obj.language,
|
||||||
obj.authority,
|
obj.authority,
|
||||||
(obj.display || obj.value),
|
(obj.display || obj.value),
|
||||||
obj.place,
|
obj.place || objIndex,
|
||||||
obj.confidence,
|
obj.confidence,
|
||||||
obj.otherInformation
|
obj.otherInformation
|
||||||
);
|
);
|
||||||
} else if (Array.isArray(obj)) {
|
} else if (Array.isArray(obj)) {
|
||||||
result = [];
|
result = [];
|
||||||
obj.forEach((item, index) => {
|
obj.forEach((item, index) => {
|
||||||
result[index] = normalizeSectionData(item);
|
result[index] = normalizeSectionData(item, index);
|
||||||
});
|
});
|
||||||
} else if (typeof obj === 'object') {
|
} else if (typeof obj === 'object') {
|
||||||
result = Object.create({});
|
result = Object.create({});
|
||||||
@@ -141,9 +141,9 @@ export class SubmissionResponseParsingService extends BaseResponseParsingService
|
|||||||
// If entry is not an array, for sure is not a section of type form
|
// If entry is not an array, for sure is not a section of type form
|
||||||
if (Array.isArray(entry)) {
|
if (Array.isArray(entry)) {
|
||||||
normalizedSectionData[metdadataId] = [];
|
normalizedSectionData[metdadataId] = [];
|
||||||
entry.forEach((valueItem) => {
|
entry.forEach((valueItem, index) => {
|
||||||
// Parse value and normalize it
|
// Parse value and normalize it
|
||||||
const normValue = normalizeSectionData(valueItem);
|
const normValue = normalizeSectionData(valueItem, index);
|
||||||
if (isNotEmpty(normValue)) {
|
if (isNotEmpty(normValue)) {
|
||||||
normalizedSectionData[metdadataId].push(normValue);
|
normalizedSectionData[metdadataId].push(normValue);
|
||||||
}
|
}
|
||||||
|
@@ -168,7 +168,7 @@ export class DsDynamicTagComponent extends DynamicFormControlComponent implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
private addTagsToChips() {
|
private addTagsToChips() {
|
||||||
if (!this.hasAuthority || !this.model.authorityOptions.closed) {
|
if (hasValue(this.currentValue) && (!this.hasAuthority || !this.model.authorityOptions.closed)) {
|
||||||
let res: string[] = [];
|
let res: string[] = [];
|
||||||
res = this.currentValue.split(',');
|
res = this.currentValue.split(',');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user