mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
final bug fixing
This commit is contained in:
4
src/app/core/cache/object-cache.reducer.ts
vendored
4
src/app/core/cache/object-cache.reducer.ts
vendored
@@ -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)
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
@@ -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('');
|
||||
});
|
||||
});
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user