summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates/dirinfo.html
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templates/dirinfo.html')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/dirinfo.html237
1 files changed, 237 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/dirinfo.html b/bitbake/lib/toaster/toastergui/templates/dirinfo.html
new file mode 100644
index 0000000000..9b76a1cb8c
--- /dev/null
+++ b/bitbake/lib/toaster/toastergui/templates/dirinfo.html
@@ -0,0 +1,237 @@
1{% extends "basebuildpage.html" %}
2{% block extraheadcontent %}
3{% load static %}
4<link rel="stylesheet" href="{% static 'css/jquery.treetable.css' %}" type="text/css">
5<link rel="stylesheet" href="{% static 'css/jquery.treetable.theme.toaster.css' %}" type="text/css">
6{% endblock extraheadcontent %}
7
8{% block localbreadcrumb %}
9<li>{{target.target}}</li>
10{% endblock localbreadcrumb%}
11
12{% block buildinfomain %}
13
14{% load static %}
15<script src="{% static 'js/jquery.treetable.js' %}">
16</script>
17{% load projecttags %}
18
19<script type='text/javascript'>
20 function setupTreetable() {
21 $("#dirtable").treetable({
22 expandable: true,
23 branchAttr: "ttBranch",
24 clickableNodeNames: true,
25 onNodeCollapse: function() {
26 /* Do nothing, keep cached */
27 },
28 onNodeExpand: function() {
29 var start = this.id;
30 var n = $("#dirtable").treetable("node", start);
31 if (this.children.length > 0) {
32 /* already was expanded once */
33 $("#dirtable").treetable("reveal", start);
34 }
35 else {
36 var url = "{% url "dirinfo_ajax" build.id target.id %}";
37 $.ajax({
38 async: false,
39 type : "GET",
40 url : url,
41 data : "start=" + start,
42 success : function(response) {
43 var objects = $.parseJSON(response);
44 addRows(n, objects)
45 },
46 error : function(jqXHR, textStatus, errorThrown ) {alert(textStatus + ":" + errorThrown)},
47 });
48 }
49 },
50 });
51 }
52 function td(data) {
53 if (data == null) {
54 data = '';
55 }
56 return '<td>' + data + '</td>'
57 }
58
59 function formatRow(o) {
60 /* setup tr-wide formatting */
61 var tr = '<tr class="';
62 if (o.link_to != null) {
63 tr += 'muted ';
64 }
65 if (o.isdir && o.childcount) {
66 tr += 'branch" data-tt-branch="true" ';
67 }
68 else {
69 tr += 'leaf" data-tt-branch="false" ';
70 }
71 tr += ' data-tt-id="' + o.fullpath +'" ';
72 if (o.parent != "/") {
73 tr += ' data-tt-parent-id="' + o.parent +'" ';
74 }
75 tr += '>';
76
77 /* setup td specific formatting */
78 var link_to = td(o.link_to);
79 var size = td(o.size);
80 var permission = td(o.permission);
81 var owner = td(o.owner);
82 var group = td(o.group);
83
84 /* handle the name column */
85 var name = null;;
86 var namespan=1;
87 if (o.isdir) {
88 if (o.link_to == null) {
89 namespan = 2;
90 if (o.package == null) {
91 namespan = 3;
92 }
93 }
94 var colspan = 'colspan="' + namespan + '"';
95 name = '<td class="content-directory"' + colspan + '>';
96 if (o.childcount) {
97 name += '<a href="">';
98 }
99 name += '<i class="icon-folder-close"></i>';
100 name += '&nbsp;' + o.name;
101 if (o.childcount) {
102 name += '</a>';
103 }
104 name += '</td>';
105 }
106 else {
107 name = '<td>';
108 if (o.link_to == null) {
109 name += '<i class="icon-file"></i>';
110 }
111 else {
112 name += '<i class="icon-hand-right"></i>';
113 }
114 name += '&nbsp;' + o.name;
115 name += '</td>';
116 }
117
118 /* handle the package column */
119 var package = null;
120 if (o.package != null) {
121 /* add link to included package page */
122 build_id = {{ build.id }};
123 target_id = {{ target.id }};
124 /* Create a url for a dummy package id of 0 */
125 dummy = "{% url 'package_included_detail' build.id target.id 0 %}"
126 /* fill in the package id */
127 url = dummy.substr(0, dummy.length-1) + o.package_id;
128 package = '<a href=' + url + '>' ;
129 package += o.package;
130 package += '</a>';
131 if (o.installed_package != o.package) {
132 /* make class muted and add hover help */
133 package += '<span class="muted"> as ' + o.installed_package + ' </span>';
134 package += '<i class="icon-question-sign get-help hover-help" ';
135 package += 'title="' + o.package + ' was renamed at packaging time and was installed in your image as ' + o.installed_package + '">';
136 package += '</i>';
137 }
138 }
139 package = td(package);
140
141 var cols1to3;
142 switch (namespan) {
143 case 3:
144 cols1to3 = name;
145 break;
146 case 2:
147 cols1to3 = name + package;
148 break;
149 default:
150 cols1to3 = name + link_to + package;
151 }
152 r = tr + cols1to3 + size + permission + owner + group + "</tr>"
153 return r;
154 }
155
156 function addRows(n, objs) {
157 rows = "";
158 for (i=0; i<objs.length; i++) {
159 rows += formatRow(objs[i]);
160 }
161 $("#dirtable").treetable("loadBranch", n, rows);
162 }
163
164 $.fn.isOffScreen = function(){
165 var win = $(window);
166 viewportBottom = win.scrollTop() + win.height();
167
168 var bounds = this.offset();
169 bounds.bottom = bounds.top + this.outerHeight();
170
171 return (bounds.bottom > viewportBottom);
172 };
173
174 function selectRow(path) {
175 var row = $('tr[data-tt-id="' + path + '"]');
176 row.addClass(" highlight");
177 if (row.isOffScreen()) {
178 $('html, body').animate({ scrollTop: row.offset().top - 150}, 2000);
179 }
180 }
181</script>
182
183<div class="span10">
184
185 <div class="page-header">
186 <h1> {{target.target}} </h1>
187 </div>
188
189 <ul class="nav nav-pills">
190 <li class="">
191 <a href="{% url 'target' build.id target.id %}">
192 <i class="icon-question-sign get-help" data-toggle="tooltip" title="Of all the packages built, the subset installed in the root file system of this image"></i>
193 Packages included ({{target.package_count}} - {{packages_sum|filtered_filesizeformat}})
194 </a>
195 </li>
196 <li class="active">
197 <a href="{% url 'dirinfo' build.id target.id %}">
198 <i class="icon-question-sign get-help" data-toggle="tooltip" title="The directories and files in the root file system of this image"></i>
199 Directory structure
200 </a>
201 </li>
202 </ul>
203
204 <div id="directory-structure" class="tab-pane active">
205 <table id="dirtable" class="table table-bordered table-hover treetable">
206 <thead>
207 <tr>
208 <th>Directory / File</th>
209 <th>Symbolic link to</th>
210 <th>Source package</th>
211 <th>Size</th>
212 <th>Permissions</th>
213 <th>Owner</th>
214 <th>Group</th>
215 </tr>
216 </thead>
217 <tbody>
218 <script type='text/javascript'>
219 setupTreetable();
220 addRows(null, {{ objects|safe }} );
221 {% if file_path %}
222 {% comment %}
223 link from package_included_detail specifies file path
224 {% endcomment %}
225 {% for dir_elem in dir_list %}
226 $("#dirtable").treetable("expandNode", "{{dir_elem}}");
227 {% endfor %}
228 selectRow("{{file_path}}");
229 {% endif %}
230 </script>
231 </tbody>
232 </table>
233 </div> <!-- directory-structure -->
234</div> <!-- span10 -->
235
236{% endblock buildinfomain %}
237