summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/base.js6
-rw-r--r--bitbake/lib/toaster/toastergui/templates/base.html95
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py9
3 files changed, 59 insertions, 51 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/base.js b/bitbake/lib/toaster/toastergui/static/js/base.js
index 6042a96ee4..ed22a4ebc1 100644
--- a/bitbake/lib/toaster/toastergui/static/js/base.js
+++ b/bitbake/lib/toaster/toastergui/static/js/base.js
@@ -121,14 +121,14 @@ function basePageInit(ctx) {
121 }); 121 });
122 122
123 function _checkProjectBuildable() { 123 function _checkProjectBuildable() {
124 if (selectedProject.projectId === undefined) { 124 if (selectedProject.projectId === undefined || selectedProject.projectIsDefault) {
125 return; 125 return;
126 } 126 }
127 127
128 libtoaster.getProjectInfo(selectedProject.projectPageUrl, 128 libtoaster.getProjectInfo(selectedProject.projectPageUrl,
129 function (data) { 129 function (data) {
130 if (data.machine === null || data.machine.name === undefined || data.layers.length === 0) { 130 if (data.machine === null || data.machine.name === undefined || data.layers.length === 0) {
131 /* we can't build anything with out a machine and some layers */ 131 /* we can't build anything without a machine and some layers */
132 $("#new-build-button #targets-form").hide(); 132 $("#new-build-button #targets-form").hide();
133 $("#new-build-button .alert").show(); 133 $("#new-build-button .alert").show();
134 } else { 134 } else {
@@ -147,7 +147,7 @@ function basePageInit(ctx) {
147 /* If we don't have a current project then present the set project 147 /* If we don't have a current project then present the set project
148 * form. 148 * form.
149 */ 149 */
150 if (selectedProject.projectId === undefined) { 150 if (selectedProject.projectId === undefined || selectedProject.projectIsDefault) {
151 $('#change-project-form').show(); 151 $('#change-project-form').show();
152 $('#project .icon-pencil').hide(); 152 $('#project .icon-pencil').hide();
153 } 153 }
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index 3f277909d7..c1d0693066 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -38,6 +38,7 @@
38 projectId : {{project.id}}, 38 projectId : {{project.id}},
39 projectPageUrl : {% url 'project' project.id as purl %}{{purl|json}}, 39 projectPageUrl : {% url 'project' project.id as purl %}{{purl|json}},
40 projectName : {{project.name|json}}, 40 projectName : {{project.name|json}},
41 projectIsDefault: {% if project.is_default %}true{% else %}false{% endif %},
41 recipesTypeAheadUrl: {% url 'xhr_recipestypeahead' project.id as paturl%}{{paturl|json}}, 42 recipesTypeAheadUrl: {% url 'xhr_recipestypeahead' project.id as paturl%}{{paturl|json}},
42 layersTypeAheadUrl: {% url 'xhr_layerstypeahead' project.id as paturl%}{{paturl|json}}, 43 layersTypeAheadUrl: {% url 'xhr_layerstypeahead' project.id as paturl%}{{paturl|json}},
43 machinesTypeAheadUrl: {% url 'xhr_machinestypeahead' project.id as paturl%}{{paturl|json}}, 44 machinesTypeAheadUrl: {% url 'xhr_machinestypeahead' project.id as paturl%}{{paturl|json}},
@@ -48,7 +49,7 @@
48 projectId : undefined, 49 projectId : undefined,
49 projectPageUrl : undefined, 50 projectPageUrl : undefined,
50 projectName : undefined, 51 projectName : undefined,
51 projectId : undefined, 52 projectIsDefault: false,
52 {% endif %} 53 {% endif %}
53 }; 54 };
54 </script> 55 </script>
@@ -122,52 +123,54 @@
122 <div class="btn-group pull-right"> 123 <div class="btn-group pull-right">
123 <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a> 124 <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a>
124 </div> 125 </div>
125 <!-- New build popover --> 126 <!-- New build popover; only shown if there is at least one user-created project -->
126 <div class="btn-group pull-right" id="new-build-button" style="display:none"> 127 {% if non_cli_projects.count > 0 %}
127 <button class="btn dropdown-toggle" data-toggle="dropdown"> 128 <div class="btn-group pull-right" id="new-build-button" style="display:none">
128 New build 129 <button class="btn dropdown-toggle" data-toggle="dropdown">
129 <i class="icon-caret-down"></i> 130 New build
130 </button> 131 <i class="icon-caret-down"></i>
131 <ul class="dropdown-menu new-build multi-select"> 132 </button>
132 <li> 133 <ul class="dropdown-menu new-build multi-select">
133 <h3>New build</h3> 134 <li>
134 <h6>Project:</h6> 135 <h3>New build</h3>
135 <span id="project"> 136 <h6>
136 {% if project.id %} 137 Project:
137 <a class="lead" href="{% project_url project %}">{{project.name}}</a> 138 <span id="project">
138 {% else %} 139 {% if project.id and not project.is_default %}
139 <a class="lead" href="#"></a> 140 <a class="lead" href="{% project_url project %}">{{project.name}}</a>
140 {% endif %} 141 {% else %}
141 <i class="icon-pencil"></i> 142 <a class="lead" href="#"></a>
142 </span> 143 {% endif %}
143 <form id="change-project-form" style="display:none;"> 144 <i class="icon-pencil"></i>
144 <div class="input-append"> 145 </span>
145 <input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"/> 146 </h6>
146 <button id="save-project-button" class="btn" type="button">Save</button> 147 <form id="change-project-form" style="display:none;">
147 <a href="#" id="cancel-change-project" class="btn btn-link" style="display: none">Cancel</a> 148 <div class="input-append">
148 </div> 149 <input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"/>
149 <p><a id="view-all-projects" href="{% url 'all-projects' %}">View all projects</a></p> 150 <button id="save-project-button" class="btn" type="button">Save</button>
150 </form> 151 <a href="#" id="cancel-change-project" class="btn btn-link" style="display: none">Cancel</a>
151 </li> 152 </div>
152 <li> 153 <p><a id="view-all-projects" href="{% url 'all-projects' %}">View all projects</a></p>
153 <div class="alert" style="display:none;"> 154 </form>
154 <p>This project configuration is incomplete, so you cannot run builds.</p> 155 </li>
155 <p><a href="{% if project.id %}{% url 'project' project.id %}{% endif %}">View project configuration</a></p> 156 <li>
156 </div> 157 <div class="alert" style="display:none;">
157 </li> 158 <p>This project configuration is incomplete, so you cannot run builds.</p>
158 <li id="targets-form"> 159 <p><a href="{% if project.id %}{% url 'project' project.id %}{% endif %}">View project configuration</a></p>
159 <h6>Recipe(s):</h6>
160 <form>
161 <input type="text" class="input-xlarge build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" disabled/>
162 <div class="row-fluid">
163 <button class="btn btn-primary build-button" disabled>Build</button>
164 </div> 160 </div>
165 </form> 161 </li>
166 </li> 162 <li id="targets-form">
167 </ul> 163 <h6>Recipe(s):</h6>
168 </div> 164 <form>
169 165 <input type="text" class="input-xlarge build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" disabled/>
170 166 <div class="row-fluid">
167 <button class="btn btn-primary build-button" disabled>Build</button>
168 </div>
169 </form>
170 </li>
171 </ul>
172 </div>
173 {% endif %}
171 </div> 174 </div>
172 </div> 175 </div>
173</div> 176</div>
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index c4264a11a9..e2f2874539 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1870,10 +1870,15 @@ def image_information_dir(request, build_id, target_id, packagefile_id):
1870 return redirect(builds) 1870 return redirect(builds)
1871 # the context processor that supplies data used across all the pages 1871 # the context processor that supplies data used across all the pages
1872 1872
1873 1873# a context processor which runs on every request; this provides the
1874# projects and non_cli_projects (i.e. projects created by the user)
1875# variables referred to in templates, which used to determine the
1876# visibility of UI elements like the "New build" button
1874def managedcontextprocessor(request): 1877def managedcontextprocessor(request):
1878 projects = Project.objects.all()
1875 ret = { 1879 ret = {
1876 "projects": Project.objects.all(), 1880 "projects": projects,
1881 "non_cli_projects": projects.exclude(is_default=True),
1877 "DEBUG" : toastermain.settings.DEBUG, 1882 "DEBUG" : toastermain.settings.DEBUG,
1878 "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE, 1883 "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE,
1879 "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH, 1884 "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH,