diff --git a/src/app/core/cache/object-cache.reducer.ts b/src/app/core/cache/object-cache.reducer.ts index 53a656e774..96ab0b277f 100644 --- a/src/app/core/cache/object-cache.reducer.ts +++ b/src/app/core/cache/object-cache.reducer.ts @@ -95,14 +95,10 @@ export function objectCacheReducer(state = initialState, action: ObjectCacheActi switch (action.type) { case ObjectCacheActionTypes.ADD: { - if ((action.payload as any).objectToCache instanceof NormalizedItem) { - console.log('ADD', (action.payload as any).objectToCache.self); - } return addToObjectCache(state, action as AddToObjectCacheAction); } case ObjectCacheActionTypes.REMOVE: { - console.log('REMOVE', action.payload); return removeFromObjectCache(state, action as RemoveFromObjectCacheAction) } diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index f1e833b9ac..e737bbf7fb 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -385,7 +385,6 @@ export class RelationshipService extends DataService { return this.update(updatedRelationship); }), tap((relationshipRD: RemoteData) => { - console.log(relationshipRD); if (relationshipRD.hasSucceeded && count < 1) { count++; this.refreshRelationshipItemsInCache(item1); diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts index 37fd77649b..f62b42cfee 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts @@ -71,26 +71,30 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu this.openModal(value) .then(() => { - const newName: MetadataValue = new MetadataValue(); - newName.value = value; + const newName: MetadataValue = new MetadataValue(); + newName.value = value; - const existingNames: MetadataValue[] = this.dso.metadata[this.alternativeField] || []; - const alternativeNames = { [this.alternativeField]: [...existingNames, newName] }; - const updatedItem = - Object.assign({}, this.dso, { - metadata: { - ...this.dso.metadata, - ...alternativeNames - }, - }); - this.itemDataService.update(updatedItem).pipe(take(1)).subscribe(); - }) + const existingNames: MetadataValue[] = this.dso.metadata[this.alternativeField] || []; + const alternativeNames = { [this.alternativeField]: [...existingNames, newName] }; + const updatedItem = + Object.assign({}, this.dso, { + metadata: { + ...this.dso.metadata, + ...alternativeNames + }, + }); + this.itemDataService.update(updatedItem).pipe(take(1)).subscribe(); + } + ).catch(() => { + /* empty, don't throw console error */ + }) } this.select(value); } openModal(value): Promise { const modalRef = this.modalService.open(NameVariantModalComponent, { centered: true }); + const modalComp = modalRef.componentInstance; modalComp.value = value; return modalRef.result; diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.html b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.html index e177b2b561..062e68da1f 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.html +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.html @@ -1,11 +1,12 @@ -
- -
\ No newline at end of file + diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.scss b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.scss index 8301e12c5f..d55951dd91 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.scss +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.scss @@ -1,5 +1,4 @@ form { - z-index: 1; &:before { position: absolute; font-weight: 900; @@ -9,10 +8,9 @@ form { right: 0; height: 20px; width: 20px; - z-index: -1; } input.suggestion_input { background: transparent; } -} \ No newline at end of file +} diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.ts index a1802ce1a7..5b4ecd9d2e 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-suggestions/person-input-suggestions.component.ts @@ -33,8 +33,10 @@ export class PersonInputSuggestionsComponent extends InputSuggestionsComponent i } onSubmit(data) { - this.value = data; - this.submitSuggestion.emit(data); + if (data !== this.value) { + this.value = data; + this.submitSuggestion.emit(data); + } } onClickSuggestion(data) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts index 8e0c6fc20e..c9e46106c5 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component.spec.ts @@ -52,7 +52,6 @@ describe('DsDynamicDisabledComponent', () => { it('should have a disabled input', () => { const input = de.query(By.css('input')); - console.log(input.nativeElement.getAttribute('disabled')); expect(input.nativeElement.getAttribute('disabled')).toEqual(''); }); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts index 3720072744..8e6fdeb5ab 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts @@ -108,11 +108,21 @@ export class RelationshipEffects { @Effect() commitServerSyncBuffer = this.actions$ .pipe( - ofType(ServerSyncBufferActionTypes.COMMIT), + ofType(ServerSyncBufferActionTypes.EMPTY), filter(() => hasValue(updateAfterPatchSubmissionId)), - tap(() => console.log('id', updateAfterPatchSubmissionId)), - refreshWorkspaceItemInCache('bla' + updateAfterPatchSubmissionId, this.submissionObjectService, this.objectCache, this.requestService), - tap(() => console.log('id nog s', updateAfterPatchSubmissionId)), + switchMap(() => this.submissionObjectService.getHrefByID(updateAfterPatchSubmissionId).pipe(take(1))), + switchMap((href: string) => { + this.objectCache.remove(href); + this.requestService.removeByHrefSubstring(updateAfterPatchSubmissionId); + return combineLatest( + this.objectCache.hasBySelfLinkObservable(href), + this.requestService.hasByHrefObservable(href) + ).pipe( + filter(([existsInOC, existsInRC]) => !existsInOC && !existsInRC), + take(1), + switchMap(() => this.submissionObjectService.findById(updateAfterPatchSubmissionId).pipe(getSucceededRemoteData(), getRemoteDataPayload()) as Observable) + ) + }), map((submissionObject) => new SaveSubmissionSectionFormSuccessAction(updateAfterPatchSubmissionId, [submissionObject], false)) ); @@ -163,7 +173,6 @@ export class RelationshipEffects { const refreshWorkspaceItemInCache = (submissionId, submissionObjectService, objectCache, requestService) => (source: Observable): Observable => source.pipe( - tap(() => console.log(submissionId)), switchMap(() => submissionObjectService.getHrefByID(submissionId).pipe(take(1))), switchMap((href: string) => { objectCache.remove(href); diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index 8648222234..6fa09f8398 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -293,7 +293,6 @@ export class FormComponent implements OnDestroy, OnInit { } removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void { - console.log(arrayContext, index); const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray; this.removeArrayItem.emit(this.getEvent($event, arrayContext, index - 1, 'remove')); this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext);