All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] toaster UI fixes
@ 2015-10-09  9:32 Elliot Smith
  2015-10-09  9:32 ` [PATCH 1/5] toaster: layerdetails update build recipe button class name Elliot Smith
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

A number of UI fixes:

* Add/Rm layer button not updated in some cases [YOCTO #8294]
* Updates to the JS unit tests
* A fix for the project layers returned
* Fix a bug noticed in the layer details page where the button class names were
incorrect meaning the toggle of the add/remove layer didn't enable/disable
the buttons to trigger recipe builds.

[YOCTO #8294]

The following changes since commit 06cdf52fec2f46e3e063ec64ee4cba6c79bfebe5:

  toaster: fix naming for clone directory (2015-10-07 15:35:13 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib elliot/submit/michaelw/toaster/table-ui-fixes
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=elliot/submit/michaelw/toaster/table-ui-fixes

Michael Wood (5):
  toaster: layerdetails update build recipe button class name
  toaster: Fix typo in returning pk list of layer versions in current
    project
  toaster: tables Add the recipe filter back into the Recipe table
  toaster: Fix stale layer state buttons
  toaster: Update JS unit tests

 lib/toaster/orm/models.py                          |  2 +-
 lib/toaster/toastergui/static/js/layerBtn.js       |  9 +-----
 lib/toaster/toastergui/static/js/layerdetails.js   |  4 +--
 lib/toaster/toastergui/static/js/table.js          |  2 +-
 lib/toaster/toastergui/static/js/tests/test.js     | 34 +++++++++++-----------
 lib/toaster/toastergui/tables.py                   | 20 +++++++++++--
 .../toastergui/templates/js-unit-tests.html        | 16 +++++++---
 lib/toaster/toastergui/templates/layer_btn.html    | 12 ++++++--
 lib/toaster/toastergui/templates/recipe_btn.html   | 12 ++++++--
 lib/toaster/toastergui/templates/toastertable.html |  1 -
 10 files changed, 71 insertions(+), 41 deletions(-)

--
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] toaster: layerdetails update build recipe button class name
  2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
@ 2015-10-09  9:32 ` Elliot Smith
  2015-10-09  9:32 ` [PATCH 2/5] toaster: Fix typo in returning pk list of layer versions in current project Elliot Smith
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

Update the class name which we are using for the recipe build button.
This fixes a regression in the buttons being enabled/disabled when
adding and removing the layer being viewed from the project.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 lib/toaster/toastergui/static/js/layerdetails.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/layerdetails.js b/lib/toaster/toastergui/static/js/layerdetails.js
index 8817b47..8c2ec4c 100644
--- a/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/lib/toaster/toastergui/static/js/layerdetails.js
@@ -254,7 +254,7 @@ function layerDetailsPageInit (ctx) {
 
     if (added){
       /* enable and switch all the button states */
-      $(".build-target-btn").removeAttr("disabled");
+      $(".build-recipe-btn").removeAttr("disabled");
       $(".select-machine-btn").removeAttr("disabled");
       addRmLayerBtn.addClass("btn-danger");
       addRmLayerBtn.data('directive', "remove");
@@ -263,7 +263,7 @@ function layerDetailsPageInit (ctx) {
 
     } else {
       /* disable and switch all the button states */
-      $(".build-target-btn").attr("disabled","disabled");
+      $(".build-recipe-btn").attr("disabled","disabled");
       $(".select-machine-btn").attr("disabled", "disabled");
       addRmLayerBtn.removeClass("btn-danger");
       addRmLayerBtn.data('directive', "add");
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] toaster: Fix typo in returning pk list of layer versions in current project
  2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
  2015-10-09  9:32 ` [PATCH 1/5] toaster: layerdetails update build recipe button class name Elliot Smith
@ 2015-10-09  9:32 ` Elliot Smith
  2015-10-09  9:32 ` [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table Elliot Smith
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

This was accidentally returning the primary key of the ProjectLayer
rather than the ProjectLayer.Layer_Version.pk

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 lib/toaster/orm/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 375985e..1cbf480 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -222,7 +222,7 @@ class Project(models.Model):
         if pk is False:
             return layer_versions
         else:
-            return layer_versions.values_list('pk', flat=True)
+            return layer_versions.values_list('layercommit__pk', flat=True)
 
 
     def get_available_machines(self):
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table
  2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
  2015-10-09  9:32 ` [PATCH 1/5] toaster: layerdetails update build recipe button class name Elliot Smith
  2015-10-09  9:32 ` [PATCH 2/5] toaster: Fix typo in returning pk list of layer versions in current project Elliot Smith
@ 2015-10-09  9:32 ` Elliot Smith
  2015-10-09  9:32 ` [PATCH 4/5] toaster: Fix stale layer state buttons Elliot Smith
  2015-10-09  9:32 ` [PATCH 5/5] toaster: Update JS unit tests Elliot Smith
  4 siblings, 0 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

Add the "Is recipe currently available in the project" filter back to
the Recipe table which was removed when we had intermediate
AvailableRecipe tables.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 lib/toaster/toastergui/tables.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py
index a676ffa..4f24772 100644
--- a/lib/toaster/toastergui/tables.py
+++ b/lib/toaster/toastergui/tables.py
@@ -335,10 +335,23 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin):
 
         return context
 
+    def setup_filters(self, *args, **kwargs):
+        self.add_filter(title="Filter by project recipes",
+                        name="in_current_project",
+                        filter_actions=[
+                            self.make_filter_action("in_project", "Recipes provided by layers added to this project", self.filter_in_project),
+                            self.make_filter_action("not_in_project", "Recipes provided by layers not added to this project", self.filter_not_in_project)
+                        ])
 
     def setup_queryset(self, *args, **kwargs):
         prj = Project.objects.get(pk = kwargs['pid'])
 
+        # Project layers used by the filters
+        self.project_layers = prj.get_project_layer_versions(pk=True)
+
+        # Project layers used to switch the button states
+        self.static_context_extra['current_layers'] = self.project_layers
+
         self.queryset = prj.get_all_compatible_recipes()
         self.queryset = self.queryset.order_by(self.default_orderby)
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] toaster: Fix stale layer state buttons
  2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
                   ` (2 preceding siblings ...)
  2015-10-09  9:32 ` [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table Elliot Smith
@ 2015-10-09  9:32 ` Elliot Smith
  2015-10-09  9:32 ` [PATCH 5/5] toaster: Update JS unit tests Elliot Smith
  4 siblings, 0 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

Move the "is available to the project" state computation to the template
for the Layer add/remove buttons, Recipe build/Add layer as done for the
Package add/remove. This is more reliable as we can get an inconsistent
state on the front end JS as there are many opportunities for hitting
out of date project information.

[YOCTO #8294]

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 lib/toaster/toastergui/static/js/layerBtn.js       |  9 +--------
 lib/toaster/toastergui/static/js/table.js          |  2 +-
 lib/toaster/toastergui/static/js/tests/test.js     |  2 +-
 lib/toaster/toastergui/tables.py                   |  7 ++++---
 lib/toaster/toastergui/templates/layer_btn.html    | 12 ++++++++++--
 lib/toaster/toastergui/templates/recipe_btn.html   | 12 ++++++++++--
 lib/toaster/toastergui/templates/toastertable.html |  1 -
 7 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/layerBtn.js b/lib/toaster/toastergui/static/js/layerBtn.js
index da0241c..7318b3f 100644
--- a/lib/toaster/toastergui/static/js/layerBtn.js
+++ b/lib/toaster/toastergui/static/js/layerBtn.js
@@ -1,6 +1,6 @@
 "use strict";
 
-function layerBtnsInit(ctx) {
+function layerBtnsInit() {
 
   /* Remove any current bindings to avoid duplicated binds */
   $(".layerbtn").unbind('click');
@@ -80,11 +80,4 @@ function layerBtnsInit(ctx) {
     imgCustomModal.data('recipe', $(this).data('recipe'));
     imgCustomModal.modal('show');
   });
-
-  /* Setup the initial state of the buttons */
-
-  for (var i in ctx.projectLayers){
-      $(".layer-exists-" + ctx.projectLayers[i]).show();
-      $(".layer-add-" + ctx.projectLayers[i]).hide();
-  }
 }
diff --git a/lib/toaster/toastergui/static/js/table.js b/lib/toaster/toastergui/static/js/table.js
index bc81e67..40b5022 100644
--- a/lib/toaster/toastergui/static/js/table.js
+++ b/lib/toaster/toastergui/static/js/table.js
@@ -130,7 +130,7 @@ function tableInit(ctx){
       tableBody.append(row);
 
       /* If we have layerbtns then initialise them */
-      layerBtnsInit(ctx);
+      layerBtnsInit();
 
       /* If we have popovers initialise them now */
       $('td > a.btn').popover({
diff --git a/lib/toaster/toastergui/static/js/tests/test.js b/lib/toaster/toastergui/static/js/tests/test.js
index d610113..f0df6e4 100644
--- a/lib/toaster/toastergui/static/js/tests/test.js
+++ b/lib/toaster/toastergui/static/js/tests/test.js
@@ -152,7 +152,7 @@ QUnit.test("Layer details page init", function(assert){
 });
 
 QUnit.test("Layer btns init", function(assert){
-  assert.throws(layerBtnsInit({ projectLayers : [] }));
+  assert.throws(layerBtnsInit());
 });
 
 QUnit.test("Table init", function(assert){
diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py
index 4f24772..b10445b 100644
--- a/lib/toaster/toastergui/tables.py
+++ b/lib/toaster/toastergui/tables.py
@@ -57,9 +57,7 @@ class LayersTable(ToasterTable):
         context = super(LayersTable, self).get_context_data(**kwargs)
 
         project = Project.objects.get(pk=kwargs['pid'])
-
         context['project'] = project
-        context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=project))
 
         return context
 
@@ -93,7 +91,10 @@ class LayersTable(ToasterTable):
 
     def setup_queryset(self, *args, **kwargs):
         prj = Project.objects.get(pk = kwargs['pid'])
-        compatible_layers = prj.compatible_layerversions()
+        compatible_layers = prj.get_all_compatible_layer_versions()
+
+        self.static_context_extra['current_layers'] = \
+                prj.get_project_layer_versions(pk=True)
 
         self.queryset = compatible_layers.order_by(self.default_orderby)
 
diff --git a/lib/toaster/toastergui/templates/layer_btn.html b/lib/toaster/toastergui/templates/layer_btn.html
index a2e9393..314eec7 100644
--- a/lib/toaster/toastergui/templates/layer_btn.html
+++ b/lib/toaster/toastergui/templates/layer_btn.html
@@ -1,8 +1,16 @@
-<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" >
+<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"
+    {% if data.pk not in extra.current_layers %}
+    style="display:none;"
+    {% endif %}
+  >
   <i class="icon-trash"></i>
   Delete layer
 </button>
-<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">
+<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"
+    {% if data.pk in extra.current_layers %}
+    style="display:none;"
+    {% endif %}
+  >
   <i class="icon-plus"></i>
   Add layer
 </button>
diff --git a/lib/toaster/toastergui/templates/recipe_btn.html b/lib/toaster/toastergui/templates/recipe_btn.html
index 77c1b23..baab06e 100644
--- a/lib/toaster/toastergui/templates/recipe_btn.html
+++ b/lib/toaster/toastergui/templates/recipe_btn.html
@@ -1,7 +1,15 @@
-<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;" >
+<button data-recipe-name="{{data.name}}" class="btn btn-block layer-exists-{{data.layer_version.pk}} build-recipe-btn" style="margin-top: 5px;
+  {% if data.layer_version.pk not in extra.current_layers %}
+    display:none;
+  {% endif %}"
+ >
   Build recipe
 </button>
-<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">
+<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"
+    {% if data.layer_version.pk in extra.current_layers %}
+     style="display:none;"
+    {% endif %}
+>
   <i class="icon-plus"></i>
   Add layer
   <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/lib/toaster/toastergui/templates/toastertable.html b/lib/toaster/toastergui/templates/toastertable.html
index 9ef4c6f..98a715f 100644
--- a/lib/toaster/toastergui/templates/toastertable.html
+++ b/lib/toaster/toastergui/templates/toastertable.html
@@ -12,7 +12,6 @@
       tableName : "{{table_name}}",
       url : "{{ xhr_table_url }}?format=json",
       title : "{{title}}",
-      projectLayers : {{projectlayers|json}},
     };
 
     try {
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] toaster: Update JS unit tests
  2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
                   ` (3 preceding siblings ...)
  2015-10-09  9:32 ` [PATCH 4/5] toaster: Fix stale layer state buttons Elliot Smith
@ 2015-10-09  9:32 ` Elliot Smith
  4 siblings, 0 replies; 7+ messages in thread
From: Elliot Smith @ 2015-10-09  9:32 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

Update JS unit tests.
- Expand the add remove layer check to make sure that the layer is
  actually added to the project.
- Remove some unused vars
- Make sure that the layers/project ids will always exist at the point
  of running the test.
- Add the missing typeahead input fields to the dom to fix the failing
  typeahead test.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 lib/toaster/toastergui/static/js/tests/test.js     | 32 +++++++++++-----------
 .../toastergui/templates/js-unit-tests.html        | 16 ++++++++---
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/tests/test.js b/lib/toaster/toastergui/static/js/tests/test.js
index f0df6e4..aac0ba6 100644
--- a/lib/toaster/toastergui/static/js/tests/test.js
+++ b/lib/toaster/toastergui/static/js/tests/test.js
@@ -13,8 +13,6 @@ QUnit.test("Layer alert notification", function(assert) {
     "name":"meta-example"
   };
 
-  var correctResponse = "You have added <strong>3</strong> layers to your project: <a id=\"layer-affected-name\" href=\"/toastergui/project/1/layer/22\">meta-example</a> and its dependencies <a href=\"/toastergui/project/1/layer/9\" data-original-title=\"\" title=\"\">meta-example-two</a>, <a href=\"/toastergui/project/1/layer/9\" data-original-title=\"\" title=\"\">meta-example-three</a>";
-
   var layerDepsList = [
     {
     "layerdetailurl":"/toastergui/project/1/layer/9",
@@ -68,9 +66,9 @@ QUnit.test("Show notification", function(assert){
 });
 
 var layer = {
-  "id": 91,
-  "name":  "meta-crystalforest",
-  "layerdetailurl": "/toastergui/project/4/layer/91"
+  "id": 1,
+  "name":  "meta-testing",
+  "layerdetailurl": "/toastergui/project/1/layer/1"
 };
 
 QUnit.test("Add layer", function(assert){
@@ -84,11 +82,19 @@ QUnit.test("Add layer", function(assert){
     }
   }, 200);
 
-  libtoaster.addRmLayer(layer, true, function(deps){
-    assert.equal(deps.length, 1);
-    done();
+  /* Compare the number of layers before and after the add in the project */
+  libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl, function(prjInfo){
+    var origNumLayers = prjInfo.layers.length;
+
+    libtoaster.addRmLayer(layer, true, function(deps){
+      libtoaster.getProjectInfo(libtoaster.ctx.projectPageUrl,
+        function(prjInfo){
+        assert.ok(prjInfo.layers.length > origNumLayers,
+          "Layer not added to project");
+        done();
+      });
+    });
   });
-
 });
 
 QUnit.test("Rm layer", function(assert){
@@ -156,7 +162,7 @@ QUnit.test("Layer btns init", function(assert){
 });
 
 QUnit.test("Table init", function(assert){
-  assert.throws(tableInit({ url : tableUrl }));
+  assert.throws(tableInit({ url : ctx.tableUrl }));
 });
 
 $(document).ajaxError(function(event, jqxhr, settings, errMsg){
@@ -167,9 +173,3 @@ $(document).ajaxError(function(event, jqxhr, settings, errMsg){
     assert.notOk(jqxhr.responseText);
   });
 });
-
-
-
-
-
-
diff --git a/lib/toaster/toastergui/templates/js-unit-tests.html b/lib/toaster/toastergui/templates/js-unit-tests.html
index 5b8fd84..8d65f33 100644
--- a/lib/toaster/toastergui/templates/js-unit-tests.html
+++ b/lib/toaster/toastergui/templates/js-unit-tests.html
@@ -22,9 +22,11 @@
 <script src="{% static 'js/table.js' %}"></script>
 
 <script>
-  var tableUrl = '{% url 'projectlayers' project.pk %}';
+  var ctx = {
+    tableUrl : '{% url 'projectlayers' project.pk %}',
+    projectId : {{project.pk}},
+  }
 </script>
-
 <script src="{% static 'js/tests/test.js' %}"></script>
 
 <div id="qunit"></div>
@@ -34,6 +36,12 @@
 <input type="text" id="projects" placeholder="projects"></input>
 <input type="text" id="machines" placeholder="machines"></input>
 
-{% endblock %}
-
+<!-- import layer dependency input typeahead -->
+<input type="text" id="layer-dependency" style="display:none"></input>
+<!-- project page input typeaheads -->
+<input type="text" id="layer-add-input" style="display:none"></input>
+<input type="text" id="machine-change-input" style="display:none"></input>
+<!-- import layer dependency input typeahead on layer details edit layer -->
+<input type="text" id="layer-dep-input" style="display:none"></input>
 
+{% endblock %}
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table
  2015-10-08 18:32 [PATCH 0/5] UI fixes michaelw/toaster/table-ui-fixes Michael Wood
@ 2015-10-08 18:32 ` Michael Wood
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Wood @ 2015-10-08 18:32 UTC (permalink / raw)
  To: toaster

Add the "Is recipe currently available in the project" filter back to
the Recipe table which was removed when we had intermediate
AvailableRecipe tables.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
 bitbake/lib/toaster/toastergui/tables.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py
index a676ffa..4f24772 100644
--- a/bitbake/lib/toaster/toastergui/tables.py
+++ b/bitbake/lib/toaster/toastergui/tables.py
@@ -335,10 +335,23 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin):
 
         return context
 
+    def setup_filters(self, *args, **kwargs):
+        self.add_filter(title="Filter by project recipes",
+                        name="in_current_project",
+                        filter_actions=[
+                            self.make_filter_action("in_project", "Recipes provided by layers added to this project", self.filter_in_project),
+                            self.make_filter_action("not_in_project", "Recipes provided by layers not added to this project", self.filter_not_in_project)
+                        ])
 
     def setup_queryset(self, *args, **kwargs):
         prj = Project.objects.get(pk = kwargs['pid'])
 
+        # Project layers used by the filters
+        self.project_layers = prj.get_project_layer_versions(pk=True)
+
+        # Project layers used to switch the button states
+        self.static_context_extra['current_layers'] = self.project_layers
+
         self.queryset = prj.get_all_compatible_recipes()
         self.queryset = self.queryset.order_by(self.default_orderby)
 
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-09  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09  9:32 [PATCH 0/5] toaster UI fixes Elliot Smith
2015-10-09  9:32 ` [PATCH 1/5] toaster: layerdetails update build recipe button class name Elliot Smith
2015-10-09  9:32 ` [PATCH 2/5] toaster: Fix typo in returning pk list of layer versions in current project Elliot Smith
2015-10-09  9:32 ` [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table Elliot Smith
2015-10-09  9:32 ` [PATCH 4/5] toaster: Fix stale layer state buttons Elliot Smith
2015-10-09  9:32 ` [PATCH 5/5] toaster: Update JS unit tests Elliot Smith
  -- strict thread matches above, loose matches on Subject: below --
2015-10-08 18:32 [PATCH 0/5] UI fixes michaelw/toaster/table-ui-fixes Michael Wood
2015-10-08 18:32 ` [PATCH 3/5] toaster: tables Add the recipe filter back into the Recipe table Michael Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.