mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fixed functionality after merge
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { CacheableObject, TypedObject } from '../object-cache.reducer';
|
import { CacheableObject, TypedObject } from '../object-cache.reducer';
|
||||||
import { autoserialize } from 'cerialize';
|
import { autoserialize, deserialize } from 'cerialize';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
/**
|
/**
|
||||||
* An abstract model class for a NormalizedObject.
|
* An abstract model class for a NormalizedObject.
|
||||||
@@ -8,10 +8,10 @@ export abstract class NormalizedObject<T extends TypedObject> implements Cacheab
|
|||||||
/**
|
/**
|
||||||
* The link to the rest endpoint where this object can be found
|
* The link to the rest endpoint where this object can be found
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@deserialize
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
@autoserialize
|
@deserialize
|
||||||
_links: {
|
_links: {
|
||||||
[name: string]: string
|
[name: string]: string
|
||||||
};
|
};
|
||||||
@@ -19,6 +19,6 @@ export abstract class NormalizedObject<T extends TypedObject> implements Cacheab
|
|||||||
/**
|
/**
|
||||||
* A string representing the kind of object
|
* A string representing the kind of object
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@deserialize
|
||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { distinctUntilChanged, filter, find, first, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, filter, find, first, map, mergeMap, skipWhile, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||||
@@ -190,12 +190,16 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
|
|
||||||
return hrefObs.pipe(
|
return hrefObs.pipe(
|
||||||
find((href: string) => hasValue(href)),
|
find((href: string) => hasValue(href)),
|
||||||
switchMap((href: string) => {
|
tap((href: string) => {
|
||||||
this.requestService.removeByHrefSubstring(href);
|
this.requestService.removeByHrefSubstring(href);
|
||||||
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
||||||
this.requestService.configure(request, true);
|
this.requestService.configure(request, true);
|
||||||
return this.rdbService.buildList<T>(href) as Observable<RemoteData<PaginatedList<T>>>
|
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
switchMap((href) => this.requestService.getByHref(href)),
|
||||||
|
skipWhile((requestEntry) => hasValue(requestEntry)),
|
||||||
|
switchMap((href) =>
|
||||||
|
this.rdbService.buildList<T>(hrefObs) as Observable<RemoteData<PaginatedList<T>>>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -90,6 +90,7 @@ describe('RelationshipService', () => {
|
|||||||
objectCache,
|
objectCache,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -263,6 +263,7 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
return this.getItemRelationshipsByLabel(item1, label)
|
return this.getItemRelationshipsByLabel(item1, label)
|
||||||
.pipe(
|
.pipe(
|
||||||
getSucceededRemoteData(),
|
getSucceededRemoteData(),
|
||||||
|
isNotEmptyOperator(),
|
||||||
tap((t) => console.log(t)),
|
tap((t) => console.log(t)),
|
||||||
map((relationshipListRD: RemoteData<PaginatedList<Relationship>>) => relationshipListRD.payload.page),
|
map((relationshipListRD: RemoteData<PaginatedList<Relationship>>) => relationshipListRD.payload.page),
|
||||||
mergeMap((relationships: Relationship[]) => {
|
mergeMap((relationships: Relationship[]) => {
|
||||||
@@ -322,9 +323,9 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
const { relation, type } = relationshipAndType;
|
const { relation, type } = relationshipAndType;
|
||||||
let updatedRelationship;
|
let updatedRelationship;
|
||||||
if (relationshipLabel === type.leftwardType) {
|
if (relationshipLabel === type.leftwardType) {
|
||||||
updatedRelationship = Object.assign(new Relationship(), relation, { rightWardValue: nameVariant });
|
updatedRelationship = Object.assign(new Relationship(), relation, { rightwardValue: nameVariant });
|
||||||
} else {
|
} else {
|
||||||
updatedRelationship = Object.assign(new Relationship(), relation, { leftWardValue: nameVariant });
|
updatedRelationship = Object.assign(new Relationship(), relation, { leftwardValue: nameVariant });
|
||||||
}
|
}
|
||||||
return this.update(updatedRelationship);
|
return this.update(updatedRelationship);
|
||||||
})
|
})
|
||||||
|
@@ -96,14 +96,15 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
new DynamicSwitchModel({ id: 'switch' }),
|
new DynamicSwitchModel({ id: 'switch' }),
|
||||||
new DynamicTextAreaModel({ id: 'textarea' }),
|
new DynamicTextAreaModel({ id: 'textarea' }),
|
||||||
new DynamicTimePickerModel({ id: 'timepicker' }),
|
new DynamicTimePickerModel({ id: 'timepicker' }),
|
||||||
new DynamicTypeaheadModel({ id: 'typeahead', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
new DynamicTypeaheadModel({ id: 'typeahead', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||||
new DynamicScrollableDropdownModel({
|
new DynamicScrollableDropdownModel({
|
||||||
id: 'scrollableDropdown',
|
id: 'scrollableDropdown',
|
||||||
authorityOptions: authorityOptions,
|
authorityOptions: authorityOptions,
|
||||||
workspaceItem: new WorkspaceItem(),
|
metadataFields: [],
|
||||||
repeatable: false
|
repeatable: false,
|
||||||
|
submissionId: '1234'
|
||||||
}),
|
}),
|
||||||
new DynamicTagModel({ id: 'tag', workspaceItem: new WorkspaceItem(), repeatable: false}),
|
new DynamicTagModel({ id: 'tag', metadataFields: [], repeatable: false, submissionId: '1234'}),
|
||||||
new DynamicListCheckboxGroupModel({
|
new DynamicListCheckboxGroupModel({
|
||||||
id: 'checkboxList',
|
id: 'checkboxList',
|
||||||
authorityOptions: authorityOptions,
|
authorityOptions: authorityOptions,
|
||||||
@@ -123,12 +124,12 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
relationFields: [],
|
relationFields: [],
|
||||||
scopeUUID: '',
|
scopeUUID: '',
|
||||||
submissionScope: '',
|
submissionScope: '',
|
||||||
workspaceItem: new WorkspaceItem(),
|
repeatable: false,
|
||||||
repeatable: false
|
metadataFields: []
|
||||||
}),
|
}),
|
||||||
new DynamicDsDatePickerModel({ id: 'datepicker'}),
|
new DynamicDsDatePickerModel({ id: 'datepicker'}),
|
||||||
new DynamicLookupModel({ id: 'lookup', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
new DynamicLookupModel({ id: 'lookup', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||||
new DynamicLookupNameModel({ id: 'lookupName', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
new DynamicLookupNameModel({ id: 'lookupName', metadataFields: [], repeatable: false, submissionId: '1234' }),
|
||||||
new DynamicQualdropModel({ id: 'combobox', readOnly: false, required: false })
|
new DynamicQualdropModel({ id: 'combobox', readOnly: false, required: false })
|
||||||
];
|
];
|
||||||
const testModel = formModel[8];
|
const testModel = formModel[8];
|
||||||
|
@@ -89,7 +89,8 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
|
|||||||
import { RemoveRelationshipAction } from './relation-lookup-modal/relationship.actions';
|
import { RemoveRelationshipAction } from './relation-lookup-modal/relationship.actions';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppState } from '../../../../app.reducer';
|
import { AppState } from '../../../../app.reducer';
|
||||||
import { RelationshipOptions } from '../models/relationship-options.model';
|
import { SubmissionObjectDataService } from '../../../../core/submission/submission-object-data.service';
|
||||||
|
import { SubmissionObject } from '../../../../core/submission/models/submission-object.model';
|
||||||
|
|
||||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||||
switch (model.type) {
|
switch (model.type) {
|
||||||
@@ -204,7 +205,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
private itemService: ItemDataService,
|
private itemService: ItemDataService,
|
||||||
private relationshipService: RelationshipService,
|
private relationshipService: RelationshipService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
private store: Store<AppState>
|
private store: Store<AppState>,
|
||||||
|
private submissionObjectService: SubmissionObjectDataService
|
||||||
) {
|
) {
|
||||||
super(componentFactoryResolver, layoutService, validationService);
|
super(componentFactoryResolver, layoutService, validationService);
|
||||||
}
|
}
|
||||||
@@ -269,17 +271,22 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
openLookup() {
|
openLookup() {
|
||||||
this.model.workspaceItem.item.pipe(getSucceededRemoteData(), getRemoteDataPayload())
|
this.submissionObjectService
|
||||||
.subscribe((item: Item) => {
|
.findById(this.model.submissionId).pipe(
|
||||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg' });
|
getSucceededRemoteData(),
|
||||||
const modalComp = this.modalRef.componentInstance;
|
getRemoteDataPayload(),
|
||||||
modalComp.repeatable = this.model.repeatable;
|
switchMap((submissionObject: SubmissionObject) =>
|
||||||
modalComp.listId = this.listId;
|
(submissionObject.item as Observable<RemoteData<Item>>).pipe(getSucceededRemoteData(), getRemoteDataPayload()))
|
||||||
modalComp.relationshipOptions = this.model.relationship;
|
).subscribe((item: Item) => {
|
||||||
modalComp.label = this.model.label;
|
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg' });
|
||||||
modalComp.item = item;
|
const modalComp = this.modalRef.componentInstance;
|
||||||
modalComp.metadataFields = this.model.metadataFields;
|
modalComp.repeatable = this.model.repeatable;
|
||||||
})
|
modalComp.listId = this.listId;
|
||||||
|
modalComp.relationshipOptions = this.model.relationship;
|
||||||
|
modalComp.label = this.model.label;
|
||||||
|
modalComp.item = item;
|
||||||
|
modalComp.metadataFields = this.model.metadataFields;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
removeSelection(object: SearchResult<Item>) {
|
removeSelection(object: SearchResult<Item>) {
|
||||||
|
@@ -5,7 +5,6 @@ import { Subject } from 'rxjs';
|
|||||||
import { isNotEmpty } from '../../../../empty.util';
|
import { isNotEmpty } from '../../../../empty.util';
|
||||||
import { DsDynamicInputModel } from './ds-dynamic-input.model';
|
import { DsDynamicInputModel } from './ds-dynamic-input.model';
|
||||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
|
||||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||||
|
|
||||||
export const CONCAT_GROUP_SUFFIX = '_CONCAT_GROUP';
|
export const CONCAT_GROUP_SUFFIX = '_CONCAT_GROUP';
|
||||||
@@ -15,22 +14,22 @@ export const CONCAT_SECOND_INPUT_SUFFIX = '_CONCAT_SECOND_INPUT';
|
|||||||
export interface DynamicConcatModelConfig extends DynamicFormGroupModelConfig {
|
export interface DynamicConcatModelConfig extends DynamicFormGroupModelConfig {
|
||||||
separator: string;
|
separator: string;
|
||||||
value?: any;
|
value?: any;
|
||||||
workspaceItem: WorkspaceItem;
|
|
||||||
relationship?: RelationshipOptions;
|
relationship?: RelationshipOptions;
|
||||||
repeatable: boolean;
|
repeatable: boolean;
|
||||||
required: boolean;
|
required: boolean;
|
||||||
metadataFields: string[];
|
metadataFields: string[];
|
||||||
|
submissionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DynamicConcatModel extends DynamicFormGroupModel {
|
export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||||
|
|
||||||
@serializable() separator: string;
|
@serializable() separator: string;
|
||||||
@serializable() hasLanguages = false;
|
@serializable() hasLanguages = false;
|
||||||
@serializable() workspaceItem: WorkspaceItem;
|
|
||||||
@serializable() relationship?: RelationshipOptions;
|
@serializable() relationship?: RelationshipOptions;
|
||||||
@serializable() repeatable?: boolean;
|
@serializable() repeatable?: boolean;
|
||||||
@serializable() required?: boolean;
|
@serializable() required?: boolean;
|
||||||
@serializable() metadataFields: string[];
|
@serializable() metadataFields: string[];
|
||||||
|
@serializable() submissionId: string;
|
||||||
|
|
||||||
isCustomGroup = true;
|
isCustomGroup = true;
|
||||||
valueUpdates: Subject<string>;
|
valueUpdates: Subject<string>;
|
||||||
@@ -41,10 +40,10 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
|||||||
|
|
||||||
this.separator = config.separator + ' ';
|
this.separator = config.separator + ' ';
|
||||||
this.relationship = config.relationship;
|
this.relationship = config.relationship;
|
||||||
this.workspaceItem = config.workspaceItem;
|
|
||||||
this.repeatable = config.repeatable;
|
this.repeatable = config.repeatable;
|
||||||
this.required = config.required;
|
this.required = config.required;
|
||||||
this.metadataFields = config.metadataFields;
|
this.metadataFields = config.metadataFields;
|
||||||
|
this.submissionId = config.submissionId;
|
||||||
|
|
||||||
this.valueUpdates = new Subject<string>();
|
this.valueUpdates = new Subject<string>();
|
||||||
this.valueUpdates.subscribe((value: string) => this.value = value);
|
this.valueUpdates.subscribe((value: string) => this.value = value);
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { DynamicFormControlLayout, DynamicInputModel, DynamicInputModelConfig, serializable } from '@ng-dynamic-forms/core';
|
||||||
DynamicFormControlLayout,
|
|
||||||
DynamicInputModel,
|
|
||||||
DynamicInputModelConfig,
|
|
||||||
serializable
|
|
||||||
} from '@ng-dynamic-forms/core';
|
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
import { LanguageCode } from '../../models/form-field-language-value.model';
|
import { LanguageCode } from '../../models/form-field-language-value.model';
|
||||||
@@ -11,10 +6,8 @@ import { AuthorityOptions } from '../../../../../core/integration/models/authori
|
|||||||
import { hasValue } from '../../../../empty.util';
|
import { hasValue } from '../../../../empty.util';
|
||||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
|
||||||
|
|
||||||
export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
||||||
workspaceItem: WorkspaceItem;
|
|
||||||
authorityOptions?: AuthorityOptions;
|
authorityOptions?: AuthorityOptions;
|
||||||
languageCodes?: LanguageCode[];
|
languageCodes?: LanguageCode[];
|
||||||
language?: string;
|
language?: string;
|
||||||
@@ -22,6 +15,7 @@ export interface DsDynamicInputModelConfig extends DynamicInputModelConfig {
|
|||||||
relationship?: RelationshipOptions;
|
relationship?: RelationshipOptions;
|
||||||
repeatable: boolean;
|
repeatable: boolean;
|
||||||
metadataFields: string[];
|
metadataFields: string[];
|
||||||
|
submissionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DsDynamicInputModel extends DynamicInputModel {
|
export class DsDynamicInputModel extends DynamicInputModel {
|
||||||
@@ -30,10 +24,10 @@ export class DsDynamicInputModel extends DynamicInputModel {
|
|||||||
@serializable() private _languageCodes: LanguageCode[];
|
@serializable() private _languageCodes: LanguageCode[];
|
||||||
@serializable() private _language: string;
|
@serializable() private _language: string;
|
||||||
@serializable() languageUpdates: Subject<string>;
|
@serializable() languageUpdates: Subject<string>;
|
||||||
@serializable() workspaceItem: WorkspaceItem;
|
|
||||||
@serializable() relationship?: RelationshipOptions;
|
@serializable() relationship?: RelationshipOptions;
|
||||||
@serializable() repeatable?: boolean;
|
@serializable() repeatable?: boolean;
|
||||||
@serializable() metadataFields: string[];
|
@serializable() metadataFields: string[];
|
||||||
|
@serializable() submissionId: string;
|
||||||
|
|
||||||
constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) {
|
constructor(config: DsDynamicInputModelConfig, layout?: DynamicFormControlLayout) {
|
||||||
super(config, layout);
|
super(config, layout);
|
||||||
@@ -43,7 +37,8 @@ export class DsDynamicInputModel extends DynamicInputModel {
|
|||||||
this.readOnly = config.readOnly;
|
this.readOnly = config.readOnly;
|
||||||
this.value = config.value;
|
this.value = config.value;
|
||||||
this.relationship = config.relationship;
|
this.relationship = config.relationship;
|
||||||
this.workspaceItem = config.workspaceItem;
|
this.submissionId = config.submissionId;
|
||||||
|
|
||||||
this.language = config.language;
|
this.language = config.language;
|
||||||
if (!this.language) {
|
if (!this.language) {
|
||||||
// TypeAhead
|
// TypeAhead
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { DynamicFormArrayModel, DynamicFormArrayModelConfig, DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
||||||
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
|
||||||
DynamicFormArrayModel, DynamicFormArrayModelConfig, DynamicFormControlLayout,
|
|
||||||
serializable
|
|
||||||
} from '@ng-dynamic-forms/core';
|
|
||||||
import { DYNAMIC_FORM_CONTROL_TYPE_TAG } from './tag/dynamic-tag.model';
|
|
||||||
|
|
||||||
export interface DynamicRowArrayModelConfig extends DynamicFormArrayModelConfig {
|
export interface DynamicRowArrayModelConfig extends DynamicFormArrayModelConfig {
|
||||||
notRepeatable: boolean;
|
notRepeatable: boolean;
|
||||||
|
@@ -50,7 +50,8 @@ let LOOKUP_TEST_MODEL_CONFIG = {
|
|||||||
separator: ',',
|
separator: ',',
|
||||||
validators: { required: null },
|
validators: { required: null },
|
||||||
value: undefined,
|
value: undefined,
|
||||||
workspaceItem: new WorkspaceItem()
|
metadataFields: [],
|
||||||
|
submissionId: '1234'
|
||||||
};
|
};
|
||||||
|
|
||||||
let LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
let LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
||||||
@@ -73,7 +74,8 @@ let LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
|||||||
separator: ',',
|
separator: ',',
|
||||||
validators: { required: null },
|
validators: { required: null },
|
||||||
value: undefined,
|
value: undefined,
|
||||||
workspaceItem: new WorkspaceItem()
|
metadataFields: [],
|
||||||
|
submissionId: '1234'
|
||||||
};
|
};
|
||||||
|
|
||||||
let LOOKUP_TEST_GROUP = new FormGroup({
|
let LOOKUP_TEST_GROUP = new FormGroup({
|
||||||
@@ -105,7 +107,8 @@ describe('Dynamic Lookup component', () => {
|
|||||||
separator: ',',
|
separator: ',',
|
||||||
validators: { required: null },
|
validators: { required: null },
|
||||||
value: undefined,
|
value: undefined,
|
||||||
workspaceItem: new WorkspaceItem()
|
metadataFields: [],
|
||||||
|
submissionId: '1234'
|
||||||
};
|
};
|
||||||
|
|
||||||
LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
LOOKUP_NAME_TEST_MODEL_CONFIG = {
|
||||||
@@ -128,7 +131,8 @@ describe('Dynamic Lookup component', () => {
|
|||||||
separator: ',',
|
separator: ',',
|
||||||
validators: { required: null },
|
validators: { required: null },
|
||||||
value: undefined,
|
value: undefined,
|
||||||
workspaceItem: new WorkspaceItem()
|
metadataFields: [],
|
||||||
|
submissionId: '1234'
|
||||||
};
|
};
|
||||||
|
|
||||||
LOOKUP_TEST_GROUP = new FormGroup({
|
LOOKUP_TEST_GROUP = new FormGroup({
|
||||||
|
@@ -81,7 +81,8 @@ function init() {
|
|||||||
scopeUUID: '43fe1f8c-09a6-4fcf-9c78-5d4fed8f2c8f',
|
scopeUUID: '43fe1f8c-09a6-4fcf-9c78-5d4fed8f2c8f',
|
||||||
submissionScope: undefined,
|
submissionScope: undefined,
|
||||||
validators: { required: null },
|
validators: { required: null },
|
||||||
repeatable: false
|
repeatable: false,
|
||||||
|
metadataFields: []
|
||||||
} as DynamicRelationGroupModelConfig;
|
} as DynamicRelationGroupModelConfig;
|
||||||
|
|
||||||
FORM_GROUP_TEST_GROUP = new FormGroup({
|
FORM_GROUP_TEST_GROUP = new FormGroup({
|
||||||
|
@@ -97,7 +97,6 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
|||||||
config,
|
config,
|
||||||
this.model.scopeUUID,
|
this.model.scopeUUID,
|
||||||
{},
|
{},
|
||||||
this.model.workspaceItem,
|
|
||||||
this.model.submissionScope,
|
this.model.submissionScope,
|
||||||
this.model.readOnly);
|
this.model.readOnly);
|
||||||
this.initChipsFromModelValue();
|
this.initChipsFromModelValue();
|
||||||
|
@@ -16,7 +16,6 @@ import { DsDynamicScrollableDropdownComponent } from './dynamic-scrollable-dropd
|
|||||||
import { DynamicScrollableDropdownModel } from './dynamic-scrollable-dropdown.model';
|
import { DynamicScrollableDropdownModel } from './dynamic-scrollable-dropdown.model';
|
||||||
import { AuthorityValue } from '../../../../../../core/integration/models/authority.value';
|
import { AuthorityValue } from '../../../../../../core/integration/models/authority.value';
|
||||||
import { createTestComponent, hasClass } from '../../../../../testing/utils';
|
import { createTestComponent, hasClass } from '../../../../../testing/utils';
|
||||||
import { WorkspaceItem } from '../../../../../../core/submission/models/workspaceitem.model';
|
|
||||||
|
|
||||||
export const SD_TEST_GROUP = new FormGroup({
|
export const SD_TEST_GROUP = new FormGroup({
|
||||||
dropdown: new FormControl(),
|
dropdown: new FormControl(),
|
||||||
@@ -40,7 +39,8 @@ export const SD_TEST_MODEL_CONFIG = {
|
|||||||
required: false,
|
required: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: undefined,
|
value: undefined,
|
||||||
workspaceItem: new WorkspaceItem()
|
metadataFields: [],
|
||||||
|
submissionId: '1234'
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Dynamic Dynamic Scrollable Dropdown component', () => {
|
describe('Dynamic Dynamic Scrollable Dropdown component', () => {
|
||||||
|
@@ -41,5 +41,5 @@ export function nameVariantReducer(state: NameVariantListsState = {}, action: Na
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setNameVariant(state: NameVariantListState, itemID: string, nameVariant: string) {
|
function setNameVariant(state: NameVariantListState, itemID: string, nameVariant: string) {
|
||||||
return Object.assign({}, state, { [itemID]: { nameVariant } });
|
return Object.assign({}, state, { [itemID]: nameVariant });
|
||||||
}
|
}
|
||||||
|
@@ -195,11 +195,11 @@ describe('FormBuilderService test suite', () => {
|
|||||||
|
|
||||||
new DynamicColorPickerModel({id: 'testColorPicker'}),
|
new DynamicColorPickerModel({id: 'testColorPicker'}),
|
||||||
|
|
||||||
new DynamicTypeaheadModel({id: 'testTypeahead', repeatable: false}),
|
new DynamicTypeaheadModel({id: 'testTypeahead', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
||||||
|
|
||||||
new DynamicScrollableDropdownModel({id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false}),
|
new DynamicScrollableDropdownModel({id: 'testScrollableDropdown', authorityOptions: authorityOptions, repeatable: false, metadataFields: [], submissionId: '1234'}),
|
||||||
|
|
||||||
new DynamicTagModel({id: 'testTag', repeatable: false}),
|
new DynamicTagModel({id: 'testTag', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
||||||
|
|
||||||
new DynamicListCheckboxGroupModel({id: 'testCheckboxList', authorityOptions: authorityOptions, repeatable: true}),
|
new DynamicListCheckboxGroupModel({id: 'testCheckboxList', authorityOptions: authorityOptions, repeatable: true}),
|
||||||
|
|
||||||
@@ -243,14 +243,15 @@ describe('FormBuilderService test suite', () => {
|
|||||||
relationFields: [],
|
relationFields: [],
|
||||||
scopeUUID: '',
|
scopeUUID: '',
|
||||||
submissionScope: '',
|
submissionScope: '',
|
||||||
repeatable: false
|
repeatable: false,
|
||||||
|
metadataFields: []
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new DynamicDsDatePickerModel({id: 'testDate'}),
|
new DynamicDsDatePickerModel({id: 'testDate'}),
|
||||||
|
|
||||||
new DynamicLookupModel({id: 'testLookup', repeatable: false}),
|
new DynamicLookupModel({id: 'testLookup', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
||||||
|
|
||||||
new DynamicLookupNameModel({id: 'testLookupName', repeatable: false}),
|
new DynamicLookupNameModel({id: 'testLookupName', repeatable: false, metadataFields: [], submissionId: '1234'}),
|
||||||
|
|
||||||
new DynamicQualdropModel({id: 'testCombobox', readOnly: false, required: false}),
|
new DynamicQualdropModel({id: 'testCombobox', readOnly: false, required: false}),
|
||||||
|
|
||||||
|
@@ -199,6 +199,8 @@ export abstract class FieldParser {
|
|||||||
controlModel.relationship = this.configData.selectableRelationship;
|
controlModel.relationship = this.configData.selectableRelationship;
|
||||||
controlModel.repeatable = this.configData.repeatable;
|
controlModel.repeatable = this.configData.repeatable;
|
||||||
controlModel.metadataFields = isNotEmpty(this.configData.selectableMetadata) ? this.configData.selectableMetadata.map((metadataObject) => metadataObject.metadata) : [];
|
controlModel.metadataFields = isNotEmpty(this.configData.selectableMetadata) ? this.configData.selectableMetadata.map((metadataObject) => metadataObject.metadata) : [];
|
||||||
|
controlModel.submissionId = this.submissionId;
|
||||||
|
|
||||||
// Set label
|
// Set label
|
||||||
this.setLabel(controlModel, label);
|
this.setLabel(controlModel, label);
|
||||||
|
|
||||||
|
@@ -108,7 +108,11 @@ export class ParserFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case undefined: {
|
case undefined: {
|
||||||
return DisabledFieldParser
|
return {
|
||||||
|
provide: FieldParser,
|
||||||
|
useClass: DisabledFieldParser,
|
||||||
|
deps: [...fieldParserDeps]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@@ -55,7 +55,7 @@ export const qualdropInputConfig = {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: 'test',
|
value: 'test',
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,7 +136,6 @@ const relationGroupConfig = {
|
|||||||
'issue test 2'
|
'issue test 2'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
workspaceItem: new WorkspaceItem(),
|
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -165,7 +164,7 @@ export const inputWithLanguageAndAuthorityConfig = {
|
|||||||
display: 'testWithLanguageAndAuthority',
|
display: 'testWithLanguageAndAuthority',
|
||||||
id: 'testWithLanguageAndAuthority',
|
id: 'testWithLanguageAndAuthority',
|
||||||
},
|
},
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -189,7 +188,7 @@ export const inputWithLanguageConfig = {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: 'testWithLanguage',
|
value: 'testWithLanguage',
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -218,7 +217,7 @@ export const inputWithLanguageAndAuthorityArrayConfig = {
|
|||||||
display: 'testLanguageAndAuthorityArray',
|
display: 'testLanguageAndAuthorityArray',
|
||||||
id: 'testLanguageAndAuthorityArray',
|
id: 'testLanguageAndAuthorityArray',
|
||||||
}],
|
}],
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -231,7 +230,7 @@ export const inputWithFormFieldValueConfig = {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: new FormFieldMetadataValueObject('testWithFormFieldValue'),
|
value: new FormFieldMetadataValueObject('testWithFormFieldValue'),
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -244,7 +243,7 @@ export const inputWithAuthorityValueConfig = {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }),
|
value: Object.assign({}, new AuthorityValue(), { value: 'testWithAuthorityValue', id: 'testWithAuthorityValue', display: 'testWithAuthorityValue' }),
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -257,7 +256,7 @@ export const inputWithObjectValueConfig = {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' },
|
value: { value: 'testWithObjectValue', id: 'testWithObjectValue', display: 'testWithObjectValue' },
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -274,7 +273,7 @@ export const fileFormEditInputConfig = {
|
|||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
repeatable: false,
|
repeatable: false,
|
||||||
workspaceItem: new WorkspaceItem(),
|
submissionId: '1234',
|
||||||
metadataFields: []
|
metadataFields: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -118,11 +118,11 @@ const testFormConfiguration = {
|
|||||||
const testFormModel = [
|
const testFormModel = [
|
||||||
new DynamicRowGroupModel({
|
new DynamicRowGroupModel({
|
||||||
id: 'df-row-group-config-1',
|
id: 'df-row-group-config-1',
|
||||||
group: [new DsDynamicInputModel({ id: 'dc.title', workspaceItem: new WorkspaceItem(), repeatable: false })],
|
group: [new DsDynamicInputModel({ id: 'dc.title', metadataFields: [], repeatable: false, submissionId: '1234' })],
|
||||||
}),
|
}),
|
||||||
new DynamicRowGroupModel({
|
new DynamicRowGroupModel({
|
||||||
id: 'df-row-group-config-2',
|
id: 'df-row-group-config-2',
|
||||||
group: [new DsDynamicInputModel({ id: 'dc.contributor', workspaceItem: new WorkspaceItem(), repeatable: false })],
|
group: [new DsDynamicInputModel({ id: 'dc.contributor', metadataFields: [], repeatable: false, submissionId: '1234' })],
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -233,7 +233,6 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
|||||||
this.formConfig,
|
this.formConfig,
|
||||||
this.collectionId,
|
this.collectionId,
|
||||||
sectionData,
|
sectionData,
|
||||||
this.workspaceItem,
|
|
||||||
this.submissionService.getSubmissionScope()
|
this.submissionService.getSubmissionScope()
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@@ -170,7 +170,6 @@ export class SubmissionSectionUploadFileEditComponent implements OnChanges {
|
|||||||
configForm,
|
configForm,
|
||||||
this.collectionId,
|
this.collectionId,
|
||||||
this.fileData.metadata,
|
this.fileData.metadata,
|
||||||
undefined,
|
|
||||||
this.submissionService.getSubmissionScope()
|
this.submissionService.getSubmissionScope()
|
||||||
);
|
);
|
||||||
formModel.push(new DynamicFormGroupModel(metadataGroupModelConfig, BITSTREAM_METADATA_FORM_GROUP_LAYOUT));
|
formModel.push(new DynamicFormGroupModel(metadataGroupModelConfig, BITSTREAM_METADATA_FORM_GROUP_LAYOUT));
|
||||||
|
Reference in New Issue
Block a user