tethys.backend/config/inertia.ts
Arno Kaimbacher 9368a0dd8d
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 40s
Squashed commit of the following:
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.
2026-06-09 09:35:15 +02:00

76 lines
2.1 KiB
TypeScript

import { defineConfig } from '@adonisjs/inertia';
import type { HttpContext } from '@adonisjs/core/http';
import type { InferSharedProps } from '@adonisjs/inertia/types'
const inertiaConfig = defineConfig({
/**
* Path to the Edge view that will be used as the root view for Inertia responses
*/
rootView: 'app',
/**
* Data that should be shared with all rendered pages
*/
sharedData: {
//This will be available in all views
appName: 'Tethys Cloud',
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
user_id: (ctx) => {
return ctx.session?.flashMessages.get('user_id');
},
flash: (ctx) => {
return {
message: ctx.session?.flashMessages.get('message'),
warning: ctx.session?.flashMessages.get('warning'),
error: ctx.session?.flashMessages.get('error'),
};
},
// params: ({ params }) => params,
authUser: async ({ auth }: HttpContext) => {
if (!auth?.user) return null
await auth.user.load('roles') // sicherstellen, dass geladen ist
return {
id: auth.user.id,
login: auth.user.login,
email: auth.user.email,
first_name: auth.user.first_name,
last_name: auth.user.last_name,
roles: auth.user.roles.map((role) => role.name),
}
},
},
/**
* Options for the server-side rendering
*/
ssr: {
enabled: false,
entrypoint: 'inertia/app/ssr.ts',
},
});
export default inertiaConfig
declare module '@adonisjs/inertia/types' {
export interface SharedProps extends InferSharedProps<typeof inertiaConfig> { }
}
// import { InertiaConfig } from '@ioc:EidelLev/Inertia';
// /*
// |--------------------------------------------------------------------------
// | Inertia-AdonisJS config
// |--------------------------------------------------------------------------
// |
// */
// export const inertia: InertiaConfig = {
// view: 'app',
// // ssr: {
// // enabled: false,
// // },
// };