From e7b5fd09e3531896ae308469697a494040061ba8 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Mon, 4 Mar 2024 10:48:18 +0100 Subject: [PATCH] chore: Apply `eslint` fixes (#53) * Apply eslint fixes * Apply `eslint` fixes for vue files * More eslint fixes --- Website/ui/babel.config.js | 6 +- Website/ui/src/classes/paginator.js | 4 +- Website/ui/src/layouts/MobileTopNavbar.vue | 68 +++--- Website/ui/src/mixins/mapSharing.js | 2 +- Website/ui/src/modules/Assets/AddAsset.vue | 2 +- .../Client/Appliances/SellApplianceModal.vue | 13 +- Website/ui/src/modules/Client/Client.vue | 16 +- Website/ui/src/modules/Client/Clients.vue | 4 +- .../ui/src/modules/Client/PaymentDetail.vue | 24 +-- Website/ui/src/modules/Cluster/AddCluster.vue | 1 - .../ui/src/modules/EBikes/AddEBikeModal.vue | 2 +- .../src/modules/EBikes/EBikeDetailModal.vue | 8 +- Website/ui/src/modules/EBikes/EBikes.vue | 6 +- Website/ui/src/modules/Map/ClusterMap.vue | 2 +- Website/ui/src/modules/Map/MiniGridMap.vue | 18 +- Website/ui/src/modules/Map/VillageMap.vue | 2 +- Website/ui/src/modules/Meter/Basic.vue | 1 - .../ui/src/modules/MiniGrid/AddMiniGrid.vue | 2 +- .../src/modules/MiniGrid/EnergyChartBox.vue | 2 +- .../MiniGrid/RevenuePerCustomerType.vue | 1 - .../src/modules/MiniGrid/TicketsOverview.vue | 1 - Website/ui/src/modules/Sms/List.vue | 1 - Website/ui/src/modules/Sms/NewSms.vue | 1 - Website/ui/src/modules/Target/NewTarget.vue | 198 +++++++++--------- .../Ticket/AddExternalTicketingUser.vue | 72 +++---- Website/ui/src/modules/Ticket/Tickets.vue | 2 +- .../Transactions/FilterTransaction.vue | 28 +-- .../src/modules/Transactions/Transaction.vue | 34 ++- .../src/modules/Transactions/Transactions.vue | 28 +-- .../ui/src/pages/Dashboard/MiniGrid/index.vue | 2 +- Website/ui/src/pages/ForgotPassword/index.vue | 4 +- .../steama-meter/js/modules/Shared/Widget.vue | 1 - .../ui/src/plugins/steama-meter/js/routes.js | 2 +- .../js/modules/Component.vue | 6 +- .../viber-messaging/js/modules/Component.vue | 6 +- .../js/modules/Component.vue | 6 +- .../js/modules/Component.vue | 4 +- .../wavecom-payment-provider/js/routes.js | 2 +- .../ui/src/repositories/Client/AxiosClient.js | 4 +- .../src/repositories/Client/OpenCageData.js | 2 +- Website/ui/src/resources.js | 6 +- Website/ui/src/services/AgentTicketService.js | 30 +-- Website/ui/src/services/DeviceService.js | 2 +- Website/ui/src/services/MappingService.js | 26 +-- .../ui/src/services/SolarHomeSystemService.js | 1 - Website/ui/src/services/TariffService.js | 5 +- Website/ui/src/services/TicketService.js | 8 +- Website/ui/src/services/TicketUserService.js | 6 +- .../src/services/TransactionExportService.js | 6 +- Website/ui/src/services/UserService.js | 1 - Website/ui/src/shared/TailWizard.vue | 122 +++++------ Website/ui/src/shared/TicketItem.vue | 154 +++++++------- Website/ui/src/store/store.js | 1 - 53 files changed, 471 insertions(+), 485 deletions(-) diff --git a/Website/ui/babel.config.js b/Website/ui/babel.config.js index e9558405f..c94e72931 100644 --- a/Website/ui/babel.config.js +++ b/Website/ui/babel.config.js @@ -1,5 +1,5 @@ module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] + presets: [ + '@vue/cli-plugin-babel/preset' + ] } diff --git a/Website/ui/src/classes/paginator.js b/Website/ui/src/classes/paginator.js index 3b026d60e..d9663dd27 100644 --- a/Website/ui/src/classes/paginator.js +++ b/Website/ui/src/classes/paginator.js @@ -42,8 +42,8 @@ export class Paginator { param['page'] = page param['per_page'] = this.perPage return axios.get(this.url, { - params: param - } + params: param + } ).then(response => { let data = response.data this.from = data.from diff --git a/Website/ui/src/layouts/MobileTopNavbar.vue b/Website/ui/src/layouts/MobileTopNavbar.vue index 03802fdd7..4afe0126e 100644 --- a/Website/ui/src/layouts/MobileTopNavbar.vue +++ b/Website/ui/src/layouts/MobileTopNavbar.vue @@ -104,44 +104,44 @@ import Breadcrumb from '../shared/Breadcrumb' export default { - name: 'MobileTopNavBar', - components: {Breadcrumb}, - data() { - return { - open: false, - mobileSidebarVisible: false - } - }, - watch: { - $route() { - this.hideSidebar() - } - }, - methods: { - logout() { - this.$store.dispatch('auth/logOut').then(() => { - this.$router.replace('/login') - }) - - }, - showSidebar() { - this.mobileSidebarVisible = true - this.$sidebar.displaySidebar(true) + name: 'MobileTopNavBar', + components: {Breadcrumb}, + data() { + return { + open: false, + mobileSidebarVisible: false + } }, - hideSidebar() { - this.mobileSidebarVisible = false - this.$sidebar.displaySidebar(false) + watch: { + $route() { + this.hideSidebar() + } }, - replaceRoute(route) { - this.$router.replace(route) - } + methods: { + logout() { + this.$store.dispatch('auth/logOut').then(() => { + this.$router.replace('/login') + }) + + }, + showSidebar() { + this.mobileSidebarVisible = true + this.$sidebar.displaySidebar(true) + }, + hideSidebar() { + this.mobileSidebarVisible = false + this.$sidebar.displaySidebar(false) + }, + replaceRoute(route) { + this.$router.replace(route) + } - }, - computed: { - adminName() { - return this.$store.getters['auth/getAuthenticateUser'].name }, - } + computed: { + adminName() { + return this.$store.getters['auth/getAuthenticateUser'].name + }, + } } diff --git a/Website/ui/src/mixins/mapSharing.js b/Website/ui/src/mixins/mapSharing.js index e6e4dc7de..fdbfc97e7 100644 --- a/Website/ui/src/mixins/mapSharing.js +++ b/Website/ui/src/mixins/mapSharing.js @@ -170,7 +170,7 @@ export const sharedMap = { if (layer._icon) { layer.remove() } - }); + }) }, }, computed: { diff --git a/Website/ui/src/modules/Assets/AddAsset.vue b/Website/ui/src/modules/Assets/AddAsset.vue index a383fb911..d87b48e67 100644 --- a/Website/ui/src/modules/Assets/AddAsset.vue +++ b/Website/ui/src/modules/Assets/AddAsset.vue @@ -105,7 +105,7 @@ export default { } try { this.loading = true - const appliances = await this.applianceService.createAppliance() + const appliances = await this.applianceService.createAppliance() this.loading = false this.alertNotify('success', this.$tc('phrases.newAppliance', 1)) diff --git a/Website/ui/src/modules/Client/Appliances/SellApplianceModal.vue b/Website/ui/src/modules/Client/Appliances/SellApplianceModal.vue index faa22f4e4..162f1840a 100644 --- a/Website/ui/src/modules/Client/Appliances/SellApplianceModal.vue +++ b/Website/ui/src/modules/Client/Appliances/SellApplianceModal.vue @@ -444,14 +444,13 @@ export default { if (this.isDeviceBindingRequired(appliance)) { this.isDeviceSelectionRequired = true this.deviceSelectionList = availableDevices.filter((device) => { - debugger switch (appliance.assetTypeId) { - case APPLIANCE_TYPE_SHS_ID: - return (device.deviceType === 'solar_home_system' && device.device.assetId === this.selectedApplianceId) - case APPLIANCE_TYPE_E_BIKE_ID: - return (device.deviceType === 'e_bike' && device.device.assetId === this.selectedApplianceId) - default: - return false + case APPLIANCE_TYPE_SHS_ID: + return (device.deviceType === 'solar_home_system' && device.device.assetId === this.selectedApplianceId) + case APPLIANCE_TYPE_E_BIKE_ID: + return (device.deviceType === 'e_bike' && device.device.assetId === this.selectedApplianceId) + default: + return false } }).map(device => { return { diff --git a/Website/ui/src/modules/Client/Client.vue b/Website/ui/src/modules/Client/Client.vue index 03b42eba4..955a01e5b 100644 --- a/Website/ui/src/modules/Client/Client.vue +++ b/Website/ui/src/modules/Client/Client.vue @@ -140,14 +140,14 @@ export default { const lon = parseFloat(points[1]) let markerType = '' switch (device.device_type) { - case 'e_bike': - markerType = MARKER_TYPE.E_BIKE - break - case 'shs': - markerType = MARKER_TYPE.SHS - break - default: - markerType = MARKER_TYPE.METER + case 'e_bike': + markerType = MARKER_TYPE.E_BIKE + break + case 'shs': + markerType = MARKER_TYPE.SHS + break + default: + markerType = MARKER_TYPE.METER } markingInfos.push({ id: device.id, diff --git a/Website/ui/src/modules/Client/Clients.vue b/Website/ui/src/modules/Client/Clients.vue index adb65dfd9..0b63f4f5d 100644 --- a/Website/ui/src/modules/Client/Clients.vue +++ b/Website/ui/src/modules/Client/Clients.vue @@ -68,7 +68,7 @@ import {People} from '@/classes/people' import {timing} from '@/mixins/timing' import i18n from '../../i18n' import AddClientModal from '@/modules/Client/AddClientModal.vue' -import {OutstandingDebtsExportService} from "@/services/OutstandingDebtsExportService"; +import {OutstandingDebtsExportService} from '@/services/OutstandingDebtsExportService' const debounce = require('debounce') @@ -176,7 +176,7 @@ export default { this.searchTerm = '' }, exportDebts () { - const email = this.$store.getters['auth/getAuthenticateUser'].email; + const email = this.$store.getters['auth/getAuthenticateUser'].email window.open(this.outstandingDebtsExportService.exportOutstandingDebts(email)) } } diff --git a/Website/ui/src/modules/Client/PaymentDetail.vue b/Website/ui/src/modules/Client/PaymentDetail.vue index 9d878cb71..c62c7dbed 100644 --- a/Website/ui/src/modules/Client/PaymentDetail.vue +++ b/Website/ui/src/modules/Client/PaymentDetail.vue @@ -71,18 +71,18 @@ export default { async getFlow (period = 'M') { switch (period) { - case 'Y': - this.periodName = this.$tc('words.annually') - break - case 'M': - this.periodName = this.$tc('words.month', 2) - break - case 'W': - this.periodName = this.$tc('words.week', 2) - break - case 'D': - this.periodName = this.$tc('words.day', 2) - break + case 'Y': + this.periodName = this.$tc('words.annually') + break + case 'M': + this.periodName = this.$tc('words.month', 2) + break + case 'W': + this.periodName = this.$tc('words.week', 2) + break + case 'D': + this.periodName = this.$tc('words.day', 2) + break } try { await this.paymentService.getPaymentDetail(this.personId, period) diff --git a/Website/ui/src/modules/Cluster/AddCluster.vue b/Website/ui/src/modules/Cluster/AddCluster.vue index aeee1a6f0..7b35e7c03 100644 --- a/Website/ui/src/modules/Cluster/AddCluster.vue +++ b/Website/ui/src/modules/Cluster/AddCluster.vue @@ -235,7 +235,6 @@ export default { editedItems.forEach((item) => { const editedGeoDataItem = this.mappingService.searchedOrDrawnItems.find(x => x.type === item.type) if (editedGeoDataItem) { - debugger editedGeoDataItem.geojson.coordinates = item.geojson.coordinates editedGeoDataItem.lat = item.lat editedGeoDataItem.lon = item.lon diff --git a/Website/ui/src/modules/EBikes/AddEBikeModal.vue b/Website/ui/src/modules/EBikes/AddEBikeModal.vue index 0dfbe9d7f..afa153e30 100644 --- a/Website/ui/src/modules/EBikes/AddEBikeModal.vue +++ b/Website/ui/src/modules/EBikes/AddEBikeModal.vue @@ -77,7 +77,7 @@ import Widget from '@/shared/widget.vue' import {ManufacturerService} from '@/services/ManufacturerService' import {ApplianceService} from '@/services/ApplianceService' import {timing, notify} from '@/mixins' -import {EBikeService} from "@/services/EBikeService"; +import {EBikeService} from '@/services/EBikeService' //these are fixed values in the database const MANUFACTURER_TYPE = 'e-bike' diff --git a/Website/ui/src/modules/EBikes/EBikeDetailModal.vue b/Website/ui/src/modules/EBikes/EBikeDetailModal.vue index f67d681b3..0b69d98e1 100644 --- a/Website/ui/src/modules/EBikes/EBikeDetailModal.vue +++ b/Website/ui/src/modules/EBikes/EBikeDetailModal.vue @@ -94,10 +94,10 @@ diff --git a/Website/ui/src/modules/Ticket/AddExternalTicketingUser.vue b/Website/ui/src/modules/Ticket/AddExternalTicketingUser.vue index be7af58aa..dff0b5fa7 100644 --- a/Website/ui/src/modules/Ticket/AddExternalTicketingUser.vue +++ b/Website/ui/src/modules/Ticket/AddExternalTicketingUser.vue @@ -39,47 +39,47 @@ diff --git a/Website/ui/src/modules/Ticket/Tickets.vue b/Website/ui/src/modules/Ticket/Tickets.vue index c14381768..076f41713 100644 --- a/Website/ui/src/modules/Ticket/Tickets.vue +++ b/Website/ui/src/modules/Ticket/Tickets.vue @@ -53,7 +53,7 @@ import {EventBus} from '@/shared/eventbus' import Filtering from '@/modules/Ticket/Filtering' import {resources} from '@/resources' import {TicketService} from '@/services/TicketService' -import {baseUrl} from "@/repositories/Client/AxiosClient"; +import {baseUrl} from '@/repositories/Client/AxiosClient' export default { name: 'Tickets', components: {Filtering, Widget, TicketItem}, diff --git a/Website/ui/src/modules/Transactions/FilterTransaction.vue b/Website/ui/src/modules/Transactions/FilterTransaction.vue index 357614bca..1917866ac 100644 --- a/Website/ui/src/modules/Transactions/FilterTransaction.vue +++ b/Website/ui/src/modules/Transactions/FilterTransaction.vue @@ -116,8 +116,8 @@ import {EventBus} from '@/shared/eventbus' import {TransactionProviderService} from '@/services/TransactionProviderService' import {mapGetters} from 'vuex' import moment from 'moment-timezone' -import store from "@/store/store"; -import {TransactionExportService} from "@/services/TransactionExportService"; +import store from '@/store/store' +import {TransactionExportService} from '@/services/TransactionExportService' export default { name: 'FilterTransaction', @@ -191,18 +191,18 @@ export default { }, seTransaction (transaction) { switch (transaction) { - case 'All': - this.filter.status = 'all' - break - case 'Only Approved': - this.filter.status = '1' - break - case 'Only Rejected': - this.filter.status = '-1' - break + case 'All': + this.filter.status = 'all' + break + case 'Only Approved': + this.filter.status = '1' + break + case 'Only Rejected': + this.filter.status = '-1' + break - default: - break + default: + break } }, submitFilter () { @@ -218,7 +218,7 @@ export default { timeZone: moment.tz.guess(), currency: store.getters['settings/getMainSettings'].currency } - const email = this.$store.getters['auth/getAuthenticateUser'].email; + const email = this.$store.getters['auth/getAuthenticateUser'].email window.open(this.transactionExportService.exportTransactions(email, data)) }, getSearch () { diff --git a/Website/ui/src/modules/Transactions/Transaction.vue b/Website/ui/src/modules/Transactions/Transaction.vue index 588d436ad..1648c00ae 100644 --- a/Website/ui/src/modules/Transactions/Transaction.vue +++ b/Website/ui/src/modules/Transactions/Transaction.vue @@ -206,9 +206,7 @@ diff --git a/Website/ui/src/plugins/steama-meter/js/modules/Shared/Widget.vue b/Website/ui/src/plugins/steama-meter/js/modules/Shared/Widget.vue index 516663f2a..3317c9035 100644 --- a/Website/ui/src/plugins/steama-meter/js/modules/Shared/Widget.vue +++ b/Website/ui/src/plugins/steama-meter/js/modules/Shared/Widget.vue @@ -185,7 +185,6 @@ export default { }, checkDataLength (subscriber, dataLength) { console.log(subscriber, dataLength) - debugger if (!this.validateSubscriber(subscriber)) { return } diff --git a/Website/ui/src/plugins/steama-meter/js/routes.js b/Website/ui/src/plugins/steama-meter/js/routes.js index 1cdbd98ba..a6b11ee8b 100644 --- a/Website/ui/src/plugins/steama-meter/js/routes.js +++ b/Website/ui/src/plugins/steama-meter/js/routes.js @@ -36,4 +36,4 @@ let routes = [ meta: { layout: 'default' }, }, - ] \ No newline at end of file +] \ No newline at end of file diff --git a/Website/ui/src/plugins/swifta-payment-provider/js/modules/Component.vue b/Website/ui/src/plugins/swifta-payment-provider/js/modules/Component.vue index b40d44142..b4512a75f 100644 --- a/Website/ui/src/plugins/swifta-payment-provider/js/modules/Component.vue +++ b/Website/ui/src/plugins/swifta-payment-provider/js/modules/Component.vue @@ -2,10 +2,10 @@