From 91dfd23a7cba42091b05d2654e5d44cb87a72482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Wed, 8 Jan 2025 14:19:36 +0100 Subject: [PATCH] pkp/pkp-lib#10767 Refine Top controls on workflow page --- .../workflowConfigAuthorOJS.js | 35 +++++++++++++++-- .../workflowConfigAuthorOMP.js | 29 ++++++++++++++ .../workflowConfigEditorialOJS.js | 21 +++++----- .../workflowConfigEditorialOMP.js | 38 +++++++++++++------ .../workflowConfigEditorialOPS.js | 14 +++++++ src/pages/workflow/workflowStore.js | 27 +++++++++++++ 6 files changed, 138 insertions(+), 26 deletions(-) diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js index a262b1c70..e582478af 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOJS.js @@ -1,5 +1,6 @@ import {useLocalize} from '@/composables/useLocalize'; -import {Actions} from '../useWorkflowActions'; +import {Actions as WorkflowActions} from '../useWorkflowActions'; +import {Actions as FileManagerActions} from '@/managers/FileManager/useFileManagerActions'; import {useSubmission} from '@/composables/useSubmission'; const { @@ -25,7 +26,7 @@ export function getHeaderItems({ component: 'WorkflowActionButton', props: { label: t('editor.submissionLibrary'), - action: Actions.WORKFLOW_VIEW_LIBRARY, + action: WorkflowActions.WORKFLOW_VIEW_LIBRARY, }, }); @@ -159,9 +160,37 @@ export const WorkflowConfig = { return items; }, + getActionItems: ({submission, selectedReviewRound}) => { + const actions = []; + + if ( + [ + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_REQUESTED, + pkp.const.REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW, + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED, + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED, + ].includes(selectedReviewRound.statusId) + ) + actions.push({ + component: 'WorkflowActionButton', + props: { + action: FileManagerActions.FILE_UPLOAD, + label: t('dashboard.submitRevisions'), + actionArgs: { + submissionId: submission.id, + fileStage: pkp.const.SUBMISSION_FILE_REVIEW_REVISION, + reviewRoundId: selectedReviewRound.id, + wizardTitleKey: 'editor.submissionReview.uploadFile', + submissionStageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, + }, + }, + }); + return actions; + }, }, + [pkp.const.WORKFLOW_STAGE_ID_EDITING]: { - getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => { + getPrimaryItems: ({submission, selectedStageId}) => { const items = []; items.push({ diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOMP.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOMP.js index 739c83312..23cbb1f20 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOMP.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigAuthorOMP.js @@ -1,6 +1,7 @@ import {useLocalize} from '@/composables/useLocalize'; import {Actions} from '../useWorkflowActions'; import {useSubmission} from '@/composables/useSubmission'; +import {Actions as FileManagerActions} from '@/managers/FileManager/useFileManagerActions'; const {hasSubmissionPassedStage, getOpenReviewAssignmentsForRound} = useSubmission(); @@ -98,6 +99,34 @@ export const WorkflowConfig = { return items; }, + getActionItems: ({submission, selectedReviewRound}) => { + const actions = []; + const {t} = useLocalize(); + + if ( + [ + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_REQUESTED, + pkp.const.REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW, + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED, + pkp.const.REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED, + ].includes(selectedReviewRound.statusId) + ) + actions.push({ + component: 'WorkflowActionButton', + props: { + action: FileManagerActions.FILE_UPLOAD, + label: t('dashboard.submitRevisions'), + actionArgs: { + submissionId: submission.id, + fileStage: pkp.const.SUBMISSION_FILE_INTERNAL_REVIEW_REVISION, + reviewRoundId: selectedReviewRound.id, + wizardTitleKey: 'editor.submissionReview.uploadFile', + submissionStageId: pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW, + }, + }, + }); + return actions; + }, }, [pkp.const.WORKFLOW_STAGE_ID_EDITING]: { getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => { diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js index 736ccdd81..23f3b63ad 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js @@ -1,5 +1,4 @@ import {useLocalize} from '@/composables/useLocalize'; -import {Actions} from '../useWorkflowActions'; import {useSubmission} from '@/composables/useSubmission'; import {useCurrentUser} from '@/composables/useCurrentUser'; @@ -42,7 +41,7 @@ export function getHeaderItems({ component: 'WorkflowActionButton', props: { label: t('common.view'), - action: Actions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, + action: WorkflowActions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, }, }); } @@ -56,7 +55,7 @@ export function getHeaderItems({ component: 'WorkflowActionButton', props: { label: t('common.preview'), - action: Actions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, + action: WorkflowActions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, }, }); } @@ -66,7 +65,7 @@ export function getHeaderItems({ component: 'WorkflowActionButton', props: { label: t('editor.activityLog'), - action: Actions.WORKFLOW_VIEW_ACTIVITY_LOG, + action: WorkflowActions.WORKFLOW_VIEW_ACTIVITY_LOG, }, }); } @@ -74,7 +73,7 @@ export function getHeaderItems({ component: 'WorkflowActionButton', props: { label: t('editor.submissionLibrary'), - action: Actions.WORKFLOW_VIEW_LIBRARY, + action: WorkflowActions.WORKFLOW_VIEW_LIBRARY, }, }); @@ -710,7 +709,7 @@ export const PublicationConfig = { props: { label: t('common.preview'), isSecondary: true, - action: Actions.WORKFLOW_PREVIEW_PUBLICATION, + action: WorkflowActions.WORKFLOW_PREVIEW_PUBLICATION, }, }); } @@ -726,7 +725,7 @@ export const PublicationConfig = { : t('editor.submission.schedulePublication'), isSecondary: true, action: - Actions.WORKFLOW_ASSIGN_TO_ISSUE_AND_SCHEDULE_FOR_PUBLICATION, + WorkflowActions.WORKFLOW_ASSIGN_TO_ISSUE_AND_SCHEDULE_FOR_PUBLICATION, }, }); } else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) { @@ -735,7 +734,7 @@ export const PublicationConfig = { props: { label: t('common.preview'), isSecondary: true, - action: Actions.WORKFLOW_PREVIEW_PUBLICATION, + action: WorkflowActions.WORKFLOW_PREVIEW_PUBLICATION, }, }); @@ -744,7 +743,7 @@ export const PublicationConfig = { props: { label: t('publication.unschedule'), isWarnable: true, - action: Actions.WORKFLOW_UNSCHEDULE_PUBLICATION, + action: WorkflowActions.WORKFLOW_UNSCHEDULE_PUBLICATION, }, }); } else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) { @@ -753,7 +752,7 @@ export const PublicationConfig = { props: { label: t('publication.unpublish'), isWarnable: true, - action: Actions.WORKFLOW_UNPUBLISH_PUBLICATION, + action: WorkflowActions.WORKFLOW_UNPUBLISH_PUBLICATION, }, }); @@ -766,7 +765,7 @@ export const PublicationConfig = { props: { label: t('publication.createVersion'), isSecondary: true, - action: Actions.WORKFLOW_CREATE_NEW_VERSION, + action: WorkflowActions.WORKFLOW_CREATE_NEW_VERSION, }, }); } diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js index 9f7329cb8..a9d160b6e 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js @@ -21,17 +21,10 @@ export function getHeaderItems({ return []; } const {t} = useLocalize(); - const items = []; - - items.push({ - component: 'WorkflowWorkTypeOMP', - props: { - submission: submission, - }, - }); + const actions = []; if (submission.status === pkp.const.STATUS_PUBLISHED) { - items.push({ + actions.push({ component: 'WorkflowActionButton', props: { label: t('common.view'), @@ -40,8 +33,22 @@ export function getHeaderItems({ }); } + if ( + submission.status !== pkp.const.STATUS_PUBLISHED && + (submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EDITING || + submission.stageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION) + ) { + actions.push({ + component: 'WorkflowActionButton', + props: { + label: t('common.preview'), + action: WorkflowActions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, + }, + }); + } + if (permissions.canAccessEditorialHistory) { - items.push({ + actions.push({ component: 'WorkflowActionButton', props: { label: t('editor.activityLog'), @@ -49,7 +56,7 @@ export function getHeaderItems({ }, }); } - items.push({ + actions.push({ component: 'WorkflowActionButton', props: { label: t('editor.submissionLibrary'), @@ -57,7 +64,14 @@ export function getHeaderItems({ }, }); - return items; + actions.push({ + component: 'WorkflowWorkTypeOMP', + props: { + submission: submission, + }, + }); + + return actions; } export const WorkflowConfig = { diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js index a3d560df3..9243db567 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOPS.js @@ -34,6 +34,20 @@ export function getHeaderItems({ }); } + if ( + submission.status !== pkp.const.STATUS_PUBLISHED && + (submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EDITING || + submission.stageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION) + ) { + actions.push({ + component: 'WorkflowActionButton', + props: { + label: t('common.preview'), + action: WorkflowActions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION, + }, + }); + } + if (permissions.canAccessEditorialHistory) { actions.push({ component: 'WorkflowActionButton', diff --git a/src/pages/workflow/workflowStore.js b/src/pages/workflow/workflowStore.js index 6388fb692..f488effa2 100644 --- a/src/pages/workflow/workflowStore.js +++ b/src/pages/workflow/workflowStore.js @@ -11,6 +11,8 @@ import { Actions as DecisionActions, } from './composables/useWorkflowDecisions'; +import {useFileManagerActions} from '@/managers/FileManager/useFileManagerActions'; + import {useDataChangedProvider} from '@/composables/useDataChangedProvider'; import {wrapActionFns} from '@/utils/wrapActionFns'; @@ -149,6 +151,26 @@ export const useWorkflowStore = defineComponentStore( }), ); + /** + * File Manager actions + */ + /** + * File Manager actions + */ + const _fileManagerActionFns = useFileManagerActions(); + + function fileUpload(args) { + _fileManagerActionFns.fileUpload( + { + submission: submission.value, + selectedPublication: selectedPublication.value, + reviewRoundId: selectedReviewRound.value?.id, + ...args, + }, + () => triggerDataChange(), + ); + } + /** * Items * @@ -199,6 +221,11 @@ export const useWorkflowStore = defineComponentStore( ...workflowActions, ...decisionActions, + /** + * File manager actions + */ + fileUpload, + /** * Summary */