do more cleanup of code using eslint

This commit is contained in:
janis
2023-10-05 13:46:53 +02:00
parent 0352bb9051
commit 5c5462186f
24 changed files with 314 additions and 240 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -187,7 +187,9 @@ export default {
if ( Object.keys( this.cart[ this.event.eventID ][ 'tickets' ] ).length < 1 ) { if ( Object.keys( this.cart[ this.event.eventID ][ 'tickets' ] ).length < 1 ) {
try { try {
delete this.cart[ this.event.eventID ]; delete this.cart[ this.event.eventID ];
} catch {} } catch {
console.log( 'element nonexistent' );
}
} else { } else {
delete this.cart[ this.event.eventID ][ 'tickets' ][ ticket ]; delete this.cart[ this.event.eventID ][ 'tickets' ][ ticket ];
} }
@@ -238,7 +240,7 @@ export default {
} }
}, },
created () { created () {
window.addEventListener( 'visibilitychange', ( e ) => { window.addEventListener( 'visibilitychange', () => {
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
}, 1 ); }, 1 );
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<template> <template>
<div id="notifications" @click="handleNotifications();"> <div id="notifications" @click="handleNotifications();">
<div class="message-box" :class="[ location, size ]"> <div class="message-box" :class="[ location, size ]">
@@ -80,7 +81,9 @@ export default {
} }
try { try {
this.queue.splice( this.queue.indexOf( id ), 1 ); this.queue.splice( this.queue.indexOf( id ), 1 );
} catch {} } catch {
console.debug( 'queue empty' );
}
if ( this.currentlyDisplayedNotificationID == id ) { if ( this.currentlyDisplayedNotificationID == id ) {
this.handleNotifications(); this.handleNotifications();
} }

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<template> <template>
<div id="popup-backdrop"> <div id="popup-backdrop">
<div class="popup-container"> <div class="popup-container">

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - properties.vue * libreevent - properties.vue
* *
@@ -266,16 +267,16 @@ export default {
} }
}, },
watch: { watch: {
draggables ( value ) { draggables () {
this.loadInternal(); this.loadInternal();
}, },
active ( value ) { active () {
this.loadInternal(); this.loadInternal();
}, },
scaleFactor ( value ) { scaleFactor () {
this.loadInternal(); this.loadInternal();
}, },
historyPos ( value ) { historyPos () {
this.loadInternal(); this.loadInternal();
} }
}, },

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - window.vue * libreevent - window.vue
* *
@@ -74,7 +75,7 @@ export default {
data() { data() {
return { return {
active: 0, active: 0,
draggables: { 1: { 'x': 100, 'y': 100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': 1, 'origin': 1, 'shape': 'rectangular', 'type': 'seat', 'startingRow': 1, 'seatNumberingPosition': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'numberingDirection': 'left', 'seatNumberingPosition': 1, 'category': '1' } }, draggables: { 1: { 'x': 100, 'y': 100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': 1, 'origin': 1, 'shape': 'rectangular', 'type': 'seat', 'startingRow': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'numberingDirection': 'left', 'seatNumberingPosition': 1, 'category': '1' } },
available: { 'redo': false, 'undo': false }, available: { 'redo': false, 'undo': false },
scaleFactor: 1, scaleFactor: 1,
sizePoll: null, sizePoll: null,
@@ -206,7 +207,7 @@ export default {
// } // }
this.save(); this.save();
}, },
eventHandler ( e ) { eventHandler () {
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) { if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth }; this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
this.loadSeatplan(); this.loadSeatplan();

View File

@@ -102,7 +102,7 @@ export default {
} }
}, },
watch: { watch: {
origin ( value ) { origin () {
this.updateOrigin(); this.updateOrigin();
} }
}, },

View File

@@ -49,16 +49,16 @@ export default {
} }
}, },
watch: { watch: {
origin ( value ) { origin () {
this.updateStyle(); this.updateStyle();
}, },
scaleFactor ( value ) { scaleFactor () {
this.updateStyle(); this.updateStyle();
}, },
colour ( value ) { colour () {
this.updateStyle(); this.updateStyle();
}, },
textSize ( value ) { textSize () {
this.updateStyle(); this.updateStyle();
} }
}, },

View File

@@ -102,7 +102,7 @@ export default {
} }
}, },
watch: { watch: {
origin ( value ) { origin () {
this.updateOrigin(); this.updateOrigin();
} }
}, },

View File

@@ -108,7 +108,7 @@ export default {
}, },
}, },
watch: { watch: {
origin ( value ) { origin () {
this.updateOrigin(); this.updateOrigin();
} }
}, },

View File

@@ -49,16 +49,16 @@ export default {
} }
}, },
watch: { watch: {
origin ( value ) { origin () {
this.updateStyle(); this.updateStyle();
}, },
scaleFactor ( value ) { scaleFactor () {
this.updateStyle(); this.updateStyle();
}, },
colour ( value ) { colour () {
this.updateStyle(); this.updateStyle();
}, },
textSize ( value ) { textSize () {
this.updateStyle(); this.updateStyle();
} }
}, },

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - window.vue * libreevent - window.vue
* *
@@ -173,7 +174,7 @@ export default {
this.seatChecks(); this.seatChecks();
// TODO: FUTURE Trim scroll box to about 200px more than seatplan size // TODO: FUTURE Trim scroll box to about 200px more than seatplan size
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) ); sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
window.addEventListener( 'visibilitychange', ( e ) => { window.addEventListener( 'visibilitychange', () => {
this.seatPlanInit(); this.seatPlanInit();
}, 1 ); }, 1 );
}, },
@@ -237,7 +238,7 @@ export default {
} }
} ); } );
}, },
eventHandler ( e ) { eventHandler () {
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) { if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth }; this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
this.loadSeatplan(); this.loadSeatplan();
@@ -330,7 +331,7 @@ export default {
this.loadSeatplan(); this.loadSeatplan();
} else { } else {
if ( ( this.zoomFactor < 0.3 && scale < 0 ) || ( this.zoomFactor > 2.9 && scale > 0 ) ) { if ( ( this.zoomFactor < 0.3 && scale < 0 ) || ( this.zoomFactor > 2.9 && scale > 0 ) ) {
console.log( 'maxZoomLevelReached' );
} else { } else {
this.zoomFactor += scale; this.zoomFactor += scale;
} }

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - rightClickMenu.vue * libreevent - rightClickMenu.vue
* *

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - settings.vue * libreevent - settings.vue
* *

View File

@@ -51,7 +51,7 @@ export default {
props: { props: {
'cart': { 'cart': {
type: Object, type: Object,
default: {}, default: {}
// EXAMPLE: { 'TestEvent2': { 'displayName': 'TestEvent2', 'tickets': { 'secAr1s1': { 'displayName': 'Row 1, Seat 1', 'price': 20 } } } } // EXAMPLE: { 'TestEvent2': { 'displayName': 'TestEvent2', 'tickets': { 'secAr1s1': { 'displayName': 'Row 1, Seat 1', 'price': 20 } } } }
}, },
'width': { 'width': {

View File

@@ -9,7 +9,6 @@
import { createRouter, createWebHistory } from 'vue-router'; import { createRouter, createWebHistory } from 'vue-router';
import { useUserStore } from '@/stores/userStore'; import { useUserStore } from '@/stores/userStore';
import { useBackendStore } from '@/stores/backendStore';
import adminRoutes from '@/router/adminRoutes'; import adminRoutes from '@/router/adminRoutes';
import mainRoutes from '@/router/mainRoutes'; import mainRoutes from '@/router/mainRoutes';
@@ -27,7 +26,7 @@ const router = createRouter( {
routes, routes,
} ); } );
router.afterEach( ( to, from ) => { router.afterEach( ( to ) => {
let userStore = useUserStore(); let userStore = useUserStore();
document.title = to.meta.title ? to.meta.title + userStore.getPageName : 'libreevent'; document.title = to.meta.title ? to.meta.title + userStore.getPageName : 'libreevent';
} ); } );

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - AdminView.vue * libreevent - AdminView.vue
* *
@@ -225,7 +226,7 @@ export default {
methods: { methods: {
logout () { logout () {
if ( confirm( 'Do you really want to log out?' ) ) { if ( confirm( 'Do you really want to log out?' ) ) {
fetch( '/admin/logout' ).then( _ => { fetch( '/admin/logout' ).then( () => {
this.userStore.setAdminAuth( false ); this.userStore.setAdminAuth( false );
this.$router.push( '/admin/login' ); this.$router.push( '/admin/login' );
} ); } );

View File

@@ -23,7 +23,7 @@
</div> </div>
<!-- <img :src="event.logo" alt="event logo" class="ticket-logo"> --> <!-- <img :src="event.logo" alt="event logo" class="ticket-logo"> -->
</router-link> </router-link>
<router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else="new Date( event.date ).getTime() > currentDate"> <router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else>
<div class="ticket-name"> <div class="ticket-name">
<h3>{{ event.name }}</h3> <h3>{{ event.name }}</h3>
<p>{{ event.description }}</p> <p>{{ event.description }}</p>

View File

@@ -200,7 +200,7 @@ export default {
} }
}, },
watch: { watch: {
selectedTemplate( value ) { selectedTemplate() {
this.loadPageSettings(); this.loadPageSettings();
} }
}, },

View File

@@ -48,7 +48,7 @@ export default {
} }
}; };
source.onopen = e => { source.onopen = () => {
self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' ); self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' );
self.$refs.notification.cancelNotification( startNotification ); self.$refs.notification.cancelNotification( startNotification );
}; };

View File

@@ -492,8 +492,7 @@ export default {
'charset': 'utf-8' 'charset': 'utf-8'
} }
}; };
// TODO: fix url fetch( '/admin/api/undeployEvent', options ).then( res => {
fetch( url, options ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
this.hasLiveVersion = false; this.hasLiveVersion = false;
this.$refs.notification.createNotification( 'Your event is no longer publicly visible!', 5, 'ok', 'normal' ); this.$refs.notification.createNotification( 'Your event is no longer publicly visible!', 5, 'ok', 'normal' );
@@ -510,7 +509,7 @@ export default {
'charset': 'utf-8' 'charset': 'utf-8'
} }
}; };
fetch( url, options ).then( res => { fetch( '/admin/api/deleteEvent', options ).then( res => {
if ( res.status === 200 ) { if ( res.status === 200 ) {
this.$refs.notification.createNotification( 'Your event has been deleted successfully!', 5, 'ok', 'normal' ); this.$refs.notification.createNotification( 'Your event has been deleted successfully!', 5, 'ok', 'normal' );
setTimeout( () => { setTimeout( () => {
@@ -534,7 +533,7 @@ export default {
} else if ( action === 'undeploy' ) { } else if ( action === 'undeploy' ) {
this.$refs.popups.openPopup( 'Do you really want to remove this event from the event listings?', {}, 'confirm' ); this.$refs.popups.openPopup( 'Do you really want to remove this event from the event listings?', {}, 'confirm' );
this.command = 'undeployEvent'; this.command = 'undeployEvent';
} else if ( type === 'delete' ) { } else if ( action === 'delete' ) {
this.$refs.popups.openPopup( 'Do you really want to delete this event? This action cannot be undone', {}, 'confirm' ); this.$refs.popups.openPopup( 'Do you really want to delete this event? This action cannot be undone', {}, 'confirm' );
this.command = 'deleteEvent'; this.command = 'deleteEvent';
} }

View File

@@ -223,7 +223,7 @@ export default {
}, },
}, },
created () { created () {
window.addEventListener( 'visibilitychange', ( e ) => { window.addEventListener( 'visibilitychange', () => {
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {}; this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
this.calculateTotal(); this.calculateTotal();
}, 1 ); }, 1 );

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!-- <!--
* libreevent - GuestPurchaseView.vue * libreevent - GuestPurchaseView.vue
* *
@@ -61,7 +62,7 @@ export default {
} }
}; };
source.onopen = e => { source.onopen = () => {
self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' ); self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' );
self.$refs.notification.cancelNotification( startNotification ); self.$refs.notification.cancelNotification( startNotification );
}; };