mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
optimizations and improvements to the web UI
This commit is contained in:
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Removed
|
||||
|
||||
- Removed `heating_circuit` config setting
|
||||
- Removed showing the JSON config files when Saving from the Web
|
||||
|
||||
## [1.9.0] 2019-09-01
|
||||
|
||||
|
||||
@@ -8,14 +8,11 @@ var custom_config = {
|
||||
"listen_mode": false,
|
||||
"shower_timer": false,
|
||||
"shower_alert": false,
|
||||
"publish_time": 120
|
||||
"publish_time": 120,
|
||||
"tx_mode": 1
|
||||
}
|
||||
};
|
||||
|
||||
function custom_commit() {
|
||||
websock.send(JSON.stringify(custom_config));
|
||||
}
|
||||
|
||||
function listcustom() {
|
||||
|
||||
document.getElementById("led_gpio").value = custom_config.settings.led_gpio;
|
||||
@@ -72,7 +69,7 @@ function savecustom() {
|
||||
custom_config.settings.publish_time = parseInt(document.getElementById("publish_time").value);
|
||||
custom_config.settings.tx_mode = parseInt(document.getElementById("tx_mode").value);
|
||||
|
||||
custom_uncommited();
|
||||
custom_saveconfig();
|
||||
}
|
||||
|
||||
function listCustomStats() {
|
||||
@@ -84,6 +81,8 @@ function listCustomStats() {
|
||||
document.getElementById("devicesshow").style.display = "none";
|
||||
document.getElementById("thermostat_show").style.display = "none";
|
||||
document.getElementById("boiler_show").style.display = "none";
|
||||
document.getElementById("sm_show").style.display = "none";
|
||||
document.getElementById("hp_show").style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<i class="glyphicon glyphicon-arrow-left"></i>
|
||||
</div>
|
||||
<div class="sidebar-header">
|
||||
<h1 id="customname2" class="text-center"></h1>
|
||||
<h1 id="customname2" class="text-center" onclick="home();"></h1>
|
||||
<h6 id="mainver" class="text-center"></h6>
|
||||
</div>
|
||||
<ul class="list-unstyled components">
|
||||
@@ -70,7 +70,7 @@
|
||||
</ul>
|
||||
<ul class="list-unstyled CTAs">
|
||||
<li>
|
||||
<a id="helpurl" target="_blank" class="download">Help</a>
|
||||
<a id="helpurl" target="_blank" class="article">Help</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="article" onclick="logout();">Logout</a>
|
||||
@@ -102,46 +102,6 @@
|
||||
<div id="ajaxcontent">
|
||||
</div>
|
||||
|
||||
<div id="revcommit" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Please review your system changes</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre id="jsonholder"></pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" onclick="commit();" class="btn btn-success" data-dismiss="modal">Save
|
||||
& Restart</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="custom_revcommit" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Please review your custom changes</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre id="jsonholder2"></pre>
|
||||
Note: some settings my require a <b>Restart System</b> first to take effect.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" onclick="custom_commit();" class="btn btn-success"
|
||||
data-dismiss="modal">Save
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="destroy" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
@@ -22,26 +22,6 @@
|
||||
style="display:none;">
|
||||
</div>
|
||||
<br>
|
||||
<div id="restoremodal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Please wait while data is restoring...</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="pbar" class="progress">
|
||||
<div id="dynamic" class="progress-bar progress-bar-primary progress-bar-striped active">
|
||||
Restoring...</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="restoreclose" style="display:none;" class="btn btn-default"
|
||||
data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@@ -57,7 +37,7 @@
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Please wait a few seconds while the system restarts...</h3>
|
||||
<h3 class="panel-title">Please wait for about 10 seconds while the system restarts...</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="progress">
|
||||
@@ -125,7 +105,7 @@
|
||||
|
||||
<div id="eventcontent">
|
||||
<div class="text-center" id="loading-img">
|
||||
<h5>Please wait while processing the log data...<span id="loadpages"></span></h5>
|
||||
<h5>Loading Logs. Please wait...<span id="loadpages"></span></h5>
|
||||
<br>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -95,25 +95,30 @@ function listntp() {
|
||||
deviceTime();
|
||||
}
|
||||
|
||||
function revcommit() {
|
||||
document.getElementById("jsonholder").innerText = JSON.stringify(config, null, 2);
|
||||
$("#revcommit").modal("show");
|
||||
function home() {
|
||||
window.location = '/';
|
||||
}
|
||||
|
||||
function uncommited() {
|
||||
function restart_alert() {
|
||||
$("#commit").fadeOut(200, function () {
|
||||
$(this).css("background", "gold").fadeIn(1000);
|
||||
});
|
||||
document.getElementById("commit").innerHTML = "<h6>Settings have changed. Click here to review and save.</h6>";
|
||||
document.getElementById("commit").innerHTML = "<h6>Settings have changed. It's recommended to reboot the system. Click here to restart.</h6>";
|
||||
|
||||
$("#commit").click(function () {
|
||||
revcommit();
|
||||
$("#reboot").modal("show");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
function custom_uncommited() {
|
||||
document.getElementById("jsonholder2").innerText = JSON.stringify(custom_config.settings, null, 2);
|
||||
$("#custom_revcommit").modal("show");
|
||||
function saveconfig() {
|
||||
websock.send(JSON.stringify(config));
|
||||
restart_alert();
|
||||
}
|
||||
|
||||
function custom_saveconfig() {
|
||||
websock.send(JSON.stringify(custom_config));
|
||||
restart_alert();
|
||||
}
|
||||
|
||||
function saventp() {
|
||||
@@ -125,14 +130,13 @@ function saventp() {
|
||||
config.ntp.enabled = true;
|
||||
}
|
||||
|
||||
uncommited();
|
||||
saveconfig();
|
||||
}
|
||||
|
||||
function forcentp() {
|
||||
websock.send("{\"command\":\"forcentp\"}");
|
||||
}
|
||||
|
||||
|
||||
function savegeneral() {
|
||||
var a = document.getElementById("adminpwd").value;
|
||||
if (a === null || a === "") {
|
||||
@@ -147,7 +151,7 @@ function savegeneral() {
|
||||
config.general.serial = true;
|
||||
}
|
||||
|
||||
uncommited();
|
||||
saveconfig();
|
||||
}
|
||||
|
||||
function savemqtt() {
|
||||
@@ -167,7 +171,7 @@ function savemqtt() {
|
||||
config.mqtt.user = document.getElementById("mqttuser").value;
|
||||
config.mqtt.password = document.getElementById("mqttpwd").value;
|
||||
|
||||
uncommited();
|
||||
saveconfig();
|
||||
}
|
||||
|
||||
function savenetwork() {
|
||||
@@ -186,7 +190,7 @@ function savenetwork() {
|
||||
config.network.wmode = wmode;
|
||||
config.network.password = document.getElementById("wifipass").value;
|
||||
|
||||
uncommited();
|
||||
saveconfig();
|
||||
}
|
||||
|
||||
var formData = new FormData();
|
||||
@@ -199,8 +203,8 @@ function inProgress(callback) {
|
||||
var i = 0;
|
||||
var prg = setInterval(function () {
|
||||
$(".progress-bar").css("width", i + "%").attr("aria-valuenow", i).html(i + "%");
|
||||
i++;
|
||||
if (i === 101) {
|
||||
i = i + 5;
|
||||
if (i === 105) {
|
||||
clearInterval(prg);
|
||||
var a = document.createElement("a");
|
||||
a.href = "http://" + config.general.hostname + ".local";
|
||||
@@ -221,9 +225,6 @@ function inProgress(callback) {
|
||||
contentType: false
|
||||
});
|
||||
break;
|
||||
case "commit":
|
||||
websock.send(JSON.stringify(config));
|
||||
break;
|
||||
case "destroy":
|
||||
websock.send("{\"command\":\"destroy\"}");
|
||||
break;
|
||||
@@ -238,10 +239,6 @@ function inProgress(callback) {
|
||||
}).hide().fadeIn();
|
||||
}
|
||||
|
||||
function commit() {
|
||||
inProgress("commit");
|
||||
}
|
||||
|
||||
function handleSTA() {
|
||||
document.getElementById("scanb").style.display = "block";
|
||||
document.getElementById("hidessid").style.display = "block";
|
||||
@@ -498,10 +495,10 @@ function restoreSet() {
|
||||
return;
|
||||
}
|
||||
if (json.command === "configfile") {
|
||||
var x = confirm("File seems to be valid, do you wish to continue?");
|
||||
var x = confirm("System Config file seems to be valid, do you wish to continue?");
|
||||
if (x) {
|
||||
config = json;
|
||||
uncommited();
|
||||
saveconfig();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -526,10 +523,10 @@ function restoreCustomSet() {
|
||||
return;
|
||||
}
|
||||
if (json.command === "custom_configfile") {
|
||||
var x = confirm("File seems to be valid, do you wish to continue?");
|
||||
var x = confirm("Custom Config file seems to be valid, do you wish to continue?");
|
||||
if (x) {
|
||||
custom_config = json;
|
||||
custom_uncommited();
|
||||
custom_saveconfig();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -677,10 +674,6 @@ function initMQTTLogTable() {
|
||||
});
|
||||
}
|
||||
|
||||
function restartESP() {
|
||||
inProgress("restart");
|
||||
}
|
||||
|
||||
var nextIsNotJson = false;
|
||||
|
||||
function socketMessageListener(evt) {
|
||||
|
||||
@@ -51,7 +51,7 @@ var eventlog = {
|
||||
"command": "eventlist",
|
||||
"page": 1,
|
||||
"haspages": 1,
|
||||
"list":[
|
||||
"list": [
|
||||
"{\"type\":\"WARN\",\"src\":\"system\",\"desc\":\"test data\",\"data\":\"Record #1\",\"time\": 1563371160}",
|
||||
"{\"type\":\"WARN\",\"src\":\"system\",\"desc\":\"test data\",\"data\":\"Record #2\",\"time\":0}",
|
||||
"{\"type\":\"INFO\",\"src\":\"system\",\"desc\":\"System booted\",\"data\":\"\",\"time\":1568660479}",
|
||||
@@ -147,7 +147,7 @@ function sendStatus() {
|
||||
function sendCustomStatus() {
|
||||
var stats = {
|
||||
"command": "custom_status",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"customname": "EMS-ESP",
|
||||
"appurl": "https://github.com/proddy/EMS-ESP",
|
||||
"updateurl": "https://api.github.com/repos/proddy/EMS-ESP/releases/latest",
|
||||
@@ -214,7 +214,7 @@ wss.on('connection', function connection(ws) {
|
||||
console.log("[INFO] Got Command: " + obj.command);
|
||||
switch (obj.command) {
|
||||
case "configfile":
|
||||
console.log("[INFO] New system settings file received");
|
||||
console.log("[INFO] New system config received");
|
||||
configfile = obj;
|
||||
break;
|
||||
case "custom_configfile":
|
||||
@@ -269,7 +269,7 @@ wss.on('connection', function connection(ws) {
|
||||
console.log("[INFO] getting ntp time");
|
||||
break;
|
||||
default:
|
||||
console.log("[WARN] Unknown command ");
|
||||
console.log("[WARN] Unknown command");
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user