tethys.backend/resources/js/app.ts
Arno Kaimbacher f04c1f6327 hotfix: enhance editor dataset management and UI improvements
- Implemented dataset editing functionality for editor roles, including fetching, updating, and categorizing datasets.
- Added routes and controller actions for editing, updating, and categorizing datasets within the editor interface.
- Integrated UI components for managing dataset metadata, subjects, references, and files.
- Enhanced keyword management with features for adding, editing, and deleting keywords, including handling keywords used by multiple datasets.
- Improved reference management with features for adding, editing, and deleting dataset references.
- Added validation for dataset updates using the `updateEditorDatasetValidator`.
- Updated the dataset edit form to include components for managing titles, descriptions, authors, contributors, licenses, coverage, subjects, references, and files.
- Implemented transaction management for dataset updates to ensure data consistency.
- Added a download route for files associated with datasets.
- Improved the UI for displaying and interacting with datasets in the editor index view, including adding edit and categorize buttons.
- Fixed an issue where the file size was not correctly calculated.
- Added a tooltip to the keyword value column in the TableKeywords component to explain the editability of keywords.
- Added a section to display keywords that are marked for deletion.
- Added a section to display references that are marked for deletion.
- Added a restore button to the references to delete section to restore references.
- Updated the SearchCategoryAutocomplete component to support read-only mode.
- Updated the FormControl component to support read-only mode.
- Added icons and styling improvements to various components.
- Added a default value for subjectsToDelete and referencesToDelete in the dataset model.
- Updated the FooterBar component to use the JustboilLogo component.
- Updated the app.ts file to fetch chart data without a year parameter.
- Updated the Login.vue file to invert the logo in dark mode.
- Updated the AccountInfo.vue file to add a Head component.
2025-04-08 14:16:35 +02:00

105 lines
3.4 KiB
TypeScript

import '../css/app.css';
import { createApp, h } from 'vue';
import { Inertia } from '@inertiajs/inertia';
import { Head, Link, createInertiaApp } from '@inertiajs/vue3';
// import DefaultLayout from '@/Layouts/Default.vue';
import { createPinia } from 'pinia';
import { StyleService } from '@/Stores/style.service';
import { LayoutService } from '@/Stores/layout';
import { LocaleStore } from '@/Stores/locale';
import { MainService } from './Stores/main';
import { darkModeKey, styleKey } from '@/config';
import type { DefineComponent } from 'vue';
import { resolvePageComponent } from '@adonisjs/inertia/helpers';
const pinia = createPinia();
// import i18n from './i18n';
import { EmitterPlugin } from '@/EmitterDirective';
import { initRoutes } from '@eidellev/adonis-stardust/client/index.js';
initRoutes();
// import { loadTranslations } from './utils/tethyscloud-l10n';
import asyncPlugin from '@/apps/settings/asyncPlugin';
// const translation = await asyncPlugin.install('settings');
// interface SetupOptions {
// el: Element;
// App: App;
// props: Record<string, any>;
// plugin: Plugin;
// }
// import '@fontsource/archivo-black/index.css';
// import '@fontsource/inter/index.css';
createInertiaApp({
progress: {
// color: '#4B5563',
color: '#22C55E',
showSpinner: true,
},
// Webpack
// resolve: async (name: string) => {
// // Dynamically import the Vue component using import
// const { default: page } = await import(`./Pages/${name}.vue`);
// // const page = require(`./Pages/${name}.vue`).default;
// // if (!page.layout) {
// // page.layout = DefaultLayout;
// // }
// return page;
// },
resolve: (name) => {
return resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob<DefineComponent>('./Pages/**/*.vue'));
},
setup({ el, App, props, plugin }) {
const app = createApp({ render: () => h(App, props) })
.use(plugin)
.use(pinia)
// .use(i18n)
.use(EmitterPlugin);
// .component('inertia-link', Link)
app.component('Head', Head);
app.component('Link', Link);
// Listen for navigation event to handle layout changes
// window.addEventListener('inertia:navigate', () => {
// layoutService.isAsideMobileExpanded = false;
// layoutService.isAsideLgActive = false;
// });
asyncPlugin.install('settings').then(() => {
app.mount(el);
});
},
});
const styleService = StyleService(pinia);
const layoutService = LayoutService(pinia);
const localeService = LocaleStore(pinia);
localeService.initializeLocale();
const mainService = MainService(pinia);
// mainService.setUser(user);
/* App style */
styleService.setStyle(localStorage[styleKey] ?? 'basic');
/* Dark mode */
if ((!localStorage[darkModeKey] && window.matchMedia('(prefers-color-scheme: dark)').matches) || localStorage[darkModeKey] === '1') {
styleService.setDarkMode(true);
}
// mainService.fetch('clients');
// mainService.fetch('history');
mainService.fetchApi('clients');
mainService.fetchApi('authors');
mainService.fetchApi('datasets');
mainService.fetchChartData();
/* Collapse mobile aside menu on route change */
Inertia.on('navigate', () => {
layoutService.isAsideMobileExpanded = false;
layoutService.isAsideLgActive = false;
});