mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07:56 +01:00
Reset settings to defaults
This commit is contained in:
parent
fe9c2cc5ea
commit
f98dc488d4
@ -43,6 +43,7 @@ function SettingsWindow() {
|
|||||||
|
|
||||||
this.retryLoadSettingsDelay; // retry setTimout instance
|
this.retryLoadSettingsDelay; // retry setTimout instance
|
||||||
this.retrySaveSettingsDelay; // retry setTimout instance
|
this.retrySaveSettingsDelay; // retry setTimout instance
|
||||||
|
this.retryResetSettingsDelay // retry setTimout instance
|
||||||
this.retryRetrieveNetworkStatusDelay;// retry setTimout instance
|
this.retryRetrieveNetworkStatusDelay;// retry setTimout instance
|
||||||
|
|
||||||
this.apFieldSet;
|
this.apFieldSet;
|
||||||
@ -119,7 +120,8 @@ function SettingsWindow() {
|
|||||||
self.clientFieldSet = self.form.find("#clientSettings");
|
self.clientFieldSet = self.form.find("#clientSettings");
|
||||||
self.gcodeSettings = self.form.find("#gcodeSettings");
|
self.gcodeSettings = self.form.find("#gcodeSettings");
|
||||||
self.x3gSettings = self.form.find("#x3gSettings");
|
self.x3gSettings = self.form.find("#x3gSettings");
|
||||||
|
self.btnRestoreSettings = self.form.find("#restoreSettings");
|
||||||
|
|
||||||
btnAP.on('touchstart mousedown',self.showAPSettings);
|
btnAP.on('touchstart mousedown',self.showAPSettings);
|
||||||
btnClient.on('touchstart mousedown',self.showClientSettings);
|
btnClient.on('touchstart mousedown',self.showClientSettings);
|
||||||
btnRefresh.on('touchstart mousedown',self.refreshNetworks);
|
btnRefresh.on('touchstart mousedown',self.refreshNetworks);
|
||||||
@ -127,6 +129,8 @@ function SettingsWindow() {
|
|||||||
btnCreate.on('touchstart mousedown',self.createAP);
|
btnCreate.on('touchstart mousedown',self.createAP);
|
||||||
self.printerSelector.change(self.printerSelectorChanged);
|
self.printerSelector.change(self.printerSelectorChanged);
|
||||||
networkSelector.change(self.networkSelectorChanged);
|
networkSelector.change(self.networkSelectorChanged);
|
||||||
|
self.btnRestoreSettings.on('touchstart mousedown',self.resetSettings);
|
||||||
|
|
||||||
|
|
||||||
// update panel
|
// update panel
|
||||||
var $updatePanelElement = self.form.find("#updatePanel");
|
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) {
|
this.displayValidationError = function(key,msg) {
|
||||||
var formElement = self.form.find("[name|='"+key+"']");
|
var formElement = self.form.find("[name|='"+key+"']");
|
||||||
formElement.addClass("error");
|
formElement.addClass("error");
|
||||||
|
BIN
www/img/buttons/btnReset_settings.png
Normal file
BIN
www/img/buttons/btnReset_settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
@ -180,6 +180,10 @@
|
|||||||
<legend>Debug</legend>
|
<legend>Debug</legend>
|
||||||
<input type="button" onclick="settingsWindow.downloadlogs()" name="downloadlogs" value="Download logs" class="button" id="downloadlogs"/>
|
<input type="button" onclick="settingsWindow.downloadlogs()" name="downloadlogs" value="Download logs" class="button" id="downloadlogs"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
<fieldset id="restorePanel">
|
||||||
|
<legend>Restore</legend>
|
||||||
|
<input type="button" name="restoresettings" value="Restore settings to defaults" class="button" id="restoreSettings"/>
|
||||||
|
</fieldset>
|
||||||
</form><br/>
|
</form><br/>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user