summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/targets.html
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/targets.html')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/targets.html220
1 files changed, 41 insertions, 179 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/targets.html b/bitbake/lib/toaster/toastergui/templates/targets.html
index c27292095d..903e841ae5 100644
--- a/bitbake/lib/toaster/toastergui/templates/targets.html
+++ b/bitbake/lib/toaster/toastergui/templates/targets.html
@@ -1,14 +1,34 @@
1{% extends "baseprojectpage.html" %} 1{% extends "baseprojectpage.html" %}
2{% load projecttags %} 2{% load projecttags %}
3{% load humanize %} 3{% load humanize %}
4{% load static %}
4 5
5{% block localbreadcrumb %} 6{% block localbreadcrumb %}
6<li>All compatible recipes</li> 7<li>All compatible recipes</li>
7{% endblock %} 8{% endblock %}
8 9
9{% block projectinfomain %} 10{% block projectinfomain %}
10 <div class="page-header"> 11
11 <h1> 12<script src="{% static 'js/layerBtn.js' %}"></script>
13<script>
14
15 $(document).ready(function (){
16 var ctx = {
17 projectLayers : {{projectlayerset}},
18 };
19
20 try {
21 layerBtnsInit(ctx);
22 } catch (e) {
23 document.write("Sorry, An error has occurred loading this page");
24 console.warn(e);
25 }
26 });
27</script>
28
29
30<div class="page-header">
31 <h1>
12 {% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %} 32 {% if request.GET.filter and objects.paginator.count > 0 or request.GET.search and objects.paginator.count > 0 %}
13 {{objects.paginator.count}} recipe{{objects.paginator.count|pluralize}} found 33 {{objects.paginator.count}} recipe{{objects.paginator.count|pluralize}} found
14 {% elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %} 34 {% elif request.GET.filter and objects.paginator.count == 0 or request.GET.search and objects.paginator.count == 0 %}
@@ -16,14 +36,16 @@
16 {%else%} 36 {%else%}
17 All compatible recipes 37 All compatible recipes
18 {%endif%} 38 {%endif%}
19 <i class="icon-question-sign get-help heading-help" title="This page lists all the recipes compatible with the release selected for this project, which is {{project.release.description}}"></i> 39 <i class="icon-question-sign get-help heading-help" title="This page lists all the recipes compatible with the release selected for this project, which is {{project.release.description}}"></i>
20 </h1> 40 </h1>
21 </div> 41</div>
22 42
23 <div id="zone1alerts"> 43<div id="zone1alerts" style="display:none">
24 44 <div class="alert alert-info lead">
45 <button type="button" class="close" id="hide-alert">&times;</button>
46 <span id="alert-msg"></span>
25 </div> 47 </div>
26 48</div>
27{% if objects.paginator.count == 0 %} 49{% if objects.paginator.count == 0 %}
28 {% if request.GET.filter or request.GET.search %} 50 {% if request.GET.filter or request.GET.search %}
29 <div class="row-fluid"> 51 <div class="row-fluid">
@@ -75,17 +97,16 @@
75 </a> 97 </a>
76 {% endif %} 98 {% endif %}
77 </td> 99 </td>
78 <td class="add-layer" value="{{o.pk}}" layerversion_id="{{o.preffered_layerversion.pk}}"> 100 <td class="add-layer" value="{{o.pk}}">
79 <div id="layer-tooltip-{{o.pk}}" style="display: none; font-size: 11px; line-height: 1.3;" class="tooltip-inner">layer was modified</div> 101 <a href="{% url 'project' project.id %}#/targetbuild={{o.name}}" class="btn btn-block layer-exists-{{o.preffered_layerversion.pk}}" style="display:none; margin-top: 5px;" >
80 <a href="{% url 'project' project.id %}#/targetbuild={{o.name}}" id="target-build-{{o.pk}}" class="btn btn-block remove-layer" style="display:none;" > 102 Build recipe
81 Build recipe 103 </a>
82 </a> 104 <button class="btn btn-block layerbtn layer-add-{{o.preffered_layerversion.pk}}" data-layer='{ "id": {{o.preffered_layerversion.pk}}, "name": "{{o.preffered_layerversion.layer.name}}", "url": "{%url 'layerdetails' o.preffered_layerversion.pk%}"}' data-directive="add">
83 <a id="layer-add-{{o.pk}}" class="btn btn-block" style="display:none;" href="javascript:layerAdd({{o.preffered_layerversion.pk}}, '{{o.preffered_layerversion.layer.name}}', '{%url 'layerdetails' o.preffered_layerversion.pk%}', {{o.pk}})" > 105 <i class="icon-plus"></i>
84 <i class="icon-plus"></i> 106 Add layer
85 Add layer 107 <i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{o.preffered_layerversion.layer.name}} layer to your project"></i></i>
86 <i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{o.preffered_layerversion.layer.name}} layer to your project"></i> 108 </button>
87 </a> 109 </td>
88 </td>
89 </tr> 110 </tr>
90 {% endfor %} 111 {% endfor %}
91{% include "basetable_bottom.html" %} 112{% include "basetable_bottom.html" %}
@@ -115,165 +136,6 @@
115 136
116{% if project %} 137{% if project %}
117<script> 138<script>
118
119var tooltipUpdateText;
120
121/* ensure csrf cookie exists {% csrf_token %} */
122function _makeXHREditCall(data, onsuccess, onfail) {
123 $.ajax( {
124 type: "POST",
125 url: "{% url 'xhr_projectedit' project.id %}",
126 data: data,
127 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
128 success: function (_data) {
129 if (_data.error != "ok") {
130 console.warn(_data.error);
131 } else {
132 updateButtons(_data.layers.map(function (e) {return e.id}));
133 if (onsuccess != undefined) onsuccess(_data);
134 }
135 },
136 error: function (_data) {
137 console.warn("Call failed");
138 console.warn(_data);
139 }
140 });
141}
142
143function show_alert(text, cls) {
144 $("#zone1alerts").html("<div class=\"alert alert-info lead\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" + text + "</div>");
145}
146
147
148function show_dependencies_modal(layerId, layerName, layerURL, dependencies) {
149 // update layer name
150 $('.layer-name').text(layerName);
151 var deplistHtml = "";
152 for (var i = 0; i < dependencies.length; i++) {
153 deplistHtml += "<li><label class=\"checkbox\"><input name=\"dependencies\" value=\""
154 deplistHtml += dependencies[i].id;
155 deplistHtml +="\" type=\"checkbox\" checked=\"checked\"/>";
156 deplistHtml += dependencies[i].name;
157 deplistHtml += "</label></li>";
158 }
159 $('#dependencies_list').html(deplistHtml);
160
161 var selected = [layerId];
162 var layer_link_list = undefined;
163
164 $("#dependencies_modal_form").submit(function (e) {
165 e.preventDefault();
166 $("input[name='dependencies']:checked").map(function () { selected.push(parseInt($(this).val()))});
167 layer_link_list = "<a href='"+layerURL+"'>"+layerName+"</a>";
168 if (selected.length > 1) {
169 tooltipUpdateText = "" + selected.length + " layers added";
170 } else {
171 tooltipUpdateText = "1 layer added";
172 }
173
174 for (var i = 0; i < selected.length; i++) {
175 for (var j = 0; j < dependencies.length; j++) {
176 if (dependencies[j].id == selected[i]) {
177 layer_link_list+= ", <a href='"+dependencies[j].layerdetailurl+"'>"+dependencies[j].name+"</a>"
178 break;
179 }
180 }
181 }
182
183 $('#dependencies_modal').modal('hide');
184
185 {% if project %}
186 _makeXHREditCall({ 'layerAdd': selected.join(",") }, function onXHRSuccess() {
187 show_alert("You have added <strong>"+selected.length+"</strong> layer(s) to <a href=\"{% url 'project' project.id%}\">{{project.name}}</a>: " + layer_link_list);
188 });
189 {% endif %}
190
191 });
192 $('#dependencies_modal').modal('show');
193}
194
195function updateLayerCountLabels (amount) {
196 /* Update the filter labels */
197 var countLabel = $("#layer_version__projectlayer__project\\:{{project.id}}_count");
198 countLabel.text(Number(countLabel.text())+amount);
199
200 var countLabelRemaining = $("#layer_version__projectlayer__project\\:NOT{{project.id}}_count");
201 countLabelRemaining.text(Number(countLabelRemaining.text())-amount);
202}
203
204var pressedButton = undefined;
205
206function layerAdd(layerId, layerName, layerURL, pressedButtonId) {
207 pressedButton = pressedButtonId;
208 $.ajax({
209 url: '{% url "xhr_datatypeahead" %}',
210 data: {'type': 'layerdeps','value':layerId},
211 success: function(_data) {
212 if (_data.error != "ok") {
213 console.warn(_data.error);
214 } else {
215 updateLayerCountLabels(_data.list.length+1);
216
217 if (_data.list.length > 0) {
218 show_dependencies_modal(layerId, layerName, layerURL, _data.list);
219 }
220 else {
221 tooltipUpdateText = "1 layer added";
222 _makeXHREditCall({ 'layerAdd': layerId }, function () {
223 show_alert("You have added <strong>1</strong> layer to <a href=\"{% url 'project' project.id%}\">{{project.name}}</a>: <a href=\""+layerURL+"\">" + layerName +"</a>");
224 });
225 }
226 }
227 }
228 })
229}
230
231function buttonSet(id, state) {
232 var tohide, toshow;
233 if (state == "add")
234 {
235 toshow = "#layer-add-";
236 tohide = "#target-build-";
237 }
238 else if (state == "build")
239 {
240 tohide = "#layer-add-";
241 toshow = "#target-build-";
242 }
243
244 var previouslyvisible = $(tohide + id).is(":visible");
245 if (previouslyvisible && id == pressedButton) {
246 $(tohide + id).fadeOut( function() {
247 $("#layer-tooltip-" + id).text(tooltipUpdateText);
248 $("#layer-tooltip-" + id).fadeIn().delay(2000).fadeOut(function(){
249 $(toshow + id).delay(300).fadeIn();
250 });
251 });
252 } else {
253 $(tohide + id).hide();
254 $("#layer-tooltip-" + id).hide();
255 $(toshow + id).show();
256 }
257};
258
259
260function updateButtons(projectLayers) {
261 var displayedLayers = [];
262 $(".add-layer").map(function () { displayedLayers.push( { "l": parseInt($(this).attr('layerversion_id')), "i": parseInt($(this).attr('value'))})});
263 for (var i=0; i < displayedLayers.length; i++) {
264 if (projectLayers.indexOf(displayedLayers[i].l) > -1) {
265 buttonSet(displayedLayers[i].i, "build");
266 }
267 else {
268 buttonSet(displayedLayers[i].i, "add");
269 }
270 }
271}
272
273$(document).ready(function (){
274 updateButtons({{projectlayerset}});
275});
276
277</script> 139</script>
278{%endif%} 140{%endif%}
279 141