From ee41286ff7344ef4b14c920060de93bc927016a9 Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sun, 10 Dec 2023 20:58:12 +0000 Subject: [PATCH] [CodeFactor] Apply fixes --- gui/src/components/main_active_stats.vue | 5 ---- gui/src/js/waterfallHandler.js | 8 +++--- gui/src/store/settingsStore.js | 34 +++++++++++------------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/gui/src/components/main_active_stats.vue b/gui/src/components/main_active_stats.vue index a4912892..54449f67 100644 --- a/gui/src/components/main_active_stats.vue +++ b/gui/src/components/main_active_stats.vue @@ -179,11 +179,6 @@ export default { // init waterfall localSpectrum = initWaterfall("waterfall-main"); - - - - - }, }; diff --git a/gui/src/js/waterfallHandler.js b/gui/src/js/waterfallHandler.js index 16ede11e..f01fd28d 100644 --- a/gui/src/js/waterfallHandler.js +++ b/gui/src/js/waterfallHandler.js @@ -21,7 +21,7 @@ export function initWaterfall(id) { export function addDataToWaterfall(data) { data = JSON.parse(data); - spectrums.forEach(element => { + spectrums.forEach((element) => { //console.log(element); element.addData(data); }); @@ -32,13 +32,11 @@ export function addDataToWaterfall(data) { * @param {number} index colormap index to use */ export function setColormap() { - let index = settings.local.wf_theme; if (isNaN(index)) index = 0; - console.log("Setting waterfall colormap to " + index) - spectrums.forEach(element => { + console.log("Setting waterfall colormap to " + index); + spectrums.forEach((element) => { //console.log(element); element.setColorMap(index); }); - } diff --git a/gui/src/store/settingsStore.js b/gui/src/store/settingsStore.js index a04ac320..796bdae0 100644 --- a/gui/src/store/settingsStore.js +++ b/gui/src/store/settingsStore.js @@ -2,9 +2,8 @@ import { reactive, ref, watch } from "vue"; import { getConfig, setConfig } from "../js/api"; -var nconf = require( "nconf"); -nconf.file({file: 'config/config.json'}); - +var nconf = require("nconf"); +nconf.file({ file: "config/config.json" }); // +++ //GUI DEFAULT SETTINGS........ @@ -14,19 +13,19 @@ nconf.file({file: 'config/config.json'}); // +++ nconf.defaults({ local: { - host: "127.0.0.1", - port: "5000", - enable_fft: true, - spectrum: "waterfall", - wf_theme: 2, - theme: "default_light", - high_graphics: true, - update_channel: "alpha", - enable_sys_notification: false, - } + host: "127.0.0.1", + port: "5000", + enable_fft: true, + spectrum: "waterfall", + wf_theme: 2, + theme: "default_light", + high_graphics: true, + update_channel: "alpha", + enable_sys_notification: false, + }, }); -nconf.required(['local:host','local:port']); +nconf.required(["local:host", "local:port"]); export const settingsStore = reactive({ local: { @@ -100,7 +99,7 @@ export const settingsStore = reactive({ }); //Save settings for GUI to config file -settingsStore.local = nconf.get('local'); +settingsStore.local = nconf.get("local"); saveSettingsToConfig(); export function onChange() { @@ -121,8 +120,7 @@ watch(settingsStore.local, (oldValue, newValue) => { }); function saveSettingsToConfig() { - nconf.set('local',settingsStore.local); + nconf.set("local", settingsStore.local); nconf.save(); console.log("Settings saved!"); -}; - +}