fix: Fix regole ESLint records

This commit is contained in:
Maicol Battistini 2021-12-27 16:46:28 +01:00
parent 2d43ac1235
commit 8f4d5c38b9
No known key found for this signature in database
GPG Key ID: 4FDB0F87CDB1D34A
3 changed files with 17 additions and 12 deletions

View File

@ -110,7 +110,6 @@
<path value="$PROJECT_DIR$/vendor/devcode-it/openstamanager-standard-modules" />
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
<path value="$PROJECT_DIR$/vendor/laravel/serializable-closure" />
<path value="$PROJECT_DIR$/vendor/openstamanager/standard_modules" />
<path value="$PROJECT_DIR$/vendor/maicol07/laravel-json-api-resource" />
<path value="$PROJECT_DIR$/vendor/maximebf/debugbar" />
<path value="$PROJECT_DIR$/vendor/barryvdh/laravel-debugbar" />

View File

@ -97,29 +97,33 @@ export class RecordsPage extends Page {
recordDialogMaxWidth: string | number = '75%';
model: Model;
model: typeof Model;
/** @private */
data: Model[] = {};
async oninit(vnode) {
// noinspection JSUnresolvedFunction
vnode.state.data = (await this.model.all()).getData();
if (vnode.state.data) {
for (const record of vnode.state.data) {
const response = await this.model.all();
this.data = response.getData();
if (this.data.length > 0) {
for (const record of this.data) {
this.rows.put(record.id, record);
}
m.redraw();
}
}
async onupdate(vnode) {
onupdate(vnode) {
const rows: Cash = $('.mdc-data-table__row[data-model-id]');
if (rows.length > 0) {
rows.on(
'click',
(event: PointerEvent) => {
async (event: PointerEvent) => {
if (event.target.tagName === 'MWC-CHECKBOX') {
return;
}
this.updateRecord($(event.target)
await this.updateRecord($(event.target)
.parent('tr')
.data('model-id'));
}
@ -168,8 +172,8 @@ export class RecordsPage extends Page {
}
async updateRecord(id: number) {
// noinspection JSUnresolvedFunction
const instance: Model = (await this.model.find(id)).getData();
const response = await this.model.find(id);
const instance = response.getData();
const dialog = $('mwc-dialog#add-record-dialog');
// eslint-disable-next-line sonarjs/no-duplicate-string
@ -190,6 +194,7 @@ export class RecordsPage extends Page {
await instance.delete();
// noinspection JSUnresolvedVariable
this.rows.forget(instance.id);
m.redraw();
await showSnackbar(__('Record eliminato!'), 4000);
@ -210,7 +215,7 @@ export class RecordsPage extends Page {
<mwc-dialog id="add-record-dialog" class="record-dialog"
heading={__('Aggiungi nuovo record')}
style={`--mdc-dialog-max-width: ${this.recordDialogMaxWidth}`}>
<form method="PUT">
<form>
<text-field id="id" name="id" style="display: none;" data-default-value=""/>
{(() => {
const sections = collect(this.sections);

View File

@ -20,6 +20,7 @@ export default class Model extends BaseModel {
super();
// Return a proxy of this object to allow dynamic attributes getters and setters
// eslint-disable-next-line no-constructor-return
return new Proxy(this, {
get(target: this, property, receiver) {
const accessor = target[`get${capitalize(property)}Attribute`];