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) {
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)
}

View File

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

View File

@@ -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<any> {
const modalRef = this.modalService.open(NameVariantModalComponent, { centered: true });
const modalComp = modalRef.componentInstance;
modalComp.value = value;
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)"
(keydown.arrowdown)="shiftFocusDown($event)"
(keydown.arrowup)="shiftFocusUp($event)" (keydown.esc)="close()"
(dsClickOutside)="close();">
<input #inputField type="text" [(ngModel)]="value" [name]="name"
<input #inputField type="text" [ngModel]="value" [name]="name"
class="form-control suggestion_input"
(focus)="open()"
(blur)="onSubmit(inputField.value)"
(click)="open()"
[ngClass]="{'is-invalid': !valid}"
[dsDebounce]="debounceTime" (onDebounce)="find($event)"
@@ -21,4 +22,4 @@
</div>
</div>
</div>
</form>
</form>

View File

@@ -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;
}
}
}

View File

@@ -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) {

View File

@@ -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('');
});
});

View File

@@ -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<SubmissionObject>)
)
}),
map((submissionObject) => new SaveSubmissionSectionFormSuccessAction(updateAfterPatchSubmissionId, [submissionObject], false))
);
@@ -163,7 +173,6 @@ export class RelationshipEffects {
const refreshWorkspaceItemInCache = (submissionId, submissionObjectService, objectCache, requestService) =>
<T>(source: Observable<T>): Observable<SubmissionObject> =>
source.pipe(
tap(() => console.log(submissionId)),
switchMap(() => submissionObjectService.getHrefByID(submissionId).pipe(take(1))),
switchMap((href: string) => {
objectCache.remove(href);

View File

@@ -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);