- renamings to the new naming convetion for adonisjs version 6
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s

- npm updates
This commit is contained in:
Kaimbacher 2024-04-29 11:25:50 +02:00
parent bee76f8d5b
commit a29865b781
53 changed files with 701 additions and 731 deletions

View file

@ -5,7 +5,7 @@ import { Link, usePage } from '@inertiajs/vue3';
import { StyleService } from '@/Stores/style.service';
import { mdiMinus, mdiPlus } from '@mdi/js';
import { getButtonColor } from '@/colors.js';
import { getButtonColor } from '@/colors';
import BaseIcon from '@/Components/BaseIcon.vue';
// import AsideMenuList from '@/Components/AsideMenuList.vue';
import { stardust } from '@eidellev/adonis-stardust/client';

View file

@ -2,7 +2,7 @@
import { computed } from 'vue';
import { Link } from '@inertiajs/vue3';
// import { Link } from '@inertiajs/inertia-vue3';
import { getButtonColor } from '@/colors.js';
import { getButtonColor } from '@/colors';
import BaseIcon from '@/Components/BaseIcon.vue';
const props = defineProps({

View file

@ -1,6 +1,6 @@
<script setup>
import { computed } from 'vue';
import { containerMaxW } from '@/config.js';
import { containerMaxW } from '@/config';
import BaseLevel from '@/Components/BaseLevel.vue';
import JustboilLogo from '@/Components/JustboilLogo.vue';

View file

@ -1,6 +1,7 @@
<script setup>
import { computed, useSlots } from 'vue';
defineProps({
label: {
type: String,

View file

@ -1,5 +1,5 @@
<script setup>
import { colorsText, colorsBgLight } from '@/colors.js';
import { colorsText, colorsBgLight } from '@/colors';
import BaseIcon from '@/Components/BaseIcon.vue';
defineProps({

View file

@ -2,10 +2,10 @@
import { usePage, router } from '@inertiajs/vue3';
// import { usePage } from '@inertiajs/inertia-vue3';
// import { Inertia } from '@inertiajs/inertia';
import { ComputedRef } from 'vue';
import type { ComputedRef } from 'vue';
import { computed, ref } from 'vue';
import { containerMaxW } from '@/config.js';
import { containerMaxW } from '@/config';
import { StyleService } from '@/Stores/style.service';
import { LayoutService } from '@/Stores/layout';
import {

View file

@ -1,7 +1,7 @@
<script setup>
import { ref, computed, useSlots } from 'vue';
import { mdiClose } from '@mdi/js';
import { colorsBgLight, colorsOutline } from '@/colors.js';
import { colorsBgLight, colorsOutline } from '@/colors';
import BaseLevel from '@/Components/BaseLevel.vue';
import BaseIcon from '@/Components/BaseIcon.vue';
import BaseButton from '@/Components/BaseButton.vue';

View file

@ -1,5 +1,5 @@
<script setup>
import { colorsBgLight } from '@/colors.js';
import { colorsBgLight } from '@/colors';
defineProps({
color: {

View file

@ -1,6 +1,6 @@
<script setup>
import { computed } from 'vue';
import { colorsBgLight, colorsOutline } from '@/colors.js';
import { colorsBgLight, colorsOutline } from '@/colors';
import BaseIcon from '@/Components/BaseIcon.vue';
const props = defineProps({

View file

@ -1,5 +1,5 @@
<script setup>
import { containerMaxW } from '@/config.js';
import { containerMaxW } from '@/config';
</script>
<template>

View file

@ -19,7 +19,10 @@ export interface Role {
created_at: DateTime;
updated_at: DateTime;
}
export interface License {
id: any;
// Add other properties as needed
}
export interface Dataset {
[key: string]:
| string
@ -33,9 +36,10 @@ export interface Dataset {
| Coverage
| Array<DatasetReference>
| Array<File>
| (Array<number> | Array<Object>);
| (Array<number> | Array<License>)
| Array<TethysFile>;
language: string;
licenses: Array<number> | Array<Object>;
licenses: Array<number> | Array<License>;
rights: boolean;
type: string;
creating_corporation: string;

View file

@ -54,7 +54,7 @@ export default {
<script lang="ts">
import { Component, Vue, Prop } from 'vue-facing-decorator';
import type User from 'App/Models/User';
import type User from '#app/Models/User';
import { Link } from '@inertiajs/vue3';
import DefaultLayout from '@/Layouts/Default.vue';
// import { NInput, NButton } from 'naive-ui';

View file

@ -31,13 +31,13 @@ const mainService = MainService()
// const chartData = ref();
const fillChartData = async () => {
await mainService.fetchChartData(2022);
await mainService.fetchChartData("2022");
// chartData.value = chartConfig.sampleChartData();
// chartData.value = mainService.graphData;
};
const chartData = computed(() => mainService.graphData);
onMounted(async () => {
await mainService.fetchChartData(2022);
await mainService.fetchChartData("2022");
});
;
/* Fetch sample data */

View file

@ -28,9 +28,10 @@
<div class="flex flex-col md:flex-row">
<!-- (1) language field -->
<FormField label="Language *" help="required: select dataset main language"
:class="{ 'text-red-400': errors.language }" class="w-full flex-1">
<FormControl required v-model="form.language" :type="'select'" placeholder="[Enter Language]"
:errors="form.errors.language" :options="{ de: 'de', en: 'en' }">
:class="{ 'text-red-400': form.errors.language }" class="w-full flex-1">
<FormControl required v-model="form.language" :type="'select'"
placeholder="[Enter Language]" :errors="form.errors.language"
:options="{ de: 'de', en: 'en' }">
<div class="text-red-400 text-sm" v-if="form.errors.language">
{{ form.errors.language.join(', ') }}
</div>
@ -49,7 +50,7 @@
<FormField label="Dataset Type *" help="required: dataset type"
:class="{ 'text-red-400': form.errors.type }" class="w-full mx-2 flex-1">
<FormControl required v-model="form.type" :type="'select'" placeholder="-- select type --"
:errors="errors.type" :options="doctypes">
:errors="form.errors.type" :options="doctypes">
<div class="text-red-400 text-sm"
v-if="form.errors.type && Array.isArray(form.errors.type)">
{{ form.errors.type.join(', ') }}
@ -86,8 +87,10 @@
</FormControl>
</FormField>
<FormField label="Main Title Language*" help="required: main title language"
:class="{ 'text-red-400': form.errors['titles.0.language'] }" class="w-full ml-1 flex-1">
<FormControl required v-model="form.titles[0].language" type="text" :is-read-only="true">
:class="{ 'text-red-400': form.errors['titles.0.language'] }"
class="w-full ml-1 flex-1">
<FormControl required v-model="form.titles[0].language" type="text"
:is-read-only="true">
<div class="text-red-400 text-sm"
v-if="form.errors['titles.0.language'] && Array.isArray(form.errors['titles.0.language'])">
{{ form.errors['titles.0.language'].join(', ') }}
@ -157,7 +160,8 @@
:header-icon="mdiPlusCircle" v-on:header-icon-click="addDescription()">
<div class="flex flex-col md:flex-row">
<FormField label="Main Abstract *" help="required: main abstract"
:class="{ 'text-red-400': form.errors['descriptions.0.value'] }" class="w-full mr-1 flex-1">
:class="{ 'text-red-400': form.errors['descriptions.0.value'] }"
class="w-full mr-1 flex-1">
<FormControl required v-model="form.descriptions[0].value" type="textarea"
placeholder="[enter main abstract]">
<div class="text-red-400 text-sm"
@ -172,7 +176,7 @@
<FormControl required v-model="form.descriptions[0].language" type="text"
:is-read-only="true">
<div class="text-red-400 text-sm" v-if="form.errors['descriptions.0.value'] && Array.isArray(form.errors['descriptions.0.language'])
">
">
{{ form.errors['descriptions.0.language'].join(', ') }}
</div>
</FormControl>
@ -211,8 +215,9 @@
</FormControl>
</td>
<td data-label="Description Language">
<FormControl required v-model="form.descriptions[index].language" type="select"
:options="{ de: 'de', en: 'en' }" placeholder="[select title language]">
<FormControl required v-model="form.descriptions[index].language"
type="select" :options="{ de: 'de', en: 'en' }"
placeholder="[select title language]">
<div class="text-red-400 text-sm"
v-if="form.errors[`descriptions.${index}.language`]">
{{ form.errors[`descriptions.${index}.language`].join(', ') }}
@ -223,7 +228,8 @@
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
<BaseButton color="danger" :icon="mdiTrashCan" small
v-if="item.id == undefined" @click.prevent="removeDescription(index)" />
v-if="item.id == undefined"
@click.prevent="removeDescription(index)" />
</BaseButtons>
</td>
</tr>
@ -238,8 +244,8 @@
placeholder="search in person table...." v-on:person="onAddAuthor"></SearchAutocomplete>
<TablePersons :persons="form.authors" v-if="form.authors.length > 0" />
<div class="text-red-400 text-sm" v-if="errors.authors && Array.isArray(errors.authors)">
{{ errors.authors.join(', ') }}
<div class="text-red-400 text-sm" v-if="form.errors.authors && Array.isArray(form.errors.authors)">
{{ form.errors.authors.join(', ') }}
</div>
</CardBox>
@ -261,9 +267,9 @@
<div class="flex flex-col md:flex-row">
<!-- (9) project_id -->
<FormField label="Project.." help="project is optional"
:class="{ 'text-red-400': errors.project_id }" class="w-full mx-2 flex-1">
<FormControl required v-model="form.project_id" :type="'select'" placeholder="[Select Project]"
:errors="form.errors.project_id" :options="projects">
:class="{ 'text-red-400': form.errors.project_id }" class="w-full mx-2 flex-1">
<FormControl required v-model="form.project_id" :type="'select'"
placeholder="[Select Project]" :errors="form.errors.project_id" :options="projects">
<div class="text-red-400 text-sm" v-if="form.errors.project_id">
{{ form.errors.project_id.join(', ') }}
</div>
@ -271,7 +277,7 @@
</FormField>
<!-- (10) embargo_date -->
<FormField label="Embargo Date.." help="embargo date is optional"
:class="{ 'text-red-400': errors.embargo_date }" class="w-full mx-2 flex-1">
:class="{ 'text-red-400': form.errors.embargo_date }" class="w-full mx-2 flex-1">
<FormControl v-model="form.embargo_date" :type="'date'" placeholder="date('y-m-d')"
:errors="form.errors.embargo_date">
<div class="text-red-400 text-sm" v-if="form.errors.embargo_date">
@ -283,8 +289,9 @@
<BaseDivider />
<MapComponent v-if="form.coverage" :mapOptions="mapOptions" :baseMaps="baseMaps" :fitBounds="fitBounds"
:coverage="form.coverage" :mapId="mapId" v-bind-event:onMapInitializedEvent="onMapInitialized">
<MapComponent v-if="form.coverage" :mapOptions="mapOptions" :baseMaps="baseMaps"
:fitBounds="fitBounds" :coverage="form.coverage" :mapId="mapId"
v-bind-event:onMapInitializedEvent="onMapInitialized">
</MapComponent>
<div class="flex flex-col md:flex-row">
<!-- x min and max -->
@ -478,7 +485,7 @@ import { computed, ComputedRef } from 'vue';
// import { ref } from 'vue';
// import { MainService } from '@/Stores/main';
// import FormInput from '@/Components/FormInput.vue'; // @/Components/FormInput.vue'
import { Dataset, Title, Subject, TethysFile } from '@/Dataset';
import { Dataset, Title, Subject, TethysFile, Person, License } from '@/Dataset';
import { stardust } from '@eidellev/adonis-stardust/client';
import FormField from '@/Components/FormField.vue';
@ -513,10 +520,10 @@ import { notify } from '@/notiwind';
import NotificationBar from '@/Components/NotificationBar.vue';
const props = defineProps({
errors: {
type: Object,
default: () => ({}),
},
// errors: {
// type: Object,
// default: () => ({}),
// },
licenses: {
type: Object,
default: () => ({}),
@ -570,6 +577,12 @@ const flash: ComputedRef<any> = computed(() => {
// console.log(test);
return usePage().props.flash;
});
const errors: ComputedRef<any> = computed(() => {
return usePage().props.errors;
});
// const errors: ComputedRef<any> = computed(() => {
// return usePage().props.errors;
// });
// const projects = reactive([]);
// const licenses = reactive([]);
@ -647,9 +660,16 @@ const submit = async (): Promise<void> => {
// await Inertia.post('/app/register', this.form);
// await router.post('/app/register', this.form);
if (form.licenses.every((item) => hasIdAttribute(item))) {
form.licenses = form.licenses.map((obj) => obj.id.toString());
}
let licenses = form.licenses.map((obj) => {
if (hasIdAttribute(obj)) {
return obj.id.toString()
} else {
return obj;
}
});
// const files = form.files.map((obj) => {
// return new File([obj.blob], obj.label, { type: obj.type, lastModified: obj.lastModified });
@ -660,7 +680,7 @@ const submit = async (): Promise<void> => {
if (!obj.id) {
// return MultipartFile for file upload
const options: FilePropertyBag = {
type: obj.type,
type: obj.type,
lastModified: obj.lastModified
};
// let file = new File([obj.blob], `${obj.label}?sortOrder=${obj.sort_order}`, options);
@ -679,9 +699,7 @@ const submit = async (): Promise<void> => {
await form
.transform((data) => ({
...data,
licenses: form.licenses.every((item) => hasIdAttribute(item))
? form.licenses.map((obj) => obj.id.toString())
: form.licenses,
licenses: licenses,
files: fileUploads,
fileInputs: fileInputs,
// files: form.files.map((obj) => {
@ -701,7 +719,7 @@ const submit = async (): Promise<void> => {
.put(route);
};
const hasIdAttribute = (obj: any): obj is { id: any } => {
const hasIdAttribute = (obj: License | number): obj is License => {
return typeof obj === 'object' && 'id' in obj;
};
@ -709,7 +727,7 @@ const addTitle = () => {
let newTitle: Title = { value: '', language: '', type: '' };
form.titles.push(newTitle);
};
const removeTitle = (key) => {
const removeTitle = (key: any) => {
form.titles.splice(key, 1);
};
@ -717,11 +735,11 @@ const addDescription = () => {
let newDescription = { value: '', language: '', type: '' };
form.descriptions.push(newDescription);
};
const removeDescription = (key) => {
const removeDescription = (key: any) => {
form.descriptions.splice(key, 1);
};
const onAddAuthor = (person) => {
const onAddAuthor = (person: Person) => {
if (form.authors.filter((e) => e.id === person.id).length > 0) {
notify({ type: 'warning', title: 'Warning', text: 'person is already defined as author' }, 4000);
} else if (form.contributors.filter((e) => e.id === person.id).length > 0) {
@ -732,7 +750,7 @@ const onAddAuthor = (person) => {
}
};
const onAddContributor = (person) => {
const onAddContributor = (person: Person) => {
if (form.contributors.filter((e) => e.id === person.id).length > 0) {
notify({ type: 'warning', title: 'Warning', text: 'person is already defined as contributor' }, 4000);
} else if (form.authors.filter((e) => e.id === person.id).length > 0) {
@ -757,11 +775,11 @@ const addReference = () => {
form.references.push(newReference);
};
const removeReference = (key) => {
const removeReference = (key: any) => {
form.references.splice(key, 1);
};
const onMapInitialized = (newItem) => {
const onMapInitialized = (newItem: any) => {
console.log(newItem);
};
</script>

View file

@ -1,5 +1,5 @@
import '../css/app.css';
import { createApp, h, App, Plugin } from 'vue';
import { createApp, h } from 'vue';
import { Inertia } from '@inertiajs/inertia';
import { createInertiaApp } from '@inertiajs/vue3';
@ -16,12 +16,12 @@ import { EmitterPlugin } from '@/EmitterDirective';
import { initRoutes } from '@eidellev/adonis-stardust/client/index.js';
initRoutes();
interface SetupOptions {
el: Element;
App: App;
props: Record<string, any>;
plugin: Plugin;
}
// interface SetupOptions {
// el: Element;
// App: App;
// props: Record<string, any>;
// plugin: Plugin;
// }
// import '@fontsource/archivo-black/index.css';
// import '@fontsource/inter/index.css';
@ -58,7 +58,7 @@ createInertiaApp({
// )
// },
setup({ el, App, props, plugin} : SetupOptions) {
setup({ el, App, props, plugin}) {
createApp({ render: () => h(App, props) })
.use(plugin)
.use(pinia)

View file

@ -35,7 +35,7 @@ export const colorsOutline = {
info: [colorsText.info, 'border-blue-500'],
};
export const getButtonColor = (color, isOutlined, hasHover) => {
export const getButtonColor = (color: 'white' | 'contrast' | 'light' | 'success' | 'danger' | 'warning' | 'info' | 'modern', isOutlined: boolean, hasHover: boolean) => {
const colors = {
bg: {
white: 'bg-white text-black',

View file

@ -0,0 +1,18 @@
{
"extends": "@adonisjs/tsconfig/tsconfig.client.json",
"compilerOptions": {
"baseUrl": ".",
"jsx": "preserve",
"module": "ESNext",
"jsxImportSource": "vue",
"allowJs": true,
// "target": "ESNext",
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"paths": {
"@/*": ["./*"],
"~/*": ["../*"]
},
},
"include": ["./**/*.ts", "./**/*.vue"],
}

View file

@ -1,6 +1,6 @@
{
// tsconfig.vue.json
"extends": "@vue/tsconfig/tsconfig.json",
"extends": "@vue/tsconfig/tsconfig.json", // 0.4.0
// "include": ["./resources/js/**/*"],
"include": ["env.d.ts", "./**/*.ts", "./**/*.vue"],
"compilerOptions": {
@ -23,4 +23,4 @@
"~/*": ["../*"]
},
// "files": ["./index.d.ts"]
}
}