From f3dd6adaf38192648d3bf51dbfb604d35eee9980 Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Mon, 30 Sep 2019 22:41:25 +0200 Subject: [PATCH] start nvs editor --- components/wifi-manager/code.js | 46 +++++++++++++++++++++++------- components/wifi-manager/index.html | 19 ++++++++++++ 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 0b0a58fe..f34d6bd2 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -492,10 +492,16 @@ function checkStatus(){ if (data["recovery"] === 1) { recovery = true; $("#otadiv").show(); + $('a[href^="#tab-audio"]').hide(); + $('a[href^="#tab-gpio"]').hide(); + $('a[href^="#tab-nvs"]').show(); enableStatusTimer = true; } else { recovery = false; $("#otadiv").hide(); + $('a[href^="#tab-audio"]').show(); + $('a[href^="#tab-gpio"]').show(); + //$('a[href^="#tab-nvs"]').hide(); enableStatusTimer = false; } } @@ -530,25 +536,43 @@ function checkStatus(){ function getConfig() { $.getJSON("/config.json", function(data) { + for (var key in data) { + if (data.hasOwnProperty(key)) { + if (key == 'autoexec') { + if (data["autoexec"] === "1") { + $("#autoexec-cb")[0].checked=true; + } else { + $("#autoexec-cb")[0].checked=false; + } + } else if (key == 'autoexec1') { + $("#autoexec1").val(data["autoexec1"]); + } + + if (recovery) { + $("tbody#nvsTable").append( + ""+ + ""+key+""+ + ""+ + ""+ + ""+ + "" + ); + //TODO append empty line + } + } + } +/* if (data.hasOwnProperty('autoexec')) { if (data["autoexec"] === 1) { - console.log('turn on autoexec'); $("#autoexec-cb")[0].checked=true; } else { - console.log('turn off autoexec'); $("#autoexec-cb")[0].checked=false; } } - if (data.hasOwnProperty('list')) { - data.list.forEach(function(line) { - let key = Object.keys(line)[0]; - let val = Object.values(line)[0]; - console.log(key, val); - if (key == 'autoexec1') { - $("#autoexec1").val(val); - } - }); + if (data.hasOwnProperty('autoexec')) { + $("#autoexec1").val(data["autoexec1"]); } + */ }) .fail(function() { console.log("failed to fetch config!"); diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 03bc126f..163b89ef 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -34,6 +34,9 @@ + @@ -254,6 +257,22 @@ +
+ + + + + + + + + +
KeyValue
+
+ +
+
+

Check for firmware upgrade