Skip to content

Commit

Permalink
pkp/pkp-lib#7495 workflow store refactor to have separate version for…
Browse files Browse the repository at this point in the history
… OMP and OJS
  • Loading branch information
jardakotesovec authored and ipula committed Oct 22, 2024
1 parent 1cf730d commit 97d9402
Show file tree
Hide file tree
Showing 30 changed files with 2,984 additions and 1,043 deletions.
2 changes: 2 additions & 0 deletions src/components/Container/Page.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script type="text/javascript">
import Container from '@/components/Container/Container.vue';
import ModalManager from '@/components/Modal/ModalManager.vue';
import DashboardPage from '@/pages/dashboard/DashboardPage.vue';
import PkpAnnouncer from '@/components/Announcer/Announcer.vue';
import ReviewerSubmissionPage from '@/pages/reviewerSubmission/ReviewerSubmissionPage.vue';
Expand All @@ -19,6 +20,7 @@ export default {
FailedJobsPage,
FailedJobDetailsPage,
CounterReportsPage,
DashboardPage,
},
extends: Container,
data() {
Expand Down
21 changes: 21 additions & 0 deletions src/managers/ChapterManager/ChapterManager.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<GridWrapper
:key="`${submissionId} - ${publicationId}`"
grid-component="grid.users.chapter.ChapterGridHandler"
:params="params"
></GridWrapper>
</template>
<script setup>
import GridWrapper from '@/components/GridWrapper/GridWrapper.vue';
import {computed} from 'vue';
const props = defineProps({
submissionId: {type: String, required: true},
publicationId: {type: String, required: true},
});
const params = computed(() => ({
submissionId: props.submissionId,
publicationId: props.publicationId,
}));
</script>
21 changes: 21 additions & 0 deletions src/managers/PublicationFormatManager/PublicationFormatManager.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<GridWrapper
:key="`${submissionId} - ${publicationId}`"
grid-component="grid.catalogEntry.PublicationFormatGridHandler"
:params="params"
></GridWrapper>
</template>
<script setup>
import GridWrapper from '@/components/GridWrapper/GridWrapper.vue';
import {computed} from 'vue';
const props = defineProps({
submissionId: {type: String, required: true},
publicationId: {type: String, required: true},
});
const params = computed(() => ({
submissionId: props.submissionId,
publicationId: props.publicationId,
}));
</script>
19 changes: 19 additions & 0 deletions src/managers/RepresentativeManager/RepresentativeManager.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<GridWrapper
:key="`${submissionId}`"
grid-component="grid.catalogEntry.RepresentativesGridHandler"
:params="params"
></GridWrapper>
</template>
<script setup>
import GridWrapper from '@/components/GridWrapper/GridWrapper.vue';
import {computed} from 'vue';
const props = defineProps({
submissionId: {type: String, required: true},
});
const params = computed(() => ({
submissionId: props.submissionId,
}));
</script>
3 changes: 1 addition & 2 deletions src/pages/dashboard/dashboardPageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {useReviewActivityLogic} from './composables/useReviewActivityLogic';
import {useSubmission} from '@/composables/useSubmission';

import DashboardModalFilters from '@/pages/dashboard/modals/DashboardModalFilters.vue';
import Workflow from '@/pages/workflow/Workflow.vue';

const {t, tk} = useLocalize();

Expand Down Expand Up @@ -330,7 +329,7 @@ export const useDashboardPageStore = defineComponentStore(
function openWorkflowModal(submissionId) {
queryParamsUrl.workflowSubmissionId = submissionId;
openSideModal(
Workflow,
'WorkflowPage',
{
submissionId,
pageInitConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<SideModalBody>
<template #pre-title>
{{ submissionId }}
{{ workflowStore.submissionId }}
</template>
<template #title>
<span v-if="selectedPublication" class="underline">
Expand All @@ -17,7 +17,7 @@
}}
</template>
<template v-if="submission" #post-description>
<StageBubble :extended-stage="extendedStage">
<StageBubble :extended-stage="workflowStore.extendedStage">
<span class="text-lg-normal">
{{ stageLabel }}
</span>
Expand All @@ -26,7 +26,7 @@
<template v-if="submission" #actions>
<div class="flex gap-x-4">
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-bind="item.props"
v-for="(item, index) in workflowStore.headerItems"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -40,15 +40,15 @@
</nav>
</template>
<template #heading>
<h2>{{ workflowStore.stageTitle }}</h2>
<h2>{{ workflowStore.menuTitle }}</h2>
</template>
<template
v-if="workflowStore.publicationControlsLeft?.length"
#publication-controls-left
>
<div class="flex flex-col gap-y-2" data-cy="workflow-controls-left">
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-bind="item.props"
v-for="(item, index) in workflowStore.publicationControlsLeft"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -61,7 +61,7 @@
>
<div class="flex gap-x-3" data-cy="workflow-controls-right">
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-bind="item.props"
v-for="(item, index) in workflowStore.publicationControlsRight"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -75,7 +75,7 @@
data-cy="workflow-primary-items"
>
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-bind="item.props"
v-for="(item, index) in workflowStore.primaryItems"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -88,7 +88,7 @@
data-cy="workflow-action-items"
>
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-for="(item, index) in workflowStore.actionItems"
v-bind="item.props"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -101,7 +101,7 @@
data-cy="workflow-secondary-items"
>
<component
:is="Components[item.component] || item.component"
:is="workflowStore.Components[item.component] || item.component"
v-for="(item, index) in workflowStore.secondaryItems"
v-bind="item.props"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
Expand All @@ -113,78 +113,18 @@
</template>
<script setup>
import {computed} from 'vue';
import {storeToRefs} from 'pinia';
import SideMenu from '@/components/SideMenu/SideMenu.vue';
import SideModalBody from '@/components/Modal/SideModalBody.vue';
import StageBubble from '@/components/StageBubble/StageBubble.vue';
import FileManager from '@/managers/FileManager/FileManager.vue';
import DiscussionManager from '@/managers/DiscussionManager/DiscussionManager.vue';
import ParticipantManager from '@/managers/ParticipantManager/ParticipantManager.vue';
import ReviewerManager from '@/managers/ReviewerManager/ReviewerManager.vue';
import ContributorManager from '@/managers/ContributorManager/ContributorManager.vue';
import WorkflowPrimaryBasicMetadata from './components/primary/WorkflowPrimaryBasicMetadata.vue';
import WorkflowReviewRoundStatus from './components/primary/WorkflowReviewRoundStatus.vue';
// Publications
import WorkflowNotificationDisplay from './components/primary/WorkflowNotificationDisplay.vue';
import WorkflowPaymentDropdown from './components/header/WorkflowPaymentDropdown.vue';
import WorkflowPublicationForm from './components/publication/WorkflowPublicationForm.vue';
import WorkflowPublicationJats from './components/publication/WorkflowPublicationJats.vue';
import WorkflowPublicationVersionControl from './components/publication/WorkflowPublicationVersionControl.vue';
import WorkflowChangeSubmissionLanguage from './components/publication/WorkflowChangeSubmissionLanguage.vue';
import WorkflowActionButton from './components/action/WorkflowActionButton.vue';
import WorkflowRecommendOnlyControls from './components/action/WorkflowRecommendOnlyControls.vue';
import WorkflowRecommendOnlyListingRecommendations from './components/secondary/WorkflowRecommendOnlyListingRecommendations.vue';
import WorkflowSubmissionStatus from './components/primary/WorkflowSubmissionStatus.vue';
import GalleyManager from '@/managers/GalleyManager/GalleyManager.vue';
import WorkflowPublicationEditDisabled from './components/publication/WorkflowPublicationEditDisabled.vue';
import {useWorkflowStore} from './workflowStore';
import SideModalLayoutMenu2Columns from '@/components/Modal/SideModalLayoutMenu2Columns.vue';
import {useLocalize} from '@/composables/useLocalize';
import {useSubmission} from '@/composables/useSubmission';
const {localizeSubmission} = useLocalize();
const Components = {
FileManager,
ReviewerManager,
DiscussionManager,
ContributorManager,
ParticipantManager,
GalleyManager,
WorkflowActionButton,
WorkflowRecommendOnlyControls,
WorkflowRecommendOnlyListingRecommendations,
WorkflowNotificationDisplay,
WorkflowPaymentDropdown,
WorkflowPrimaryBasicMetadata,
WorkflowReviewRoundStatus,
WorkflowPublicationForm,
WorkflowPublicationJats,
WorkflowPublicationVersionControl,
WorkflowChangeSubmissionLanguage,
WorkflowSubmissionStatus,
WorkflowPublicationEditDisabled,
};
const props = defineProps({
submissionId: {type: Number, required: true},
pageInitConfig: {type: Object, required: true},
});
const workflowStore = useWorkflowStore(props);
const {getExtendedStage, getExtendedStageLabel} = useSubmission();
const extendedStage = computed(
() => submission.value && getExtendedStage(submission.value),
);
const stageLabel = computed(
() => submission.value && getExtendedStageLabel(submission.value),
);
const workflowStore = useWorkflowStore();
const {submission, selectedPublication} = storeToRefs(workflowStore);
</script>
15 changes: 15 additions & 0 deletions src/pages/workflow/WorkflowPageOMP.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<WorkflowPage />
</template>

<script setup>
import WorkflowPage from './WorkflowPage.vue';
import {useWorkflowStore} from './workflowStoreOMP';
const props = defineProps({
submissionId: {type: Number, required: true},
pageInitConfig: {type: Object, required: true},
});
useWorkflowStore(props);
</script>
52 changes: 52 additions & 0 deletions src/pages/workflow/components/header/WorkflowWorkTypeOMP.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<DropdownActions
:label="label"
:actions="actions"
@action="handleAction"
></DropdownActions>
</template>

<script setup>
import {computed} from 'vue';
import DropdownActions from '@/components/DropdownActions/DropdownActions.vue';
import {useLocalize} from '@/composables/useLocalize';
import {useWorkflowStore} from '@/pages/workflow/workflowStore';
const {t} = useLocalize();
const props = defineProps({submission: {type: Object, required: true}});
const label = computed(() => {
if (props.submission.workType === pkp.const['WORK_TYPE_EDITED_VOLUME']) {
return t('submission.workflowType.editedVolume.label');
}
return t('common.publication');
});
const actions = computed(() => {
return [
{
label: t('submission.workflowType.editedVolume.label'),
name: 'setAsEditedVolume',
},
{
label: t('common.publication'),
name: 'setAsAuthoredWork',
},
];
});
const workflowStore = useWorkflowStore();
function handleAction(actionName) {
if (actionName === 'setAsEditedVolume') {
workflowStore.workflowChangeWorktype({
workType: pkp.const.WORK_TYPE_EDITED_VOLUME,
});
} else if (actionName === 'setAsAuthoredWork') {
workflowStore.workflowChangeWorktype({
workType: pkp.const.WORK_TYPE_AUTHORED_WORK,
});
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<PkpForm
v-if="form"
v-bind="form"
@set="set"
@success="triggerDataChange"
></PkpForm>
</template>

<script setup>
import {computed, watch} from 'vue';
import PkpForm from '@/components/Form/Form.vue';
import {useFetch} from '@/composables/useFetch';
import {useForm} from '@/composables/useForm';
import {useUrl} from '@/composables/useUrl';
import {useDataChanged} from '@/composables/useDataChanged';
const props = defineProps({
formName: {type: String, required: true},
submission: {type: Object, required: true},
});
const relativeUrl = computed(() => {
// its not publication specific, but its under publications endpoint, therefore selecting publication works correctly
return `submissions/${props.submission.id}/publications/${props.submission.publications[0].id}/_components/${props.formName}`;
});
const {apiUrl: publicationFormUrl} = useUrl(relativeUrl);
const {data: publicationForm, fetch: fetchForm} = useFetch(publicationFormUrl);
watch(
relativeUrl,
() => {
fetchForm();
},
{immediate: true},
);
const {triggerDataChange} = useDataChanged();
const {set, form} = useForm(publicationForm);
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {useUrl} from '@/composables/useUrl';
import {useDataChanged} from '@/composables/useDataChanged';
const props = defineProps({
canEditPublication: {type: Boolean, required: true},
canEdit: {type: Boolean, required: true},
formName: {type: String, required: true},
noFieldsMessage: {type: String, required: false, default: null},
submission: {type: Object, required: true},
Expand All @@ -44,7 +44,7 @@ watch(
);
watch(publicationForm, (newPublicationForm) => {
newPublicationForm.canSubmit = props.canEditPublication;
newPublicationForm.canSubmit = props.canEdit;
});
const displayNoFieldsEnabled = computed(() => {
Expand Down
Loading

0 comments on commit 97d9402

Please sign in to comment.