mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +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 { GroupDataService } from './eperson/group-data.service';
|
||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||
import { RatingReviewerActionAdvancedInfo } from './tasks/models/rating-reviewer-action-advanced-info.model';
|
||||
import { ReviewerActionAdvancedInfo } from './tasks/models/reviewer-action-advanced-info.model';
|
||||
import { SelectReviewerActionAdvancedInfo } from './tasks/models/select-reviewer-action-advanced-info.model';
|
||||
import { RatingAdvancedWorkflowInfo } from './tasks/models/rating-advanced-workflow-info.model';
|
||||
import { AdvancedWorkflowInfo } from './tasks/models/advanced-workflow-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
|
||||
@@ -335,9 +335,9 @@ export const models =
|
||||
Version,
|
||||
VersionHistory,
|
||||
WorkflowAction,
|
||||
ReviewerActionAdvancedInfo,
|
||||
RatingReviewerActionAdvancedInfo,
|
||||
SelectReviewerActionAdvancedInfo,
|
||||
AdvancedWorkflowInfo,
|
||||
RatingAdvancedWorkflowInfo,
|
||||
SelectReviewerAdvancedWorkflowInfo,
|
||||
TemplateItem,
|
||||
Feature,
|
||||
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 { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
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
|
||||
@@ -40,6 +40,6 @@ export class WorkflowAction extends DSpaceObject {
|
||||
* The advanced info required by the advanced options
|
||||
*/
|
||||
@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
|
||||
* 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
|
||||
* - Optionally overwrite createBody if the request body requires more than just the option
|
||||
*/
|
||||
@Component({
|
||||
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 {
|
||||
|
||||
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
|
||||
@@ -40,6 +42,9 @@ export abstract class AdvancedClaimedTaskActionsAbstractComponent extends Claime
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates to the advanced workflow page based on the {@link workflow}.
|
||||
*/
|
||||
openAdvancedClaimedTaskTab(): void {
|
||||
void this.router.navigate([this.workflowTaskPageRoute], {
|
||||
queryParams: {
|
||||
|
@@ -9,11 +9,14 @@ import {
|
||||
} from '../abstract/advanced-claimed-task-actions-abstract.component';
|
||||
import {
|
||||
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';
|
||||
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({
|
||||
selector: 'ds-advanced-claimed-task-action-rating-reviewer',
|
||||
templateUrl: './advanced-claimed-task-action-rating.component.html',
|
||||
@@ -24,7 +27,7 @@ export class AdvancedClaimedTaskActionRatingComponent extends AdvancedClaimedTas
|
||||
/**
|
||||
* This component represents the advanced select option
|
||||
*/
|
||||
option = WORKFLOW_ADVANCED_TASK_OPTION_RATING;
|
||||
option = ADVANCED_WORKFLOW_TASK_OPTION_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 {
|
||||
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';
|
||||
|
||||
@rendersWorkflowTaskOption(WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER)
|
||||
/**
|
||||
* Advanced Workflow button that redirect to the {@link AdvancedWorkflowActionSelectReviewerComponent}
|
||||
*/
|
||||
@rendersWorkflowTaskOption(ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER)
|
||||
@Component({
|
||||
selector: 'ds-advanced-claimed-task-action-select-reviewer',
|
||||
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
|
||||
*/
|
||||
option = WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER;
|
||||
option = ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER;
|
||||
|
||||
workflowType = ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
||||
|
||||
|
@@ -1,6 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* The Advanced Workflow page containing the correct {@link AdvancedWorkflowActionComponent}
|
||||
* based on the route parameters.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-page',
|
||||
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 { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
||||
import {
|
||||
RatingReviewerActionAdvancedInfo
|
||||
} from '../../../core/tasks/models/rating-reviewer-action-advanced-info.model';
|
||||
RatingAdvancedWorkflowInfo
|
||||
} 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';
|
||||
|
||||
/**
|
||||
* The page on which reviewers can rate submitted items.
|
||||
*/
|
||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_RATING)
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-rating-reviewer',
|
||||
@@ -23,7 +26,7 @@ export class AdvancedWorkflowActionRatingComponent extends AdvancedWorkflowActio
|
||||
|
||||
ratingForm: FormGroup;
|
||||
|
||||
ngOnInit() {
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.ratingForm = new FormGroup({
|
||||
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 {
|
||||
const body = {
|
||||
[WORKFLOW_ADVANCED_TASK_OPTION_RATING]: true,
|
||||
[ADVANCED_WORKFLOW_TASK_OPTION_RATING]: true,
|
||||
score: this.ratingForm.get('rating').value,
|
||||
};
|
||||
if (this.ratingForm.get('review').value !== '') {
|
||||
@@ -59,8 +65,8 @@ export class AdvancedWorkflowActionRatingComponent extends AdvancedWorkflowActio
|
||||
return ADVANCED_WORKFLOW_ACTION_RATING;
|
||||
}
|
||||
|
||||
getAdvancedInfo(workflowAction: WorkflowAction | null): RatingReviewerActionAdvancedInfo | null {
|
||||
return workflowAction ? (workflowAction.advancedInfo[0] as RatingReviewerActionAdvancedInfo) : null;
|
||||
getAdvancedInfo(workflowAction: WorkflowAction | null): RatingAdvancedWorkflowInfo | 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 { WorkflowAction } from '../../../core/tasks/models/workflow-action-object.model';
|
||||
import {
|
||||
SelectReviewerActionAdvancedInfo
|
||||
} from '../../../core/tasks/models/select-reviewer-action-advanced-info.model';
|
||||
SelectReviewerAdvancedWorkflowInfo
|
||||
} from '../../../core/tasks/models/select-reviewer-advanced-workflow-info.model';
|
||||
import {
|
||||
EPersonListActionConfig
|
||||
} from '../../../access-control/group-registry/group-form/members-list/members-list.component';
|
||||
import { Subscription } from 'rxjs';
|
||||
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';
|
||||
|
||||
/**
|
||||
* The page on which Review Managers can assign Reviewers to review an item.
|
||||
*/
|
||||
@rendersAdvancedWorkflowTaskOption(ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER)
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-action-select-reviewer',
|
||||
@@ -75,7 +78,7 @@ export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkf
|
||||
}
|
||||
this.subs.push(this.workflowAction$.subscribe((workflowAction: WorkflowAction) => {
|
||||
if (workflowAction) {
|
||||
this.groupId = (workflowAction.advancedInfo as SelectReviewerActionAdvancedInfo[])[0].group;
|
||||
this.groupId = (workflowAction.advancedInfo as SelectReviewerAdvancedWorkflowInfo[])[0].group;
|
||||
} else {
|
||||
this.groupId = null;
|
||||
}
|
||||
@@ -86,18 +89,23 @@ export class AdvancedWorkflowActionSelectReviewerComponent extends AdvancedWorkf
|
||||
return ADVANCED_WORKFLOW_ACTION_SELECT_REVIEWER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only performs the action when some reviewers have been selected.
|
||||
*/
|
||||
performAction(): void {
|
||||
if (this.selectedReviewers.length > 0) {
|
||||
super.performAction();
|
||||
} else {
|
||||
this.displayError = true;
|
||||
}
|
||||
console.log(this.displayError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the task option and the selected {@link EPerson} id(s)
|
||||
*/
|
||||
createBody(): any {
|
||||
return {
|
||||
[WORKFLOW_ADVANCED_TASK_OPTION_SELECT_REVIEWER]: true,
|
||||
[ADVANCED_WORKFLOW_TASK_OPTION_SELECT_REVIEWER]: true,
|
||||
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 { PaginatedList } from '../../../../core/data/paginated-list.model';
|
||||
import {
|
||||
MembersListComponent, EPersonListActionConfig
|
||||
MembersListComponent,
|
||||
EPersonListActionConfig,
|
||||
} from '../../../../access-control/group-registry/group-form/members-list/members-list.component';
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,9 @@ enum SubKey {
|
||||
SearchResultsDTO,
|
||||
}
|
||||
|
||||
/**
|
||||
* A custom {@link MembersListComponent} for the advanced SelectReviewer workflow.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-reviewers-list',
|
||||
// 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 {
|
||||
this.config.currentPage = page;
|
||||
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> {
|
||||
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) {
|
||||
ePerson.memberOfGroup = false;
|
||||
const index = this.selectedReviewers.indexOf(ePerson);
|
||||
if (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) {
|
||||
ePerson.memberOfGroup = true;
|
||||
if (!this.multipleReviewers) {
|
||||
|
@@ -108,7 +108,8 @@ describe('AdvancedWorkflowActionComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
// tslint:disable-next-line:component-selector
|
||||
selector: '',
|
||||
template: ''
|
||||
})
|
||||
class TestComponent extends AdvancedWorkflowActionComponent {
|
||||
|
@@ -13,6 +13,12 @@ import { ClaimedTaskDataService } from '../../../core/tasks/claimed-task-data.se
|
||||
import { map } from 'rxjs/operators';
|
||||
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({
|
||||
selector: 'ds-advanced-workflow-action',
|
||||
template: '',
|
||||
@@ -62,7 +68,7 @@ export abstract class AdvancedWorkflowActionComponent extends WorkflowItemAction
|
||||
/**
|
||||
* Submits the task with the given {@link createBody}.
|
||||
*
|
||||
* @param id
|
||||
* @param id The task id
|
||||
*/
|
||||
sendRequest(id: string): Observable<boolean> {
|
||||
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 {
|
||||
getAdvancedComponentByWorkflowTaskOption
|
||||
} 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 { PAGE_NOT_FOUND_PATH } from '../../../app-routing-paths';
|
||||
|
||||
/**
|
||||
* Component for loading a {@link AdvancedWorkflowActionComponent} depending on the "{@link type}" input
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-advanced-workflow-actions-loader',
|
||||
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
|
||||
*/
|
||||
@ViewChild(AdvancedClaimedTaskActionsDirective, { static: true }) claimedTaskActionsDirective: AdvancedClaimedTaskActionsDirective;
|
||||
@ViewChild(AdvancedWorkflowActionsDirective, { static: true }) claimedTaskActionsDirective: AdvancedWorkflowActionsDirective;
|
||||
|
||||
constructor(
|
||||
private componentFactoryResolver: ComponentFactoryResolver,
|
||||
@@ -47,8 +50,8 @@ export class AdvancedWorkflowActionsLoaderComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
getComponentByWorkflowTaskOption(option: string) {
|
||||
return getAdvancedComponentByWorkflowTaskOption(option);
|
||||
getComponentByWorkflowTaskOption(type: string): any {
|
||||
return getAdvancedComponentByWorkflowTaskOption(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { Directive, ViewContainerRef } from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[dsAdvancedClaimedTaskActions]',
|
||||
selector: '[dsAdvancedWorkflowActions]',
|
||||
})
|
||||
/**
|
||||
* Directive used as a hook to know where to inject the dynamic Advanced Claimed Task Actions component
|
||||
*/
|
||||
export class AdvancedClaimedTaskActionsDirective {
|
||||
export class AdvancedWorkflowActionsDirective {
|
||||
|
||||
constructor(
|
||||
public viewContainerRef: ViewContainerRef,
|
@@ -24,8 +24,8 @@ 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';
|
||||
AdvancedWorkflowActionsDirective
|
||||
} from './advanced-workflow-action/advanced-workflow-actions-loader/advanced-workflow-actions.directive';
|
||||
import { AccessControlModule } from '../access-control/access-control.module';
|
||||
import {
|
||||
ReviewersListComponent
|
||||
@@ -54,7 +54,7 @@ import { RatingModule } from 'ngx-bootstrap/rating';
|
||||
AdvancedWorkflowActionRatingComponent,
|
||||
AdvancedWorkflowActionSelectReviewerComponent,
|
||||
AdvancedWorkflowActionPageComponent,
|
||||
AdvancedClaimedTaskActionsDirective,
|
||||
AdvancedWorkflowActionsDirective,
|
||||
ReviewersListComponent,
|
||||
]
|
||||
})
|
||||
|
Reference in New Issue
Block a user