-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlogs.html
More file actions
101 lines (96 loc) · 2.79 KB
/
logs.html
File metadata and controls
101 lines (96 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Intellidwell Sprinkler Controller Firmware
# Copyright (C) 2025 Tanner Nelson
#
# Licensed under GPLv3 with additional non-commercial hardware restrictions.
# See LICENSE for details.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Intellidwell Sprinkler Controller - Logs</title>
<style>
body {
background-color: #333;
color: white;
font-family: Arial, sans-serif;
padding: 20px;
}
h1 {
color: #FFD700;
}
.container {
width: 80%;
margin: auto;
}
.log-area {
width: 100%;
height: 400px;
border: 1px solid #ccc;
overflow-y: scroll;
margin-bottom: 10px;
padding: 10px;
background-color: #444;
color: white;
white-space: pre-line;
}
.button {
padding: 10px 20px;
background-color: #2196F3;
color: white;
border: none;
cursor: pointer;
border-radius: 12px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
}
.button:disabled {
background-color: #aaa;
}
@media (max-width: 600px) {
body {
padding: 5px;
}
.log-area {
height: 300px;
}
.button {
width: 100%;
padding: 12px;
}
}
</style>
</head>
<body>
<h1>System Logs</h1>
<div class="container">
<div class="log-area" id="logArea">Loading logs...</div>
<button class="button" id="clearButton" onclick="clearLogs()">Clear Logs</button>
</div>
<script>
function fetchLogs() {
fetch('/get-logs')
.then(response => response.text())
.then(data => {
document.getElementById('logArea').innerHTML = data.replace(/\n/g, '<br>');
const logArea = document.getElementById('logArea');
logArea.scrollTop = logArea.scrollHeight; // Scroll to the bottom
});
}
function clearLogs() {
fetch('/clear-logs', { method: 'POST' })
.then(response => response.text())
.then(data => {
document.getElementById('logArea').textContent = '';
alert(data);
});
}
window.onload = function() {
fetchLogs();
setInterval(fetchLogs, 10000); // Fetch logs every 10 seconds
};
</script>
</body>
</html>