summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-11-04 15:37:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:17 +0000
commit2a3dd32d669f4d114fe9c978c9fc1269c2566b8a (patch)
tree0ed51b92443a32d7a399ce322cdf3293cc544c0a
parentd6e7e4ad43471fdaa1b6184bd13c91069478839e (diff)
downloadpoky-2a3dd32d669f4d114fe9c978c9fc1269c2566b8a.tar.gz
bitbake: toaster: Continue front end features to custom image recipe page.
Continuation of the work on the custom image recipe page, this brings in: - Basic notification of having added/removed a package. - Connect up Build button - Download recipe feature - No packages states - Project bread crumb - Display additional recipe metadata - Update accessors for recipe object inheritance changes [YOCTO #8082] (Bitbake rev: a656756a9255ec5882686ce9563d17f2eb3136e3) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/customrecipe.js34
-rw-r--r--bitbake/lib/toaster/toastergui/templates/customrecipe.html146
-rw-r--r--bitbake/lib/toaster/toastergui/templates/pkg_add_rm_btn.html4
3 files changed, 114 insertions, 70 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
index 4f6b304dd6..4cd9382b49 100644
--- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
+++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js
@@ -3,6 +3,7 @@
3function customRecipePageInit(ctx) { 3function customRecipePageInit(ctx) {
4 4
5 var urlParams = libtoaster.parseUrlParams(); 5 var urlParams = libtoaster.parseUrlParams();
6 var customiseTable = $("#selectpackagestable");
6 7
7 (function notificationRequest(){ 8 (function notificationRequest(){
8 if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){ 9 if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new'){
@@ -10,7 +11,7 @@ function customRecipePageInit(ctx) {
10 } 11 }
11 })(); 12 })();
12 13
13 $("#recipeselection").on('table-done', function(e, total, tableParams){ 14 customiseTable.on('table-done', function(e, total, tableParams){
14 /* Table is done so now setup the click handler for the package buttons */ 15 /* Table is done so now setup the click handler for the package buttons */
15 $(".add-rm-package-btn").click(function(e){ 16 $(".add-rm-package-btn").click(function(e){
16 e.preventDefault(); 17 e.preventDefault();
@@ -21,30 +22,45 @@ function customRecipePageInit(ctx) {
21 function addRemovePackage(pkgBtn, tableParams){ 22 function addRemovePackage(pkgBtn, tableParams){
22 var pkgBtnData = pkgBtn.data(); 23 var pkgBtnData = pkgBtn.data();
23 var method; 24 var method;
24 var buttonToShow; 25 var msg = "You have ";
25 26
26 if (pkgBtnData.directive == 'add') { 27 if (pkgBtnData.directive == 'add') {
27 method = 'PUT'; 28 method = 'PUT';
28 buttonToShow = '#package-rm-btn-' + pkgBtnData.package; 29 msg += "added 1 package to "+ctx.recipe.name+":";
29 } else if (pkgBtnData.directive == 'remove') { 30 } else if (pkgBtnData.directive == 'remove') {
30 method = 'DELETE'; 31 method = 'DELETE';
31 buttonToShow = '#package-add-btn-' + pkgBtnData.package; 32 msg += "removed 1 package from "+ctx.recipe.name+":";
32 } else { 33 } else {
33 throw("Unknown package directive: should be add or remove"); 34 throw("Unknown package directive: should be add or remove");
34 } 35 }
35 36
37 msg += ' <strong>' + pkgBtnData.name + '<strong>';
38
36 $.ajax({ 39 $.ajax({
37 type: method, 40 type: method,
38 url: pkgBtnData.packageUrl, 41 url: pkgBtnData.packageUrl,
39 headers: { 'X-CSRFToken' : $.cookie('csrftoken')}, 42 headers: { 'X-CSRFToken' : $.cookie('csrftoken')},
40 success: function(data){ 43 success: function(data){
41 /* Invalidate the Add | Rm package table's current cache */ 44 if (data.error !== 'ok'){
45 console.warn(data.error);
46 return;
47 }
48 /* Reload and Invalidate the Add | Rm package table's current data */
42 tableParams.nocache = true; 49 tableParams.nocache = true;
43 $.get(ctx.tableApiUrl, tableParams); 50 customiseTable.trigger('reload', [tableParams]);
44 /* Swap the buttons around */ 51
45 pkgBtn.hide(); 52 libtoaster.showChangeNotification(msg);
46 $(buttonToShow).show();
47 } 53 }
48 }); 54 });
49 } 55 }
56
57 /* Trigger a build of your custom image */
58 $(".build-custom-image").click(function(){
59 libtoaster.startABuild(libtoaster.ctx.projectBuildsUrl,
60 libtoaster.ctx.projectId,
61 ctx.recipe.name,
62 function(){
63 window.location.replace(libtoaster.ctx.projectBuildsUrl);
64 });
65 });
50} 66}
diff --git a/bitbake/lib/toaster/toastergui/templates/customrecipe.html b/bitbake/lib/toaster/toastergui/templates/customrecipe.html
index 823bbd8a1e..2f3aee3686 100644
--- a/bitbake/lib/toaster/toastergui/templates/customrecipe.html
+++ b/bitbake/lib/toaster/toastergui/templates/customrecipe.html
@@ -4,13 +4,29 @@
4{% load static %} 4{% load static %}
5{% block pagecontent %} 5{% block pagecontent %}
6 6
7{% include "projecttopbar.html" %} 7<div class="section">
8 <ul class="breadcrumb">
9 <li>
10 <a href="{% url 'project' project.id %}">{{project.name}}</a>
11 <span class="divider">&rarr;</span>
12 </li>
13 <li><a href="{% url 'projectcustomimages' project.id %}">Custom images</a>
14 <span class="divider">&rarr;</span>
15 </li>
16 <li class="active">
17 {{recipe.name}} ({{recipe.layer_version.layer.name}})
18 </li>
19 </ul>
20</div>
8 21
9<script src="{% static 'js/customrecipe.js' %}"></script> 22<script src="{% static 'js/customrecipe.js' %}"></script>
10<script> 23<script>
11 $(document).ready(function (){ 24 $(document).ready(function (){
12 var ctx = { 25 var ctx = {
13 tableApiUrl: "{% url 'recipeselectpackages' project.id recipe.pk %}?format=json" 26 recipe : {
27 id: {{recipe.pk}},
28 name: "{{recipe.name}}",
29 }
14 }; 30 };
15 31
16 try { 32 try {
@@ -30,7 +46,7 @@
30 <div class="page-header air"> 46 <div class="page-header air">
31 <h1> 47 <h1>
32 {{recipe.name}} 48 {{recipe.name}}
33 <small>({{recipe.base_recipe.name}})</small> 49 <small>({{recipe.layer_version.layer.name}})</small>
34 </h1> 50 </h1>
35 </div> 51 </div>
36</div> 52</div>
@@ -38,44 +54,47 @@
38<div class="row-fluid span11"> 54<div class="row-fluid span11">
39 <div class="span8"> 55 <div class="span8">
40 <div class="button-place btn-group" style="width: 100%"> 56 <div class="button-place btn-group" style="width: 100%">
41 <a class="btn btn-large span6" href="#" id="build-custom-image" style="width: 50%"> 57 <a class="btn btn-large span6 build-custom-image" href="#" style="width: 50%">
42 Build {{recipe.name}} 58 Build {{recipe.name}}
43 </a> 59 </a>
44 <button class="btn btn-large span6" data-toggle="modal" data-target="#download-file" id="download" style="width: 50%"> 60 <a href="{% url 'customrecipedownload' project.id recipe.id %}" class="btn btn-large span6" style="width: 50%">
45 Download recipe file 61 Download recipe file
46 </button> 62 </a>
47 </div>
48 <div id="no-package-results" class="air" style="display:none;">
49 <div class="alert">
50 <h3>No packages found</h3>
51 <p>You might consider <a href="all-software-recipes.html">searching the list of recipes</a> instead. If you find a recipe that matches the name of the package you want:</p>
52 <ol>
53 <li>Add the layer providing the recipe to your project</li>
54 <li>Build the recipe</li>
55 <li>Once the build completes, come back to this page and search for the package</li>
56 </ol>
57 <form class="input-append no-results">
58 <input type="text" class="input-xlarge" value="search query">
59 <a href="#" class="add-on btn">
60 <i class="icon-remove"></i>
61 </a>
62 <button class="btn">Search</button>
63 <button class="btn btn-link" id="show-all">Show all packages</button>
64 </form>
65 </div>
66 </div> 63 </div>
67 <div id="packages-table"> 64 <div id="no-package-results" class="air" style="display:none;">
68 {% url 'recipeselectpackages' project.id recipe.id as xhr_table_url %} 65 <div class="alert">
69 {% with 'recipeselection' as table_name %} 66 <h3>No packages found</h3>
70 {% with 'Add | Remove packages' as title %} 67 <p>You might consider <a href="all-software-recipes.html">searching the list of recipes</a> instead. If you find a recipe that matches the name of the package you want:</p>
71 68 <ol>
72 <h2>{{title}} (<span class="table-count-{{table_name}}"></span>) </h2> 69 <li>Add the layer providing the recipe to your project</li>
73 70 <li>Build the recipe</li>
74 {% include "toastertable.html" %} 71 <li>Once the build completes, come back to this page and search for the package</li>
75 {% endwith %} 72 </ol>
76 {% endwith %} 73 <form class="input-append no-results">
74 <input type="text" class="input-xlarge" value="search query">
75 <a href="#" class="add-on btn">
76 <i class="icon-remove"></i>
77 </a>
78 <button class="btn">Search</button>
79 <button class="btn btn-link" id="show-all">Show all packages</button>
80 </form>
81 </div>
82 </div>
83 <div id="packages-table">
84 {% if recipe.package_set.count == 0 and last_build == None %}
85 <h2> Add | Remove packages </h2>
86 <div class="alert alert-info air">
87 <p class="lead">Toaster has no package information for {{recipe.name}}. To generate package information, build {{recipe.name}}</p>
88 <button class="btn btn-info btn-large build-custom-recipe" style="margin:20px 0 10px 0;">Build {{recipe.name}}</button>
89 </div>
90 {% else %}
91 {# ToasterTable for Adding remove packages #}
92 {% url 'recipeselectpackages' project.id recipe.id as xhr_table_url %}
93 <h2>{{title}} (<span class="table-count-{{table_name}}">0</span>) </h2>
94 {% include "toastertable.html" %}
95 {% endif %}
96 </div>
77 </div> 97 </div>
78 </div>
79 <div class="span4 well"> 98 <div class="span4 well">
80 <h2 style="margin-bottom:20px;">About {{recipe.name}}</h2> 99 <h2 style="margin-bottom:20px;">About {{recipe.name}}</h2>
81 100
@@ -84,59 +103,68 @@
84 Approx. packages included 103 Approx. packages included
85 <i class="icon-question-sign get-help" title="" data-original-title="The number of packages included is based on information from previous builds and from parsing layers, so we can never be sure it is 100% accurate"></i> 104 <i class="icon-question-sign get-help" title="" data-original-title="The number of packages included is based on information from previous builds and from parsing layers, so we can never be sure it is 100% accurate"></i>
86 </dt> 105 </dt>
87 <dd class="no-packages">{{recipe.packages.count}}</dd> 106 <dd class="no-packages">{{recipe.package_set.all.count}}</dd>
88 <!-- <dt> 107 <dt>
89 Approx. package size 108 Approx. package size
90 <i class="icon-question-sign get-help" title="" data-original-title="Package size is based on information from previous builds, so we can never be sure it is 100% accurate"></i> 109 <i class="icon-question-sign get-help" title="" data-original-title="Package size is based on information from previous builds, so we can never be sure it is 100% accurate"></i>
91 </dt> 110 </dt>
92 <dd>244.3 MB</dd> 111 <dd>{{approx_pkg_size.size__sum|filtered_filesizeformat}}</dd>
112 {% if last_build %}
93 <dt>Last build</dt> 113 <dt>Last build</dt>
94 <dd> 114 <dd>
95 <i class="icon-ok-sign success"></i> 115 <i class="icon-ok-sign success"></i>
96 <a href="build-dashboard.html">11/06/15 15:22</a> 116 <a href="{% url 'projectbuilds' project.id%}">{{last_build.completed_on|date:"d/m/y H:i"}}</a>
97 </dd> 117 </dd>
118 {% endif %}
119 <dt>Layer</dt>
120 <dd><a href="{% url 'layerdetails' project.id recipe.layer_version.pk %}">{{recipe.layer_version.layer.name}}</a></dd>
121 <dt>Based on</dt>
122 <dd><a href="{% url 'recipedetails' project.id recipe.base_recipe.pk %}">{{recipe.base_recipe.name}}</a></dd>
123 {% if last_build %}
124 <dt>Last build</dt>
125 <dd>
126 <i class="icon-ok-sign success"></i>
127 <a href="{% url 'projectbuilds' project.id%}">{{last_build.completed_on|date:"d/m/y H:i"}}</a>
128 </dd>
129 {% endif %}
98 <dt>Recipe file</dt> 130 <dt>Recipe file</dt>
99 <dd> 131 <dd>
100 <code>custom-image-name.bb</code> 132 <code>{{recipe.name}}_{{recipe.version}}.bb</code>
101 <a href="#download-file" data-toggle="modal"><i class="icon-download-alt" title="" data-original-title="Download recipe file"></i></a> 133 <a href="{% url 'customrecipedownload' project.pk recipe.pk %}"><i class="icon-share" title="" data-original-title="View recipe file"></i></a>
102 </dd> --> 134 </dd>
103 <dt>Layer</dt> 135 <dt>Layer</dt>
104 <!-- TODO recipe details page --> 136 <dd><a href="{% url 'layerdetails' project.id recipe.layer_version.pk %}">{{recipe.layer_version.layer.name}}</a></dd>
105 <dd><a href="{% url 'layerdetails' project.id recipe.base_recipe.layer_version.pk %}">{{recipe.base_recipe.layer_version.layer.name}}</a></dd> 137 <dt>
106 <!--<dt>
107 Summary 138 Summary
108 </dt> 139 </dt>
109 <dd> 140 <dd>
110 <span class="muted">Not set</span> 141 {{recipe.summary}}
111 <i class="icon-pencil" data-original-title="" title=""></i>
112 </dd> 142 </dd>
113 <dt> 143 <dt>
114 Description 144 Description
115 </dt> 145 </dt>
116 <dd> 146 <dd>
117 <span class="muted">Not set</span> 147 {{recipe.description}}
118 <i class="icon-pencil" data-original-title="" title=""></i>
119 </dd> 148 </dd>
120 <dt>Version</dt> 149 <dt>Version</dt>
121 <dd> 150 <dd>
122 1.0 151 {{recipe.version}}
123 <i class="icon-pencil" data-original-title="" title=""></i>
124 </dd> 152 </dd>
125 <dt>Section</dt> 153 <dt>Section</dt>
126 <dd> 154 <dd>
127 base 155 {{recipe.section}}
128 <i class="icon-pencil" data-original-title="" title=""></i>
129 <i class="icon-trash" data-original-title="" title=""></i>
130 </dd> 156 </dd>
131 <dt>License</dt> 157 <dt>License</dt>
132 <dd> 158 <dd>
133 MIT 159 {{recipe.license}}
134 <i class="icon-question-sign get-help" title="" data-original-title="All custom images have their license set to MIT. This is because the license applies only to the recipe (.bb) file, and not to the image itself. To see which licenses apply to the image you must check the license manifest generated with each build"></i> 160 <i class="icon-question-sign get-help" title="" data-original-title="All custom images have their license set to MIT. This is because the license applies only to the recipe (.bb) file, and not to the image itself. To see which licenses apply to the image you must check the license manifest generated with each build"></i>
135 </dd> --> 161 </dd>
136 </dl> 162 </dl>
163 <!--
137 <i class="icon-trash no-tooltip"></i> 164 <i class="icon-trash no-tooltip"></i>
138 <a href="#" class="error" id="delete">Delete custom image</a> 165 <a href="#" class="error" id="delete">Delete custom image</a>
166 -->
139 </div> 167 </div>
140</div> 168 </div>
141 169
142 {% endblock %} 170 {% endblock %}
diff --git a/bitbake/lib/toaster/toastergui/templates/pkg_add_rm_btn.html b/bitbake/lib/toaster/toastergui/templates/pkg_add_rm_btn.html
index b766aeac93..8723d4ed56 100644
--- a/bitbake/lib/toaster/toastergui/templates/pkg_add_rm_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/pkg_add_rm_btn.html
@@ -1,4 +1,4 @@
1<button class="btn btn-block btn-danger add-rm-package-btn" id="package-rm-btn-{{data.pk}}" data-directive="remove" data-package="{{data.pk}}" data-package-url="{% url 'xhr_customrecipe_packages' extra.recipe_id data.pk %}" style=" 1<button class="btn btn-block btn-danger add-rm-package-btn" data-directive="remove" data-package="{{data.pk}}" data-package-url="{% url 'xhr_customrecipe_packages' extra.recipe_id data.pk %}" data-name="{{data.name}}" style="
2 {% if data.pk not in extra.current_packages %} 2 {% if data.pk not in extra.current_packages %}
3 display:none 3 display:none
4 {% endif %} 4 {% endif %}
@@ -6,7 +6,7 @@
6 <i class="icon-trash no-tooltip"></i> 6 <i class="icon-trash no-tooltip"></i>
7 Remove package 7 Remove package
8</a> 8</a>
9<button class="btn btn-block add-rm-package-btn" data-directive="add" id="package-add-btn-{{data.pk}}" data-package="{{data.pk}}" data-package-url="{% url 'xhr_customrecipe_packages' extra.recipe_id data.pk %}" style=" 9<button class="btn btn-block add-rm-package-btn" data-directive="add" data-package="{{data.pk}}" data-package-url="{% url 'xhr_customrecipe_packages' extra.recipe_id data.pk %}" data-name="{{data.name}}" style="
10 {% if data.pk in extra.current_packages %} 10 {% if data.pk in extra.current_packages %}
11 display:none 11 display:none
12 {% endif %} 12 {% endif %}