- add methods for releasing datasets from submitter

- npm updates
- side menu with child items
- flash messages via HttpContext response (extended via macro)
This commit is contained in:
Kaimbacher 2023-06-27 18:23:18 +02:00
parent e0ff71b117
commit f403c3109f
37 changed files with 1020 additions and 482 deletions

View File

@ -17,8 +17,68 @@ import { TransactionClientContract } from '@ioc:Adonis/Lucid/Database';
import Subject from 'App/Models/Subject';
import CreateDatasetValidator from 'App/Validators/CreateDatasetValidator';
import { TitleTypes, DescriptionTypes } from 'Contracts/enums';
import type { ModelQueryBuilderContract } from '@ioc:Adonis/Lucid/Orm';
export default class DatasetController {
public async index({ auth, request, inertia }: HttpContextContract) {
const user = (await User.find(auth.user?.id)) as User;
const page = request.input('page', 1);
let datasets: ModelQueryBuilderContract<typeof Dataset, Dataset> = Dataset.query();
// if (request.input('search')) {
// // users = users.whereRaw('name like %?%', [request.input('search')])
// const searchTerm = request.input('search');
// datasets.where('name', 'ilike', `%${searchTerm}%`);
// }
if (request.input('sort')) {
type SortOrder = 'asc' | 'desc' | undefined;
let attribute = request.input('sort');
let sort_order: SortOrder = 'asc';
if (attribute.substr(0, 1) == '-') {
sort_order = 'desc';
// attribute = substr(attribute, 1);
attribute = attribute.substr(1);
}
datasets.orderBy(attribute, sort_order);
} else {
// users.orderBy('created_at', 'desc');
datasets.orderBy('id', 'asc');
}
// const users = await User.query().orderBy('login').paginate(page, limit);
const myDatasets = await datasets
.whereIn('server_state', [
'inprogress',
'released',
'editor_accepted',
'approved',
'reviewed',
'rejected_editor',
'rejected_reviewer',
])
.where('account_id', user.id)
.preload('titles')
.preload('user', (query) => query.select('id', 'login'))
// .preload('titles', (builder) => {
// // pull the actual preload data
// builder.where('type', 'Main');
// })
.paginate(page, 10);
return inertia.render('Submitter/Dataset/Index', {
// testing: 'this is a test',
datasets: myDatasets.serialize(),
filters: request.all(),
can: {
// create: await auth.user?.can(['user-create']),
edit: await auth.user?.can(['dataset-edit']),
delete: await auth.user?.can(['dataset-delete']),
},
});
}
public async create({ inertia }: HttpContextContract) {
const licenses = await License.query().select('id', 'name_long').pluck('name_long', 'id');
@ -423,4 +483,89 @@ export default class DatasetController {
'files.*.size': 'file size is to big',
'files.extnames': 'file extension is not supported',
};
// public async release({ params, view }) {
public async release({ request, inertia }: HttpContextContract) {
const id = request.param('id');
const dataset = await Dataset.query()
.preload('user', (builder) => {
builder.select('id', 'login');
})
.where('id', id)
.firstOrFail();
// const editors = await User.query()
// .whereHas('roles', (builder) => {
// builder.where('name', 'editor');
// })
// .pluck('login', 'id');
return inertia.render('Submitter/Dataset/Release', {
dataset,
});
}
public async releaseUpdate({ request, response }: HttpContextContract) {
const id = request.param('id');
const dataset = await Dataset.query().preload('files').where('id', id).firstOrFail();
if (dataset.files.length === 0) {
return response.flash('message', 'At least minimum one file is required.').redirect('back');
}
const preferation = request.input('preferation', '');
const preferredReviewer = request.input('preferred_reviewer');
const preferredReviewerEmail = request.input('preferred_reviewer_email');
if (preferation === 'yes_preferation') {
const newSchema = schema.create({
preferred_reviewer: schema.string({ trim: true }, [rules.minLength(3), rules.maxLength(255)]),
preferred_reviewer_email: schema.string([rules.email()]),
});
try {
await request.validate({ schema: newSchema });
} catch (error) {
// return response.badRequest(error.messages);
throw error;
}
}
const input = {
preferred_reviewer: preferredReviewer || null,
preferred_reviewer_email: preferredReviewerEmail || null,
server_state: 'released',
editor_id: null,
reviewer_id: null,
reject_editor_note: null,
reject_reviewer_note: null,
};
// Clear editor_id if it exists
if (dataset.editor_id !== null) {
input.editor_id = null;
}
// Clear reject_editor_note if it exists
if (dataset.reject_editor_note !== null) {
input.reject_editor_note = null;
}
// Clear reviewer_id if it exists
if (dataset.reviewer_id !== null) {
input.reviewer_id = null;
}
// Clear reject_reviewer_note if it exists
if (dataset.reject_reviewer_note !== null) {
input.reject_reviewer_note = null;
}
// if (await dataset.merge(input).save()) {
// return response.redirect().route('publish.workflow.submit.index').flash('flash_message', 'You have released your dataset!');
// }
return response.toRoute('dataset.list').flash('message', 'You have released your dataset');
// throw new GeneralException(trans('exceptions.publish.release.update_error'));
}
}

34
app/FlashResponse.ts Normal file
View File

@ -0,0 +1,34 @@
import { Response } from '@adonisjs/http-server/build/src/Response';
import { ServerResponse, IncomingMessage } from 'http';
import { RouterContract } from '@ioc:Adonis/Core/Route';
import { EncryptionContract } from '@ioc:Adonis/Core/Encryption';
import { ResponseConfig, ResponseContract } from '@ioc:Adonis/Core/Response';
class FlashResponse extends Response implements ResponseContract {
protected static macros = {};
protected static getters = {};
constructor(
public request: IncomingMessage,
public response: ServerResponse,
flashEncryption: EncryptionContract,
flashConfig: ResponseConfig,
flashRouter: RouterContract,
) {
super(request, response, flashEncryption, flashConfig, flashRouter);
}
nonce: string;
public flash(key: string, message: any): this {
// Store the flash message in the session
this.ctx?.session.flash(key, message);
return this;
}
public toRoute(route: string): this {
// Redirect to the specified route
super.redirect().toRoute(route);
return this;
}
}
export default FlashResponse;

View File

@ -8,14 +8,17 @@ import {
BelongsTo,
hasMany,
HasMany,
computed,
} from '@ioc:Adonis/Lucid/Orm';
import { DateTime } from 'luxon';
import dayjs from 'dayjs';
import Person from './Person';
import User from './User';
import Title from './Title';
import Description from './Description';
import License from './License';
import Subject from './Subject';
import File from './File';
export default class Dataset extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
@ -47,10 +50,29 @@ export default class Dataset extends BaseModel {
@column({})
public account_id: number | null = null;
@column({})
public editor_id: number | null = null;
@column({})
public reviewer_id: number | null = null;
@column({})
public reject_editor_note: string;
@column({})
public reject_reviewer_note: string;
@column.dateTime({ columnName: 'server_date_published' })
public serverDatePublished: DateTime;
@column.dateTime({ autoCreate: true, columnName: 'created_at' })
// @column.dateTime({ autoCreate: true, columnName: 'created_at' })
@column.dateTime({
serialize: (value: Date | null) => {
return value ? dayjs(value).format('MMMM D YYYY HH:mm a') : value;
},
autoCreate: true,
columnName: 'created_at',
})
public createdAt: DateTime;
@column.dateTime({ autoCreate: true, autoUpdate: true, columnName: 'server_date_modified' })
@ -100,9 +122,17 @@ export default class Dataset extends BaseModel {
})
public subjects: ManyToMany<typeof Subject>;
// async save(): Promise<this> {
// // Call the parent save method to persist changes to the database
// await super.save();
// return this;
// }
@hasMany(() => File, {
foreignKey: 'document_id',
})
public files: HasMany<typeof File>;
@computed({
serializeAs: 'main_title',
})
public get mainTitle() {
// return `${this.firstName} ${this.lastName}`;
const mainTitle = this.titles?.find((title) => title.type === 'Main');
return mainTitle ? mainTitle.value : null;
}
}

View File

@ -4,11 +4,14 @@ import {
BaseModel,
hasMany,
HasMany,
belongsTo,
BelongsTo,
// manyToMany,
// ManyToMany,
SnakeCaseNamingStrategy,
} from '@ioc:Adonis/Lucid/Orm';
import HashValue from './HashValue';
import Dataset from './Dataset';
export default class File extends BaseModel {
public static namingStrategy = new SnakeCaseNamingStrategy();
@ -21,6 +24,9 @@ export default class File extends BaseModel {
})
public id: number;
@column({})
public document_id: number;
@column({})
public pathName: string;
@ -51,10 +57,14 @@ export default class File extends BaseModel {
@column.dateTime({ autoCreate: true, autoUpdate: true })
public updatedAt: DateTime;
// public function hashvalues()
// public function dataset()
// {
// return $this->hasMany(HashValue::class, 'file_id', 'id');
// return $this->belongsTo(Dataset::class, 'document_id', 'id');
// }
@belongsTo(() => Dataset, {
foreignKey: 'document_id',
})
public dataset: BelongsTo<typeof Dataset>;
@hasMany(() => HashValue, {
foreignKey: 'file_id',

7
contracts/response.ts Normal file
View File

@ -0,0 +1,7 @@
declare module '@ioc:Adonis/Core/Response' {
interface ResponseContract {
flash(key: string, message: any): this;
toRoute(route: string): this;
}
}

View File

@ -37,4 +37,3 @@ export default class CollectionsRoles extends BaseSchema {
// REVOKE ALL ON TABLE collections_roles FROM tethys_app;
// GRANT ALL ON TABLE collections_roles TO tethys_admin;
// GRANT DELETE, UPDATE, INSERT, SELECT ON TABLE collections_roles TO tethys_app;

View File

@ -29,7 +29,6 @@ export default class Persons extends BaseSchema {
}
}
// -- Table: persons
// CREATE TABLE IF NOT EXISTS persons
// (

177
package-lock.json generated
View File

@ -3848,6 +3848,12 @@
"resolved": "https://registry.npmjs.org/@types/he/-/he-1.2.0.tgz",
"integrity": "sha512-uH2smqTN4uGReAiKedIVzoLUAXIYLBTbSofhx3hbNqj74Ua6KqFsLYszduTrLCMEAEAozF73DbGi/SC1bzQq4g=="
},
"node_modules/@types/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ==",
"dev": true
},
"node_modules/@types/http-proxy": {
"version": "1.17.11",
"resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz",
@ -3941,9 +3947,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.3.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz",
"integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg=="
"version": "20.3.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.2.tgz",
"integrity": "sha512-vOBLVQeCQfIcF/2Y7eKFTqrMnizK5lRNQ7ykML/5RuwVXVWxYkgwS7xbt4B6fKCUPgbSL5FSsjHQpaGQP/dQmw=="
},
"node_modules/@types/pino": {
"version": "6.3.12",
@ -4027,11 +4033,12 @@
}
},
"node_modules/@types/serve-static": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz",
"integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==",
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz",
"integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==",
"dev": true,
"dependencies": {
"@types/http-errors": "*",
"@types/mime": "*",
"@types/node": "*"
}
@ -4094,15 +4101,15 @@
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.0.tgz",
"integrity": "sha512-78B+anHLF1TI8Jn/cD0Q00TBYdMgjdOn980JfAVa9yw5sop8nyTfVOQAv6LWywkOGLclDBtv5z3oxN4w7jxyNg==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.60.1.tgz",
"integrity": "sha512-KSWsVvsJsLJv3c4e73y/Bzt7OpqMCADUO846bHcuWYSYM19bldbAeDv7dYyV0jwkbMfJ2XdlzwjhXtuD7OY6bw==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.4.0",
"@typescript-eslint/scope-manager": "5.60.0",
"@typescript-eslint/type-utils": "5.60.0",
"@typescript-eslint/utils": "5.60.0",
"@typescript-eslint/scope-manager": "5.60.1",
"@typescript-eslint/type-utils": "5.60.1",
"@typescript-eslint/utils": "5.60.1",
"debug": "^4.3.4",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
@ -4128,14 +4135,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.60.0.tgz",
"integrity": "sha512-jBONcBsDJ9UoTWrARkRRCgDz6wUggmH5RpQVlt7BimSwaTkTjwypGzKORXbR4/2Hqjk9hgwlon2rVQAjWNpkyQ==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.60.1.tgz",
"integrity": "sha512-pHWlc3alg2oSMGwsU/Is8hbm3XFbcrb6P5wIxcQW9NsYBfnrubl/GhVVD/Jm/t8HXhA2WncoIRfBtnCgRGV96Q==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.60.0",
"@typescript-eslint/types": "5.60.0",
"@typescript-eslint/typescript-estree": "5.60.0",
"@typescript-eslint/scope-manager": "5.60.1",
"@typescript-eslint/types": "5.60.1",
"@typescript-eslint/typescript-estree": "5.60.1",
"debug": "^4.3.4"
},
"engines": {
@ -4155,13 +4162,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.60.0.tgz",
"integrity": "sha512-hakuzcxPwXi2ihf9WQu1BbRj1e/Pd8ZZwVTG9kfbxAMZstKz8/9OoexIwnmLzShtsdap5U/CoQGRCWlSuPbYxQ==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.60.1.tgz",
"integrity": "sha512-Dn/LnN7fEoRD+KspEOV0xDMynEmR3iSHdgNsarlXNLGGtcUok8L4N71dxUgt3YvlO8si7E+BJ5Fe3wb5yUw7DQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.60.0",
"@typescript-eslint/visitor-keys": "5.60.0"
"@typescript-eslint/types": "5.60.1",
"@typescript-eslint/visitor-keys": "5.60.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -4172,13 +4179,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.60.0.tgz",
"integrity": "sha512-X7NsRQddORMYRFH7FWo6sA9Y/zbJ8s1x1RIAtnlj6YprbToTiQnM6vxcMu7iYhdunmoC0rUWlca13D5DVHkK2g==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.60.1.tgz",
"integrity": "sha512-vN6UztYqIu05nu7JqwQGzQKUJctzs3/Hg7E2Yx8rz9J+4LgtIDFWjjl1gm3pycH0P3mHAcEUBd23LVgfrsTR8A==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "5.60.0",
"@typescript-eslint/utils": "5.60.0",
"@typescript-eslint/typescript-estree": "5.60.1",
"@typescript-eslint/utils": "5.60.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@ -4199,9 +4206,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.60.0.tgz",
"integrity": "sha512-ascOuoCpNZBccFVNJRSC6rPq4EmJ2NkuoKnd6LDNyAQmdDnziAtxbCGWCbefG1CNzmDvd05zO36AmB7H8RzKPA==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.60.1.tgz",
"integrity": "sha512-zDcDx5fccU8BA0IDZc71bAtYIcG9PowaOwaD8rjYbqwK7dpe/UMQl3inJ4UtUK42nOCT41jTSCwg76E62JpMcg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -4212,13 +4219,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.0.tgz",
"integrity": "sha512-R43thAuwarC99SnvrBmh26tc7F6sPa2B3evkXp/8q954kYL6Ro56AwASYWtEEi+4j09GbiNAHqYwNNZuNlARGQ==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.60.1.tgz",
"integrity": "sha512-hkX70J9+2M2ZT6fhti5Q2FoU9zb+GeZK2SLP1WZlvUDqdMbEKhexZODD1WodNRyO8eS+4nScvT0dts8IdaBzfw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.60.0",
"@typescript-eslint/visitor-keys": "5.60.0",
"@typescript-eslint/types": "5.60.1",
"@typescript-eslint/visitor-keys": "5.60.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@ -4289,17 +4296,17 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.60.0.tgz",
"integrity": "sha512-ba51uMqDtfLQ5+xHtwlO84vkdjrqNzOnqrnwbMHMRY8Tqeme8C2Q8Fc7LajfGR+e3/4LoYiWXUM6BpIIbHJ4hQ==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.60.1.tgz",
"integrity": "sha512-tiJ7FFdFQOWssFa3gqb94Ilexyw0JVxj6vBzaSpfN/8IhoKkDuSAenUKvsSHw2A/TMpJb26izIszTXaqygkvpQ==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
"@typescript-eslint/scope-manager": "5.60.0",
"@typescript-eslint/types": "5.60.0",
"@typescript-eslint/typescript-estree": "5.60.0",
"@typescript-eslint/scope-manager": "5.60.1",
"@typescript-eslint/types": "5.60.1",
"@typescript-eslint/typescript-estree": "5.60.1",
"eslint-scope": "^5.1.1",
"semver": "^7.3.7"
},
@ -4337,12 +4344,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.60.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.0.tgz",
"integrity": "sha512-wm9Uz71SbCyhUKgcaPRauBdTegUyY/ZWl8gLwD/i/ybJqscrrdVSFImpvUz16BLPChIeKBK5Fa9s6KDQjsjyWw==",
"version": "5.60.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.60.1.tgz",
"integrity": "sha512-xEYIxKcultP6E/RMKqube11pGjXH1DCo60mQoWhVYyKfLkwbIVVjYxmOenNMxILx0TjCujPTjjnTIVzm09TXIw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.60.0",
"@typescript-eslint/types": "5.60.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@ -5943,9 +5950,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001506",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001506.tgz",
"integrity": "sha512-6XNEcpygZMCKaufIcgpQNZNf00GEqc7VQON+9Rd0K1bMYo8xhMZRAo5zpbnbMNizi4YNgIDAFrdykWsvY3H4Hw==",
"version": "1.0.30001508",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001508.tgz",
"integrity": "sha512-sdQZOJdmt3GJs1UMNpCCCyeuS2IEGLXnHyAo9yIO5JJDjbjoVRij4M1qep6P6gFpptD1PqIYgzM+gwJbOi92mw==",
"dev": true,
"funding": [
{
@ -7648,9 +7655,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
"version": "1.4.436",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.436.tgz",
"integrity": "sha512-aktOxo8fnrMC8vOIBMVS3PXbT1nrPQ+SouUuN7Y0a+Rw3pOMrvIV92Ybnax7x4tugA+ZpYA5fOHTby7ama8OQQ==",
"version": "1.4.441",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.441.tgz",
"integrity": "sha512-LlCgQ8zgYZPymf5H4aE9itwiIWH4YlCiv1HFLmmcBeFYi5E+3eaIFnjHzYtcFQbaKfAW+CqZ9pgxo33DZuoqPg==",
"dev": true
},
"node_modules/emittery": {
@ -7729,9 +7736,9 @@
}
},
"node_modules/envinfo": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.9.0.tgz",
"integrity": "sha512-RODB4txU+xImYDemN5DqaKC0CHk05XSVkOX4pq0hK26Qx+1LChkuOyUDlGEjYb3ACr0n9qBhFjg37hQuJvpkRQ==",
"version": "7.10.0",
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz",
"integrity": "sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw==",
"dev": true,
"peer": true,
"bin": {
@ -9571,9 +9578,9 @@
}
},
"node_modules/html-entities": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.6.tgz",
"integrity": "sha512-9o0+dcpIw2/HxkNuYKxSJUF/MMRZQECK4GnF+oQOmJ83yCVHTWgCH5aOXxK5bozNRmM8wtgryjHD3uloPBDEGw==",
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.4.0.tgz",
"integrity": "sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==",
"funding": [
{
"type": "github",
@ -12377,14 +12384,14 @@
}
},
"node_modules/pg": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.11.0.tgz",
"integrity": "sha512-meLUVPn2TWgJyLmy7el3fQQVwft4gU5NGyvV0XbD41iU9Jbg8lCH4zexhIkihDzVHJStlt6r088G6/fWeNjhXA==",
"version": "8.11.1",
"resolved": "https://registry.npmjs.org/pg/-/pg-8.11.1.tgz",
"integrity": "sha512-utdq2obft07MxaDg0zBJI+l/M3mBRfIpEN3iSemsz0G5F2/VXx+XzqF4oxrbIZXQxt2AZzIUzyVg/YM6xOP/WQ==",
"dependencies": {
"buffer-writer": "2.0.0",
"packet-reader": "1.0.0",
"pg-connection-string": "^2.6.0",
"pg-pool": "^3.6.0",
"pg-connection-string": "^2.6.1",
"pg-pool": "^3.6.1",
"pg-protocol": "^1.6.0",
"pg-types": "^2.1.0",
"pgpass": "1.x"
@ -12393,7 +12400,7 @@
"node": ">= 8.0.0"
},
"optionalDependencies": {
"pg-cloudflare": "^1.1.0"
"pg-cloudflare": "^1.1.1"
},
"peerDependencies": {
"pg-native": ">=3.0.1"
@ -12405,9 +12412,9 @@
}
},
"node_modules/pg-cloudflare": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.0.tgz",
"integrity": "sha512-tGM8/s6frwuAIyRcJ6nWcIvd3+3NmUKIs6OjviIm1HPPFEt5MzQDOTBQyhPWg/m0kCl95M6gA1JaIXtS8KovOA==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz",
"integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==",
"optional": true
},
"node_modules/pg-connection-string": {
@ -12424,9 +12431,9 @@
}
},
"node_modules/pg-pool": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.0.tgz",
"integrity": "sha512-clFRf2ksqd+F497kWFyM21tMjeikn60oGDmqMT8UBrynEwVEX/5R5xd2sdvdo1cZCFlguORNpVuqxIj+aK4cfQ==",
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.1.tgz",
"integrity": "sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==",
"peerDependencies": {
"pg": ">=8.0"
}
@ -12452,9 +12459,9 @@
}
},
"node_modules/pg/node_modules/pg-connection-string": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.0.tgz",
"integrity": "sha512-x14ibktcwlHKoHxx9X3uTVW9zIGR41ZB6QNhHb21OPNdCCO3NaRnpJuwKIQSR4u+Yqjx4HCvy7Hh7VSy1U4dGg=="
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.6.1.tgz",
"integrity": "sha512-w6ZzNu6oMmIzEAYVw+RLK0+nqHPt8K3ZnknKi+g48Ak2pr3dtljJW3o+D/n2zzCG07Zoe9VOX3aiKpj+BN0pjg=="
},
"node_modules/pgpass": {
"version": "1.0.5",
@ -12622,9 +12629,9 @@
}
},
"node_modules/pino-std-serializers": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.1.tgz",
"integrity": "sha512-wHuWB+CvSVb2XqXM0W/WOYUkVSPbiJb9S5fNB7TBhd8s892Xq910bRxwHtC4l71hgztObTjXL6ZheZXFjhDrDQ=="
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz",
"integrity": "sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA=="
},
"node_modules/pino/node_modules/pino-std-serializers": {
"version": "3.2.0",
@ -14206,9 +14213,9 @@
}
},
"node_modules/semver": {
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz",
"integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==",
"version": "7.5.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz",
"integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@ -15843,9 +15850,9 @@
}
},
"node_modules/tslib": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz",
"integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w=="
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz",
"integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA=="
},
"node_modules/tsscmp": {
"version": "1.0.6",
@ -17001,9 +17008,9 @@
}
},
"node_modules/youch-terminal": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/youch-terminal/-/youch-terminal-2.2.0.tgz",
"integrity": "sha512-LLYtvG/4XoRO/vhf2eBkzT6dI1hWliLSp7NuXRKsvBAITuIxODS61X7AQOHl5Aaf8oquS9JlHSpjTFjX140XKA==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/youch-terminal/-/youch-terminal-2.2.1.tgz",
"integrity": "sha512-enW8MxCaZKbss1zwJEP5IGP7b3/QWOc00payGqMaCzfia+QnFJYg0rLrboHXLd/rLsISc2VpRWaTqMsY8kmfMw==",
"dev": true,
"dependencies": {
"kleur": "^4.1.5",

View File

@ -1,5 +1,7 @@
import type { ApplicationContract } from '@ioc:Adonis/Core/Application';
import Hash from '@ioc:Adonis/Core/Hash';
import type Hash from '@ioc:Adonis/Core/Hash';
// import HttpContextContract from '@ioc:Adonis/Core/HttpContext';
import type Response from '@ioc:Adonis/Core/Response';
import { LaravelHash } from './HashDriver';
export default class AppProvider {
@ -15,6 +17,22 @@ export default class AppProvider {
hashInstance.extend('bcrypt', () => {
return new LaravelHash();
});
const responseInstance: typeof Response = this.app.container.use('Adonis/Core/Response');
responseInstance.macro('flash', function (key: string, message: any) {
this.ctx!.session.flash(key, message);
return this;
});
responseInstance.macro('toRoute', function (route: string) {
this.redirect().toRoute(route);
return this;
});
// this.app.container.singleton('Adonis/Core/Response', () => {
// return FlashResponse;
// });
// this.app.container.singleton('Adonis/Core/HttpContext', () => {
// });
}
public async ready() {

View File

@ -1,6 +1,6 @@
import { HashDriverContract } from "@ioc:Adonis/Core/Hash";
import { HashDriverContract } from '@ioc:Adonis/Core/Hash';
// const bcrypt = require("bcrypt");
import bcrypt from "bcryptjs";
import bcrypt from 'bcryptjs';
const saltRounds = 10;
export class LaravelHash implements HashDriverContract {
@ -11,8 +11,8 @@ export class LaravelHash implements HashDriverContract {
public async verify(hashedValue: string, plainValue: string) {
let newHash: string;
if (hashedValue.includes("$2y$10$")) {
newHash = hashedValue.replace("$2y$10$", "$2a$10$");
if (hashedValue.includes('$2y$10$')) {
newHash = hashedValue.replace('$2y$10$', '$2a$10$');
} else {
newHash = hashedValue;
}

View File

@ -31,7 +31,7 @@ const hasColor = computed(() => props.item && props.item.color);
const isDropdownActive = ref(false);
const componentClass = computed(() => [
props.isDropdownList ? 'py-3 px-6 text-sm' : 'py-3 px-6',
props.isDropdownList ? 'py-3 px-6 text-sm font-semibold' : 'py-3 px-6',
hasColor.value ? getButtonColor(props.item.color, false, true) : styleService.asideMenuItemStyle,
]);
@ -76,18 +76,19 @@ const is = computed(() => {
<!-- <component :is="itemHref ? 'div' : Link" :href="itemHref ? itemHref : itemRoute" -->
<component :is="is" :href="itemRoute ? stardust.route(props.item.route) : props.item.href"
class="flex cursor-pointer dark:text-slate-300 dark:hover:text-white" :class="componentClass"
@click="menuClick" v-bind:target="props.item.target ?? null">
@click.prevent="menuClick" v-bind:target="props.item.target ?? null">
<BaseIcon v-if="item.icon" :path="item.icon" class="flex-none" :class="activeInactiveStyle" w="w-16"
:size="18" />
<span class="grow text-ellipsis line-clamp-1" :class="activeInactiveStyle">
{{ item.label }}
</span>
<!-- <BaseIcon v-if="hasDropdown" :path="isDropdownActive ? mdiMinus : mdiPlus" class="flex-none"
:class="activeInactiveStyle" w="w-12" /> -->
<!-- plus icon for expanding sub menu -->
<BaseIcon v-if="hasDropdown" :path="isDropdownActive ? mdiMinus : mdiPlus" class="flex-none"
:class="activeInactiveStyle" w="w-12" @click.prevent="menuClick"/>
</component>
<!-- <AsideMenuList v-if="hasDropdown" :menu="item.children" :class="[
<AsideMenuList v-if="hasDropdown" :menu="item.children" :class="[
styleService.asideMenuDropdownStyle,
isDropdownActive ? 'block dark:bg-slate-800/50' : 'hidden',
]" is-dropdown-list /> -->
]" is-dropdown-list />
</li>
</template>

View File

@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import AsideMenuItem from '@/Components/AsideMenuItem.vue';
defineProps({
@ -22,7 +22,7 @@ const menuClick = (event, item) => {
v-for="(item, index) in menu"
:key="index"
v-bind:item="item"
:is-dropdown-list="isDropdownList"
:is-dropdown-list="item.children?.length > 0"
@menu-click="menuClick"
/>
</ul>

View File

@ -2,19 +2,19 @@ export const chartColors = {
default: {
primary: '#00D1B2',
info: '#209CEE',
danger: '#FF3860'
}
}
danger: '#FF3860',
},
};
const randomChartData = n => {
const data = []
const randomChartData = (n) => {
const data = [];
for (let i = 0; i < n; i++) {
data.push(Math.round(Math.random() * 200))
data.push(Math.round(Math.random() * 200));
}
return data
}
return data;
};
const datasetObject = (color, points) => {
return {
@ -32,23 +32,19 @@ const datasetObject = (color, points) => {
pointRadius: 4,
data: randomChartData(points),
tension: 0.5,
cubicInterpolationMode: 'default'
}
}
cubicInterpolationMode: 'default',
};
};
export const sampleChartData = (points = 9) => {
const labels = []
const labels = [];
for (let i = 1; i <= points; i++) {
labels.push(`0${i}`)
labels.push(`0${i}`);
}
return {
labels,
datasets: [
datasetObject('primary', points),
datasetObject('info', points),
datasetObject('danger', points)
]
}
}
datasets: [datasetObject('primary', points), datasetObject('info', points), datasetObject('danger', points)],
};
};

View File

@ -3,7 +3,6 @@ import { EventEmitter } from './EventEmitter';
import type { Map } from 'leaflet/src/map/index';
export abstract class Control<T> extends EventEmitter<T> {
// @section
// @aka Control options
options = {
@ -36,17 +35,16 @@ export abstract class Control<T> extends EventEmitter<T> {
addTo(map: Map): Control<T> {
this._map = map;
let container = this._container = this.onAdd(map);
let container = (this._container = this.onAdd(map));
let pos = this.getPosition(); //"topright"
let corner = map.controlCorners[pos];
if (container) {
// $(container).addClass('gba-control');
container.classList.add("gba-control");
container.classList.add('gba-control');
if (pos.indexOf('bottom') !== -1) {
corner.insertBefore(container, corner.firstChild);
}
else {
} else {
corner.appendChild(container);
}
}
@ -65,6 +63,4 @@ export abstract class Control<T> extends EventEmitter<T> {
}
return this;
}
}

View File

@ -10,5 +10,4 @@ export interface LayerOptions {
// export type LayerMap = Map<string, LayerOptions>;
export class LayerMap extends Map<string, LayerOptions> {
}
export class LayerMap extends Map<string, LayerOptions> {}

View File

@ -118,13 +118,13 @@ const removeAuthor = (key) => {
<thead>
<tr>
<!-- <th v-if="checkable" /> -->
<th scope="col">ID</th>
<th scope="col">Sort</th>
<th class="hidden lg:table-cell"></th>
<th>Name</th>
<th>Email</th>
<!-- <th>Name Type</th> -->
<!-- <th>Progress</th> -->
<th>Created</th>
<!-- <th>Created</th> -->
<th />
</tr>
</thead>
@ -155,9 +155,6 @@ const removeAuthor = (key) => {
{{ client.progress }}
</progress>
</td> -->
<td data-label="Created" class="lg:w-1 whitespace-nowrap">
<small class="text-gray-500 dark:text-slate-400" :title="element.created_at">{{ element.created_at }}</small>
</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" /> -->

View File

@ -46,9 +46,9 @@ const profileSubmit = async () => {
};
const passwordForm = useForm({
old_password: "",
new_password: "",
confirm_password: "",
old_password: '',
new_password: '',
confirm_password: '',
});
const passwordSubmit = async () => {
await passwordForm.post(stardust.route('admin.account.info.store'), {
@ -56,7 +56,7 @@ const passwordSubmit = async () => {
onSuccess: (resp) => {
console.log(resp);
passwordForm.reset();
}
},
});
};
</script>
@ -65,8 +65,14 @@ const passwordSubmit = async () => {
<LayoutAuthenticated>
<SectionMain>
<SectionTitleLineWithButton :icon="mdiAccount" title="Profile" main>
<BaseButton :route-name="stardust.route('dashboard')" :icon="mdiArrowLeftBoldOutline" label="Back" color="white"
rounded-full small />
<BaseButton
:route-name="stardust.route('dashboard')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
rounded-full
small
/>
</SectionTitleLineWithButton>
<!-- <NotificationBar v-if="$page.props.flash.message" color="success" :icon="mdiAlertBoxOutline">
@ -74,7 +80,6 @@ const passwordSubmit = async () => {
</NotificationBar> -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- password form -->
<!-- <CardBox title="Edit Profile" :icon="mdiAccountCircle" form @submit.prevent="profileForm.post(route('admin.account.info.store'))"> -->
<CardBox title="Edit Profile" :icon="mdiAccountCircle" form @submit.prevent="profileSubmit()">
@ -86,8 +91,7 @@ const passwordSubmit = async () => {
</FormControl>
</FormField>
<FormField label="Email" help="Required. Your e-mail" :class="{ 'text-red-400': errors.email }">
<FormControl v-model="profileForm.email" :icon="mdiMail" type="email" name="email" required
:error="errors.email">
<FormControl v-model="profileForm.email" :icon="mdiMail" type="email" name="email" required :error="errors.email">
<div class="text-red-400 text-sm" v-if="errors.email">
{{ errors.email }}
</div>
@ -108,10 +112,19 @@ const passwordSubmit = async () => {
})
"> -->
<CardBox title="Change Password" :icon="mdiLock" form @submit.prevent="passwordSubmit()">
<FormField label="Current password" help="Required. Your current password"
:class="{ 'text-red-400': passwordForm.errors.old_password }">
<FormControl v-model="passwordForm.old_password" :icon="mdiAsterisk" name="old_password" type="password"
required :error="passwordForm.errors.old_password">
<FormField
label="Current password"
help="Required. Your current password"
:class="{ 'text-red-400': passwordForm.errors.old_password }"
>
<FormControl
v-model="passwordForm.old_password"
:icon="mdiAsterisk"
name="old_password"
type="password"
required
:error="passwordForm.errors.old_password"
>
<div class="text-red-400 text-sm" v-if="passwordForm.errors.old_password">
{{ passwordForm.errors.old_password }}
</div>
@ -120,19 +133,38 @@ const passwordSubmit = async () => {
<BaseDivider />
<FormField label="New password" help="Required. New password" :class="{ 'text-red-400': passwordForm.errors.new_password }">
<FormControl v-model="passwordForm.new_password" :icon="mdiFormTextboxPassword" name="new_password"
type="password" required :error="passwordForm.errors.new_password">
<FormField
label="New password"
help="Required. New password"
:class="{ 'text-red-400': passwordForm.errors.new_password }"
>
<FormControl
v-model="passwordForm.new_password"
:icon="mdiFormTextboxPassword"
name="new_password"
type="password"
required
:error="passwordForm.errors.new_password"
>
<div class="text-red-400 text-sm" v-if="passwordForm.errors.new_password">
{{ passwordForm.errors.new_password }}
</div>
</FormControl>
</FormField>
<FormField label="Confirm password" help="Required. New password one more time"
:class="{ 'text-red-400': passwordForm.errors.confirm_password }">
<FormControl v-model="passwordForm.confirm_password" :icon="mdiFormTextboxPassword" name="confirm_password"
type="password" required :error="passwordForm.errors.confirm_password">
<FormField
label="Confirm password"
help="Required. New password one more time"
:class="{ 'text-red-400': passwordForm.errors.confirm_password }"
>
<FormControl
v-model="passwordForm.confirm_password"
:icon="mdiFormTextboxPassword"
name="confirm_password"
type="password"
required
:error="passwordForm.errors.confirm_password"
>
<div class="text-red-400 text-sm" v-if="passwordForm.errors.confirm_password">
{{ passwordForm.errors.confirm_password }}
</div>
@ -145,7 +177,6 @@ const passwordSubmit = async () => {
</BaseButtons>
</template>
</CardBox>
</div>
</SectionMain>
</LayoutAuthenticated>

View File

@ -0,0 +1,141 @@
<script setup lang="ts">
// import { Head, Link, useForm, usePage } from '@inertiajs/inertia-vue3';
import { Head, usePage } from '@inertiajs/vue3';
import { ComputedRef } from 'vue';
import { mdiSquareEditOutline, mdiTrashCan, mdiAlertBoxOutline } from '@mdi/js';
import { computed } from 'vue';
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
import SectionMain from '@/Components/SectionMain.vue';
// import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
import BaseButton from '@/Components/BaseButton.vue';
import CardBox from '@/Components/CardBox.vue';
import BaseButtons from '@/Components/BaseButtons.vue';
import NotificationBar from '@/Components/NotificationBar.vue';
import Pagination from '@/Components/Admin/Pagination.vue';
// import Sort from '@/Components/Admin/Sort.vue';
import { stardust } from '@eidellev/adonis-stardust/client';
const props = defineProps({
datasets: {
type: Object,
default: () => ({}),
},
filters: {
type: Object,
default: () => ({}),
},
can: {
type: Object,
default: () => ({}),
},
// user: {
// type: Object,
// default: () => ({}),
// }
});
// const search = computed(() => {
// return props.filters.search;
// });
const flash: ComputedRef<any> = computed(() => {
// let test = usePage();
// console.log(test);
return usePage().props.flash;
});
// const form = useForm({
// search: props.filters.search,
// });
// const formDelete = useForm({});
// async function destroy(id) {
// const destroy = async (id) => {
// // if (confirm('Are you sure you want to delete?')) {
// // await formDelete.delete(stardust.route('dataset.destroy', [id]));
// // }
// };
</script>
<template>
<LayoutAuthenticated>
<Head title="Submit Dataset" />
<SectionMain>
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
{{ flash.message }}
</NotificationBar>
<!-- table -->
<CardBox class="mb-6" has-table>
<table>
<thead>
<tr>
<th>
<!-- <Sort label="Dataset Title" attribute="title" :search="form.search" /> -->
Dataset Title
</th>
<th>
<!-- <Sort label="Email" attribute="email" :search="form.search" /> -->
<th>Server State</th>
</th>
<th>Date of last modification</th>
<th v-if="can.edit || can.delete">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="dataset in props.datasets.data" :key="dataset.id">
<td data-label="Login">
<!-- <Link v-bind:href="stardust.route('user.show', [user.id])"
class="no-underline hover:underline text-cyan-600 dark:text-cyan-400">
{{ user.login }}
</Link> -->
<!-- {{ user.id }} -->
{{ dataset.main_title }}
</td>
<td>
{{ dataset.server_state }}
</td>
<td data-label="Created" class="lg:w-1 whitespace-nowrap">
<small class="text-gray-500 dark:text-slate-400" :title="dataset.server_date_modified">{{ dataset.updated_at }}</small>
</td>
<td v-if="can.edit || can.delete" class="before:hidden lg:w-1 whitespace-nowrap">
<BaseButtons type="justify-start lg:justify-end" no-wrap>
<!-- release created dataset -->
<BaseButton
v-if="can.delete && (dataset.server_state === 'inprogress' || dataset.server_state === 'rejected_editor')"
:route-name="stardust.route('dataset.release', [dataset.id])"
color="info"
:icon="mdiSquareEditOutline"
:label="'Release'"
small
/>
<!-- @click="destroy(dataset.id)" -->
<BaseButton v-if="can.delete" color="danger" :icon="mdiTrashCan" small />
</BaseButtons>
</td>
</tr>
</tbody>
</table>
<div class="py-4">
<Pagination v-bind:data="datasets.meta" />
<!-- <ul>
<li>
<a href="{{ users.page == 1 ? '#' : '?page=' + (users.page - 1) }}">Previous</a>
</li>
@each(page in ???)
<li>
<a href="?page={{ page }}">{{ page }}</a>
</li>
@endeach
<li>
<a href="{{ users.lastPage == users.page ? '#' : '?page=' + (users.page + 1) }}">Next</a>
</li>
</ul> -->
</div>
</CardBox>
</SectionMain>
</LayoutAuthenticated>
</template>

View File

@ -0,0 +1,131 @@
<script setup lang="ts">
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
import SectionMain from '@/Components/SectionMain.vue';
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
import { useForm, Head, usePage } from '@inertiajs/vue3';
// import { Inertia } from '@inertiajs/inertia';
import { computed, Ref } from 'vue';
import CardBox from '@/Components/CardBox.vue';
import FormField from '@/Components/FormField.vue';
import FormControl from '@/Components/FormControl.vue';
import BaseButton from '@/Components/BaseButton.vue';
import BaseButtons from '@/Components/BaseButtons.vue';
import { stardust } from '@eidellev/adonis-stardust/client';
import { mdiArrowLeftBoldOutline, mdiLockOpen } from '@mdi/js';
import FormValidationErrors from '@/Components/FormValidationErrors.vue';
const props = defineProps({
dataset: {
type: Object,
default: () => ({}),
},
});
const flash: Ref<any> = computed(() => {
return usePage().props.flash;
});
const errors: Ref<any> = computed(() => {
return usePage().props.errors;
});
const form = useForm({
preferred_reviewer: '',
preferred_reviewer_email: '',
preferation: 'yes_preferation',
// preferation: '',
// isPreferationRequired: false,
});
// const preferation = ref('yes_preferation');
// const isPreferationRequired = ref(false);
const isPreferationRequired = computed(() => form.preferation === 'yes_preferation');
const handleSubmit = async (e) => {
e.preventDefault();
await form.put(stardust.route('dataset.releaseUpdate', [props.dataset.id]));
};
</script>
<template>
<LayoutAuthenticated>
<Head title="Release saved datasets" />
<SectionMain>
<SectionTitleLineWithButton :icon="mdiLockOpen" title="Release your dataset for Editor" main>
<BaseButton
:route-name="stardust.route('dataset.list')"
:icon="mdiArrowLeftBoldOutline"
label="Back"
color="white"
rounded-full
small
/>
</SectionTitleLineWithButton>
<CardBox form @submit.prevent="handleSubmit">
<FormValidationErrors v-bind:errors="errors" />
<div class="lex flex-col md:flex-row mb-3">
<label for="elevation-option-one" class="pure-radio">
<input id="elevation-option-one" type="radio" v-model="form.preferation" value="yes_preferation" />
preferred reviewer
</label>
<label for="elevation-option-two" class="pure-radio">
<input id="elevation-option-two" type="radio" v-model="form.preferation" value="no_preferation" />
no preferred reviewer
</label>
</div>
<div v-if="isPreferationRequired == true">
<FormField label="preferred reviewer" :class="{ 'text-red-400': form.errors.preferred_reviewer }">
<FormControl
v-model="form.preferred_reviewer"
type="text"
placeholder="-- enter name of preferred reviewer --"
required
:error="form.errors.preferred_reviewer"
>
<div class="text-red-400 text-sm" v-if="form.errors.preferred_reviewer">
{{ form.errors.preferred_reviewer }}
</div>
</FormControl>
</FormField>
<FormField label="reviewer email" :class="{ 'text-red-400': form.errors.preferred_reviewer_email }">
<FormControl
v-model="form.preferred_reviewer_email"
type="text"
placeholder="-- enter email of reviewer --"
required
:error="form.errors.preferred_reviewer_email"
>
<div class="text-red-400 text-sm" v-if="form.errors.preferred_reviewer_email">
{{ form.errors.preferred_reviewer_email }}
</div>
</FormControl>
</FormField>
</div>
<!-- <NotificationBar v-if="flash && flash.message" color="warning" :icon="mdiAlertBoxOutline">
{{ flash.message }}
class="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4"
</NotificationBar> -->
<div v-if="flash && flash.message" class="flex flex-col mt-6 animate-fade-in">
<div class="bg-yellow-500 border-l-4 border-orange-400 text-white p-4" role="alert">
<p class="font-bold">Be Warned</p>
<p>{{ flash.message }}</p>
</div>
</div>
<template #footer>
<BaseButtons>
<BaseButton
type="submit"
color="info"
label="Release"
:class="{ 'opacity-25': form.processing }"
:disabled="form.processing"
/>
</BaseButtons>
</template>
</CardBox>
</SectionMain>
</LayoutAuthenticated>
</template>

View File

@ -1,14 +1,11 @@
import { defineStore } from 'pinia';
// import axios from 'axios';
export const MapService = defineStore('map', {
state: () => ({
// dataset: {} as Dataset,
mapService: new Map<string, any>(),
}),
actions: {
// payload = authenticated user
@ -30,7 +27,6 @@ export const MapService = defineStore('map', {
setMap(id: string, map) {
this.mapService.set(id, map);
},
hasMap(id: string): boolean {
@ -40,7 +36,5 @@ export const MapService = defineStore('map', {
deleteMap(id: string): boolean {
return this.mapService.delete(id);
},
},
});

View File

@ -48,9 +48,7 @@ export const StyleService = defineStore('style', {
if (typeof document !== 'undefined') {
document.body.classList[this.darkMode ? 'add' : 'remove']('dark-scrollbars');
document.documentElement.classList[this.darkMode ? 'add' : 'remove'](
'dark-scrollbars-compat'
);
document.documentElement.classList[this.darkMode ? 'add' : 'remove']('dark-scrollbars-compat');
}
},
},

View File

@ -8,14 +8,12 @@ export const TimeService = defineStore('map', {
mapService: new Map<string, any>(),
}),
actions: {
getMap(id: string) {
return this.mapService.get(id);
},
setMap(id: string, map) {
this.mapService.set(id, map);
},
hasMap(id: string): boolean {
@ -31,7 +29,5 @@ export const TimeService = defineStore('map', {
// const to = dayjs(timespan.to);
// return dayjs.duration(to.diff(from));
// },
},
});

View File

@ -58,10 +58,7 @@ const layoutService = LayoutService(pinia);
styleService.setStyle(localStorage[styleKey] ?? 'basic');
/* Dark mode */
if (
(!localStorage[darkModeKey] && window.matchMedia('(prefers-color-scheme: dark)').matches) ||
localStorage[darkModeKey] === '1'
) {
if ((!localStorage[darkModeKey] && window.matchMedia('(prefers-color-scheme: dark)').matches) || localStorage[darkModeKey] === '1') {
styleService.setDarkMode(true);
}

View File

@ -51,12 +51,9 @@ export const getButtonColor = (color, isOutlined, hasHover) => {
white: 'hover:bg-gray-50',
contrast: 'hover:bg-gray-900 hover:dark:bg-slate-100',
light: 'hover:bg-gray-200',
success:
'hover:bg-emerald-700 hover:border-emerald-700 hover:dark:bg-emerald-600 hover:dark:border-emerald-600',
danger:
'hover:bg-red-700 hover:border-red-700 hover:dark:bg-red-600 hover:dark:border-red-600',
warning:
'hover:bg-yellow-700 hover:border-yellow-700 hover:dark:bg-yellow-600 hover:dark:border-yellow-600',
success: 'hover:bg-emerald-700 hover:border-emerald-700 hover:dark:bg-emerald-600 hover:dark:border-emerald-600',
danger: 'hover:bg-red-700 hover:border-red-700 hover:dark:bg-red-600 hover:dark:border-red-600',
warning: 'hover:bg-yellow-700 hover:border-yellow-700 hover:dark:bg-yellow-600 hover:dark:border-yellow-600',
info: 'hover:bg-blue-700 hover:border-blue-700 hover:dark:bg-blue-600 hover:dark:border-blue-600',
modern: 'hover:bg-emerald-700 hover:border-emerald-700 hover:dark:bg-emerald-600 hover:dark:border-emerald-600',
},
@ -82,15 +79,11 @@ export const getButtonColor = (color, isOutlined, hasHover) => {
},
outlineHover: {
white: 'hover:bg-gray-100 hover:text-gray-900 dark:hover:text-slate-900',
contrast:
'hover:bg-gray-800 hover:text-gray-100 hover:dark:bg-slate-100 hover:dark:text-black',
contrast: 'hover:bg-gray-800 hover:text-gray-100 hover:dark:bg-slate-100 hover:dark:text-black',
light: 'hover:bg-gray-100 hover:text-gray-900 dark:hover:text-slate-900',
success:
'hover:bg-emerald-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-emerald-600',
danger:
'hover:bg-red-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-red-600',
warning:
'hover:bg-yellow-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-yellow-600',
success: 'hover:bg-emerald-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-emerald-600',
danger: 'hover:bg-red-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-red-600',
warning: 'hover:bg-yellow-600 hover:text-white hover:text-white hover:dark:text-white hover:dark:border-yellow-600',
info: 'hover:bg-blue-600 hover:text-white hover:dark:text-white hover:dark:border-blue-600',
modern: 'hover:bg-teal-600 hover:text-teal hover:dark:bg-teal-100 hover:dark:text-black',
},

View File

@ -1,5 +1,5 @@
export const darkModeKey = "darkMode";
export const darkModeKey = 'darkMode';
export const styleKey = "style";
export const styleKey = 'style';
export const containerMaxW = "xl:max-w-6xl xl:mx-auto";
export const containerMaxW = 'xl:max-w-6xl xl:mx-auto';

View File

@ -1,10 +1,4 @@
import {
mdiMonitor,
mdiGithub,
mdiAccountEye,
mdiAccountGroup,
mdiDatabasePlus,
} from '@mdi/js';
import { mdiMonitor, mdiGithub, mdiAccountEye, mdiAccountGroup, mdiDatabasePlus } from '@mdi/js';
export default [
{
@ -32,11 +26,28 @@ export default [
icon: mdiAccountEye,
label: 'Roles',
},
{
// route: 'dataset.create',
icon: mdiDatabasePlus,
label: 'Submitter',
children: [
{
route: 'dataset.list',
icon: mdiDatabasePlus,
label: 'All my datasets',
},
{
route: 'dataset.create',
icon: mdiDatabasePlus,
label: 'Create Dataset',
},
],
},
// {
// route: 'dataset.create',
// icon: mdiDatabasePlus,
// label: 'Create Dataset',
// },
{
href: 'https://gitea.geologie.ac.at/geolba/tethys',
icon: mdiGithub,

View File

@ -138,6 +138,7 @@ Route.post('/edit-account-info/store/:id', 'UsersController.accountInfoStore')
Route.group(() => {
// Route.get('/user', 'UsersController.index').as('user.index');
Route.get('/dataset', 'DatasetController.index').as('dataset.list').middleware(['auth']); //.middleware(['can:dataset-list']);
Route.get('/dataset/create', 'DatasetController.create').as('dataset.create').middleware(['auth', 'can:dataset-submit']);
Route.post('/dataset/first/first-step', 'DatasetController.firstStep')
.as('dataset.first.step')
@ -151,6 +152,14 @@ Route.group(() => {
Route.post('/dataset/submit', 'DatasetController.store').as('dataset.submit').middleware(['auth', 'can:dataset-submit']);
Route.get('/dataset/:id/release', 'DatasetController.release')
.as('dataset.release')
.where('id', Route.matchers.number())
.middleware(['auth', 'can:dataset-submit']);
Route.put('/dataset/:id/releaseupdate', 'DatasetController.releaseUpdate')
.as('dataset.releaseUpdate')
.middleware(['auth', 'can:dataset-submit']);
// Route.get('/user/:id', 'UsersController.show').as('user.show').where('id', Route.matchers.number());
// Route.get('/user/:id/edit', 'UsersController.edit').as('user.edit').where('id', Route.matchers.number());
// Route.put('/user/:id/update', 'UsersController.update').as('user.update').where('id', Route.matchers.number());

View File

@ -5,4 +5,3 @@ test.group('Home', () => {
assert.equal(2 + 2, 4);
});
});