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/lib | |
parent | 49ac18dd0fedbcb63e9b18d1b0df62431ed37eb0 (diff) | |
download | ast2050-yocto-poky-152e2d9cc533c70cf3172c165d00ee177fb4aa78.zip ast2050-yocto-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/lib')
-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 864130d..fac59e6 100644 --- a/bitbake/lib/toaster/toastergui/static/js/base.js +++ b/bitbake/lib/toaster/toastergui/static/js/base.js @@ -3,10 +3,12 @@ function basePageInit (ctx) { var newBuildButton = $("#new-build-button"); - /* Hide the button if we're on the project,newproject or importlyaer page */ - if (ctx.currentUrl.search('newproject|project/\\d/$|importlayer/$') > 0){ - newBuildButton.hide(); - return; + /* 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){ + newBuildButton.hide(); + return; } @@ -17,6 +19,9 @@ function basePageInit (ctx) { function _checkProjectBuildable(){ + if (ctx.projectId == undefined) + return; + libtoaster.getProjectInfo(ctx.projectInfoUrl, ctx.projectId, function(data){ 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 734d2ad..f457b91 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html @@ -31,6 +31,7 @@ ctx.projectBuildUrl = "{% url 'xhr_build' %}"; ctx.projectPageUrl = "{% url 'project' %}"; ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; + ctx.numProjects = {{projects|length}}; {% if project %} ctx.projectId = {{project.id}}; {% endif %} |