Spaces:
Build error
Build error
<html lang="ru"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="icon" type="image/ico" href="https://huggingface.co/spaces/igs-img/stor/resolve/main/list.ico"> | |
<title>Таблица данных</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> | |
<link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet"> | |
<script src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script> | |
<style> | |
.container { | |
width: 100%; | |
max-width: 100%; | |
} | |
/* Шапка */ | |
.header { | |
width: 100%; | |
padding: 0px 0; /* Убраны отступы справа и слева */ | |
display: flex; | |
justify-content: space-between; | |
align-items: center; | |
background-color: #f8f9fa; | |
border-bottom: 1px solid #ddd; | |
} | |
/* Кнопки и лейбл в шапке */ | |
.header .buttons, | |
.header .label { | |
margin: 0; /* Полностью убраны отступы */ | |
} | |
</style> | |
</head> | |
<body> | |
<!-- Навигационная панель --> | |
<nav class="navbar navbar-light bg-light w-100"> | |
<div class="container"> | |
<a class="navbar-brand" href="/online"> | |
<img src="https://huggingface.co/spaces/igs-img/stor/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-outline-success" type="button">Онлайн</button> | |
<button id="st_set" class="btn btn-outline-success" type="button">Настройки</button> | |
<button id="st_plot" class="btn btn-outline-success" type="button">Графики</button> | |
<button id="st_table" class="btn btn-success" type="button">Таблица</button> | |
</form> | |
</div> | |
</nav> | |
<div id="data-table"></div> | |
<script> | |
document.addEventListener("DOMContentLoaded", function () { | |
fetch("/get_all_data") | |
.then(response => response.json()) | |
.then(data => { | |
const table = new Tabulator("#data-table", { | |
layout: "fitColumns", | |
columns: [ | |
{ title: "ID", field: "id", sorter: "number" }, | |
{ title: "Неделя", field: "wek", sorter: "number" }, | |
{ title: "День", field: "dey", sorter: "number" }, | |
{ title: "Время системы", field: "time_system", sorter: "string" }, | |
{ title: "Уровень pH", field: "ph", sorter: "number" }, | |
{ title: "Уровень EC", field: "ec", sorter: "number" }, | |
{ title: "Темп. раствора", field: "tS", sorter: "number" }, | |
{ title: "Темп. воздуха", field: "tA", sorter: "number" }, | |
{ title: "Влажность воздуха", field: "hDm", sorter: "number" }, | |
{ title: "Об. вентилятора", field: "sVen", sorter: "number" }, | |
{ title: "pH (нас)", field: "nPh", sorter: "number" }, | |
{ title: "EC (нас)", field: "nEC", sorter: "number" }, | |
{ title: "Свет ВКЛ (нас)", field: "nLon", sorter: "string" }, | |
{ title: "Свет ОТКЛ (нас)", field: "nLoff", sorter: "string" }, | |
{ title: "Темп. воздуха (нас)", field: "nTa", sorter: "number" }, | |
{ title: "Насос A (нас)", field: "onA", sorter: "number" }, | |
{ title: "Насос B (нас)", field: "onB", sorter: "number" }, | |
{ title: "Насос C (нас)", field: "onC", sorter: "number" }, | |
{ title: "Дата записи", field: "date_time", sorter: "datetime" } | |
], | |
data: data.map(item => ({ | |
...item, | |
time_system: `${item.v_hid}:${item.v_min}` // Объединяем v_hid и v_min через двоеточие | |
})) | |
}); | |
}) | |
.catch(error => console.error("Ошибка загрузки данных:", error)); | |
}); | |
</script> | |
<script> | |
document.getElementById("st_onl").addEventListener("click", function() { | |
var baseUrl = window.location.origin; | |
var targetUrl = baseUrl + "/online"; | |
window.location.href = targetUrl; | |
}); | |
</script> | |
<script> | |
document.getElementById("st_set").addEventListener("click", function() { | |
var baseUrl = window.location.origin; | |
var targetUrl = baseUrl + "/settings"; | |
window.location.href = targetUrl; | |
}); | |
</script> | |
<script> | |
document.getElementById("st_plot").addEventListener("click", function() { | |
var baseUrl = window.location.origin; | |
var targetUrl = baseUrl + "/plot_week"; | |
window.location.href = targetUrl; | |
}); | |
</script> | |
<script> | |
document.getElementById("st_table").addEventListener("click", function() { | |
var baseUrl = window.location.origin; | |
var targetUrl = baseUrl + "/table"; | |
window.location.href = targetUrl; | |
}); | |
</script> | |
</body> | |
</html> | |