aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static/js/configs.js
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-13 15:02:17 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-13 15:02:17 +0800
commit2db6464949e65df55396640dda598ffcdd27420c (patch)
treee8e4e114eddc3e6394314954ec16622d7e96b202 /fg21sim/webui/static/js/configs.js
parentbb0ee7f9f713a4371f3837486293f85aa0fbaec8 (diff)
downloadfg21sim-2db6464949e65df55396640dda598ffcdd27420c.tar.bz2
webui: Store config validity; Check before start task
* "updateFormConfigStatus()": Store the configuration validity as a custom data attribute. * Check the current configuration validity before start the task on the server.
Diffstat (limited to 'fg21sim/webui/static/js/configs.js')
-rw-r--r--fg21sim/webui/static/js/configs.js16
1 files changed, 10 insertions, 6 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);
}
};