Skip to content

Commit

Permalink
pkp/pkp-lib#7495 initial adjustments for new submission listing & wor…
Browse files Browse the repository at this point in the history
…kflow for OPS
  • Loading branch information
jardakotesovec committed Nov 7, 2024
1 parent 272bf4a commit e88d2d2
Show file tree
Hide file tree
Showing 13 changed files with 1,412 additions and 18 deletions.
4 changes: 3 additions & 1 deletion src/managers/GalleyManager/galleyManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ export const useGalleyManagerStore = defineComponentStore(
/**
* Actions
*/
const _galleyActionsFns = useGalleyManagerActions();
const _galleyActionsFns = useGalleyManagerActions({
galleyGridComponent: _galleyConfigurationFns.getGalleyGridComponent(),
});
function getActionArgs() {
return {
canEdit: props.canEdit,
Expand Down
8 changes: 4 additions & 4 deletions src/managers/GalleyManager/useGalleyManagerActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Actions = {
GALLEY_DELETE: 'galleyDelete',
};

export function useGalleyManagerActions() {
export function useGalleyManagerActions({galleyGridComponent}) {
const {t} = useLocalize();

function getBottomActions({canEdit}) {
Expand Down Expand Up @@ -76,7 +76,7 @@ export function useGalleyManagerActions() {

function galleyAdd({submission, publication}, finishedCallback) {
const {openLegacyModal} = useLegacyGridUrl({
component: 'grid.articleGalleys.ArticleGalleyGridHandler',
component: galleyGridComponent,
op: 'addGalley',
params: {
submissionId: submission.id,
Expand Down Expand Up @@ -123,7 +123,7 @@ export function useGalleyManagerActions() {

function galleyEdit({submission, publication, galley}, finishedCallback) {
const {openLegacyModal} = useLegacyGridUrl({
component: 'grid.articleGalleys.ArticleGalleyGridHandler',
component: galleyGridComponent,
op: 'editGalley',
params: {
submissionId: submission.id,
Expand Down Expand Up @@ -153,7 +153,7 @@ export function useGalleyManagerActions() {
// http://localhost:7002/index.php/publicknowledge/$$$call$$$/grid/article-galleys/article-galley-grid/delete-galley
// ?submissionId=17&publicationId=22&representationId=9
const {url} = useLegacyGridUrl({
component: 'grid.articleGalleys.ArticleGalleyGridHandler',
component: galleyGridComponent,
op: 'deleteGalley',
params: {
submissionId: submission.id,
Expand Down
10 changes: 9 additions & 1 deletion src/managers/GalleyManager/useGalleyManagerConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import {useLocalize} from '@/composables/useLocalize';
export function useGalleyManagerConfiguration() {
const {t} = useLocalize();

function getGalleyGridComponent() {
if (pkp.context.app === 'ops') {
return 'grid.preprintGalleys.PreprintGalleyGridHandler';
} else {
return 'grid.articleGalleys.ArticleGalleyGridHandler';
}
}

function getColumns() {
const columns = [];

Expand All @@ -29,5 +37,5 @@ export function useGalleyManagerConfiguration() {
return columns;
}

return {getColumns};
return {getColumns, getGalleyGridComponent};
}
27 changes: 22 additions & 5 deletions src/pages/workflow/WorkflowPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,29 @@
#publication-controls-left
>
<div class="flex flex-col gap-y-2" data-cy="workflow-controls-left">
<component
:is="workflowStore.Components[item.component] || item.component"
v-bind="item.props"
<template
v-for="(item, index) in workflowStore.publicationControlsLeft"
:key="`${index} - ${item.component} - ${item?.props?.namespace}`"
/>
>
<div v-if="Array.isArray(item)" :key="`${index}`">
<div class="flex gap-x-2">
<component
:is="
workflowStore.Components[subitem.component] ||
subitem.component
"
v-bind="subitem.props"
v-for="(subitem, subindex) in item"
:key="`${subindex} - ${subitem.component} - ${subitem?.props?.namespace}`"
/>
</div>
</div>
<component
:is="workflowStore.Components[item.component] || item.component"
v-else
v-bind="item.props"
:key="`else ${index} - ${item.component} - ${item?.props?.namespace}`"
/>
</template>
</div>
</template>
<template
Expand Down
15 changes: 15 additions & 0 deletions src/pages/workflow/WorkflowPageOPS.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 './workflowStoreOPS';
const props = defineProps({
submissionId: {type: Number, required: true},
pageInitConfig: {type: Object, required: true},
});
useWorkflowStore(props);
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<Dropdown
class="pkpWorkflow__publicationRelation"
has-dropdown-icon
:label="t('publication.relation')"
>
<PkpForm v-bind="relationForm" @set="set" />
</Dropdown>
</template>

<script setup>
import {watch} from 'vue';
import Dropdown from '@/components/Dropdown/Dropdown.vue';
import PkpForm from '@/components/Form/Form.vue';
import {useLocalize} from '@/composables/useLocalize';
import {useForm} from '@/composables/useForm';
import {useUrl} from '@/composables/useUrl';
import {useDashboardPageStore} from '@/pages/dashboard/dashboardPageStore.js';
const dashboardStore = useDashboardPageStore();
const {t} = useLocalize();
const props = defineProps({publication: {type: Object, required: true}});
const relationForm = dashboardStore.componentForms.relationForm;
const {setValue, setAction, set} = useForm(relationForm);
watch(
props.publication,
(newPublication) => {
setValue('relationStatus', newPublication.relationStatus);
setValue('vorDoi', newPublication.vorDoi);
const {apiUrl} = useUrl(
`submissions/${newPublication.submissionId}/publications/${newPublication.id}`,
);
setAction(apiUrl.value);
},
{immediate: true},
);
</script>
<style lang="less">
.pkpWorkflow__publicationRelation .pkpDropdown__content {
min-width: 22em;
max-width: 22em;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useLocalize} from '@/composables/useLocalize';
import {DashboardPageTypes} from '@/pages/dashboard/dashboardPageStore';

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

import * as ConfigAuthorOMP from './workflowConfigAuthorOMP';
import * as ConfigEditorialOMP from './workflowConfigEditorialOMP';
Expand All @@ -16,11 +16,11 @@ export function useWorkflowConfigOMP({dashboardPage}) {
Configs = {
getHeaderItems: ConfigEditorialOMP.getHeaderItems,
WorkflowConfig: {
...ConfigEditorialShared.WorkflowConfig,
...ConfigEditorialOJS.WorkflowConfig,
...ConfigEditorialOMP.WorkflowConfig,
},
PublicationConfig: {
...ConfigEditorialShared.PublicationConfig,
...ConfigEditorialOJS.PublicationConfig,
...ConfigEditorialOMP.PublicationConfig,
},
MarketingConfig: ConfigEditorialOMP.MarketingConfig,
Expand All @@ -29,11 +29,11 @@ export function useWorkflowConfigOMP({dashboardPage}) {
Configs = {
getHeaderItems: ConfigEditorialOMP.getHeaderItems,
WorkflowConfig: {
...ConfigAuthorShared.WorkflowConfig,
...ConfigAuthorOJS.WorkflowConfig,
...ConfigAuthorOMP.WorkflowConfig,
},
PublicationConfig: {
...ConfigAuthorShared.PublicationConfig,
...ConfigAuthorOJS.PublicationConfig,
...ConfigAuthorOMP.PublicationConfig,
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import {useLocalize} from '@/composables/useLocalize';
import {DashboardPageTypes} from '@/pages/dashboard/dashboardPageStore';

import * as ConfigAuthorOPS from './workflowConfigAuthorOPS';
import * as ConfigEditorialOPS from './workflowConfigEditorialOPS';

export function useWorkflowConfigOPS({dashboardPage}) {
const {t} = useLocalize();

let Configs = null;

if (dashboardPage === DashboardPageTypes.EDITORIAL_DASHBOARD) {
Configs = {
getHeaderItems: ConfigEditorialOPS.getHeaderItems,
WorkflowConfig: {
//...ConfigEditorialShared.WorkflowConfig,
...ConfigEditorialOPS.WorkflowConfig,
},
PublicationConfig: {
//...ConfigEditorialShared.PublicationConfig,
...ConfigEditorialOPS.PublicationConfig,
},
};
} else {
Configs = {
getHeaderItems: ConfigEditorialOPS.getHeaderItems,
WorkflowConfig: {
...ConfigAuthorOPS.WorkflowConfig,
},
PublicationConfig: {
...ConfigAuthorOPS.PublicationConfig,
},
};
}

function _getItems(
getterFnName,
{
selectedMenuState,
submission,
pageInitConfig,
selectedPublication,
selectedPublicationId,
selectedReviewRound,
permissions,
},
) {
if (selectedMenuState.stageId) {
const itemsArgs = {
submission,
selectedPublication,
selectedPublicationId,
selectedStageId: selectedMenuState.stageId,
selectedReviewRound,
permissions,
};
if (!submission) {
return [];
}

if (!permissions.accessibleStages.includes(selectedMenuState.stageId)) {
if (getterFnName === 'getPrimaryItems') {
return [
{
component: 'PrimaryBasicMetadata',
props: {body: t('user.authorization.accessibleWorkflowStage')},
},
];
} else {
return [];
}
}

return [
...(Configs.WorkflowConfig?.common?.[getterFnName]?.(itemsArgs) || []),
...(Configs.WorkflowConfig[selectedMenuState.stageId]?.[getterFnName]?.(
itemsArgs,
) || []),
];
} else if (selectedMenuState.primaryMenuItem === 'publication') {
const itemsArgs = {
submission,
pageInitConfig: pageInitConfig,
selectedPublication,
selectedPublicationId,
permissions,
};
if (!submission || !selectedPublication) {
return [];
}

return [
...(Configs.PublicationConfig?.common?.[getterFnName]?.(itemsArgs) ||
[]),
...(Configs.PublicationConfig[selectedMenuState.secondaryMenuItem]?.[
getterFnName
]?.(itemsArgs) || []),
];
}
}

function getHeaderItems(args) {
return Configs.getHeaderItems(args);
}

function getPrimaryItems(args) {
return _getItems('getPrimaryItems', args);
}

function getSecondaryItems(args) {
return _getItems('getSecondaryItems', args);
}

function getActionItems(args) {
return _getItems('getActionItems', args);
}

function getPublicationControlsLeft(args) {
return _getItems('getPublicationControlsLeft', args);
}

function getPublicationControlsRight(args) {
return _getItems('getPublicationControlsRight', args);
}

return {
getHeaderItems,
getPrimaryItems,
getSecondaryItems,
getActionItems,
getPublicationControlsLeft,
getPublicationControlsRight,
};
}
Loading

0 comments on commit e88d2d2

Please sign in to comment.