adjusted busy slot visualisation

This commit is contained in:
DJ2LS 2023-10-17 15:32:28 +02:00
parent 854b2a464a
commit f87c6e61b4
2 changed files with 87 additions and 26 deletions

View file

@ -242,48 +242,89 @@ export default {
</div>
</div>
<div class="btn-group" role="group" aria-label="Busy indicators">
<button
class="btn btn-sm ms-2 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.channel_busy === 'True',
'btn-outline-secondary': state.channel_busy === 'False',
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
busy
</button>
<button
class="btn btn-sm ms-2 disabled"
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.channel_busy === 'True',
'btn-outline-secondary': state.channel_busy === 'False',
'btn-warning': state.getChannelBusySlotState(0) === true,
'btn-outline-secondary': state.getChannelBusySlotState(0) === false,
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
S1
</button>
<button
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.getChannelBusySlotState(1) === true,
'btn-outline-secondary': state.getChannelBusySlotState(1) === false,
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
S2
</button>
<button
class="btn btn-sm disabled"
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.getChannelBusySlotState(2) === true,
'btn-outline-secondary': state.getChannelBusySlotState(2) === false,
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
S3
</button>
<button
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.getChannelBusySlotState(3) === true,
'btn-outline-secondary': state.getChannelBusySlotState(3) === false,
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
S4
</button>
<button
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.getChannelBusySlotState(4) === true,
'btn-outline-secondary': state.getChannelBusySlotState(4) === false,
}"
title="Channel busy state: <strong class='text-success'>not busy</strong> / <strong class='text-danger'>busy </strong>"
>
S5
</button>
<button
class="btn btn-sm p-1 disabled"
type="button"
data-bs-placement="top"
data-bs-toggle="tooltip"

View file

@ -59,6 +59,25 @@ export const useStateStore = defineStore("stateStore", () => {
var python_version = ref();
var tnc_version = ref();
function getChannelBusySlotState(slot){
const slot_state = channel_busy_slot.value;
if (typeof slot_state !== 'undefined') {
// Replace 'False' with 'false' to match JavaScript's boolean representation
const string = slot_state.replace(/False/g, 'false').replace(/True/g, 'true');
// Parse the string to get an array
const arr = JSON.parse(string);
return arr[slot]
} else {
// Handle the undefined case
return false;
}
}
function updateTncState(state) {
tnc_connection.value = state;
@ -129,6 +148,7 @@ export const useStateStore = defineStore("stateStore", () => {
fft,
channel_busy,
channel_busy_slot,
getChannelBusySlotState,
scatter,
ptt_state,
s_meter_strength_percent,