All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 40s
commit 579f0878e5240dc17db69be1e0b0c0f5af7ef9fe
Author: Arno Kaimbacher <arno.kaimbacher@geosphere.at>
Date: Tue Jun 9 09:25:44 2026 +0200
feat: Refactor error handling in Dataset Edit form and improve validation messages
- Updated error handling in the Dataset Edit form to use a centralized formatError function for displaying validation messages.
- Enhanced user feedback by ensuring that error messages are displayed consistently across various fields.
- Modified the validation rule for arrayContainsTypes to provide clearer error messages for missing main and translated titles/abstracts.
- Introduced a new ValidationService to manage manual construction of validation errors.
- Updated Vite configuration to streamline asset loading and improve performance.
- Adjusted Inertia setup to utilize dynamic imports for page-specific assets.
- Cleaned up unnecessary comments and code in various files for better readability.
commit 5efddc2a58c0e164fef585cc7344c06155dbc2c1
Author: Arno Kaimbacher <arno.kaimbacher@geosphere.at>
Date: Mon Jan 12 17:02:47 2026 +0100
feat: add dataset change detection and form submission composables
- Implemented `useDatasetChangeDetection` for tracking unsaved changes in dataset forms, including comparisons for licenses, basic properties, files, coverage, and more.
- Added `useDatasetFormSubmission` for handling dataset form submissions with validation, success/error handling, and auto-save functionality.
228 lines
No EOL
11 KiB
Vue
228 lines
No EOL
11 KiB
Vue
<script lang="ts" setup>
|
|
import { Head, usePage } from '@inertiajs/vue3';
|
|
import {
|
|
mdiLicense,
|
|
mdiCheckCircle,
|
|
mdiCloseCircle,
|
|
mdiAlertBoxOutline,
|
|
mdiFileDocumentOutline,
|
|
mdiCheckCircleOutline,
|
|
mdiPauseCircleOutline,
|
|
} from '@mdi/js';
|
|
import { computed, ComputedRef } from 'vue';
|
|
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
|
|
import SectionMain from '@/Components/SectionMain.vue';
|
|
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
|
|
import BaseButton from '@/Components/BaseButton.vue';
|
|
import BaseButtons from '@/Components/BaseButtons.vue';
|
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
|
import CardBox from '@/Components/CardBox.vue';
|
|
import NotificationBar from '@/Components/NotificationBar.vue';
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
|
|
|
interface License {
|
|
id: number;
|
|
name: string;
|
|
sort_order: number;
|
|
active: boolean;
|
|
}
|
|
|
|
const props = defineProps({
|
|
licenses: {
|
|
type: Array<License>,
|
|
default: () => [],
|
|
},
|
|
can: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
});
|
|
|
|
const flash: ComputedRef<any> = computed(() => usePage().props.flash);
|
|
|
|
const licenseCount = computed(() => props.licenses.length);
|
|
const activeCount = computed(() => props.licenses.filter((l) => l.active).length);
|
|
const inactiveCount = computed(() => licenseCount.value - activeCount.value);
|
|
|
|
const getLicenseColor = (index: number) => {
|
|
const colors = [
|
|
'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-300',
|
|
'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300',
|
|
'bg-violet-100 text-violet-800 dark:bg-violet-900 dark:text-violet-300',
|
|
'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300',
|
|
'bg-rose-100 text-rose-800 dark:bg-rose-900 dark:text-rose-300',
|
|
'bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-300',
|
|
];
|
|
return colors[index % colors.length];
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<LayoutAuthenticated>
|
|
<Head title="Licenses" />
|
|
<SectionMain>
|
|
<SectionTitleLineWithButton :icon="mdiLicense" title="Licenses" main>
|
|
<span class="text-sm text-gray-500 dark:text-gray-400 font-medium">
|
|
{{ licenseCount }} {{ licenseCount === 1 ? 'license' : 'licenses' }}
|
|
</span>
|
|
</SectionTitleLineWithButton>
|
|
|
|
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
|
|
{{ flash.message }}
|
|
</NotificationBar>
|
|
|
|
<!-- Summary stats -->
|
|
<div class="reveal grid grid-cols-1 sm:grid-cols-3 gap-4 mb-6">
|
|
<div class="flex items-center gap-4 rounded-xl border-l-4 border-blue-500 bg-white dark:bg-slate-900/40 shadow-sm p-4">
|
|
<div class="flex items-center justify-center w-11 h-11 rounded-lg bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-300">
|
|
<BaseIcon :path="mdiFileDocumentOutline" size="22" />
|
|
</div>
|
|
<div>
|
|
<p class="text-2xl font-bold text-gray-900 dark:text-white leading-none">{{ licenseCount }}</p>
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Total</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-4 rounded-xl border-l-4 border-emerald-500 bg-white dark:bg-slate-900/40 shadow-sm p-4">
|
|
<div class="flex items-center justify-center w-11 h-11 rounded-lg bg-emerald-100 dark:bg-emerald-900/40 text-emerald-600 dark:text-emerald-300">
|
|
<BaseIcon :path="mdiCheckCircleOutline" size="22" />
|
|
</div>
|
|
<div>
|
|
<p class="text-2xl font-bold text-gray-900 dark:text-white leading-none">{{ activeCount }}</p>
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Active</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center gap-4 rounded-xl border-l-4 border-gray-400 bg-white dark:bg-slate-900/40 shadow-sm p-4">
|
|
<div class="flex items-center justify-center w-11 h-11 rounded-lg bg-gray-100 dark:bg-slate-700 text-gray-600 dark:text-gray-300">
|
|
<BaseIcon :path="mdiPauseCircleOutline" size="22" />
|
|
</div>
|
|
<div>
|
|
<p class="text-2xl font-bold text-gray-900 dark:text-white leading-none">{{ inactiveCount }}</p>
|
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">Inactive</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<CardBox class="reveal reveal-1 mb-6" has-table>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Sort Order</th>
|
|
<th>Status</th>
|
|
<th v-if="can.edit">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr v-if="licenses.length === 0">
|
|
<td :colspan="can.edit ? 4 : 3" class="text-center py-14">
|
|
<div class="flex flex-col items-center justify-center text-gray-500 dark:text-gray-400">
|
|
<div class="flex items-center justify-center w-16 h-16 rounded-full bg-gray-100 dark:bg-slate-800 mb-4">
|
|
<BaseIcon :path="mdiLicense" size="32" class="text-gray-400" />
|
|
</div>
|
|
<p class="text-lg font-medium mb-1">No licenses found</p>
|
|
<p class="text-sm">Licenses will appear here once configured</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr
|
|
v-for="(license, index) in licenses"
|
|
:key="license.id"
|
|
class="hover:bg-gray-50 dark:hover:bg-slate-800 transition-colors"
|
|
>
|
|
<td data-label="Name">
|
|
<span
|
|
class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium transition-all hover:shadow-md"
|
|
:class="getLicenseColor(index)"
|
|
>
|
|
{{ license.name }}
|
|
</span>
|
|
</td>
|
|
<td data-label="Sort Order">
|
|
<span
|
|
class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-slate-700 text-gray-700 dark:text-gray-300 font-semibold text-sm"
|
|
>
|
|
{{ license.sort_order }}
|
|
</span>
|
|
</td>
|
|
<td data-label="Status">
|
|
<span
|
|
v-if="license.active"
|
|
class="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"
|
|
>
|
|
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
|
<path
|
|
fill-rule="evenodd"
|
|
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
|
|
clip-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
Active
|
|
</span>
|
|
<span
|
|
v-else
|
|
class="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300"
|
|
>
|
|
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
|
<path
|
|
fill-rule="evenodd"
|
|
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
|
|
clip-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
Inactive
|
|
</span>
|
|
</td>
|
|
<td v-if="can.edit" class="before:hidden lg:w-1 whitespace-nowrap">
|
|
<BaseButtons type="justify-start lg:justify-end" no-wrap>
|
|
<BaseButton
|
|
v-if="license.active"
|
|
:route-name="stardust.route('settings.license.down', [license.id])"
|
|
color="warning"
|
|
:icon="mdiCloseCircle"
|
|
label="Deactivate"
|
|
small
|
|
/>
|
|
<BaseButton
|
|
v-else
|
|
:route-name="stardust.route('settings.license.up', [license.id])"
|
|
color="success"
|
|
:icon="mdiCheckCircle"
|
|
label="Activate"
|
|
small
|
|
/>
|
|
</BaseButtons>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</CardBox>
|
|
</SectionMain>
|
|
</LayoutAuthenticated>
|
|
</template>
|
|
|
|
<style scoped>
|
|
@keyframes fade-up {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(12px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
.reveal {
|
|
animation: fade-up 0.5s ease-out both;
|
|
}
|
|
.reveal-1 {
|
|
animation-delay: 0.1s;
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.reveal {
|
|
animation: none;
|
|
}
|
|
}
|
|
</style> |