mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
fix issue where related entites would be rendered as metadata for one box fields
This commit is contained in:
@@ -109,6 +109,7 @@ import { paginatedRelationsToItems } from '../../../../+item-page/simple/item-ty
|
||||
import { RelationshipOptions } from '../models/relationship-options.model';
|
||||
import { FormBuilderService } from '../form-builder.service';
|
||||
import { modalConfigDefaults } from 'ngx-bootstrap/modal/modal-options.class';
|
||||
import { models } from '../../../../core/core.module';
|
||||
|
||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||
switch (model.type) {
|
||||
@@ -292,7 +293,12 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
this.subs.push(subscription);
|
||||
}
|
||||
|
||||
this.value = Object.assign(new MetadataValue(), this.model.value);
|
||||
if (hasValue(this.model.metadataValue)) {
|
||||
this.value = Object.assign(new MetadataValue(), this.model.metadataValue);
|
||||
} else {
|
||||
this.value = Object.assign(new MetadataValue(), this.model.value);
|
||||
}
|
||||
|
||||
if (hasValue(this.value) && this.value.isVirtual) {
|
||||
const relationship$ = this.relationshipService.findById(this.value.virtualValue, followLink('leftItem'), followLink('rightItem'), followLink('relationshipType'))
|
||||
.pipe(
|
||||
|
@@ -6,6 +6,7 @@ import { hasNoValue, isNotEmpty } from '../../../../empty.util';
|
||||
import { DsDynamicInputModel } from './ds-dynamic-input.model';
|
||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
|
||||
export const CONCAT_GROUP_SUFFIX = '_CONCAT_GROUP';
|
||||
export const CONCAT_FIRST_INPUT_SUFFIX = '_CONCAT_FIRST_INPUT';
|
||||
@@ -21,6 +22,7 @@ export interface DynamicConcatModelConfig extends DynamicFormGroupModelConfig {
|
||||
metadataFields: string[];
|
||||
submissionId: string;
|
||||
hasSelectableMetadata: boolean;
|
||||
metadataValue?: MetadataValue;
|
||||
}
|
||||
|
||||
export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
@@ -34,6 +36,7 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
@serializable() metadataFields: string[];
|
||||
@serializable() submissionId: string;
|
||||
@serializable() hasSelectableMetadata: boolean;
|
||||
@serializable() metadataValue: MetadataValue;
|
||||
|
||||
isCustomGroup = true;
|
||||
valueUpdates: Subject<string>;
|
||||
@@ -49,6 +52,7 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
this.metadataFields = config.metadataFields;
|
||||
this.submissionId = config.submissionId;
|
||||
this.hasSelectableMetadata = config.hasSelectableMetadata;
|
||||
this.metadataValue = config.metadataValue;
|
||||
this.valueUpdates = new Subject<string>();
|
||||
this.valueUpdates.subscribe((value: string) => this.value = value);
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import { AuthorityOptions } from '../../../../../core/integration/models/authori
|
||||
import { hasValue } from '../../../../empty.util';
|
||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
|
||||
export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
||||
authorityOptions?: AuthorityOptions;
|
||||
@@ -18,6 +19,7 @@ export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
||||
metadataFields: string[];
|
||||
submissionId: string;
|
||||
hasSelectableMetadata: boolean;
|
||||
metadataValue?: MetadataValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +34,7 @@ export class DsDynamicInputModel extends DynamicInputModel {
|
||||
@serializable() metadataFields: string[];
|
||||
@serializable() submissionId: string;
|
||||
@serializable() hasSelectableMetadata: boolean;
|
||||
@serializable() metadataValue: MetadataValue;
|
||||
|
||||
constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) {
|
||||
super(config, layout);
|
||||
@@ -43,6 +46,7 @@ export class DsDynamicInputModel extends DynamicInputModel {
|
||||
this.relationship = config.relationship;
|
||||
this.submissionId = config.submissionId;
|
||||
this.hasSelectableMetadata = config.hasSelectableMetadata;
|
||||
this.metadataValue = config.metadataValue;
|
||||
|
||||
this.language = config.language;
|
||||
if (!this.language) {
|
||||
|
Reference in New Issue
Block a user