diff options
author | Michael Wood <michael.g.wood@intel.com> | 2014-11-20 15:06:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-28 14:02:57 +0000 |
commit | 152e2d9cc533c70cf3172c165d00ee177fb4aa78 (patch) | |
tree | 80f459e860ca2d0fad9b0ccc6638c180b4fd174d /bitbake | |
parent | 49ac18dd0fedbcb63e9b18d1b0df62431ed37eb0 (diff) | |
download | poky-152e2d9cc533c70cf3172c165d00ee177fb4aa78.tar.gz |
bitbake: toaster: base Only show New Build button when there are > 0 projects
Only show new build button if we have defined at least one project as we
can't select a project to build against if there are no projects created
yet.
(Bitbake rev: 6daada59ee846c4e957bba3574dc262a0c79854d)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/base.js | 13 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/base.html | 1 |
2 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js index 864130def9..fac59e6458 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js | |||
@@ -3,10 +3,12 @@ | |||
3 | function basePageInit (ctx) { | 3 | function basePageInit (ctx) { |
4 | 4 | ||
5 | var newBuildButton = $("#new-build-button"); | 5 | var newBuildButton = $("#new-build-button"); |
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 | if (ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ | 7 | * or if there are no projects yet defined |
8 | newBuildButton.hide(); | 8 | */ |
9 | return; | 9 | if (ctx.numProjects == 0 || ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ |
10 | newBuildButton.hide(); | ||
11 | return; | ||
10 | } | 12 | } |
11 | 13 | ||
12 | 14 | ||
@@ -17,6 +19,9 @@ function basePageInit (ctx) { | |||
17 | 19 | ||
18 | 20 | ||
19 | function _checkProjectBuildable(){ | 21 | function _checkProjectBuildable(){ |
22 | if (ctx.projectId == undefined) | ||
23 | return; | ||
24 | |||
20 | libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, | 25 | libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, |
21 | function(data){ | 26 | function(data){ |
22 | if (data.machine.name == undefined || data.layers.length == 0) { | 27 | if (data.machine.name == undefined || data.layers.length == 0) { |
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index 734d2ad8a2..f457b91dce 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html | |||
@@ -31,6 +31,7 @@ | |||
31 | ctx.projectBuildUrl = "{% url 'xhr_build' %}"; | 31 | ctx.projectBuildUrl = "{% url 'xhr_build' %}"; |
32 | ctx.projectPageUrl = "{% url 'project' %}"; | 32 | ctx.projectPageUrl = "{% url 'project' %}"; |
33 | ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; | 33 | ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; |
34 | ctx.numProjects = {{projects|length}}; | ||
34 | {% if project %} | 35 | {% if project %} |
35 | ctx.projectId = {{project.id}}; | 36 | ctx.projectId = {{project.id}}; |
36 | {% endif %} | 37 | {% endif %} |