mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
d84dc12fb0
commit
2e4b06732e
3 changed files with 26 additions and 15 deletions
|
@ -1,5 +1,4 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import { setActivePinia } from "pinia";
|
import { setActivePinia } from "pinia";
|
||||||
import pinia from "../store/index";
|
import pinia from "../store/index";
|
||||||
setActivePinia(pinia);
|
setActivePinia(pinia);
|
||||||
|
@ -11,24 +10,33 @@ import { useStateStore } from "../store/stateStore.js";
|
||||||
const state = useStateStore(pinia);
|
const state = useStateStore(pinia);
|
||||||
|
|
||||||
function getOverallHealth() {
|
function getOverallHealth() {
|
||||||
//Return a number indicating health for icon bg color; lower the number the healthier
|
//Return a number indicating health for icon bg color; lower the number the healthier
|
||||||
let health = 0
|
let health = 0;
|
||||||
if (state.modem_connection !== "connected") health +=5;
|
if (state.modem_connection !== "connected") health += 5;
|
||||||
if (!state.is_modem_running) health+=3;
|
if (!state.is_modem_running) health += 3;
|
||||||
if (settings.radiocontrol==="rigctld" && ( state.rigctld_started === undefined || state.rigctld_started === "false")) health += 2;
|
if (
|
||||||
if (process.env.FDUpdateAvail === '1') health+=1;
|
settings.radiocontrol === "rigctld" &&
|
||||||
return health;
|
(state.rigctld_started === undefined || state.rigctld_started === "false")
|
||||||
|
)
|
||||||
|
health += 2;
|
||||||
|
if (process.env.FDUpdateAvail === "1") health += 1;
|
||||||
|
return health;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<a
|
<a
|
||||||
class="btn border btn-outline-secondary list-group-item mb-5"
|
class="btn border btn-outline-secondary list-group-item mb-5"
|
||||||
data-bs-html="false"
|
data-bs-html="false"
|
||||||
data-bs-toggle="modal"
|
data-bs-toggle="modal"
|
||||||
data-bs-target="#modemCheck"
|
data-bs-target="#modemCheck"
|
||||||
title="Check FreeDATA status"
|
title="Check FreeDATA status"
|
||||||
:class=" getOverallHealth() >4 ? 'bg-danger' : getOverallHealth() < 2 ? '' : 'bg-warning'"
|
:class="
|
||||||
|
getOverallHealth() > 4
|
||||||
|
? 'bg-danger'
|
||||||
|
: getOverallHealth() < 2
|
||||||
|
? ''
|
||||||
|
: 'bg-warning'
|
||||||
|
"
|
||||||
><i class="bi bi-activity h3"></i>
|
><i class="bi bi-activity h3"></i>
|
||||||
</a>
|
</a>
|
||||||
|
</template>
|
||||||
</template>
|
|
||||||
|
|
|
@ -35,4 +35,4 @@ export function getModemVersion() {
|
||||||
}
|
}
|
||||||
export function getModemCurrentState() {
|
export function getModemCurrentState() {
|
||||||
getFromServer(settings.modem_host, settings.modem_port, "modem/state", null);
|
getFromServer(settings.modem_host, settings.modem_port, "modem/state", null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,10 @@ export function stateDispatcher(data) {
|
||||||
|
|
||||||
stateStore.modem_connection = "connected";
|
stateStore.modem_connection = "connected";
|
||||||
|
|
||||||
if (data["freedata-message"] == "state-change" || data["freedata-message"] == "state" ) {
|
if (
|
||||||
|
data["freedata-message"] == "state-change" ||
|
||||||
|
data["freedata-message"] == "state"
|
||||||
|
) {
|
||||||
stateStore.channel_busy = data["channel_busy"];
|
stateStore.channel_busy = data["channel_busy"];
|
||||||
stateStore.is_codec2_traffic = data["is_codec2_traffic"];
|
stateStore.is_codec2_traffic = data["is_codec2_traffic"];
|
||||||
stateStore.is_modem_running = data["is_modem_running"];
|
stateStore.is_modem_running = data["is_modem_running"];
|
||||||
|
|
Loading…
Reference in a new issue