mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
98535: Cleaned up code & added documentation
This commit is contained in:
@@ -162,9 +162,9 @@ import { SearchConfig } from './shared/search/search-filters/search-config.model
|
|||||||
import { SequenceService } from './shared/sequence.service';
|
import { SequenceService } from './shared/sequence.service';
|
||||||
import { GroupDataService } from './eperson/group-data.service';
|
import { GroupDataService } from './eperson/group-data.service';
|
||||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||||
import { RatingReviewerActionAdvancedInfo } from './tasks/models/rating-reviewer-action-advanced-info.model';
|
import { RatingAdvancedWorkflowInfo } from './tasks/models/rating-advanced-workflow-info.model';
|
||||||
import { ReviewerActionAdvancedInfo } from './tasks/models/reviewer-action-advanced-info.model';
|
import { AdvancedWorkflowInfo } from './tasks/models/advanced-workflow-info.model';
|
||||||
import { SelectReviewerActionAdvancedInfo } from './tasks/models/select-reviewer-action-advanced-info.model';
|
import { SelectReviewerAdvancedWorkflowInfo } from './tasks/models/select-reviewer-advanced-workflow-info.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When not in production, endpoint responses can be mocked for testing purposes
|
* When not in production, endpoint responses can be mocked for testing purposes
|
||||||
@@ -335,9 +335,9 @@ export const models =
|
|||||||
Version,
|
Version,
|
||||||
VersionHistory,
|
VersionHistory,
|
||||||
WorkflowAction,
|
WorkflowAction,
|
||||||
ReviewerActionAdvancedInfo,
|
AdvancedWorkflowInfo,
|
||||||
RatingReviewerActionAdvancedInfo,
|
RatingAdvancedWorkflowInfo,
|
||||||
SelectReviewerActionAdvancedInfo,
|
SelectReviewerAdvancedWorkflowInfo,
|
||||||
TemplateItem,
|
TemplateItem,
|
||||||
Feature,
|
Feature,
|
||||||
Authorization,
|
Authorization,
|
||||||
|
11
src/app/core/tasks/models/advanced-workflow-info.model.ts
Normal file
11
src/app/core/tasks/models/advanced-workflow-info.model.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { autoserialize } from 'cerialize';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract model class for a {@link AdvancedWorkflowInfo}
|
||||||
|
*/
|
||||||
|
export abstract class AdvancedWorkflowInfo {
|
||||||
|
|
||||||
|
@autoserialize
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The resource type for {@link RatingAdvancedWorkflowInfo}
|
||||||
|
*
|
||||||
|
* Needs to be in a separate file to prevent circular
|
||||||
|
* dependencies in webpack.
|
||||||
|
*/
|
||||||
|
export const RATING_ADVANCED_WORKFLOW_INFO = new ResourceType('ratingrevieweraction');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The resource type for {@link SelectReviewerAdvancedWorkflowInfo}
|
||||||
|
*
|
||||||
|
* Needs to be in a separate file to prevent circular
|
||||||
|
* dependencies in webpack.
|
||||||
|
*/
|
||||||
|
export const SELECT_REVIEWER_ADVANCED_WORKFLOW_INFO = new ResourceType('selectrevieweraction');
|
@@ -0,0 +1,28 @@
|
|||||||
|
import { typedObject } from '../../cache/builders/build-decorators';
|
||||||
|
import { inheritSerialization, autoserialize } from 'cerialize';
|
||||||
|
import { RATING_ADVANCED_WORKFLOW_INFO } from './advanced-workflow-info.resource-type';
|
||||||
|
import { AdvancedWorkflowInfo } from './advanced-workflow-info.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A model class for a {@link RatingAdvancedWorkflowInfo}
|
||||||
|
*/
|
||||||
|
@typedObject
|
||||||
|
@inheritSerialization(AdvancedWorkflowInfo)
|
||||||
|
export class RatingAdvancedWorkflowInfo extends AdvancedWorkflowInfo {
|
||||||
|
|
||||||
|
static type: ResourceType = RATING_ADVANCED_WORKFLOW_INFO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the description is required.
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
descriptionRequired: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum value.
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
maxValue: number;
|
||||||
|
|
||||||
|
}
|
@@ -1,27 +0,0 @@
|
|||||||
import { typedObject } from '../../cache/builders/build-decorators';
|
|
||||||
import { inheritSerialization, autoserialize } from 'cerialize';
|
|
||||||
import { RATING_REVIEWER_ACTION_ADVANCED_INFO } from './reviewer-action-advanced-info.resource-type';
|
|
||||||
import { ReviewerActionAdvancedInfo } from './reviewer-action-advanced-info.model';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A model class for a {@link RatingReviewerActionAdvancedInfo}
|
|
||||||
*/
|
|
||||||
@typedObject
|
|
||||||
@inheritSerialization(ReviewerActionAdvancedInfo)
|
|
||||||
export class RatingReviewerActionAdvancedInfo extends ReviewerActionAdvancedInfo {
|
|
||||||
|
|
||||||
static type = RATING_REVIEWER_ACTION_ADVANCED_INFO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the description is required.
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
descriptionRequired: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum value.
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
maxValue: number;
|
|
||||||
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
import { typedObject } from '../../cache/builders/build-decorators';
|
|
||||||
import { autoserialize } from 'cerialize';
|
|
||||||
import { REVIEWER_ACTION_ADVANCED_INFO } from './reviewer-action-advanced-info.resource-type';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A model class for a {@link ReviewerActionAdvancedInfo}
|
|
||||||
*/
|
|
||||||
@typedObject
|
|
||||||
export class ReviewerActionAdvancedInfo {
|
|
||||||
|
|
||||||
static type = REVIEWER_ACTION_ADVANCED_INFO;
|
|
||||||
|
|
||||||
@autoserialize
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The resource type for {@link ReviewerActionAdvancedInfo}
|
|
||||||
*
|
|
||||||
* Needs to be in a separate file to prevent circular
|
|
||||||
* dependencies in webpack.
|
|
||||||
*/
|
|
||||||
export const REVIEWER_ACTION_ADVANCED_INFO = new ResourceType('revieweraction');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The resource type for {@link RatingReviewerActionAdvancedInfo}
|
|
||||||
*
|
|
||||||
* Needs to be in a separate file to prevent circular
|
|
||||||
* dependencies in webpack.
|
|
||||||
*/
|
|
||||||
export const RATING_REVIEWER_ACTION_ADVANCED_INFO = new ResourceType('ratingrevieweraction');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The resource type for {@link SelectReviewerActionAdvancedInfo}
|
|
||||||
*
|
|
||||||
* Needs to be in a separate file to prevent circular
|
|
||||||
* dependencies in webpack.
|
|
||||||
*/
|
|
||||||
export const SELECT_REVIEWER_ACTION_ADVANCED_INFO = new ResourceType('selectrevieweraction');
|
|
@@ -1,18 +0,0 @@
|
|||||||
import { typedObject } from '../../cache/builders/build-decorators';
|
|
||||||
import { inheritSerialization, autoserialize } from 'cerialize';
|
|
||||||
import { SELECT_REVIEWER_ACTION_ADVANCED_INFO } from './reviewer-action-advanced-info.resource-type';
|
|
||||||
import { ReviewerActionAdvancedInfo } from './reviewer-action-advanced-info.model';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A model class for a {@link SelectReviewerActionAdvancedInfo}
|
|
||||||
*/
|
|
||||||
@typedObject
|
|
||||||
@inheritSerialization(ReviewerActionAdvancedInfo)
|
|
||||||
export class SelectReviewerActionAdvancedInfo extends ReviewerActionAdvancedInfo {
|
|
||||||
|
|
||||||
static type = SELECT_REVIEWER_ACTION_ADVANCED_INFO;
|
|
||||||
|
|
||||||
@autoserialize
|
|
||||||
group: string;
|
|
||||||
|
|
||||||
}
|
|
@@ -0,0 +1,19 @@
|
|||||||
|
import { typedObject } from '../../cache/builders/build-decorators';
|
||||||
|
import { inheritSerialization, autoserialize } from 'cerialize';
|
||||||
|
import { SELECT_REVIEWER_ADVANCED_WORKFLOW_INFO } from './advanced-workflow-info.resource-type';
|
||||||
|
import { AdvancedWorkflowInfo } from './advanced-workflow-info.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A model class for a {@link SelectReviewerAdvancedWorkflowInfo}
|
||||||
|
*/
|
||||||
|
@typedObject
|
||||||
|
@inheritSerialization(AdvancedWorkflowInfo)
|
||||||
|
export class SelectReviewerAdvancedWorkflowInfo extends AdvancedWorkflowInfo {
|
||||||
|
|
||||||
|
static type: ResourceType = SELECT_REVIEWER_ADVANCED_WORKFLOW_INFO;
|
||||||
|
|
||||||
|
@autoserialize
|
||||||
|
group: string;
|
||||||
|
|
||||||
|
}
|
@@ -2,7 +2,7 @@ import { inheritSerialization, autoserialize } from 'cerialize';
|
|||||||
import { typedObject } from '../../cache/builders/build-decorators';
|
import { typedObject } from '../../cache/builders/build-decorators';
|
||||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||||
import { WORKFLOW_ACTION } from './workflow-action-object.resource-type';
|
import { WORKFLOW_ACTION } from './workflow-action-object.resource-type';
|
||||||
import { ReviewerActionAdvancedInfo } from './reviewer-action-advanced-info.model';
|
import { AdvancedWorkflowInfo } from './advanced-workflow-info.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a WorkflowAction
|
* A model class for a WorkflowAction
|
||||||
@@ -40,6 +40,6 @@ export class WorkflowAction extends DSpaceObject {
|
|||||||
* The advanced info required by the advanced options
|
* The advanced info required by the advanced options
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
advancedInfo: ReviewerActionAdvancedInfo[];
|
advancedInfo: AdvancedWorkflowInfo[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,8 @@ import { getAdvancedWorkflowRoute } from '../../../../workflowitems-edit-page/wo
|
|||||||
/**
|
/**
|
||||||
* Abstract component for rendering an advanced claimed task's action
|
* Abstract component for rendering an advanced claimed task's action
|
||||||
* To create a child-component for a new option:
|
* To create a child-component for a new option:
|
||||||
* - Set the "option" of the component
|
* - Set the "option" and "workflowType" of the component
|
||||||
* - Add a @rendersWorkflowTaskOption annotation to your component providing the same enum value
|
* - Add a @rendersWorkflowTaskOption annotation to your component providing the same enum value
|
||||||
* - Optionally overwrite createBody if the request body requires more than just the option
|
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-claimed-task-action-abstract',
|
selector: 'ds-advanced-claimed-task-action-abstract',
|
||||||
@@ -17,7 +16,10 @@ import { getAdvancedWorkflowRoute } from '../../../../workflowitems-edit-page/wo
|
|||||||
})
|
})
|
||||||
export abstract class AdvancedClaimedTaskActionsAbstractComponent extends ClaimedTaskActionsAbstractComponent implements OnInit {
|
export abstract class AdvancedClaimedTaskActionsAbstractComponent extends ClaimedTaskActionsAbstractComponent implements OnInit {
|
||||||
|
|
||||||
workflowType: string;
|
/**
|
||||||
|
* The {@link WorkflowAction} id of the advanced workflow that needs to be opened.
|
||||||
|
*/
|
||||||
|
abstract workflowType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Route to the workflow's task page
|
* Route to the workflow's task page
|
||||||
@@ -40,6 +42,9 @@ export abstract class AdvancedClaimedTaskActionsAbstractComponent extends Claime
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigates to the advanced workflow page based on the {@link workflow}.
|
||||||
|
*/
|
||||||
openAdvancedClaimedTaskTab(): void {
|
openAdvancedClaimedTaskTab(): void {
|
||||||
void this.router.navigate([this.workflowTaskPageRoute], {
|
void this.router.navigate([this.workflowTaskPageRoute], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
@@ -9,11 +9,14 @@ import {
|
|||||||
} from '../abstract/advanced-claimed-task-actions-abstract.component';
|
} from '../abstract/advanced-claimed-task-actions-abstract.component';
|
||||||
import {
|
import {
|
||||||
ADVANCED_WORKFLOW_ACTION_RATING,
|
ADVANCED_WORKFLOW_ACTION_RATING,
|
||||||
WORKFLOW_ADVANCED_TASK_OPTION_RATING,
|
ADVANCED_WORKFLOW_TASK_OPTION_RATING,
|
||||||
} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component';
|
} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-rating/advanced-workflow-action-rating.component';
|
||||||
import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator';
|
import { rendersWorkflowTaskOption } from '../switcher/claimed-task-actions-decorator';
|
||||||
|
|
||||||
@rendersWorkflowTaskOption(WORKFLOW_ADVANCED_TASK_OPTION_RATING)
|
/**
|
||||||
|
* Advanced Workflow button that redirect to the {@link AdvancedWorkflowActionRatingComponent}
|
||||||
|
*/
|
||||||
|
@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_RATING)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-claimed-task-action-rating-reviewer',
|
selector: 'ds-advanced-claimed-task-action-rating-reviewer',
|
||||||
templateUrl: './advanced-claimed-task-action-rating.component.html',
|
templateUrl: './advanced-claimed-task-action-rating.component.html',
|
||||||
@@ -24,7 +27,7 @@ export class AdvancedClaimedTaskActionRatingComponent extends AdvancedClaimedTas
|
|||||||
/**
|
/**
|
||||||
* This component represents the advanced select option
|
* This component represents the advanced select option
|
||||||
*/
|
*/
|
||||||
option = WORKFLOW_ADVANCED_TASK_OPTION_RATING;
|
option = ADVANCED_WORKFLOW_TASK_OPTION_RATING;
|
||||||
|
|
||||||
workflowType = ADVANCED_WORKFLOW_ACTION_RATING;
|
workflowType = ADVANCED_WORKFLOW_ACTION_RATING;
|
||||||
|
|
||||||
|
@@ -10,10 +10,13 @@ import { SearchService } from '../../../../core/shared/search/search.service';
|
|||||||
import { RequestService } from '../../../../core/data/request.service';
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
import {
|
import {
|
||||||
ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER,
|
ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER,
|
||||||
WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER
|
ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER
|
||||||
} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component';
|
} from '../../../../workflowitems-edit-page/advanced-workflow-action/advanced-workflow-action-select-reviewer/advanced-workflow-action-select-reviewer.component';
|
||||||
|
|
||||||
@rendersWorkflowTaskOption(WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER)
|
/**
|
||||||
|
* Advanced Workflow button that redirect to the {@link AdvancedWorkflowActionSelectReviewerComponent}
|
||||||
|
*/
|
||||||
|
@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-claimed-task-action-select-reviewer',
|
selector: 'ds-advanced-claimed-task-action-select-reviewer',
|
||||||
templateUrl: './advanced-claimed-task-action-select-reviewer.component.html',
|
templateUrl: './advanced-claimed-task-action-select-reviewer.component.html',
|
||||||
@@ -24,7 +27,7 @@ export class AdvancedClaimedTaskActionSelectReviewerComponent extends AdvancedCl
|
|||||||
/**
|
/**
|
||||||
* This component represents the advanced select option
|
* This component represents the advanced select option
|
||||||
*/
|
*/
|
||||||
option = WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER;
|
option = ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER;
|
||||||
|
|
||||||
workflowType = ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
workflowType = ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
||||||
|
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Advanced Workflow page containing the correct {@link AdvancedWorkflowActionComponent}
|
||||||
|
* based on the route parameters.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-workflow-action-page',
|
selector: 'ds-advanced-workflow-action-page',
|
||||||
templateUrl: './advanced-workflow-action-page.component.html',
|
templateUrl: './advanced-workflow-action-page.component.html',
|
||||||
|
@@ -6,12 +6,15 @@ import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/adv
|
|||||||
import { FormGroup, FormControl } from '@angular/forms';
|
import { FormGroup, FormControl } from '@angular/forms';
|
||||||
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
||||||
import {
|
import {
|
||||||
RatingReviewerActionAdvancedInfo
|
RatingAdvancedWorkflowInfo
|
||||||
} from '../../../core/tasks/models/rating-reviewer-action-advanced-info.model';
|
} from '../../../core/tasks/models/rating-advanced-workflow-info.model';
|
||||||
|
|
||||||
export const WORKFLOW_ADVANCED_TASK_OPTION_RATING = 'submit_score';
|
export const ADVANCED_WORKFLOW_TASK_OPTION_RATING = 'submit_score';
|
||||||
export const ADVANCED_WORKFLOW_ACTION_RATING = 'scorereviewaction';
|
export const ADVANCED_WORKFLOW_ACTION_RATING = 'scorereviewaction';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The page on which reviewers can rate submitted items.
|
||||||
|
*/
|
||||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_RATING)
|
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_RATING)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-workflow-action-rating-reviewer',
|
selector: 'ds-advanced-workflow-action-rating-reviewer',
|
||||||
@@ -23,7 +26,7 @@ export class AdvancedWorkflowActionRatingComponent extends AdvancedWorkflowActio
|
|||||||
|
|
||||||
ratingForm: FormGroup;
|
ratingForm: FormGroup;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit(): void {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.ratingForm = new FormGroup({
|
this.ratingForm = new FormGroup({
|
||||||
review: new FormControl(''),
|
review: new FormControl(''),
|
||||||
@@ -43,9 +46,12 @@ export class AdvancedWorkflowActionRatingComponent extends AdvancedWorkflowActio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the task option, the score and the review if one was provided
|
||||||
|
*/
|
||||||
createBody(): any {
|
createBody(): any {
|
||||||
const body = {
|
const body = {
|
||||||
[WORKFLOW_ADVANCED_TASK_OPTION_RATING]: true,
|
[ADVANCED_WORKFLOW_TASK_OPTION_RATING]: true,
|
||||||
score: this.ratingForm.get('rating').value,
|
score: this.ratingForm.get('rating').value,
|
||||||
};
|
};
|
||||||
if (this.ratingForm.get('review').value !== '') {
|
if (this.ratingForm.get('review').value !== '') {
|
||||||
@@ -59,8 +65,8 @@ export class AdvancedWorkflowActionRatingComponent extends AdvancedWorkflowActio
|
|||||||
return ADVANCED_WORKFLOW_ACTION_RATING;
|
return ADVANCED_WORKFLOW_ACTION_RATING;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAdvancedInfo(workflowAction: WorkflowAction | null): RatingReviewerActionAdvancedInfo | null {
|
getAdvancedInfo(workflowAction: WorkflowAction | null): RatingAdvancedWorkflowInfo | null {
|
||||||
return workflowAction ? (workflowAction.advancedInfo[0] as RatingReviewerActionAdvancedInfo) : null;
|
return workflowAction ? (workflowAction.advancedInfo[0] as RatingAdvancedWorkflowInfo) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -5,17 +5,20 @@ import {
|
|||||||
import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component';
|
import { AdvancedWorkflowActionComponent } from '../advanced-workflow-action/advanced-workflow-action.component';
|
||||||
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
import { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
||||||
import {
|
import {
|
||||||
SelectReviewerActionAdvancedInfo
|
SelectReviewerAdvancedWorkflowInfo
|
||||||
} from '../../../core/tasks/models/select-reviewer-action-advanced-info.model';
|
} from '../../../core/tasks/models/select-reviewer-advanced-workflow-info.model';
|
||||||
import {
|
import {
|
||||||
EPersonListActionConfig
|
EPersonListActionConfig
|
||||||
} from '../../../access-control/group-registry/group-form/members-list/members-list.component';
|
} from '../../../access-control/group-registry/group-form/members-list/members-list.component';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||||
|
|
||||||
export const WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER = 'submit_select_reviewer';
|
export const ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER = 'submit_select_reviewer';
|
||||||
export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
|
export const ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER = 'selectrevieweraction';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The page on which Review Managers can assign Reviewers to review an item.
|
||||||
|
*/
|
||||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER)
|
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-workflow-action-select-reviewer',
|
selector: 'ds-advanced-workflow-action-select-reviewer',
|
||||||
@@ -75,7 +78,7 @@ export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkf
|
|||||||
}
|
}
|
||||||
this.subs.push(this.workflowAction$.subscribe((workflowAction: WorkflowAction) => {
|
this.subs.push(this.workflowAction$.subscribe((workflowAction: WorkflowAction) => {
|
||||||
if (workflowAction) {
|
if (workflowAction) {
|
||||||
this.groupId = (workflowAction.advancedInfo as SelectReviewerActionAdvancedInfo[])[0].group;
|
this.groupId = (workflowAction.advancedInfo as SelectReviewerAdvancedWorkflowInfo[])[0].group;
|
||||||
} else {
|
} else {
|
||||||
this.groupId = null;
|
this.groupId = null;
|
||||||
}
|
}
|
||||||
@@ -86,18 +89,23 @@ export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkf
|
|||||||
return ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
return ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only performs the action when some reviewers have been selected.
|
||||||
|
*/
|
||||||
performAction(): void {
|
performAction(): void {
|
||||||
if (this.selectedReviewers.length > 0) {
|
if (this.selectedReviewers.length > 0) {
|
||||||
super.performAction();
|
super.performAction();
|
||||||
} else {
|
} else {
|
||||||
this.displayError = true;
|
this.displayError = true;
|
||||||
}
|
}
|
||||||
console.log(this.displayError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the task option and the selected {@link EPerson} id(s)
|
||||||
|
*/
|
||||||
createBody(): any {
|
createBody(): any {
|
||||||
return {
|
return {
|
||||||
[WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER]: true,
|
[ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER]: true,
|
||||||
eperson: this.selectedReviewers.map((ePerson: EPerson) => ePerson.id),
|
eperson: this.selectedReviewers.map((ePerson: EPerson) => ePerson.id),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,8 @@ import { Observable, of as observableOf } from 'rxjs';
|
|||||||
import { hasValue } from '../../../../shared/empty.util';
|
import { hasValue } from '../../../../shared/empty.util';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../../core/data/paginated-list.model';
|
||||||
import {
|
import {
|
||||||
MembersListComponent, EPersonListActionConfig
|
MembersListComponent,
|
||||||
|
EPersonListActionConfig,
|
||||||
} from '../../../../access-control/group-registry/group-form/members-list/members-list.component';
|
} from '../../../../access-control/group-registry/group-form/members-list/members-list.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,6 +27,9 @@ enum SubKey {
|
|||||||
SearchResultsDTO,
|
SearchResultsDTO,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A custom {@link MembersListComponent} for the advanced SelectReviewer workflow.
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-reviewers-list',
|
selector: 'ds-reviewers-list',
|
||||||
// templateUrl: './reviewers-list.component.html',
|
// templateUrl: './reviewers-list.component.html',
|
||||||
@@ -83,6 +87,12 @@ export class ReviewersListComponent extends MembersListComponent implements OnIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the list of currently selected members, when no group is defined the list of {@link selectedReviewers}
|
||||||
|
* will be set.
|
||||||
|
*
|
||||||
|
* @param page The number of the page to retrieve
|
||||||
|
*/
|
||||||
retrieveMembers(page: number): void {
|
retrieveMembers(page: number): void {
|
||||||
this.config.currentPage = page;
|
this.config.currentPage = page;
|
||||||
if (this.groupId === null) {
|
if (this.groupId === null) {
|
||||||
@@ -95,19 +105,35 @@ export class ReviewersListComponent extends MembersListComponent implements OnIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the given {@link possibleMember} is part of the {@link selectedReviewers}.
|
||||||
|
*
|
||||||
|
* @param possibleMember The {@link EPerson} that needs to be checked
|
||||||
|
*/
|
||||||
isMemberOfGroup(possibleMember: EPerson): Observable<boolean> {
|
isMemberOfGroup(possibleMember: EPerson): Observable<boolean> {
|
||||||
return observableOf(hasValue(this.selectedReviewers.find((reviewer: EpersonDtoModel) => reviewer.eperson.id === possibleMember.id)));
|
return observableOf(hasValue(this.selectedReviewers.find((reviewer: EpersonDtoModel) => reviewer.eperson.id === possibleMember.id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the {@link ePerson} from the {@link selectedReviewers}
|
||||||
|
*
|
||||||
|
* @param ePerson The {@link EpersonDtoModel} containg the {@link EPerson} to remove
|
||||||
|
*/
|
||||||
deleteMemberFromGroup(ePerson: EpersonDtoModel) {
|
deleteMemberFromGroup(ePerson: EpersonDtoModel) {
|
||||||
ePerson.memberOfGroup = false;
|
ePerson.memberOfGroup = false;
|
||||||
const index = this.selectedReviewers.indexOf(ePerson);
|
const index = this.selectedReviewers.indexOf(ePerson);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.selectedReviewers.splice(index, 1);
|
this.selectedReviewers.splice(index, 1);
|
||||||
}
|
}
|
||||||
this.selectedReviewersUpdated.emit(this.selectedReviewers.map((epersonDtoModel: EpersonDtoModel) => epersonDtoModel.eperson));
|
this.selectedReviewersUpdated.emit(this.selectedReviewers.map((ePersonDtoModel: EpersonDtoModel) => ePersonDtoModel.eperson));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the {@link ePerson} to the {@link selectedReviewers} (or replaces it when {@link multipleReviewers} is
|
||||||
|
* `false`). Afterwards it will emit the list.
|
||||||
|
*
|
||||||
|
* @param ePerson The {@link EPerson} to add to the list
|
||||||
|
*/
|
||||||
addMemberToGroup(ePerson: EpersonDtoModel) {
|
addMemberToGroup(ePerson: EpersonDtoModel) {
|
||||||
ePerson.memberOfGroup = true;
|
ePerson.memberOfGroup = true;
|
||||||
if (!this.multipleReviewers) {
|
if (!this.multipleReviewers) {
|
||||||
|
@@ -108,7 +108,8 @@ describe('AdvancedWorkflowActionComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-test-cmp',
|
// tslint:disable-next-line:component-selector
|
||||||
|
selector: '',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
class TestComponent extends AdvancedWorkflowActionComponent {
|
class TestComponent extends AdvancedWorkflowActionComponent {
|
||||||
|
@@ -13,6 +13,12 @@ import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.se
|
|||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
|
import { ProcessTaskResponse } from '../../../core/tasks/models/process-task-response';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract component for rendering an advanced claimed task's workflow page
|
||||||
|
* To create a child-component for a new option:
|
||||||
|
* - Set the "getType()" of the component
|
||||||
|
* - Implement the createBody, should always contain at least the ADVANCED_WORKFLOW_TASK_OPTION
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-workflow-action',
|
selector: 'ds-advanced-workflow-action',
|
||||||
template: '',
|
template: '',
|
||||||
@@ -62,7 +68,7 @@ export abstract class AdvancedWorkflowActionComponent extends WorkflowItemAction
|
|||||||
/**
|
/**
|
||||||
* Submits the task with the given {@link createBody}.
|
* Submits the task with the given {@link createBody}.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id The task id
|
||||||
*/
|
*/
|
||||||
sendRequest(id: string): Observable<boolean> {
|
sendRequest(id: string): Observable<boolean> {
|
||||||
return this.claimedTaskDataService.submitTask(id, this.createBody()).pipe(
|
return this.claimedTaskDataService.submitTask(id, this.createBody()).pipe(
|
||||||
|
@@ -1 +1 @@
|
|||||||
<ng-template dsAdvancedClaimedTaskActions></ng-template>
|
<ng-template dsAdvancedWorkflowActions></ng-template>
|
||||||
|
@@ -3,10 +3,13 @@ import { hasValue } from '../../../shared/empty.util';
|
|||||||
import {
|
import {
|
||||||
getAdvancedComponentByWorkflowTaskOption
|
getAdvancedComponentByWorkflowTaskOption
|
||||||
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
|
} from '../../../shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-decorator';
|
||||||
import { AdvancedClaimedTaskActionsDirective } from './advanced-claimed-task-actions.directive';
|
import { AdvancedWorkflowActionsDirective } from './advanced-workflow-actions.directive';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { PAGE_NOT_FOUND_PATH } from '../../../app-routing-paths';
|
import { PAGE_NOT_FOUND_PATH } from '../../../app-routing-paths';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component for loading a {@link AdvancedWorkflowActionComponent} depending on the "{@link type}" input
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-advanced-workflow-actions-loader',
|
selector: 'ds-advanced-workflow-actions-loader',
|
||||||
templateUrl: './advanced-workflow-actions-loader.component.html',
|
templateUrl: './advanced-workflow-actions-loader.component.html',
|
||||||
@@ -23,7 +26,7 @@ export class AdvancedWorkflowActionsLoaderComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Directive to determine where the dynamic child component is located
|
* Directive to determine where the dynamic child component is located
|
||||||
*/
|
*/
|
||||||
@ViewChild(AdvancedClaimedTaskActionsDirective, { static: true }) claimedTaskActionsDirective: AdvancedClaimedTaskActionsDirective;
|
@ViewChild(AdvancedWorkflowActionsDirective, { static: true }) claimedTaskActionsDirective: AdvancedWorkflowActionsDirective;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
@@ -47,8 +50,8 @@ export class AdvancedWorkflowActionsLoaderComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponentByWorkflowTaskOption(option: string) {
|
getComponentByWorkflowTaskOption(type: string): any {
|
||||||
return getAdvancedComponentByWorkflowTaskOption(option);
|
return getAdvancedComponentByWorkflowTaskOption(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import { Directive, ViewContainerRef } from '@angular/core';
|
import { Directive, ViewContainerRef } from '@angular/core';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[dsAdvancedClaimedTaskActions]',
|
selector: '[dsAdvancedWorkflowActions]',
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Directive used as a hook to know where to inject the dynamic Advanced Claimed Task Actions component
|
* Directive used as a hook to know where to inject the dynamic Advanced Claimed Task Actions component
|
||||||
*/
|
*/
|
||||||
export class AdvancedClaimedTaskActionsDirective {
|
export class AdvancedWorkflowActionsDirective {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public viewContainerRef: ViewContainerRef,
|
public viewContainerRef: ViewContainerRef,
|
@@ -24,8 +24,8 @@ import {
|
|||||||
AdvancedWorkflowActionPageComponent
|
AdvancedWorkflowActionPageComponent
|
||||||
} from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
} from './advanced-workflow-action/advanced-workflow-action-page/advanced-workflow-action-page.component';
|
||||||
import {
|
import {
|
||||||
AdvancedClaimedTaskActionsDirective
|
AdvancedWorkflowActionsDirective
|
||||||
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-claimed-task-actions.directive';
|
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-workflow-actions.directive';
|
||||||
import { AccessControlModule } from '../access-control/access-control.module';
|
import { AccessControlModule } from '../access-control/access-control.module';
|
||||||
import {
|
import {
|
||||||
ReviewersListComponent
|
ReviewersListComponent
|
||||||
@@ -54,7 +54,7 @@ import { RatingModule } from 'ngx-bootstrap/rating';
|
|||||||
AdvancedWorkflowActionRatingComponent,
|
AdvancedWorkflowActionRatingComponent,
|
||||||
AdvancedWorkflowActionSelectReviewerComponent,
|
AdvancedWorkflowActionSelectReviewerComponent,
|
||||||
AdvancedWorkflowActionPageComponent,
|
AdvancedWorkflowActionPageComponent,
|
||||||
AdvancedClaimedTaskActionsDirective,
|
AdvancedWorkflowActionsDirective,
|
||||||
ReviewersListComponent,
|
ReviewersListComponent,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user