aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static/js/websocket.js
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-09 20:59:44 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-09 21:10:29 +0800
commit31e328d5ea6aff36e43ad54029589c7f15be82b7 (patch)
tree34d0855d1b683ce2a42b81f594adb3f5d5292543 /fg21sim/webui/static/js/websocket.js
parent0c2ab928af57178e6d7d3265709c3f1c3b654013 (diff)
downloadfg21sim-31e328d5ea6aff36e43ad54029589c7f15be82b7.tar.bz2
webui: Implement status updating function
Add "updateTaskStatus()" to update the "#task-status" element. Also add function "getServerTaskStatus()" to get the task status from the server.
Diffstat (limited to 'fg21sim/webui/static/js/websocket.js')
-rw-r--r--fg21sim/webui/static/js/websocket.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/fg21sim/webui/static/js/websocket.js b/fg21sim/webui/static/js/websocket.js
index 0c566c6..8f726b8 100644
--- a/fg21sim/webui/static/js/websocket.js
+++ b/fg21sim/webui/static/js/websocket.js
@@ -135,8 +135,7 @@ var connectWebSocket = function (url) {
handleMsgConfigs(msg);
}
else if (msg.type === "console") {
- console.error("NotImplementedError");
- // handleMsgConsole(msg);
+ handleMsgConsole(msg);
}
else if (msg.type === "results") {
console.error("NotImplementedError");
@@ -173,6 +172,18 @@ $(document).ready(function () {
connectWebSocket(ws_url);
});
+ /**********************************************************************
+ * Configuration form
+ */
+
+ // Re-check/validate the whole form configurations
+ $("#conf-recheck").on("click", function () {
+ // TODO:
+ // * collect all current form configurations
+ // * sync to the server and validate
+ // * update the form errors
+ });
+
// Reset the configurations to the defaults
$("#reset-defaults").on("click", function () {
// TODO:
@@ -212,6 +223,17 @@ $(document).ready(function () {
setServerConfigs(g_ws, {[name]: value});
});
+ /**********************************************************************
+ * Console operations
+ */
+
+ // Start the task on the server
+ $("#task-start").on("click", function () {
+ updateTaskStatus({running: true, finished: false});
+ startServerTask(g_ws);
+ getServerTaskStatus(g_ws);
+ });
+
} else {
// WebSocket NOT supported
console.error("Oops, WebSocket is NOT supported!");