diff --git a/public/globals.js b/public/globals.js
index 95e566c52..3d90f042c 100644
--- a/public/globals.js
+++ b/public/globals.js
@@ -147,12 +147,12 @@ window.pkp = {
'acceptInvitation.verifyOrcid': 'Verify ORCID iD',
'admin.jobs.failed.action.redispatch': 'Try Again',
'admin.jobs.failed.action.redispatch.all': 'Requeue All Failed Jobs',
- 'admin.submissions.incomplete.bulkDelete.body':
- '##admin.submissions.incomplete.bulkDelete.body##',
- 'admin.submissions.incomplete.bulkDelete.column.description':
- '##admin.submissions.incomplete.bulkDelete.column.description##',
- 'admin.submissions.incomplete.bulkDelete.confirm':
- '##admin.submissions.incomplete.bulkDelete.confirm##',
+ 'dashboard.submissions.incomplete.bulkDelete.body':
+ '##dashboard.submissions.incomplete.bulkDelete.body##',
+ 'dashboard.submissions.incomplete.bulkDelete.column.description':
+ '##dashboard.submissions.incomplete.bulkDelete.column.description##',
+ 'dashboard.submissions.incomplete.bulkDelete.confirm':
+ '##dashboard.submissions.incomplete.bulkDelete.confirm##',
'admin.version': 'Version',
'article.article': 'Article',
'article.metadata': 'Metadata',
diff --git a/src/components/Button/Button.stories.js b/src/components/Button/Button.stories.js
index fe8e881b1..675224b8b 100644
--- a/src/components/Button/Button.stories.js
+++ b/src/components/Button/Button.stories.js
@@ -50,6 +50,14 @@ export const Warnable = {
},
};
+export const WarnableDisabled = {
+ args: {
+ slot: 'Delete',
+ isWarnable: true,
+ isDisabled: true,
+ },
+};
+
export const IsCompact = {
args: {
slot: 'Delete',
diff --git a/src/components/Button/Button.vue b/src/components/Button/Button.vue
index d10c3e25d..a6f860f81 100644
--- a/src/components/Button/Button.vue
+++ b/src/components/Button/Button.vue
@@ -12,7 +12,7 @@
@focus="emit('focus')"
@blur="emit('blur')"
>
-
+
@@ -82,7 +82,7 @@ const styles = computed(() => ({
'text-primary border-light hover:text-hover disabled:text-disabled ':
isSecondary.value,
// Warnable
- 'text-negative border-light': props.isWarnable,
+ 'text-negative border-light disabled:text-disabled': props.isWarnable,
// Warnable & Secondary have white background when its not link
'bg-secondary': (isSecondary.value || props.isWarnable) && !props.isLink,
// Active
diff --git a/src/components/DropdownActions/DropdownActions.vue b/src/components/DropdownActions/DropdownActions.vue
index 923fccb0a..f25566f33 100644
--- a/src/components/DropdownActions/DropdownActions.vue
+++ b/src/components/DropdownActions/DropdownActions.vue
@@ -46,6 +46,7 @@
v-for="(action, i) in actions"
:key="i"
v-slot="{active, close}"
+ :disabled="action.disabled || false"
>
{
@@ -82,7 +84,16 @@ import ButtonIcon from '@/components/ButtonIcon/ButtonIcon.vue';
import Icon from '@/components/Icon/Icon.vue';
defineProps({
- /** An array of action objects. Each object should contain `label` (string), `url` (string) to navigate to if the action involves a link, or `name` (string) to perform the action when clicked, an optional `icon` (string) and `isWarnable` (boolean) if the button needs the "warning" button styling from `` component. */
+ /**
+ * An array of action objects.
+ * Each object should contain
+ * `label` (string),
+ * `url` (string) to navigate to if the action involves a link, or
+ * `name` (string) to perform the action when clicked, an optional
+ * `icon` (string) and
+ * `isWarnable` (boolean) if the button needs the "warning" button styling from `` component.
+ * `disabled` (boolean) when the item is not available
+ * */
actions: {
type: Array,
required: true,
diff --git a/src/components/Table/TableCellSelect.vue b/src/components/Table/TableCellSelect.vue
index bd9fe4350..d360a00b8 100644
--- a/src/components/Table/TableCellSelect.vue
+++ b/src/components/Table/TableCellSelect.vue
@@ -1,6 +1,7 @@
-
+
{{ t('common.filter') }}
-
-
+
+
+
+
+
diff --git a/src/pages/dashboard/components/DashboardBulkDeleteButton.vue b/src/pages/dashboard/components/DashboardBulkDeleteButton.vue
index 042ec2334..7f9f6ed01 100644
--- a/src/pages/dashboard/components/DashboardBulkDeleteButton.vue
+++ b/src/pages/dashboard/components/DashboardBulkDeleteButton.vue
@@ -1,19 +1,11 @@
- store.bulkDeleteSelectedItems.length
- ? store.bulkDeleteActionDelete()
- : store.bulkDeleteToggleEnabled()
- "
+ v-if="store.bulkDeleteSelectionEnabled"
+ :is-disabled="store.bulkDeleteSelectedItems.length === 0"
+ :is-warnable="true"
+ @click="() => store.bulkDeleteActionDelete()"
>
- {{ t('admin.submissions.incomplete.bulkDelete.button') }}
+ {{ t('dashboard.submissions.incomplete.bulkDelete.button') }}
diff --git a/src/pages/dashboard/components/DashboardTable/DashboardTable.vue b/src/pages/dashboard/components/DashboardTable/DashboardTable.vue
index e69135738..8aa8417d2 100644
--- a/src/pages/dashboard/components/DashboardTable/DashboardTable.vue
+++ b/src/pages/dashboard/components/DashboardTable/DashboardTable.vue
@@ -4,9 +4,11 @@
@sort="(columnId) => $emit('sortColumn', columnId)"
>
-
+
- {{ t('admin.submissions.incomplete.bulkDelete.column.description') }}
+ {{
+ t('dashboard.submissions.incomplete.bulkDelete.column.description')
+ }}
-
+
{
- if (
- dashboardPage === DashboardPageTypes.EDITORIAL_DASHBOARD &&
- hasCurrentUserAtLeastOneRole([pkp.const.ROLE_ID_SITE_ADMIN])
- ) {
- return true;
- } else if (dashboardPage === DashboardPageTypes.MY_SUBMISSIONS) {
- return true;
- }
+ /**
+ * Enabling the checkboxes to select submissions to be deleted
+ * */
+ const bulkDeleteSelectionEnabled = ref(false);
+ function bulkDeleteSelectionEnable() {
+ bulkDeleteSelectionEnabled.value = true;
+ }
- return false;
- });
+ function bulkDeleteSelectionDisable() {
+ bulkDeleteSelectionEnabled.value = false;
+ }
- const bulkDeleteEnabled = ref(false);
+ /**
+ * Managing the list of selected items
+ * */
const bulkDeleteSelectedItems = ref([]);
function bulkDeleteSelectItem(submissionId) {
if (!bulkDeleteSelectedItems.value.includes(submissionId)) {
@@ -42,10 +42,9 @@ export function useDashboardBulkDelete({
);
}
- function bulkDeleteToggleEnabled() {
- bulkDeleteEnabled.value = !bulkDeleteEnabled.value;
- }
-
+ /**
+ * Permissions
+ * */
const {
hasCurrentUserAtLeastOneAssignedRoleInAnyStage,
hasCurrentUserAtLeastOneRole,
@@ -55,7 +54,10 @@ export function useDashboardBulkDelete({
// incomplete submission can be deleted by author of the submission or admin
if (submission.submissionProgress)
if (
- hasCurrentUserAtLeastOneRole([pkp.const.ROLE_ID_SITE_ADMIN]) ||
+ hasCurrentUserAtLeastOneRole([
+ pkp.const.ROLE_ID_SITE_ADMIN,
+ pkp.const.ROLE_ID_MANAGER,
+ ]) ||
hasCurrentUserAtLeastOneAssignedRoleInAnyStage(submission, [
pkp.const.ROLE_ID_AUTHOR,
])
@@ -66,6 +68,21 @@ export function useDashboardBulkDelete({
return false;
}
+ const bulkDeleteIsAvailableForUser = computed(() => {
+ if (
+ dashboardPage === DashboardPageTypes.EDITORIAL_DASHBOARD &&
+ hasCurrentUserAtLeastOneRole([
+ pkp.const.ROLE_ID_SITE_ADMIN,
+ pkp.const.ROLE_ID_MANAGER,
+ ])
+ ) {
+ return true;
+ } else if (dashboardPage === DashboardPageTypes.MY_SUBMISSIONS) {
+ return true;
+ }
+ return false;
+ });
+
const bulkDeleteSubmissionIdsCanBeDeleted = computed(() => {
const submissionIds = [];
if (submissions.value && submissions.value?.length) {
@@ -75,7 +92,6 @@ export function useDashboardBulkDelete({
}
});
}
-
return submissionIds;
});
@@ -94,14 +110,14 @@ export function useDashboardBulkDelete({
function bulkDeleteResetSelection() {
bulkDeleteSelectedItems.value = [];
- bulkDeleteEnabled.value = false;
+ bulkDeleteSelectionEnabled.value = false;
}
function bulkDeleteActionDelete() {
const {openDialog} = useModal();
openDialog({
- title: t('admin.submissions.incomplete.bulkDelete.confirm'),
- message: t('admin.submissions.incomplete.bulkDelete.body'),
+ title: t('dashboard.submissions.incomplete.bulkDelete.confirm'),
+ message: t('dashboard.submissions.incomplete.bulkDelete.body'),
actions: [
{
label: t('common.confirm'),
@@ -115,6 +131,7 @@ export function useDashboardBulkDelete({
label: t('common.cancel'),
isWarnable: true,
callback: (close) => {
+ bulkDeleteResetSelection();
close();
},
},
@@ -125,10 +142,10 @@ export function useDashboardBulkDelete({
}
return {
- bulkDeleteDisplayDeleteButton,
- bulkDeleteEnabled,
- bulkDeleteToggleEnabled,
-
+ bulkDeleteIsAvailableForUser,
+ bulkDeleteSelectionEnabled,
+ bulkDeleteSelectionEnable,
+ bulkDeleteSelectionDisable,
bulkDeleteSelectedItems,
bulkDeleteSelectItem,
bulkDeleteDeselectItem,
diff --git a/src/pages/dashboard/dashboardPageStore.js b/src/pages/dashboard/dashboardPageStore.js
index 9107e7166..858874bee 100644
--- a/src/pages/dashboard/dashboardPageStore.js
+++ b/src/pages/dashboard/dashboardPageStore.js
@@ -238,10 +238,11 @@ export const useDashboardPageStore = defineComponentStore(
* Bulk delete
*/
const {
- bulkDeleteDisplayDeleteButton,
+ bulkDeleteIsAvailableForUser,
- bulkDeleteEnabled,
- bulkDeleteToggleEnabled,
+ bulkDeleteSelectionEnabled,
+ bulkDeleteSelectionEnable,
+ bulkDeleteSelectionDisable,
bulkDeleteSelectedItems,
bulkDeleteSelectItem,
@@ -436,10 +437,11 @@ export const useDashboardPageStore = defineComponentStore(
setCurrentPage,
// Bulk delete
- bulkDeleteDisplayDeleteButton,
+ bulkDeleteIsAvailableForUser,
- bulkDeleteEnabled,
- bulkDeleteToggleEnabled,
+ bulkDeleteSelectionEnabled,
+ bulkDeleteSelectionEnable,
+ bulkDeleteSelectionDisable,
bulkDeleteSelectedItems,
bulkDeleteSelectItem,