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

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

View File

@ -31,7 +31,7 @@ function NetworkAPI() {
_wifiboxCGIBinURL = wifiboxCGIBinURL;
}
this.scan = function(completeHandler) {
console.log("NetworkAPI:scan");
//console.log("NetworkAPI:scan");
//console.log(" _wifiboxURL: ",_wifiboxURL);
$.ajax({
url: _wifiboxURL + "/network/scan",
@ -84,10 +84,10 @@ function NetworkAPI() {
dataType: 'json',
timeout: _timeoutTime,
success: function(response){
console.log("NetworkAPI:associate response: ",response);
//console.log("NetworkAPI:associate response: ",response);
}
}).fail(function() {
console.log("NetworkAPI:associate: timeout (normal behavior)");
//console.log("NetworkAPI:associate: timeout (normal behavior)");
});
};
@ -99,10 +99,10 @@ function NetworkAPI() {
dataType: 'json',
timeout: _timeoutTime,
success: function(response){
console.log("NetworkAPI:openAP response: ",response);
//console.log("NetworkAPI:openAP response: ",response);
}
}).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) {
console.log("FormPanel:saveSettings");
console.log(" newSettings: ",newSettings);
//console.log("FormPanel:saveSettings");
//console.log(" newSettings: ",newSettings);
_configAPI.save(newSettings,function(data) {
var validation = data.validation;
console.log(" validation: ",validation);
//console.log(" validation: ",validation);
clearValidationErrors();
var validated = true;
$.each(validation, function(key, val) {
@ -112,7 +112,7 @@ function FormPanel() {
settings.substituted_ssid = data.substituted_ssid;
if(complete) complete(validated);
}, function() {
console.log("Settings:saveSettings: failed");
//console.log("Settings:saveSettings: failed");
clearTimeout(_retrySaveSettingsDelay);
_retrySaveSettingsDelay = setTimeout(function() { _self.saveSettings(newSettings,complete); },_retryDelay); // retry after delay
});

View File

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

View File

@ -21,9 +21,7 @@ function PrinterPanel() {
var _self = this;
this.init = function(wifiboxURL,wifiboxCGIBinURL,panelElement) {
console.log("PrinterPanel:init");
console.log(" panelElement: ",panelElement);
console.log(" _self: ",_self);
// super call:
_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
// reload after changing printer type
_printerSettings = _self.readForm();
console.log(" _printerSettings: ",_printerSettings);
var gcodePanel = _element.find("#gcodePanel");
gcodePanel.coolfieldset({collapsed:true});
}
this.printerSelectorChanged = function(e) {
//console.log("PrinterPanel:printerSelectorChanged");
_self.printerType = _printerSelector.find("option:selected").val();
//_self.savePrinterType(self.loadPrinterSettings);
var settings = {};
settings[_printerSelector.attr("name")] = _self.printerType;