diff options
Diffstat (limited to 'fg21sim/webui')
-rw-r--r-- | fg21sim/webui/static/js/configs.js | 9 | ||||
-rw-r--r-- | fg21sim/webui/static/js/websocket.js | 1 | ||||
-rw-r--r-- | fg21sim/webui/templates/base.html | 2 | ||||
-rw-r--r-- | fg21sim/webui/templates/console.html | 4 |
4 files changed, 10 insertions, 6 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index 4e635ae..6ded8c4 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -136,7 +136,7 @@ var getFormConfigSingle = function (name) { value = target.filter(":checked").val(); } else if (target.is(":checkbox") && target.data("type") === "boolean") { // Convert the checkbox value into boolean - value = target.is(":checked") ? true : false; + value = target.prop("checked"); } else if (target.is(":checkbox")) { // Get values of checked checkboxes into array // Credit: https://stackoverflow.com/a/16171146/4856091 @@ -211,13 +211,10 @@ var setFormConfigSingle = function (name, value) { // Convert the checkbox value into boolean target.prop("checked", value); } else if (target.is(":checkbox")) { - // Convert value (key of a single option) to an Array - if (! Array.isArray(value)) { - value = [value]; - } + // The received value is already an Array target.val(value); } else if (target.is(":text") && target.data("type") == "array") { - // The received value is already an Array + // Convert array of values into a string value = value.join(", "); target.val(value); } else { diff --git a/fg21sim/webui/static/js/websocket.js b/fg21sim/webui/static/js/websocket.js index 26d7fce..0fcf98e 100644 --- a/fg21sim/webui/static/js/websocket.js +++ b/fg21sim/webui/static/js/websocket.js @@ -232,6 +232,7 @@ $(document).ready(function () { startServerTask(g_ws); getServerTaskStatus(g_ws); } else { + $("#console-invalid-configs").modal(); console.error("Exist invalid configuration values!"); } }); diff --git a/fg21sim/webui/templates/base.html b/fg21sim/webui/templates/base.html index 35b55dd..c8a4f17 100644 --- a/fg21sim/webui/templates/base.html +++ b/fg21sim/webui/templates/base.html @@ -16,6 +16,7 @@ <link rel="stylesheet" href="{{ static_url('css/font-awesome.css') }}" /> <link rel="stylesheet" href="{{ static_url('css/milligram.css') }}" /> <link rel="stylesheet" href="{{ static_url('css/fonts.css') }}" /> + <link rel="stylesheet" href="{{ static_url('css/jquery.modal.css') }}" /> <link rel="stylesheet" href="{{ static_url('css/main.css') }}" /> {% block extra_css %}{% end %} {% end %} @@ -41,6 +42,7 @@ {% block script %} <script src="{{ static_url('js/jquery-3.1.1.js') }}"></script> + <script src="{{ static_url('js/jquery.modal.js') }}"></script> <script src="{{ static_url('js/main.js') }}"></script> {% block extra_script %}{% end %} {% end %} diff --git a/fg21sim/webui/templates/console.html b/fg21sim/webui/templates/console.html index ca082cc..54a6744 100644 --- a/fg21sim/webui/templates/console.html +++ b/fg21sim/webui/templates/console.html @@ -16,6 +16,10 @@ <span class="text">Not started</span> </span> </strong></p> + <div id="console-invalid-configs" class="modal" style="display: none;"> + <p>There exist some <strong>invalid</strong> configuration values!</p> + <p>Please correct the configurations before starting the simulations</p> + </div> <p class="button-group"> <button type="button" id="task-start"><span class="fa fa-play" aria-hidden="true"></span> Start</button> |