diff options
Diffstat (limited to 'bitbake/lib/toaster')
-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 %} |