From f98dc488d495bf87f0d163be5ad7c28870a83676 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 22 Nov 2013 17:45:16 +0100 Subject: [PATCH] Reset settings to defaults --- js_src/SettingsWindow.js | 40 +++++++++++++++++++++++++- www/img/buttons/btnReset_settings.png | Bin 0 -> 7564 bytes www/settings.html | 4 +++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 www/img/buttons/btnReset_settings.png diff --git a/js_src/SettingsWindow.js b/js_src/SettingsWindow.js index 0338258..4b38378 100644 --- a/js_src/SettingsWindow.js +++ b/js_src/SettingsWindow.js @@ -43,6 +43,7 @@ function SettingsWindow() { this.retryLoadSettingsDelay; // retry setTimout instance this.retrySaveSettingsDelay; // retry setTimout instance + this.retryResetSettingsDelay // retry setTimout instance this.retryRetrieveNetworkStatusDelay;// retry setTimout instance this.apFieldSet; @@ -119,7 +120,8 @@ function SettingsWindow() { self.clientFieldSet = self.form.find("#clientSettings"); self.gcodeSettings = self.form.find("#gcodeSettings"); self.x3gSettings = self.form.find("#x3gSettings"); - + self.btnRestoreSettings = self.form.find("#restoreSettings"); + btnAP.on('touchstart mousedown',self.showAPSettings); btnClient.on('touchstart mousedown',self.showClientSettings); btnRefresh.on('touchstart mousedown',self.refreshNetworks); @@ -127,6 +129,8 @@ function SettingsWindow() { btnCreate.on('touchstart mousedown',self.createAP); self.printerSelector.change(self.printerSelectorChanged); networkSelector.change(self.networkSelectorChanged); + self.btnRestoreSettings.on('touchstart mousedown',self.resetSettings); + // update panel var $updatePanelElement = self.form.find("#updatePanel"); @@ -263,6 +267,40 @@ function SettingsWindow() { }); } } + this.resetSettings = function() { + console.log("resetSettings"); + //$("#restoreSettings").addClass("disabled"); + self.btnRestoreSettings.attr("disabled", true); + + //console.log(" self.wifiboxURL: ",self.wifiboxURL); + + if (communicateWithWifibox) { + $.ajax({ + url: self.wifiboxURL + "/config/resetall", + type: "POST", + dataType: 'json', + timeout: this.timeoutTime, + success: function(response){ + console.log("Settings:resetSettings response: ",response); + if(response.status == "error") { + clearTimeout(self.retryResetSettingsDelay); + self.retryResetSettingsDelay = setTimeout(function() { self.resetSettings() },self.retryDelay); // retry after delay + } else { + settings = response.data; + console.log(" settings: ",settings); + self.fillForm(); + $(document).trigger(SettingsWindow.SETTINGS_LOADED); + + self.btnRestoreSettings.removeAttr("disabled"); + } + } + }).fail(function() { + console.log("Settings:resetSettings: failed"); + clearTimeout(self.retryResetSettingsDelay); + self.retryResetSettingsDelay = setTimeout(function() { self.resetSettings() },self.retryDelay); // retry after delay + }); + } + } this.displayValidationError = function(key,msg) { var formElement = self.form.find("[name|='"+key+"']"); formElement.addClass("error"); diff --git a/www/img/buttons/btnReset_settings.png b/www/img/buttons/btnReset_settings.png new file mode 100644 index 0000000000000000000000000000000000000000..f79bfa0a0db09f25c51be227c1b27521aebf2d80 GIT binary patch literal 7564 zcmbVRWl$XLmWG7j?h?r0A;2($Gq_9e!6h)j;68%}mtes)z$65B4Fo4R1eX8-0)gNT z!GkQ{z4yDjKW^<-ZC7=_(&u@OyytYkT^*&Vu1J7Oi;ISaMxd-Dr~S}EA5J}N%!g}T zU}@b$LxYqzKtf%tkzO!&IGVJTiv=8@>;$ucYr|nyK5m0>F*LNtwstxONCP!hh^31Y z5cZc0(A&xN0gZ+xCh6@8vvhzX0Tyr@J7;mG!kfzd zs_R(#I#`NWF-b}Q#JnL71Ws@y4B+kL=!}4Pi!=R$7xK{mYnq1%@DCBBgE-SajWSTv z1jxF$!vO+75Vs{r5DXCH2ZH%QBK#s;0A3In!~^E#0SR$~K@b5U2nY=L*TM9l&E3ix zqAjQJFI^8KaVA?N(iOtPyxb2G+z20MB+Q%J8NvKF zgB%=T>2BwWv~zI={KW{faPdHjGd)=PPZykA)ztn??2PzVpdLcT;|+7=0RuriPELRM z^$%$TQXBr?X8cEKgpQ9ZoJSjuaPe@rd{_@_=D)!YvHRZ@{U!Kd4MfA;?qN}2j&d%R z9!_v)q_Uhi)59I0m7Ns?Bp?g|gN67(L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LhJmvib7YJ;P=C%OSMJHdcmjD<59sb4M$@iVGQ}jTiW;;Rf#6qqn8HWmf(y;RbOZ zErY5ew?ikyS%}X)XR2%K(;?rCJ`)&QI(MFuI)<^ESCov02DD7#e~unXFf#xYeN6Aa z3%azlIklI^c{Kge+_gWhs}Vn?{`h`hHF19Zcwn`OEmUlMam2{RRCroXw{rx7VAhnH%rdMg4d3J$D=S&5ui_ z`biVq#9JoFEIxfTZShRCcuGRj8JrBKr!}^@4aS0|1JVrHXMTzKT~?PDq@|_3NlIF9 z&-y5{&Z--eCoHa2fK`9JN0u%|1`6rl6YBIMMr++PpZRoyk;dt^t>ShOQd`)bpN}Cg zFYg;uo?V2_7)cHbXs5cDUjK*&C3xXre5C0obEk`@qw?4-ls*06>he;o8t~%O3>^~< Y+yPW$9r>C0*Z)yvd3Cu;8S{|;0>cU^+5i9m literal 0 HcmV?d00001 diff --git a/www/settings.html b/www/settings.html index ba7ee3a..aac0987 100644 --- a/www/settings.html +++ b/www/settings.html @@ -180,6 +180,10 @@ Debug +
+ Restore + +