Skip to content

Commit

Permalink
pkp/pkp-lib#10067 Pass dashboardPage to config files when it might be…
Browse files Browse the repository at this point in the history
… useful for plugins
  • Loading branch information
jardakotesovec committed Feb 24, 2025
1 parent 8df0489 commit e4a2b7a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/pages/dashboard/composables/useDashboardConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function useDashboardConfig() {

return items;
}

function getRightControls() {
const items = [];

Expand Down
50 changes: 33 additions & 17 deletions src/pages/dashboard/dashboardPageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const useDashboardPageStore = defineComponentStore(
(pageInitConfig) => {
const extender = useExtender();

const dashboardPage = pageInitConfig.dashboardPage;
/**
* ModalStore
*/
Expand All @@ -60,10 +61,10 @@ export const useDashboardPageStore = defineComponentStore(
/** Dashboard Page */

const dashboardPageTitle = computed(() => {
return t(TitleTranslations[pageInitConfig.dashboardPage]);
return t(TitleTranslations[dashboardPage]);
});
const dashboardPageIcon = computed(() => {
return TitleIcons[pageInitConfig.dashboardPage];
return TitleIcons[dashboardPage];
});

/**
Expand All @@ -76,9 +77,11 @@ export const useDashboardPageStore = defineComponentStore(
* Config
*/
const dashboardConfig = extender.addFns(useDashboardConfig());
const leftControlItems = computed(() => dashboardConfig.getLeftControls());
const leftControlItems = computed(() =>
dashboardConfig.getLeftControls({dashboardPage: dashboardPage}),
);
const rightControlItems = computed(() =>
dashboardConfig.getRightControls(),
dashboardConfig.getRightControls({dashboardPage: dashboardPage}),
);

/**
Expand Down Expand Up @@ -120,7 +123,7 @@ export const useDashboardPageStore = defineComponentStore(
*/
const columns = computed(() =>
dashboardConfig.getColumns({
dashboardPage: pageInitConfig.dashboardPage,
dashboardPage: dashboardPage,
}),
);

Expand Down Expand Up @@ -272,7 +275,7 @@ export const useDashboardPageStore = defineComponentStore(
bulkDeleteResetSelection,
} = useDashboardBulkDelete({
submissions,
dashboardPage: pageInitConfig.dashboardPage,
dashboardPage: dashboardPage,
onSubmissionDeleteCallback: () => {
fetchSubmissions();
},
Expand Down Expand Up @@ -417,21 +420,30 @@ export const useDashboardPageStore = defineComponentStore(
useDashboardConfigEditorialActivity(),
);

function getEditorialActivityForEditorialDashboard(...args) {
function getEditorialActivityForEditorialDashboard(args) {
return dashboardConfigEditorialActivity.getEditorialActivityForEditorialDashboard(
...args,
{
...args,
dashboardPage,
},
);
}

function getEditorialActivityForMySubmissions(...args) {
function getEditorialActivityForMySubmissions(args) {
return dashboardConfigEditorialActivity.getEditorialActivityForMySubmissions(
...args,
{
...args,
dashboardPage,
},
);
}

function getEditorialActivityForMyReviewAssignments(...args) {
function getEditorialActivityForMyReviewAssignments(args) {
return dashboardConfigEditorialActivity.getEditorialActivityForMyReviewAssignments(
...args,
{
...args,
dashboardPage,
},
);
}

Expand All @@ -443,21 +455,25 @@ export const useDashboardPageStore = defineComponentStore(
useDashboardConfigReviewActivity(),
);

function getReviewActivityIndicatorProps(...args) {
return dashboardConfigReviewActivity.getReviewActivityIndicatorProps(
function getReviewActivityIndicatorProps(args) {
return dashboardConfigReviewActivity.getReviewActivityIndicatorProps({
...args,
);
dashboardPage,
});
}

function getReviewActivityIndicatorPopoverProps(...args) {
return dashboardConfigReviewActivity.getReviewActivityIndicatorPopoverProps(
...args,
{
...args,
dashboardPage,
},
);
}

return {
// Dashboard
dashboardPage: pageInitConfig.dashboardPage,
dashboardPage,
dashboardPageTitle,
dashboardPageIcon,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function useWorkflowConfigOJS({dashboardPage}) {
selectedPublicationId,
selectedReviewRound,
permissions,
dashboardPage,
},
) {
if (selectedMenuState.stageId) {
Expand Down Expand Up @@ -53,6 +54,7 @@ export function useWorkflowConfigOJS({dashboardPage}) {
selectedPublication,
selectedPublicationId,
permissions,
dashboardPage,
};
if (!submission || !selectedPublication) {
return [];
Expand Down
6 changes: 5 additions & 1 deletion src/pages/workflow/composables/useWorkflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function useWorkflowMenu({
menuItems,
submission,
workflowNavigationConfig,
dashboardPage,
}) {
const {
sideMenuProps,
Expand Down Expand Up @@ -57,7 +58,10 @@ export function useWorkflowMenu({
}
}
navigateToMenu(
workflowNavigationConfig.getInitialSelectionItemKey(newSubmission),
workflowNavigationConfig.getInitialSelectionItemKey({
submission: newSubmission,
dashboardPage,
}),
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function useWorkflowNavigationConfigOJS(pageInitConfig) {
return menuItems;
}

function getInitialSelectionItemKey(submission) {
function getInitialSelectionItemKey({submission}) {
if (
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export function useWorkflowNavigationConfigOMP(pageInitConfig) {
return menuItems;
}

function getInitialSelectionItemKey(submission) {
function getInitialSelectionItemKey({submission}) {
if (
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW ||
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function useWorkflowNavigationConfigOPS(pageInitConfig) {
return menuItems;
}

function getInitialSelectionItemKey(submission) {
function getInitialSelectionItemKey({submission}) {
if (
submission.stageId === pkp.const.WORKFLOW_STAGE_ID_PRODUCTION &&
submission.status !== pkp.const.STATUS_QUEUED
Expand Down
8 changes: 7 additions & 1 deletion src/pages/workflow/workflowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const useWorkflowStore = defineComponentStore(
workflowNavigationConfig.getMenuItems({
submission: submission.value,
permissions: permissions.value,
dashboardPage,
}),
);

Expand All @@ -109,7 +110,12 @@ export const useWorkflowStore = defineComponentStore(
selectedMenuState,
setExpandedKeys,
sideMenuProps,
} = useWorkflowMenu({menuItems, submission, workflowNavigationConfig});
} = useWorkflowMenu({
menuItems,
submission,
workflowNavigationConfig,
dashboardPage,
});

/**
* Expose workflow actions
Expand Down

0 comments on commit e4a2b7a

Please sign in to comment.