0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 01:07:56 +01:00

Add button to include/exclude beta releases.

This commit is contained in:
Wouter R 2014-02-24 15:48:39 +01:00
parent daba2ef1c6
commit ce489112e8
3 changed files with 22 additions and 7 deletions

View File

@ -7,6 +7,8 @@
*/ */
function UpdatePanel() { function UpdatePanel() {
var _form = new FormPanel();
this.wifiboxURL; this.wifiboxURL;
this.element; this.element;
@ -40,24 +42,34 @@ function UpdatePanel() {
var self = this; var self = this;
this.init = function(wifiboxURL,updatePanelElement) { this.init = function(wifiboxURL,updatePanelElement) {
_form.init(wifiboxURL,wifiboxURL,updatePanelElement);
this.wifiboxURL = wifiboxURL; this.wifiboxURL = wifiboxURL;
this.element = updatePanelElement; this.element = updatePanelElement;
this.retainCheckbox = this.element.find("#retainConfiguration"); this.retainCheckbox = this.element.find("#retainConfiguration");
this.includeBetasCheckbox = this.element.find("#includeBetas");
this.btnUpdate = this.element.find("#update"); this.btnUpdate = this.element.find("#update");
this.statusDisplay = this.element.find("#updateState"); this.statusDisplay = this.element.find("#updateState");
this.infoDisplay = this.element.find("#updateInfo"); this.infoDisplay = this.element.find("#updateInfo");
this.retainCheckbox.change(this.retainChanged); this.retainCheckbox.change(this.retainChanged);
this.includeBetasCheckbox.change(this.includeBetasChanged);
this.btnUpdate.click(this.update); this.btnUpdate.click(this.update);
this.checkStatus(false); this.checkStatus(false);
} }
this.retainChanged = function(e) { this.retainChanged = function(e) {
//console.log("UpdatePanel:retainChanged"); //console.log("UpdatePanel:retainChanged");
//this call ensures that the update button gets enabled if (!retainChanged && !canUpdate)
self.setState(self.state,true); 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() { this.update = function() {
console.log("UpdatePanel:update"); console.log("UpdatePanel:update");
self.downloadUpdate(); self.downloadUpdate();
@ -149,6 +161,8 @@ function UpdatePanel() {
this.handleStatusData = function(data) { this.handleStatusData = function(data) {
//console.log("UpdatePanel:handleStatusData"); //console.log("UpdatePanel:handleStatusData");
var refreshUI = (self.canUpdate != data.can_update);
self.canUpdate = data.can_update; self.canUpdate = data.can_update;
if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { 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.progress = data.progress; // not always available
self.imageSize = data.image_size; // 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){ switch(this.state){
case UpdatePanel.IMAGE_READY: case UpdatePanel.IMAGE_READY:

View File

@ -137,7 +137,7 @@ form dl dt {
font-style: italic; font-style: italic;
width: 10em; width: 10em;
} }
#updatePanel #retainConfigurationLabel { #updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel {
display: inline; display: inline;
float: none; float: none;
} }

View File

@ -52,7 +52,7 @@
<option value="marlin_generic">Generic Marlin Printer</option> <option value="marlin_generic">Generic Marlin Printer</option>
<option value="makerbot_generic">Generic Makerbot Printer</option> <option value="makerbot_generic">Generic Makerbot Printer</option>
</select> --><br/> </select> --><br/>
<label for="printerDimensionsX">Dimensions:</label> <label for="printerDimensionsX">Dimensions:</label>
x:<input id="printerDimensionsX" type="number" class="small" name="printer.dimensions.x" placeholder="x">mm<br> x:<input id="printerDimensionsX" type="number" class="small" name="printer.dimensions.x" placeholder="x">mm<br>
<label for="printerDimensionsY"></label> <label for="printerDimensionsY"></label>
@ -80,7 +80,7 @@
<dt>{preheatBedTemp}</dt><dd>Preheat bed temperature</dd> <dt>{preheatBedTemp}</dt><dd>Preheat bed temperature</dd>
<dt>{printerType}</dt><dd>Printer type</dd> <dt>{printerType}</dt><dd>Printer type</dd>
<dt>{if heatedBed}</dt><dd>Enable line if printer has heated bed</dd> <dt>{if heatedBed}</dt><dd>Enable line if printer has heated bed</dd>
</dl> </dl>
</small> </small>
</div> </div>
@ -165,8 +165,9 @@
<fieldset id="updatePanel"> <fieldset id="updatePanel">
<legend>Update</legend> <legend>Update</legend>
<input id="retainConfiguration" type="checkbox" name="" value="retainConfiguration" checked="true"> <label for="retainConfiguration" id="retainConfigurationLabel">Preserve personal sketches and settings</label> <input id="retainConfiguration" type="checkbox" name="" value="retainConfiguration" checked="true"> <label for="retainConfiguration" id="retainConfigurationLabel">Preserve personal sketches and settings</label><br/>
<br/><br/> <input id="includeBetas" type="checkbox" name="doodle3d.includeBetas" value="includeBetas"> <label for="includeBetas" id="includeBetasLabel">Include beta releases (<a target="beta-info" href="http://doodle3d.com/help/beta">read more</a>)</label><br/>
<br/>
<input type="button" name="update" value="Update" class="button" id="update"/> <input type="button" name="update" value="Update" class="button" id="update"/>
<span id="updateState"></span><br/> <span id="updateState"></span><br/>
<small id="updateInfo"></small> <small id="updateInfo"></small>
@ -178,7 +179,7 @@
<input type="button" onclick="settingsWindow.downloadGcode()" name="downloadGcode" value="Download GCODE" class="button" id="downloadGcode"/> <input type="button" onclick="settingsWindow.downloadGcode()" name="downloadGcode" value="Download GCODE" class="button" id="downloadGcode"/>
<input type="button" onclick="settingsWindow.downloadSvg()" name="downloadSvg" value="Download SVG" class="button" id="downloadSvg"/> <input type="button" onclick="settingsWindow.downloadSvg()" name="downloadSvg" value="Download SVG" class="button" id="downloadSvg"/>
</fieldset> </fieldset>
<fieldset id="restorePanel"> <fieldset id="restorePanel">
<legend>Restore</legend> <legend>Restore</legend>
<input type="button" name="restoresettings" value="Restore settings to defaults" class="button" id="restoreSettings"/> <input type="button" name="restoresettings" value="Restore settings to defaults" class="button" id="restoreSettings"/>