summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/projectapp.js
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-01-08 13:15:10 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-08 22:34:36 +0000
commited9fa17467ad8f41c654187eb840d4b4e15d262d (patch)
tree21166f53d96811cc2c31f83c69a026eb2f97d53b /bitbake/lib/toaster/toastergui/static/js/projectapp.js
parent2e26745a134373dfde3aa2b16fef3df720436e77 (diff)
downloadpoky-ed9fa17467ad8f41c654187eb840d4b4e15d262d.tar.gz
bitbake: toaster: Improve client side error handling
Make use of the toastermain.settings.DEBUG flag to toggle the client side error logging. Make the error logging consistent by using console.warn/error across the project, this adds traceability to the warnings. Also handles the case where console is not available by stubbing it in libtoaster. (Bitbake rev: c34ebc51a6cbf90c64ef1ac461e475c6341f0f2a) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/projectapp.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectapp.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectapp.js b/bitbake/lib/toaster/toastergui/static/js/projectapp.js
index bb97f3292c..767ea13a7e 100644
--- a/bitbake/lib/toaster/toastergui/static/js/projectapp.js
+++ b/bitbake/lib/toaster/toastergui/static/js/projectapp.js
@@ -136,7 +136,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
136 $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: type, value: currentValue}}) 136 $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: type, value: currentValue}})
137 .success(function (_data) { 137 .success(function (_data) {
138 if (_data.error != "ok") { 138 if (_data.error != "ok") {
139 alert(_data.error); 139 console.warn(_data.error);
140 deffered.reject(_data.error); 140 deffered.reject(_data.error);
141 } 141 }
142 deffered.resolve(_data.list); 142 deffered.resolve(_data.list);
@@ -152,12 +152,12 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
152 if (inXHRcall) { 152 if (inXHRcall) {
153 if (callparams.data === undefined) { 153 if (callparams.data === undefined) {
154 // we simply skip the data refresh calls 154 // we simply skip the data refresh calls
155 console.log("race on XHR, aborted"); 155 console.warn("race on XHR, aborted");
156 return; 156 return;
157 } else { 157 } else {
158 // we return a promise that we'll solve by reissuing the command later 158 // we return a promise that we'll solve by reissuing the command later
159 var delayed = $q.defer(); 159 var delayed = $q.defer();
160 console.log("race on XHR, delayed"); 160 console.warn("race on XHR, delayed");
161 $interval(function () {$scope._makeXHRCall(callparams).then(function (d) { delayed.resolve(d); });}, 100, 1); 161 $interval(function () {$scope._makeXHRCall(callparams).then(function (d) { delayed.resolve(d); });}, 100, 1);
162 162
163 return delayed.promise; 163 return delayed.promise;
@@ -171,7 +171,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
171 171
172 $http(callparams).success(function(_data, _status, _headers, _config) { 172 $http(callparams).success(function(_data, _status, _headers, _config) {
173 if (_data.error != "ok") { 173 if (_data.error != "ok") {
174 alert("Failed XHR request (" + _status + "): " + _data.error); 174 console.warn("Failed XHR request (" + _status + "): " + _data.error);
175 console.error("Failed XHR request: ", _data, _status, _headers, _config); 175 console.error("Failed XHR request: ", _data, _status, _headers, _config);
176 // stop refreshing hte page 176 // stop refreshing hte page
177 $interval.cancel($scope.pollHandle); 177 $interval.cancel($scope.pollHandle);
@@ -267,7 +267,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
267 deffered.resolve(_data); 267 deffered.resolve(_data);
268 } 268 }
269 }).error(function(_data, _status, _headers, _config) { 269 }).error(function(_data, _status, _headers, _config) {
270 alert("Failed HTTP XHR request (" + _status + ")" + _data); 270 console.warn("Failed HTTP XHR request (" + _status + ")" + _data);
271 console.error("Failed HTTP XHR request: ", _data, _status, _headers, _config); 271 console.error("Failed HTTP XHR request: ", _data, _status, _headers, _config);
272 inXHRcall = false; 272 inXHRcall = false;
273 deffered.reject(_data.error); 273 deffered.reject(_data.error);
@@ -298,7 +298,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
298 298
299 $scope.targetNamedBuild = function(target) { 299 $scope.targetNamedBuild = function(target) {
300 if ($scope.targetName === undefined && $scope.targetName1 === undefined){ 300 if ($scope.targetName === undefined && $scope.targetName1 === undefined){
301 alert("No target defined, please type in a target name"); 301 console.warn("No target defined, please type in a target name");
302 return; 302 return;
303 } 303 }
304 304
@@ -310,7 +310,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
310 targets: $scope.safeTargetName, 310 targets: $scope.safeTargetName,
311 } 311 }
312 }).then(function (data) { 312 }).then(function (data) {
313 console.log("received ", data); 313 console.warn("received ", data);
314 $scope.targetName = undefined; 314 $scope.targetName = undefined;
315 $scope.targetName1 = undefined; 315 $scope.targetName1 = undefined;
316 $location.hash('buildslist'); 316 $location.hash('buildslist');
@@ -357,7 +357,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
357 $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: "layerdeps", value: $scope.layerAddId }}) 357 $http({method:"GET", url: $scope.urls.xhr_datatypeahead, params : { type: "layerdeps", value: $scope.layerAddId }})
358 .success(function (_data) { 358 .success(function (_data) {
359 if (_data.error != "ok") { 359 if (_data.error != "ok") {
360 alert(_data.error); 360 console.warn(_data.error);
361 } else { 361 } else {
362 if (_data.list.length > 0) { 362 if (_data.list.length > 0) {
363 // activate modal 363 // activate modal
@@ -369,7 +369,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
369 $scope.selectedItems = (function () { s = {}; for (var i = 0; i < items.length; i++) { s[items[i].id] = true; };return s; })(); 369 $scope.selectedItems = (function () { s = {}; for (var i = 0; i < items.length; i++) { s[items[i].id] = true; };return s; })();
370 370
371 $scope.ok = function() { 371 $scope.ok = function() {
372 console.log("scope selected is ", $scope.selectedItems); 372 console.warn("scope selected is ", $scope.selectedItems);
373 $modalInstance.close(Object.keys($scope.selectedItems).filter(function (e) { return $scope.selectedItems[e];})); 373 $modalInstance.close(Object.keys($scope.selectedItems).filter(function (e) { return $scope.selectedItems[e];}));
374 }; 374 };
375 375
@@ -378,7 +378,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
378 }; 378 };
379 379
380 $scope.update = function() { 380 $scope.update = function() {
381 console.log("updated ", $scope.selectedItems); 381 console.warn("updated ", $scope.selectedItems);
382 }; 382 };
383 }, 383 },
384 resolve: { 384 resolve: {
@@ -393,7 +393,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
393 393
394 modalInstance.result.then(function (selectedArray) { 394 modalInstance.result.then(function (selectedArray) {
395 selectedArray.push($scope.layerAddId); 395 selectedArray.push($scope.layerAddId);
396 console.log("selected", selectedArray); 396 console.warn("selected", selectedArray);
397 397
398 $scope._makeXHRCall({ 398 $scope._makeXHRCall({
399 method: "POST", url: $scope.urls.xhr_edit, 399 method: "POST", url: $scope.urls.xhr_edit,
@@ -473,7 +473,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
473 473
474 $scope.edit = function(elementid) { 474 $scope.edit = function(elementid) {
475 var data = {}; 475 var data = {};
476 console.log("edit with ", elementid); 476 console.warn("edit with ", elementid);
477 var alertText = undefined; 477 var alertText = undefined;
478 var alertZone = undefined; 478 var alertZone = undefined;
479 var oldLayers = []; 479 var oldLayers = [];
@@ -675,7 +675,7 @@ projectApp.controller('prjCtrl', function($scope, $modal, $http, $interval, $loc
675*/ 675*/
676 676
677function test_diff_arrays() { 677function test_diff_arrays() {
678 _diffArrays([1,2,3], [2,3,4], function(e,f) { return e==f; }, function(e) {console.log("added", e)}, function(e) {console.log("deleted", e);}) 678 _diffArrays([1,2,3], [2,3,4], function(e,f) { return e==f; }, function(e) {console.warn("added", e)}, function(e) {console.warn("deleted", e);})
679} 679}
680 680
681// test_diff_arrays(); 681// test_diff_arrays();
@@ -685,6 +685,6 @@ var s = undefined;
685function test_set_alert(text) { 685function test_set_alert(text) {
686 s = angular.element("div#main").scope(); 686 s = angular.element("div#main").scope();
687 s.displayAlert(s.zone3alerts, text); 687 s.displayAlert(s.zone3alerts, text);
688 console.log(s.zone3alerts); 688 console.warn(s.zone3alerts);
689 s.$digest(); 689 s.$digest();
690} 690}