- renamings to the new naming convetion for adonisjs version 6
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 58s
- npm updates
This commit is contained in:
parent
bee76f8d5b
commit
a29865b781
53 changed files with 701 additions and 731 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue