diff --git a/js/settings/UpdatePanel.js b/js/settings/UpdatePanel.js index 6594d0b..6d24a6e 100644 --- a/js/settings/UpdatePanel.js +++ b/js/settings/UpdatePanel.js @@ -7,6 +7,8 @@ */ function UpdatePanel() { + var _form = new FormPanel(); + this.wifiboxURL; this.element; @@ -40,24 +42,34 @@ function UpdatePanel() { var self = this; this.init = function(wifiboxURL,updatePanelElement) { + _form.init(wifiboxURL,wifiboxURL,updatePanelElement); this.wifiboxURL = wifiboxURL; this.element = updatePanelElement; this.retainCheckbox = this.element.find("#retainConfiguration"); + this.includeBetasCheckbox = this.element.find("#includeBetas"); this.btnUpdate = this.element.find("#update"); this.statusDisplay = this.element.find("#updateState"); this.infoDisplay = this.element.find("#updateInfo"); this.retainCheckbox.change(this.retainChanged); + this.includeBetasCheckbox.change(this.includeBetasChanged); this.btnUpdate.click(this.update); this.checkStatus(false); } this.retainChanged = function(e) { //console.log("UpdatePanel:retainChanged"); + //this call ensures that the update button gets enabled if (!retainChanged && !canUpdate) self.setState(self.state,true); } + this.includeBetasChanged = function() { + //console.log("UpdatePanel:includeBetasChanged"); + _form.saveSettings(_form.readForm(),function(validated, data) { + if(validated) self.checkStatus(false); + }); + } this.update = function() { console.log("UpdatePanel:update"); self.downloadUpdate(); @@ -149,6 +161,8 @@ function UpdatePanel() { this.handleStatusData = function(data) { //console.log("UpdatePanel:handleStatusData"); + var refreshUI = (self.canUpdate != data.can_update); + self.canUpdate = data.can_update; if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { @@ -161,7 +175,7 @@ function UpdatePanel() { self.progress = data.progress; // not always available self.imageSize = data.image_size; // not always available - self.setState(data.state_code); + self.setState(data.state_code, refreshUI); switch(this.state){ case UpdatePanel.IMAGE_READY: diff --git a/www/css/settings.css b/www/css/settings.css index dc6a6cf..25b1360 100644 --- a/www/css/settings.css +++ b/www/css/settings.css @@ -137,7 +137,7 @@ form dl dt { font-style: italic; width: 10em; } -#updatePanel #retainConfigurationLabel { +#updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel { display: inline; float: none; } \ No newline at end of file diff --git a/www/settings.html b/www/settings.html index 943d441..147601e 100644 --- a/www/settings.html +++ b/www/settings.html @@ -52,7 +52,7 @@ -->
- + x:mm
@@ -80,7 +80,7 @@
{preheatBedTemp}
Preheat bed temperature
{printerType}
Printer type
{if heatedBed}
Enable line if printer has heated bed
- + @@ -165,8 +165,9 @@
Update - -

+
+
+

@@ -178,7 +179,7 @@
- +
Restore