summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
diff options
context:
space:
mode:
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 });