From 1b13222e1c031d29419781e41956bedf643ebd74 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 31 Jul 2015 15:09:07 +0300 Subject: 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 Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/static/js/importlayer.js | 6 +++--- bitbake/lib/toaster/toastergui/static/js/layerdetails.js | 2 +- bitbake/lib/toaster/toastergui/static/js/libtoaster.js | 4 ++-- bitbake/lib/toaster/toastergui/tables.py | 7 +++++-- bitbake/lib/toaster/toastergui/templates/layer_btn.html | 4 ++-- bitbake/lib/toaster/toastergui/templates/layerdetails.html | 2 +- bitbake/lib/toaster/toastergui/templates/machine_btn.html | 2 +- bitbake/lib/toaster/toastergui/templates/recipe_btn.html | 2 +- bitbake/lib/toaster/toastergui/views.py | 14 ++++++++++++-- 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) { newLayerDep.children("span").tooltip(); var link = newLayerDep.children("a"); - link.attr("href", currentLayerDepSelection.layerDetailsUrl); + link.attr("href", currentLayerDepSelection.layerdetailurl); link.text(currentLayerDepSelection.name); link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); @@ -65,10 +65,10 @@ function importLayerPageInit (ctx) { $("#layer-deps-list").append(newLayerDep); - libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerDetailsUrl, function (data){ + libtoaster.getLayerDepsForProject(currentLayerDepSelection.layerdetailurl, function (data){ /* These are the dependencies of the layer added as a dependency */ if (data.list.length > 0) { - currentLayerDepSelection.url = currentLayerDepSelection.layerDetailsUrl; + currentLayerDepSelection.url = currentLayerDepSelection.layerdetailurl; layerDeps[currentLayerDepSelection.id].deps = data.list; } 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) { newLayerDep.children("span").tooltip(); var link = newLayerDep.children("a"); - link.attr("href", currentLayerDepSelection.layerDetailsUrl); + link.attr("href", currentLayerDepSelection.layerdetailurl); link.text(currentLayerDepSelection.name); link.tooltip({title: currentLayerDepSelection.tooltip, placement: "right"}); 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 (){ function _addRmLayer(layerObj, add, doneCb){ if (add === true) { /* If adding get the deps for this layer */ - libtoaster.getLayerDepsForProject(layerObj.url, + libtoaster.getLayerDepsForProject(layerObj.layerdetailurl, function (layers) { /* got result for dependencies */ @@ -285,7 +285,7 @@ var libtoaster = (function (){ } alertMsg.children("#layer-affected-name").text(layer.name); - alertMsg.children("#layer-affected-name").attr("href", layer.url); + alertMsg.children("#layer-affected-name").attr("href", layer.layerdetailurl); alertMsg.children("#project-affected-name").text(libtoaster.ctx.projectName); alertMsg.children("#project-affected-name").attr("href", libtoaster.ctx.projectPageUrl); 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): project = Project.objects.get(pk=kwargs['pid']) self.add_column(title="LayerDetailsUrl", displayable = False, - field_name="layerDetailsUrl", + field_name="layerdetailurl", computation = lambda x: reverse('layerdetails', args=(project.id, x.id))) @@ -208,7 +208,10 @@ class LayerDetails(ToasterTemplateView): context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) context['layerdeps'] = {"list": [ - [{"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()]} + [ {"id": y.id, + "name": y.layer.name, + "layerdetailurl": reverse('layerdetails', args=(kwargs['pid'], y.id)), + } for y in x.depends_on.get_equivalents_wpriority(context['project'])][0] for x in context['layerversion'].dependencies.all()]} context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) 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 @@ - - 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 @@ {% else %} inCurrentPrj : false, {% endif %} - url : "{% url 'layerdetails' project.id layerversion.id %}", + layerdetailurl : "{% url 'layerdetails' project.id layerversion.id %}", sourceId: {{layerversion.layer_source_id|json}}, } }; 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 @@ -