mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CSTPER-3620] Workflow Actions refresh entire MyDSpace page instead of just WorkflowItem
Lint
This commit is contained in:
@@ -101,7 +101,7 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
console.log('Destroy of ClaimedTaskActionComponent', this.object)
|
||||
console.log('Destroy of ClaimedTaskActionComponent', this.object);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { SearchService } from '../../core/shared/search/search.service';
|
||||
|
||||
export interface MyDSpaceActionsResult {
|
||||
result: boolean,
|
||||
reloadedObject: DSpaceObject,
|
||||
result: boolean;
|
||||
reloadedObject: DSpaceObject;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,6 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
||||
* Refresh current page
|
||||
*/
|
||||
reload(): void {
|
||||
debugger;
|
||||
|
||||
this.router.navigated = false;
|
||||
const url = decodeURIComponent(this.router.url);
|
||||
@@ -106,7 +105,6 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
||||
* Override the target object with a refreshed one
|
||||
*/
|
||||
refresh(): void {
|
||||
debugger;
|
||||
|
||||
// find object by id
|
||||
this.objectDataService.findById(this.object.id).pipe(
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
|
||||
import { Router } from '@angular/router';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
@@ -69,8 +69,8 @@ const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
||||
mockObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
|
||||
|
||||
describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
mockDataService = new PoolTaskDataService(null, null, null, null, null, null, null, null)
|
||||
beforeEach(fakeAsync(() => {
|
||||
mockDataService = new PoolTaskDataService(null, null, null, null, null, null, null, null);
|
||||
mockClaimedTaskDataService = new ClaimedTaskDataService(null, null, null, null, null, null, null, null);
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
@@ -118,7 +118,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
spyOn(component, 'initObjects');
|
||||
});
|
||||
|
||||
it('should call initReloadAnchor and initObjects on init', async(() => {
|
||||
it('should call initReloadAnchor and initObjects on init', fakeAsync(() => {
|
||||
component.ngOnInit();
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -130,7 +130,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
|
||||
}));
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
describe('on action execution fail', () => {
|
||||
|
||||
@@ -158,7 +158,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(notificationsServiceStub.error).toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should not call reloadObject', (done) => {
|
||||
@@ -166,7 +166,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.reloadObjectExecution).not.toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -175,7 +175,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.processCompleted.emit).not.toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -206,7 +206,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.reloadObjectExecution).toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should convert the reloaded object', (done) => {
|
||||
@@ -214,7 +214,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.convertReloadedObject).toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('should emit the reloaded object in case of success', (done) => {
|
||||
@@ -222,7 +222,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.processCompleted.emit).toHaveBeenCalledWith({result: true, reloadedObject: result as any});
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -252,7 +252,7 @@ describe('MyDSpaceReloadableActionsComponent', () => {
|
||||
component.startActionExecution().subscribe( (result) => {
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { waitForAsync, ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Router } from '@angular/router';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
@@ -75,7 +75,7 @@ mockObject = Object.assign(new PoolTask(), { workflowitem: observableOf(rdWorkfl
|
||||
|
||||
describe('PoolTaskActionsComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
mockDataService = new PoolTaskDataService(null, null, null, null, null, null, null, null)
|
||||
mockDataService = new PoolTaskDataService(null, null, null, null, null, null, null, null);
|
||||
mockClaimedTaskDataService = new ClaimedTaskDataService(null, null, null, null, null, null, null, null);
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
@@ -160,7 +160,7 @@ describe('PoolTaskActionsComponent', () => {
|
||||
expect(notificationsServiceStub.success).toHaveBeenCalled();
|
||||
|
||||
done();
|
||||
})
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import {Component, Injector, Input, OnDestroy} from '@angular/core';
|
||||
import { Component, Injector, Input, OnDestroy } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -92,7 +92,7 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
||||
return this.objectDataService.getPoolTaskEndpointById(this.object.id)
|
||||
.pipe(switchMap((poolTaskHref) => {
|
||||
return this.claimedTaskService.claimTask(this.object.id, poolTaskHref);
|
||||
}))
|
||||
}));
|
||||
}
|
||||
|
||||
reloadObjectExecution(): Observable<RemoteData<DSpaceObject> | DSpaceObject> {
|
||||
@@ -111,12 +111,12 @@ export class PoolTaskActionsComponent extends MyDSpaceReloadableActionsComponent
|
||||
))
|
||||
.subscribe((item: Item) => {
|
||||
this.itemUuid = item.uuid;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subs.forEach((sub) => sub.unsubscribe());
|
||||
console.log('Destroy of PoolTaskActionsComponent', this.object)
|
||||
console.log('Destroy of PoolTaskActionsComponent', this.object);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -162,7 +162,9 @@ export class ListableObjectComponentLoaderComponent implements OnInit, OnDestroy
|
||||
* Fetch the component depending on the item's relationship type, view mode and context
|
||||
* @returns {GenericConstructor<Component>}
|
||||
*/
|
||||
getComponent(object, viewMode: ViewMode, context: Context): GenericConstructor<Component> {
|
||||
return getListableObjectComponent(object.getRenderTypes(), viewMode, context);
|
||||
getComponent(renderTypes: (string | GenericConstructor<ListableObject>)[],
|
||||
viewMode: ViewMode,
|
||||
context: Context): GenericConstructor<Component> {
|
||||
return getListableObjectComponent(renderTypes, viewMode, context);
|
||||
}
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ describe('PoolSearchResultDetailElementComponent', () => {
|
||||
spyOn(component.reloadedObject, 'emit').and.callThrough();
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
const actionsComponents = fixture.debugElement.query(By.css('ds-pool-task-actions'));
|
||||
actionsComponents.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponents.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
@@ -104,7 +104,7 @@ describe('ClaimedSearchResultListElementComponent', () => {
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
|
||||
const actionsComponent = fixture.debugElement.query(By.css('ds-claimed-task-actions'));
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
@@ -80,7 +80,7 @@ describe('ItemMyDSpaceResultListElementComponent', () => {
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
|
||||
const actionsComponent = fixture.debugElement.query(By.css('ds-item-actions'));
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
@@ -103,7 +103,7 @@ describe('PoolSearchResultListElementComponent', () => {
|
||||
spyOn(component.reloadedObject, 'emit').and.callThrough();
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
const actionsComponents = fixture.debugElement.query(By.css('ds-pool-task-actions'));
|
||||
actionsComponents.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponents.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
@@ -101,7 +101,7 @@ describe('WorkflowItemSearchResultListElementComponent', () => {
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
|
||||
const actionsComponent = fixture.debugElement.query(By.css('ds-workflowitem-actions'));
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
@@ -101,7 +101,7 @@ describe('WorkspaceItemSearchResultListElementComponent', () => {
|
||||
const actionPayload: any = { reloadedObject: {}};
|
||||
|
||||
const actionsComponent = fixture.debugElement.query(By.css('ds-workspaceitem-actions'));
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload)
|
||||
actionsComponent.triggerEventHandler('processCompleted', actionPayload);
|
||||
tick();
|
||||
|
||||
expect(component.reloadedObject.emit).toHaveBeenCalledWith(actionPayload.reloadedObject);
|
||||
|
Reference in New Issue
Block a user