mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fix issue where related entites would be rendered as metadata for one box fields
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<ng-template #descTemplate>
|
||||
<span class="text-muted">
|
||||
<span *ngIf="metadataRepresentation.allMetadata(['dc.description']).length > 0"
|
||||
class="item-list-job-title">
|
||||
<span class="item-list-job-title">
|
||||
<span [innerHTML]="metadataRepresentation.firstMetadataValue(['dc.description'])"></span>
|
||||
</span>
|
||||
</span>
|
||||
@@ -9,5 +8,5 @@
|
||||
<ds-truncatable [id]="metadataRepresentation.id">
|
||||
<a [routerLink]="['/items/' + metadataRepresentation.id]"
|
||||
[innerHTML]="metadataRepresentation.getValue()"
|
||||
[tooltip]="metadataRepresentation.allMetadata(['organization.legalName']).length > 0 ? descTemplate : null"></a>
|
||||
[tooltip]="metadataRepresentation.allMetadata(['dc.description']).length > 0 ? descTemplate : null"></a>
|
||||
</ds-truncatable>
|
||||
|
@@ -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) {
|
||||
|
@@ -305,6 +305,7 @@ export abstract class FieldParser {
|
||||
}
|
||||
|
||||
public setValues(modelConfig: DsDynamicInputModelConfig, fieldValue: any, forceValueAsObj: boolean = false, groupModel?: boolean) {
|
||||
console.log('modelConfig.id', modelConfig.id);
|
||||
if (isNotEmpty(fieldValue)) {
|
||||
if (groupModel) {
|
||||
// Array, values is an array
|
||||
@@ -317,6 +318,7 @@ export abstract class FieldParser {
|
||||
}
|
||||
|
||||
if (typeof fieldValue === 'object') {
|
||||
modelConfig.metadataValue = fieldValue;
|
||||
modelConfig.language = fieldValue.language;
|
||||
modelConfig.place = fieldValue.place;
|
||||
if (forceValueAsObj) {
|
||||
|
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
|
||||
<!--Array with non repeatable items - Only delete button-->
|
||||
<div *ngIf="context.notRepeatable && group.context.groups.length > 1 || index > 0 && !group.group[0]?.value?.isVirtual"
|
||||
<div *ngIf="context.notRepeatable && group.context.groups.length > 1 || index > 0 && !(group.group[0]?.value?.isVirtual || group.group[0]?.metadataValue?.isVirtual)"
|
||||
class="col-xs-2 d-flex flex-column justify-content-sm-start align-items-end">
|
||||
<div class="btn-group" role="group" aria-label="Remove button">
|
||||
<button type="button" class="btn btn-secondary"
|
||||
|
Reference in New Issue
Block a user