From dfb7169564043eefab2183e223ae0892b0cad449 Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Thu, 3 Oct 2019 19:34:42 +0200 Subject: [PATCH 1/2] only show 7 FW entries by default --- components/wifi-manager/code.js | 30 +++++++++++++++++++++++------- components/wifi-manager/style.css | 4 ++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index e6864cc0..64d564a6 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -308,6 +308,7 @@ $(document).ready(function(){ $('#fwcheck').on("click", function(){ $("#releaseTable").html(""); $.getJSON(releaseURL, function(data) { + var i=0; data.forEach(function(release) { var url = ''; release.assets.forEach(function(asset) { @@ -321,17 +322,32 @@ $(document).ready(function(){ body = body.replace(/[\s\S]+(### Revision Log[\s\S]+)### ESP-IDF Version Used[\s\S]+/, "$1"); body = body.replace(/- \(.+?\) /g, "- "); var [date, time] = release.created_at.split('T'); + var trclass = (i++ > 6)?' hide':''; $("#releaseTable").append( - ""+ - ""+ver+""+ - ""+idf+""+ - ""+date+""+ - ""+cfg+""+ - ""+branch+""+ - ""+ + ""+ + ""+ver+""+ + ""+idf+""+ + ""+date+""+ + ""+cfg+""+ + ""+branch+""+ + ""+ "" ); }); + if (i > 7) { + $("#releaseTable").append( + ""+ + ""+ + ""+ + ""+ + "" + ); + $('#showallbutton').on("click", function(){ + console.log('show all'); + $("tr.hide").removeClass("hide"); + $("tr#showall").addClass("hide"); + }); + } }) .fail(function() { alert("failed to fetch release history!"); diff --git a/components/wifi-manager/style.css b/components/wifi-manager/style.css index 15ffc4ef..2e088f34 100644 --- a/components/wifi-manager/style.css +++ b/components/wifi-manager/style.css @@ -352,3 +352,7 @@ div#message { border-radius: 8px; box-shadow: 0px 5px 2px -5px rgba(255, 255, 255, 0.5) inset, 0px 10px 20px -5px rgba(255, 255, 255, 0.1) inset, 0 0px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 1px rgba(0, 0, 0, 0.12), 0 1px 10px 0 rgba(0, 0, 0, 0.3); } + +tr.hide { + display: none; +} From 2d7aef57ef6b76a31e5a964502761e27d9cccda7 Mon Sep 17 00:00:00 2001 From: Christian Herzog Date: Thu, 3 Oct 2019 20:20:02 +0200 Subject: [PATCH 2/2] add FW search --- components/wifi-manager/code.js | 21 ++++++++++++++++++++- components/wifi-manager/index.html | 3 +++ components/wifi-manager/style.css | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/components/wifi-manager/code.js b/components/wifi-manager/code.js index 64d564a6..fc25b661 100644 --- a/components/wifi-manager/code.js +++ b/components/wifi-manager/code.js @@ -343,17 +343,36 @@ $(document).ready(function(){ "" ); $('#showallbutton').on("click", function(){ - console.log('show all'); $("tr.hide").removeClass("hide"); $("tr#showall").addClass("hide"); }); } + $("#searchfw").css("display", "inline"); }) .fail(function() { alert("failed to fetch release history!"); }); }); + $('input#searchinput').on("input", function(){ + var s = $('input#searchinput').val(); + var re = new RegExp(s, "gi"); + if (s.length == 0) { + $("tr.release").removeClass("hide"); + } else if (s.length < 3) { + $("tr.release").addClass("hide"); + } else { + $("tr.release").addClass("hide"); + $("tr.release").each(function(tr){ + $(this).find('td').each (function() { + if ($(this).html().match(re)) { + $(this).parent().removeClass('hide'); + } + }); + }); + } + }); + //first time the page loads: attempt to get the connection status and start the wifi scan refreshAP(); getConfig(); diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 41c01590..b23b0b0f 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -270,6 +270,9 @@
+
+ +
diff --git a/components/wifi-manager/style.css b/components/wifi-manager/style.css index 2e088f34..df4b701f 100644 --- a/components/wifi-manager/style.css +++ b/components/wifi-manager/style.css @@ -356,3 +356,8 @@ div#message { tr.hide { display: none; } + +#searchfw { + float: right; + display: none; +}