- Added "rejected_to_reviewer" state to the `ServerStates` enum. - Implemented routes and controller actions (`rejectToReviewer`, `rejectToReviewerUpdate`) for editors to reject datasets back to reviewers with a rejection note. - Added UI elements (button) in the editor dataset index and publish views to trigger the "reject to reviewer" action. - Updated the reviewer dataset index view to display datasets in the "rejected_to_reviewer" state and show the editor's rejection note. - Modified the reviewer dataset review page to allow reviewers to view and accept datasets that have been rejected back to them by editors. - Updated the database migration to include the "rejected_to_reviewer" state in the `documents_server_state_check` constraint. - Updated dependencies (pinia, redis).
215 lines
No EOL
10 KiB
Vue
215 lines
No EOL
10 KiB
Vue
<script setup lang="ts">
|
|
import { Head, usePage } from '@inertiajs/vue3';
|
|
import { ComputedRef } from 'vue';
|
|
import { mdiAlertBoxOutline, mdiGlasses, mdiReiterate } from '@mdi/js';
|
|
import { computed } from 'vue';
|
|
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
|
|
import SectionMain from '@/Components/SectionMain.vue';
|
|
import BaseButton from '@/Components/BaseButton.vue';
|
|
import CardBox from '@/Components/CardBox.vue';
|
|
import BaseButtons from '@/Components/BaseButtons.vue';
|
|
import NotificationBar from '@/Components/NotificationBar.vue';
|
|
import Pagination from '@/Components/Admin/Pagination.vue';
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
|
|
|
const props = defineProps({
|
|
datasets: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
filters: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
can: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
// user: {
|
|
// type: Object,
|
|
// default: () => ({}),
|
|
// }
|
|
});
|
|
|
|
const flash: ComputedRef<any> = computed(() => {
|
|
// let test = usePage();
|
|
// console.log(test);
|
|
return usePage().props.flash;
|
|
});
|
|
|
|
|
|
const getRowClass = (dataset) => {
|
|
// (props.options ? 'select' : props.type)
|
|
let rowclass = '';
|
|
if (dataset.server_state == 'approved') {
|
|
rowclass = 'bg-approved';
|
|
} else if (dataset.server_state == 'rejected_reviewer') {
|
|
rowclass = 'bg-rejected-reviewer';
|
|
} else if (dataset.server_state == 'reviewed') {
|
|
rowclass = 'bg-reviewed';
|
|
} else if (dataset.server_state == 'released') {
|
|
rowclass = 'bg-released';
|
|
} else if (dataset.server_state == 'published') {
|
|
rowclass = 'bg-published';
|
|
} else if (dataset.server_state == 'rejected_to_reviewer') {
|
|
rowclass = 'bg-rejected-reviewer';
|
|
} else {
|
|
rowclass = '';
|
|
}
|
|
return rowclass;
|
|
};
|
|
|
|
// New method to format server state
|
|
const formatServerState = (state: string) => {
|
|
if (state === 'inprogress') {
|
|
return 'draft';
|
|
} else if (state === 'released') {
|
|
return 'submitted';
|
|
} else if (state === 'approved') {
|
|
return 'ready for review';
|
|
} else if (state === 'reviewer_accepted') {
|
|
return 'in review';
|
|
}
|
|
return state; // Return the original state for other cases
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<LayoutAuthenticated>
|
|
|
|
<Head title="Dataset List" />
|
|
<SectionMain>
|
|
<!-- <FormValidationErrors v-bind:errors="errors" /> -->
|
|
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
|
|
{{ flash.message }}
|
|
</NotificationBar>
|
|
<NotificationBar v-if="flash.warning" color="warning" :icon="mdiAlertBoxOutline">
|
|
{{ flash.warning }}
|
|
</NotificationBar>
|
|
<NotificationBar v-if="flash.error" color="danger" :icon="mdiAlertBoxOutline">
|
|
{{ flash.error }}
|
|
</NotificationBar>
|
|
|
|
<!-- table -->
|
|
<CardBox class="mb-6" has-table>
|
|
<div v-if="props.datasets.data.length > 0">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider dark:text-white">
|
|
<!-- <Sort label="Dataset Title" attribute="title" :search="form.search" /> -->
|
|
Title
|
|
</th>
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider dark:text-white">
|
|
ID
|
|
</th>
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider dark:text-white">
|
|
<!-- <Sort label="Email" attribute="email" :search="form.search" /> -->
|
|
State
|
|
</th>
|
|
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider">
|
|
Editor
|
|
</th>
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider dark:text-white">
|
|
Remaining Time
|
|
</th>
|
|
<th scope="col" class="relative px-6 py-3 dark:text-white" v-if="can.edit || can.delete">
|
|
<span class="sr-only">Actions</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr v-for="dataset in props.datasets.data" :key="dataset.id" :class="[getRowClass(dataset)]">
|
|
<td data-label="Login"
|
|
class="py-4 whitespace-nowrap text-gray-700">
|
|
<div class="text-sm table-title">{{ dataset.main_title }}</div>
|
|
</td>
|
|
<td class="py-4 whitespace-nowrap text-gray-700">
|
|
<div class="text-sm">{{ dataset.id }}</div>
|
|
</td>
|
|
<td class="py-4 whitespace-nowrap text-gray-700">
|
|
<div class="text-sm">{{ formatServerState(dataset.server_state) }}</div>
|
|
<div v-if="dataset.server_state === 'rejected_to_reviewer' && dataset.reject_editor_note"
|
|
class="inline-block relative ml-2 group">
|
|
<button
|
|
class="w-5 h-5 rounded-full bg-gray-200 text-gray-600 text-xs flex items-center justify-center focus:outline-none hover:bg-gray-300">
|
|
i
|
|
</button>
|
|
<div
|
|
class="absolute left-0 top-full mt-1 w-64 bg-white shadow-lg rounded-md p-3 text-xs text-left z-50 transform scale-0 origin-top-left transition-transform duration-100 group-hover:scale-100">
|
|
<p class="text-gray-700 max-h-40 overflow-y-auto overflow-x-hidden whitespace-normal break-words">
|
|
{{ dataset.reject_editor_note }}
|
|
</p>
|
|
<div class="absolute -top-1 left-1 w-2 h-2 bg-white transform rotate-45">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
|
|
|
|
<td class="py-4 whitespace-nowrap text-gray-700">
|
|
<div class="text-sm">{{ dataset.editor?.login }}</div>
|
|
</td>
|
|
|
|
<td data-label="modified" class="py-4 whitespace-nowrap text-gray-700">
|
|
<div class="text-sm" :title="dataset.remaining_time">
|
|
{{ dataset.remaining_time + ' days' }}
|
|
</div>
|
|
</td>
|
|
<td
|
|
class="py-4 whitespace-nowrap text-right text-sm font-medium text-gray-700">
|
|
<BaseButtons type="justify-start lg:justify-end" no-wrap>
|
|
<BaseButton
|
|
v-if="can.reject && (dataset.server_state == 'approved' || dataset.server_state == 'rejected_to_reviewer')"
|
|
:route-name="stardust.route('reviewer.dataset.review', [dataset.id])"
|
|
color="info" :icon="mdiGlasses" :label="'View'" small />
|
|
|
|
<BaseButton
|
|
v-if="can.reject && (dataset.server_state == 'approved' || dataset.server_state == 'rejected_to_reviewer')"
|
|
:route-name="stardust.route('reviewer.dataset.reject', [dataset.id])"
|
|
color="info" :icon="mdiReiterate" :label="'Reject'" small />
|
|
</BaseButtons>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div v-else>
|
|
<!-- Show warning message if datasets are not defined or empty -->
|
|
<div class="bg-yellow-200 text-yellow-800 rounded-md p-4">
|
|
<p>No datasets defined.</p>
|
|
<!-- You can add more descriptive text here -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- <BaseButton
|
|
v-if="can.edit && (dataset.server_state == 'editor_accepted' || dataset.server_state == 'rejected_reviewer')"
|
|
:route-name="stardust.route('editor.dataset.edit', [dataset.id])" color="info"
|
|
:icon="mdiSquareEditOutline" :label="'Edit'" small /> -->
|
|
<div class="py-4">
|
|
<Pagination v-bind:data="datasets.meta" />
|
|
|
|
</div>
|
|
</CardBox>
|
|
</SectionMain>
|
|
</LayoutAuthenticated>
|
|
</template>
|
|
|
|
<style scoped lang="css">
|
|
.table-title {
|
|
max-width: 200px;
|
|
/* set a maximum width */
|
|
overflow: hidden;
|
|
/* hide overflow */
|
|
text-overflow: ellipsis;
|
|
/* show ellipsis for overflowed text */
|
|
white-space: nowrap;
|
|
/* prevent wrapping */
|
|
}
|
|
|
|
</style> |