mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 21:43:04 +00:00
98211: Created advanced workflow task pages
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<div class="container">
|
||||
<h2>{{'workflow-item.' + type + '.header' | translate}}</h2>
|
||||
<ds-advanced-workflow-actions-loader [type]="type">
|
||||
</ds-advanced-workflow-actions-loader>
|
||||
</div>
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdvancedWorkflowActionPageComponent } from './advanced-workflow-action-page.component';
|
||||
|
||||
describe('AdvancedWorkflowActionPageComponent', () => {
|
||||
let component: AdvancedWorkflowActionPageComponent;
|
||||
let fixture: ComponentFixture<AdvancedWorkflowActionPageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AdvancedWorkflowActionPageComponent,
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdvancedWorkflowActionPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-page',
|
||||
templateUrl: './advanced-workflow-action-page.component.html',
|
||||
styleUrls: ['./advanced-workflow-action-page.component.scss']
|
||||
})
|
||||
export class AdvancedWorkflowActionPageComponent implements OnInit {
|
||||
|
||||
public type: string;
|
||||
|
||||
constructor(
|
||||
protected route: ActivatedRoute,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.type = this.route.snapshot.queryParams.workflow;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<p>advanced-workflow-action-rating-reviewer works!</p>
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdvancedWorkflowActionRatingReviewerComponent } from './advanced-workflow-action-rating-reviewer.component';
|
||||
|
||||
describe('AdvancedWorkflowActionRatingReviewerComponent', () => {
|
||||
let component: AdvancedWorkflowActionRatingReviewerComponent;
|
||||
let fixture: ComponentFixture<AdvancedWorkflowActionRatingReviewerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdvancedWorkflowActionRatingReviewerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdvancedWorkflowActionRatingReviewerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,15 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {
|
||||
rendersAdvancedWorkflowTaskOption
|
||||
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
|
||||
|
||||
export const ADVANCED_WORKFLOW_ACTION_RATING_REVIEWER = 'ratingrevieweraction';
|
||||
|
||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_RATING_REVIEWER)
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-rating-reviewer',
|
||||
templateUrl: './advanced-workflow-action-rating-reviewer.component.html',
|
||||
styleUrls: ['./advanced-workflow-action-rating-reviewer.component.scss']
|
||||
})
|
||||
export class AdvancedWorkflowActionRatingReviewerComponent {
|
||||
}
|
@@ -0,0 +1 @@
|
||||
advancedInfo: {{ (workflowAction | async)?.advancedInfo | json }}
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdvancedWorkflowActionSelectReviewerComponent } from './advanced-workflow-action-select-reviewer.component';
|
||||
|
||||
describe('AdvancedWorkflowActionSelectReviewerComponent', () => {
|
||||
let component: AdvancedWorkflowActionSelectReviewerComponent;
|
||||
let fixture: ComponentFixture<AdvancedWorkflowActionSelectReviewerComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdvancedWorkflowActionSelectReviewerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdvancedWorkflowActionSelectReviewerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,16 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {
|
||||
rendersAdvancedWorkflowTaskOption
|
||||
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
|
||||
import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component';
|
||||
|
||||
export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
|
||||
|
||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER)
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-select-reviewer',
|
||||
templateUrl: './advanced-workflow-action-select-reviewer.component.html',
|
||||
styleUrls: ['./advanced-workflow-action-select-reviewer.component.scss'],
|
||||
})
|
||||
export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkflowActionComponent {
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<p>advanced-workflow-action works!</p>
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdvancedWorkflowActionComponent } from './advanced-workflow-action.component';
|
||||
|
||||
describe('AdvancedWorkflowActionComponent', () => {
|
||||
let component: AdvancedWorkflowActionComponent;
|
||||
let fixture: ComponentFixture<AdvancedWorkflowActionComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdvancedWorkflowActionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdvancedWorkflowActionComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,29 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
||||
import { WorkflowActionDataService } from '../../../core/data/workflow-action-data.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action',
|
||||
templateUrl: './advanced-workflow-action.component.html',
|
||||
styleUrls: ['./advanced-workflow-action.component.scss']
|
||||
})
|
||||
export class AdvancedWorkflowActionComponent implements OnInit {
|
||||
|
||||
workflowAction: Observable<WorkflowAction>;
|
||||
|
||||
constructor(
|
||||
protected route: ActivatedRoute,
|
||||
protected workflowActionService: WorkflowActionDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.workflowAction = this.workflowActionService.findById(this.route.snapshot.queryParams.workflow).pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
import { Directive, ViewContainerRef } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[dsAdvancedClaimedTaskActions]',
|
||||
})
|
||||
/**
|
||||
* Directive used as a hook to know where to inject the dynamic Advanced Claimed Task Actions component
|
||||
*/
|
||||
export class AdvancedClaimedTaskActionsDirective {
|
||||
|
||||
constructor(
|
||||
public viewContainerRef: ViewContainerRef,
|
||||
) {
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1 @@
|
||||
<ng-template dsAdvancedClaimedTaskActions></ng-template>
|
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdvancedWorkflowActionsLoaderComponent } from './advanced-workflow-actions-loader.component';
|
||||
|
||||
describe('AdvancedWorkflowActionsLoaderComponent', () => {
|
||||
let component: AdvancedWorkflowActionsLoaderComponent;
|
||||
let fixture: ComponentFixture<AdvancedWorkflowActionsLoaderComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AdvancedWorkflowActionsLoaderComponent,
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdvancedWorkflowActionsLoaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,54 @@
|
||||
import { Component, Input, ViewChild, ComponentFactoryResolver, OnInit } from '@angular/core';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import {
|
||||
getAdvancedComponentByWorkflowTaskOption
|
||||
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
|
||||
import { AdvancedClaimedTaskActionsDirective } from './advanced-claimed-task-actions.directive';
|
||||
import { Router } from '@angular/router';
|
||||
import { PAGE_NOT_FOUND_PATH } from '../../../app-routing-paths';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-actions-loader',
|
||||
templateUrl: './advanced-workflow-actions-loader.component.html',
|
||||
styleUrls: ['./advanced-workflow-actions-loader.component.scss'],
|
||||
})
|
||||
export class AdvancedWorkflowActionsLoaderComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* The name of the type to render
|
||||
* Passed on to the decorator to fetch the relevant component for this option
|
||||
*/
|
||||
@Input() type: string;
|
||||
|
||||
/**
|
||||
* Directive to determine where the dynamic child component is located
|
||||
*/
|
||||
@ViewChild(AdvancedClaimedTaskActionsDirective, { static: true }) claimedTaskActionsDirective: AdvancedClaimedTaskActionsDirective;
|
||||
|
||||
constructor(
|
||||
private componentFactoryResolver: ComponentFactoryResolver,
|
||||
private router: Router,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch, create and initialize the relevant component
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
const comp = this.getComponentByWorkflowTaskOption(this.type);
|
||||
if (hasValue(comp)) {
|
||||
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(comp);
|
||||
|
||||
const viewContainerRef = this.claimedTaskActionsDirective.viewContainerRef;
|
||||
viewContainerRef.clear();
|
||||
viewContainerRef.createComponent(componentFactory);
|
||||
} else {
|
||||
void this.router.navigate([PAGE_NOT_FOUND_PATH]);
|
||||
}
|
||||
}
|
||||
|
||||
getComponentByWorkflowTaskOption(option: string) {
|
||||
return getAdvancedComponentByWorkflowTaskOption(option);
|
||||
}
|
||||
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
import { URLCombiner } from '../core/url-combiner/url-combiner';
|
||||
import { getWorkflowItemModuleRoute } from '../app-routing-paths';
|
||||
import { RATING_REVIEWER_ACTION_ADVANCED_INFO } from '../core/tasks/models/reviewer-action-advanced-info.resource-type';
|
||||
|
||||
export function getWorkflowItemPageRoute(wfiId: string) {
|
||||
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId).toString();
|
||||
@@ -21,16 +20,12 @@ export function getWorkflowItemSendBackRoute(wfiId: string) {
|
||||
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_SEND_BACK_PATH).toString();
|
||||
}
|
||||
|
||||
export function getWorkflowSelectReviewerRoute(wfiId: string) {
|
||||
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_SELECT_REVIEWER_PATH).toString();
|
||||
}
|
||||
export function getWorkflowRatingReviewerRoute(wfiId: string) {
|
||||
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_RATING_REVIEWER_PATH).toString();
|
||||
export function getAdvancedWorkflowRoute(wfiId: string) {
|
||||
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, ADVANCED_WORKFLOW_PATH).toString();
|
||||
}
|
||||
|
||||
export const WORKFLOW_ITEM_EDIT_PATH = 'edit';
|
||||
export const WORKFLOW_ITEM_DELETE_PATH = 'delete';
|
||||
export const WORKFLOW_ITEM_VIEW_PATH = 'view';
|
||||
export const WORKFLOW_ITEM_SEND_BACK_PATH = 'sendback';
|
||||
export const WORKFLOW_SELECT_REVIEWER_PATH = 'selectreviewer';
|
||||
export const WORKFLOW_RATING_REVIEWER_PATH = 'ratingreviewer';
|
||||
export const ADVANCED_WORKFLOW_PATH = 'advanced';
|
||||
|
@@ -8,8 +8,7 @@ import {
|
||||
WORKFLOW_ITEM_EDIT_PATH,
|
||||
WORKFLOW_ITEM_SEND_BACK_PATH,
|
||||
WORKFLOW_ITEM_VIEW_PATH,
|
||||
WORKFLOW_SELECT_REVIEWER_PATH,
|
||||
WORKFLOW_RATING_REVIEWER_PATH,
|
||||
ADVANCED_WORKFLOW_PATH,
|
||||
} from './workflowitems-edit-page-routing-paths';
|
||||
import { ThemedSubmissionEditComponent } from '../submission/edit/themed-submission-edit.component';
|
||||
import { ThemedWorkflowItemDeleteComponent } from './workflow-item-delete/themed-workflow-item-delete.component';
|
||||
@@ -17,6 +16,9 @@ import { ThemedWorkflowItemSendBackComponent } from './workflow-item-send-back/t
|
||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { ItemFromWorkflowResolver } from './item-from-workflow.resolver';
|
||||
import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-page.component';
|
||||
import {
|
||||
AdvancedWorkflowActionPageComponent
|
||||
} from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -64,21 +66,12 @@ import { ThemedFullItemPageComponent } from '../item-page/full/themed-full-item-
|
||||
},
|
||||
{
|
||||
canActivate: [AuthenticatedGuard],
|
||||
path: WORKFLOW_SELECT_REVIEWER_PATH,
|
||||
component: ThemedWorkflowItemSendBackComponent,
|
||||
path: ADVANCED_WORKFLOW_PATH,
|
||||
component: AdvancedWorkflowActionPageComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
},
|
||||
data: { title: 'workflow-item.select-reviewer.title', breadcrumbKey: 'workflow-item.edit' }
|
||||
},
|
||||
{
|
||||
canActivate: [AuthenticatedGuard],
|
||||
path: WORKFLOW_RATING_REVIEWER_PATH,
|
||||
component: ThemedWorkflowItemSendBackComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
},
|
||||
data: { title: 'workflow-item.rating-reviewer.title', breadcrumbKey: 'workflow-item.edit' }
|
||||
data: { title: 'workflow-item.advanced.title', breadcrumbKey: 'workflow-item.edit' }
|
||||
},
|
||||
]
|
||||
}]
|
||||
|
@@ -9,6 +9,16 @@ import { ThemedWorkflowItemDeleteComponent } from './workflow-item-delete/themed
|
||||
import { ThemedWorkflowItemSendBackComponent } from './workflow-item-send-back/themed-workflow-item-send-back.component';
|
||||
import { StatisticsModule } from '../statistics/statistics.module';
|
||||
import { ItemPageModule } from '../item-page/item-page.module';
|
||||
import {
|
||||
AdvancedWorkflowActionsLoaderComponent
|
||||
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-workflow-actions-loader.component';
|
||||
import { AdvancedWorkflowActionRatingReviewerComponent } from './advanced-workflow-action/advanced-workflow-action-rating-reviewer/advanced-workflow-action-rating-reviewer.component';
|
||||
import { AdvancedWorkflowActionSelectReviewerComponent } from './advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component';
|
||||
import { AdvancedWorkflowActionPageComponent } from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
||||
import {
|
||||
AdvancedClaimedTaskActionsDirective
|
||||
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-claimed-task-actions.directive';
|
||||
import { AdvancedWorkflowActionComponent } from './advanced-workflow-action/advanced-workflow-action/advanced-workflow-action.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -23,7 +33,13 @@ import { ItemPageModule } from '../item-page/item-page.module';
|
||||
WorkflowItemDeleteComponent,
|
||||
ThemedWorkflowItemDeleteComponent,
|
||||
WorkflowItemSendBackComponent,
|
||||
ThemedWorkflowItemSendBackComponent
|
||||
ThemedWorkflowItemSendBackComponent,
|
||||
AdvancedWorkflowActionsLoaderComponent,
|
||||
AdvancedWorkflowActionRatingReviewerComponent,
|
||||
AdvancedWorkflowActionSelectReviewerComponent,
|
||||
AdvancedWorkflowActionPageComponent,
|
||||
AdvancedClaimedTaskActionsDirective,
|
||||
AdvancedWorkflowActionComponent,
|
||||
]
|
||||
})
|
||||
/**
|
||||
|
Reference in New Issue
Block a user