Less logging

This commit is contained in:
peteruithoven 2014-02-04 22:56:58 +01:00
parent 932ad198ec
commit 652192d42d
5 changed files with 39 additions and 44 deletions

View File

@ -17,13 +17,13 @@ function ConfigAPI() {
var _self = this; var _self = this;
this.init = function(wifiboxURL,wifiboxCGIBinURL) { this.init = function(wifiboxURL,wifiboxCGIBinURL) {
console.log("ConfigAPI:init"); //console.log("ConfigAPI:init");
_wifiboxURL = wifiboxURL; _wifiboxURL = wifiboxURL;
_wifiboxCGIBinURL = wifiboxCGIBinURL; _wifiboxCGIBinURL = wifiboxCGIBinURL;
} }
this.loadAll = function(completeHandler,failedHandler) { this.loadAll = function(completeHandler,failedHandler) {
console.log("ConfigAPI:loadAll"); //console.log("ConfigAPI:loadAll");
$.ajax({ $.ajax({
url: _wifiboxURL + "/config/all", url: _wifiboxURL + "/config/all",
type: "GET", type: "GET",
@ -41,26 +41,26 @@ function ConfigAPI() {
}); });
}; };
this.load = function(targetSettings,completeHandler,failedHandler) { this.load = function(targetSettings,completeHandler,failedHandler) {
console.log("ConfigAPI:load"); //console.log("ConfigAPI:load");
$.ajax({ $.ajax({
url: _wifiboxURL + "/config/", url: _wifiboxURL + "/config/",
type: "GET", type: "GET",
dataType: 'json', dataType: 'json',
data: targetSettings, data: targetSettings,
timeout: _timeoutTime, timeout: _timeoutTime,
success: function(response){ success: function(response){
if(response.status == "error" || response.status == "fail") { if(response.status == "error" || response.status == "fail") {
failedHandler(); failedHandler();
} else { } else {
completeHandler(response.data); completeHandler(response.data);
}
} }
}).fail(function() { }
failedHandler(); }).fail(function() {
}); failedHandler();
}; });
};
this.save = function(newSettings,completeHandler,failedHandler) { this.save = function(newSettings,completeHandler,failedHandler) {
console.log("ConfigAPI:save"); //console.log("ConfigAPI:save");
$.ajax({ $.ajax({
url: _wifiboxURL + "/config", url: _wifiboxURL + "/config",
type: "POST", type: "POST",
@ -80,7 +80,7 @@ function ConfigAPI() {
}); });
}; };
this.resetAll = function(completeHandler,failedHandler) { this.resetAll = function(completeHandler,failedHandler) {
console.log("ConfigAPI:resetAll"); //console.log("ConfigAPI:resetAll");
$.ajax({ $.ajax({
url: _wifiboxCGIBinURL + "/config/resetall", url: _wifiboxCGIBinURL + "/config/resetall",
type: "POST", type: "POST",

View File

@ -31,7 +31,7 @@ function NetworkAPI() {
_wifiboxCGIBinURL = wifiboxCGIBinURL; _wifiboxCGIBinURL = wifiboxCGIBinURL;
} }
this.scan = function(completeHandler) { this.scan = function(completeHandler) {
console.log("NetworkAPI:scan"); //console.log("NetworkAPI:scan");
//console.log(" _wifiboxURL: ",_wifiboxURL); //console.log(" _wifiboxURL: ",_wifiboxURL);
$.ajax({ $.ajax({
url: _wifiboxURL + "/network/scan", url: _wifiboxURL + "/network/scan",
@ -84,10 +84,10 @@ function NetworkAPI() {
dataType: 'json', dataType: 'json',
timeout: _timeoutTime, timeout: _timeoutTime,
success: function(response){ success: function(response){
console.log("NetworkAPI:associate response: ",response); //console.log("NetworkAPI:associate response: ",response);
} }
}).fail(function() { }).fail(function() {
console.log("NetworkAPI:associate: timeout (normal behavior)"); //console.log("NetworkAPI:associate: timeout (normal behavior)");
}); });
}; };
@ -99,10 +99,10 @@ function NetworkAPI() {
dataType: 'json', dataType: 'json',
timeout: _timeoutTime, timeout: _timeoutTime,
success: function(response){ success: function(response){
console.log("NetworkAPI:openAP response: ",response); //console.log("NetworkAPI:openAP response: ",response);
} }
}).fail(function() { }).fail(function() {
console.log("NetworkAPI:openAP: timeout (normal behavior)"); //console.log("NetworkAPI:openAP: timeout (normal behavior)");
}); });
}; };

View File

@ -95,11 +95,11 @@ function FormPanel() {
}; };
this.saveSettings = function(newSettings,complete) { this.saveSettings = function(newSettings,complete) {
console.log("FormPanel:saveSettings"); //console.log("FormPanel:saveSettings");
console.log(" newSettings: ",newSettings); //console.log(" newSettings: ",newSettings);
_configAPI.save(newSettings,function(data) { _configAPI.save(newSettings,function(data) {
var validation = data.validation; var validation = data.validation;
console.log(" validation: ",validation); //console.log(" validation: ",validation);
clearValidationErrors(); clearValidationErrors();
var validated = true; var validated = true;
$.each(validation, function(key, val) { $.each(validation, function(key, val) {
@ -112,7 +112,7 @@ function FormPanel() {
settings.substituted_ssid = data.substituted_ssid; settings.substituted_ssid = data.substituted_ssid;
if(complete) complete(validated); if(complete) complete(validated);
}, function() { }, function() {
console.log("Settings:saveSettings: failed"); //console.log("Settings:saveSettings: failed");
clearTimeout(_retrySaveSettingsDelay); clearTimeout(_retrySaveSettingsDelay);
_retrySaveSettingsDelay = setTimeout(function() { _self.saveSettings(newSettings,complete); },_retryDelay); // retry after delay _retrySaveSettingsDelay = setTimeout(function() { _self.saveSettings(newSettings,complete); },_retryDelay); // retry after delay
}); });

View File

@ -54,7 +54,7 @@ function NetworkPanel() {
var _self = this; var _self = this;
this.init = function(wifiboxURL,wifiboxCGIBinURL,panelElement) { this.init = function(wifiboxURL,wifiboxCGIBinURL,panelElement) {
console.log("NetworkPanel:init"); //console.log("NetworkPanel:init");
// super call: // super call:
_self.constructor.prototype.init.call(_self,wifiboxURL,wifiboxCGIBinURL,panelElement); _self.constructor.prototype.init.call(_self,wifiboxURL,wifiboxCGIBinURL,panelElement);
@ -109,7 +109,7 @@ function NetworkPanel() {
_self.retrieveNetworkStatus(false); _self.retrieveNetworkStatus(false);
} }
this.refreshNetworks = function(completeHandler) { this.refreshNetworks = function(completeHandler) {
console.log("NetworkPanel:refreshNetworks"); //console.log("NetworkPanel:refreshNetworks");
_api.scan(function(data) { _api.scan(function(data) {
//console.log("NetworkPanel:scanned"); //console.log("NetworkPanel:scanned");
_networks = {}; _networks = {};
@ -204,7 +204,7 @@ function NetworkPanel() {
}); });
}; };
function setNetworkMode(mode) { function setNetworkMode(mode) {
console.log("NetworkPanel:setNetworkMode: ",_networkMode,">",mode); //console.log("NetworkPanel:setNetworkMode: ",_networkMode,">",mode);
if(mode == _networkMode) return; if(mode == _networkMode) return;
switch(mode) { switch(mode) {
case NETWORK_MODE.NEITHER: case NETWORK_MODE.NEITHER:
@ -228,7 +228,7 @@ function NetworkPanel() {
} }
this.selectNetwork = function(ssid) { this.selectNetwork = function(ssid) {
console.log("NetworkPanel:selectNetwork: ",ssid); //console.log("NetworkPanel:selectNetwork: ",ssid);
if(ssid == "") return; if(ssid == "") return;
_selectedNetwork = ssid; _selectedNetwork = ssid;
@ -272,7 +272,7 @@ function NetworkPanel() {
msg = statusMessage; msg = statusMessage;
break; break;
} }
console.log(" client display msg: ",msg); //console.log(" client display msg: ",msg);
_clientStateDisplay.html(msg); _clientStateDisplay.html(msg);
}; };
function updateAPModeUI(state,statusMessage) { function updateAPModeUI(state,statusMessage) {
@ -294,12 +294,12 @@ function NetworkPanel() {
msg = "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>"; msg = "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;
} }
console.log(" ap display msg: ",msg); //console.log(" ap display msg: ",msg);
_apModeStateDisplay.html(msg); _apModeStateDisplay.html(msg);
}; };
this.connectToNetwork = function() { this.connectToNetwork = function() {
console.log("NetworkPanel:connectToNetwork"); //console.log("NetworkPanel:connectToNetwork");
if(_selectedNetwork == undefined) return; if(_selectedNetwork == undefined) return;
// save network related settings and on complete, connect to network // save network related settings and on complete, connect to network
_self.saveSettings(_self.readForm(),function(validated) { _self.saveSettings(_self.readForm(),function(validated) {
@ -315,7 +315,7 @@ function NetworkPanel() {
}; };
this.createAP = function() { this.createAP = function() {
console.log("createAP"); //console.log("createAP");
// 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(success) { _self.saveSettings(_self.readForm(),function(success) {
if(!success) return; if(!success) return;

View File

@ -21,9 +21,7 @@ function PrinterPanel() {
var _self = this; var _self = this;
this.init = function(wifiboxURL,wifiboxCGIBinURL,panelElement) { this.init = function(wifiboxURL,wifiboxCGIBinURL,panelElement) {
console.log("PrinterPanel:init");
console.log(" panelElement: ",panelElement);
console.log(" _self: ",_self);
// super call: // super call:
_self.constructor.prototype.init.call(_self,wifiboxURL,wifiboxCGIBinURL,panelElement); _self.constructor.prototype.init.call(_self,wifiboxURL,wifiboxCGIBinURL,panelElement);
@ -35,15 +33,12 @@ function PrinterPanel() {
// we use readForm to get all the settings we need to // we use readForm to get all the settings we need to
// reload after changing printer type // reload after changing printer type
_printerSettings = _self.readForm(); _printerSettings = _self.readForm();
console.log(" _printerSettings: ",_printerSettings);
var gcodePanel = _element.find("#gcodePanel"); var gcodePanel = _element.find("#gcodePanel");
gcodePanel.coolfieldset({collapsed:true}); gcodePanel.coolfieldset({collapsed:true});
} }
this.printerSelectorChanged = function(e) { this.printerSelectorChanged = function(e) {
//console.log("PrinterPanel:printerSelectorChanged");
_self.printerType = _printerSelector.find("option:selected").val(); _self.printerType = _printerSelector.find("option:selected").val();
//_self.savePrinterType(self.loadPrinterSettings);
var settings = {}; var settings = {};
settings[_printerSelector.attr("name")] = _self.printerType; settings[_printerSelector.attr("name")] = _self.printerType;