flask_inference_api3 / online.html
DmitrMakeev's picture
Update online.html
0a11444 verified
raw
history blame
10.1 kB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/ico" href="/resolve/main/list.ico">
<title>My static Space</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="https://vk-ai-system-flask-inference-api3.hf.space/online">
<img src="/resolve/main/list.png" width="30" height="30" class="d-inline-block align-top" alt="">
MackorLab
</a>
<form class="form-inline">
<button id="st_onl" class="btn btn-success" type="button" >Онлайн</button>
<button id="st_set" class="btn btn-outline-success" type="button" >Настройки</button>
<button id="st_graf" class="btn btn-outline-success" type="button" >Графики</button>
</form>
</nav>
<div class="container mt-3">
<div class="container text-center">
<h1>Онлайн данные системы</h1>
</div> <br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Время </h5>
</div>
<div class="container text-center">
<h2><span id="v_hid"></span> : <span id="v_min"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">День </h5>
</div>
<div class="container text-center">
<h2><span id="dey"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Неделя </h5>
</div>
<div class="container text-center">
<h2><span id="wek"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
</div>
<br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">pH раствора</h5>
</div>
<div class="container text-center">
<h2><span id="ph"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">EC раствора</h5>
</div>
<div class="container text-center">
<h2><span id="ec"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Т. раствора</h5>
</div>
<div class="container text-center">
<h2><span id="tS"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
</div>
<br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Т. воздуха</h5>
</div>
<div class="container text-center">
<h2><span id="tA"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Вл. воздуха</h5>
</div>
<div class="container text-center">
<h2><span id="hDm"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Об. вентилятора</h5>
</div>
<div class="container text-center">
<h2><span id="sVen"></span></h2>
</div>
</div>
<div class="card-footer">
</div>
</div>
</div>
<br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Система: <span id="rFul"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Освещение: <span id="rLi"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Под.воды: <span id="rWat"></span></h5>
</div>
</div>
</div>
</div>
<br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Под. раствора: <span id="rRas"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Доз. pH: <span id="rPH"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Доз. EC: <span id="rEC"></span></h5>
</div>
</div>
</div>
</div>
<br>
<div class="card-deck">
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Слив: <span id="rSl"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Ур. раствора: <span id="rLe"></span></h5>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="container text-center">
<h5 class="card-title">Дат. затопления: <span id="alW"></span></h5>
</div>
</div>
</div>
</div>
<br>
<div class="card text-center">
<div class="card-body">
<div class="container text-center">
<span><button type="button" class="btn btn-success btn-lg">Старт</button></span>
<span><button type="button" class="btn btn-danger btn-lg">Стоп</button></span>
<span><button type="button" class="btn btn-info btn-lg">Рестарт</button></span>
</div>
</div>
<div class="card-footer text-muted"> </div>
</div>
<br><br><br><br><br><br>
</div>
<script>
document.getElementById("st_onl").addEventListener("click", function() {
// Получаем основной URL без пути и параметров
var baseUrl = window.location.origin;
// Добавляем необходимый путь к основному URL
var targetUrl = baseUrl + "/online";
// Переходим по сформированному URL
window.location.href = targetUrl;
});
</script>
<script>
document.getElementById("st_set").addEventListener("click", function() {
// Получаем основной URL без пути и параметров
var baseUrl = window.location.origin;
// Добавляем необходимый путь к основному URL
var targetUrl = baseUrl + "/settings";
// Переходим по сформированному URL
window.location.href = targetUrl;
});
</script>
<script>
document.getElementById("st_graf").addEventListener("click", function() {
// Получаем основной URL без пути и параметров
var baseUrl = window.location.origin;
// Добавляем необходимый путь к основному URL
var targetUrl = baseUrl + "/settings";
// Переходим по сформированному URL
window.location.href = targetUrl;
});
</script>
<script>
function updateValues(data) {
document.getElementById("dey").textContent = data.dey;
document.getElementById("wek").textContent = data.wek;
document.getElementById("v_hid").textContent = data.v_hid;
document.getElementById("v_min").textContent = data.v_min;
document.getElementById("dey").textContent = data.dey;
document.getElementById("wek").textContent = data.wek;
document.getElementById("ph").textContent = data.ph;
document.getElementById("ec").textContent = data.ec;
document.getElementById("tS").textContent = data.tS;
document.getElementById("tA").textContent = data.tA;
document.getElementById("hDm").textContent = data.hDm;
document.getElementById("sVen").textContent = data.sVen;
document.getElementById("rFul").textContent = data.rFul;
document.getElementById("rLi").textContent = data.rLi;
document.getElementById("rWat").textContent = data.rWat;
document.getElementById("rRas").textContent = data.rRas;
document.getElementById("rPH").textContent = data.rPH;
document.getElementById("rEC").textContent = data.rEC;
document.getElementById("rSl").textContent = data.rSl;
document.getElementById("rLe").textContent = data.rLe;
document.getElementById("alW").textContent = data.alW;
}
function fetchValues() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/online_api", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
updateValues(response);
}
};
xhr.send();
}
fetchValues();
setInterval(fetchValues, 10000);
</script>
</body>
</html>