Skip to content

Commit

Permalink
pkp/pkp-lib#10618 Refine submission status, clean up inherited config…
Browse files Browse the repository at this point in the history
…urations, various fixes
  • Loading branch information
jardakotesovec committed Nov 28, 2024
1 parent b1a232e commit 6fa4697
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 808 deletions.
21 changes: 15 additions & 6 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} from 'vue';
import {ref, computed, watch} from 'vue';
import {useFetch} from '@/composables/useFetch';
import {useUrl} from '@/composables/useUrl';
import {useFileManagerActions} from './useFileManagerActions';
Expand All @@ -26,16 +26,25 @@ export const useFileManagerStore = defineComponentStore(
`submissions/${submissionId.value}/files`,
);

const queryParams = computed(() => ({
fileStages: managerConfig.value.fileStage,
reviewRoundIds: props.reviewRoundId ? props.reviewRoundId : undefined,
}));

const {data, fetch: fetchFiles} = useFetch(filesApiUrl, {
query: {
fileStages: managerConfig.value.fileStage,
reviewRoundIds: props.reviewRoundId ? props.reviewRoundId : undefined,
},
query: queryParams,
});

const files = computed(() => data.value?.items || []);

fetchFiles();
watch(
[filesApiUrl, queryParams],
() => {
files.value = null;
fetchFiles();
},
{immediate: true},
);

/** Reload files when data on screen changes */
const {triggerDataChange} = useDataChanged(() => fetchFiles());
Expand Down

This file was deleted.

125 changes: 101 additions & 24 deletions src/pages/workflow/components/primary/WorkflowSubmissionStatus.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,117 @@
<template>
<div class="border border-light p-5">
<h2 class="text-lg-bold text-heading">{{ texts.heading }}</h2>
<p v-if="description" class="text-base-normal">{{ texts.description }}</p>
<div v-if="message" class="border border-light p-4">
<h3 v-if="message.heading" class="mb-2 text-lg-bold text-heading">
{{ message.heading }}
</h3>
<p v-if="message.body" class="text-sm-normal">{{ message.body }}</p>
</div>
</template>

<script setup>
import {computed} from 'vue';
import {useSubmission} from '@/composables/useSubmission.js';
import {useLocalize} from '@/composables/useLocalize';
const props = defineProps({
submission: {type: Object, required: true},
submission: {
type: String,
required: true,
},
selectedStageId: {type: Number, required: true},
selectedReviewRoundId: {type: Number, required: false},
});
const {t} = useLocalize();
const {t, tk} = useLocalize();
const {
getActiveStage,
hasNotSubmissionStartedStage,
hasSubmissionPassedStage,
getCurrentReviewRound,
} = useSubmission();
//const activeStage = computed(() => getActiveStage(props.submission));
const StageNames = {
[pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW]: tk(
'workflow.review.internalReview',
),
[pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: tk(
'workflow.review.externalReview',
),
[pkp.const.WORKFLOW_STAGE_ID_EDITING]: tk('submission.copyediting'),
[pkp.const.WORKFLOW_STAGE_ID_PRODUCTION]: tk('submission.production'),
};
const texts = computed(() => {
switch (props.submission.stageId) {
case pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW:
const message = computed(() => {
// not initiated yet
if (hasNotSubmissionStartedStage(props.submission, props.selectedStageId)) {
return {
heading: t('common.status'),
body: t('workflow.stageNotStarted', {
stage: t(StageNames[props.selectedStageId]),
}),
};
// submission is in some future stage
} else if (
hasSubmissionPassedStage(props.submission, props.selectedStageId)
) {
const activeStage = getActiveStage(props.submission);
// more detailed messaging for review rounds that has been moved to the next review round
if (
props.selectedStageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
props.selectedStageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
) {
const currentReviewRound = getCurrentReviewRound(
props.submission,
props.selectedStageId,
);
if (props.selectedReviewRoundId < currentReviewRound.id) {
return {
heading: t('common.status'),
body: t('workflow.submissionNextReviewRoundInFutureStage', {
stage: t(StageNames[activeStage.id]),
}),
};
}
}
return {
heading: t('common.status'),
body: t('workflow.submissionInFutureStage', {
stage: t(StageNames[activeStage.id]),
}),
};
// when active stage is review stage
} else if (
props.selectedStageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
props.selectedStageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
) {
const currentReviewRound = getCurrentReviewRound(
props.submission,
props.selectedStageId,
);
if (props.selectedReviewRoundId < currentReviewRound.id) {
return {
heading: t('editor.submission.workflowDecision.submission.underReview'),
heading: t('common.status'),
body: t('workflow.submissionInNextReviewRound'),
};
case pkp.const.WORKFLOW_STAGE_ID_EDITING:
return {heading: 'todo'};
case pkp.const.WORKFLOW_STAGE_ID_PRODUCTION:
switch (props.submission.status) {
case pkp.const.STATUS_QUEUED:
return {heading: 'todo'};
case pkp.const.STATUS_SCHEDULED:
return {heading: 'todo'};
case pkp.const.STATUS_PUBLISHED:
return {heading: 'todo'};
case pkp.const.STATUS_DECLINED:
return {heading: 'todo'};
}
}
return {
heading: t('notification.type.roundStatusTitle', {
round: currentReviewRound.round,
}),
body: currentReviewRound.status,
};
} else if (props.selectedStageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION) {
if (props.submission.status === pkp.const.STATUS_PUBLISHED) {
return {
heading: t('common.status'),
body: t('editor.submission.workflowDecision.submission.published'),
};
}
}
return '';
return null;
});
</script>
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {DashboardPageTypes} from '@/pages/dashboard/dashboardPageStore';
import {deepMerge} from '@/utils/deepMerge';

import * as ConfigAuthorOJS from './workflowConfigAuthorOJS';
import * as ConfigEditorialOJS from './workflowConfigEditorialOJS';

import * as ConfigAuthorOPS from './workflowConfigAuthorOPS';
import * as ConfigEditorialOPS from './workflowConfigEditorialOPS';
Expand All @@ -9,9 +13,9 @@ export function useWorkflowConfigOPS({dashboardPage}) {
let Configs = null;

if (dashboardPage === DashboardPageTypes.EDITORIAL_DASHBOARD) {
Configs = ConfigEditorialOPS;
Configs = deepMerge(deepMerge({}, ConfigEditorialOJS), ConfigEditorialOPS);
} else {
Configs = ConfigAuthorOPS;
Configs = deepMerge(deepMerge({}, ConfigAuthorOJS), ConfigAuthorOPS);
}

function _getItems(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import {useLocalize} from '@/composables/useLocalize';
import {Actions} from '../useWorkflowActions';
import {useSubmission} from '@/composables/useSubmission';

const {hasSubmissionPassedStage, getOpenReviewAssignmentsForRound} =
useSubmission();
const {
hasSubmissionPassedStage,
getOpenReviewAssignmentsForRound,
hasNotSubmissionStartedStage,
} = useSubmission();

const {t} = useLocalize();

Expand Down Expand Up @@ -31,13 +34,18 @@ export function getHeaderItems({

export const WorkflowConfig = {
common: {
getPrimaryItems: ({submission, permissions, selectedStageId}) => {
getPrimaryItems: ({
submission,
permissions,
selectedStageId,
selectedReviewRound,
}) => {
if (!permissions.accessibleStages.includes(selectedStageId)) {
return {
shouldContinue: false,
items: [
{
component: 'PrimaryBasicMetadata',
component: 'WorkflowPrimaryBasicMetadata',
props: {
body: t('user.authorization.accessibleWorkflowStage'),
},
Expand All @@ -46,17 +54,33 @@ export const WorkflowConfig = {
};
}

const items = [];

items.push({
component: 'WorkflowChangeSubmissionLanguage',
props: {
submission,
canChangeSubmissionLanguage: false,
},
});

const shouldContinue = !hasNotSubmissionStartedStage(
submission,
selectedStageId,
);

items.push({
component: 'WorkflowSubmissionStatus',
props: {
submission,
selectedStageId,
selectedReviewRoundId: selectedReviewRound?.id,
},
});

return {
shouldContinue: true,
items: [
{
component: 'WorkflowChangeSubmissionLanguage',
props: {
submission,
canChangeSubmissionLanguage: false,
},
},
],
shouldContinue,
items,
};
},
},
Expand Down Expand Up @@ -94,38 +118,6 @@ export const WorkflowConfig = {
[pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: {
getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];
if (!selectedReviewRound) {
return [
{
component: 'WorkflowPrimaryBasicMetadata',
props: {body: t('editor.review.notInitiated')},
},
];
}
const {getCurrentReviewRound} = useSubmission();

const currentReviewRound = getCurrentReviewRound(
submission,
selectedStageId,
);

if (selectedReviewRound.round < currentReviewRound.round) {
items.push({
component: 'WorkflowPrimaryBasicMetadata',
props: {
body: t(
'editor.submission.workflowDecision.submission.reviewRound',
),
},
});
}

if (selectedReviewRound.id === currentReviewRound.id) {
items.push({
component: 'WorkflowReviewRoundStatus',
props: {reviewRound: selectedReviewRound},
});
}

items.push({
component: 'WorkflowListingEmails',
Expand Down Expand Up @@ -172,20 +164,6 @@ export const WorkflowConfig = {
getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];

if (
hasSubmissionPassedStage(
submission,
pkp.const.WORKFLOW_STAGE_ID_EDITING,
)
) {
items.push({
component: 'WorkflowPrimaryBasicMetadata',
props: {
body: t('editor.submission.workflowDecision.submission.production'),
},
});
}

items.push({
component: 'DiscussionManager',
props: {
Expand All @@ -209,14 +187,6 @@ export const WorkflowConfig = {
[pkp.const.WORKFLOW_STAGE_ID_PRODUCTION]: {
getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];
if (submission.status === pkp.const.STATUS_PUBLISHED) {
items.push({
component: 'WorkflowPrimaryBasicMetadata',
props: {
body: t('editor.submission.workflowDecision.submission.published'),
},
});
}

items.push({
component: 'DiscussionManager',
Expand Down
Loading

0 comments on commit 6fa4697

Please sign in to comment.