mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
added command log_events
This commit is contained in:
@@ -53,6 +53,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="progressupload">
|
||||
<br>
|
||||
<br>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<br>
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Please wait for about a minute while the firmware uploads...</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="progress">
|
||||
<div id="updateprog" class="progress-bar progress-bar-striped active" role="progressbar"
|
||||
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width:0%">0%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="generalcontent">
|
||||
<br>
|
||||
<legend>General Settings</legend>
|
||||
@@ -90,6 +114,21 @@
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Event Logging<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
aria-hidden="true" data-toggle="popover" data-trigger="hover" data-placement="right"
|
||||
data-content="Enabling logging of all events to the device's storage"></i></label>
|
||||
<div class="col-xs-9">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="1" name="logeventsenabled">Enabled</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="0" name="logeventsenabled" checked>Disabled</label>
|
||||
</form>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="col-xs-9 col-md-8">
|
||||
<button onclick="savegeneral()" class="btn btn-primary btn-sm pull-right">Save</button>
|
||||
@@ -112,6 +151,8 @@
|
||||
<br>
|
||||
<legend>Event Log</legend>
|
||||
<h6 class="text-muted">Dates shown in () represent elapsed time in seconds when NTP Time is disabled</h6>
|
||||
<div id="logevents" class="label label-danger">Event Logging has been disabled. See Settings->General Settings.
|
||||
</div>
|
||||
<br>
|
||||
<div class="panel panel-default">
|
||||
<div>
|
||||
@@ -216,7 +257,8 @@
|
||||
<div id="networkcontent">
|
||||
<br>
|
||||
<legend>Wireless Settings</legend>
|
||||
<h6 class="text-muted">Enter the wireless network settings here, or use Scan to find nearby networks to join</h6>
|
||||
<h6 class="text-muted">Enter the wireless network settings here, or use Scan to find nearby networks to join
|
||||
</h6>
|
||||
<br>
|
||||
<div class="row form-group">
|
||||
<label class="col-xs-3">Mode<i style="margin-left: 10px;" class="glyphicon glyphicon-info-sign"
|
||||
@@ -225,7 +267,8 @@
|
||||
<div class="col-xs-9">
|
||||
<form>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="1" name="wmode" id="wmodeap" onclick="handleAP();" checked>Access Point
|
||||
<input type="radio" value="1" name="wmode" id="wmodeap" onclick="handleAP();" checked>Access
|
||||
Point
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" value="0" name="wmode" id="wmodesta" onclick="handleSTA();">Client</label>
|
||||
@@ -262,7 +305,8 @@
|
||||
<div id="ntpcontent">
|
||||
<br>
|
||||
<legend>Time Settings</legend>
|
||||
<h6 class="text-muted">With Network Time Protocol (NTP) enabled, all times are adjusted to the local timezone and
|
||||
<h6 class="text-muted">With Network Time Protocol (NTP) enabled, all times are adjusted to the local timezone
|
||||
and
|
||||
respect daylight saving
|
||||
time (DST)</h6>
|
||||
<br>
|
||||
|
||||
@@ -18,7 +18,8 @@ var config = {
|
||||
"general": {
|
||||
"hostname": "",
|
||||
"serial": false,
|
||||
"password": "admin"
|
||||
"password": "admin",
|
||||
"log_events": true
|
||||
},
|
||||
"mqtt": {
|
||||
"enabled": false,
|
||||
@@ -151,6 +152,11 @@ function savegeneral() {
|
||||
config.general.serial = true;
|
||||
}
|
||||
|
||||
config.general.log_events = false;
|
||||
if (parseInt($("input[name=\"logeventsenabled\"]:checked").val()) === 1) {
|
||||
config.general.log_events = true;
|
||||
}
|
||||
|
||||
saveconfig();
|
||||
}
|
||||
|
||||
@@ -239,6 +245,32 @@ function inProgress(callback) {
|
||||
}).hide().fadeIn();
|
||||
}
|
||||
|
||||
function inProgressUpload() {
|
||||
$("body").load("myesp.html #progressupload", function (responseTxt, statusTxt, xhr) {
|
||||
if (statusTxt === "success") {
|
||||
$(".progress").css("height", "40");
|
||||
$(".progress").css("font-size", "xx-large");
|
||||
var i = 0;
|
||||
var prg = setInterval(function () {
|
||||
$(".progress-bar").css("width", i + "%").attr("aria-valuenow", i).html(i + "%");
|
||||
i = i + 1;
|
||||
if (i === 101) {
|
||||
clearInterval(prg);
|
||||
document.getElementById("updateprog").className = "progress-bar progress-bar-success";
|
||||
document.getElementById("updateprog").innerHTML = "Completed";
|
||||
}
|
||||
}, 500);
|
||||
$.ajax({
|
||||
url: "/update",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false
|
||||
});
|
||||
}
|
||||
}).hide().fadeIn();
|
||||
}
|
||||
|
||||
function handleSTA() {
|
||||
document.getElementById("scanb").style.display = "block";
|
||||
document.getElementById("hidessid").style.display = "block";
|
||||
@@ -274,6 +306,10 @@ function listgeneral() {
|
||||
if (config.general.serial) {
|
||||
$("input[name=\"serialenabled\"][value=\"1\"]").prop("checked", true);
|
||||
}
|
||||
|
||||
if (config.general.log_events) {
|
||||
$("input[name=\"logeventsenabled\"][value=\"1\"]").prop("checked", true);
|
||||
}
|
||||
}
|
||||
|
||||
function listmqtt() {
|
||||
@@ -423,7 +459,15 @@ function getContent(contentname) {
|
||||
page = 1;
|
||||
data = [];
|
||||
getEvents();
|
||||
|
||||
if (config.general.log_events) {
|
||||
document.getElementById("logevents").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("logevents").style.display = "block";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "#customcontent":
|
||||
listcustom();
|
||||
break;
|
||||
@@ -552,7 +596,7 @@ function initEventTable() {
|
||||
var dup = JSON.parse(data[i]);
|
||||
dup.uid = i + 1;
|
||||
} catch (e) {
|
||||
var dup = { "uid": i, "type": "ERRO", "src": "SYS", "desc": "Error in logfile entry", "data": data[i], "time": 1 }
|
||||
var dup = { "uid": i + 1, "type": "ERRO", "src": "SYS", "desc": "Error in log file", "data": data[i], "time": 1 }
|
||||
}
|
||||
newlist[i].value = dup;
|
||||
|
||||
@@ -866,7 +910,7 @@ function connectWS() {
|
||||
|
||||
function upload() {
|
||||
formData.append("bin", $("#binform")[0].files[0]);
|
||||
inProgress("upload");
|
||||
inProgressUpload();
|
||||
}
|
||||
|
||||
function login() {
|
||||
|
||||
Reference in New Issue
Block a user