Add option to regenearte when auto-refreshing

This makes it easier to watch test progress with local_dash.

BUG=None
TEST=Manual

Change-Id: Ib90a5d2eab08f7996f03bc9acd7db8f28f873fb5
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51434
diff --git a/utils_py/local_dash/dash_template/result_viewer b/utils_py/local_dash/dash_template/result_viewer
index f0f90bf..c80fde9 100755
--- a/utils_py/local_dash/dash_template/result_viewer
+++ b/utils_py/local_dash/dash_template/result_viewer
@@ -169,7 +169,7 @@
     if args:
       cmd.append(args)
     subprocess.check_call(cmd)
-  bottle.redirect('/')
+  bottle.redirect('/' + ''.join(bottle.request.url.partition('?')[1:]))
 
 @app.route('/logs/<filepath:path>')
 def server_result_file(filepath):
diff --git a/utils_py/local_dash/dash_template/views/header.tpl b/utils_py/local_dash/dash_template/views/header.tpl
index 23e7491..f3a4cdc 100644
--- a/utils_py/local_dash/dash_template/views/header.tpl
+++ b/utils_py/local_dash/dash_template/views/header.tpl
@@ -16,5 +16,7 @@
   <a href="/help">Help</a> |
   <input type="checkbox" name="CB1" onclick="StartTime()">
   <label for="CB1">Auto-refresh (60s)</label>
+  <input type="checkbox" name="CB2">
+  <label for="CB2">Regenerate on auto-refresh</label>
 </form>
 </div>
diff --git a/utils_py/local_dash/dash_template/views/master.tpl b/utils_py/local_dash/dash_template/views/master.tpl
index 705162f..70e9803 100644
--- a/utils_py/local_dash/dash_template/views/master.tpl
+++ b/utils_py/local_dash/dash_template/views/master.tpl
@@ -18,12 +18,17 @@
       }
       function RefreshPage(){
         clearTimeout(asdf)
-        if(document.frmRefresh.CB1.checked)
-          document.location.href= "/?refreshing"
+        if(document.frmRefresh.CB1.checked) {
+          if (document.frmRefresh.CB2.checked)
+            document.location.href= "/regenerate?refreshing&regen";
+          else
+            document.location.href= "/?refreshing";
+        }
       }
       function LoadPage(){
-        var findCheck = document.location.href.split("?refr");
-        if(findCheck.length == 2){
+        if (document.location.href.indexOf("&regen") != -1)
+          document.frmRefresh.CB2.checked=true;
+        if (document.location.href.indexOf("?refr") != -1) {
           document.frmRefresh.CB1.checked=true;
           StartTime()
         }
diff --git a/utils_py/local_dash/dash_template/views/test_view.tpl b/utils_py/local_dash/dash_template/views/test_view.tpl
index ba19165..d372b29 100644
--- a/utils_py/local_dash/dash_template/views/test_view.tpl
+++ b/utils_py/local_dash/dash_template/views/test_view.tpl
@@ -134,7 +134,7 @@
                             class="info DevSlaveBox testna">
                           %else:
                             class="info DevSlaveBox failure">
-			  %end
+                          %end
                           <span>
                               <b>{{test_name}}</b><br>
                             {{!dut_info}}