Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I10684 #463

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/StageBubble/StageBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export const ExtendedStagesColorClass = {
incomplete: 'bg-stage-incomplete-submission',
submission: 'bg-stage-desk-review',
internalReview: 'bg-stage-in-review',
externalReview: 'bg-stage-in-review',
editing: 'bg-stage-copyediting',
productionQueued: 'bg-stage-production',
Expand Down
46 changes: 26 additions & 20 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ExtendedStages = {
export const ExtendedStagesLabels = {
incomplete: tk('submissions.incomplete'),
submission: tk('manager.publication.submissionStage'),
internalReview: tk('todo'),
internalReview: tk('submission.stage.internalReviewWithRound'),
externalReview: tk('submission.stage.externalReviewWithRound'),
editing: tk('submission.copyediting'),
productionQueued: tk('manager.publication.productionStage'),
Expand Down Expand Up @@ -108,8 +108,8 @@ export function useSubmission() {
);
}

function getCurrentReviewAssignments(submission) {
const currentReviewRound = getCurrentReviewRound(submission);
function getCurrentReviewAssignments(submission, stageId) {
const currentReviewRound = getCurrentReviewRound(submission, stageId);

return submission.reviewAssignments.filter(
(reviewAssignment) => reviewAssignment.round === currentReviewRound.round,
Expand Down Expand Up @@ -140,6 +140,8 @@ export function useSubmission() {
return submission.submissionProgress
? ExtendedStages.INCOMPLETE
: ExtendedStages.SUBMISSION;
case pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW:
return ExtendedStages.INTERNAL_REVIEW;
case pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
return ExtendedStages.EXTERNAL_REVIEW;
case pkp.const.WORKFLOW_STAGE_ID_EDITING:
Expand All @@ -158,32 +160,37 @@ export function useSubmission() {

function getExtendedStageLabel(submission) {
const extendedStage = getExtendedStage(submission);
const round =
extendedStage === ExtendedStages.EXTERNAL_REVIEW
? submission.reviewRounds[submission.reviewRounds.length - 1].round
: undefined;

let round = undefined;

const activeStage = getActiveStage(submission);

if (
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
) {
const rounds = getReviewRoundsForStage(submission, activeStage.id);
round = rounds[rounds.length - 1].round;
}

return t(ExtendedStagesLabels[extendedStage], {
round,
});
}

function getFileStageFromWorkflowStage(submission) {
const FileStageMapping = {
[pkp.const.WORKFLOW_STAGE_ID_SUBMISSION]:
pkp.const.SUBMISSION_FILE_SUBMISSION,
[pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]:
pkp.const.SUBMISSION_FILE_REVIEW_REVISION,
[pkp.const.WORKFLOW_STAGE_ID_EDITING]: pkp.const.SUBMISSION_FILE_FINAL,
};

return FileStageMapping[submission.stageId];
}

function hasSubmissionPassedStage(submission, stageId) {
return submission.stageId > stageId;
}

function hasNotSubmissionStartedStage(submission, stageId) {
if (
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
) {
const rounds = getReviewRoundsForStage(submission, stageId);
return rounds?.length === 0;
}

return submission.stageId < stageId;
}

Expand Down Expand Up @@ -252,7 +259,6 @@ export function useSubmission() {
getCurrentReviewAssignments,
getCurrentPublication,
getLatestPublication,
getFileStageFromWorkflowStage,
hasNotSubmissionStartedStage,
hasSubmissionPassedStage,
// review assignments
Expand Down
8 changes: 4 additions & 4 deletions src/managers/FileManager/fileManagerStore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {defineComponentStore} from '@/utils/defineComponentStore';

import {ref, computed, watch} from 'vue';
import {ref, computed, watch, toRefs} from 'vue';
import {useFetch} from '@/composables/useFetch';
import {useUrl} from '@/composables/useUrl';
import {useFileManagerActions} from './useFileManagerActions';
Expand All @@ -10,13 +10,13 @@ export const useFileManagerStore = defineComponentStore(
'fileManager',
(props) => {
const submissionId = ref(props.submission.id);

const {namespace, submissionStageId} = toRefs(props);
/**
* Manager configuration
*/
const {managerConfig} = useFileManagerConfig({
namespace: props.namespace,
submissionStageId: props.submissionStageId,
namespace: namespace,
submissionStageId: submissionStageId,
});

/**
Expand Down
4 changes: 2 additions & 2 deletions src/managers/FileManager/useFileManagerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ export function useFileManagerConfig({namespace, submissionStageId}) {
const {hasCurrentUserAtLeastOneRole} = useCurrentUser();

const managerConfig = computed(() => {
const config = FileManagerConfigurations[namespace]({
stageId: submissionStageId,
const config = FileManagerConfigurations[namespace.value]({
stageId: submissionStageId.value,
});

const permittedActions = config.actions.filter((action) => {
Expand Down
27 changes: 21 additions & 6 deletions src/pages/dashboard/composables/useEditorialLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export function useEditorialLogic() {
];
}
}
if (activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
const activeRound = getCurrentReviewRound(submission);
if (
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
activeStage.id === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
) {
const activeRound = getCurrentReviewRound(submission, activeStage.id);

if (activeStage.currentUserDecidingEditor) {
// just hack for illustration
Expand Down Expand Up @@ -76,7 +79,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -107,7 +113,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -187,7 +196,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -219,7 +231,10 @@ export function useEditorialLogic() {
},
];
} else {
const reviewAssignments = getCurrentReviewAssignments(submission);
const reviewAssignments = getCurrentReviewAssignments(
submission,
activeStage.id,
);

return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,6 @@ export const WorkflowConfig = {
return [];
}

const actionArgs = {
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
};

const selectedStage = getStageById(submission, selectedStageId);

const isRecommendOnlyEditor = selectedStage.currentUserCanRecommendOnly;
Expand All @@ -347,6 +342,11 @@ export const WorkflowConfig = {
},
});
} else {
const actionArgs = {
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
};

addItemIf(
items,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ export const WorkflowConfig = {
},
getActionItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];

if (!selectedReviewRound) {
return [];
}

const {getCurrentReviewRound} = useSubmission();

const currentReviewRound = getCurrentReviewRound(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {t} = useLocalize();

const StageColors = {
[pkp.const.WORKFLOW_STAGE_ID_SUBMISSION]: 'border-stage-desk-review',
[pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW]: 'border-stage-in-review',
[pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: 'border-stage-in-review',
[pkp.const.WORKFLOW_STAGE_ID_EDITING]: 'border-stage-copyediting',
[pkp.const.WORKFLOW_STAGE_ID_PRODUCTION]: 'border-stage-production',
Expand Down
Loading