summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-07-31 15:09:07 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-01 11:26:11 +0100
commit1b13222e1c031d29419781e41956bedf643ebd74 (patch)
treedb1bc8ea9fa2ea54d888c7cfe5d356c025fb5ffa /bitbake
parentdf999d2ac162a5be3a65ac4ce771a7466aab2bdb (diff)
downloadpoky-1b13222e1c031d29419781e41956bedf643ebd74.tar.gz
bitbake: toastergui: Standardise the layer object property layerdetailurl
To be able to use the utility functions in libtoaster we need to have a single property name for the value that represents the url for the layer details in the layer object. (Bitbake rev: 4d64fd0d1236d342b29537f601a68cd23a8255ea) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/importlayer.js6
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerdetails.js2
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/libtoaster.js4
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py7
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layer_btn.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layerdetails.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/machine_btn.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/recipe_btn.html2
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py14
9 files changed, 28 insertions, 15 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
index df48e84876..560e25a01c 100644
--- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js
+++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js
@@ -50,7 +50,7 @@ function importLayerPageInit (ctx) {
50 newLayerDep.children("span").tooltip(); 50 newLayerDep.children("span").tooltip();
51 51
52 var link = newLayerDep.children("a"); 52 var link = newLayerDep.children("a");
53 link.attr("href", currentLayerDepSelection.layerDetailsUrl); 53 link.attr("href", currentLayerDepSelection.layerdetailurl);
54 link.text(currentLayerDepSelection.name); 54 link.text(currentLayerDepSelection.name);
55 link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); 55 link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"});
56 56
@@ -65,10 +65,10 @@ function importLayerPageInit (ctx) {
65 65
66 $("#layer-deps-list").append(newLayerDep); 66 $("#layer-deps-list").append(newLayerDep);
67 67
68 libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerDetailsUrl, function (data){ 68 libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerdetailurl, function (data){
69 /* These are the dependencies of the layer added as a dependency */ 69 /* These are the dependencies of the layer added as a dependency */
70 if (data.list.length > 0) { 70 if (data.list.length > 0) {
71 currentLayerDepSelection.url = currentLayerDepSelection.layerDetailsUrl; 71 currentLayerDepSelection.url = currentLayerDepSelection.layerdetailurl;
72 layerDeps[currentLayerDepSelection.id].deps = data.list; 72 layerDeps[currentLayerDepSelection.id].deps = data.list;
73 } 73 }
74 74
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
index e522373b3f..291ed98c34 100644
--- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
@@ -78,7 +78,7 @@ function layerDetailsPageInit (ctx) {
78 newLayerDep.children("span").tooltip(); 78 newLayerDep.children("span").tooltip();
79 79
80 var link = newLayerDep.children("a"); 80 var link = newLayerDep.children("a");
81 link.attr("href", currentLayerDepSelection.layerDetailsUrl); 81 link.attr("href", currentLayerDepSelection.layerdetailurl);
82 link.text(currentLayerDepSelection.name); 82 link.text(currentLayerDepSelection.name);
83 link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); 83 link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"});
84 84
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
index 667aca20ff..0000c572ac 100644
--- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
@@ -225,7 +225,7 @@ var libtoaster = (function (){
225 function _addRmLayer(layerObj, add, doneCb){ 225 function _addRmLayer(layerObj, add, doneCb){
226 if (add === true) { 226 if (add === true) {
227 /* If adding get the deps for this layer */ 227 /* If adding get the deps for this layer */
228 libtoaster.getLayerDepsForProject(layerObj.url, 228 libtoaster.getLayerDepsForProject(layerObj.layerdetailurl,
229 function (layers) { 229 function (layers) {
230 230
231 /* got result for dependencies */ 231 /* got result for dependencies */
@@ -285,7 +285,7 @@ var libtoaster = (function (){
285 } 285 }
286 286
287 alertMsg.children("#layer-affected-name").text(layer.name); 287 alertMsg.children("#layer-affected-name").text(layer.name);
288 alertMsg.children("#layer-affected-name").attr("href", layer.url); 288 alertMsg.children("#layer-affected-name").attr("href", layer.layerdetailurl);
289 alertMsg.children("#project-affected-name").text(libtoaster.ctx.projectName); 289 alertMsg.children("#project-affected-name").text(libtoaster.ctx.projectName);
290 alertMsg.children("#project-affected-name").attr("href", libtoaster.ctx.projectPageUrl); 290 alertMsg.children("#project-affected-name").attr("href", libtoaster.ctx.projectPageUrl);
291 291
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 146a8ddeed..782ae80dc2 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -193,7 +193,7 @@ class LayersTable(ToasterTable):
193 project = Project.objects.get(pk=kwargs['pid']) 193 project = Project.objects.get(pk=kwargs['pid'])
194 self.add_column(title="LayerDetailsUrl", 194 self.add_column(title="LayerDetailsUrl",
195 displayable = False, 195 displayable = False,
196 field_name="layerDetailsUrl", 196 field_name="layerdetailurl",
197 computation = lambda x: reverse('layerdetails', args=(project.id, x.id))) 197 computation = lambda x: reverse('layerdetails', args=(project.id, x.id)))
198 198
199 199
@@ -208,7 +208,10 @@ class LayerDetails(ToasterTemplateView):
208 context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) 208 context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid'])
209 context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) 209 context['layerdict'] = _lv_to_dict(context['project'], context['layerversion'])
210 context['layerdeps'] = {"list": [ 210 context['layerdeps'] = {"list": [
211 [{"id": y.id, "name": y.layer.name} for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]} 211 [ {"id": y.id,
212 "name": y.layer.name,
213 "layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)),
214 } for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]}
212 context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) 215 context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project']))
213 216
214 self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] 217 self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps']
diff --git a/bitbake/lib/toaster/toastergui/templates/layer_btn.html b/bitbake/lib/toaster/toastergui/templates/layer_btn.html
index 6672017256..a2e93934de 100644
--- a/bitbake/lib/toaster/toastergui/templates/layer_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/layer_btn.html
@@ -1,8 +1,8 @@
1<button class="btn btn-danger btn-block layer-exists-{{data.pk}} layerbtn" style="display:none;" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="remove" > 1<button class="btn btn-danger btn-block layer-exists-{{data.pk}} layerbtn" style="display:none;" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="remove" >
2 <i class="icon-trash"></i> 2 <i class="icon-trash"></i>
3 Delete layer 3 Delete layer
4</button> 4</button>
5<button class="btn btn-block layer-add-{{data.pk}} layerbtn" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="add"> 5<button class="btn btn-block layer-add-{{data.pk}} layerbtn" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="add">
6 <i class="icon-plus"></i> 6 <i class="icon-plus"></i>
7 Add layer 7 Add layer
8</button> 8</button>
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
index 6269b3630f..2f875ebe14 100644
--- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html
+++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
@@ -55,7 +55,7 @@
55 {% else %} 55 {% else %}
56 inCurrentPrj : false, 56 inCurrentPrj : false,
57 {% endif %} 57 {% endif %}
58 url : "{% url 'layerdetails' project.id layerversion.id %}", 58 layerdetailurl : "{% url 'layerdetails' project.id layerversion.id %}",
59 sourceId: {{layerversion.layer_source_id|json}}, 59 sourceId: {{layerversion.layer_source_id|json}},
60 } 60 }
61 }; 61 };
diff --git a/bitbake/lib/toaster/toastergui/templates/machine_btn.html b/bitbake/lib/toaster/toastergui/templates/machine_btn.html
index fffb536e2b..54ff5def71 100644
--- a/bitbake/lib/toaster/toastergui/templates/machine_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/machine_btn.html
@@ -1,6 +1,6 @@
1<a href="{% url 'project' extra.pid %}#/machineselect={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.id}}" style="margin-top: 5px; display:none"> 1<a href="{% url 'project' extra.pid %}#/machineselect={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.id}}" style="margin-top: 5px; display:none">
2 Select machine</a> 2 Select machine</a>
3<button class="btn btn-block layerbtn layer-add-{{data.layer_version.id}}" data-layer='{ "id": {{data.layer_version.id}}, "name": "{{data.layer_version.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.layer_version.id %}"}' data-directive="add"> 3<button class="btn btn-block layerbtn layer-add-{{data.layer_version.id}}" data-layer='{ "id": {{data.layer_version.id}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.id %}"}' data-directive="add">
4 <i class="icon-plus"></i> 4 <i class="icon-plus"></i>
5 Add layer 5 Add layer
6 <i title="" class="icon-question-sign get-help" data-original-title="To enable this machine, you must first add the {{data.layer_version.layer.name}} layer to your project"></i> 6 <i title="" class="icon-question-sign get-help" data-original-title="To enable this machine, you must first add the {{data.layer_version.layer.name}} layer to your project"></i>
diff --git a/bitbake/lib/toaster/toastergui/templates/recipe_btn.html b/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
index 1c7c58ca3f..d9ec3faec1 100644
--- a/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
@@ -1,7 +1,7 @@
1<a href="{% url 'project' extra.pid %}#/targetbuild={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}}" style="display:none; margin-top: 5px;" > 1<a href="{% url 'project' extra.pid %}#/targetbuild={{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}}" style="display:none; margin-top: 5px;" >
2 Build recipe 2 Build recipe
3</a> 3</a>
4<button class="btn btn-block layerbtn layer-add-{{data.layer_version.pk}}" data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}", "url": "{%url 'layerdetails' extra.pid data.layer_version.pk%}"}' data-directive="add"> 4<button class="btn btn-block layerbtn layer-add-{{data.layer_version.pk}}" data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.pk%}"}' data-directive="add">
5 <i class="icon-plus"></i> 5 <i class="icon-plus"></i>
6 Add layer 6 Add layer
7 <i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{data.layer_version.layer.name}} layer to your project"></i> 7 <i title="" class="icon-question-sign get-help" data-original-title="To build this target, you must first add the {{data.layer_version.layer.name}} layer to your project"></i>
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 9c63aae251..9e89714b9c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2434,7 +2434,8 @@ if True:
2434 continue 2434 continue
2435 2435
2436 if prj_layer_created: 2436 if prj_layer_created:
2437 layers_added.append({'id': layer_dep_obj.id, 'name': Layer.objects.get(id=layer_dep_obj.layer_id).name}) 2437 layerdepdetailurl = reverse('layerdetails', args=(prj.id, layer_dep_obj.pk))
2438 layers_added.append({'id': layer_dep_obj.id, 'name': Layer.objects.get(id=layer_dep_obj.layer_id).name, 'layerdetailurl': layerdepdetailurl })
2438 2439
2439 2440
2440 # If an old layer version exists in our project then remove it 2441 # If an old layer version exists in our project then remove it
@@ -2453,8 +2454,17 @@ if True:
2453 2454
2454 return HttpResponse(jsonfilter({"error": "Uncaught error: Could not create layer version"}), content_type = "application/json") 2455 return HttpResponse(jsonfilter({"error": "Uncaught error: Could not create layer version"}), content_type = "application/json")
2455 2456
2457 layerdetailurl = reverse('layerdetails', args=(prj.id, layer_version.pk))
2456 2458
2457 return HttpResponse(jsonfilter({"error": "ok", "imported_layer" : { "name" : layer.name, "id": layer_version.id }, "deps_added": layers_added }), content_type = "application/json") 2459 json_response = {"error": "ok",
2460 "imported_layer" : {
2461 "name" : layer.name,
2462 "id": layer_version.id,
2463 "layerdetailurl": layerdetailurl,
2464 },
2465 "deps_added": layers_added }
2466
2467 return HttpResponse(jsonfilter(json_response), content_type = "application/json")
2458 2468
2459 def xhr_updatelayer(request): 2469 def xhr_updatelayer(request):
2460 2470