summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-04-19 17:28:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-04-19 21:11:26 +0100
commit1cf8f215b3543ce0f39ebd3321d58cfb518f1c1f (patch)
treeac2ec1be24db0eb3f845d53cfa7ce6c18c36ab70 /bitbake/lib/toaster/toastergui/templates/basebuildpage.html
parenta40a3e6defefd69521a417a366b8752be7e778f9 (diff)
downloadpoky-1cf8f215b3543ce0f39ebd3321d58cfb518f1c1f.tar.gz
bitbake: toaster: add modal to select custom image for editing
Add functionality to the placeholder button on the build dashboard to open a modal dialog displaying editable custom images, in cases where multiple custom images were built by the build. Where there is only one editable custom image, go direct to its edit page. The images shown in the modal are custom recipes for the project which were built during the build shown in the dashboard. This also affects the new custom image dialog, as that also has to show custom image recipes as well as image recipes built during the build. Modify the API on the Build object to support both. Also modify and rename the queryset_to_list template filter so that it can deal with lists as well as querysets, as the new custom image modal has to show a list of image recipes which is an amalgam of two querysets. [YOCTO #9123] (Bitbake rev: 8c2aea3fa8e1071de60390e86e2536904fa9b7c0) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/basebuildpage.html')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basebuildpage.html62
1 files changed, 35 insertions, 27 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
index 4a8e2a7abd..0d8c8820da 100644
--- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
+++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
@@ -1,7 +1,7 @@
1{% extends "base.html" %} 1{% extends "base.html" %}
2{% load projecttags %} 2{% load projecttags %}
3{% load project_url_tag %} 3{% load project_url_tag %}
4{% load queryset_to_list_filter %} 4{% load objects_to_dictionaries_filter %}
5{% load humanize %} 5{% load humanize %}
6{% block pagecontent %} 6{% block pagecontent %}
7 <!-- breadcrumbs --> 7 <!-- breadcrumbs -->
@@ -81,33 +81,40 @@
81 </p> 81 </p>
82 </li> 82 </li>
83 83
84 <li> 84 {% with build.get_custom_image_recipes as custom_image_recipes %}
85 <!-- edit custom image built during this build --> 85 {% if custom_image_recipes.count > 0 %}
86 <p class="navbar-btn" data-role="edit-custom-image-trigger"> 86 <!-- edit custom image built during this build -->
87 <button class="btn btn-block">Edit custom image</button> 87 <li>
88 </p> 88 <p class="navbar-btn" data-role="edit-custom-image-trigger">
89 {% include 'editcustomimage_modal.html' %} 89 <button class="btn btn-block">Edit custom image</button>
90 <script> 90 {% include 'editcustomimage_modal.html' %}
91 $(document).ready(function () { 91 <script>
92 var editableCustomImageRecipes = {{ build.get_custom_image_recipes | queryset_to_list:"id,name" | json }}; 92 var editableCustomImageRecipes = {{ custom_image_recipes | objects_to_dictionaries:"id,name" | json }};
93
94 // edit custom image which was built during this build
95 var editCustomImageModal = $('#edit-custom-image-modal');
96 var editCustomImageTrigger = $('[data-role="edit-custom-image-trigger"]');
97 93
98 editCustomImageTrigger.click(function () { 94 $(document).ready(function () {
99 // if there is a single editable custom image, go direct to the edit 95 var editCustomImageTrigger = $('[data-role="edit-custom-image-trigger"]');
100 // page for it; if there are multiple editable custom images, show 96 var editCustomImageModal = $('#edit-custom-image-modal');
101 // dialog to select one of them for editing
102 97
103 // single editable custom image 98 // edit custom image which was built during this build
104 99 editCustomImageTrigger.click(function () {
105 // multiple editable custom images 100 // single editable custom image: redirect to the edit page
106 editCustomImageModal.modal('show'); 101 // for that image
107 }); 102 if (editableCustomImageRecipes.length === 1) {
108 }); 103 var url = '{% url "customrecipe" build.project.id custom_image_recipes.first.id %}';
109 </script> 104 document.location.href = url;
110 </li> 105 }
106 // multiple editable custom images: show modal to select
107 // one of them for editing
108 else {
109 editCustomImageModal.modal('show');
110 }
111 });
112 });
113 </script>
114 </p>
115 </li>
116 {% endif %}
117 {% endwith %}
111 118
112 <li> 119 <li>
113 <!-- new custom image from image recipe in this build --> 120 <!-- new custom image from image recipe in this build -->
@@ -119,7 +126,7 @@
119 // imageRecipes includes both custom image recipes and built-in 126 // imageRecipes includes both custom image recipes and built-in
120 // image recipes, any of which can be used as the basis for a 127 // image recipes, any of which can be used as the basis for a
121 // new custom image 128 // new custom image
122 var imageRecipes = {{ build.get_image_recipes | queryset_to_list:"id,name" | json }}; 129 var imageRecipes = {{ build.get_image_recipes | objects_to_dictionaries:"id,name" | json }};
123 130
124 $(document).ready(function () { 131 $(document).ready(function () {
125 var newCustomImageModal = $('#new-custom-image-modal'); 132 var newCustomImageModal = $('#new-custom-image-modal');
@@ -131,6 +138,7 @@
131 if (!imageRecipes.length) { 138 if (!imageRecipes.length) {
132 return; 139 return;
133 } 140 }
141
134 newCustomImageModalSetRecipes(imageRecipes); 142 newCustomImageModalSetRecipes(imageRecipes);
135 newCustomImageModal.modal('show'); 143 newCustomImageModal.modal('show');
136 }); 144 });