- 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
|
@ -13,7 +13,7 @@ import { DateTime } from 'luxon';
|
||||||
import Index from '#app/Library/Utils/Index';
|
import Index from '#app/Library/Utils/Index';
|
||||||
import { getDomain } from '#app/Utils/utility-functions';
|
import { getDomain } from '#app/Utils/utility-functions';
|
||||||
import { DoiClient } from '#app/Library/Doi/DoiClient';
|
import { DoiClient } from '#app/Library/Doi/DoiClient';
|
||||||
import DoiClientException from '#app/Exceptions/DoiClientException';
|
import DoiClientException from '#app/exceptions/DoiClientException';
|
||||||
import logger from '@adonisjs/core/services/logger';
|
import logger from '@adonisjs/core/services/logger';
|
||||||
import { HttpException } from 'node-exceptions';
|
import { HttpException } from 'node-exceptions';
|
||||||
import { ModelQueryBuilderContract } from "@adonisjs/lucid/types/model";
|
import { ModelQueryBuilderContract } from "@adonisjs/lucid/types/model";
|
||||||
|
|
|
@ -10,8 +10,8 @@ import { readFileSync } from 'fs';
|
||||||
import { StatusCodes } from 'http-status-codes';
|
import { StatusCodes } from 'http-status-codes';
|
||||||
import SaxonJS from 'saxon-js';
|
import SaxonJS from 'saxon-js';
|
||||||
// import { Xslt, xmlParse } from 'xslt-processor'
|
// import { Xslt, xmlParse } from 'xslt-processor'
|
||||||
import { OaiErrorCodes, OaiModelError } from '#app/Exceptions/OaiErrorCodes';
|
import { OaiErrorCodes, OaiModelError } from '#app/exceptions/OaiErrorCodes';
|
||||||
import { OaiModelException, BadOaiModelException } from '#app/Exceptions/OaiModelException';
|
import { OaiModelException, BadOaiModelException } from '#app/exceptions/OaiModelException';
|
||||||
import Dataset from '#app/Models/Dataset';
|
import Dataset from '#app/Models/Dataset';
|
||||||
import Collection from '#app/Models/Collection';
|
import Collection from '#app/Models/Collection';
|
||||||
import { getDomain, preg_match } from '#app/Utils/utility-functions';
|
import { getDomain, preg_match } from '#app/Utils/utility-functions';
|
||||||
|
|
|
@ -154,7 +154,7 @@ export default class DatasetController {
|
||||||
rights: schema.string([rules.equalTo('true')]),
|
rights: schema.string([rules.equalTo('true')]),
|
||||||
});
|
});
|
||||||
|
|
||||||
await request.validate({ schema: newDatasetSchema, messages: this.messages });
|
// await request.validate({ schema: newDatasetSchema, messages: this.messages });
|
||||||
try {
|
try {
|
||||||
// Step 2 - Validate request body against the schema
|
// Step 2 - Validate request body against the schema
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// import { Log } from '@adonisjs/core/build/standalone';
|
// import { Log } from '@adonisjs/core/build/standalone';
|
||||||
// import { DoiInterface } from './interfaces/DoiInterface';
|
// import { DoiInterface } from './interfaces/DoiInterface';
|
||||||
import DoiClientContract from '#app/Library/Doi/DoiClientContract';
|
import DoiClientContract from '#app/Library/Doi/DoiClientContract';
|
||||||
import DoiClientException from '#app/Exceptions/DoiClientException';
|
import DoiClientException from '#app/exceptions/DoiClientException';
|
||||||
import { StatusCodes } from 'http-status-codes';
|
import { StatusCodes } from 'http-status-codes';
|
||||||
import logger from '@adonisjs/core/services/logger';
|
import logger from '@adonisjs/core/services/logger';
|
||||||
import { AxiosResponse } from 'axios';
|
import { AxiosResponse } from 'axios';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import ResumptionToken from './ResumptionToken.js';
|
import ResumptionToken from './ResumptionToken.js';
|
||||||
import { createClient, RedisClientType } from 'redis';
|
import { createClient, RedisClientType } from 'redis';
|
||||||
import InternalServerErrorException from '#app/Exceptions/InternalServerException';
|
import InternalServerErrorException from '#app/exceptions/InternalServerException';
|
||||||
import { sprintf } from 'sprintf-js';
|
import { sprintf } from 'sprintf-js';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import TokenWorkerContract from './TokenWorkerContract.js';
|
import TokenWorkerContract from './TokenWorkerContract.js';
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
// import db from '@adonisjs/lucid/services/db';
|
|
||||||
// // import Config from '@ioc:Adonis/Core/Config';
|
|
||||||
// import config from '@adonisjs/core/services/config';
|
|
||||||
// import { QueryClientContract } from "@adonisjs/lucid/types/database";
|
|
||||||
// import { TransactionClientContract } from "@adonisjs/lucid/types/database";
|
|
||||||
|
|
||||||
// export function getUserRoles(userId: number, trx?: TransactionClientContract): Promise<Array<string>> {
|
|
||||||
// const { userRole } = config.get('acl.joinTables');
|
|
||||||
// return ((trx || db) as QueryClientContract | TransactionClientContract)
|
|
||||||
// .query()
|
|
||||||
// .from('roles')
|
|
||||||
// .distinct('roles.slug')
|
|
||||||
// .leftJoin(userRole, `${userRole}.role_id`, 'roles.id')
|
|
||||||
// .where(`${userRole}.user_id`, userId)
|
|
||||||
// .then((res) => {
|
|
||||||
// return res.map((r) => r.slug);
|
|
||||||
// });
|
|
||||||
// }
|
|
|
@ -29,7 +29,7 @@ export default class HttpExceptionHandler extends ExceptionHandler {
|
||||||
* codes. You might want to enable them in production only, but feel
|
* codes. You might want to enable them in production only, but feel
|
||||||
* free to enable them in development as well.
|
* free to enable them in development as well.
|
||||||
*/
|
*/
|
||||||
protected renderStatusPages = app.inProduction;
|
protected renderStatusPages = true; //app.inProduction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Status pages is a collection of error code range and a callback
|
* Status pages is a collection of error code range and a callback
|
||||||
|
@ -68,7 +68,7 @@ export default class HttpExceptionHandler extends ExceptionHandler {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public async handle(error: any, ctx: HttpContext) {
|
public async handle(error: any, ctx: HttpContext) {
|
||||||
// const { response, request, session, inertia } = ctx;
|
const { response, request, session, inertia } = ctx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle failed authentication attempt
|
* Handle failed authentication attempt
|
||||||
|
@ -86,17 +86,18 @@ export default class HttpExceptionHandler extends ExceptionHandler {
|
||||||
// let test = response.getStatus(); //200
|
// let test = response.getStatus(); //200
|
||||||
// let header = request.header('X-Inertia'); // true
|
// let header = request.header('X-Inertia'); // true
|
||||||
// if (request.header('X-Inertia') && [500, 503, 404, 403, 401, 200].includes(response.getStatus())) {
|
// if (request.header('X-Inertia') && [500, 503, 404, 403, 401, 200].includes(response.getStatus())) {
|
||||||
// // session.flash('errors', error.messages.errors);
|
if (request.header('X-Inertia') && [422].includes(error.status)) {
|
||||||
// session.flash('errors', error.messages);
|
// session.flash('errors', error.messages.errors);
|
||||||
// return response.redirect().back();
|
session.flash('errors', error.messages);
|
||||||
// // return inertia.render('errors/server_error', {
|
return response.redirect().back();
|
||||||
// // return inertia.render('errors/server_error', {
|
// return inertia.render('errors/server_error', {
|
||||||
// // // status: response.getStatus(),
|
// return inertia.render('errors/server_error', {
|
||||||
// // error: error,
|
// // status: response.getStatus(),
|
||||||
// // });
|
// error: error,
|
||||||
// // ->toResponse($request)
|
// });
|
||||||
// // ->setStatusCode($response->status());
|
// ->toResponse($request)
|
||||||
// }
|
// ->setStatusCode($response->status());
|
||||||
|
}
|
||||||
// Dynamically change the error templates based on the absence of X-Inertia header
|
// Dynamically change the error templates based on the absence of X-Inertia header
|
||||||
// if (!ctx.request.header('X-Inertia')) {
|
// if (!ctx.request.header('X-Inertia')) {
|
||||||
// this.statusPages = {
|
// this.statusPages = {
|
|
@ -11,37 +11,37 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata';
|
||||||
import { Ignitor, prettyPrintError } from '@adonisjs/core'
|
import { Ignitor, prettyPrintError } from '@adonisjs/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the application root. AdonisJS need it to resolve
|
* URL to the application root. AdonisJS need it to resolve
|
||||||
* paths to file and directories for scaffolding commands
|
* paths to file and directories for scaffolding commands
|
||||||
*/
|
*/
|
||||||
const APP_ROOT = new URL('../', import.meta.url)
|
const APP_ROOT = new URL('../', import.meta.url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The importer is used to import files in context of the
|
* The importer is used to import files in context of the
|
||||||
* application.
|
* application.
|
||||||
*/
|
*/
|
||||||
const IMPORTER = (filePath: string) => {
|
const IMPORTER = (filePath: string) => {
|
||||||
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
||||||
return import(new URL(filePath, APP_ROOT).href)
|
return import(new URL(filePath, APP_ROOT).href);
|
||||||
}
|
}
|
||||||
return import(filePath)
|
return import(filePath);
|
||||||
}
|
};
|
||||||
|
|
||||||
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
||||||
.tap((app) => {
|
.tap((app) => {
|
||||||
app.booting(async () => {
|
app.booting(async () => {
|
||||||
await import('#start/env')
|
await import('#start/env');
|
||||||
|
});
|
||||||
|
app.listen('SIGTERM', () => app.terminate());
|
||||||
|
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
|
||||||
})
|
})
|
||||||
app.listen('SIGTERM', () => app.terminate())
|
.ace()
|
||||||
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate())
|
.handle(process.argv.splice(2))
|
||||||
})
|
.catch((error) => {
|
||||||
.ace()
|
process.exitCode = 1;
|
||||||
.handle(process.argv.splice(2))
|
prettyPrintError(error);
|
||||||
.catch((error) => {
|
});
|
||||||
process.exitCode = 1
|
|
||||||
prettyPrintError(error)
|
|
||||||
})
|
|
||||||
|
|
|
@ -9,37 +9,37 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata';
|
||||||
import { Ignitor, prettyPrintError } from '@adonisjs/core'
|
import { Ignitor, prettyPrintError } from '@adonisjs/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the application root. AdonisJS need it to resolve
|
* URL to the application root. AdonisJS need it to resolve
|
||||||
* paths to file and directories for scaffolding commands
|
* paths to file and directories for scaffolding commands
|
||||||
*/
|
*/
|
||||||
const APP_ROOT = new URL('../', import.meta.url)
|
const APP_ROOT = new URL('../', import.meta.url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The importer is used to import files in context of the
|
* The importer is used to import files in context of the
|
||||||
* application.
|
* application.
|
||||||
*/
|
*/
|
||||||
const IMPORTER = (filePath: string) => {
|
const IMPORTER = (filePath: string) => {
|
||||||
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
||||||
return import(new URL(filePath, APP_ROOT).href)
|
return import(new URL(filePath, APP_ROOT).href);
|
||||||
}
|
}
|
||||||
return import(filePath)
|
return import(filePath);
|
||||||
}
|
};
|
||||||
|
|
||||||
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
||||||
.tap((app) => {
|
.tap((app) => {
|
||||||
app.booting(async () => {
|
app.booting(async () => {
|
||||||
await import('#start/env')
|
await import('#start/env');
|
||||||
|
});
|
||||||
|
app.listen('SIGTERM', () => app.terminate());
|
||||||
|
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
|
||||||
})
|
})
|
||||||
app.listen('SIGTERM', () => app.terminate())
|
.httpServer()
|
||||||
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate())
|
.start()
|
||||||
})
|
.catch((error) => {
|
||||||
.httpServer()
|
process.exitCode = 1;
|
||||||
.start()
|
prettyPrintError(error);
|
||||||
.catch((error) => {
|
});
|
||||||
process.exitCode = 1
|
|
||||||
prettyPrintError(error)
|
|
||||||
})
|
|
||||||
|
|
66
bin/test.ts
66
bin/test.ts
|
@ -10,53 +10,53 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
process.env.NODE_ENV = 'test'
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata';
|
||||||
import { Ignitor, prettyPrintError } from '@adonisjs/core'
|
import { Ignitor, prettyPrintError } from '@adonisjs/core';
|
||||||
import { configure, processCLIArgs, run } from '@japa/runner'
|
import { configure, processCLIArgs, run } from '@japa/runner';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to the application root. AdonisJS need it to resolve
|
* URL to the application root. AdonisJS need it to resolve
|
||||||
* paths to file and directories for scaffolding commands
|
* paths to file and directories for scaffolding commands
|
||||||
*/
|
*/
|
||||||
const APP_ROOT = new URL('../', import.meta.url)
|
const APP_ROOT = new URL('../', import.meta.url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The importer is used to import files in context of the
|
* The importer is used to import files in context of the
|
||||||
* application.
|
* application.
|
||||||
*/
|
*/
|
||||||
const IMPORTER = (filePath: string) => {
|
const IMPORTER = (filePath: string) => {
|
||||||
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
if (filePath.startsWith('./') || filePath.startsWith('../')) {
|
||||||
return import(new URL(filePath, APP_ROOT).href)
|
return import(new URL(filePath, APP_ROOT).href);
|
||||||
}
|
}
|
||||||
return import(filePath)
|
return import(filePath);
|
||||||
}
|
};
|
||||||
|
|
||||||
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
new Ignitor(APP_ROOT, { importer: IMPORTER })
|
||||||
.tap((app) => {
|
.tap((app) => {
|
||||||
app.booting(async () => {
|
app.booting(async () => {
|
||||||
await import('#start/env')
|
await import('#start/env');
|
||||||
|
});
|
||||||
|
app.listen('SIGTERM', () => app.terminate());
|
||||||
|
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate());
|
||||||
})
|
})
|
||||||
app.listen('SIGTERM', () => app.terminate())
|
.testRunner()
|
||||||
app.listenIf(app.managedByPm2, 'SIGINT', () => app.terminate())
|
.configure(async (app) => {
|
||||||
})
|
const { runnerHooks, ...config } = await import('../tests/bootstrap.js');
|
||||||
.testRunner()
|
|
||||||
.configure(async (app) => {
|
|
||||||
const { runnerHooks, ...config } = await import('../tests/bootstrap.js')
|
|
||||||
|
|
||||||
processCLIArgs(process.argv.splice(2))
|
processCLIArgs(process.argv.splice(2));
|
||||||
configure({
|
configure({
|
||||||
...app.rcFile.tests,
|
...app.rcFile.tests,
|
||||||
...config,
|
...config,
|
||||||
...{
|
...{
|
||||||
setup: runnerHooks.setup,
|
setup: runnerHooks.setup,
|
||||||
teardown: runnerHooks.teardown.concat([() => app.terminate()]),
|
teardown: runnerHooks.teardown.concat([() => app.terminate()]),
|
||||||
},
|
},
|
||||||
|
});
|
||||||
})
|
})
|
||||||
})
|
.run(() => run())
|
||||||
.run(() => run())
|
.catch((error) => {
|
||||||
.catch((error) => {
|
process.exitCode = 1;
|
||||||
process.exitCode = 1
|
prettyPrintError(error);
|
||||||
prettyPrintError(error)
|
});
|
||||||
})
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ export default defineConfig({
|
||||||
* Data that should be shared with all rendered pages
|
* Data that should be shared with all rendered pages
|
||||||
*/
|
*/
|
||||||
sharedData: {
|
sharedData: {
|
||||||
|
//This will be available in all views
|
||||||
|
appName: 'Tethys Cloud',
|
||||||
|
|
||||||
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
|
errors: (ctx) => ctx.session?.flashMessages.get('errors'),
|
||||||
|
|
||||||
user_id: (ctx) => {
|
user_id: (ctx) => {
|
||||||
|
|
173
config/shield.ts
173
config/shield.ts
|
@ -1,134 +1,51 @@
|
||||||
import { defineConfig } from '@adonisjs/shield';
|
import { defineConfig } from '@adonisjs/shield'
|
||||||
|
|
||||||
export default defineConfig({
|
const shieldConfig = defineConfig({
|
||||||
csp: {
|
/**
|
||||||
/*
|
* Configure CSP policies for your app. Refer documentation
|
||||||
|--------------------------------------------------------------------------
|
* to learn more
|
||||||
| Enable/disable CSP
|
*/
|
||||||
|--------------------------------------------------------------------------
|
csp: {
|
||||||
|
|
enabled: false,
|
||||||
| The CSP rules are disabled by default for seamless onboarding.
|
directives: {},
|
||||||
|
|
reportOnly: false,
|
||||||
*/
|
},
|
||||||
enabled: false,
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
* Configure CSRF protection options. Refer documentation
|
||||||
| Directives
|
* to learn more
|
||||||
|--------------------------------------------------------------------------
|
*/
|
||||||
|
|
csrf: {
|
||||||
| All directives are defined in camelCase and here is the list of
|
enabled: true,
|
||||||
| available directives and their possible values.
|
exceptRoutes: [],
|
||||||
|
|
enableXsrfCookie: true,
|
||||||
| https://content-security-policy.com
|
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
||||||
|
|
},
|
||||||
| @example
|
|
||||||
| directives: {
|
|
||||||
| defaultSrc: ["'self'", '@nonce', 'cdnjs.cloudflare.com']
|
|
||||||
| }
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
directives: {},
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
* Control how your website should be embedded inside
|
||||||
| Report only
|
* iFrames
|
||||||
|--------------------------------------------------------------------------
|
*/
|
||||||
|
|
xFrame: {
|
||||||
| Setting `reportOnly=true` will not block the scripts from running and
|
enabled: true,
|
||||||
| instead report them to a URL.
|
action: 'DENY',
|
||||||
|
|
},
|
||||||
*/
|
|
||||||
reportOnly: false,
|
|
||||||
},
|
|
||||||
csrf: {
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Enable/Disable CSRF
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
enabled: true,
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
* Force browser to always use HTTPS
|
||||||
| Routes to Ignore
|
*/
|
||||||
|--------------------------------------------------------------------------
|
hsts: {
|
||||||
|
|
enabled: true,
|
||||||
| Define an array of route patterns that you want to ignore from CSRF
|
maxAge: '180 days',
|
||||||
| validation. Make sure the route patterns are started with a leading
|
},
|
||||||
| slash. Example:
|
|
||||||
|
|
|
||||||
| `/foo/bar`
|
|
||||||
|
|
|
||||||
| Also you can define a function that is evaluated on every HTTP Request.
|
|
||||||
| ```
|
|
||||||
| exceptRoutes: ({ request }) => request.url().includes('/api')
|
|
||||||
| ```
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
exceptRoutes: [],
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|--------------------------------------------------------------------------
|
* Disable browsers from sniffing the content type of a
|
||||||
| Enable Sharing Token Via Cookie
|
* response and always rely on the "content-type" header.
|
||||||
|--------------------------------------------------------------------------
|
*/
|
||||||
|
|
contentTypeSniffing: {
|
||||||
| When the following flag is enabled, AdonisJS will drop `XSRF-TOKEN`
|
enabled: true,
|
||||||
| cookie that frontend frameworks can read and return back as a
|
},
|
||||||
| `X-XSRF-TOKEN` header.
|
})
|
||||||
|
|
|
||||||
| The cookie has `httpOnly` flag set to false, so it is little insecure and
|
|
||||||
| can be turned off when you are not using a frontend framework making
|
|
||||||
| AJAX requests.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
enableXsrfCookie: true,
|
|
||||||
|
|
||||||
/*
|
export default shieldConfig
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Methods to Validate
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Define an array of HTTP methods to be validated for a valid CSRF token.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
|
|
||||||
},
|
|
||||||
hsts: {
|
|
||||||
enabled: true,
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Max Age
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Control, how long the browser should remember that a site is only to be
|
|
||||||
| accessed using HTTPS.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
maxAge: '180 days',
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Include Subdomains
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Apply rules on the subdomains as well.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
includeSubDomains: true,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Preloading
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Google maintains a service to register your domain and it will preload
|
|
||||||
| the HSTS policy. Learn more https://hstspreload.org/
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
preload: false,
|
|
||||||
},
|
|
||||||
contentTypeSniffing: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
850
package-lock.json
generated
850
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -49,7 +49,6 @@
|
||||||
"@types/source-map-support": "^0.5.6",
|
"@types/source-map-support": "^0.5.6",
|
||||||
"@types/sprintf-js": "^1.1.4",
|
"@types/sprintf-js": "^1.1.4",
|
||||||
"@types/supertest": "^6.0.2",
|
"@types/supertest": "^6.0.2",
|
||||||
"@vue/tsconfig": "^0.4.0",
|
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.13",
|
||||||
"babel-preset-typescript-vue3": "^2.0.17",
|
"babel-preset-typescript-vue3": "^2.0.17",
|
||||||
"chart.js": "^4.2.0",
|
"chart.js": "^4.2.0",
|
||||||
|
@ -69,7 +68,7 @@
|
||||||
"ts-loader": "^9.4.2",
|
"ts-loader": "^9.4.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.1.3",
|
"typescript": "^5.1.3",
|
||||||
"vue": "^3.2.47",
|
"vue": "^3.4.26",
|
||||||
"vue-facing-decorator": "^3.0.0",
|
"vue-facing-decorator": "^3.0.0",
|
||||||
"vue-loader": "^17.0.1",
|
"vue-loader": "^17.0.1",
|
||||||
"xslt3": "^2.5.0"
|
"xslt3": "^2.5.0"
|
||||||
|
@ -120,12 +119,12 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"imports": {
|
"imports": {
|
||||||
"#controllers/*": "./app/Controllers/*.js",
|
"#controllers/*": "./app/Controllers/*.js",
|
||||||
"#exceptions/*": "./app/Exceptions/*.js",
|
"#exceptions/*": "./app/exceptions/*.js",
|
||||||
"#models/*": "./app/Models/*.js",
|
"#models/*": "./app/Models/*.js",
|
||||||
"#services/*": "./app/services/*.js",
|
"#services/*": "./app/services/*.js",
|
||||||
"#listeners/*": "./app/listeners/*.js",
|
"#listeners/*": "./app/listeners/*.js",
|
||||||
"#events/*": "./app/events/*.js",
|
"#events/*": "./app/events/*.js",
|
||||||
"#middleware/*": "./app/Middleware/*.js",
|
"#middleware/*": "./app/middleware/*.js",
|
||||||
"#validators/*": "./app/Validators/*.js",
|
"#validators/*": "./app/Validators/*.js",
|
||||||
"#start/*": "./start/*.js",
|
"#start/*": "./start/*.js",
|
||||||
"#config/*": "./config/*.js",
|
"#config/*": "./config/*.js",
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
"assets/resources_js_Components_Admin_Pagination_vue-resources_js_Components_BaseButtons_vue-resource-8134e7.js": "http://localhost:8080/assets/resources_js_Components_Admin_Pagination_vue-resources_js_Components_BaseButtons_vue-resource-8134e7.js",
|
"assets/resources_js_Components_Admin_Pagination_vue-resources_js_Components_BaseButtons_vue-resource-8134e7.js": "http://localhost:8080/assets/resources_js_Components_Admin_Pagination_vue-resources_js_Components_BaseButtons_vue-resource-8134e7.js",
|
||||||
"assets/resources_js_Components_Map_draw_component_vue-resources_js_Components_Map_zoom_component_vue-196747.js": "http://localhost:8080/assets/resources_js_Components_Map_draw_component_vue-resources_js_Components_Map_zoom_component_vue-196747.js",
|
"assets/resources_js_Components_Map_draw_component_vue-resources_js_Components_Map_zoom_component_vue-196747.js": "http://localhost:8080/assets/resources_js_Components_Map_draw_component_vue-resources_js_Components_Map_zoom_component_vue-196747.js",
|
||||||
"assets/resources_js_Components_Admin_Sort_vue-resources_js_Components_SectionTitleLineWithButton_vue.js": "http://localhost:8080/assets/resources_js_Components_Admin_Sort_vue-resources_js_Components_SectionTitleLineWithButton_vue.js",
|
"assets/resources_js_Components_Admin_Sort_vue-resources_js_Components_SectionTitleLineWithButton_vue.js": "http://localhost:8080/assets/resources_js_Components_Admin_Sort_vue-resources_js_Components_SectionTitleLineWithButton_vue.js",
|
||||||
"assets/resources_js_Components_CardBoxModal_vue.js": "http://localhost:8080/assets/resources_js_Components_CardBoxModal_vue.js",
|
|
||||||
"assets/resources_js_Components_FileUpload_vue-resources_js_Components_FormCheckRadioGroup_vue-resour-d5e5fc.js": "http://localhost:8080/assets/resources_js_Components_FileUpload_vue-resources_js_Components_FormCheckRadioGroup_vue-resour-d5e5fc.js",
|
"assets/resources_js_Components_FileUpload_vue-resources_js_Components_FormCheckRadioGroup_vue-resour-d5e5fc.js": "http://localhost:8080/assets/resources_js_Components_FileUpload_vue-resources_js_Components_FormCheckRadioGroup_vue-resour-d5e5fc.js",
|
||||||
"assets/fonts/inter-latin-ext-400-normal.woff": "http://localhost:8080/assets/fonts/inter-latin-ext-400-normal.40b3b0d5.woff",
|
"assets/fonts/inter-latin-ext-400-normal.woff": "http://localhost:8080/assets/fonts/inter-latin-ext-400-normal.40b3b0d5.woff",
|
||||||
"assets/fonts/inter-latin-ext-400-normal.woff2": "http://localhost:8080/assets/fonts/inter-latin-ext-400-normal.0f9e8d4e.woff2",
|
"assets/fonts/inter-latin-ext-400-normal.woff2": "http://localhost:8080/assets/fonts/inter-latin-ext-400-normal.0f9e8d4e.woff2",
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Link, usePage } from '@inertiajs/vue3';
|
||||||
|
|
||||||
import { StyleService } from '@/Stores/style.service';
|
import { StyleService } from '@/Stores/style.service';
|
||||||
import { mdiMinus, mdiPlus } from '@mdi/js';
|
import { mdiMinus, mdiPlus } from '@mdi/js';
|
||||||
import { getButtonColor } from '@/colors.js';
|
import { getButtonColor } from '@/colors';
|
||||||
import BaseIcon from '@/Components/BaseIcon.vue';
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
||||||
// import AsideMenuList from '@/Components/AsideMenuList.vue';
|
// import AsideMenuList from '@/Components/AsideMenuList.vue';
|
||||||
import { stardust } from '@eidellev/adonis-stardust/client';
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { Link } from '@inertiajs/vue3';
|
import { Link } from '@inertiajs/vue3';
|
||||||
// import { Link } from '@inertiajs/inertia-vue3';
|
// import { Link } from '@inertiajs/inertia-vue3';
|
||||||
import { getButtonColor } from '@/colors.js';
|
import { getButtonColor } from '@/colors';
|
||||||
import BaseIcon from '@/Components/BaseIcon.vue';
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { containerMaxW } from '@/config.js';
|
import { containerMaxW } from '@/config';
|
||||||
import BaseLevel from '@/Components/BaseLevel.vue';
|
import BaseLevel from '@/Components/BaseLevel.vue';
|
||||||
import JustboilLogo from '@/Components/JustboilLogo.vue';
|
import JustboilLogo from '@/Components/JustboilLogo.vue';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, useSlots } from 'vue';
|
import { computed, useSlots } from 'vue';
|
||||||
|
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
label: {
|
label: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { colorsText, colorsBgLight } from '@/colors.js';
|
import { colorsText, colorsBgLight } from '@/colors';
|
||||||
import BaseIcon from '@/Components/BaseIcon.vue';
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
import { usePage, router } from '@inertiajs/vue3';
|
import { usePage, router } from '@inertiajs/vue3';
|
||||||
// import { usePage } from '@inertiajs/inertia-vue3';
|
// import { usePage } from '@inertiajs/inertia-vue3';
|
||||||
// import { Inertia } from '@inertiajs/inertia';
|
// import { Inertia } from '@inertiajs/inertia';
|
||||||
import { ComputedRef } from 'vue';
|
import type { ComputedRef } from 'vue';
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { containerMaxW } from '@/config.js';
|
import { containerMaxW } from '@/config';
|
||||||
import { StyleService } from '@/Stores/style.service';
|
import { StyleService } from '@/Stores/style.service';
|
||||||
import { LayoutService } from '@/Stores/layout';
|
import { LayoutService } from '@/Stores/layout';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, useSlots } from 'vue';
|
import { ref, computed, useSlots } from 'vue';
|
||||||
import { mdiClose } from '@mdi/js';
|
import { mdiClose } from '@mdi/js';
|
||||||
import { colorsBgLight, colorsOutline } from '@/colors.js';
|
import { colorsBgLight, colorsOutline } from '@/colors';
|
||||||
import BaseLevel from '@/Components/BaseLevel.vue';
|
import BaseLevel from '@/Components/BaseLevel.vue';
|
||||||
import BaseIcon from '@/Components/BaseIcon.vue';
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
||||||
import BaseButton from '@/Components/BaseButton.vue';
|
import BaseButton from '@/Components/BaseButton.vue';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { colorsBgLight } from '@/colors.js';
|
import { colorsBgLight } from '@/colors';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
color: {
|
color: {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { colorsBgLight, colorsOutline } from '@/colors.js';
|
import { colorsBgLight, colorsOutline } from '@/colors';
|
||||||
import BaseIcon from '@/Components/BaseIcon.vue';
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { containerMaxW } from '@/config.js';
|
import { containerMaxW } from '@/config';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -19,7 +19,10 @@ export interface Role {
|
||||||
created_at: DateTime;
|
created_at: DateTime;
|
||||||
updated_at: DateTime;
|
updated_at: DateTime;
|
||||||
}
|
}
|
||||||
|
export interface License {
|
||||||
|
id: any;
|
||||||
|
// Add other properties as needed
|
||||||
|
}
|
||||||
export interface Dataset {
|
export interface Dataset {
|
||||||
[key: string]:
|
[key: string]:
|
||||||
| string
|
| string
|
||||||
|
@ -33,9 +36,10 @@ export interface Dataset {
|
||||||
| Coverage
|
| Coverage
|
||||||
| Array<DatasetReference>
|
| Array<DatasetReference>
|
||||||
| Array<File>
|
| Array<File>
|
||||||
| (Array<number> | Array<Object>);
|
| (Array<number> | Array<License>)
|
||||||
|
| Array<TethysFile>;
|
||||||
language: string;
|
language: string;
|
||||||
licenses: Array<number> | Array<Object>;
|
licenses: Array<number> | Array<License>;
|
||||||
rights: boolean;
|
rights: boolean;
|
||||||
type: string;
|
type: string;
|
||||||
creating_corporation: string;
|
creating_corporation: string;
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default {
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue, Prop } from 'vue-facing-decorator';
|
import { Component, Vue, Prop } from 'vue-facing-decorator';
|
||||||
import type User from 'App/Models/User';
|
import type User from '#app/Models/User';
|
||||||
import { Link } from '@inertiajs/vue3';
|
import { Link } from '@inertiajs/vue3';
|
||||||
import DefaultLayout from '@/Layouts/Default.vue';
|
import DefaultLayout from '@/Layouts/Default.vue';
|
||||||
// import { NInput, NButton } from 'naive-ui';
|
// import { NInput, NButton } from 'naive-ui';
|
||||||
|
|
|
@ -31,13 +31,13 @@ const mainService = MainService()
|
||||||
|
|
||||||
// const chartData = ref();
|
// const chartData = ref();
|
||||||
const fillChartData = async () => {
|
const fillChartData = async () => {
|
||||||
await mainService.fetchChartData(2022);
|
await mainService.fetchChartData("2022");
|
||||||
// chartData.value = chartConfig.sampleChartData();
|
// chartData.value = chartConfig.sampleChartData();
|
||||||
// chartData.value = mainService.graphData;
|
// chartData.value = mainService.graphData;
|
||||||
};
|
};
|
||||||
const chartData = computed(() => mainService.graphData);
|
const chartData = computed(() => mainService.graphData);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await mainService.fetchChartData(2022);
|
await mainService.fetchChartData("2022");
|
||||||
});
|
});
|
||||||
;
|
;
|
||||||
/* Fetch sample data */
|
/* Fetch sample data */
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
<div class="flex flex-col md:flex-row">
|
<div class="flex flex-col md:flex-row">
|
||||||
<!-- (1) language field -->
|
<!-- (1) language field -->
|
||||||
<FormField label="Language *" help="required: select dataset main language"
|
<FormField label="Language *" help="required: select dataset main language"
|
||||||
:class="{ 'text-red-400': errors.language }" class="w-full flex-1">
|
:class="{ 'text-red-400': form.errors.language }" class="w-full flex-1">
|
||||||
<FormControl required v-model="form.language" :type="'select'" placeholder="[Enter Language]"
|
<FormControl required v-model="form.language" :type="'select'"
|
||||||
:errors="form.errors.language" :options="{ de: 'de', en: 'en' }">
|
placeholder="[Enter Language]" :errors="form.errors.language"
|
||||||
|
:options="{ de: 'de', en: 'en' }">
|
||||||
<div class="text-red-400 text-sm" v-if="form.errors.language">
|
<div class="text-red-400 text-sm" v-if="form.errors.language">
|
||||||
{{ form.errors.language.join(', ') }}
|
{{ form.errors.language.join(', ') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
<FormField label="Dataset Type *" help="required: dataset type"
|
<FormField label="Dataset Type *" help="required: dataset type"
|
||||||
:class="{ 'text-red-400': form.errors.type }" class="w-full mx-2 flex-1">
|
: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 --"
|
<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"
|
<div class="text-red-400 text-sm"
|
||||||
v-if="form.errors.type && Array.isArray(form.errors.type)">
|
v-if="form.errors.type && Array.isArray(form.errors.type)">
|
||||||
{{ form.errors.type.join(', ') }}
|
{{ form.errors.type.join(', ') }}
|
||||||
|
@ -86,8 +87,10 @@
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Main Title Language*" help="required: main title language"
|
<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">
|
:class="{ 'text-red-400': form.errors['titles.0.language'] }"
|
||||||
<FormControl required v-model="form.titles[0].language" type="text" :is-read-only="true">
|
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"
|
<div class="text-red-400 text-sm"
|
||||||
v-if="form.errors['titles.0.language'] && Array.isArray(form.errors['titles.0.language'])">
|
v-if="form.errors['titles.0.language'] && Array.isArray(form.errors['titles.0.language'])">
|
||||||
{{ form.errors['titles.0.language'].join(', ') }}
|
{{ form.errors['titles.0.language'].join(', ') }}
|
||||||
|
@ -157,7 +160,8 @@
|
||||||
:header-icon="mdiPlusCircle" v-on:header-icon-click="addDescription()">
|
:header-icon="mdiPlusCircle" v-on:header-icon-click="addDescription()">
|
||||||
<div class="flex flex-col md:flex-row">
|
<div class="flex flex-col md:flex-row">
|
||||||
<FormField label="Main Abstract *" help="required: main abstract"
|
<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"
|
<FormControl required v-model="form.descriptions[0].value" type="textarea"
|
||||||
placeholder="[enter main abstract]">
|
placeholder="[enter main abstract]">
|
||||||
<div class="text-red-400 text-sm"
|
<div class="text-red-400 text-sm"
|
||||||
|
@ -172,7 +176,7 @@
|
||||||
<FormControl required v-model="form.descriptions[0].language" type="text"
|
<FormControl required v-model="form.descriptions[0].language" type="text"
|
||||||
:is-read-only="true">
|
: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'])
|
<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(', ') }}
|
{{ form.errors['descriptions.0.language'].join(', ') }}
|
||||||
</div>
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
@ -211,8 +215,9 @@
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</td>
|
</td>
|
||||||
<td data-label="Description Language">
|
<td data-label="Description Language">
|
||||||
<FormControl required v-model="form.descriptions[index].language" type="select"
|
<FormControl required v-model="form.descriptions[index].language"
|
||||||
:options="{ de: 'de', en: 'en' }" placeholder="[select title language]">
|
type="select" :options="{ de: 'de', en: 'en' }"
|
||||||
|
placeholder="[select title language]">
|
||||||
<div class="text-red-400 text-sm"
|
<div class="text-red-400 text-sm"
|
||||||
v-if="form.errors[`descriptions.${index}.language`]">
|
v-if="form.errors[`descriptions.${index}.language`]">
|
||||||
{{ form.errors[`descriptions.${index}.language`].join(', ') }}
|
{{ form.errors[`descriptions.${index}.language`].join(', ') }}
|
||||||
|
@ -223,7 +228,8 @@
|
||||||
<BaseButtons type="justify-start lg:justify-end" no-wrap>
|
<BaseButtons type="justify-start lg:justify-end" no-wrap>
|
||||||
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
|
<!-- <BaseButton color="info" :icon="mdiEye" small @click="isModalActive = true" /> -->
|
||||||
<BaseButton color="danger" :icon="mdiTrashCan" small
|
<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>
|
</BaseButtons>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -238,8 +244,8 @@
|
||||||
placeholder="search in person table...." v-on:person="onAddAuthor"></SearchAutocomplete>
|
placeholder="search in person table...." v-on:person="onAddAuthor"></SearchAutocomplete>
|
||||||
|
|
||||||
<TablePersons :persons="form.authors" v-if="form.authors.length > 0" />
|
<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)">
|
<div class="text-red-400 text-sm" v-if="form.errors.authors && Array.isArray(form.errors.authors)">
|
||||||
{{ errors.authors.join(', ') }}
|
{{ form.errors.authors.join(', ') }}
|
||||||
</div>
|
</div>
|
||||||
</CardBox>
|
</CardBox>
|
||||||
|
|
||||||
|
@ -261,9 +267,9 @@
|
||||||
<div class="flex flex-col md:flex-row">
|
<div class="flex flex-col md:flex-row">
|
||||||
<!-- (9) project_id -->
|
<!-- (9) project_id -->
|
||||||
<FormField label="Project.." help="project is optional"
|
<FormField label="Project.." help="project is optional"
|
||||||
:class="{ 'text-red-400': errors.project_id }" class="w-full mx-2 flex-1">
|
: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]"
|
<FormControl required v-model="form.project_id" :type="'select'"
|
||||||
:errors="form.errors.project_id" :options="projects">
|
placeholder="[Select Project]" :errors="form.errors.project_id" :options="projects">
|
||||||
<div class="text-red-400 text-sm" v-if="form.errors.project_id">
|
<div class="text-red-400 text-sm" v-if="form.errors.project_id">
|
||||||
{{ form.errors.project_id.join(', ') }}
|
{{ form.errors.project_id.join(', ') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -271,7 +277,7 @@
|
||||||
</FormField>
|
</FormField>
|
||||||
<!-- (10) embargo_date -->
|
<!-- (10) embargo_date -->
|
||||||
<FormField label="Embargo Date.." help="embargo date is optional"
|
<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')"
|
<FormControl v-model="form.embargo_date" :type="'date'" placeholder="date('y-m-d')"
|
||||||
:errors="form.errors.embargo_date">
|
:errors="form.errors.embargo_date">
|
||||||
<div class="text-red-400 text-sm" v-if="form.errors.embargo_date">
|
<div class="text-red-400 text-sm" v-if="form.errors.embargo_date">
|
||||||
|
@ -283,8 +289,9 @@
|
||||||
|
|
||||||
<BaseDivider />
|
<BaseDivider />
|
||||||
|
|
||||||
<MapComponent v-if="form.coverage" :mapOptions="mapOptions" :baseMaps="baseMaps" :fitBounds="fitBounds"
|
<MapComponent v-if="form.coverage" :mapOptions="mapOptions" :baseMaps="baseMaps"
|
||||||
:coverage="form.coverage" :mapId="mapId" v-bind-event:onMapInitializedEvent="onMapInitialized">
|
:fitBounds="fitBounds" :coverage="form.coverage" :mapId="mapId"
|
||||||
|
v-bind-event:onMapInitializedEvent="onMapInitialized">
|
||||||
</MapComponent>
|
</MapComponent>
|
||||||
<div class="flex flex-col md:flex-row">
|
<div class="flex flex-col md:flex-row">
|
||||||
<!-- x min and max -->
|
<!-- x min and max -->
|
||||||
|
@ -478,7 +485,7 @@ import { computed, ComputedRef } from 'vue';
|
||||||
// import { ref } from 'vue';
|
// import { ref } from 'vue';
|
||||||
// import { MainService } from '@/Stores/main';
|
// import { MainService } from '@/Stores/main';
|
||||||
// import FormInput from '@/Components/FormInput.vue'; // @/Components/FormInput.vue'
|
// 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 { stardust } from '@eidellev/adonis-stardust/client';
|
||||||
|
|
||||||
import FormField from '@/Components/FormField.vue';
|
import FormField from '@/Components/FormField.vue';
|
||||||
|
@ -513,10 +520,10 @@ import { notify } from '@/notiwind';
|
||||||
import NotificationBar from '@/Components/NotificationBar.vue';
|
import NotificationBar from '@/Components/NotificationBar.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
errors: {
|
// errors: {
|
||||||
type: Object,
|
// type: Object,
|
||||||
default: () => ({}),
|
// default: () => ({}),
|
||||||
},
|
// },
|
||||||
licenses: {
|
licenses: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
|
@ -570,6 +577,12 @@ const flash: ComputedRef<any> = computed(() => {
|
||||||
// console.log(test);
|
// console.log(test);
|
||||||
return usePage().props.flash;
|
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 projects = reactive([]);
|
||||||
// const licenses = reactive([]);
|
// const licenses = reactive([]);
|
||||||
|
@ -647,9 +660,16 @@ const submit = async (): Promise<void> => {
|
||||||
// await Inertia.post('/app/register', this.form);
|
// await Inertia.post('/app/register', this.form);
|
||||||
// await router.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) => {
|
// const files = form.files.map((obj) => {
|
||||||
// return new File([obj.blob], obj.label, { type: obj.type, lastModified: obj.lastModified });
|
// 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) {
|
if (!obj.id) {
|
||||||
// return MultipartFile for file upload
|
// return MultipartFile for file upload
|
||||||
const options: FilePropertyBag = {
|
const options: FilePropertyBag = {
|
||||||
type: obj.type,
|
type: obj.type,
|
||||||
lastModified: obj.lastModified
|
lastModified: obj.lastModified
|
||||||
};
|
};
|
||||||
// let file = new File([obj.blob], `${obj.label}?sortOrder=${obj.sort_order}`, options);
|
// let file = new File([obj.blob], `${obj.label}?sortOrder=${obj.sort_order}`, options);
|
||||||
|
@ -679,9 +699,7 @@ const submit = async (): Promise<void> => {
|
||||||
await form
|
await form
|
||||||
.transform((data) => ({
|
.transform((data) => ({
|
||||||
...data,
|
...data,
|
||||||
licenses: form.licenses.every((item) => hasIdAttribute(item))
|
licenses: licenses,
|
||||||
? form.licenses.map((obj) => obj.id.toString())
|
|
||||||
: form.licenses,
|
|
||||||
files: fileUploads,
|
files: fileUploads,
|
||||||
fileInputs: fileInputs,
|
fileInputs: fileInputs,
|
||||||
// files: form.files.map((obj) => {
|
// files: form.files.map((obj) => {
|
||||||
|
@ -701,7 +719,7 @@ const submit = async (): Promise<void> => {
|
||||||
.put(route);
|
.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;
|
return typeof obj === 'object' && 'id' in obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -709,7 +727,7 @@ const addTitle = () => {
|
||||||
let newTitle: Title = { value: '', language: '', type: '' };
|
let newTitle: Title = { value: '', language: '', type: '' };
|
||||||
form.titles.push(newTitle);
|
form.titles.push(newTitle);
|
||||||
};
|
};
|
||||||
const removeTitle = (key) => {
|
const removeTitle = (key: any) => {
|
||||||
form.titles.splice(key, 1);
|
form.titles.splice(key, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -717,11 +735,11 @@ const addDescription = () => {
|
||||||
let newDescription = { value: '', language: '', type: '' };
|
let newDescription = { value: '', language: '', type: '' };
|
||||||
form.descriptions.push(newDescription);
|
form.descriptions.push(newDescription);
|
||||||
};
|
};
|
||||||
const removeDescription = (key) => {
|
const removeDescription = (key: any) => {
|
||||||
form.descriptions.splice(key, 1);
|
form.descriptions.splice(key, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onAddAuthor = (person) => {
|
const onAddAuthor = (person: Person) => {
|
||||||
if (form.authors.filter((e) => e.id === person.id).length > 0) {
|
if (form.authors.filter((e) => e.id === person.id).length > 0) {
|
||||||
notify({ type: 'warning', title: 'Warning', text: 'person is already defined as author' }, 4000);
|
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) {
|
} 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) {
|
if (form.contributors.filter((e) => e.id === person.id).length > 0) {
|
||||||
notify({ type: 'warning', title: 'Warning', text: 'person is already defined as contributor' }, 4000);
|
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) {
|
} else if (form.authors.filter((e) => e.id === person.id).length > 0) {
|
||||||
|
@ -757,11 +775,11 @@ const addReference = () => {
|
||||||
form.references.push(newReference);
|
form.references.push(newReference);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeReference = (key) => {
|
const removeReference = (key: any) => {
|
||||||
form.references.splice(key, 1);
|
form.references.splice(key, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onMapInitialized = (newItem) => {
|
const onMapInitialized = (newItem: any) => {
|
||||||
console.log(newItem);
|
console.log(newItem);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import '../css/app.css';
|
import '../css/app.css';
|
||||||
import { createApp, h, App, Plugin } from 'vue';
|
import { createApp, h } from 'vue';
|
||||||
import { Inertia } from '@inertiajs/inertia';
|
import { Inertia } from '@inertiajs/inertia';
|
||||||
|
|
||||||
import { createInertiaApp } from '@inertiajs/vue3';
|
import { createInertiaApp } from '@inertiajs/vue3';
|
||||||
|
@ -16,12 +16,12 @@ import { EmitterPlugin } from '@/EmitterDirective';
|
||||||
import { initRoutes } from '@eidellev/adonis-stardust/client/index.js';
|
import { initRoutes } from '@eidellev/adonis-stardust/client/index.js';
|
||||||
initRoutes();
|
initRoutes();
|
||||||
|
|
||||||
interface SetupOptions {
|
// interface SetupOptions {
|
||||||
el: Element;
|
// el: Element;
|
||||||
App: App;
|
// App: App;
|
||||||
props: Record<string, any>;
|
// props: Record<string, any>;
|
||||||
plugin: Plugin;
|
// plugin: Plugin;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// import '@fontsource/archivo-black/index.css';
|
// import '@fontsource/archivo-black/index.css';
|
||||||
// import '@fontsource/inter/index.css';
|
// import '@fontsource/inter/index.css';
|
||||||
|
@ -58,7 +58,7 @@ createInertiaApp({
|
||||||
// )
|
// )
|
||||||
// },
|
// },
|
||||||
|
|
||||||
setup({ el, App, props, plugin} : SetupOptions) {
|
setup({ el, App, props, plugin}) {
|
||||||
createApp({ render: () => h(App, props) })
|
createApp({ render: () => h(App, props) })
|
||||||
.use(plugin)
|
.use(plugin)
|
||||||
.use(pinia)
|
.use(pinia)
|
||||||
|
|
|
@ -35,7 +35,7 @@ export const colorsOutline = {
|
||||||
info: [colorsText.info, 'border-blue-500'],
|
info: [colorsText.info, 'border-blue-500'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getButtonColor = (color, isOutlined, hasHover) => {
|
export const getButtonColor = (color: 'white' | 'contrast' | 'light' | 'success' | 'danger' | 'warning' | 'info' | 'modern', isOutlined: boolean, hasHover: boolean) => {
|
||||||
const colors = {
|
const colors = {
|
||||||
bg: {
|
bg: {
|
||||||
white: 'bg-white text-black',
|
white: 'bg-white text-black',
|
18
resources/js/tsconfig.json
Normal file
18
resources/js/tsconfig.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"extends": "@adonisjs/tsconfig/tsconfig.client.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"module": "ESNext",
|
||||||
|
"jsxImportSource": "vue",
|
||||||
|
"allowJs": true,
|
||||||
|
// "target": "ESNext",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./*"],
|
||||||
|
"~/*": ["../*"]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"include": ["./**/*.ts", "./**/*.vue"],
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
// tsconfig.vue.json
|
// tsconfig.vue.json
|
||||||
"extends": "@vue/tsconfig/tsconfig.json",
|
"extends": "@vue/tsconfig/tsconfig.json", // 0.4.0
|
||||||
// "include": ["./resources/js/**/*"],
|
// "include": ["./resources/js/**/*"],
|
||||||
"include": ["env.d.ts", "./**/*.ts", "./**/*.vue"],
|
"include": ["env.d.ts", "./**/*.ts", "./**/*.vue"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
@ -23,4 +23,4 @@
|
||||||
"~/*": ["../*"]
|
"~/*": ["../*"]
|
||||||
},
|
},
|
||||||
// "files": ["./index.d.ts"]
|
// "files": ["./index.d.ts"]
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ import server from '@adonisjs/core/services/server'
|
||||||
import router from '@adonisjs/core/services/router'
|
import router from '@adonisjs/core/services/router'
|
||||||
|
|
||||||
server.errorHandler(
|
server.errorHandler(
|
||||||
() => import('#exceptions/Handler')
|
() => import('#exceptions/handler')
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -302,18 +302,18 @@ Encore.addLoader({
|
||||||
// vue$: 'vue/dist/vue.runtime.esm-bundler.js',
|
// vue$: 'vue/dist/vue.runtime.esm-bundler.js',
|
||||||
// });
|
// });
|
||||||
|
|
||||||
Encore.addLoader(babelLoader)
|
// Encore.addLoader(babelLoader)
|
||||||
// Encore.enableTypeScriptLoader(config => {
|
Encore.enableTypeScriptLoader(config => {
|
||||||
// // Loader-specific options
|
// Loader-specific options
|
||||||
// config.configFile = 'resources/js/tsconfig.vue.json';
|
config.configFile = 'resources/js/tsconfig.json';
|
||||||
// config.appendTsSuffixTo = [/\.vue$/];
|
config.appendTsSuffixTo = [/\.vue$/];
|
||||||
// config.transpileOnly = true;
|
config.transpileOnly = true;
|
||||||
// config.happyPackMode = false;
|
config.happyPackMode = false;
|
||||||
// }, {
|
}, {
|
||||||
// // Directly change the exclude rule
|
// Directly change the exclude rule
|
||||||
// exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
|
|
||||||
// })
|
})
|
||||||
.addAliases({
|
.addAliases({
|
||||||
'@': join(__dirname, 'resources/js'),
|
'@': join(__dirname, 'resources/js'),
|
||||||
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user