succd: Cleanup whitespace in HTML file
This commit is contained in:
parent
34ab508b13
commit
f7752922c2
|
@ -6,29 +6,29 @@
|
|||
<style>
|
||||
body {
|
||||
font-size: 14px;
|
||||
padding: 2em;
|
||||
padding: 2em;
|
||||
}
|
||||
table {
|
||||
font-size: 40px;
|
||||
font-size: 40px;
|
||||
}
|
||||
th, td {
|
||||
background-color: #e8e8e8;
|
||||
padding: 0.4em;
|
||||
background-color: #e8e8e8;
|
||||
padding: 0.4em;
|
||||
}
|
||||
th {
|
||||
font-weight: 100;
|
||||
text-align: right;
|
||||
font-size: 30px;
|
||||
font-weight: 100;
|
||||
text-align: right;
|
||||
font-size: 30px;
|
||||
}
|
||||
td {
|
||||
text-align: left;
|
||||
text-align: left;
|
||||
}
|
||||
td {
|
||||
font-weight: 800;
|
||||
font-weight: 800;
|
||||
}
|
||||
h2 {
|
||||
font-style: italic;
|
||||
font-weight: 100;
|
||||
font-style: italic;
|
||||
font-weight: 100;
|
||||
}
|
||||
button {
|
||||
height: 4.5em;
|
||||
|
@ -56,15 +56,15 @@ td > span {
|
|||
<h2>nothing more permanent than a temporary solution</h2>
|
||||
|
||||
<p style="margin-top: 2em; clear: both;">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Voltage</th>
|
||||
<td id="volts" colspan="4">{{.volts}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pressure</th>
|
||||
<td id="mbar" colspan="4">{{.mbar}}</td>
|
||||
</tr>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Voltage</th>
|
||||
<td id="volts" colspan="4">{{.volts}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pressure</th>
|
||||
<td id="mbar" colspan="4">{{.mbar}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Thresholds</th>
|
||||
<td>Rough:</td>
|
||||
|
@ -72,13 +72,13 @@ td > span {
|
|||
<td>High:</td>
|
||||
<td id="thigh">...</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pumps</th>
|
||||
<tr>
|
||||
<th>Pumps</th>
|
||||
<td>RP:</td>
|
||||
<td id="rp">{{ if .rp }}ON{{ else }}OFF{{ end }}</td>
|
||||
<td>DP:</td>
|
||||
<td id="dp">{{ if .dp }}ON{{ else }}OFF{{ end }}</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Evac Control</th>
|
||||
<td colspan="4">
|
||||
|
@ -90,18 +90,18 @@ td > span {
|
|||
<button id="dpoff">DP Off</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td id="status" colspan="4">OK</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td id="status" colspan="4">OK</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<p style="margin-top: 2em;">
|
||||
<canvas id="graph" width="1024" height="512" style="max-width: 100%;"></canvas>
|
||||
</p>
|
||||
|
||||
<p style="font-style: italic; font-size: 12px; margin-top: 5em;">
|
||||
{{.hostname}} | load: {{.load}} | <a href="/debug/pprof">pprof</a> | <a href="/metrics">metrics</a> | ws ping: <span id="ping">…</span>
|
||||
{{.hostname}} | load: {{.load}} | <a href="/debug/pprof">pprof</a> | <a href="/metrics">metrics</a> | ws ping: <span id="ping">…</span>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
|
@ -237,49 +237,49 @@ let historicalDraw = (w, h) => {
|
|||
};
|
||||
|
||||
window.addEventListener("load", (_) => {
|
||||
console.log("s u c c");
|
||||
console.log("s u c c");
|
||||
|
||||
let status = document.querySelector("#status");
|
||||
let volts = document.querySelector("#volts");
|
||||
let mbar = document.querySelector("#mbar");
|
||||
let ping = document.querySelector("#ping");
|
||||
let status = document.querySelector("#status");
|
||||
let volts = document.querySelector("#volts");
|
||||
let mbar = document.querySelector("#mbar");
|
||||
let ping = document.querySelector("#ping");
|
||||
let trough = document.querySelector("#trough");
|
||||
let thigh = document.querySelector("#thigh");
|
||||
|
||||
// Buttons
|
||||
let pd = document.querySelector("#pd");
|
||||
let vent = document.querySelector("#vent");
|
||||
let rpon = document.querySelector("#rpon");
|
||||
let rpoff = document.querySelector("#rpoff");
|
||||
let pd = document.querySelector("#pd");
|
||||
let vent = document.querySelector("#vent");
|
||||
let rpon = document.querySelector("#rpon");
|
||||
let rpoff = document.querySelector("#rpoff");
|
||||
canvas = document.querySelector("#graph").getContext("2d");
|
||||
|
||||
// TODO(q3k): unhardcode this.
|
||||
historicalDraw(1024, 512);
|
||||
|
||||
// Basic retry loop for connecting to WS.
|
||||
let loc = window.location;
|
||||
let wsloc = "";
|
||||
if (loc.protocol == "https:") {
|
||||
wsloc = "wss:";
|
||||
} else {
|
||||
wsloc = "ws:";
|
||||
}
|
||||
wsloc += "//" + loc.host + "/stream";
|
||||
console.log("Connecting to " + wsloc + "...");
|
||||
let loc = window.location;
|
||||
let wsloc = "";
|
||||
if (loc.protocol == "https:") {
|
||||
wsloc = "wss:";
|
||||
} else {
|
||||
wsloc = "ws:";
|
||||
}
|
||||
wsloc += "//" + loc.host + "/stream";
|
||||
console.log("Connecting to " + wsloc + "...");
|
||||
|
||||
let connected = false;
|
||||
let connect = () => {
|
||||
const socket = new WebSocket(wsloc);
|
||||
socket.addEventListener("open", (event) => {
|
||||
connected = true;
|
||||
console.log("Socket connected!");
|
||||
status.innerHTML = "Online";
|
||||
status.style = "background-color: #60f060;";
|
||||
});
|
||||
socket.addEventListener("message", (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
volts.innerHTML = data.Volts;
|
||||
mbar.innerHTML = data.Mbar;
|
||||
let connected = false;
|
||||
let connect = () => {
|
||||
const socket = new WebSocket(wsloc);
|
||||
socket.addEventListener("open", (event) => {
|
||||
connected = true;
|
||||
console.log("Socket connected!");
|
||||
status.innerHTML = "Online";
|
||||
status.style = "background-color: #60f060;";
|
||||
});
|
||||
socket.addEventListener("message", (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
volts.innerHTML = data.Volts;
|
||||
mbar.innerHTML = data.Mbar;
|
||||
rp.innerHTML = data.RPOn ? "ON" : "OFF";
|
||||
if (data.RPOn) {
|
||||
rp.style = "background-color: #60f060";
|
||||
|
@ -309,22 +309,22 @@ window.addEventListener("load", (_) => {
|
|||
thigh.style = "background-color: #f06060";
|
||||
}
|
||||
historicalPush(data.MbarFloat);
|
||||
ping.innerHTML = Date.now();
|
||||
});
|
||||
socket.addEventListener("close", (event) => {
|
||||
status.innerHTML = "Offline";
|
||||
status.style = "background-color: #f06060;";
|
||||
if (connected) {
|
||||
console.log("Socket dead, reconnecting...");
|
||||
}
|
||||
connected = false;
|
||||
setTimeout(connect, 1000);
|
||||
});
|
||||
socket.addEventListener("error", (event) => {
|
||||
socket.close();
|
||||
});
|
||||
};
|
||||
connect();
|
||||
ping.innerHTML = Date.now();
|
||||
});
|
||||
socket.addEventListener("close", (event) => {
|
||||
status.innerHTML = "Offline";
|
||||
status.style = "background-color: #f06060;";
|
||||
if (connected) {
|
||||
console.log("Socket dead, reconnecting...");
|
||||
}
|
||||
connected = false;
|
||||
setTimeout(connect, 1000);
|
||||
});
|
||||
socket.addEventListener("error", (event) => {
|
||||
socket.close();
|
||||
});
|
||||
};
|
||||
connect();
|
||||
|
||||
pd.addEventListener("click", async (event) => {
|
||||
await fetch("/button/pumpdown");
|
||||
|
|
Loading…
Reference in a new issue