mirror of
https://git.yoctoproject.org/poky
synced 2026-04-17 18:32:12 +02:00
bitbake: toaster: libtoaster Fix a few warnings picked up by jshint
Fix warnings and items that do not conform to strict. Also add a fairly lenient jshintrc. usage: jshint js_file (Bitbake rev: 93a1e05a5d6bd19e689126bfef0df8caa0d8bf34) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
41ebd5105b
commit
0fa38bb8e1
11
bitbake/lib/toaster/toastergui/static/js/.jshintrc
Normal file
11
bitbake/lib/toaster/toastergui/static/js/.jshintrc
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"curly" : false,
|
||||
"predef" : [ "$","libtoaster", "prettyPrint" ],
|
||||
"eqnull": true,
|
||||
"plusplus" : false,
|
||||
"browser" : true,
|
||||
"jquery" : true,
|
||||
"devel" : true,
|
||||
"unused" : true,
|
||||
"maxerr" : 60
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
"use strict";
|
||||
/* All shared functionality to go in libtoaster object.
|
||||
* This object really just helps readability since we can then have
|
||||
* a traceable namespace.
|
||||
@@ -19,7 +20,7 @@ var libtoaster = (function (){
|
||||
source: function(query, process){
|
||||
xhrParams.value = query;
|
||||
$.getJSON(xhrUrl, this.options.xhrParams, function(data){
|
||||
if (data.error != "ok") {
|
||||
if (data.error !== "ok") {
|
||||
console.log("Error getting data from server "+data.error);
|
||||
return;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ var libtoaster = (function (){
|
||||
}
|
||||
|
||||
jQElement.data('typeahead').render = customRenderFunc;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* url - the url of the xhr build */
|
||||
@@ -79,10 +80,10 @@ var libtoaster = (function (){
|
||||
data: data,
|
||||
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
||||
success: function (_data) {
|
||||
if (_data.error != "ok") {
|
||||
if (_data.error !== "ok") {
|
||||
console.warn(_data.error);
|
||||
} else {
|
||||
if (onsuccess != undefined) onsuccess(_data);
|
||||
if (onsuccess !== undefined) onsuccess(_data);
|
||||
}
|
||||
},
|
||||
error: function (_data) {
|
||||
@@ -90,7 +91,7 @@ var libtoaster = (function (){
|
||||
console.warn(_data);
|
||||
if (onfail) onfail(data);
|
||||
} });
|
||||
};
|
||||
}
|
||||
|
||||
/* Get a project's configuration info */
|
||||
function _getProjectInfo(url, projectId, onsuccess, onfail){
|
||||
@@ -100,18 +101,18 @@ var libtoaster = (function (){
|
||||
data: { project_id : projectId },
|
||||
headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
|
||||
success: function (_data) {
|
||||
if (_data.error != "ok") {
|
||||
if (_data.error !== "ok") {
|
||||
console.warn(_data.error);
|
||||
} else {
|
||||
if (onsuccess != undefined) onsuccess(_data);
|
||||
if (onsuccess !== undefined) onsuccess(_data);
|
||||
}
|
||||
},
|
||||
error: function (_data) {
|
||||
console.warn(_data);
|
||||
if (onfail) onfail(data);
|
||||
if (onfail) onfail(_data);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/* Properties for data can be:
|
||||
* layerDel (csv)
|
||||
@@ -129,10 +130,10 @@ var libtoaster = (function (){
|
||||
success: function (data) {
|
||||
if (data.error != "ok") {
|
||||
console.log(data.error);
|
||||
if (onFail != undefined)
|
||||
if (onFail !== undefined)
|
||||
onFail(data);
|
||||
} else {
|
||||
if (onSuccess != undefined)
|
||||
if (onSuccess !== undefined)
|
||||
onSuccess(data);
|
||||
}
|
||||
},
|
||||
@@ -141,7 +142,7 @@ var libtoaster = (function (){
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function _getLayerDepsForProject(xhrDataTypeaheadUrl, projectId, layerId, onSuccess, onFail){
|
||||
/* Check for dependencies not in the current project */
|
||||
@@ -150,7 +151,7 @@ var libtoaster = (function (){
|
||||
function(data) {
|
||||
if (data.error != "ok") {
|
||||
console.log(data.error);
|
||||
if (onFail != undefined)
|
||||
if (onFail !== undefined)
|
||||
onFail(data);
|
||||
} else {
|
||||
onSuccess(data);
|
||||
@@ -158,22 +159,22 @@ var libtoaster = (function (){
|
||||
}, function() {
|
||||
console.log("E: Failed to make request");
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/* parses the query string of the current window.location to an object */
|
||||
function _parseUrlParams() {
|
||||
string = window.location.search
|
||||
var string = window.location.search;
|
||||
string = string.substr(1);
|
||||
stringArray = string.split ("&");
|
||||
obj = {};
|
||||
var stringArray = string.split ("&");
|
||||
var obj = {};
|
||||
|
||||
for (i in stringArray) {
|
||||
keyVal = stringArray[i].split ("=");
|
||||
for (var i in stringArray) {
|
||||
var keyVal = stringArray[i].split ("=");
|
||||
obj[keyVal[0]] = keyVal[1];
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
/* takes a flat object and outputs it as a query string
|
||||
* e.g. the output of dumpsUrlParams
|
||||
@@ -181,7 +182,7 @@ var libtoaster = (function (){
|
||||
function _dumpsUrlParams(obj) {
|
||||
var str = "?";
|
||||
|
||||
for (key in obj){
|
||||
for (var key in obj){
|
||||
if (!obj[key])
|
||||
continue;
|
||||
|
||||
@@ -190,7 +191,7 @@ var libtoaster = (function (){
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
@@ -203,23 +204,23 @@ var libtoaster = (function (){
|
||||
debug: false,
|
||||
parseUrlParams : _parseUrlParams,
|
||||
dumpsUrlParams : _dumpsUrlParams,
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
/* keep this in the global scope for compatability */
|
||||
function reload_params(params) {
|
||||
uri = window.location.href;
|
||||
splitlist = uri.split("?");
|
||||
url = splitlist[0], parameters=splitlist[1];
|
||||
var uri = window.location.href;
|
||||
var splitlist = uri.split("?");
|
||||
var url = splitlist[0];
|
||||
var parameters = splitlist[1];
|
||||
// deserialize the call parameters
|
||||
if(parameters){
|
||||
cparams = parameters.split("&");
|
||||
}else{
|
||||
cparams = []
|
||||
}
|
||||
nparams = {}
|
||||
for (i = 0; i < cparams.length; i++) {
|
||||
temp = cparams[i].split("=");
|
||||
var cparams = [];
|
||||
if(parameters)
|
||||
cparams = parameters.split("&");
|
||||
|
||||
var nparams = {};
|
||||
for (var i = 0; i < cparams.length; i++) {
|
||||
var temp = cparams[i].split("=");
|
||||
nparams[temp[0]] = temp[1];
|
||||
}
|
||||
// update parameter values
|
||||
@@ -227,7 +228,7 @@ function reload_params(params) {
|
||||
nparams[encodeURIComponent(i)] = encodeURIComponent(params[i]);
|
||||
}
|
||||
// serialize the structure
|
||||
callparams = []
|
||||
var callparams = [];
|
||||
for (i in nparams) {
|
||||
callparams.push(i+"="+nparams[i]);
|
||||
}
|
||||
@@ -238,7 +239,7 @@ function reload_params(params) {
|
||||
/* Things that happen for all pages */
|
||||
$(document).ready(function() {
|
||||
|
||||
/* If we don't have a console object which might be the case in some
|
||||
/* If we don't have a console object which might be the case in some
|
||||
* browsers, no-op it to avoid undefined errors.
|
||||
*/
|
||||
if (!window.console) {
|
||||
@@ -271,7 +272,7 @@ $(document).ready(function() {
|
||||
// .btn class applied, and make sure popovers work on click, are mutually
|
||||
// exclusive and they close when your click outside their area
|
||||
|
||||
$('html').click(function(e){
|
||||
$('html').click(function(){
|
||||
$('td > a.btn').popover('hide');
|
||||
});
|
||||
|
||||
@@ -323,9 +324,9 @@ $(document).ready(function() {
|
||||
// linking directly to tabs
|
||||
$(function(){
|
||||
var hash = window.location.hash;
|
||||
hash && $('ul.nav a[href="' + hash + '"]').tab('show');
|
||||
$('ul.nav a[href="' + hash + '"]').tab('show');
|
||||
|
||||
$('.nav-tabs a').click(function (e) {
|
||||
$('.nav-tabs a').click(function () {
|
||||
$(this).tab('show');
|
||||
$('body').scrollTop();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user