summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-09-26 13:59:34 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-30 16:52:22 +0100
commitfbf7e14894f08a803cc3096da6b0143faaa3d43e (patch)
tree8c2d14a2dda20622a320a4e0367e64bc7311daf4 /bitbake/lib
parent44058c45eea28f8f5bc7a787f899671ee603c3b8 (diff)
downloadpoky-fbf7e14894f08a803cc3096da6b0143faaa3d43e.tar.gz
bitbake: toaster: Add front end controls for deleting a build
Add front end modal and controls for deleting a build from the build dashboard. Also convert the Actions list to links instead of buttons as per the design. [YOCTO #6238] (Bitbake rev: 93bca6d877e0b2b5b8ef6b27288c0987a6c899b1) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basebuildpage.html138
-rw-r--r--bitbake/lib/toaster/toastergui/templates/builddashboard.html2
2 files changed, 105 insertions, 35 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
index 01d3117e1e..0b6ef56380 100644
--- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
+++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html
@@ -3,8 +3,88 @@
3{% load project_url_tag %} 3{% load project_url_tag %}
4{% load objects_to_dictionaries_filter %} 4{% load objects_to_dictionaries_filter %}
5{% load humanize %} 5{% load humanize %}
6{% load field_values_filter %}
6{% block pagecontent %} 7{% block pagecontent %}
7 8
9 <script>
10 var configVarUrl = "{% url 'configvars' build.id %}";
11
12 $(document).ready(function(){
13
14 $("#delete-build-confirm").click(function(){
15 libtoaster.disableAjaxLoadingTimer();
16 $(this).find('[data-role="submit-state"]').hide();
17 $(this).find('[data-role="loading-state"]').show();
18 $(this).attr("disabled", "disabled");
19
20 /* Make the modal non cancelable while delete is in progress */
21 $('#delete-build-modal button[data-dismiss="modal"]').hide();
22
23 $.ajax({
24 type: 'DELETE',
25 url: "{% url 'xhr_build' build.id %}",
26 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
27 success: function (data) {
28 if (data.error !== "ok") {
29 console.warn(data.error);
30 } else {
31 window.location.replace(data.gotoUrl);
32 }
33 },
34 error: function (data) {
35 console.warn(data);
36 }
37 });
38 });
39
40
41 $('#breadcrumb > li').append('<span class="divider">&rarr;</span>');
42 $('#breadcrumb > li:last').addClass("active");
43 $('#breadcrumb > li:last > span').remove();
44
45 $("#build-menu li a").each(function(){
46 /* Set the page active state in the Build menu */
47 var currentUrl = window.location.href.split('?')[0];
48 if (currentUrl === $(this).prop("href")){
49 $(this).parent().addClass("active");
50 } else {
51 /* Special case the configvar as this is part of configuration
52 * page but is a separate url
53 */
54 if (window.location.pathname === configVarUrl){
55 $("#menu-configuration").addClass("active");
56 } else {
57 $(this).parent().removeClass("active");
58 }
59 }
60 });
61 });
62 </script>
63
64
65
66<div class="modal fade" tabindex="-1" role="dialog" id="delete-build-modal" style="display: none;" data-backdrop="static" data-keyboard="false">
67 <div class="modal-dialog">
68 <div class="modal-content">
69 <div class="modal-body">
70 <p>Are you sure you want to delete the build <strong>{{build.get_sorted_target_list|field_values:"target"|join:", "}} {{build.machine}}</strong> completed on <strong>{{build.completed_on|date:"d/m/y H:i"}}</strong>?</p>
71 </div>
72 <div class="modal-footer">
73 <button id="delete-build-confirm" class="btn btn-primary btn-large">
74 <span data-role="submit-state">Delete build</span>
75 <span data-role="loading-state" style="display:none">
76 <span class="fa-pulse">
77 <i class="icon-spinner"></i>
78 </span>
79 &nbsp;Deleting build...
80 </span>
81 </button>
82 <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button>
83 </div>
84 </div><!-- /.modal-content -->
85 </div><!-- /.modal-dialog -->
86</div> <!-- / modal -->
87
8<div class="row"> 88<div class="row">
9 <!-- breadcrumbs --> 89 <!-- breadcrumbs -->
10 <div class="col-md-12"> 90 <div class="col-md-12">
@@ -22,36 +102,6 @@
22 </li> 102 </li>
23 {% block localbreadcrumb %}{% endblock %} 103 {% block localbreadcrumb %}{% endblock %}
24 </ul> 104 </ul>
25 <script>
26
27 var configVarUrl = "{% url 'configvars' build.id %}";
28
29 $(document).ready(function(){
30 $('#breadcrumb > li').append('<span class="divider">&rarr;</span>');
31 $('#breadcrumb > li:last').addClass("active");
32 $('#breadcrumb > li:last > span').remove();
33
34 $("#build-menu li a").each(function(){
35 /* Set the page active state in the Build menu */
36 var currentUrl = window.location.href.split('?')[0];
37 if (currentUrl === $(this).prop("href")){
38 $(this).parent().addClass("active");
39 } else {
40 /* Special case the configvar as this is part of configuration
41 * page but is a separate url, and the direct links to errors
42 * and warnings, which are part of the build dashboard
43 */
44 if (window.location.pathname === configVarUrl){
45 $("#menu-configuration").addClass("active");
46 } else if (currentUrl.indexOf('error') > 1 || currentUrl.indexOf('warning') > 1){
47 $("#menu-dashboard").addClass("active");
48 } else {
49 $(this).parent().removeClass("active");
50 }
51 }
52 });
53 });
54 </script>
55 </div> 105 </div>
56</div> 106</div>
57 107
@@ -86,13 +136,22 @@
86 <li><a href="{% url 'cputime' build.pk %}">CPU usage</a></li> 136 <li><a href="{% url 'cputime' build.pk %}">CPU usage</a></li>
87 <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li> 137 <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li>
88 138
89 <li class="nav-header">Actions</li> 139 <li class="nav-header">Actions</li>
90 <a class="btn btn-default btn-block navbar-btn" href="{% url 'build_artifact' build.id 'cookerlog' build.id %}">Download build log</a> 140 <li>
141 <a href="{% url 'build_artifact' build.id 'cookerlog' build.id %}">
142 <span class="glyphicon glyphicon-download-alt"></span>
143 Download build log
144 </a>
145 </li>
91 146
92 {% with build.get_custom_image_recipes as custom_image_recipes %} 147 {% with build.get_custom_image_recipes as custom_image_recipes %}
93 {% if custom_image_recipes.count > 0 %} 148 {% if custom_image_recipes.count > 0 %}
94 <!-- edit custom image built during this build --> 149 <!-- edit custom image built during this build -->
95 <button class="btn btn-default btn-block navbar-btn" data-role="edit-custom-image-trigger">Edit custom image</button> 150 <li>
151 <a href="#" data-role="edit-custom-image-trigger">
152 <span class="glyphicon glyphicon-edit"></span>
153 Edit custom image
154 </a>
96 {% include 'editcustomimage_modal.html' %} 155 {% include 'editcustomimage_modal.html' %}
97 <script> 156 <script>
98 var editableCustomImageRecipes = {{ custom_image_recipes | objects_to_dictionaries:"id,name" | json }}; 157 var editableCustomImageRecipes = {{ custom_image_recipes | objects_to_dictionaries:"id,name" | json }};
@@ -117,12 +176,17 @@
117 }); 176 });
118 }); 177 });
119 </script> 178 </script>
179 </li>
120 {% endif %} 180 {% endif %}
121 {% endwith %} 181 {% endwith %}
122 182
123 <!-- new custom image from image recipe in this build --> 183 <!-- new custom image from image recipe in this build -->
124 {% if build.has_image_recipes %} 184 {% if build.has_image_recipes %}
125 <button class="btn btn-default btn-block navbar-btn" data-role="new-custom-image-trigger">New custom image</button> 185 <li>
186 <a href="#" data-role="new-custom-image-trigger">
187 <span class="glyphicon glyphicon-plus"></span>
188 New custom image
189 </a>
126 {% include 'newcustomimage_modal.html' %} 190 {% include 'newcustomimage_modal.html' %}
127 <script> 191 <script>
128 // imageRecipes includes both custom image recipes and built-in 192 // imageRecipes includes both custom image recipes and built-in
@@ -147,6 +211,12 @@
147 }); 211 });
148 </script> 212 </script>
149 {% endif %} 213 {% endif %}
214
215 <li>
216 <a href="#delete-build-modal" id="delete-build" data-toggle="modal" data-target="#delete-build-modal" class="text-danger">
217 <span class="glyphicon glyphicon-trash"></span>
218 Delete build
219 </a>
150 </ul> 220 </ul>
151 </div> 221 </div>
152 <!-- end left sidebar container --> 222 <!-- end left sidebar container -->
diff --git a/bitbake/lib/toaster/toastergui/templates/builddashboard.html b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
index 1c390cd603..02a29816a6 100644
--- a/bitbake/lib/toaster/toastergui/templates/builddashboard.html
+++ b/bitbake/lib/toaster/toastergui/templates/builddashboard.html
@@ -34,7 +34,7 @@
34 <a href="#warnings" class="show-warnings"> {{build.warnings.count}} warning{{build.warnings.count|pluralize}}</a> 34 <a href="#warnings" class="show-warnings"> {{build.warnings.count}} warning{{build.warnings.count|pluralize}}</a>
35 {% endif %} 35 {% endif %}
36 {% if build.cooker_log_path %} 36 {% if build.cooker_log_path %}
37 <a class="alert-link pull-right log" href="{% url 'build_artifact' build.id "cookerlog" build.id %}">Download build log</a> 37 <a class="pull-right log" href="{% url 'build_artifact' build.id "cookerlog" build.id %}">Download build log</a>
38 {% endif %} 38 {% endif %}
39 <span class="pull-right"> 39 <span class="pull-right">
40 Build time: 40 Build time: