From 99c2e307e8d25bbcf64190b763f8d29bcae9ee76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Wed, 16 Oct 2024 20:09:43 +0200 Subject: [PATCH] pkp/pkp-lib#7495 Move OJS specific items for dashboard to own handler pkp/pkp-lib#7495 PHP formatting --- .../forms/dashboard/SubmissionFilters.php | 54 ++++++++++++++ .../60-content/AmwandengaSubmission.cy.js | 4 +- js/load.js | 6 ++ pages/dashboard/DashboardHandlerNext.php | 74 +++++++++++++++++++ pages/dashboard/index.php | 29 ++++++++ registry/uiLocaleKeysBackend.json | 24 ++++-- 6 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 classes/components/forms/dashboard/SubmissionFilters.php create mode 100644 pages/dashboard/DashboardHandlerNext.php create mode 100644 pages/dashboard/index.php diff --git a/classes/components/forms/dashboard/SubmissionFilters.php b/classes/components/forms/dashboard/SubmissionFilters.php new file mode 100644 index 00000000000..217e8ea9d6e --- /dev/null +++ b/classes/components/forms/dashboard/SubmissionFilters.php @@ -0,0 +1,54 @@ +addPage(['id' => 'default', 'submitButton' => null]) + ->addGroup(['id' => 'default', 'pageId' => 'default']) + ->addSectionFields() + ->addAssignedTo() + ->addIssues() + ->addCategories() + ->addDaysSinceLastActivity() + ; + } + + protected function addIssues(): self + { + $request = Application::get()->getRequest(); + + return $this->addField(new FieldSelectIssues('issueIds', [ + 'groupId' => 'default', + 'label' => __('issue.issues'), + 'value' => [], + 'apiUrl' => $request->getDispatcher()->url($request, Application::ROUTE_API, $request->getContext()->getPath(), 'issues'), + ])); + } +} diff --git a/cypress/tests/data/60-content/AmwandengaSubmission.cy.js b/cypress/tests/data/60-content/AmwandengaSubmission.cy.js index b3bb98a8595..151ef5f4bbc 100644 --- a/cypress/tests/data/60-content/AmwandengaSubmission.cy.js +++ b/cypress/tests/data/60-content/AmwandengaSubmission.cy.js @@ -464,7 +464,9 @@ describe('Data suite: Amwandenga', function() { cy.get('button').contains('Create New Version').click(); cy.contains('Are you sure you want to create a new version?'); cy.get('div[role=dialog]:contains("Create New Version")').get('button').contains('Yes').click(); - cy.wait(3000); + + // Once there is 'in progress' overlay when creating new version this can be improved + cy.wait(10000); // Toggle between versions cy.get('button').contains('All Versions').click(); diff --git a/js/load.js b/js/load.js index e4eda1b537a..3e3dc178e38 100644 --- a/js/load.js +++ b/js/load.js @@ -18,6 +18,8 @@ import Container from '@/components/Container/Container.vue'; import AdvancedSearchReviewerContainer from '@/components/Container/AdvancedSearchReviewerContainer.vue'; import Page from '@/components/Container/Page.vue'; import PageOJS from '@/components/Container/PageOJS.vue'; +import WorkflowPageOJS from '@/pages/workflow/WorkflowPageOJS.vue'; + import AccessPage from '@/components/Container/AccessPage.vue'; import AddContextContainer from '@/components/Container/AddContextContainer.vue'; import AdminPage from '@/components/Container/AdminPage.vue'; @@ -36,6 +38,10 @@ import SubmissionWizardPage from '@/components/Container/SubmissionWizardPage.vu import WorkflowPage from '@/components/Container/WorkflowPageOJS.vue'; import DashboardPage from '@/pages/dashboard/DashboardPage.vue'; +// Helper for initializing and tracking Vue controllers +import VueRegistry from '../lib/pkp/js/classes/VueRegistry.js'; +VueRegistry.registerComponent('WorkflowPage', WorkflowPageOJS); + // Expose Vue, the registry and controllers in a global var window.pkp = Object.assign(PkpLoad, window.pkp || {}, { controllers: { diff --git a/pages/dashboard/DashboardHandlerNext.php b/pages/dashboard/DashboardHandlerNext.php new file mode 100644 index 00000000000..0ff87f0517e --- /dev/null +++ b/pages/dashboard/DashboardHandlerNext.php @@ -0,0 +1,74 @@ +getContext(); + + $paymentManager = Application::get()->getPaymentManager($context); + + $pageInitConfig = $templateMgr->getState('pageInitConfig'); + $pageInitConfig['publicationSettings']['submissionPaymentsEnabled'] = $paymentManager->publicationEnabled(); + $templateMgr->setState(['pageInitConfig' => $pageInitConfig]); + + $templateMgr->setConstants([ + 'FORM_ASSIGN_TO_ISSUE' => FORM_ASSIGN_TO_ISSUE + ]); + } + + + protected function getSubmissionFiltersForm($userRoles, $context) + { + $sections = Repo::section() + ->getCollector() + ->filterByContextIds([$context->getId()]) + ->getMany(); + + $categories = Repo::category() + ->getCollector() + ->filterByContextIds([$context->getId()]) + ->getMany(); + + return new SubmissionFilters( + $context, + $userRoles, + $sections, + $categories + ); + } +} diff --git a/pages/dashboard/index.php b/pages/dashboard/index.php new file mode 100644 index 00000000000..68b4361162e --- /dev/null +++ b/pages/dashboard/index.php @@ -0,0 +1,29 @@ +