aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/webui/static/js')
-rw-r--r--fg21sim/webui/static/js/configs.js16
-rw-r--r--fg21sim/webui/static/js/websocket.js10
2 files changed, 17 insertions, 9 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js
index d05892b..4e635ae 100644
--- a/fg21sim/webui/static/js/configs.js
+++ b/fg21sim/webui/static/js/configs.js
@@ -262,28 +262,32 @@ var setFormConfigs = function (data, errors) {
/**
* Update the configuration form status indicator: "#conf-status"
+ * Also store the validity status in a custom data attribute.
*/
var updateFormConfigStatus = function () {
+ var target = $("#conf-status");
var recheck_icon = $("#conf-recheck");
var invalid = $("#conf-form").find("input[name]:invalid");
if (invalid.length) {
// Exists invalid configurations
console.warn("Found", invalid.length, "invalid configurations!");
recheck_icon.show();
- $("#conf-status").removeClass("label-default label-success")
+ target.removeClass("label-default label-success")
.addClass("label-warning");
- $("#conf-status .icon").removeClass("fa-question-circle fa-check-circle")
+ target.find(".icon").removeClass("fa-question-circle fa-check-circle")
.addClass("fa-warning");
- $("#conf-status .text").text("Invalid!");
+ target.find(".text").text("Invalid!");
+ target.data("validity", false);
} else {
// All valid
// console.info("Great, all configurations are valid :)");
recheck_icon.hide();
- $("#conf-status").removeClass("label-default label-warning")
+ target.removeClass("label-default label-warning")
.addClass("label-success");
- $("#conf-status .icon").removeClass("fa-question-circle fa-warning")
+ target.find(".icon").removeClass("fa-question-circle fa-warning")
.addClass("fa-check-circle");
- $("#conf-status .text").text("Valid :)");
+ target.find(".text").text("Valid :)");
+ target.data("validity", true);
}
};
diff --git a/fg21sim/webui/static/js/websocket.js b/fg21sim/webui/static/js/websocket.js
index fdca619..26d7fce 100644
--- a/fg21sim/webui/static/js/websocket.js
+++ b/fg21sim/webui/static/js/websocket.js
@@ -227,9 +227,13 @@ $(document).ready(function () {
// Start the task on the server
$("#task-start").on("click", function () {
- updateTaskStatus({running: true, finished: false});
- startServerTask(g_ws);
- getServerTaskStatus(g_ws);
+ if ($("#conf-status").data("validity")) {
+ updateTaskStatus({running: true, finished: false});
+ startServerTask(g_ws);
+ getServerTaskStatus(g_ws);
+ } else {
+ console.error("Exist invalid configuration values!");
+ }
});
/* Logging messages controls */