- extend edit form for submitter
All checks were successful
CI Pipeline / japa-tests (push) Successful in 52s

- corrected releasUpdate action for submitter
- npm updates
This commit is contained in:
Kaimbacher 2023-07-28 17:08:20 +02:00
parent 4e97e47fbc
commit 5ce4f0b018
7 changed files with 267 additions and 55 deletions

View File

@ -589,7 +589,7 @@ export default class DatasetController {
public async edit({ params, inertia }) {
const datasetQuery = Dataset.query().where('id', params.id);
datasetQuery.preload('titles');
datasetQuery.preload('titles').preload('descriptions').preload('coverage');
const dataset = await datasetQuery.firstOrFail();
// await dataset.loadMany([
@ -669,7 +669,7 @@ export default class DatasetController {
return inertia.render('Submitter/Dataset/Edit', {
dataset,
titletypes: titleTypes,
descriptionTypes,
descriptiontypes: descriptionTypes,
contributorTypes,
nameTypes,
languages,

73
app/Models/Coverage.ts Normal file
View File

@ -0,0 +1,73 @@
import { column, BaseModel, SnakeCaseNamingStrategy, belongsTo, BelongsTo } from '@ioc:Adonis/Lucid/Orm';
import { DateTime } from 'luxon';
import Dataset from './Dataset';
export default class Coverage extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
public static primaryKey = 'id';
public static table = 'coverage';
public static selfAssignPrimaryKey = false;
@column({
isPrimary: true,
})
public id: number;
@column({})
public dataset_id: number;
@column({})
public elevation_min: number;
@column({})
public elevation_max: number;
@column({})
public elevation_absolut: number;
@column({})
public depth_min: number;
@column({})
public depth_max: number;
@column({})
public depth_absolut: number;
@column.dateTime({})
public time_min: DateTime;
@column.dateTime({})
public time_max: DateTime;
@column.dateTime({})
public time_absolut: DateTime;
@column({})
public x_min: number;
@column({})
public x_max: number;
@column({})
public y_min: number;
@column({})
public y_max: number;
@column.dateTime({
autoCreate: true,
})
public created_at: DateTime;
@column.dateTime({
autoCreate: true,
autoUpdate: true,
})
public updated_at: DateTime;
@belongsTo(() => Dataset, {
foreignKey: 'dataset_id',
})
public dataset: BelongsTo<typeof Dataset>;
}

View File

@ -9,6 +9,8 @@ import {
hasMany,
HasMany,
computed,
hasOne,
HasOne,
} from '@ioc:Adonis/Lucid/Orm';
import { DateTime } from 'luxon';
import dayjs from 'dayjs';
@ -19,6 +21,7 @@ import Description from './Description';
import License from './License';
import Subject from './Subject';
import File from './File';
import Coverage from './Coverage';
export default class Dataset extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
@ -56,9 +59,16 @@ export default class Dataset extends BaseModel {
@column({})
public reviewer_id: number | null = null;
@column({})
public reject_editor_note: string | null;
@column({})
public preferred_reviewer: string | null;
@column({})
public preferred_reviewer_email: string | null;
@column({})
public reject_reviewer_note: string | null;
@ -123,6 +133,12 @@ export default class Dataset extends BaseModel {
})
public files: HasMany<typeof File>;
@hasOne(() => Coverage, {
foreignKey: 'dataset_id',
})
public coverage: HasOne<typeof Coverage>;
@computed({
serializeAs: 'main_title',
})

View File

@ -33,12 +33,12 @@ export enum TitleTypes {
// for table dataset_abstracts
export enum DescriptionTypes {
abstract = 'Abstract',
methods = 'Methods',
series_information = 'Series_information',
technical_info = 'Technical_info',
translated = 'Translated',
other = 'Other',
Abstract = 'Abstract',
Methods = 'Methods',
Series_information = 'Series_information',
Technical_info = 'Technical_info',
Translated = 'Translated',
Other = 'Other',
}
export enum PersonNameTypes {

64
package-lock.json generated
View File

@ -6724,9 +6724,9 @@
}
},
"node_modules/core-js-compat": {
"version": "3.31.1",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.31.1.tgz",
"integrity": "sha512-wIDWd2s5/5aJSdpOJHfSibxNODxoGoWOBHt8JSPB41NOE94M7kuTPZCYLOlTtuoXTsBPKobpJ6T+y0SSy5L9SA==",
"version": "3.32.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.0.tgz",
"integrity": "sha512-7a9a3D1k4UCVKnLhrgALyFcP7YCsLOQIxPd0dKjf/6GuPcgyiGP70ewWdCGrSK7evyhymi0qO4EqCmSJofDeYw==",
"dev": true,
"dependencies": {
"browserslist": "^4.21.9"
@ -7004,13 +7004,13 @@
}
},
"node_modules/css-minimizer-webpack-plugin/node_modules/jest-worker": {
"version": "29.6.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.1.tgz",
"integrity": "sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA==",
"version": "29.6.2",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.2.tgz",
"integrity": "sha512-l3ccBOabTdkng8I/ORCkADz4eSMKejTYv1vB/Z83UiubqhC1oQ5Li6dWCyqOIvSifGjUBxuvxvlm6KGK2DtuAQ==",
"dev": true,
"dependencies": {
"@types/node": "*",
"jest-util": "^29.6.1",
"jest-util": "^29.6.2",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
},
@ -7397,9 +7397,9 @@
}
},
"node_modules/default-browser/node_modules/execa": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-7.1.1.tgz",
"integrity": "sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==",
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz",
"integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.3",
@ -7950,9 +7950,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
"version": "1.4.471",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.471.tgz",
"integrity": "sha512-GpmGRC1vTl60w/k6YpQ18pSiqnmr0j3un//5TV1idPi6aheNfkT1Ye71tMEabWyNDO6sBMgAR+95Eb0eUUr1tA==",
"version": "1.4.475",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.475.tgz",
"integrity": "sha512-mTye5u5P98kSJO2n7zYALhpJDmoSQejIGya0iR01GpoRady8eK3bw7YHHnjA1Rfi4ZSLdpuzlAC7Zw+1Zu7Z6A==",
"dev": true
},
"node_modules/emittery": {
@ -8155,9 +8155,9 @@
}
},
"node_modules/eslint-config-prettier": {
"version": "8.8.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz",
"integrity": "sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA==",
"version": "8.9.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.9.0.tgz",
"integrity": "sha512-+sbni7NfVXnOpnRadUA8S28AUlsZt9GjgFvABIRL9Hkn8KqNzOp+7Lw4QWtrwn20KzU3wqu1QoOj2m+7rKRqkA==",
"dev": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
@ -8843,9 +8843,9 @@
}
},
"node_modules/fast-redact": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.2.0.tgz",
"integrity": "sha512-zaTadChr+NekyzallAMXATXLOR8MNx3zqpZ0MUF2aGf4EathnG0f32VLODNlY8IuGY3HoRO2L6/6fSzNsLaHIw==",
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.3.0.tgz",
"integrity": "sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ==",
"engines": {
"node": ">=6"
}
@ -10508,15 +10508,15 @@
}
},
"node_modules/jest-diff": {
"version": "29.6.1",
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.1.tgz",
"integrity": "sha512-FsNCvinvl8oVxpNLttNQX7FAq7vR+gMDGj90tiP7siWw1UdakWUGqrylpsYrpvj908IYckm5Y0Q7azNAozU1Kg==",
"version": "29.6.2",
"resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.2.tgz",
"integrity": "sha512-t+ST7CB9GX5F2xKwhwCf0TAR17uNDiaPTZnVymP9lw0lssa9vG+AFyDZoeIHStU3WowFFwT+ky+er0WVl2yGhA==",
"dev": true,
"dependencies": {
"chalk": "^4.0.0",
"diff-sequences": "^29.4.3",
"jest-get-type": "^29.4.3",
"pretty-format": "^29.6.1"
"pretty-format": "^29.6.2"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
@ -10738,9 +10738,9 @@
}
},
"node_modules/jest-util": {
"version": "29.6.1",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.1.tgz",
"integrity": "sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg==",
"version": "29.6.2",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.2.tgz",
"integrity": "sha512-3eX1qb6L88lJNCFlEADKOkjpXJQyZRiavX1INZ4tRnrBVr2COd3RgcTLyUiEXMNBlDU/cgYq6taUS0fExrWW4w==",
"dev": true,
"dependencies": {
"@jest/types": "^29.6.1",
@ -11326,9 +11326,9 @@
"integrity": "sha512-QS9p+Q20YBxpE0dJBnF6CPURP7p1GUsxnhTxTWH5nG3A1F5w8Rg3T4Xyh5UlrFSbHp88oOciVP/0agsNLhkHdQ=="
},
"node_modules/magic-string": {
"version": "0.30.1",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz",
"integrity": "sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==",
"version": "0.30.2",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.2.tgz",
"integrity": "sha512-lNZdu7pewtq/ZvWUp9Wpf/x7WzMTsR26TWV03BRZrXFsv+BI6dy8RAiKgm1uM/kyR0rCfUcqvOlXKG66KhIGug==",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15"
},
@ -13831,9 +13831,9 @@
}
},
"node_modules/pretty-format": {
"version": "29.6.1",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.1.tgz",
"integrity": "sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog==",
"version": "29.6.2",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.2.tgz",
"integrity": "sha512-1q0oC8eRveTg5nnBEWMXAU2qpv65Gnuf2eCQzSjxpWFkPaPARwqZZDGuNE0zPAZfTCHzIk3A8dIjwlQKKLphyg==",
"dev": true,
"dependencies": {
"@jest/schemas": "^29.6.0",

View File

@ -59,7 +59,7 @@ const inputElClass = computed(() => {
const base = [
'px-3 py-2 max-w-full focus:ring focus:outline-none border-gray-700 rounded w-full',
'dark:placeholder-gray-400',
computedType.value === 'textarea' ? 'h-24' : 'h-12',
computedType.value === 'textarea' ? 'h-44' : 'h-12',
props.borderless ? 'border-0' : 'border',
// props.transparent && !props.isReadOnly ? 'bg-transparent' : 'bg-white dark:bg-slate-800',
props.isReadOnly ? 'bg-gray-50 dark:bg-slate-600' : 'bg-white dark:bg-slate-800',
@ -120,7 +120,7 @@ if (props.ctrlKFocus) {
v-else-if="computedType === 'textarea'"
:id="id"
v-model="computedValue"
:class="inputElClass"
:class="inputElClass"
:name="name"
:placeholder="placeholder"
:required="required"

View File

@ -42,7 +42,7 @@
</FormField>
<!-- titles -->
<CardBox class="mb-6 shadow" :has-form-data="true" title="Titles" :icon="mdiFinance"
<CardBox class="mb-6 shadow" :has-form-data="false" title="Titles" :icon="mdiFinance"
:header-icon="mdiPlusCircle" v-on:header-icon-click="addTitle()">
<div class="flex flex-col md:flex-row">
<FormField label="Main Title *" help="required: main title"
@ -68,13 +68,13 @@
<label v-if="form.titles.length > 1">additional titles </label>
<!-- <BaseButton :icon="mdiPlusCircle" @click.prevent="addTitle()" color="modern" rounded-full small /> -->
<table class="table-auto">
<table>
<thead>
<tr>
<!-- <th v-if="checkable" /> -->
<th scope="col">Title Value *</th>
<th>Title Type*</th>
<th>Title Language*</th>
<th>Title Value</th>
<th>Title Type</th>
<th>Title Language</th>
<th />
</tr>
</thead>
@ -82,7 +82,7 @@
<template v-for="(item, index) in form.titles" :key="index">
<tr v-if="item.type != 'Main'">
<!-- <td scope="row">{{ index + 1 }}</td> -->
<td scope="row">
<td data-label="Title Value">
<FormControl required v-model="form.titles[index].value" type="text"
placeholder="[enter main title]">
<div class="text-red-400 text-sm"
@ -91,7 +91,7 @@
</div>
</FormControl>
</td>
<td>
<td data-label="Title Type">
<FormControl required v-model="form.titles[index].type" type="select"
:options="titletypes" placeholder="[select title type]">
<div class="text-red-400 text-sm"
@ -100,7 +100,7 @@
</div>
</FormControl>
</td>
<td>
<td data-label="Title Language">
<FormControl required v-model="form.titles[index].language" type="select"
:options="{ de: 'de', en: 'en' }" placeholder="[select title language]">
<div class="text-red-400 text-sm"
@ -109,7 +109,6 @@
</div>
</FormControl>
</td>
<td>
<td class="before:hidden lg:w-1 whitespace-nowrap">
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
@ -117,21 +116,110 @@
@click.prevent="removeTitle(index)" />
</BaseButtons>
</td>
</td>
</tr>
</template>
</tbody>
</table>
</CardBox>
<CardBox class="mb-6 shadow" :has-form-data="false" title="Descriptions" :icon="mdiFinance"
: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">
<FormControl required v-model="form.descriptions[0].value" type="textarea"
placeholder="[enter main abstract]">
<div class="text-red-400 text-sm"
v-if="form.errors['descriptions.0.value'] && Array.isArray(form.errors['descriptions.0.value'])">
{{ form.errors['descriptions.0.value'].join(', ') }}
</div>
</FormControl>
</FormField>
<FormField label="Main Title Language*" help="required: main abstract language"
:class="{ 'text-red-400': form.errors['descriptions.0.language'] }"
class="w-full ml-1 flex-1">
<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>
</FormField>
</div>
<table>
<thead>
<tr>
<!-- <th v-if="checkable" /> -->
<th>Title Value</th>
<th>Title Type</th>
<th>Title Language</th>
<th />
</tr>
</thead>
<tbody>
<template v-for="(item, index) in form.descriptions" :key="index">
<tr v-if="item.type != 'Abstract'">
<!-- <td scope="row">{{ index + 1 }}</td> -->
<td data-label="Description Value">
<FormControl required v-model="form.descriptions[index].value" type="text"
placeholder="[enter main title]">
<div class="text-red-400 text-sm"
v-if="form.errors[`descriptions.${index}.value`]">
{{ form.errors[`descriptions.${index}.value`].join(', ') }}
</div>
</FormControl>
</td>
<td data-label="Description Type">
<FormControl required v-model="form.descriptions[index].type" type="select"
:options="props.descriptiontypes" placeholder="[select title type]">
<div class="text-red-400 text-sm"
v-if="Array.isArray(form.errors[`descriptions.${index}.type`])">
{{ form.errors[`descriptions.${index}.type`].join(', ') }}
</div>
</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]">
<div class="text-red-400 text-sm"
v-if="form.errors[`descriptions.${index}.language`]">
{{ form.errors[`descriptions.${index}.language`].join(', ') }}
</div>
</FormControl>
</td>
<td class="before:hidden lg:w-1 whitespace-nowrap">
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
<BaseButton color="danger" :icon="mdiTrashCan" small
@click.prevent="removeDescription(index)" />
</BaseButtons>
</td>
</tr>
</template>
</tbody>
</table>
</CardBox>
<MapComponent v-if="form.coverage"
:mapOptions="mapOptions"
:baseMaps="baseMaps"
:fitBounds="fitBounds"
:coverage="form.coverage"
:mapId="mapId"
v-bind-event:onMapInitializedEvent="onMapInitialized"
></MapComponent>
</div>
<div class="mb-4">
<!-- <div class="mb-4">
<label for="description" class="block text-gray-700 font-bold mb-2">Description:</label>
<textarea id="description"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
v-model="form.type"></textarea>
</div>
</div> -->
<div class="mb-4">
<!-- <label for="project" class="block text-gray-700 font-bold mb-2">Project:</label>
@ -192,6 +280,11 @@ import BaseButtons from '@/Components/BaseButtons.vue';
import CardBox from '@/Components/CardBox.vue';
import { stardust } from '@eidellev/adonis-stardust/client';
import MapComponent from '@/Components/Map/map.component.vue';
import { MapOptions } from '@/Components/Map/MapOptions';
import { LatLngBoundsExpression } from 'leaflet/src/geo/LatLngBounds';
import { LayerOptions } from '@/Components/Map/LayerOptions';
const props = defineProps({
dataset: {
type: Object,
@ -206,6 +299,10 @@ const props = defineProps({
type: Object,
default: () => ({}),
},
descriptiontypes: {
type: Object,
default: () => ({}),
},
errors: {
type: Object,
default: () => ({}),
@ -215,6 +312,19 @@ const props = defineProps({
// const projects = reactive([]);
// const licenses = reactive([]);
const mapOptions: MapOptions = {
center: [48.208174, 16.373819],
zoom: 3,
zoomControl: false,
attributionControl: false,
};
const baseMaps: Map<string, LayerOptions> = new Map<string, LayerOptions>();
const fitBounds: LatLngBoundsExpression = [
[46.4318173285, 9.47996951665],
[49.0390742051, 16.9796667823],
];
const mapId = 'test';
let form = useForm<Dataset>(props.dataset as Dataset);
// const form = useForm({
// _method: 'put',
@ -241,6 +351,19 @@ const removeTitle = (key) => {
form.titles.splice(key, 1);
};
const addDescription = () => {
let newDescription = { value: '', language: '', type: '' };
//this.dataset.files.push(uploadedFiles[i]);
form.descriptions.push(newDescription);
};
const removeDescription = (key) => {
form.descriptions.splice(key, 1);
};
const onMapInitialized = (newItem) => {
// notify({ type: 'info', text: message });
console.log(newItem);
};
</script>
<!-- <style>