From 31e328d5ea6aff36e43ad54029589c7f15be82b7 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 9 Nov 2016 20:59:44 +0800 Subject: 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. --- fg21sim/webui/static/js/websocket.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'fg21sim/webui/static/js/websocket.js') 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!"); -- cgit v1.2.2