reformatted file structure and reformatted for phones, as well as fixed web sockets for remote devices
This commit is contained in:
@@ -3,13 +3,14 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/luxon@2.3.1/build/global/luxon.min.js"></script>
|
||||
<canvas id="line-chart" class="grad-border mt-3 mb-4" width="600" height="360"></canvas>
|
||||
{% if cur_miners|length == 0 %}<a role="button" href="{{url_for('scan')}}" id="noMiners" class="w-100 btn btn-info">Click here to add miners.</a>{% endif %}
|
||||
{% if cur_miners|length == 0 %}<a role="button" href="/scan" id="noMiners" class="w-100 btn btn-info">Click here to add miners.</a>{% endif %}
|
||||
|
||||
|
||||
<div id="errors"></div>
|
||||
|
||||
<script>
|
||||
var ws = new WebSocket("ws://localhost:80/dashboard/ws");
|
||||
if (!window.WebSocket) alert("WebSocket not supported by this browser");
|
||||
var ws = new WebSocket("ws://{{request.url.hostname}}:80/dashboard/ws");
|
||||
let all_data = []
|
||||
let all_labels = []
|
||||
ws.onmessage = function(event) {
|
||||
@@ -21,7 +22,7 @@ ws.onmessage = function(event) {
|
||||
if (new_data["miners"][i].hasOwnProperty("error")) {
|
||||
if (!document.getElementById(new_data["miners"][i]["ip"] + "_error")) {
|
||||
errors.innerHTML += "<div id='" + new_data["miners"][i]["ip"] + "_error" +
|
||||
"' class='d-flex align-items-center p-1 mb-1 ms-4 alert alert-danger'><strong class='p-0 m-0'>" +
|
||||
"' class='d-flex align-items-center p-1 mb-1 alert alert-danger'><strong class='p-0 m-0'>" +
|
||||
new_data["miners"][i]["ip"] + ": " +
|
||||
new_data["miners"][i]["error"] +
|
||||
"</strong><div class='spinner-border spinner-border-sm ms-auto'></div></div>"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/luxon@2.3.1/build/global/luxon.min.js"></script>
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
<h2 class="ms-4">{{miner}}</h2>
|
||||
<h2 class="ms-3 mt-1">{{miner}}</h2>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="d-flex flex-row-reverse">
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex align-items-center mt-4 ms-4 alert alert-secondary">
|
||||
<div class="d-flex align-items-center mt-4 alert alert-secondary">
|
||||
<div class="mx-auto">Model:</div>
|
||||
<div class="mx-auto fw-bolder" id="minerModel">?</div>
|
||||
<div class="mx-auto" style="border-left: 1px solid grey; height: 50px;"></div>
|
||||
@@ -61,13 +61,13 @@
|
||||
<div class="mx-auto fw-bolder" id="minerHashrate">?</div>
|
||||
</div>
|
||||
|
||||
<div id="errorContainer" class="d-flex align-items-center mt-4 ms-4 alert alert-danger invisible">
|
||||
<div id="errorContainer" class="d-flex align-items-center mt-4 alert alert-danger invisible">
|
||||
<strong id="errorCode"></strong>
|
||||
<div class="spinner-border ms-auto"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ws = new WebSocket("ws://localhost:80/miner/{{miner}}/ws");
|
||||
var ws = new WebSocket("ws://{{request.url.hostname}}:80/miner/{{miner}}/ws");
|
||||
let all_data = []
|
||||
let all_labels = []
|
||||
ws.onmessage = function(event) {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<link href="{{ url_for('static', path='/navbar.css')}}" rel="stylesheet">
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src * gap: data: blob: 'unsafe-inline' 'unsafe-eval' ws: wss:;">
|
||||
</head>
|
||||
<body>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||||
@@ -31,9 +33,9 @@
|
||||
</svg>
|
||||
|
||||
|
||||
<header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
|
||||
<a class="d-md-none col-md-3 col-lg-2 me-0 px-3" style="height: 50px;" href="#"></a>
|
||||
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<header class="navbar navbar-dark sticky-top bg-dark flex-xl-nowrap p-0 shadow">
|
||||
<a class="d-lg-none col-lg-3 col-xl-2 me-0 px-3" style="height: 50px;" href="#"></a>
|
||||
<button class="navbar-toggler position-absolute d-lg-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
@@ -47,31 +49,31 @@
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<nav id="sidebarMenu" class="text-white bg-dark col-md-3 col-lg-2 d-md-block sidebar collapse">
|
||||
<nav id="sidebarMenu" class="text-white bg-dark col-lg-3 col-xl-2 d-lg-block sidebar collapse">
|
||||
<div class="position-sticky pt-3">
|
||||
<ul class="nav nav-pills flex-column">
|
||||
<li class="nav-item mb-1 mx-2">
|
||||
<a href="{{url_for('dashboard')}}" class="nav-link {% if request.path == '/dashboard' %}active{% else %}text-white{% endif %}">
|
||||
<a href="/dashboard" class="nav-link {% if request.path.strip('/') == 'dashboard' %}active{% else %}text-white{% endif %}">
|
||||
<svg class="bi me-2" width="16" height="16"><use xlink:href="#dashboard"></use></svg>
|
||||
Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item mb-1 mx-2">
|
||||
<a href="" class="nav-link {% if request.path == '/scan' or request.path.split('/')[1] == 'miner' %}active{% else %}text-white{% endif %}" data-bs-toggle="collapse" data-bs-target="#miners-collapse" aria-expanded="false">
|
||||
<a href="" class="nav-link {% if request.path.strip('/') == 'scan' or request.path.split('/')[1] == 'miner' %}active{% else %}text-white{% endif %}" data-bs-toggle="collapse" data-bs-target="#miners-collapse" aria-expanded="false">
|
||||
<svg class="bi me-2" width="16" height="16"><use xlink:href="#miners"></use></svg>
|
||||
Miners
|
||||
</a>
|
||||
<div class="collapse mt-1" id="miners-collapse" style="">
|
||||
<ul id="navMiners" class="btn-toggle-nav overflow-auto list-unstyled fw-normal pb-1 small">
|
||||
<li>
|
||||
<a href="{{url_for('scan')}}" class="nav-link {% if request.path == '/scan' %}active{% else %}text-white{% endif %}">
|
||||
<a href="/scan" class="nav-link {% if request.path.strip('/') == 'scan' %}active{% else %}text-white{% endif %}">
|
||||
<svg class="bi me-2 mt-1" width="16" height="16"><use xlink:href="#scan"></use></svg>
|
||||
Add Miners
|
||||
</a>
|
||||
</li>
|
||||
{% for miner in cur_miners %}
|
||||
<li>
|
||||
<a href="{{url_for('miner')}}/{{miner}}" class="nav-link {% if request.path == '/miner/' + miner %}active{% else %}text-white{% endif %}">
|
||||
<a href="/miner/{{miner}}" class="nav-link {% if request.path.strip('/') == 'miner/' + miner %}active{% else %}text-white{% endif %}">
|
||||
<svg class="bi me-2 mt-1" width="16" height="16"><use xlink:href="#miner"></use></svg>
|
||||
{{miner}}
|
||||
</a>
|
||||
@@ -85,7 +87,7 @@
|
||||
<li class="border-top my-3"></li>
|
||||
|
||||
<li class="nav-item mb-1 mx-2">
|
||||
<a href="/settings" class="nav-link {% if request.path == '/settings' %}active{% else %}text-white{% endif %}">
|
||||
<a href="/settings" class="nav-link {% if request.path.strip('/') == 'settings' %}active{% else %}text-white{% endif %}">
|
||||
<svg class="bi me-2" width="16" height="16"><use xlink:href="#settings"></use></svg>
|
||||
Settings
|
||||
</a>
|
||||
@@ -95,7 +97,7 @@
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="col-md-9 ms-sm-auto col-lg-10 px-md-4 ps-4">
|
||||
<div class="col-lg-9 ms-md-auto col-xl-10 px-lg-4 ps-4">
|
||||
{% block content %}
|
||||
|
||||
{% endblock content %}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
window.post = function(url, data) {
|
||||
return fetch(url, {method: "POST", headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)});
|
||||
}
|
||||
var ws = new WebSocket("ws://localhost:80/scan/ws");
|
||||
var ws = new WebSocket("ws://{{request.url.hostname}}:80/scan/ws");
|
||||
ws.onmessage = function(event) {
|
||||
if (event.data == "Done") {
|
||||
document.getElementById("scanButton").innerHTML = "Scan"
|
||||
|
||||
Reference in New Issue
Block a user