diff options
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/recipedetails.js | 52 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/templates/recipedetails.html | 180 |
2 files changed, 232 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/recipedetails.js b/bitbake/lib/toaster/toastergui/static/js/recipedetails.js new file mode 100644 index 0000000000..2bfd0a4b2c --- /dev/null +++ b/bitbake/lib/toaster/toastergui/static/js/recipedetails.js | |||
@@ -0,0 +1,52 @@ | |||
1 | "use strict"; | ||
2 | |||
3 | function recipeDetailsPageInit(ctx){ | ||
4 | |||
5 | $(".customise-btn").click(function(e){ | ||
6 | e.preventDefault(); | ||
7 | var imgCustomModal = $("#new-custom-image-modal"); | ||
8 | |||
9 | if (imgCustomModal.length === 0) | ||
10 | throw("Modal new-custom-image not found"); | ||
11 | |||
12 | imgCustomModal.data('recipe', $(this).data('recipe')); | ||
13 | imgCustomModal.modal('show'); | ||
14 | }); | ||
15 | |||
16 | $("#add-layer-btn").click(function(){ | ||
17 | var btn = $(this); | ||
18 | |||
19 | libtoaster.addRmLayer(ctx.recipe.layer_version, | ||
20 | true, | ||
21 | function (layersList){ | ||
22 | var msg = libtoaster.makeLayerAddRmAlertMsg(ctx.recipe.layer_version, | ||
23 | layersList, | ||
24 | true); | ||
25 | |||
26 | libtoaster.showChangeNotification(msg); | ||
27 | |||
28 | var toShow = $("#customise-build-btns"); | ||
29 | |||
30 | /* If we have no packages built yet also fade in the build packages | ||
31 | * hint message | ||
32 | */ | ||
33 | if (ctx.recipe.totalPackages === 0){ | ||
34 | toShow = toShow.add("#build-to-get-packages-msg"); | ||
35 | } | ||
36 | |||
37 | $("#packages-alert").add(btn).fadeOut(function(){ | ||
38 | toShow.fadeIn(); | ||
39 | }); | ||
40 | }); | ||
41 | }); | ||
42 | |||
43 | /* Trigger a build of your custom image */ | ||
44 | $(".build-recipe-btn").click(function(){ | ||
45 | libtoaster.startABuild(libtoaster.ctx.projectBuildsUrl, | ||
46 | libtoaster.ctx.projectId, | ||
47 | ctx.recipe.name, | ||
48 | function(){ | ||
49 | window.location.replace(libtoaster.ctx.projectBuildsUrl); | ||
50 | }); | ||
51 | }); | ||
52 | } | ||
diff --git a/bitbake/lib/toaster/toastergui/templates/recipedetails.html b/bitbake/lib/toaster/toastergui/templates/recipedetails.html new file mode 100644 index 0000000000..aed0492aeb --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templates/recipedetails.html | |||
@@ -0,0 +1,180 @@ | |||
1 | {% extends "base.html" %} | ||
2 | {% load projecttags %} | ||
3 | {% load humanize %} | ||
4 | {% load static %} | ||
5 | {% block pagecontent %} | ||
6 | |||
7 | <div class="section"> | ||
8 | <ul class="breadcrumb"> | ||
9 | <li class="muted"> | ||
10 | {{project.name}} | ||
11 | </li> | ||
12 | <li> | ||
13 | <a href="{% url 'project' project.id %}">Configuration</a> | ||
14 | <span class="divider">→</span> | ||
15 | </li> | ||
16 | <li> | ||
17 | {% if recipe.is_image %} | ||
18 | <a href="{% url 'projectimagerecipes' project.id %}">Image recipes</a> | ||
19 | {% else %} | ||
20 | <a href="{% url 'projectsoftwarerecipes' project.id %}">Software recipes</a> | ||
21 | {% endif %} | ||
22 | <span class="divider">→</span> | ||
23 | </li> | ||
24 | <li class="active"> | ||
25 | {{recipe.name}} ({{recipe.layer_version.layer.name}}) | ||
26 | </li> | ||
27 | </ul> | ||
28 | </div> | ||
29 | |||
30 | <script src="{% static 'js/recipedetails.js' %}"></script> | ||
31 | <script> | ||
32 | $(document).ready(function (){ | ||
33 | var ctx = { | ||
34 | recipe : { | ||
35 | id: {{recipe.pk}}, | ||
36 | name: "{{recipe.name}}", | ||
37 | totalPackages: {{packages.count}}, | ||
38 | layer_version : { | ||
39 | id: {{recipe.layer_version.pk}}, | ||
40 | name: "{{recipe.layer_version.layer.name}}", | ||
41 | layerdetailurl: "{% url 'layerdetails' project.pk recipe.layer_version.pk %}" | ||
42 | } | ||
43 | } | ||
44 | }; | ||
45 | |||
46 | try { | ||
47 | recipeDetailsPageInit(ctx); | ||
48 | } catch (e) { | ||
49 | document.write("Sorry, An error has occurred loading this page"); | ||
50 | console.warn(e); | ||
51 | } | ||
52 | }); | ||
53 | </script> | ||
54 | |||
55 | {% include 'newcustomimage_modal.html' %} | ||
56 | |||
57 | <div class="row-fluid span11"> | ||
58 | <div class="alert alert-success lead" id="image-created-notification" style="margin-top: 15px; display: none"> | ||
59 | <button type="button" data-dismiss="alert" class="close">x</button> | ||
60 | Your custom image <strong>{{recipe.name}}</strong> has been created. You can now add or remove packages as needed. | ||
61 | </div> | ||
62 | <div class="page-header air"> | ||
63 | <h1> | ||
64 | {{recipe.name}} | ||
65 | <small>({{recipe.layer_version.layer.name}})</small> | ||
66 | </h1> | ||
67 | </div> | ||
68 | </div> | ||
69 | |||
70 | <div class="row-fluid span11"> | ||
71 | <div class="span8"> | ||
72 | <div class="button-place btn-group" id="customise-build-btns" | ||
73 | style="width: 100%; | ||
74 | {% if not in_project %} | ||
75 | display:none; | ||
76 | {% endif %}"> | ||
77 | <button class="btn btn-large span6 build-recipe-btn" style="width: 50%"> | ||
78 | Build {{recipe.name}} | ||
79 | </button> | ||
80 | {% if recipe.is_image %} | ||
81 | <button class="btn btn-large span6 customise-btn" data-recipe="{{recipe.pk}}" style="width: 50%"> | ||
82 | Customise {{recipe.name}} | ||
83 | </button> | ||
84 | {% endif %} | ||
85 | </div> | ||
86 | <div class="button-place"> | ||
87 | <button class="btn btn-block btn-large" id="add-layer-btn" | ||
88 | style="width:100%; | ||
89 | {% if in_project %} | ||
90 | display:none; | ||
91 | {% endif %}"> | ||
92 | <i class="icon-plus"></i> | ||
93 | Add the {{recipe.layer_version.layer.name}} layer to your project to build or customise this image recipe | ||
94 | </button> | ||
95 | </div> | ||
96 | |||
97 | <div id="packages-table"> | ||
98 | {% if packages.count %} | ||
99 | {% url 'recipepackages' project.id recipe.id as xhr_table_url %} | ||
100 | <h2>{{title}} (<span class="table-count-{{table_name}}">0</span>) </h2> | ||
101 | {% include "toastertable.html" %} | ||
102 | {% else %} | ||
103 | <h2>{{title}}</h2> | ||
104 | {% endif %} | ||
105 | |||
106 | <div class="alert alert-info air" id="build-to-get-packages-msg" | ||
107 | {# if there are packages and it's in the project don't show this msg #} | ||
108 | {% if packages.count or not packages.count and not in_project %} | ||
109 | style="display:none" | ||
110 | {% endif %} > | ||
111 | <p class="lead">Toaster has no package information for {{recipe.name}}. To generate package information, build {{recipe.name}}</p> | ||
112 | <button class="btn btn-info btn-large build-recipe-btn" style="margin:20px 0 10px 0;">Build {{recipe.name}}</button> | ||
113 | </div> | ||
114 | |||
115 | <div class="alert alert-info air" id="packages-alert" | ||
116 | {% if packages.count or in_project %} | ||
117 | style="display:none" | ||
118 | {% endif %} | ||
119 | > | ||
120 | <p class="lead">Toaster has no package information for {{recipe.name}} | ||
121 | </p> | ||
122 | </div> | ||
123 | </div> | ||
124 | </div> | ||
125 | <div class="span4 well"> | ||
126 | <h2 style="margin-bottom:20px;">About {{recipe.name}}</h2> | ||
127 | <dl> | ||
128 | <dt> | ||
129 | Approx. packages included | ||
130 | <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> | ||
131 | </dt> | ||
132 | <dd class="no-packages">{{packages.count}}</dd> | ||
133 | <dt> | ||
134 | Approx. package size | ||
135 | <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> | ||
136 | </dt> | ||
137 | <dd>{{approx_pkg_size.size__sum|filtered_filesizeformat}}</dd> | ||
138 | {% if last_build %} | ||
139 | <dt>Last build</dt> | ||
140 | <dd> | ||
141 | <i class="icon-ok-sign success"></i> | ||
142 | <a href="{% url 'projectbuilds' project.id%}">{{last_build.completed_on|date:"d/m/y H:i"}}</a> | ||
143 | </dd> | ||
144 | {% endif %} | ||
145 | <dt>Recipe file</dt> | ||
146 | <dd> | ||
147 | <code>{{recipe.file_path|cut_path_prefix:recipe.layer_version.local_path}}</code> | ||
148 | <a href="{{recipe.get_vcs_recipe_file_link_url}}"><i class="icon-share" title="" data-original-title="View recipe file"></i></a> | ||
149 | </dd> | ||
150 | <dt>Layer</dt> | ||
151 | <dd><a href="{% url 'layerdetails' project.id recipe.layer_version.pk %}">{{recipe.layer_version.layer.name}}</a></dd> | ||
152 | <dt> | ||
153 | Summary | ||
154 | </dt> | ||
155 | <dd> | ||
156 | {{recipe.summary}} | ||
157 | </dd> | ||
158 | <dt> | ||
159 | Description | ||
160 | </dt> | ||
161 | <dd> | ||
162 | {{recipe.description}} | ||
163 | </dd> | ||
164 | <dt>Version</dt> | ||
165 | <dd> | ||
166 | {{recipe.version}} | ||
167 | </dd> | ||
168 | <dt>Section</dt> | ||
169 | <dd> | ||
170 | {{recipe.section}} | ||
171 | </dd> | ||
172 | <dt>License</dt> | ||
173 | <dd> | ||
174 | {{recipe.license}} | ||
175 | </dd> | ||
176 | </dl> | ||
177 | </div> | ||
178 | </div> | ||
179 | |||
180 | {% endblock %} | ||