diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-04-19 17:28:45 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-19 21:11:26 +0100 |
commit | a40a3e6defefd69521a417a366b8752be7e778f9 (patch) | |
tree | aa23613673cd30831cdf8482aa03d3de97a54e7c /bitbake/lib/toaster/toastergui/templates/basebuildpage.html | |
parent | e65c9808e9bb85ffd2b668bade4b8a50e470d050 (diff) | |
download | poky-a40a3e6defefd69521a417a366b8752be7e778f9.tar.gz |
bitbake: toaster: add build dashboard buttons to edit/create custom images
When a build is viewed in the dashboard, enable users to edit
a custom image which was built during that build, and/or create
a new custom image based on one of the image recipes built during
the build.
Add methods to the Build model to enable querying for the
set of image recipes built during a build.
Add buttons to the dashboard, with the "Edit custom image"
button opening a basic modal for now. The "New custom image"
button opens the existing new custom image modal, but is modified
to show a list of images available as a base for a new custom image.
Add a new function to the new custom image modal's script which
enables multiple potential custom images to be shown as radio
buttons in the dialog (if there is more than 1). Modify existing
code to use this new function.
Add a template filter which allows the queryset of recipes for
a build to be available to client-side scripts, and from there
be used to populate the new custom image modal.
[YOCTO #9123]
(Bitbake rev: 4c49ffd28e41c4597bdac34d5e54c125571a4b95)
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.html | 207 |
1 files changed, 133 insertions, 74 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html index ff9433eee7..4a8e2a7abd 100644 --- a/bitbake/lib/toaster/toastergui/templates/basebuildpage.html +++ b/bitbake/lib/toaster/toastergui/templates/basebuildpage.html | |||
@@ -1,90 +1,149 @@ | |||
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 humanize %} | 5 | {% load humanize %} |
5 | {% block pagecontent %} | 6 | {% block pagecontent %} |
7 | <!-- breadcrumbs --> | ||
8 | <div class="section"> | ||
9 | <ul class="breadcrumb" id="breadcrumb"> | ||
10 | <li><a href="{% project_url build.project %}">{{build.project.name}}</a></li> | ||
11 | {% if not build.project.is_default %} | ||
12 | <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> | ||
13 | {% endif %} | ||
14 | <li> | ||
15 | {% block parentbreadcrumb %} | ||
16 | <a href="{%url 'builddashboard' build.pk%}"> | ||
17 | {{build.get_sorted_target_list.0.target}} {% if build.target_set.all.count > 1 %}(+{{build.target_set.all.count|add:"-1"}}){% endif %} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}}) | ||
18 | </a> | ||
19 | {% endblock %} | ||
20 | </li> | ||
21 | {% block localbreadcrumb %}{% endblock %} | ||
22 | </ul> | ||
23 | <script> | ||
24 | $( function () { | ||
25 | $('#breadcrumb > li').append('<span class="divider">→</span>'); | ||
26 | $('#breadcrumb > li:last').addClass("active"); | ||
27 | $('#breadcrumb > li:last > span').remove(); | ||
28 | }); | ||
29 | </script> | ||
30 | </div> | ||
31 | |||
32 | <div class="row-fluid"> | ||
33 | <!-- begin left sidebar container --> | ||
34 | <div id="nav" class="span2"> | ||
35 | <ul class="nav nav-list well"> | ||
36 | <li | ||
37 | {% if request.resolver_match.url_name == 'builddashboard' %} | ||
38 | class="active" | ||
39 | {% endif %} > | ||
40 | <a class="nav-parent" href="{% url 'builddashboard' build.pk %}">Build summary</a> | ||
41 | </li> | ||
42 | {% if build.target_set.all.0.is_image and build.outcome == 0 %} | ||
43 | <li class="nav-header">Images</li> | ||
44 | {% block nav-target %} | ||
45 | {% for t in build.get_sorted_target_list %} | ||
46 | <li><a href="{% url 'target' build.pk t.pk %}">{{t.target}}</a><li> | ||
47 | {% endfor %} | ||
48 | {% endblock %} | ||
49 | {% endif %} | ||
50 | <li class="nav-header">Build</li> | ||
51 | {% block nav-configuration %} | ||
52 | <li><a href="{% url 'configuration' build.pk %}">Configuration</a></li> | ||
53 | {% endblock %} | ||
54 | {% block nav-tasks %} | ||
55 | <li><a href="{% url 'tasks' build.pk %}">Tasks</a></li> | ||
56 | {% endblock %} | ||
57 | {% block nav-recipes %} | ||
58 | <li><a href="{% url 'recipes' build.pk %}">Recipes</a></li> | ||
59 | {% endblock %} | ||
60 | {% block nav-packages %} | ||
61 | <li><a href="{% url 'packages' build.pk %}">Packages</a></li> | ||
62 | {% endblock %} | ||
63 | <li class="nav-header">Performance</li> | ||
64 | {% block nav-buildtime %} | ||
65 | <li><a href="{% url 'buildtime' build.pk %}">Time</a></li> | ||
66 | {% endblock %} | ||
67 | {% block nav-cputime %} | ||
68 | <li><a href="{% url 'cputime' build.pk %}">CPU usage</a></li> | ||
69 | {% endblock %} | ||
70 | {% block nav-diskio %} | ||
71 | <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li> | ||
72 | {% endblock %} | ||
6 | 73 | ||
74 | <li class="divider"></li> | ||
7 | 75 | ||
8 | <div class=""> | 76 | <li> |
9 | <!-- Breadcrumbs --> | 77 | <p class="navbar-btn"> |
10 | <div class="section"> | 78 | <a class="btn btn-block" href="{% url 'build_artifact' build.id 'cookerlog' build.id %}"> |
11 | <ul class="breadcrumb" id="breadcrumb"> | 79 | Download build log |
12 | <li><a href="{% project_url build.project %}">{{build.project.name}}</a></li> | ||
13 | {% if not build.project.is_default %} | ||
14 | <li><a href="{% url 'projectbuilds' build.project.id %}">Builds</a></li> | ||
15 | {% endif %} | ||
16 | <li> | ||
17 | {% block parentbreadcrumb %} | ||
18 | <a href="{%url 'builddashboard' build.pk%}"> | ||
19 | {{build.get_sorted_target_list.0.target}} {%if build.target_set.all.count > 1%}(+{{build.target_set.all.count|add:"-1"}}){%endif%} {{build.machine}} ({{build.completed_on|date:"d/m/y H:i"}}) | ||
20 | </a> | 80 | </a> |
21 | {% endblock %} | 81 | </p> |
22 | </li> | 82 | </li> |
23 | {% block localbreadcrumb %}{% endblock %} | ||
24 | </ul> | ||
25 | <script> | ||
26 | $( function () { | ||
27 | $('#breadcrumb > li').append('<span class="divider">→</span>'); | ||
28 | $('#breadcrumb > li:last').addClass("active"); | ||
29 | $('#breadcrumb > li:last > span').remove(); | ||
30 | }); | ||
31 | </script> | ||
32 | </div> | ||
33 | 83 | ||
34 | <div class="row-fluid"> | 84 | <li> |
85 | <!-- edit custom image built during this build --> | ||
86 | <p class="navbar-btn" data-role="edit-custom-image-trigger"> | ||
87 | <button class="btn btn-block">Edit custom image</button> | ||
88 | </p> | ||
89 | {% include 'editcustomimage_modal.html' %} | ||
90 | <script> | ||
91 | $(document).ready(function () { | ||
92 | var editableCustomImageRecipes = {{ build.get_custom_image_recipes | queryset_to_list:"id,name" | json }}; | ||
35 | 93 | ||
36 | <!-- begin left sidebar container --> | 94 | // edit custom image which was built during this build |
37 | <div id="nav" class="span2"> | 95 | var editCustomImageModal = $('#edit-custom-image-modal'); |
38 | <ul class="nav nav-list well"> | 96 | var editCustomImageTrigger = $('[data-role="edit-custom-image-trigger"]'); |
39 | <li | ||
40 | {% if request.resolver_match.url_name == 'builddashboard' %} | ||
41 | class="active" | ||
42 | {% endif %} > | ||
43 | <a class="nav-parent" href="{% url 'builddashboard' build.pk %}">Build summary</a> | ||
44 | </li> | ||
45 | {% if build.target_set.all.0.is_image and build.outcome == 0 %} | ||
46 | <li class="nav-header">Images</li> | ||
47 | {% block nav-target %} | ||
48 | {% for t in build.get_sorted_target_list %} | ||
49 | <li><a href="{% url 'target' build.pk t.pk %}">{{t.target}}</a><li> | ||
50 | {% endfor %} | ||
51 | {% endblock %} | ||
52 | {% endif %} | ||
53 | <li class="nav-header">Build</li> | ||
54 | {% block nav-configuration %} | ||
55 | <li><a href="{% url 'configuration' build.pk %}">Configuration</a></li> | ||
56 | {% endblock %} | ||
57 | {% block nav-tasks %} | ||
58 | <li><a href="{% url 'tasks' build.pk %}">Tasks</a></li> | ||
59 | {% endblock %} | ||
60 | {% block nav-recipes %} | ||
61 | <li><a href="{% url 'recipes' build.pk %}">Recipes</a></li> | ||
62 | {% endblock %} | ||
63 | {% block nav-packages %} | ||
64 | <li><a href="{% url 'packages' build.pk %}">Packages</a></li> | ||
65 | {% endblock %} | ||
66 | <li class="nav-header">Performance</li> | ||
67 | {% block nav-buildtime %} | ||
68 | <li><a href="{% url 'buildtime' build.pk %}">Time</a></li> | ||
69 | {% endblock %} | ||
70 | {% block nav-cputime %} | ||
71 | <li><a href="{% url 'cputime' build.pk %}">CPU time</a></li> | ||
72 | {% endblock %} | ||
73 | {% block nav-diskio %} | ||
74 | <li><a href="{% url 'diskio' build.pk %}">Disk I/O</a></li> | ||
75 | {% endblock %} | ||
76 | </ul> | ||
77 | </div> | ||
78 | <!-- end left sidebar container --> | ||
79 | 97 | ||
80 | <!-- Begin right container --> | 98 | editCustomImageTrigger.click(function () { |
81 | {% block buildinfomain %}{% endblock %} | 99 | // if there is a single editable custom image, go direct to the edit |
82 | <!-- End right container --> | 100 | // page for it; if there are multiple editable custom images, show |
101 | // dialog to select one of them for editing | ||
83 | 102 | ||
103 | // single editable custom image | ||
84 | 104 | ||
85 | </div> | 105 | // multiple editable custom images |
86 | </div> | 106 | editCustomImageModal.modal('show'); |
107 | }); | ||
108 | }); | ||
109 | </script> | ||
110 | </li> | ||
87 | 111 | ||
112 | <li> | ||
113 | <!-- new custom image from image recipe in this build --> | ||
114 | <p class="navbar-btn" data-role="new-custom-image-trigger"> | ||
115 | <button class="btn btn-block">New custom image</button> | ||
116 | </p> | ||
117 | {% include 'newcustomimage_modal.html' %} | ||
118 | <script> | ||
119 | // imageRecipes includes both custom image recipes and built-in | ||
120 | // image recipes, any of which can be used as the basis for a | ||
121 | // new custom image | ||
122 | var imageRecipes = {{ build.get_image_recipes | queryset_to_list:"id,name" | json }}; | ||
88 | 123 | ||
89 | {% endblock %} | 124 | $(document).ready(function () { |
125 | var newCustomImageModal = $('#new-custom-image-modal'); | ||
126 | var newCustomImageTrigger = $('[data-role="new-custom-image-trigger"]'); | ||
90 | 127 | ||
128 | // show create new custom image modal to select an image built | ||
129 | // during this build as the basis for the custom recipe | ||
130 | newCustomImageTrigger.click(function () { | ||
131 | if (!imageRecipes.length) { | ||
132 | return; | ||
133 | } | ||
134 | newCustomImageModalSetRecipes(imageRecipes); | ||
135 | newCustomImageModal.modal('show'); | ||
136 | }); | ||
137 | }); | ||
138 | </script> | ||
139 | </li> | ||
140 | </ul> | ||
141 | |||
142 | </div> | ||
143 | <!-- end left sidebar container --> | ||
144 | |||
145 | <!-- begin right container --> | ||
146 | {% block buildinfomain %}{% endblock %} | ||
147 | <!-- end right container --> | ||
148 | </div> | ||
149 | {% endblock %} | ||