2023-06-27 16:23:18 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
// import { Head, Link, useForm, usePage } from '@inertiajs/inertia-vue3';
|
|
|
|
import { Head, usePage } from '@inertiajs/vue3';
|
|
|
|
import { ComputedRef } from 'vue';
|
2023-07-17 17:13:30 +00:00
|
|
|
import { mdiSquareEditOutline, mdiTrashCan, mdiAlertBoxOutline, mdiLockOpen } from '@mdi/js';
|
2023-06-27 16:23:18 +00:00
|
|
|
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;
|
|
|
|
});
|
|
|
|
|
2023-11-30 12:40:32 +00:00
|
|
|
const validStates = ['inprogress', 'rejected_editor'];
|
2023-06-27 16:23:18 +00:00
|
|
|
|
2023-11-30 12:40:32 +00:00
|
|
|
const getRowClass = (dataset) => {
|
|
|
|
// (props.options ? 'select' : props.type)
|
|
|
|
let rowclass = '';
|
|
|
|
if (dataset.server_state == 'inprogress') {
|
2024-01-04 15:40:05 +00:00
|
|
|
rowclass = 'bg-inprogress';
|
2023-11-30 12:40:32 +00:00
|
|
|
} else if (dataset.server_state == 'released') {
|
2024-01-04 15:40:05 +00:00
|
|
|
rowclass = 'bg-released';
|
|
|
|
} else if (dataset.server_state == 'editor_accepted' || dataset.server_state == 'rejected_reviewer') {
|
|
|
|
rowclass = 'bg-editor-accepted';
|
2023-11-30 12:40:32 +00:00
|
|
|
} else if (dataset.server_state == 'approved') {
|
2024-01-04 15:40:05 +00:00
|
|
|
rowclass = 'bg-approved';
|
|
|
|
} else if (dataset.server_state == 'reviewed') {
|
|
|
|
rowclass = 'bg-reviewed';
|
|
|
|
} else if (dataset.server_state == 'rejected_editor') {
|
|
|
|
rowclass = 'bg-rejected-editor';
|
2023-11-30 12:40:32 +00:00
|
|
|
} else {
|
|
|
|
rowclass = '';
|
|
|
|
}
|
|
|
|
return rowclass;
|
|
|
|
};
|
2023-06-27 16:23:18 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<LayoutAuthenticated>
|
2023-09-05 16:18:42 +00:00
|
|
|
|
2023-11-30 12:40:32 +00:00
|
|
|
<Head title="Dataset List" />
|
2023-06-27 16:23:18 +00:00
|
|
|
<SectionMain>
|
2023-07-17 17:13:30 +00:00
|
|
|
<!-- <FormValidationErrors v-bind:errors="errors" /> -->
|
2023-06-27 16:23:18 +00:00
|
|
|
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
|
|
|
|
{{ flash.message }}
|
|
|
|
</NotificationBar>
|
2023-07-17 17:13:30 +00:00
|
|
|
<NotificationBar v-if="flash.warning" color="warning" :icon="mdiAlertBoxOutline">
|
|
|
|
{{ flash.warning }}
|
|
|
|
</NotificationBar>
|
2023-06-27 16:23:18 +00:00
|
|
|
|
|
|
|
<!-- table -->
|
|
|
|
<CardBox class="mb-6" has-table>
|
2024-01-04 15:40:05 +00:00
|
|
|
<table class="">
|
2023-06-27 16:23:18 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-12-01 09:44:19 +00:00
|
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider">
|
2023-06-27 16:23:18 +00:00
|
|
|
<!-- <Sort label="Dataset Title" attribute="title" :search="form.search" /> -->
|
|
|
|
Dataset Title
|
2023-12-01 09:44:19 +00:00
|
|
|
</th>
|
|
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider">
|
2023-06-27 16:23:18 +00:00
|
|
|
<!-- <Sort label="Email" attribute="email" :search="form.search" /> -->
|
2023-12-01 09:44:19 +00:00
|
|
|
Server State
|
|
|
|
</th>
|
|
|
|
<th scope="col" class="py-3 text-left text-xs font-medium uppercase tracking-wider">
|
|
|
|
Date of last modification
|
|
|
|
</th>
|
|
|
|
<th scope="col" class="relative px-6 py-3" v-if="can.edit || can.delete">
|
|
|
|
<span class="sr-only">Actions</span>
|
2023-06-27 16:23:18 +00:00
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
2023-12-01 09:44:19 +00:00
|
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
2023-11-30 12:40:32 +00:00
|
|
|
<tr v-for="dataset in props.datasets.data" :key="dataset.id" :class="getRowClass(dataset)">
|
2023-12-01 09:44:19 +00:00
|
|
|
<td data-label="Login" class="py-4 whitespace-nowrap text-gray-700 dark:text-white">
|
2023-12-15 16:17:33 +00:00
|
|
|
<!-- <Link v-bind:href="stardust.route('settings.user.show', [user.id])"
|
2023-06-27 16:23:18 +00:00
|
|
|
class="no-underline hover:underline text-cyan-600 dark:text-cyan-400">
|
|
|
|
{{ user.login }}
|
|
|
|
</Link> -->
|
|
|
|
<!-- {{ user.id }} -->
|
|
|
|
{{ dataset.main_title }}
|
2023-09-05 16:18:42 +00:00
|
|
|
</td>
|
2023-12-01 09:44:19 +00:00
|
|
|
<td class="py-4 whitespace-nowrap text-gray-700 dark:text-white">
|
2023-06-27 16:23:18 +00:00
|
|
|
{{ dataset.server_state }}
|
2023-09-05 16:18:42 +00:00
|
|
|
</td>
|
|
|
|
|
2023-12-01 09:44:19 +00:00
|
|
|
<td data-label="modified" class="py-4 whitespace-nowrap text-gray-700 dark:text-white">
|
|
|
|
<div class="text-sm" :title="dataset.server_date_modified">
|
2023-11-30 12:40:32 +00:00
|
|
|
{{ dataset.server_date_modified }}
|
2023-12-01 09:44:19 +00:00
|
|
|
</div>
|
2023-06-27 16:23:18 +00:00
|
|
|
</td>
|
2023-12-01 09:44:19 +00:00
|
|
|
<td class="py-4 whitespace-nowrap text-right text-sm font-medium text-gray-700 dark:text-white">
|
2023-11-30 12:40:32 +00:00
|
|
|
<BaseButtons v-if="validStates.includes(dataset.server_state)"
|
|
|
|
type="justify-start lg:justify-end" no-wrap>
|
2023-09-05 16:18:42 +00:00
|
|
|
<!-- release created dataset -->
|
|
|
|
<BaseButton v-if="can.edit"
|
|
|
|
:route-name="stardust.route('dataset.release', [dataset.id])" color="info"
|
|
|
|
:icon="mdiLockOpen" :label="'Release'" small />
|
2023-11-30 12:40:32 +00:00
|
|
|
<BaseButton v-if="can.edit" :route-name="stardust.route('dataset.edit', [dataset.id])"
|
2023-09-05 16:18:42 +00:00
|
|
|
color="info" :icon="mdiSquareEditOutline" :label="'Edit'" small />
|
|
|
|
<BaseButton v-if="can.delete" color="danger"
|
|
|
|
:route-name="stardust.route('dataset.delete', [dataset.id])" :icon="mdiTrashCan"
|
|
|
|
small />
|
2023-06-27 16:23:18 +00:00
|
|
|
</BaseButtons>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div class="py-4">
|
|
|
|
<Pagination v-bind:data="datasets.meta" />
|
|
|
|
<!-- <ul>
|
|
|
|
<li>
|
|
|
|
<a href="{{ users.page == 1 ? '#' : '?page=' + (users.page - 1) }}">Previous</a>
|
|
|
|
</li>
|
|
|
|
@each(page in ???)
|
|
|
|
<li>
|
|
|
|
<a href="?page={{ page }}">{{ page }}</a>
|
|
|
|
</li>
|
|
|
|
@endeach
|
|
|
|
<li>
|
|
|
|
<a href="{{ users.lastPage == users.page ? '#' : '?page=' + (users.page + 1) }}">Next</a>
|
|
|
|
</li>
|
|
|
|
</ul> -->
|
|
|
|
</div>
|
|
|
|
</CardBox>
|
|
|
|
</SectionMain>
|
|
|
|
</LayoutAuthenticated>
|
|
|
|
</template>
|
2023-11-30 12:40:32 +00:00
|
|
|
|
2024-01-04 15:40:05 +00:00
|
|
|
<style scoped lang="css">
|
2023-12-01 09:44:19 +00:00
|
|
|
.pure-table tr.released {
|
|
|
|
/* background-color: greenyellow; */
|
|
|
|
background-color: rgb(52 211 153);
|
2023-11-30 12:40:32 +00:00
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
2023-12-01 09:44:19 +00:00
|
|
|
.pure-table tr.inprogress {
|
|
|
|
padding: 0.8em;
|
|
|
|
/* bg-teal-300 */
|
|
|
|
background-color: rgb(94 234 212);
|
2023-11-30 12:40:32 +00:00
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-table tr.editor_accepted {
|
2023-12-01 09:44:19 +00:00
|
|
|
/* background-color: lightblue; */
|
|
|
|
background-color: rgb(125 211 252);
|
2023-11-30 12:40:32 +00:00
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-table tr.rejected_reviewer {
|
|
|
|
padding: 0.8em;
|
|
|
|
background-color: orange;
|
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-table tr.rejected_editor {
|
|
|
|
/* padding: 0.8em; */
|
|
|
|
background-color: orange;
|
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-table tr.reviewed {
|
|
|
|
/* padding: 0.8em; */
|
|
|
|
background-color: yellow;
|
|
|
|
color: gray;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-table tr.approved {
|
|
|
|
/* padding: 0.8em; */
|
|
|
|
background-color: rgb(86, 86, 241);
|
|
|
|
color: whitesmoke;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-01-04 15:40:05 +00:00
|
|
|
|
|
|
|
</style>
|