mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
trying to fix query in submission entities
This commit is contained in:
@@ -72,6 +72,7 @@ import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
||||
import { FormService } from '../../form.service';
|
||||
import { SubmissionService } from '../../../../submission/submission.service';
|
||||
|
||||
describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
@@ -177,6 +178,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
{ provide: RelationshipService, useValue: {} },
|
||||
{ provide: SelectableListService, useValue: {} },
|
||||
{ provide: FormService, useValue: {} },
|
||||
{ provide: SubmissionService, useValue: {} },
|
||||
{
|
||||
provide: SubmissionObjectDataService,
|
||||
useValue: {
|
||||
|
@@ -99,6 +99,7 @@ import { MetadataValue } from '../../../../core/shared/metadata.models';
|
||||
import { FormService } from '../../form.service';
|
||||
import { deepClone } from 'fast-json-patch';
|
||||
import { SelectableListState } from '../../../object-list/selectable-list/selectable-list.reducer';
|
||||
import { SubmissionService } from '../../../../submission/submission.service';
|
||||
|
||||
export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type<DynamicFormControl> | null {
|
||||
switch (model.type) {
|
||||
@@ -224,7 +225,8 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
private store: Store<AppState>,
|
||||
private submissionObjectService: SubmissionObjectDataService,
|
||||
private ref: ChangeDetectorRef,
|
||||
private formService: FormService
|
||||
private formService: FormService,
|
||||
private submissionService: SubmissionService
|
||||
) {
|
||||
super(componentFactoryResolver, layoutService, validationService, dynamicFormInstanceService);
|
||||
}
|
||||
@@ -318,11 +320,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
* Open a modal where the user can select relationships to be added to item being submitted
|
||||
*/
|
||||
openLookup() {
|
||||
// const event = this.createDynamicFormControlEvent(new CustomEvent('open'), 'change');
|
||||
// event.control = this.control;
|
||||
// event.model = this.model;
|
||||
// this.onChange(event);
|
||||
this.formService.removeForm(this.formId);
|
||||
|
||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, {
|
||||
size: 'lg'
|
||||
});
|
||||
@@ -330,8 +328,11 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
|
||||
modalComp.query = this.model.value ? this.model.value.value : '';
|
||||
if (hasValue(this.model.value)) {
|
||||
modalComp.selectEvent.pipe(take(1)).subscribe(() => this.model.value = '');
|
||||
this.model.valueUpdates.next('');
|
||||
this.change.emit();
|
||||
}
|
||||
this.submissionService.dispatchSave(this.model.submissionId);
|
||||
|
||||
modalComp.repeatable = this.model.repeatable;
|
||||
modalComp.listId = this.listId;
|
||||
modalComp.relationshipOptions = this.model.relationship;
|
||||
|
@@ -73,11 +73,6 @@ export class ReorderableFormFieldMetadataValue extends Reorderable {
|
||||
}
|
||||
|
||||
update(): Observable<FormFieldMetadataValueObject> {
|
||||
// this.metadataValue.place = this.newIndex;
|
||||
// this.model.valueUpdates.next(this.metadataValue.value);
|
||||
// console.log('this.model', this.model);
|
||||
// this.control.markAsDirty();
|
||||
// console.log('this.control.value', this.control.value);
|
||||
this.oldIndex = this.newIndex;
|
||||
return observableOf(this.metadataValue);
|
||||
}
|
||||
|
@@ -185,13 +185,12 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent imple
|
||||
|
||||
onChange($event) {
|
||||
let event = $event;
|
||||
if (hasNoValue($event.context)) {
|
||||
if (hasValue($event) && hasNoValue($event.context)) {
|
||||
const context = Object.assign({}, $event.context, { index: this.reorderables.length });
|
||||
event = Object.assign({}, $event, { context });
|
||||
} else {
|
||||
this.updateReorderables();
|
||||
}
|
||||
super.onChange(event);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ import { DynamicFormControlLayout, DynamicFormGroupModel, DynamicFormGroupModelC
|
||||
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import { isNotEmpty } from '../../../../empty.util';
|
||||
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';
|
||||
@@ -72,6 +72,9 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
} else {
|
||||
tempValue = value.value;
|
||||
}
|
||||
if (hasNoValue(tempValue)) {
|
||||
tempValue = '';
|
||||
}
|
||||
values = [...tempValue.split(this.separator), null].map((v) =>
|
||||
Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v }));
|
||||
|
||||
|
@@ -11,19 +11,13 @@ import { ListableObject } from '../../../../object-collection/shared/listable-ob
|
||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||
import { SearchResult } from '../../../../search/search-result.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
getRemoteDataPayload,
|
||||
getSucceededRemoteData
|
||||
} from '../../../../../core/shared/operators';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../core/shared/operators';
|
||||
import { AddRelationshipAction, RemoveRelationshipAction, UpdateRelationshipAction } from './relationship.actions';
|
||||
import { RelationshipService } from '../../../../../core/data/relationship.service';
|
||||
import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState } from '../../../../../app.reducer';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model';
|
||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
import { LookupRelationService } from '../../../../../core/data/lookup-relation.service';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||
@@ -150,7 +144,6 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
* @param selectableObjects
|
||||
*/
|
||||
select(...selectableObjects: Array<SearchResult<Item>>) {
|
||||
this.selectEvent.emit(selectableObjects);
|
||||
this.zone.runOutsideAngular(
|
||||
() => {
|
||||
const obs: Observable<any[]> = combineLatest(...selectableObjects.map((sri: SearchResult<Item>) => {
|
||||
|
@@ -302,10 +302,13 @@ export class FormComponent implements OnDestroy, OnInit {
|
||||
insertItem($event, arrayContext: DynamicFormArrayModel, index: number): void {
|
||||
const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray;
|
||||
this.formBuilderService.addFormArrayGroup(formArrayControl, arrayContext);
|
||||
this.addArrayItem.emit(this.getEvent($event, arrayContext, index, 'add'));
|
||||
|
||||
const value = formArrayControl.controls[index].value;
|
||||
formArrayControl.controls[formArrayControl.length - 1].setValue(value);
|
||||
formArrayControl.controls[index].reset();
|
||||
this.addArrayItem.emit(this.getEvent($event, arrayContext, index, 'add'));
|
||||
|
||||
this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext);
|
||||
this.formBuilderService.insertFormArrayGroup(index, formArrayControl, arrayContext);
|
||||
this.formService.changeForm(this.formId, this.formModel);
|
||||
}
|
||||
|
||||
|
@@ -333,6 +333,7 @@ export class SubmissionObjectEffects {
|
||||
if (notify && !currentState.sections[sectionId].enabled) {
|
||||
this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType);
|
||||
}
|
||||
console.log(submissionId, sectionId, sectionData, sectionErrors);
|
||||
mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, sectionErrors));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user