Skip to content

Commit

Permalink
pkp/pkp-lib#10599 Include remove action also in OPS config
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Dec 5, 2024
1 parent c6a3352 commit 337d7ba
Showing 1 changed file with 35 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import {useLocalize} from '@/composables/useLocalize';
import {Actions} from '../useWorkflowActions';
import {Actions as WorkflowActions} from '../useWorkflowActions';
import {useSubmission} from '@/composables/useSubmission';
import {Actions as DecisionActions} from '../useWorkflowDecisions';
import {addItemIf} from './workflowConfigHelpers';
import {useCurrentUser} from '@/composables/useCurrentUser';

const {hasSubmissionPassedStage, isDecisionAvailable, getActiveStage} =
useSubmission();

const {hasCurrentUserAtLeastOneAssignedRoleInAnyStage} = useCurrentUser();

const {t} = useLocalize();

export function getHeaderItems({
Expand All @@ -25,7 +29,7 @@ export function getHeaderItems({
component: 'WorkflowActionButton',
props: {
label: t('common.view'),
action: Actions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION,
action: WorkflowActions.WORKFLOW_VIEW_PUBLISHED_SUBMISSION,
},
});
}
Expand All @@ -35,15 +39,15 @@ export function getHeaderItems({
component: 'WorkflowActionButton',
props: {
label: t('editor.activityLog'),
action: Actions.WORKFLOW_VIEW_ACTIVITY_LOG,
action: WorkflowActions.WORKFLOW_VIEW_ACTIVITY_LOG,
},
});
}
actions.push({
component: 'WorkflowActionButton',
props: {
label: t('editor.submissionLibrary'),
action: Actions.WORKFLOW_VIEW_LIBRARY,
action: WorkflowActions.WORKFLOW_VIEW_LIBRARY,
},
});

Expand Down Expand Up @@ -118,6 +122,27 @@ export const WorkflowConfig = {
),
);

// Delete submission
addItemIf(
items,
{
component: 'WorkflowActionButton',
props: {
label: t('common.delete'),
isWarnable: true,
action: WorkflowActions.WORKFLOW_DELETE_SUBMISSION,
},
},
isDecisionAvailable(
submission,
pkp.const.DECISION_REVERT_INITIAL_DECLINE,
) &&
hasCurrentUserAtLeastOneAssignedRoleInAnyStage(submission, [
pkp.const.ROLE_ID_MANAGER,
pkp.const.ROLE_ID_SITE_ADMIN,
]),
);

return items;
},
},
Expand Down Expand Up @@ -188,7 +213,7 @@ export const PublicationConfig = {
props: {
label: t('common.preview'),
isSecondary: true,
action: Actions.WORKFLOW_PREVIEW_PUBLICATION,
action: WorkflowActions.WORKFLOW_PREVIEW_PUBLICATION,
},
});
}
Expand All @@ -200,7 +225,7 @@ export const PublicationConfig = {

label: t('publication.publish'),
isSecondary: true,
action: Actions.WORKFLOW_SCHEDULE_FOR_PUBLICATION,
action: WorkflowActions.WORKFLOW_SCHEDULE_FOR_PUBLICATION,
},
});
} else if (selectedPublication.status === pkp.const.STATUS_SCHEDULED) {
Expand All @@ -209,7 +234,7 @@ export const PublicationConfig = {
props: {
label: t('dashboard.summary.preview'),
isSecondary: true,
action: Actions.WORKFLOW_PREVIEW_PUBLICATION,
action: WorkflowActions.WORKFLOW_PREVIEW_PUBLICATION,
},
});

Expand All @@ -218,7 +243,7 @@ export const PublicationConfig = {
props: {
label: t('publication.unschedule'),
isWarnable: true,
action: Actions.WORKFLOW_UNSCHEDULE_PUBLICATION,
action: WorkflowActions.WORKFLOW_UNSCHEDULE_PUBLICATION,
},
});
} else if (selectedPublication.status === pkp.const.STATUS_PUBLISHED) {
Expand All @@ -227,7 +252,7 @@ export const PublicationConfig = {
props: {
label: t('publication.unpublish'),
isWarnable: true,
action: Actions.WORKFLOW_UNPUBLISH_PUBLICATION,
action: WorkflowActions.WORKFLOW_UNPUBLISH_PUBLICATION,
},
});

Expand All @@ -240,7 +265,7 @@ export const PublicationConfig = {
props: {
label: t('publication.createVersion'),
isSecondary: true,
action: Actions.WORKFLOW_CREATE_NEW_VERSION,
action: WorkflowActions.WORKFLOW_CREATE_NEW_VERSION,
},
});
}
Expand Down

0 comments on commit 337d7ba

Please sign in to comment.