Skip to content

Commit

Permalink
Add message that deciding editors needs to be assigned before making …
Browse files Browse the repository at this point in the history
…decision
  • Loading branch information
jardakotesovec committed Sep 26, 2024
1 parent b1c16d2 commit 5d2835b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<template>
<div
v-if="!isLoading && currentRecommendation"
v-if="!isDecidingEditorAssigned || (!isLoading && currentRecommendation)"
class="w-full border border-light"
>
<div class="p-4">
<h2 class="uppercase text-heading">
{{ t('editor.submission.recommendation') }}
</h2>
</div>
<div class="flex flex-col border-t border-light p-4">
<div
v-if="isDecidingEditorAssigned"
class="flex flex-col border-t border-light p-4"
>
<p class="text-lg-normal text-default">
{{ currentRecommendation.label }}
</p>
Expand All @@ -18,6 +21,11 @@
</PkpButton>
</span>
</div>
<div v-else class="p-4">
<p class="text-lg-normal text-default">
{{ t('editor.submission.recommendation.noDecidingEditors') }}
</p>
</div>
</div>
<div v-if="showRecommendationActions" class="flex flex-col gap-y-2">
<PkpButton
Expand All @@ -44,7 +52,7 @@ import {Actions as WorkflowActions} from '../../composables/useWorkflowActions';
const {t} = useLocalize();
const props = defineProps({
submissionId: {type: Number, required: true},
submission: {type: Object, required: true},
reviewRoundId: {type: Number, required: true},
stageId: {type: Number, required: true},
userId: {type: Number, required: true},
Expand All @@ -59,7 +67,15 @@ const RecommendOnlyDecisions = [
const explicitelyShowRecommendationActions = ref(false);
const isDecidingEditorAssigned = computed(() => {
return props.submission?.editorAssigned;
});
const showRecommendationActions = computed(() => {
if (!isDecidingEditorAssigned.value) {
return false;
}
if (explicitelyShowRecommendationActions.value) {
return true;
}
Expand Down Expand Up @@ -101,7 +117,7 @@ const actionItems = computed(() => {
const {apiUrl: recommendationApiUrl} = useUrl(
// TODO improve url when the query params are available
`submissions/${props.submissionId}/decisions`,
`submissions/${props.submission?.id}/decisions`,
);
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,21 @@ export const WorkflowConfig = {
return items;
},
getSecondaryItems: ({submission, selectedReviewRound, selectedStageId}) => {
// TODO add isDecidingEditor boolean to api
const items = [];
items.push({
component: 'WorkflowRecommendOnlyListingRecommendations',
props: {
submission: submission,
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
},
});

// TODO add isDecidingEditor boolean to api to make it more accurate
const selectedStage = getStageById(submission, selectedStageId);
const isRecommendOnlyEditor = selectedStage.currentUserCanRecommendOnly;
if (!isRecommendOnlyEditor) {
items.push({
component: 'WorkflowRecommendOnlyListingRecommendations',
props: {
submission: submission,
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
},
});
}
items.push({
component: 'ParticipantManager',
props: {
Expand Down Expand Up @@ -255,7 +259,7 @@ export const WorkflowConfig = {
items.push({
component: 'WorkflowRecommendOnlyControls',
props: {
submissionId: submission.id,
submission: submission,
userId: pkp.currentUser.id,
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
Expand Down Expand Up @@ -756,7 +760,6 @@ export function useWorkflowEditorialConfig() {
selectedStageId: selectedMenuState.stageId,
selectedReviewRound,
};
console.log('itemsArgs:', itemsArgs);
if (!submission) {
return [];
}
Expand Down

0 comments on commit 5d2835b

Please sign in to comment.