From f34766376b6a77b740f2d218de901062b6de4cf6 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 17 Nov 2016 10:41:36 +0800 Subject: webui: configs.js: Confirm before reset the configurations --- fg21sim/webui/static/js/configs.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'fg21sim/webui/static') diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index 80c218c..4b01ca3 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -549,8 +549,26 @@ $(document).ready(function () { // Reset both server-side and client-side configurations to the defaults $("#reset-defaults").on("click", function () { - // TODO: add a confirmation dialog - resetConfigs(ajax_url); + var modalData = {}; + modalData.icon = "warning"; + modalData.message = ("Are you sure to reset the configurations?"); + modalData.buttons = [ + { + text: "Cancel", + rel: "modal:close", + click: function () { $.modal.close(); } + }, + { + text: "Reset!", + "class": "button-warning", + rel: "modal:close", + click: function () { + $.modal.close(); + resetConfigs(ajax_url); + } + }, + ]; + showConfigsModal(modalData); }); // Load the configurations from the specified user configuration file -- cgit v1.2.2