Various front-end changes and controller

This commit is contained in:
30hours 2023-12-06 14:40:34 +00:00
parent ba35a6cebb
commit d585c83cef
8 changed files with 507 additions and 12 deletions

140
html/controller/index.html Normal file
View file

@ -0,0 +1,140 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>blah2</title>
<!-- load lib js -->
<script src="../lib/bootstrap-5.2.3.min.js"></script>
<script src="../lib/plotly-2.20.0.min.js"></script>
<script src="../lib/jquery-3.6.4.min.js"></script>
<!-- load lib css -->
<link rel="stylesheet" href="../lib/bootstrap-5.2.3.min.css">
<style>
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 3.5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 1rem;
}
@media (min-width: 768px) {
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 2.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
}
.navbar-nav {
flex-wrap: wrap;
}
div.plotly-notifier {
visibility: hidden;
}
</style>
</head>
<body style="background-color:#f78c58;">
<div class="container-fluid">
<div class="row align-items-center d-flex">
<a class="btn shadow-none" href="http://30hours.dev">
<h1 class="py-3">30/HOURS</h1>
</a>
<nav class="navbar navbar-light navbar-expand text-center pb-5">
<!-- Links -->
<ul class="navbar-nav mx-auto justify-content-center">
<li class="nav-item px-3 px-md-4">
<a class="navbar-brand mx-0 menu" href="/">RADAR</a>
</li>
<li class="nav-item px-3 px-md-4">
<a class="navbar-brand mx-0 menu text-decoration-underline" href="/controller">CONTROLLER</a>
</li>
</ul>
</nav>
<div class="col-sm-12 col-md-12">
<ul class="list-unstyled text-center label">
<li class="py-1 title">Display</li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/map">Delay-Doppler map</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/maxhold">Max-hold delay Doppler map</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/delay">Detections in delay over time</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/display/detection/doppler">Detections in Doppler over time</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-12">
<ul class="list-unstyled text-center label">
<li class="py-1 title">API</li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/api/map">Map data</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/api/detection">Detection data</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/api/timing">Timing data</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/api/timestamp">Latest timestamp</a></li>
</ul>
</div>
<div class="col-sm-12 col-md-12">
<ul class="list-unstyled text-center label">
<li class="py-1 title">Stash</li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/stash/map">Map data</a></li>
<li class="py-1"><a class="text-reset text-decoration-none" href="/stash/detection">Detection data</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

View file

@ -14,12 +14,12 @@
<title>blah2</title>
<!-- load lib js -->
<script src="../../lib/bootstrap-5.2.3.min.js"></script>
<script src="../../lib/plotly-2.20.0.min.js"></script>
<script src="../../lib/jquery-3.6.4.min.js"></script>
<script src="../../../lib/bootstrap-5.2.3.min.js"></script>
<script src="../../../lib/plotly-2.20.0.min.js"></script>
<script src="../../../lib/jquery-3.6.4.min.js"></script>
<!-- load lib css -->
<link rel="stylesheet" href="../../lib/bootstrap-5.2.3.min.css">
<link rel="stylesheet" href="../../../lib/bootstrap-5.2.3.min.css">
<style>
h1 {
@ -94,6 +94,6 @@
</body>
<script src="../../js/plot_detection.js"></script>
<script src="../../../js/plot_detection_delay.js"></script>
</html>

View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>blah2</title>
<!-- load lib js -->
<script src="../../../lib/bootstrap-5.2.3.min.js"></script>
<script src="../../../lib/plotly-2.20.0.min.js"></script>
<script src="../../../lib/jquery-3.6.4.min.js"></script>
<!-- load lib css -->
<link rel="stylesheet" href="../../../lib/bootstrap-5.2.3.min.css">
<style>
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 3.5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 1rem;
}
@media (min-width: 768px) {
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 2.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
}
.navbar-nav {
flex-wrap: wrap;
}
div.plotly-notifier {
visibility: hidden;
}
</style>
</head>
<body style="background-color:#f78c58;">
<div style="height: 100vh; width: 95vw" class="container-fluid">
<div style="height: 100vh; width: 95vw" class="row d-flex">
<div class="justify-content-center" id="data"></div>
</div>
</body>
<script src="../../../js/plot_detection_doppler.js"></script>
</html>

109
html/display/map/index.html Normal file
View file

@ -0,0 +1,109 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>blah2</title>
<!-- load lib js -->
<script src="../../lib/bootstrap-5.2.3.min.js"></script>
<script src="../../lib/plotly-2.20.0.min.js"></script>
<script src="../../lib/jquery-3.6.4.min.js"></script>
<!-- load lib css -->
<link rel="stylesheet" href="../../lib/bootstrap-5.2.3.min.css">
<style>
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 3.5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 1.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 1rem;
}
@media (min-width: 768px) {
h1 {
font-family: 'Helvetica', sans-serif !important;
font-weight: bold;
font-size: 5rem !important;
}
.menu {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
.title {
font-family: 'Helvetica', sans-serif !important;
font-size: 2.5rem;
font-weight: bold;
text-decoration: underline;
}
.label {
font-family: 'Helvetica', sans-serif !important;
font-size: 2rem;
}
}
.navbar-nav {
flex-wrap: wrap;
}
div.plotly-notifier {
visibility: hidden;
}
</style>
</head>
<body style="background-color:#f78c58;">
<div style="height: 100vh; width: 95vw" class="container-fluid">
<div style="height: 100vh; width: 95vw" class="row d-flex">
<div class="justify-content-center" id="data"></div>
</div>
</body>
<script>
var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var urlMap = ''
if (isLocalHost) {
urlMap = '//' + host + ':3000/api/map?timestamp=' + Date.now();
} else {
urlMap = '//' + host + '/api/map?timestamp=' + Date.now();
}
</script>
<script src="../../js/plot_map.js"></script>
</html>

View file

@ -86,12 +86,30 @@
<div style="height: 100vh; width: 95vw" class="container-fluid">
<div class="row align-items-center d-flex">
<a class="btn shadow-none" href="http://30hours.dev">
<h1 class="py-3">30/HOURS</h1>
</a>
<nav class="navbar navbar-light navbar-expand text-center pb-5">
<ul class="navbar-nav mx-auto justify-content-center">
<li class="nav-item px-3 px-md-4">
<a class="navbar-brand mx-0 menu text-decoration-underline" href="#">RADAR</a>
</li>
<li class="nav-item px-3 px-md-4">
<a class="navbar-brand mx-0 menu" href="/controller">CONTROLLER</a>
</li>
</ul>
</nav>
<div style="height: 100vh; width: 95vw" class="row d-flex">
<div class="justify-content-center" id="data"></div>
</div>
</div>
</body>
<script>

View file

@ -51,7 +51,7 @@ var layout = {
},
yaxis: {
title: {
text: 'Bistatic Range (km)',
text: 'Bistatic Delay (km)',
font: {
size: 24
}

View file

@ -0,0 +1,130 @@
var timestamp = -1;
var nRows = 3;
var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var range_x = [];
var range_y = [];
// setup API
var urlTimestamp = '';
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp?timestamp=' + Date.now();
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
}
var urlDetection = '';
if (isLocalHost) {
urlDetection = '//' + host + ':3000/stash/detection?timestamp=' + Date.now();
} else {
urlDetection = '//' + host + '/stash/detection?timestamp=' + Date.now();
}
// setup plotly
var layout = {
autosize: false,
margin: {
l: 50,
r: 50,
b: 50,
t: 10,
pad: 0
},
hoverlabel: {
namelength: 0
},
width: document.getElementById('data').offsetWidth,
height: document.getElementById('data').offsetHeight,
plot_bgcolor: "rgba(0,0,0,0)",
paper_bgcolor: "rgba(0,0,0,0)",
annotations: [],
displayModeBar: false,
xaxis: {
title: {
text: 'Timestamp',
font: {
size: 24
}
},
showgrid: false,
ticks: '',
side: 'bottom'
},
yaxis: {
title: {
text: 'Bistatic Doppler (Hz)',
font: {
size: 24
}
},
showgrid: false,
ticks: '',
ticksuffix: ' ',
autosize: false,
categoryorder: "total descending"
}
};
var config = {
displayModeBar: false,
scrollZoom: true
}
// setup plotly data
var data = [
{
z: [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
colorscale: 'Jet',
type: 'heatmap'
}
];
Plotly.newPlot('data', data, layout, config);
// callback function
var intervalId = window.setInterval(function () {
// check if timestamp is updated
var timestampData = $.get(urlTimestamp, function () { })
.done(function (data) {
if (timestamp != data) {
timestamp = data;
// get new data
var apiData = $.getJSON(urlDetection, function () { })
.done(function (data) {
// case draw new plot
if (data.nRows != nRows) {
nRows = data.nRows;
var trace1 = {
x: data.timestamp,
y: data.doppler,
mode: 'markers',
type: 'scatter'
};
var data_trace = [trace1];
Plotly.newPlot('data', data_trace, layout, config);
}
// case update plot
else {
var trace_update = {
x: [data.timestamp],
y: [data.doppler]
};
Plotly.update('data', trace_update);
}
})
.fail(function () {
})
.always(function () {
});
}
})
.fail(function () {
})
.always(function () {
});
}, 100);

View file

@ -21,7 +21,7 @@ if (isLocalHost) {
// setup plotly
var layout = {
autosize: false,
autosize: true,
margin: {
l: 50,
r: 50,
@ -32,8 +32,6 @@ var layout = {
hoverlabel: {
namelength: 0
},
width: document.getElementById('data').offsetWidth,
height: document.getElementById('data').offsetHeight,
plot_bgcolor: "rgba(0,0,0,0)",
paper_bgcolor: "rgba(0,0,0,0)",
annotations: [],
@ -62,8 +60,9 @@ var layout = {
}
};
var config = {
displayModeBar: false,
scrollZoom: true
responsive: true,
displayModeBar: false
//scrollZoom: true
}
// setup plotly data