Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 514CDE0091F; Fri, 27 Mar 2015 08:50:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.212.170 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id DD00BE00970 for ; Fri, 27 Mar 2015 08:50:19 -0700 (PDT) Received: by wibg7 with SMTP id g7so31219866wib.1 for ; Fri, 27 Mar 2015 08:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5FlG5aACgy+J0kpnt5lxpwODuzvFdVJOoICWUa+krv0=; b=FuA7ykn/ZQfr4SUHv/DXP5mS1YEucONS6mmFvN7wau2G3XklO+vYjLVqKHb9/fRszo hRId6oqOwcjx7JTgKK0Uj6lwaImaZN9Mlzry7Kyv6FMYC+dpqSEr4G1Ly40K9UwGAe0K S/UQIFFs286s+N46KnkB9T1/uqGwNRrgGXILiBVURo3ij3JZw4ouXfBy4A0IB1GAH0pr Dpvu1YpHhz7DSL8cBrOB5b7We5tUssT1wdIOU8K9/VfPJAkyyJj5q4tjpBnMFHEz1U7z hlpiE4N6pMZFdKQl/xhJg3Ll0Z4J9ZZxIhT+qHyYaABZ/OJBqUANQ03H8VBL6gJDncBL 1fWA== X-Gm-Message-State: ALoCoQnVPlmw7e/SSlTNl5flgAS8gADU7KGAAT3IQvjwidbGfLrnaEB+ffivn1KzcXcIQ8T9WCl3 X-Received: by 10.180.76.230 with SMTP id n6mr57880130wiw.15.1427471418379; Fri, 27 Mar 2015 08:50:18 -0700 (PDT) Received: from draco.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ga8sm3367906wib.11.2015.03.27.08.50.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Mar 2015 08:50:17 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Fri, 27 Mar 2015 15:49:55 +0000 Message-Id: <1427471395-10007-2-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427471395-10007-1-git-send-email-michael.g.wood@intel.com> References: <1427471395-10007-1-git-send-email-michael.g.wood@intel.com> Subject: [review-request][PATCH 2/2] bitbake: toaster: base.js minor jshint fixes X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2015 15:50:27 -0000 Fixing errors identified by jshint, some missing semicolons and preference for === operator. Also pass the urldata in libtoaster as an object rather than constructing a query string. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/static/js/base.js | 19 +++++++++---------- .../lib/toaster/toastergui/static/js/libtoaster.js | 9 ++++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js index f57e4d9..667c5df 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js @@ -6,7 +6,7 @@ function basePageInit (ctx) { /* Hide the button if we're on the project,newproject or importlyaer page * or if there are no projects yet defined */ - if (ctx.numProjects == 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ + if (ctx.numProjects === 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ newBuildButton.hide(); return; } @@ -18,17 +18,17 @@ function basePageInit (ctx) { newBuildButton.show().removeAttr("disabled"); - _checkProjectBuildable() + _checkProjectBuildable(); _setupNewBuildButton(); function _checkProjectBuildable(){ - if (ctx.projectId == undefined) + if (ctx.projectId === undefined) return; libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, function(data){ - if (data.machine.name == undefined || data.layers.length == 0) { + if (data.machine.name === undefined || data.layers.length === 0) { /* we can't build anything with out a machine and some layers */ $("#new-build-button #targets-form").hide(); $("#new-build-button .alert").show(); @@ -51,7 +51,7 @@ function basePageInit (ctx) { /* If we don't have a current project then present the set project * form. */ - if (ctx.projectId == undefined) { + if (ctx.projectId === undefined) { $('#change-project-form').show(); $('#project .icon-pencil').hide(); } @@ -72,13 +72,13 @@ function basePageInit (ctx) { * the value that has been set by selecting a suggestion from the typeahead */ newBuildProjectInput.on('input', function(event) { - if (event.keyCode == 13) + if (event.keyCode === 13) return; newBuildProjectSaveBtn.attr("disabled", "disabled"); }); newBuildTargetInput.on('input', function() { - if ($(this).val().length == 0) + if ($(this).val().length === 0) newBuildTargetBuildBtn.attr("disabled", "disabled"); else newBuildTargetBuildBtn.removeAttr("disabled"); @@ -95,7 +95,7 @@ function basePageInit (ctx) { }); newBuildProjectSaveBtn.click(function() { - ctx.projectId = selectedProject.id + ctx.projectId = selectedProject.id; /* Update the typeahead project_id paramater */ _checkProjectBuildable(); newBuildTargetInput.data('typeahead').options.xhrParams.project_id = ctx.projectId; @@ -130,6 +130,5 @@ function basePageInit (ctx) { $(".new-build").click (function(event) { event.stopPropagation(); }); - }; - + } } diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index fcf82ac..ae9e455 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -67,12 +67,11 @@ var libtoaster = (function (){ /* * url - the url of the xhr build */ function _startABuild (url, project_id, targets, onsuccess, onfail) { - var data; - if (project_id) - data = 'project_id='+project_id+'&targets='+targets; - else - data = 'targets='+targets; + var data = { + project_id : project_id, + targets : targets, + } $.ajax( { type: "POST", -- 2.1.0