From a0b5c92b2f414984a8673ca1f6e33bd686773905 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 4 Sep 2013 19:24:52 +0200 Subject: [PATCH] Network ui tweaks --- js/SettingsWindow.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/js/SettingsWindow.js b/js/SettingsWindow.js index 6d462df..e434a0c 100644 --- a/js/SettingsWindow.js +++ b/js/SettingsWindow.js @@ -47,7 +47,7 @@ function SettingsWindow() { // because the webserver needs time to switch // this time is multiplied 3 times after access point creation this.retrieveNetworkStatusDelay; // setTimout delay - this.retrieveNetworkStatusDelayTime = 3000; + this.retrieveNetworkStatusDelayTime = 4000; // Events SettingsWindow.SETTINGS_LOADED = "settingsLoaded"; @@ -316,10 +316,13 @@ function SettingsWindow() { dataType: 'json', timeout: self.timeoutTime, success: function(response){ - console.log("Settings:updateNetworkStatus response: ",response); - if(response.status == "error") { - clearTimeout(self.retryRetrieveNetworkStatusDelay); - self.retryRetrieveNetworkStatusDelay = setTimeout(function() { self.retrieveNetworkStatus() },self.retryDelay); // retry after delay + console.log("Settings:retrieveNetworkStatus response: ",response); + if(response.status == "error" || response.data.ssid == "") { + //clearTimeout(self.retryRetrieveNetworkStatusDelay); + //self.retryRetrieveNetworkStatusDelay = setTimeout(function() { self.retrieveNetworkStatus() },self.retryDelay); // retry after delay + + self.setClientModeState(SettingsWindow.NOT_CONNECTED); + } else { var data = response.data; switch(data.mode) { @@ -359,7 +362,7 @@ function SettingsWindow() { } } }).fail(function() { - console.log("Settings:updateNetworkStatus: failed"); + console.log("Settings:retrieveNetworkStatus: failed"); clearTimeout(self.retryRetrieveNetworkStatusDelay); self.retryRetrieveNetworkStatusDelay = setTimeout(function() { self.retrieveNetworkStatus() },self.retryDelay); // retry after delay }); @@ -415,7 +418,8 @@ function SettingsWindow() { if(self.selectedNetwork == undefined) return; postData = { ssid:self.selectedNetwork, - phrase:self.form.find("#password").val() + phrase:self.form.find("#password").val(), + recreate:true } console.log(" postData: ",postData); if (communicateWithWifibox) {