From 5ce4f0b018f1cc4ab423812addb928410102217d Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Fri, 28 Jul 2023 17:08:20 +0200 Subject: [PATCH] - extend edit form for submitter - corrected releasUpdate action for submitter - npm updates --- .../Http/Submitter/DatasetController.ts | 4 +- app/Models/Coverage.ts | 73 +++++++++ app/Models/Dataset.ts | 16 ++ contracts/enums.ts | 12 +- package-lock.json | 64 ++++---- resources/js/Components/FormControl.vue | 4 +- resources/js/Pages/Submitter/Dataset/Edit.vue | 149 ++++++++++++++++-- 7 files changed, 267 insertions(+), 55 deletions(-) create mode 100644 app/Models/Coverage.ts diff --git a/app/Controllers/Http/Submitter/DatasetController.ts b/app/Controllers/Http/Submitter/DatasetController.ts index 07c4eae..a3078a2 100644 --- a/app/Controllers/Http/Submitter/DatasetController.ts +++ b/app/Controllers/Http/Submitter/DatasetController.ts @@ -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, diff --git a/app/Models/Coverage.ts b/app/Models/Coverage.ts new file mode 100644 index 0000000..48b3092 --- /dev/null +++ b/app/Models/Coverage.ts @@ -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; +} diff --git a/app/Models/Dataset.ts b/app/Models/Dataset.ts index eb561c0..33eaada 100644 --- a/app/Models/Dataset.ts +++ b/app/Models/Dataset.ts @@ -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; + @hasOne(() => Coverage, { + foreignKey: 'dataset_id', + }) + public coverage: HasOne; + + @computed({ serializeAs: 'main_title', }) diff --git a/contracts/enums.ts b/contracts/enums.ts index ff6e293..f0298cf 100644 --- a/contracts/enums.ts +++ b/contracts/enums.ts @@ -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 { diff --git a/package-lock.json b/package-lock.json index 85f775c..d4ce931 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/resources/js/Components/FormControl.vue b/resources/js/Components/FormControl.vue index bfe321b..a22dfbc 100644 --- a/resources/js/Components/FormControl.vue +++ b/resources/js/Components/FormControl.vue @@ -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" diff --git a/resources/js/Pages/Submitter/Dataset/Edit.vue b/resources/js/Pages/Submitter/Dataset/Edit.vue index dadbcf7..e5618d0 100644 --- a/resources/js/Pages/Submitter/Dataset/Edit.vue +++ b/resources/js/Pages/Submitter/Dataset/Edit.vue @@ -42,7 +42,7 @@ -
additional titles - +
- - - + + + @@ -82,7 +82,7 @@
Title Value *Title Type*Title Language*Title ValueTitle TypeTitle Language
+ + +
+ + +
+ {{ form.errors['descriptions.0.value'].join(', ') }} +
+
+
+ + +
+ {{ form.errors['descriptions.0.language'].join(', ') }} +
+
+
+
+ + + + + + + + + + + + +
Title ValueTitle TypeTitle Language +
+
+ + +
-
+ + +