final bug fixing

This commit is contained in:
lotte
2020-02-03 14:49:06 +01:00
parent 360abb78de
commit d1b7f07c68
9 changed files with 40 additions and 33 deletions

View File

@@ -95,14 +95,10 @@ export function objectCacheReducer(state = initialState, action: ObjectCacheActi
switch (action.type) { switch (action.type) {
case ObjectCacheActionTypes.ADD: { 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); return addToObjectCache(state, action as AddToObjectCacheAction);
} }
case ObjectCacheActionTypes.REMOVE: { case ObjectCacheActionTypes.REMOVE: {
console.log('REMOVE', action.payload);
return removeFromObjectCache(state, action as RemoveFromObjectCacheAction) return removeFromObjectCache(state, action as RemoveFromObjectCacheAction)
} }

View File

@@ -385,7 +385,6 @@ export class RelationshipService extends DataService<Relationship> {
return this.update(updatedRelationship); return this.update(updatedRelationship);
}), }),
tap((relationshipRD: RemoteData<Relationship>) => { tap((relationshipRD: RemoteData<Relationship>) => {
console.log(relationshipRD);
if (relationshipRD.hasSucceeded && count < 1) { if (relationshipRD.hasSucceeded && count < 1) {
count++; count++;
this.refreshRelationshipItemsInCache(item1); this.refreshRelationshipItemsInCache(item1);

View File

@@ -71,26 +71,30 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
this.openModal(value) this.openModal(value)
.then(() => { .then(() => {
const newName: MetadataValue = new MetadataValue(); const newName: MetadataValue = new MetadataValue();
newName.value = value; newName.value = value;
const existingNames: MetadataValue[] = this.dso.metadata[this.alternativeField] || []; const existingNames: MetadataValue[] = this.dso.metadata[this.alternativeField] || [];
const alternativeNames = { [this.alternativeField]: [...existingNames, newName] }; const alternativeNames = { [this.alternativeField]: [...existingNames, newName] };
const updatedItem = const updatedItem =
Object.assign({}, this.dso, { Object.assign({}, this.dso, {
metadata: { metadata: {
...this.dso.metadata, ...this.dso.metadata,
...alternativeNames ...alternativeNames
}, },
}); });
this.itemDataService.update(updatedItem).pipe(take(1)).subscribe(); this.itemDataService.update(updatedItem).pipe(take(1)).subscribe();
}) }
).catch(() => {
/* empty, don't throw console error */
})
} }
this.select(value); this.select(value);
} }
openModal(value): Promise<any> { openModal(value): Promise<any> {
const modalRef = this.modalService.open(NameVariantModalComponent, { centered: true }); const modalRef = this.modalService.open(NameVariantModalComponent, { centered: true });
const modalComp = modalRef.componentInstance; const modalComp = modalRef.componentInstance;
modalComp.value = value; modalComp.value = value;
return modalRef.result; return modalRef.result;

View File

@@ -1,11 +1,12 @@
<form #form="ngForm" (ngSubmit)="onSubmit(value)" <form #form="ngForm" (ngSubmit)="onSubmit(inputField.value)"
[action]="action" (keydown)="onKeydown($event)" [action]="action" (keydown)="onKeydown($event)"
(keydown.arrowdown)="shiftFocusDown($event)" (keydown.arrowdown)="shiftFocusDown($event)"
(keydown.arrowup)="shiftFocusUp($event)" (keydown.esc)="close()" (keydown.arrowup)="shiftFocusUp($event)" (keydown.esc)="close()"
(dsClickOutside)="close();"> (dsClickOutside)="close();">
<input #inputField type="text" [(ngModel)]="value" [name]="name" <input #inputField type="text" [ngModel]="value" [name]="name"
class="form-control suggestion_input" class="form-control suggestion_input"
(focus)="open()" (focus)="open()"
(blur)="onSubmit(inputField.value)"
(click)="open()" (click)="open()"
[ngClass]="{'is-invalid': !valid}" [ngClass]="{'is-invalid': !valid}"
[dsDebounce]="debounceTime" (onDebounce)="find($event)" [dsDebounce]="debounceTime" (onDebounce)="find($event)"

View File

@@ -1,5 +1,4 @@
form { form {
z-index: 1;
&:before { &:before {
position: absolute; position: absolute;
font-weight: 900; font-weight: 900;
@@ -9,7 +8,6 @@ form {
right: 0; right: 0;
height: 20px; height: 20px;
width: 20px; width: 20px;
z-index: -1;
} }
input.suggestion_input { input.suggestion_input {

View File

@@ -33,8 +33,10 @@ export class PersonInputSuggestionsComponent extends InputSuggestionsComponent i
} }
onSubmit(data) { onSubmit(data) {
this.value = data; if (data !== this.value) {
this.submitSuggestion.emit(data); this.value = data;
this.submitSuggestion.emit(data);
}
} }
onClickSuggestion(data) { onClickSuggestion(data) {

View File

@@ -52,7 +52,6 @@ describe('DsDynamicDisabledComponent', () => {
it('should have a disabled input', () => { it('should have a disabled input', () => {
const input = de.query(By.css('input')); const input = de.query(By.css('input'));
console.log(input.nativeElement.getAttribute('disabled'));
expect(input.nativeElement.getAttribute('disabled')).toEqual(''); expect(input.nativeElement.getAttribute('disabled')).toEqual('');
}); });
}); });

View File

@@ -108,11 +108,21 @@ export class RelationshipEffects {
@Effect() commitServerSyncBuffer = this.actions$ @Effect() commitServerSyncBuffer = this.actions$
.pipe( .pipe(
ofType(ServerSyncBufferActionTypes.COMMIT), ofType(ServerSyncBufferActionTypes.EMPTY),
filter(() => hasValue(updateAfterPatchSubmissionId)), filter(() => hasValue(updateAfterPatchSubmissionId)),
tap(() => console.log('id', updateAfterPatchSubmissionId)), switchMap(() => this.submissionObjectService.getHrefByID(updateAfterPatchSubmissionId).pipe(take(1))),
refreshWorkspaceItemInCache('bla' + updateAfterPatchSubmissionId, this.submissionObjectService, this.objectCache, this.requestService), switchMap((href: string) => {
tap(() => console.log('id nog s', updateAfterPatchSubmissionId)), 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<SubmissionObject>)
)
}),
map((submissionObject) => new SaveSubmissionSectionFormSuccessAction(updateAfterPatchSubmissionId, [submissionObject], false)) map((submissionObject) => new SaveSubmissionSectionFormSuccessAction(updateAfterPatchSubmissionId, [submissionObject], false))
); );
@@ -163,7 +173,6 @@ export class RelationshipEffects {
const refreshWorkspaceItemInCache = (submissionId, submissionObjectService, objectCache, requestService) => const refreshWorkspaceItemInCache = (submissionId, submissionObjectService, objectCache, requestService) =>
<T>(source: Observable<T>): Observable<SubmissionObject> => <T>(source: Observable<T>): Observable<SubmissionObject> =>
source.pipe( source.pipe(
tap(() => console.log(submissionId)),
switchMap(() => submissionObjectService.getHrefByID(submissionId).pipe(take(1))), switchMap(() => submissionObjectService.getHrefByID(submissionId).pipe(take(1))),
switchMap((href: string) => { switchMap((href: string) => {
objectCache.remove(href); objectCache.remove(href);

View File

@@ -293,7 +293,6 @@ export class FormComponent implements OnDestroy, OnInit {
} }
removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void { removeItem($event, arrayContext: DynamicFormArrayModel, index: number): void {
console.log(arrayContext, index);
const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray; const formArrayControl = this.formGroup.get(this.formBuilderService.getPath(arrayContext)) as FormArray;
this.removeArrayItem.emit(this.getEvent($event, arrayContext, index - 1, 'remove')); this.removeArrayItem.emit(this.getEvent($event, arrayContext, index - 1, 'remove'));
this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext); this.formBuilderService.removeFormArrayGroup(index, formArrayControl, arrayContext);