mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Colorize check modal icon based on healtth
This commit is contained in:
parent
c19586369e
commit
0e53b34ed6
2 changed files with 36 additions and 8 deletions
|
@ -20,6 +20,7 @@ import infoScreen from "./infoScreen.vue";
|
|||
|
||||
import { stopTransmission } from "../js/sock.js";
|
||||
import { getModemConfig } from "../js/api";
|
||||
import main_modem_healthcheck from "./main_modem_healthcheck.vue";
|
||||
|
||||
function stopAllTransmissions() {
|
||||
console.log("stopping transmissions");
|
||||
|
@ -53,14 +54,7 @@ function stopAllTransmissions() {
|
|||
role="tablist"
|
||||
style="margin-top: 100px"
|
||||
>
|
||||
<a
|
||||
class="btn border btn-outline-secondary list-group-item mb-5"
|
||||
data-bs-html="false"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#modemCheck"
|
||||
title="Check FreeDATA status"
|
||||
><i class="bi bi-activity h3"></i>
|
||||
</a>
|
||||
<main_modem_healthcheck />
|
||||
|
||||
<a
|
||||
class="list-group-item list-group-item-dark list-group-item-action border-0 rounded-3 mb-2 active"
|
||||
|
|
34
gui/src/components/main_modem_healthcheck.vue
Normal file
34
gui/src/components/main_modem_healthcheck.vue
Normal file
|
@ -0,0 +1,34 @@
|
|||
<script setup lang="ts">
|
||||
|
||||
import { setActivePinia } from "pinia";
|
||||
import pinia from "../store/index";
|
||||
setActivePinia(pinia);
|
||||
|
||||
import { useSettingsStore } from "../store/settingsStore.js";
|
||||
const settings = useSettingsStore(pinia);
|
||||
|
||||
import { useStateStore } from "../store/stateStore.js";
|
||||
const state = useStateStore(pinia);
|
||||
|
||||
function getOverallHealth() {
|
||||
//Return a number indicating health for icon bg color; lower the number the healthier
|
||||
let health = 0
|
||||
if (state.modem_connection !== "connected") health +=5;
|
||||
if (!state.is_modem_running) health+=3;
|
||||
if (settings.radiocontrol==="rigctld" && ( state.rigctld_started === undefined || state.rigctld_started === "false")) health += 2;
|
||||
if (process.env.FDUpdateAvail === '1') health+=1;
|
||||
return health;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<a
|
||||
class="btn border btn-outline-secondary list-group-item mb-5"
|
||||
data-bs-html="false"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#modemCheck"
|
||||
title="Check FreeDATA status"
|
||||
:class=" getOverallHealth() >4 ? 'bg-danger' : getOverallHealth() < 2 ? '' : 'bg-warning'"
|
||||
><i class="bi bi-activity h3"></i>
|
||||
</a>
|
||||
|
||||
</template>
|
Loading…
Reference in a new issue