From dc59c7d18975a744ceac484eccf25225ef4ab583 Mon Sep 17 00:00:00 2001
From: Aaron LI <aaronly.me@outlook.com>
Date: Fri, 18 Nov 2016 14:35:15 +0800
Subject: webui: console.js: Disable the "Start" button when task started

---
 fg21sim/webui/static/js/console.js | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'fg21sim')

diff --git a/fg21sim/webui/static/js/console.js b/fg21sim/webui/static/js/console.js
index 6392b96..86062a7 100644
--- a/fg21sim/webui/static/js/console.js
+++ b/fg21sim/webui/static/js/console.js
@@ -200,9 +200,16 @@ $(document).ready(function () {
    * Start the simulation task on the server
    */
   $("#task-start").on("click", function () {
+    var button = $(this);
     if ($("#conf-status").data("validity")) {
+      button.disable(true);
+      console.log("Disable button:", button[0]);
       updateTaskStatus({running: true, finished: false});
       startServerTask(ajax_url)
+        .always(function () {
+          button.disable(false);
+          console.log("Enable button:", button[0]);
+        })
         .done(function () {
           getServerTaskStatus(ajax_url)
             .done(function (response) {
-- 
cgit v1.2.2