diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-03-27 15:49:55 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-17 11:53:56 +0100 |
commit | fab29bd73720c27ca605f9f0112a3df1ffaa90da (patch) | |
tree | 324ae4a92516099c92e7c57cf54baf6e889f3572 | |
parent | 65e985976989c30a94d6e78c8cb348af93fa0878 (diff) | |
download | poky-fab29bd73720c27ca605f9f0112a3df1ffaa90da.tar.gz |
bitbake: toaster: base.js minor jshint fixes
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.
(Bitbake rev: 8652fbaf5e8c56d9d28b7da57432f37313a19b4a)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/base.js | 19 | ||||
-rw-r--r-- | bitbake/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 777ab432c2..241c5d2e0c 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) { | |||
6 | /* Hide the button if we're on the project,newproject or importlyaer page | 6 | /* Hide the button if we're on the project,newproject or importlyaer page |
7 | * or if there are no projects yet defined | 7 | * or if there are no projects yet defined |
8 | */ | 8 | */ |
9 | if (ctx.numProjects == 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ | 9 | if (ctx.numProjects === 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ |
10 | newBuildButton.hide(); | 10 | newBuildButton.hide(); |
11 | return; | 11 | return; |
12 | } | 12 | } |
@@ -18,17 +18,17 @@ function basePageInit (ctx) { | |||
18 | 18 | ||
19 | newBuildButton.show().removeAttr("disabled"); | 19 | newBuildButton.show().removeAttr("disabled"); |
20 | 20 | ||
21 | _checkProjectBuildable() | 21 | _checkProjectBuildable(); |
22 | _setupNewBuildButton(); | 22 | _setupNewBuildButton(); |
23 | 23 | ||
24 | 24 | ||
25 | function _checkProjectBuildable(){ | 25 | function _checkProjectBuildable(){ |
26 | if (ctx.projectId == undefined) | 26 | if (ctx.projectId === undefined) |
27 | return; | 27 | return; |
28 | 28 | ||
29 | libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, | 29 | libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, |
30 | function(data){ | 30 | function(data){ |
31 | if (data.machine.name == undefined || data.layers.length == 0) { | 31 | if (data.machine.name === undefined || data.layers.length === 0) { |
32 | /* we can't build anything with out a machine and some layers */ | 32 | /* we can't build anything with out a machine and some layers */ |
33 | $("#new-build-button #targets-form").hide(); | 33 | $("#new-build-button #targets-form").hide(); |
34 | $("#new-build-button .alert").show(); | 34 | $("#new-build-button .alert").show(); |
@@ -51,7 +51,7 @@ function basePageInit (ctx) { | |||
51 | /* If we don't have a current project then present the set project | 51 | /* If we don't have a current project then present the set project |
52 | * form. | 52 | * form. |
53 | */ | 53 | */ |
54 | if (ctx.projectId == undefined) { | 54 | if (ctx.projectId === undefined) { |
55 | $('#change-project-form').show(); | 55 | $('#change-project-form').show(); |
56 | $('#project .icon-pencil').hide(); | 56 | $('#project .icon-pencil').hide(); |
57 | } | 57 | } |
@@ -72,13 +72,13 @@ function basePageInit (ctx) { | |||
72 | * the value that has been set by selecting a suggestion from the typeahead | 72 | * the value that has been set by selecting a suggestion from the typeahead |
73 | */ | 73 | */ |
74 | newBuildProjectInput.on('input', function(event) { | 74 | newBuildProjectInput.on('input', function(event) { |
75 | if (event.keyCode == 13) | 75 | if (event.keyCode === 13) |
76 | return; | 76 | return; |
77 | newBuildProjectSaveBtn.attr("disabled", "disabled"); | 77 | newBuildProjectSaveBtn.attr("disabled", "disabled"); |
78 | }); | 78 | }); |
79 | 79 | ||
80 | newBuildTargetInput.on('input', function() { | 80 | newBuildTargetInput.on('input', function() { |
81 | if ($(this).val().length == 0) | 81 | if ($(this).val().length === 0) |
82 | newBuildTargetBuildBtn.attr("disabled", "disabled"); | 82 | newBuildTargetBuildBtn.attr("disabled", "disabled"); |
83 | else | 83 | else |
84 | newBuildTargetBuildBtn.removeAttr("disabled"); | 84 | newBuildTargetBuildBtn.removeAttr("disabled"); |
@@ -96,7 +96,7 @@ function basePageInit (ctx) { | |||
96 | }); | 96 | }); |
97 | 97 | ||
98 | newBuildProjectSaveBtn.click(function() { | 98 | newBuildProjectSaveBtn.click(function() { |
99 | ctx.projectId = selectedProject.id | 99 | ctx.projectId = selectedProject.id; |
100 | /* Update the typeahead project_id paramater */ | 100 | /* Update the typeahead project_id paramater */ |
101 | _checkProjectBuildable(); | 101 | _checkProjectBuildable(); |
102 | newBuildTargetInput.data('typeahead').options.xhrParams.project_id = ctx.projectId; | 102 | newBuildTargetInput.data('typeahead').options.xhrParams.project_id = ctx.projectId; |
@@ -131,6 +131,5 @@ function basePageInit (ctx) { | |||
131 | $(".new-build").click (function(event) { | 131 | $(".new-build").click (function(event) { |
132 | event.stopPropagation(); | 132 | event.stopPropagation(); |
133 | }); | 133 | }); |
134 | }; | 134 | } |
135 | |||
136 | } | 135 | } |
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index fcf82ac65b..ae9e4556a1 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 (){ | |||
67 | /* | 67 | /* |
68 | * url - the url of the xhr build */ | 68 | * url - the url of the xhr build */ |
69 | function _startABuild (url, project_id, targets, onsuccess, onfail) { | 69 | function _startABuild (url, project_id, targets, onsuccess, onfail) { |
70 | var data; | ||
71 | 70 | ||
72 | if (project_id) | 71 | var data = { |
73 | data = 'project_id='+project_id+'&targets='+targets; | 72 | project_id : project_id, |
74 | else | 73 | targets : targets, |
75 | data = 'targets='+targets; | 74 | } |
76 | 75 | ||
77 | $.ajax( { | 76 | $.ajax( { |
78 | type: "POST", | 77 | type: "POST", |