From 70d6fef74eba969cef80b3072394140c6fd5680b Mon Sep 17 00:00:00 2001 From: Blesilda Ramirez Date: Wed, 9 Oct 2024 21:55:28 +0800 Subject: [PATCH] pkp/pkp-lib#10444 Add modalStyle to components that use the openDialog api --- src/components/Container/WorkflowPage.vue | 5 ++-- src/components/Form/fields/FieldOrcid.vue | 5 ++-- src/components/ListPanel/doi/DoiListItem.vue | 3 +- src/components/ListPanel/doi/DoiListPanel.vue | 2 +- .../FileManager/useFileManagerActions.js | 15 +++++----- .../GalleyManager/useGalleyManagerActions.js | 17 ++++++----- .../useParticipantManagerActions.js | 30 ++++++++++--------- .../useReviewerManagerActions.js | 30 ++++++++++--------- .../AcceptInvitationPageStore.js | 1 + .../userInvitation/UserInvitationPageStore.js | 1 + .../composables/useWorkflowActions.js | 9 ++++-- 11 files changed, 66 insertions(+), 52 deletions(-) diff --git a/src/components/Container/WorkflowPage.vue b/src/components/Container/WorkflowPage.vue index bd880fd03..967fd4745 100644 --- a/src/components/Container/WorkflowPage.vue +++ b/src/components/Container/WorkflowPage.vue @@ -341,7 +341,7 @@ export default { actions: [ { label: this.t('common.yes'), - isWarnable: true, + isPrimary: true, callback: (close) => { close(); this.createVersion(); @@ -448,7 +448,7 @@ export default { this.workingPublication.status === pkp.const.STATUS_SCHEDULED ? this.unscheduleLabel : this.unpublishLabel, - isPrimary: true, + isWarnable: true, callback: (close) => { this.unpublish(this.workingPublication); close(); @@ -459,6 +459,7 @@ export default { callback: (close) => close(), }, ], + modalStyle: 'negative', }); }, diff --git a/src/components/Form/fields/FieldOrcid.vue b/src/components/Form/fields/FieldOrcid.vue index 0b492abdf..ebb43edf4 100644 --- a/src/components/Form/fields/FieldOrcid.vue +++ b/src/components/Form/fields/FieldOrcid.vue @@ -190,6 +190,7 @@ export default { }, }, ], + modalStyle: 'primary', close: () => {}, }); }, @@ -227,7 +228,7 @@ export default { actions: [ { label: this.t('common.yes'), - isPrimary: true, + isWarnable: true, callback: async (close) => { await this.deleteOrcid(); close(); @@ -235,12 +236,12 @@ export default { }, { label: this.t('common.no'), - isWarnable: true, callback: (close) => { close(); }, }, ], + modalStyle: 'negative', close: () => {}, }); }, diff --git a/src/components/ListPanel/doi/DoiListItem.vue b/src/components/ListPanel/doi/DoiListItem.vue index af8e24b30..57e871926 100644 --- a/src/components/ListPanel/doi/DoiListItem.vue +++ b/src/components/ListPanel/doi/DoiListItem.vue @@ -513,12 +513,12 @@ export default { actions: [ { label: this.t('common.ok'), - isPrimary: true, callback: (close) => { close(); }, }, ], + modalStyle: 'negative', }); }, openVersionModal() { @@ -814,6 +814,7 @@ export default { }, }, ], + modalStyle: 'primary', }); }, triggerDeposit() { diff --git a/src/components/ListPanel/doi/DoiListPanel.vue b/src/components/ListPanel/doi/DoiListPanel.vue index 65609012d..a1d38e5f1 100644 --- a/src/components/ListPanel/doi/DoiListPanel.vue +++ b/src/components/ListPanel/doi/DoiListPanel.vue @@ -375,13 +375,13 @@ export default { actions: [ { label: this.t('common.ok'), - isPrimary: true, callback: (close) => { this.failedDoiActions = []; close(); }, }, ], + modalStyle: 'negative', bodyComponent: DoiFailedActionDialogBody, bodyProps: { failedDoiActions: this.failedDoiActions, diff --git a/src/managers/FileManager/useFileManagerActions.js b/src/managers/FileManager/useFileManagerActions.js index 4c2184634..fa5631c6e 100644 --- a/src/managers/FileManager/useFileManagerActions.js +++ b/src/managers/FileManager/useFileManagerActions.js @@ -111,15 +111,9 @@ export function useFileManagerActions() { const {openDialog, openDialogNetworkError} = useModal(); openDialog({ actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - }, - }, { label: t('common.ok'), + isWarnable: true, callback: async (close) => { const {url} = useLegacyGridUrl({ component: 'api.file.ManageFileApiHandler', @@ -146,9 +140,16 @@ export function useFileManagerActions() { } }, }, + { + label: t('common.cancel'), + callback: (close) => { + close(); + }, + }, ], title: t('common.delete'), message: t('common.confirmDelete'), + modalStyle: 'negative', }); } diff --git a/src/managers/GalleyManager/useGalleyManagerActions.js b/src/managers/GalleyManager/useGalleyManagerActions.js index 90b9a380e..2f799d8b3 100644 --- a/src/managers/GalleyManager/useGalleyManagerActions.js +++ b/src/managers/GalleyManager/useGalleyManagerActions.js @@ -139,16 +139,9 @@ export function useGalleyManagerActions({galleyGridComponent}) { const {openDialog, openDialogNetworkError} = useModal(); openDialog({ actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - finishedCallback(); - }, - }, { label: t('common.ok'), + isWarnable: true, callback: async (close) => { // http://localhost:7002/index.php/publicknowledge/$$$call$$$/grid/article-galleys/article-galley-grid/delete-galley // ?submissionId=17&publicationId=22&representationId=9 @@ -177,9 +170,17 @@ export function useGalleyManagerActions({galleyGridComponent}) { } }, }, + { + label: t('common.cancel'), + callback: (close) => { + close(); + finishedCallback(); + }, + }, ], title: t('common.delete'), message: t('common.confirmDelete'), + modalStyle: 'negative', }); } diff --git a/src/managers/ParticipantManager/useParticipantManagerActions.js b/src/managers/ParticipantManager/useParticipantManagerActions.js index 8bc63afed..54c20f6b7 100644 --- a/src/managers/ParticipantManager/useParticipantManagerActions.js +++ b/src/managers/ParticipantManager/useParticipantManagerActions.js @@ -40,15 +40,9 @@ export function useParticipantManagerActions() { openDialog({ actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - }, - }, { label: t('common.ok'), + isWarnable: true, callback: async (close) => { // http://localhost:7002/index.php/publicknowledge/ // $$$call$$$/grid/users/stage-participant/stage-participant-grid/delete-participant?submissionId=13&stageId=3&assignmentId=62 @@ -80,9 +74,16 @@ export function useParticipantManagerActions() { } }, }, + { + label: t('common.cancel'), + callback: (close) => { + close(); + }, + }, ], title: t('editor.submission.removeStageParticipant'), message: t('editor.submission.removeStageParticipant.description'), + modalStyle: 'negative', }); } @@ -124,13 +125,6 @@ export function useParticipantManagerActions() { openDialog({ actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - }, - }, { label: t('common.ok'), callback: (close) => { @@ -152,9 +146,17 @@ export function useParticipantManagerActions() { redirectToPage(); }, }, + { + label: t('common.cancel'), + isWarnable: true, + callback: (close) => { + close(); + }, + }, ], title: t('grid.action.logInAs'), message: t('grid.user.confirmLogInAs'), + modalStyle: 'primary', }); } diff --git a/src/managers/ReviewerManager/useReviewerManagerActions.js b/src/managers/ReviewerManager/useReviewerManagerActions.js index cc454e2df..15b9ba7aa 100644 --- a/src/managers/ReviewerManager/useReviewerManagerActions.js +++ b/src/managers/ReviewerManager/useReviewerManagerActions.js @@ -432,13 +432,6 @@ export function useReviewerManagerActions() { openDialog( { actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - }, - }, { label: t('common.ok'), callback: (close) => { @@ -448,9 +441,17 @@ export function useReviewerManagerActions() { redirectToPage(); }, }, + { + label: t('common.cancel'), + isWarnable: true, + callback: (close) => { + close(); + }, + }, ], title: t('grid.action.logInAs'), message: t('grid.user.confirmLogInAs'), + modalStyle: 'primary', }, finishedCallback, ); @@ -502,15 +503,9 @@ export function useReviewerManagerActions() { openDialog( { actions: [ - { - label: t('common.cancel'), - isWarnable: true, - callback: (close) => { - close(); - }, - }, { label: t('common.ok'), + isWarnable: true, callback: async (close) => { // http://localhost:7002/index.php/publicknowledge/$$$call$$$/grid/users/reviewer/reviewer-grid/unconsider-review?submissionId=12&reviewAssignmentId=17&stageId=3 @@ -539,9 +534,16 @@ export function useReviewerManagerActions() { } }, }, + { + label: t('common.cancel'), + callback: (close) => { + close(); + }, + }, ], title: t('editor.review.unconsiderReview'), message: t('editor.review.unconsiderReviewText'), + modalStyle: 'negative', }, finishedCallback, ); diff --git a/src/pages/acceptInvitation/AcceptInvitationPageStore.js b/src/pages/acceptInvitation/AcceptInvitationPageStore.js index 53f75b4bc..1ad8eff9f 100644 --- a/src/pages/acceptInvitation/AcceptInvitationPageStore.js +++ b/src/pages/acceptInvitation/AcceptInvitationPageStore.js @@ -368,6 +368,7 @@ export const useAcceptInvitationPageStore = defineComponentStore( }, }, ], + modalStyle: 'success', }); } } diff --git a/src/pages/userInvitation/UserInvitationPageStore.js b/src/pages/userInvitation/UserInvitationPageStore.js index b284eeb3a..9c4bce0d6 100644 --- a/src/pages/userInvitation/UserInvitationPageStore.js +++ b/src/pages/userInvitation/UserInvitationPageStore.js @@ -324,6 +324,7 @@ export const useUserInvitationPageStore = defineComponentStore( }, }, ], + modalStyle: 'primary', }); } else { isSubmitting.value = false; diff --git a/src/pages/workflow/composables/useWorkflowActions.js b/src/pages/workflow/composables/useWorkflowActions.js index ff0677841..9be2eae77 100644 --- a/src/pages/workflow/composables/useWorkflowActions.js +++ b/src/pages/workflow/composables/useWorkflowActions.js @@ -205,7 +205,7 @@ export function useWorkflowActions({ actions: [ { label: t('publication.unschedule'), - isPrimary: true, + isWarnable: true, callback: async (close) => { const {apiUrl: unschedulePublicationApiUrl} = useUrl( `submissions/${submission.id}/publications/${selectedPublication.id}/unpublish`, @@ -223,6 +223,7 @@ export function useWorkflowActions({ callback: (close) => close(), }, ], + modalStyle: 'negative', }); } @@ -237,7 +238,7 @@ export function useWorkflowActions({ actions: [ { label: t('publication.unpublish'), - isPrimary: true, + isWarnable: true, callback: async (close) => { const {apiUrl: unschedulePublicationApiUrl} = useUrl( `submissions/${submission.id}/publications/${selectedPublication.id}/unpublish`, @@ -255,6 +256,7 @@ export function useWorkflowActions({ callback: (close) => close(), }, ], + modalStyle: 'negative', }); } @@ -268,7 +270,7 @@ export function useWorkflowActions({ actions: [ { label: t('common.yes'), - isWarnable: true, + isPrimary: true, callback: async (close) => { close(); @@ -294,6 +296,7 @@ export function useWorkflowActions({ callback: (close) => close(), }, ], + modalStyle: 'primary', }); }