瀏覽代碼

2020-10-08 / ct_chen

Actions:
1. Webservice optimize count down in "Upgrade" function

Files:
1. EVSE/rootfs/var/www/upgrade_iso.php
ct_chen 4 年之前
父節點
當前提交
2c68d4928a
共有 1 個文件被更改,包括 7 次插入8 次删除
  1. 7 8
      EVSE/rootfs/var/www/upgrade_iso.php

+ 7 - 8
EVSE/rootfs/var/www/upgrade_iso.php

@@ -30,7 +30,7 @@ img {
 		Main Content start
 		//-->
 		<a id="loadinghref"><div id="loading" style="display:none;"><img src="img/giphy.gif"/></div></a>
-		<div id="loading2" style="display:none;"><img src="img/5minutes.gif"/></div>
+		<div id="loading2" style="display:none;"><img id="5minutes" src="img/5minutes.gif"/></div>
 		<section class="envor-section">
 			<div class="container">
 				<div class="row">
@@ -97,6 +97,8 @@ img {
 					if (request.status == 200) {
 						document.getElementById("createResult").innerHTML = "";
 						document.getElementById("createResult").innerHTML = request.responseText;
+						document.getElementById("5minutes").src = "";
+						document.getElementById("5minutes").src = "img/5minutes.gif";
 						document.getElementById("loading2").style.display="block";
 						var ts = 4*60*1000;
 						var idx=0;
@@ -115,16 +117,13 @@ img {
 						setInterval(function(){
 							var result=serverReachable();
 							if(!result) cnt=1;
-							if(result && cnt==1) cnt=2;
-							if(cnt==2) {
+							if(result && cnt>=1) cnt++;
+							if(cnt>=2) {
 								document.getElementById("createResult").innerHTML = "<font color='#ff0000'>Upgrade done!</font>";
 								document.getElementById("loading2").style.display="none";
-//								cnt=3;
-								//location.href="upgrade_iso.php";
-								//return false;
+								cnt=0;
 							}
-//							if(cnt==3)return false;
-							},3000);
+						},3000);
 					} else {
 						alert(JSON.parse(request.responseText).message);
 					}