summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerBtn.js9
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/table.js2
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/tests/test.js2
-rw-r--r--bitbake/lib/toaster/toastergui/tables.py7
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layer_btn.html12
-rw-r--r--bitbake/lib/toaster/toastergui/templates/recipe_btn.html12
-rw-r--r--bitbake/lib/toaster/toastergui/templates/toastertable.html1
7 files changed, 27 insertions, 18 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerBtn.js b/bitbake/lib/toaster/toastergui/static/js/layerBtn.js
index da0241c62b..7318b3f50e 100644
--- a/bitbake/lib/toaster/toastergui/static/js/layerBtn.js
+++ b/bitbake/lib/toaster/toastergui/static/js/layerBtn.js
@@ -1,6 +1,6 @@
1"use strict"; 1"use strict";
2 2
3function layerBtnsInit(ctx) { 3function layerBtnsInit() {
4 4
5 /* Remove any current bindings to avoid duplicated binds */ 5 /* Remove any current bindings to avoid duplicated binds */
6 $(".layerbtn").unbind('click'); 6 $(".layerbtn").unbind('click');
@@ -80,11 +80,4 @@ function layerBtnsInit(ctx) {
80 imgCustomModal.data('recipe', $(this).data('recipe')); 80 imgCustomModal.data('recipe', $(this).data('recipe'));
81 imgCustomModal.modal('show'); 81 imgCustomModal.modal('show');
82 }); 82 });
83
84 /* Setup the initial state of the buttons */
85
86 for (var i in ctx.projectLayers){
87 $(".layer-exists-" + ctx.projectLayers[i]).show();
88 $(".layer-add-" + ctx.projectLayers[i]).hide();
89 }
90} 83}
diff --git a/bitbake/lib/toaster/toastergui/static/js/table.js b/bitbake/lib/toaster/toastergui/static/js/table.js
index bc81e67a6a..40b5022deb 100644
--- a/bitbake/lib/toaster/toastergui/static/js/table.js
+++ b/bitbake/lib/toaster/toastergui/static/js/table.js
@@ -130,7 +130,7 @@ function tableInit(ctx){
130 tableBody.append(row); 130 tableBody.append(row);
131 131
132 /* If we have layerbtns then initialise them */ 132 /* If we have layerbtns then initialise them */
133 layerBtnsInit(ctx); 133 layerBtnsInit();
134 134
135 /* If we have popovers initialise them now */ 135 /* If we have popovers initialise them now */
136 $('td > a.btn').popover({ 136 $('td > a.btn').popover({
diff --git a/bitbake/lib/toaster/toastergui/static/js/tests/test.js b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
index d610113029..f0df6e4ac1 100644
--- a/bitbake/lib/toaster/toastergui/static/js/tests/test.js
+++ b/bitbake/lib/toaster/toastergui/static/js/tests/test.js
@@ -152,7 +152,7 @@ QUnit.test("Layer details page init", function(assert){
152}); 152});
153 153
154QUnit.test("Layer btns init", function(assert){ 154QUnit.test("Layer btns init", function(assert){
155 assert.throws(layerBtnsInit({ projectLayers : [] })); 155 assert.throws(layerBtnsInit());
156}); 156});
157 157
158QUnit.test("Table init", function(assert){ 158QUnit.test("Table init", function(assert){
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index 4f24772206..b10445b00f 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -57,9 +57,7 @@ class LayersTable(ToasterTable):
57 context = super(LayersTable, self).get_context_data(**kwargs) 57 context = super(LayersTable, self).get_context_data(**kwargs)
58 58
59 project = Project.objects.get(pk=kwargs['pid']) 59 project = Project.objects.get(pk=kwargs['pid'])
60
61 context['project'] = project 60 context['project'] = project
62 context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
63 61
64 return context 62 return context
65 63
@@ -93,7 +91,10 @@ class LayersTable(ToasterTable):
93 91
94 def setup_queryset(self, *args, **kwargs): 92 def setup_queryset(self, *args, **kwargs):
95 prj = Project.objects.get(pk = kwargs['pid']) 93 prj = Project.objects.get(pk = kwargs['pid'])
96 compatible_layers = prj.compatible_layerversions() 94 compatible_layers = prj.get_all_compatible_layer_versions()
95
96 self.static_context_extra['current_layers'] = \
97 prj.get_project_layer_versions(pk=True)
97 98
98 self.queryset = compatible_layers.order_by(self.default_orderby) 99 self.queryset = compatible_layers.order_by(self.default_orderby)
99 100
diff --git a/bitbake/lib/toaster/toastergui/templates/layer_btn.html b/bitbake/lib/toaster/toastergui/templates/layer_btn.html
index a2e93934de..314eec7cf2 100644
--- a/bitbake/lib/toaster/toastergui/templates/layer_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/layer_btn.html
@@ -1,8 +1,16 @@
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" > 1<button class="btn btn-danger btn-block layer-exists-{{data.pk}} layerbtn" data-layer='{ "id": {{data.pk}}, "name": "{{data.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.pk%}"}' data-directive="remove"
2 {% if data.pk not in extra.current_layers %}
3 style="display:none;"
4 {% endif %}
5 >
2 <i class="icon-trash"></i> 6 <i class="icon-trash"></i>
3 Delete layer 7 Delete layer
4</button> 8</button>
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"> 9<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"
10 {% if data.pk in extra.current_layers %}
11 style="display:none;"
12 {% endif %}
13 >
6 <i class="icon-plus"></i> 14 <i class="icon-plus"></i>
7 Add layer 15 Add layer
8</button> 16</button>
diff --git a/bitbake/lib/toaster/toastergui/templates/recipe_btn.html b/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
index 77c1b235b9..baab06eb52 100644
--- a/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/recipe_btn.html
@@ -1,7 +1,15 @@
1<button data-recipe-name="{{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}} build-recipe-btn" style="display:none; margin-top: 5px;" > 1<button data-recipe-name="{{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}} build-recipe-btn" style="margin-top: 5px;
2 {% if data.layer_version.pk not in extra.current_layers %}
3 display:none;
4 {% endif %}"
5 >
2 Build recipe 6 Build recipe
3</button> 7</button>
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"> 8<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"
9 {% if data.layer_version.pk in extra.current_layers %}
10 style="display:none;"
11 {% endif %}
12>
5 <i class="icon-plus"></i> 13 <i class="icon-plus"></i>
6 Add layer 14 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> 15 <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/templates/toastertable.html b/bitbake/lib/toaster/toastergui/templates/toastertable.html
index 9ef4c6ffee..98a715f27d 100644
--- a/bitbake/lib/toaster/toastergui/templates/toastertable.html
+++ b/bitbake/lib/toaster/toastergui/templates/toastertable.html
@@ -12,7 +12,6 @@
12 tableName : "{{table_name}}", 12 tableName : "{{table_name}}",
13 url : "{{ xhr_table_url }}?format=json", 13 url : "{{ xhr_table_url }}?format=json",
14 title : "{{title}}", 14 title : "{{title}}",
15 projectLayers : {{projectlayers|json}},
16 }; 15 };
17 16
18 try { 17 try {