mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 09:17:56 +01:00
Added network reconnect hint
This commit is contained in:
parent
b978b5ada5
commit
10ca22d7e9
@ -147,9 +147,9 @@ function SettingsWindow() {
|
|||||||
url: this.wifiboxURL + "/config/all",
|
url: this.wifiboxURL + "/config/all",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: this.timeoutTime,
|
timeout: this.timeoutTime,
|
||||||
success: function(data){
|
success: function(response){
|
||||||
console.log("Settings:loadSettings response: ",data);
|
console.log("Settings:loadSettings response: ",response);
|
||||||
settings = data.data;
|
settings = response.data;
|
||||||
console.log(" settings: ",settings);
|
console.log(" settings: ",settings);
|
||||||
self.fillForm();
|
self.fillForm();
|
||||||
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
|
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
|
||||||
@ -202,22 +202,24 @@ function SettingsWindow() {
|
|||||||
data: newSettings,
|
data: newSettings,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: this.timeoutTime,
|
timeout: this.timeoutTime,
|
||||||
success: function(data){
|
success: function(response){
|
||||||
console.log("Settings:saveSettings response: ",data);
|
console.log("Settings:saveSettings response: ",response);
|
||||||
if(data.status == "error") {
|
if(response.status == "error") {
|
||||||
clearTimeout(self.retrySaveSettingsDelay);
|
clearTimeout(self.retrySaveSettingsDelay);
|
||||||
self.retrySaveSettingsDelay = setTimeout(function() { self.saveSettings(settings) },self.retryDelay); // retry after delay
|
self.retrySaveSettingsDelay = setTimeout(function() { self.saveSettings(settings) },self.retryDelay); // retry after delay
|
||||||
} else {
|
} else {
|
||||||
var savedSettings = data.data;
|
var data = response.data;
|
||||||
|
var validation = data.validation;
|
||||||
self.clearValidationErrors();
|
self.clearValidationErrors();
|
||||||
var validated = true;
|
var validated = true;
|
||||||
$.each(savedSettings, function(key, val) {
|
$.each(validation, function(key, val) {
|
||||||
if (val != "ok") {
|
if (val != "ok") {
|
||||||
console.log("ERROR: setting '" + key + "' not successfully set. Message: " + val);
|
console.log("ERROR: setting '" + key + "' not successfully set. Message: " + val);
|
||||||
self.displayValidationError(key,val);
|
self.displayValidationError(key,val);
|
||||||
validated = false;
|
validated = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
settings.substituted_ssid = data.substituted_ssid;
|
||||||
if(complete && validated) complete();
|
if(complete && validated) complete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,15 +238,9 @@ function SettingsWindow() {
|
|||||||
formElement.after(errorMsg);
|
formElement.after(errorMsg);
|
||||||
}
|
}
|
||||||
this.clearValidationErrors = function() {
|
this.clearValidationErrors = function() {
|
||||||
console.log("clearValidationErrors");
|
|
||||||
console.log(" remove: ",self.form.find(".errorMsg").remove());
|
|
||||||
var formElements = self.form.find(".error");
|
var formElements = self.form.find(".error");
|
||||||
console.log(" formElements: ",formElements);
|
|
||||||
formElements.each( function(index,element) {
|
formElements.each( function(index,element) {
|
||||||
|
$(element).removeClass("error");
|
||||||
var element = $(element);
|
|
||||||
console.log(" element: ",element);
|
|
||||||
element.removeClass("error");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +394,7 @@ function SettingsWindow() {
|
|||||||
var networkSelector = self.form.find("#network");
|
var networkSelector = self.form.find("#network");
|
||||||
networkSelector.val(SettingsWindow.NOT_CONNECTED);
|
networkSelector.val(SettingsWindow.NOT_CONNECTED);
|
||||||
|
|
||||||
if(data.ssid) {
|
if(data.ssid && data.status == SettingsWindow.API_CREATED) {
|
||||||
self.currentAP = data.ssid;
|
self.currentAP = data.ssid;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -492,16 +488,16 @@ function SettingsWindow() {
|
|||||||
case SettingsWindow.CONNECTED:
|
case SettingsWindow.CONNECTED:
|
||||||
btnConnect.removeAttr("disabled");
|
btnConnect.removeAttr("disabled");
|
||||||
|
|
||||||
var fieldText = "Connected to: "+this.currentNetwork+".";
|
var fieldText = "Connected to: <b>"+this.currentNetwork+"</b>.";
|
||||||
if(this.currentLocalIP != undefined && this.currentLocalIP != "") {
|
if(this.currentLocalIP != undefined && this.currentLocalIP != "") {
|
||||||
var a = "<a href='http://"+this.currentLocalIP+"' target='_black'>"+this.currentLocalIP+"</a>";
|
var a = "<a href='http://"+this.currentLocalIP+"' target='_black'>"+this.currentLocalIP+"</a>";
|
||||||
fieldText += " Local ip: "+a;
|
fieldText += " (IP: "+a+")";
|
||||||
}
|
}
|
||||||
field.html(fieldText);
|
field.html(fieldText);
|
||||||
break;
|
break;
|
||||||
case SettingsWindow.CONNECTING:
|
case SettingsWindow.CONNECTING:
|
||||||
btnConnect.attr("disabled", true);
|
btnConnect.attr("disabled", true);
|
||||||
field.html("Connecting...");
|
field.html("Connecting... Reconnect by connecting your device to <b>"+this.selectedNetwork+"</b> and going to <a href='http://connect.doodle3d.com'>connect.doodle3d.com</a>");
|
||||||
break;
|
break;
|
||||||
case SettingsWindow.CONNECTING_FAILED:
|
case SettingsWindow.CONNECTING_FAILED:
|
||||||
btnConnect.removeAttr("disabled");
|
btnConnect.removeAttr("disabled");
|
||||||
@ -520,11 +516,11 @@ function SettingsWindow() {
|
|||||||
break;
|
break;
|
||||||
case SettingsWindow.AP:
|
case SettingsWindow.AP:
|
||||||
btnCreate.removeAttr("disabled");
|
btnCreate.removeAttr("disabled");
|
||||||
field.html("Is access point: "+this.currentAP);
|
field.html("Is access point: <b>"+this.currentAP+"</b>");
|
||||||
break;
|
break;
|
||||||
case SettingsWindow.CREATING_AP:
|
case SettingsWindow.CREATING_AP:
|
||||||
btnCreate.attr("disabled", true);
|
btnCreate.attr("disabled", true);
|
||||||
field.html("Creating access point...");
|
field.html("Creating access point... Reconnect by connecting your device to <b>"+settings.substituted_ssid+"</b> and going to <a href='http://draw.doodle3d.com'>draw.doodle3d.com</a>");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.apModeState = state;
|
this.apModeState = state;
|
||||||
@ -574,6 +570,7 @@ function SettingsWindow() {
|
|||||||
|
|
||||||
// save network related settings and on complete, create access point
|
// save network related settings and on complete, create access point
|
||||||
self.saveSettings(self.readForm(),function() {
|
self.saveSettings(self.readForm(),function() {
|
||||||
|
self.setAPModeState(SettingsWindow.CREATING_AP); // get latest substituted ssid
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: self.wifiboxCGIBinURL + "/network/openap",
|
url: self.wifiboxCGIBinURL + "/network/openap",
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
@ -97,16 +97,23 @@
|
|||||||
<legend>Access point settings</legend>
|
<legend>Access point settings</legend>
|
||||||
<label for="ssid">Wi-Fi box ssid*:</label><input type="text" class="large" name="network.ap.ssid" id="ssid"> <br>
|
<label for="ssid">Wi-Fi box ssid*:</label><input type="text" class="large" name="network.ap.ssid" id="ssid"> <br>
|
||||||
<small>* The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
|
<small>* The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
|
||||||
|
<br>
|
||||||
<label for="apKey">Password:</label><input type="text" class="large" name="network.ap.key" id="apKey"> <br>
|
<label for="apKey">Password:</label><input type="text" class="large" name="network.ap.key" id="apKey"> <br>
|
||||||
<label for="ipaddress">Wi-Fi box IP address:</label><input type="text" name="network.ap.address" id="ipaddress"><br>
|
<label for="ipaddress">Wi-Fi box IP address:</label><input type="text" name="network.ap.address" id="ipaddress"><br>
|
||||||
<label for="netmask">Wi-Fi box netmask:</label><input type="text" name="network.ap.netmask" id="netmask"><br>
|
<label for="netmask">Wi-Fi box netmask:</label><input type="text" name="network.ap.netmask" id="netmask"><br>
|
||||||
<input type="button" name="create" value="Create" class="button" id="createAP"/>
|
<input type="button" name="create" value="Create" class="button" id="createAP"/>
|
||||||
<span id="apModeState"></span>
|
<span id="apModeState"></span><br/>
|
||||||
|
<br/>
|
||||||
|
<small>When you can't connect to your device, you can always use an ethernet cable and go to <a href="http://connect.doodle3d.com">connect.doodle3d.com</a>.</small>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="clientSettings">
|
<fieldset id="clientSettings">
|
||||||
<legend>Client mode settings</legend>
|
<legend>Client mode settings</legend>
|
||||||
|
|
||||||
|
<label for="wifiboxid">Wi-Fi box id*:</label><input type="text" name="network.cl.wifiboxid" id="wifiboxid"><br>
|
||||||
|
<small>* Is used on <a href="http://connect.doodle3d.com">connect.doodle3d.com</a>. <br/>
|
||||||
|
The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
|
||||||
|
<br>
|
||||||
<label for="network">Network:</label>
|
<label for="network">Network:</label>
|
||||||
<select id="network" name="network.client.network">
|
<select id="network" name="network.client.network">
|
||||||
</select>
|
</select>
|
||||||
@ -115,9 +122,7 @@
|
|||||||
<input type="button" name="connect" value="Connect" class="button" id="connectToNetwork"/>
|
<input type="button" name="connect" value="Connect" class="button" id="connectToNetwork"/>
|
||||||
<span id="clientModeState"></span><br/>
|
<span id="clientModeState"></span><br/>
|
||||||
<br/>
|
<br/>
|
||||||
<label for="wifiboxid">Wi-Fi box id*:</label><input type="text" name="network.cl.wifiboxid" id="wifiboxid"><br>
|
<small>When you can't connect to your device, you can always use an ethernet cable and go to <a href="http://connect.doodle3d.com">connect.doodle3d.com</a>.</small>
|
||||||
<small>* Is used on <a href="http://connect.doodle3d.com">connect.doodle3d.com</a>. <br/>
|
|
||||||
The text <em>%%MAC_ADDR_TAIL%%</em> will be replaced by the last 6 digits of your Doodle3D Wi-Fi box's MAC address.</small>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user