mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[TLC-254] Get Type Bind config from backend
This commit is contained in:
@@ -77,11 +77,6 @@ submission:
|
||||
# NOTE: after how many time (milliseconds) submission is saved automatically
|
||||
# eg. timer: 5 * (1000 * 60); // 5 minutes
|
||||
timer: 0
|
||||
typeBind:
|
||||
# NOTE: which field to use when matching to type-bind configuration,
|
||||
# eg. dc.type, local.publicationType
|
||||
# default: dc.type
|
||||
field: dc.type
|
||||
icons:
|
||||
metadata:
|
||||
# NOTE: example of configuration
|
||||
|
@@ -2,7 +2,7 @@ import { Inject, Injectable, Injector, Optional } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
import { startWith } from 'rxjs/operators';
|
||||
import {map, startWith} from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
AND_OPERATOR,
|
||||
@@ -15,10 +15,12 @@ import {
|
||||
OR_OPERATOR
|
||||
} from '@ng-dynamic-forms/core';
|
||||
|
||||
import { hasNoValue, hasValue } from '../../../empty.util';
|
||||
import {hasNoValue, hasValue, isEmpty} from '../../../empty.util';
|
||||
import { FormBuilderService } from '../form-builder.service';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-constants';
|
||||
import {getFirstCompletedRemoteData} from "../../../../core/shared/operators";
|
||||
import {ConfigurationDataService} from "../../../../core/data/configuration-data.service";
|
||||
|
||||
/**
|
||||
* Service to manage type binding for submission input fields
|
||||
@@ -31,7 +33,6 @@ export class DsDynamicTypeBindRelationService {
|
||||
protected dynamicFormRelationService: DynamicFormRelationService,
|
||||
protected formBuilderService: FormBuilderService,
|
||||
protected injector: Injector) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,6 +54,7 @@ export class DsDynamicTypeBindRelationService {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get models for this bind type
|
||||
* @param model
|
||||
|
@@ -48,12 +48,18 @@ import { DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-conca
|
||||
import { DynamicLookupNameModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||
import { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||
import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
|
||||
import {ConfigurationDataService} from "../../../core/data/configuration-data.service";
|
||||
import {createSuccessfulRemoteDataObject$} from "../../remote-data.utils";
|
||||
import {ConfigurationProperty} from "../../../core/shared/configuration-property.model";
|
||||
|
||||
describe('FormBuilderService test suite', () => {
|
||||
|
||||
let testModel: DynamicFormControlModel[];
|
||||
let testFormConfiguration: SubmissionFormsModel;
|
||||
let service: FormBuilderService;
|
||||
let configSpy: ConfigurationDataService;
|
||||
const typeFieldProp = 'submit.type-bind.field';
|
||||
const typeFieldTestValue = 'dc.type';
|
||||
|
||||
const submissionId = '1234';
|
||||
|
||||
@@ -65,15 +71,24 @@ describe('FormBuilderService test suite', () => {
|
||||
return new Promise<boolean>((resolve) => setTimeout(() => resolve(true), 0));
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
const createConfigSuccessSpy = (...values: string[]) => jasmine.createSpyObj('configurationDataService', {
|
||||
findByPropertyName: createSuccessfulRemoteDataObject$({
|
||||
... new ConfigurationProperty(),
|
||||
name: typeFieldProp,
|
||||
values: values,
|
||||
}),
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
configSpy = createConfigSuccessSpy(typeFieldTestValue);
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ReactiveFormsModule],
|
||||
providers: [
|
||||
{ provide: FormBuilderService, useClass: FormBuilderService },
|
||||
{ provide: DynamicFormValidationService, useValue: {} },
|
||||
{ provide: NG_VALIDATORS, useValue: testValidator, multi: true },
|
||||
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true }
|
||||
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true },
|
||||
{ provide: ConfigurationDataService, useValue: configSpy }
|
||||
]
|
||||
});
|
||||
|
||||
@@ -881,4 +896,11 @@ describe('FormBuilderService test suite', () => {
|
||||
expect(formArray.length === 0).toBe(true);
|
||||
});
|
||||
|
||||
it(`should request the ${typeFieldProp} property and set value "dc_type"`, () => {
|
||||
service.setTypeBindFieldFromConfig();
|
||||
expect(configSpy.findByPropertyName).toHaveBeenCalledTimes(1);
|
||||
expect(configSpy.findByPropertyName).toHaveBeenCalledWith(typeFieldProp);
|
||||
expect(service.getTypeField()).toEqual('dc_type');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Injectable, Optional} from '@angular/core';
|
||||
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
||||
|
||||
import {
|
||||
@@ -42,6 +42,8 @@ import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './ds-dynamic-form-ui/d
|
||||
import { CONCAT_GROUP_SUFFIX, DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-concat.model';
|
||||
import { VIRTUAL_METADATA_PREFIX } from '../../../core/shared/metadata.models';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import {ConfigurationDataService} from "../../../core/data/configuration-data.service";
|
||||
import {getFirstCompletedRemoteData} from "../../../core/shared/operators";
|
||||
|
||||
@Injectable()
|
||||
export class FormBuilderService extends DynamicFormService {
|
||||
@@ -66,13 +68,17 @@ export class FormBuilderService extends DynamicFormService {
|
||||
constructor(
|
||||
componentService: DynamicFormComponentService,
|
||||
validationService: DynamicFormValidationService,
|
||||
protected rowParser: RowParser
|
||||
protected rowParser: RowParser,
|
||||
@Optional() protected configService: ConfigurationDataService,
|
||||
) {
|
||||
super(componentService, validationService);
|
||||
this.formModels = new Map();
|
||||
this.formGroups = new Map();
|
||||
// Replace . with _ in configured type field here, to make configuration more simple and user-friendly
|
||||
this.typeField = environment.submission.typeBind.field.replace(/\./g, '_');
|
||||
if (hasValue(configService)) {
|
||||
this.setTypeBindFieldFromConfig();
|
||||
} else {
|
||||
this.typeField = 'dc_type';
|
||||
}
|
||||
}
|
||||
|
||||
createDynamicFormControlEvent(control: FormControl, group: FormGroup, model: DynamicFormControlModel, type: string): DynamicFormControlEvent {
|
||||
@@ -278,7 +284,8 @@ export class FormBuilderService extends DynamicFormService {
|
||||
const rawData = typeof json === 'string' ? JSON.parse(json, parseReviver) : json;
|
||||
if (rawData.rows && !isEmpty(rawData.rows)) {
|
||||
rawData.rows.forEach((currentRow) => {
|
||||
const rowParsed = this.rowParser.parse(submissionId, currentRow, scopeUUID, sectionData, submissionScope, readOnly);
|
||||
const rowParsed = this.rowParser.parse(submissionId, currentRow, scopeUUID, sectionData, submissionScope,
|
||||
readOnly, this.typeField);
|
||||
if (isNotNull(rowParsed)) {
|
||||
if (Array.isArray(rowParsed)) {
|
||||
rows = rows.concat(rowParsed);
|
||||
@@ -489,4 +496,30 @@ export class FormBuilderService extends DynamicFormService {
|
||||
return Object.keys(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type bind field from config
|
||||
*/
|
||||
setTypeBindFieldFromConfig(): void {
|
||||
this.configService.findByPropertyName('submit.type-bind.field').pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((remoteData: any) => {
|
||||
// make sure we got a success response from the backend
|
||||
if (!remoteData.hasSucceeded) {
|
||||
this.typeField = 'dc_type';
|
||||
return;
|
||||
}
|
||||
// Read type bind value from response and set if non-empty
|
||||
const typeFieldConfig = remoteData.payload.values[0];
|
||||
if (isEmpty(typeFieldConfig)) {
|
||||
this.typeField = 'dc_type';
|
||||
} else {
|
||||
this.typeField = typeFieldConfig.replace(/\./g, '_');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getTypeField(): string {
|
||||
return this.typeField;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Inject } from '@angular/core';
|
||||
import {Inject} from '@angular/core';
|
||||
import { FormFieldModel } from '../models/form-field.model';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import {
|
||||
|
@@ -12,7 +12,8 @@ describe('DateFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: null,
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -11,7 +11,8 @@ describe('DisabledFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: null,
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -11,7 +11,8 @@ describe('DropdownFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Inject } from '@angular/core';
|
||||
import {Inject} from '@angular/core';
|
||||
import { FormFieldModel } from '../models/form-field.model';
|
||||
import {
|
||||
CONFIG_DATA,
|
||||
@@ -22,7 +22,7 @@ export class DropdownFieldParser extends FieldParser {
|
||||
@Inject(SUBMISSION_ID) submissionId: string,
|
||||
@Inject(CONFIG_DATA) configData: FormFieldModel,
|
||||
@Inject(INIT_FORM_VALUES) initFormValues,
|
||||
@Inject(PARSER_OPTIONS) parserOptions: ParserOptions
|
||||
@Inject(PARSER_OPTIONS) parserOptions: ParserOptions,
|
||||
) {
|
||||
super(submissionId, configData, initFormValues, parserOptions);
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { Inject, InjectionToken } from '@angular/core';
|
||||
import {Inject, InjectionToken} from '@angular/core';
|
||||
|
||||
import { uniqueId } from 'lodash';
|
||||
import {DynamicFormControlLayout, DynamicFormControlRelation, MATCH_VISIBLE, OR_OPERATOR} from '@ng-dynamic-forms/core';
|
||||
|
||||
import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../empty.util';
|
||||
import {hasValue, isEmpty, isNotEmpty, isNotNull, isNotUndefined} from '../../../empty.util';
|
||||
import { FormFieldModel } from '../models/form-field.model';
|
||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||
import {
|
||||
@@ -18,6 +18,8 @@ import { VocabularyOptions } from '../../../../core/submission/vocabularies/mode
|
||||
import { ParserType } from './parser-type';
|
||||
import { isNgbDateStruct } from '../../../date.util';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import {getFirstCompletedRemoteData} from "../../../../core/shared/operators";
|
||||
import {map} from "rxjs/operators";
|
||||
|
||||
export const SUBMISSION_ID: InjectionToken<string> = new InjectionToken<string>('submissionId');
|
||||
export const CONFIG_DATA: InjectionToken<FormFieldModel> = new InjectionToken<FormFieldModel>('configData');
|
||||
@@ -39,8 +41,6 @@ export abstract class FieldParser {
|
||||
@Inject(INIT_FORM_VALUES) protected initFormValues: any,
|
||||
@Inject(PARSER_OPTIONS) protected parserOptions: ParserOptions
|
||||
) {
|
||||
// Replace . with _ in configured type field here, to make configuration more simple and user-friendly
|
||||
this.typeField = environment.submission.typeBind.field.replace(/\./g, '_');
|
||||
}
|
||||
|
||||
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any;
|
||||
@@ -75,7 +75,8 @@ export abstract class FieldParser {
|
||||
metadataFields: this.getAllFieldIds(),
|
||||
hasSelectableMetadata: isNotEmpty(this.configData.selectableMetadata),
|
||||
isDraggable,
|
||||
typeBindRelations: isNotEmpty(this.configData.typeBind) ? this.getTypeBindRelations(this.configData.typeBind) : null,
|
||||
typeBindRelations: isNotEmpty(this.configData.typeBind) ? this.getTypeBindRelations(this.configData.typeBind,
|
||||
this.parserOptions.typeField) : null,
|
||||
groupFactory: () => {
|
||||
let model;
|
||||
if ((arrayCounter === 0)) {
|
||||
@@ -303,7 +304,8 @@ export abstract class FieldParser {
|
||||
|
||||
// If typeBind is configured
|
||||
if (isNotEmpty(this.configData.typeBind)) {
|
||||
(controlModel as DsDynamicInputModel).typeBindRelations = this.getTypeBindRelations(this.configData.typeBind);
|
||||
(controlModel as DsDynamicInputModel).typeBindRelations = this.getTypeBindRelations(this.configData.typeBind,
|
||||
this.parserOptions.typeField);
|
||||
}
|
||||
|
||||
return controlModel;
|
||||
@@ -319,11 +321,11 @@ export abstract class FieldParser {
|
||||
* @private
|
||||
* @return DynamicFormControlRelation[] array with one relation in it, for type bind matching to show a field
|
||||
*/
|
||||
private getTypeBindRelations(configuredTypeBindValues: string[]): DynamicFormControlRelation[] {
|
||||
private getTypeBindRelations(configuredTypeBindValues: string[], typeField: string): DynamicFormControlRelation[] {
|
||||
const bindValues = [];
|
||||
configuredTypeBindValues.forEach((value) => {
|
||||
bindValues.push({
|
||||
id: this.typeField,
|
||||
id: typeField,
|
||||
value: value
|
||||
});
|
||||
});
|
||||
|
@@ -13,7 +13,8 @@ describe('ListFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -12,7 +12,8 @@ describe('LookupFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -12,7 +12,8 @@ describe('LookupNameFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -14,7 +14,8 @@ describe('NameFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -15,7 +15,8 @@ describe('OneboxFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -2,4 +2,5 @@ export interface ParserOptions {
|
||||
readOnly: boolean;
|
||||
submissionScope: string;
|
||||
collectionUUID: string;
|
||||
typeField: string;
|
||||
}
|
||||
|
@@ -12,7 +12,8 @@ describe('RelationGroupFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: 'WORKSPACE'
|
||||
collectionUUID: 'WORKSPACE',
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -22,6 +22,7 @@ describe('RowParser test suite', () => {
|
||||
const initFormValues = {};
|
||||
const submissionScope = 'WORKSPACE';
|
||||
const readOnly = false;
|
||||
const typeField = 'dc_type';
|
||||
|
||||
beforeEach(() => {
|
||||
row1 = {
|
||||
@@ -338,7 +339,7 @@ describe('RowParser test suite', () => {
|
||||
it('should return a DynamicRowGroupModel object', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row1, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row1, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel instanceof DynamicRowGroupModel).toBe(true);
|
||||
});
|
||||
@@ -346,7 +347,7 @@ describe('RowParser test suite', () => {
|
||||
it('should return a row with three fields', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row1, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row1, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect((rowModel as DynamicRowGroupModel).group.length).toBe(3);
|
||||
});
|
||||
@@ -354,7 +355,7 @@ describe('RowParser test suite', () => {
|
||||
it('should return a DynamicRowArrayModel object', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row2, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row2, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel instanceof DynamicRowArrayModel).toBe(true);
|
||||
});
|
||||
@@ -362,7 +363,7 @@ describe('RowParser test suite', () => {
|
||||
it('should return a row that contains only scoped fields', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row3, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row3, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect((rowModel as DynamicRowGroupModel).group.length).toBe(1);
|
||||
});
|
||||
@@ -370,7 +371,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a dropdown combo field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row4, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row4, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -378,7 +379,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a lookup-name field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row5, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row5, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -386,7 +387,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a list field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row6, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row6, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -394,7 +395,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a date field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row7, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row7, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -402,7 +403,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a tag field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row8, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row8, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -410,7 +411,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a textarea field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row9, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row9, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
@@ -418,7 +419,7 @@ describe('RowParser test suite', () => {
|
||||
it('should be able to parse a group field', () => {
|
||||
const parser = new RowParser(undefined);
|
||||
|
||||
const rowModel = parser.parse(submissionId, row10, scopeUUID, initFormValues, submissionScope, readOnly);
|
||||
const rowModel = parser.parse(submissionId, row10, scopeUUID, initFormValues, submissionScope, readOnly, typeField);
|
||||
|
||||
expect(rowModel).toBeDefined();
|
||||
});
|
||||
|
@@ -31,7 +31,8 @@ export class RowParser {
|
||||
scopeUUID,
|
||||
initFormValues: any,
|
||||
submissionScope,
|
||||
readOnly: boolean): DynamicRowGroupModel {
|
||||
readOnly: boolean,
|
||||
typeField: string): DynamicRowGroupModel {
|
||||
let fieldModel: any = null;
|
||||
let parsedResult = null;
|
||||
const config: DynamicFormGroupModelConfig = {
|
||||
@@ -47,7 +48,8 @@ export class RowParser {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: readOnly,
|
||||
submissionScope: submissionScope,
|
||||
collectionUUID: scopeUUID
|
||||
collectionUUID: scopeUUID,
|
||||
typeField: typeField
|
||||
};
|
||||
|
||||
// Iterate over row's fields
|
||||
|
@@ -12,7 +12,8 @@ describe('SeriesFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -12,7 +12,8 @@ describe('TagFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: 'testScopeUUID',
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -12,7 +12,8 @@ describe('TextareaFieldParser test suite', () => {
|
||||
const parserOptions: ParserOptions = {
|
||||
readOnly: false,
|
||||
submissionScope: null,
|
||||
collectionUUID: null
|
||||
collectionUUID: null,
|
||||
typeField: 'dc_type'
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -42,6 +42,7 @@ import { NgbAccordionModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { SubmissionSectionAccessesComponent } from './sections/accesses/section-accesses.component';
|
||||
import { SubmissionAccessesConfigService } from '../core/config/submission-accesses-config.service';
|
||||
import { SectionAccessesService } from './sections/accesses/section-accesses.service';
|
||||
import {ConfigurationDataService} from "../core/data/configuration-data.service";
|
||||
|
||||
const ENTRY_COMPONENTS = [
|
||||
// put only entry components that use custom decorator
|
||||
@@ -97,7 +98,7 @@ const DECLARATIONS = [
|
||||
SectionsService,
|
||||
SubmissionUploadsConfigService,
|
||||
SubmissionAccessesConfigService,
|
||||
SectionAccessesService
|
||||
SectionAccessesService,
|
||||
]
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user