diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-17 23:23:30 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-17 23:23:30 +0800 |
commit | a5d249c0bbe0b3b51930cb23f010a17bdf0dc198 (patch) | |
tree | 48686c0d0a9c19e8370b41bc30284793a198d655 /fg21sim | |
parent | 0b92218c5b815abf9c9e7cb8168a1d2f01912eb8 (diff) | |
download | fg21sim-a5d249c0bbe0b3b51930cb23f010a17bdf0dc198.tar.bz2 |
webui: Fix a bug for "showModal()"; Cleanup ".onmessage()"
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/webui/static/js/main.js | 2 | ||||
-rw-r--r-- | fg21sim/webui/static/js/websocket.js | 20 |
2 files changed, 6 insertions, 16 deletions
diff --git a/fg21sim/webui/static/js/main.js b/fg21sim/webui/static/js/main.js index 8d843a9..27638a7 100644 --- a/fg21sim/webui/static/js/main.js +++ b/fg21sim/webui/static/js/main.js @@ -142,8 +142,8 @@ var showModal = function (modalBox, data) { .attr("type", "button") .on("click", btn.click).appendTo(p); }); + modalBox.append(p); } - modalBox.append(p); // Show the modal box modalBox.modal(); }; diff --git a/fg21sim/webui/static/js/websocket.js b/fg21sim/webui/static/js/websocket.js index b0fe1b9..2fa26d8 100644 --- a/fg21sim/webui/static/js/websocket.js +++ b/fg21sim/webui/static/js/websocket.js @@ -127,27 +127,17 @@ var connectWebSocket = function (url) { }; g_ws.onmessage = function (e) { var msg = JSON.parse(e.data); - console.log("WebSocket received message: type:", msg.type, - ", success:", msg.success); - console.log(msg); + console.log("WebSocket received message:", msg); // Delegate appropriate actions to handle the received message if (msg.type === "configs") { handleWebSocketMsgConfigs(msg); - } - else if (msg.type === "console") { + } else if (msg.type === "console") { handleWebSocketMsgConsole(msg); - } - else if (msg.type === "results") { + } else if (msg.type === "results") { console.error("NotImplementedError"); - // handleMsgResults(msg); - } - else { + } else { // Unknown/unsupported message type - console.error("WebSocket received message of unknown type:", msg.type); - if (! msg.success) { - console.error("WebSocket request failed with error:", msg.error); - // TODO: add error codes support and handle each specific error - } + console.warn("WebSocket: unknown message type:", msg.type); } }; }; |