summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/libtoaster.js39
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/projectapp.js28
2 files changed, 48 insertions, 19 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
index 15815b333e..a2a0abd45b 100644
--- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
@@ -81,14 +81,14 @@ var libtoaster = (function (){
81 headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, 81 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
82 success: function (_data) { 82 success: function (_data) {
83 if (_data.error != "ok") { 83 if (_data.error != "ok") {
84 console.log(_data.error); 84 console.warn(_data.error);
85 } else { 85 } else {
86 if (onsuccess != undefined) onsuccess(_data); 86 if (onsuccess != undefined) onsuccess(_data);
87 } 87 }
88 }, 88 },
89 error: function (_data) { 89 error: function (_data) {
90 console.log("Call failed"); 90 console.warn("Call failed");
91 console.log(_data); 91 console.warn(_data);
92 if (onfail) onfail(data); 92 if (onfail) onfail(data);
93 } }); 93 } });
94 }; 94 };
@@ -102,13 +102,13 @@ var libtoaster = (function (){
102 headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, 102 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
103 success: function (_data) { 103 success: function (_data) {
104 if (_data.error != "ok") { 104 if (_data.error != "ok") {
105 console.log(_data.error); 105 console.warn(_data.error);
106 } else { 106 } else {
107 if (onsuccess != undefined) onsuccess(_data); 107 if (onsuccess != undefined) onsuccess(_data);
108 } 108 }
109 }, 109 },
110 error: function (_data) { 110 error: function (_data) {
111 console.log(_data); 111 console.warn(_data);
112 if (onfail) onfail(data); 112 if (onfail) onfail(data);
113 } 113 }
114 }); 114 });
@@ -168,6 +168,7 @@ var libtoaster = (function (){
168 getProjectInfo: _getProjectInfo, 168 getProjectInfo: _getProjectInfo,
169 getLayerDepsForProject : _getLayerDepsForProject, 169 getLayerDepsForProject : _getLayerDepsForProject,
170 editProject : _editProject, 170 editProject : _editProject,
171 debug: false,
171 } 172 }
172})(); 173})();
173 174
@@ -203,6 +204,15 @@ function reload_params(params) {
203/* Things that happen for all pages */ 204/* Things that happen for all pages */
204$(document).ready(function() { 205$(document).ready(function() {
205 206
207 /* If we don't have a console object which might be the case in some
208 * browsers, no-op it to avoid undefined errors.
209 */
210 if (!window.console) {
211 window.console = {};
212 window.console.warn = function() {};
213 window.console.error = function() {};
214 }
215
206 /* 216 /*
207 * PrettyPrint plugin. 217 * PrettyPrint plugin.
208 * 218 *
@@ -320,4 +330,23 @@ $(document).ready(function() {
320 if (location.href.search('#warnings') > -1) { 330 if (location.href.search('#warnings') > -1) {
321 $('#collapse-warnings').addClass('in'); 331 $('#collapse-warnings').addClass('in');
322 } 332 }
333
334 function check_for_duplicate_ids () {
335 /* warn about duplicate element ids */
336 var ids = {};
337 $("[id]").each(function() {
338 if (this.id && ids[this.id]) {
339 console.warn('Duplicate element id #'+this.id);
340 }
341 ids[this.id] = true;
342 });
343 }
344
345 if (libtoaster.debug) {
346 check_for_duplicate_ids();
347 } else {
348 /* Debug is false so supress warnings by overriding the functions */
349 window.console.warn = function () {};
350 window.console.error = function () {};
351 }
323}); 352});
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}