FreeDATA/gui_vue/src/components/main_top_navbar.vue

112 lines
3.7 KiB
Vue
Raw Normal View History

2023-09-10 06:23:40 +00:00
<script setup lang="ts">
2023-10-03 13:15:17 +00:00
import { setActivePinia } from "pinia";
import pinia from "../store/index";
2023-09-10 06:23:40 +00:00
setActivePinia(pinia);
2023-10-03 13:15:17 +00:00
import { useStateStore } from "../store/stateStore.js";
2023-09-10 06:23:40 +00:00
const state = useStateStore(pinia);
2023-10-03 13:15:17 +00:00
import { useSettingsStore } from "../store/settingsStore.js";
2023-09-10 06:23:40 +00:00
const settings = useSettingsStore(pinia);
2023-10-20 11:47:42 +00:00
import { startModem, stopModem } from "../js/daemon.js";
2023-09-13 17:33:03 +00:00
2023-10-20 11:47:42 +00:00
function startStopModem() {
switch (state.modem_running_state) {
2023-10-03 13:15:17 +00:00
case "stopped":
2023-10-03 19:28:24 +00:00
settings.rx_audio = (<HTMLInputElement>document.getElementById("audio_input_selectbox")).value;
settings.tx_audio = (<HTMLInputElement>document.getElementById("audio_output_selectbox")).value;
2023-09-13 17:33:03 +00:00
2023-10-20 11:47:42 +00:00
startModem();
2023-10-03 13:15:17 +00:00
break;
case "running":
2023-10-20 11:47:42 +00:00
stopModem();
2023-10-03 13:15:17 +00:00
break;
default:
}
}
2023-09-10 06:23:40 +00:00
</script>
<template>
2023-10-03 13:15:17 +00:00
<nav class="navbar bg-body-tertiary border-bottom">
<div class="mx-auto">
<span class="badge bg-secondary me-4"
2023-10-20 11:47:42 +00:00
>Modem location | {{ settings.modem_host }}</span
2023-10-03 13:15:17 +00:00
>
<span class="badge bg-secondary me-4"
2023-10-20 11:47:42 +00:00
>Service | {{ state.modem_running_state }}</span
2023-10-03 13:15:17 +00:00
>
<div class="btn-group" role="group"></div>
<div class="btn-group me-4" role="group">
2023-09-10 06:23:40 +00:00
<button
type="button"
2023-10-20 11:47:42 +00:00
id="startModem"
2023-10-03 13:15:17 +00:00
class="btn btn-sm btn-outline-success"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
2023-10-20 11:47:42 +00:00
title="Start the Modem. Please set your audio and radio settings first!"
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'running' }"
2023-09-10 06:23:40 +00:00
>
2023-10-03 13:15:17 +00:00
<i class="bi bi-play-fill"></i>
2023-10-20 11:47:42 +00:00
<span class="ms-2">start modem</span>
2023-10-03 13:15:17 +00:00
</button>
<button
type="button"
2023-10-20 11:47:42 +00:00
id="stopModem"
2023-10-03 13:15:17 +00:00
class="btn btn-sm btn-outline-danger"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
2023-10-20 11:47:42 +00:00
title="Stop the Modem."
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'stopped' }"
2023-10-03 13:15:17 +00:00
>
<i class="bi bi-stop-fill"></i>
2023-10-20 11:47:42 +00:00
<span class="ms-2">stop modem</span>
2023-09-10 06:23:40 +00:00
</button>
</div>
2023-10-03 13:15:17 +00:00
<button
type="button"
2023-10-20 11:47:42 +00:00
id="openHelpModalStartStopModem"
2023-10-03 13:15:17 +00:00
data-bs-toggle="modal"
2023-10-20 11:47:42 +00:00
data-bs-target="#startStopModemHelpModal"
2023-10-03 13:15:17 +00:00
class="btn me-4 p-0 border-0"
>
<i class="bi bi-question-circle" style="font-size: 1rem"></i>
</button>
</div>
<!--
2023-09-10 06:23:40 +00:00
<div class="btn-toolbar" role="toolbar">
<span data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-html="false"
title="View the received files. This is currently under development!">
<button class="btn btn-sm btn-primary me-2" data-bs-toggle="offcanvas" data-bs-target="#receivedFilesSidebar" id="openReceivedFiles" type="button" > <strong>Files </strong>
<i class="bi bi-file-earmark-arrow-up-fill" style="font-size: 1rem; color: white;"></i>
<i class="bi bi-file-earmark-arrow-down-fill" style="font-size: 1rem; color: white;"></i>
</button>
</span> <span data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-html="false" title="Send files through HF. This is currently under development!">
<button class="btn btn-sm btn-primary me-2" id="openDataModule" data-bs-toggle="offcanvas" data-bs-target="#transmitFileSidebar" type="button" style="display: None;"> <strong>TX File </strong>
<i class="bi bi-file-earmark-arrow-up-fill" style="font-size: 1rem; color: white;"></i>
</button>
</span> <span data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-trigger="hover" data-bs-html="true"
title="Settings and Info">
</span>
</div>
2023-10-03 13:15:17 +00:00
--></nav>
</template>