Skip to content

Commit

Permalink
Author workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Sep 19, 2024
1 parent 583fef0 commit 8a08ea9
Show file tree
Hide file tree
Showing 29 changed files with 1,730 additions and 1,733 deletions.
2 changes: 1 addition & 1 deletion public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ window.pkp = {
'dashboard.summary.reviewers': 'Reviewers',
'dashboard.summary.revisionsUploaded': 'Revisions Submitted',
'dashboard.summary.revisionsUploadedDescription':
'These files have been submitted by the author after visions were requested',
'These files have been submitted by the author after revisions were requested',
'dashboard.summary.sendSubmissionForReview': 'Send submission for review',
'dashboard.summary.sendToProduction': 'Send to Production',
'dashboard.summary.viewActivityLog': 'View activity log',
Expand Down
8 changes: 6 additions & 2 deletions src/components/TableNext/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
>
<slot name="label" />
</span>
<div v-if="slots.description" :id="descriptionId">
<div
v-if="slots.description"
:id="descriptionId"
class="text-sm-normal"
>
<slot name="description" />
</div>
</div>
<div v-if="slots['top-controls']">
<div v-if="slots['top-controls']" class="flex-shrink-0">
<slot name="top-controls" />
</div>
</div>
Expand Down
61 changes: 0 additions & 61 deletions src/composables/useReviewAssignment.js

This file was deleted.

65 changes: 63 additions & 2 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ export const ExtendedStagesLabels = {
declined: tk('submissions.declined'),
};

const InProgressReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_ACCEPTED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REVIEW_OVERDUE,
];
const CompletedReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_RECEIVED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_COMPLETE,
pkp.const.REVIEW_ASSIGNMENT_STATUS_THANKED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_CANCELLED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND,
];

const IgnoredReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_DECLINED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_CANCELLED,
];

export function useSubmission() {
function getActiveStage(submission) {
return submission.stages.find((stage) => stage.isActiveStage);
Expand All @@ -39,8 +56,8 @@ export function useSubmission() {
return submissions.find((submission) => submission.id === submissionId);
}

function getReviewAssignmentsForRound(submission, roundId) {
return submission.reviewAssignments.filter(
function getReviewAssignmentsForRound(reviewAssignments, roundId) {
return reviewAssignments.filter(
(reviewAssignment) => reviewAssignment.roundId === roundId,
);
}
Expand Down Expand Up @@ -150,6 +167,44 @@ export function useSubmission() {
return submission.stageId < stageId;
}

function getActiveReviewAssignments(reviewAssignments) {
return reviewAssignments.filter(
(reviewAssignment) =>
!IgnoredReviewAssignmentStatuses.includes(reviewAssignment.statusId),
);
}

function getCompletedReviewAssignments(reviewAssignments = []) {
return getActiveReviewAssignments(reviewAssignments).filter(
(reviewAssignment) =>
CompletedReviewAssignmentStatuses.includes(reviewAssignment.statusId),
);
}

function getOpenReviewAssignmentsForRound(reviewAssignments, reviewRoundId) {
return getReviewAssignmentsForRound(
reviewAssignments,
reviewRoundId,
).filter(
(reviewAssignment) =>
reviewAssignment.reviewMethod ===
pkp.const.SUBMISSION_REVIEW_METHOD_OPEN,
);
}

function getReviewMethodIcons(reviewAssignment) {
switch (reviewAssignment.reviewMethod) {
case pkp.const.SUBMISSION_REVIEW_METHOD_ANONYMOUS:
return ['OpenReview', 'AnonymousReview'];
case pkp.const.SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS:
return ['AnonymousReview', 'AnonymousReview'];
case pkp.const.SUBMISSION_REVIEW_METHOD_OPEN:
return ['OpenReview', 'OpenReview'];
}

return ['OpenReview', 'OpenReview'];
}

return {
getSubmissionById,
getActiveStage,
Expand All @@ -165,6 +220,12 @@ export function useSubmission() {
getFileStageFromWorkflowStage,
hasNotSubmissionStartedStage,
hasSubmissionPassedStage,
// review assignments
getReviewAssignmentsForRound,
getActiveReviewAssignments,
getCompletedReviewAssignments,
getOpenReviewAssignmentsForRound,
getReviewMethodIcons,
InProgressReviewAssignmentStatuses,
};
}
42 changes: 22 additions & 20 deletions src/managers/FileManager/FileManager.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
<template>
<div>
<div class="flex items-center border-x border-t border-light p-4">
<div class="flex-grow">
<h3 class="text-lg-bold text-heading">
<PkpTable>
<template #label>
<h3 class="">
{{ fileManagerStore.managerConfig.title }}
</h3>
<p class="pt-2 text-sm-normal">
</template>
<template #description>
<p>
{{ fileManagerStore.managerConfig.description }}
</p>
</div>
<div class="ms-2 flex flex-none space-x-2">
<PkpButton
v-for="action in fileManagerStore.topActions"
:key="action.name"
@click="fileManagerStore[action.name]"
>
{{ action.label }}
</PkpButton>
</div>
</div>
<PkpTable aria-label="Example for basic table">
</template>
<template #top-controls>
<div class="flex space-x-2">
<PkpButton
v-for="action in fileManagerStore.topActions"
:key="action.name"
@click="fileManagerStore[action.name]"
>
{{ action.label }}
</PkpButton>
</div>
</template>
<TableHeader>
<TableColumn>No</TableColumn>
<TableColumn>File name</TableColumn>
<TableColumn>Date Uploaded</TableColumn>
<TableColumn>Type</TableColumn>
<TableColumn>{{ t('common.id') }}</TableColumn>
<TableColumn>{{ t('common.fileName') }}</TableColumn>
<TableColumn>{{ t('common.dateUploaded') }}</TableColumn>
<TableColumn>{{ t('common.type') }}</TableColumn>
<TableColumn v-if="fileManagerStore.itemActions.length">
<span class="sr-only">{{ t('common.moreActions') }}</span>
</TableColumn>
Expand Down
12 changes: 6 additions & 6 deletions src/managers/FileManager/useFileManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ export function useFileManagerActions() {
if (enabledActions.includes(Actions.FILE_UPLOAD)) {
actions.push({
// this might be different based on fileStage, more details in AddFileLinkAction.php
label: 'Upload',
label: t('common.upload'),
name: Actions.FILE_UPLOAD,
});
}

if (enabledActions.includes(Actions.FILE_SELECT_UPLOAD)) {
actions.push({
label: 'Select/Upload',
label: t('editor.submission.uploadSelectFiles'),
name: Actions.FILE_SELECT_UPLOAD,
});
}
Expand All @@ -201,7 +201,7 @@ export function useFileManagerActions() {
const enabledActions = managerConfig.permittedActions;
if (enabledActions.includes(Actions.FILE_DOWNLOAD_ALL) && filesCount) {
actions.push({
label: 'Download All Files',
label: t('submission.files.downloadAll'),
name: 'downloadAll',
});
}
Expand All @@ -214,23 +214,23 @@ export function useFileManagerActions() {
const enabledActions = managerConfig.permittedActions;
if (enabledActions.includes(Actions.FILE_SEE_NOTES)) {
actions.push({
label: 'More information',
label: t('grid.action.moreInformation'),
name: Actions.FILE_SEE_NOTES,
icon: 'View',
});
}

if (enabledActions.includes(Actions.FILE_EDIT)) {
actions.push({
label: 'Edit',
label: t('grid.action.edit'),
name: Actions.FILE_EDIT,
icon: 'Edit',
});
}

if (enabledActions.includes(Actions.FILE_DELETE)) {
actions.push({
label: 'Delete',
label: t('grid.action.delete'),
name: Actions.FILE_DELETE,
isWarnable: true,
icon: 'Cancel',
Expand Down
11 changes: 11 additions & 0 deletions src/managers/FileManager/useFileManagerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ export const FileManagerConfigurations = {
descriptionKey: tk('dashboard.summary.revisionsUploadedDescription'),
wizardTitleKey: tk('editor.submissionReview.uploadFile'),
}),
// TODO after triage
REVIEW_ATTACHMENTS: () => ({
// visible only to authors and reviewers? Add permissions for reviewers once used
permissions: [],
actions: [],
fileStage: pkp.const.SUBMISSION_FILE_REVIEW_ATTACHMENT,
gridComponent: 'grid.files.attachment.authorReviewAttachmentsGridHandler',
titleKey: tk('dashboard.summary.filesForReview'),
descriptionKey: tk('dashboard.summary.deskReviewFilesDescription'),
uploadSelectTitleKey: tk('editor.submission.review.currentFiles'),
}),
COPYEDITED_FILES: ({stageId}) => ({
permissions: [
{
Expand Down
40 changes: 22 additions & 18 deletions src/managers/ReviewerManager/ReviewerManager.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<template>
<div>
<div class="flex justify-between border-x border-t border-light px-3 py-4">
<h2 :id="headingId" class="text-lg-bold text-heading">
{{ t('dashboard.summary.reviewers') }}
</h2>
<div>
<PkpButton
v-for="action in reviewerStore.topActions"
:key="action.name"
@click="reviewerStore[action.name]()"
>
{{ action.label }}
</PkpButton>
</div>
</div>
<PkpTable
aria-label="Example for basic table"
:aria-describedby="headingId"
>
<template #label>
<h3 class="">
{{ t('dashboard.summary.reviewers') }}
</h3>
</template>
<template #top-controls>
<div class="flex space-x-2">
<PkpButton
v-for="action in reviewerStore.topActions"
:key="action.name"
@click="reviewerStore[action.name]()"
>
{{ action.label }}
</PkpButton>
</div>
</template>
<TableHeader>
<TableColumn>{{ t('dashboard.summary.reviewer') }}</TableColumn>
<TableColumn v-if="!redactedForAuthors">
<TableColumn>
{{ t('dashboard.summary.reviewerStatus') }}
</TableColumn>
<TableColumn>{{ t('common.type') }}</TableColumn>
<TableColumn>{{ t('grid.columns.actions') }}</TableColumn>
<TableColumn>
<TableColumn v-if="!redactedForAuthors">
<span class="sr-only">{{ t('common.moreActions') }}</span>
</TableColumn>
</TableHeader>
Expand All @@ -39,7 +41,7 @@
{{ reviewAssignment.reviewerFullName }}
</span>
</TableCell>
<TableCell v-if="!redactedForAuthors">
<TableCell>
<span class="text-base-normal">
{{ reviewAssignment.status }}
</span>
Expand All @@ -59,10 +61,13 @@
<ReviewerManagerCellPrimaryActions
:review-assignment="reviewAssignment"
:submission="submission"
:redacted-for-authors="redactedForAuthors"
></ReviewerManagerCellPrimaryActions>
<ReviewerManagerCellActions
v-if="!redactedForAuthors"
:review-assignment="reviewAssignment"
:submission="submission"
:redacted-for-authors="redactedForAuthors"
></ReviewerManagerCellActions>
</TableRow>
</TableBody>
Expand Down Expand Up @@ -98,4 +103,3 @@ const props = defineProps({
const reviewerStore = useReviewerManagerStore(props);
</script>
./ReviewerManagerCellActions.vue
2 changes: 2 additions & 0 deletions src/managers/ReviewerManager/ReviewerManagerCellActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import {computed} from 'vue';
const props = defineProps({
reviewAssignment: {type: Object, required: true},
submission: {type: Object, required: true},
redactedForAuthors: {type: Boolean, required: true},
});
const reviewerManagerStore = useReviewerManagerStore();
const itemActions = computed(() =>
reviewerManagerStore.getItemActions({
reviewAssignment: props.reviewAssignment,
redactedForAuthors: props.redactedForAuthors,
}),
);
Expand Down
Loading

0 comments on commit 8a08ea9

Please sign in to comment.