Footer tweaks

This commit is contained in:
Mashintime 2023-02-05 03:06:58 -05:00
parent 9af3d64d1b
commit b644e7bf44
2 changed files with 91 additions and 66 deletions

View file

@ -1489,16 +1489,43 @@ document.getElementById('hamlib_rigctld_stop').addEventListener('click', () => {
//Listen for events caused by tnc 'tnc-message' receiving
ipcRenderer.on('action-update-reception-status', (event, arg) => {
var data =arg["data"][0];
//var txprog = document.getElementById("transmission_progress")
var txprog = document.getElementById("transmission_progress")
ipcRenderer.send('request-show-electron-progressbar',data.percent);
txprog.setAttribute("aria-valuenow", data.percent);
txprog.setAttribute("style", "width:" + data.percent + "%;");
// SET TIME LEFT UNTIL FINIHED
if (typeof(data.finished) == 'undefined') {
var time_left = "time left: estimating";
} else {
var arq_seconds_until_finish = data.finished
var hours = Math.floor(arq_seconds_until_finish / 3600);
var minutes = Math.floor((arq_seconds_until_finish % 3600) / 60 );
var seconds = arq_seconds_until_finish % 60;
if(hours < 0) {
hours = 0;
}
if(minutes < 0) {
minutes = 0;
}
if(seconds < 0) {
seconds = 0;
}
if (hours > 0)
{
time_left = "time left: ~"+ hours.toString().padStart(2,'0') + ":" + minutes.toString().padStart(2,'0') + "." + seconds.toString().padStart(2,'0');
} else {
time_left = "time left: ~"+ minutes.toString().padStart(2,'0') + "." + seconds.toString().padStart(2,'0');
}
}
var time_left = "<strong>" + time_left +" || Speed/min: ";
// SET BYTES PER MINUTE
if (typeof(data.bytesperminute) == 'undefined') {
var arq_bytes_per_minute = 0;
} else {
var arq_bytes_per_minute = data.bytesperminute;
}
document.getElementById("bytes_per_min_rx").textContent = arq_bytes_per_minute;
// SET BYTES PER MINUTE COMPRESSED
var compress = data.compression;
@ -1506,11 +1533,14 @@ ipcRenderer.on('action-update-reception-status', (event, arg) => {
compress = 1;
}
var arq_bytes_per_minute_compressed = Math.round(arq_bytes_per_minute * compress);
document.getElementById("bytes_per_min_rx").setAttribute('data-bs-original-title',"raw data rate modem in bytes per minute (" + arq_bytes_per_minute_compressed + " compressed)");
time_left += formatBytes(arq_bytes_per_minute,1) + " (comp: " + formatBytes(arq_bytes_per_minute_compressed,1) + ")</strong>";
if (!(typeof(data.dxcallsign) == 'undefined')) {
//console.log("Received dxcallsign(rx-status): ", data.dxcallsign);
document.getElementById("txtConnectedWith").textContent=data.dxcallsign;
document.getElementById("txtConnectedWith").textContent='de ' + data.dxcallsign;
}
document.getElementById("transmission_timeleft").innerHTML = time_left;
});
//Listen for events caused by tnc 'tnc-message's
@ -1521,15 +1551,14 @@ ipcRenderer.on('action-update-transmission-status', (event, arg) => {
txprog.setAttribute("aria-valuenow", data.percent);
txprog.setAttribute("style", "width:" + data.percent + "%;");
// SET TIME LEFT UNTIL FINIHED
if (typeof(data.finished) == 'undefined') {
var time_left = 0;
// SET TIME LEFT UNTIL FINIHED
if (typeof(data.finished) == 'undefined') {
var time_left = "time left: estimating";
} else {
var arq_seconds_until_finish = data.finished
var hours = Math.floor(arq_seconds_until_finish / 3600);
var minutes = Math.floor((arq_seconds_until_finish % 3600) / 60 );
var seconds = arq_seconds_until_finish % 60;
if(hours < 0) {
hours = 0;
}
@ -1539,9 +1568,14 @@ ipcRenderer.on('action-update-transmission-status', (event, arg) => {
if(seconds < 0) {
seconds = 0;
}
var time_left = "time left: ~ "+ minutes + "min" + " " + seconds + "s";
if (hours > 0)
{
time_left = "time left: ~"+ hours.toString().padStart(2,'0') + ":" + minutes.toString().padStart(2,'0') + "." + seconds.toString().padStart(2,'0');
} else {
time_left = "time left: ~"+ minutes.toString().padStart(2,'0') + "." + seconds.toString().padStart(2,'0');
}
}
document.getElementById("transmission_timeleft").textContent = time_left;
var time_left = "<strong>" + time_left +" || Speed/min: ";
// SET BYTES PER MINUTE
if (typeof(data.bytesperminute) == 'undefined') {
@ -1549,7 +1583,6 @@ ipcRenderer.on('action-update-transmission-status', (event, arg) => {
} else {
var arq_bytes_per_minute = data.bytesperminute;
}
document.getElementById("bytes_per_min").textContent = arq_bytes_per_minute;
// SET BYTES PER MINUTE COMPRESSED
var compress = data.compression;
@ -1557,14 +1590,28 @@ ipcRenderer.on('action-update-transmission-status', (event, arg) => {
compress = 1;
}
var arq_bytes_per_minute_compressed = Math.round(arq_bytes_per_minute * compress);
document.getElementById("bytes_per_min").setAttribute('data-bs-original-title',"raw data rate modem in bytes per minute (" + arq_bytes_per_minute_compressed + " compressed)");
if (!(typeof(data.dxcallsign) == 'undefined')) {
//console.log("Received dxcallsign(tx-status): ", data.dxcallsign);
document.getElementById("txtConnectedWith").textContent=data.dxcallsign;
}
time_left += formatBytes(arq_bytes_per_minute,1) + " (comp: " + formatBytes(arq_bytes_per_minute_compressed,1) + ")</strong>";
if (!(typeof(data.dxcallsign) == 'undefined')) {
document.getElementById("txtConnectedWith").textContent='to ' + data.dxcallsign;
}
document.getElementById("transmission_timeleft").innerHTML = time_left;
});
//https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
function formatBytes(bytes, decimals = 1) {
if (!+bytes) return '0 Bytes'
const k = 1024
const dm = decimals < 0 ? 0 : decimals
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`
}
var slowRollTable=4;
ipcRenderer.on('action-update-tnc-state', (event, arg) => {
@ -2394,7 +2441,6 @@ ipcRenderer.on('action-update-rx-buffer', (event, arg) => {
console.log(err);
});
}
});
ipcRenderer.on('run-tnc-command', (event, arg) => {

View file

@ -1338,7 +1338,7 @@
</div>
</div>
</div>
<div class="col-sm-2">
<div class="col-sm-3">
<div class="input-group input-group-sm">
<div class="btn-group dropup me-1">
<button type="button" class="btn btn-sm btn-secondary dropdown-toggle" data-bs-toggle="dropdown"
@ -1395,48 +1395,27 @@
</div>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="input-group input-group-sm">
<span class="input-group-text" id="basic-addon1">
<i class="bi bi-speedometer2" style="font-size: 1rem; color: black;"></i>TX
<i class="bi bi-speedometer2" style="font-size: 1rem; color: black;"></i>
</span>
<span class="input-group-text" data-bs-placement="bottom" data-bs-toggle="tooltip"
data-bs-html="false" title="actual speed level">
<i id="speed_level" class="bi bi-reception-0" style="font-size: 1rem; color: black;"></i>
</span>
<span class="input-group-text" id="bytes_per_min" data-bs-placement="bottom"
data-bs-toggle="tooltip" data-bs-html="false"
title="raw data rate modem in bytes per minute">---</span>
<!--
<span class="input-group-text" id="bytes_per_min_compressed" data-bs-placement="bottom"
data-bs-toggle="tooltip" data-bs-html="false"
title="data rate including file compression in bytes per minute">---</span>
-->
<span class="input-group-text" id="basic-addon1">
<i class="bi bi-speedometer2" style="font-size: 1rem; color: black;"></i>RX
</span>
<span class="input-group-text" id="bytes_per_min_rx" data-bs-placement="bottom"
data-bs-toggle="tooltip" data-bs-html="false"
title="raw data rate modem in bytes per minute">---</span>
<!--
<span class="input-group-text" id="bytes_per_min_compressed_rx" data-bs-placement="bottom"
data-bs-toggle="tooltip" data-bs-html="false"
title="data rate including file compression in bytes per minute">---</span>
-->
<span class="input-group-text" id="basic-addon1">
<i class="bi bi-file-earmark-binary" style="font-size: 1rem; color: black;"></i>
</span>
<span class="input-group-text" id="total_bytes" data-bs-placement="bottom" data-bs-toggle="tooltip"
data-bs-html="false" title="total bytes processed">---</span>
<span class="input-group-text" id="basic-addon1"
data-bs-toggle="tooltip" title="Connected with"><span class="bi bi-chat-fill"
id="spnConnectedWith"></span></span><span class="input-group-text"
id="txtConnectedWith">------</span>
<span class="input-group-text" id="basic-addon1" data-bs-toggle="tooltip" title="Indicates if a session is active"><span class="bi bi-chat-fill" id="spnConnectedWith"></span></span>
<span class="input-group-text" id="txtConnectedWith" data-bs-toggle="tooltip" title="Connected with">------</span>
</div>
</div>
<div class="col-lg-4">
<div style="margin-right: 2px;">
<div class="progress w-100" style="height: 30px;min-width: 200px;">
<div class="progress w-100" style="height: 30px;min-width: 300px;">
<div class="progress-bar progress-bar-striped bg-primary force-gpu" id="transmission_progress"
role="progressbar" style="width: 0%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
</div>