generic-poky/bitbake/lib/toaster/toastergui/templates/dirinfo.html

238 lines
7.9 KiB
HTML
Raw Normal View History

{% extends "basebuildpage.html" %}
{% block extraheadcontent %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/jquery.treetable.css' %}" type="text/css">
<link rel="stylesheet" href="{% static 'css/jquery.treetable.theme.toaster.css' %}" type="text/css">
{% endblock extraheadcontent %}
{% block localbreadcrumb %}
<li>{{target.target}}</li>
{% endblock localbreadcrumb%}
{% block buildinfomain %}
{% load static %}
<script src="{% static 'js/jquery.treetable.js' %}">
</script>
{% load projecttags %}
<script type='text/javascript'>
function setupTreetable() {
$("#dirtable").treetable({
expandable: true,
branchAttr: "ttBranch",
clickableNodeNames: true,
onNodeCollapse: function() {
/* Do nothing, keep cached */
},
onNodeExpand: function() {
var start = this.id;
var n = $("#dirtable").treetable("node", start);
if (this.children.length > 0) {
/* already was expanded once */
$("#dirtable").treetable("reveal", start);
}
else {
var url = "{% url "dirinfo_ajax" build.id target.id %}";
$.ajax({
async: false,
type : "GET",
url : url,
data : "start=" + start,
success : function(response) {
var objects = $.parseJSON(response);
addRows(n, objects)
},
error : function(jqXHR, textStatus, errorThrown ) {alert(textStatus + ":" + errorThrown)},
});
}
},
});
}
function td(data) {
if (data == null) {
data = '';
}
return '<td>' + data + '</td>'
}
function formatRow(o) {
/* setup tr-wide formatting */
var tr = '<tr class="';
if (o.link_to != null) {
tr += 'muted ';
}
if (o.isdir && o.childcount) {
tr += 'branch" data-tt-branch="true" ';
}
else {
tr += 'leaf" data-tt-branch="false" ';
}
tr += ' data-tt-id="' + o.fullpath +'" ';
if (o.parent != "/") {
tr += ' data-tt-parent-id="' + o.parent +'" ';
}
tr += '>';
/* setup td specific formatting */
var link_to = td(o.link_to);
bitbake: toaster: sort on size in detail pages [YOCTO 5778] Implements the features described in the attachment to bugzilla 5778 - new global changes to the format of size data, and - adding sorts by selected columns to specific detail pages. Although new pagination and row search capabilities are shown on the screen shots for the 5778 attachment, those features are specified in a different bugzilla entry 5777 and are not implemented in this commit. Also, the 5778 spec includes table sorting for the recipe package detail page, but sorting for that page was not implemented in this commit due to complications with sorting then returning to a page that is only one URL fragment in a template. The scope of file changes are described below. Changes to support new 'size' field column formats... default.css - added sizecol class style (right justified) projecttags.py - changed filtered_filesizeformat to allow ".0" suffixes Changes that add class 'sizecol, span2(as spec'd) ' to <th> and/or <td> size columns were made to... dirinfo.py, package_built_dependencies.html, package_included_dependencies.html, recipe.html, bpackage.html, and target.html More significant changes to support detail page table sorting are: - tablesort.html: New created to implement the sort icons, directions, and table headings, and suppress sort handling if 'disable_sort' in context, without search or pagination elements ingrained in basetable_top. Confining the changes to this small file reduces the impact (testing and risk) on the larger set of files that arleady include basetable_top/bottom files. - view.py: Modified the following view functions with - trivial changes for size formatting to the views: target, - changes to package_built_detail, package_included_detail, package_included_reverse_dependencies to handle the sorting implementation as well as moving headings and size formatting for size columns from templates to the views. - Implementation of the detail sorting using above in: package_built_detail.html, package_included_detail.html, and package_included_reverse_dependencies.html to include the tablesort heading setup, format the size column, and iterate over the new sorted objects, suppressing sorts if table row count less than 2. (Bitbake rev: d16126e9abfffde66ab70865a81997322847d44e) Signed-off-by: Dave Lerner <dave.lerner@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08 16:32:21 +00:00
var size = '<td class = "sizecol">' + o.size + '</td>'
var permission = td(o.permission);
var owner = td(o.owner);
var group = td(o.group);
/* handle the name column */
var name = null;;
var namespan=1;
if (o.isdir) {
if (o.link_to == null) {
namespan = 2;
if (o.package == null) {
namespan = 3;
}
}
var colspan = 'colspan="' + namespan + '"';
name = '<td class="content-directory"' + colspan + '>';
if (o.childcount) {
name += '<a href="">';
}
name += '<i class="icon-folder-close"></i>';
name += '&nbsp;' + o.name;
if (o.childcount) {
name += '</a>';
}
name += '</td>';
}
else {
name = '<td>';
if (o.link_to == null) {
name += '<i class="icon-file"></i>';
}
else {
name += '<i class="icon-hand-right"></i>';
}
name += '&nbsp;' + o.name;
name += '</td>';
}
/* handle the package column */
var package = null;
if (o.package != null) {
/* add link to included package page */
build_id = {{ build.id }};
target_id = {{ target.id }};
/* Create a url for a dummy package id of 0 */
dummy = "{% url 'package_included_detail' build.id target.id 0 %}"
/* fill in the package id */
url = dummy.substr(0, dummy.length-1) + o.package_id;
package = '<a href=' + url + '>' ;
package += o.package;
package += '</a>';
if (o.installed_package != o.package) {
/* make class muted and add hover help */
package += '<span class="muted"> as ' + o.installed_package + ' </span>';
package += '<i class="icon-question-sign get-help hover-help" ';
package += 'title="' + o.package + ' was renamed at packaging time and was installed in your image as ' + o.installed_package + '">';
package += '</i>';
}
}
package = td(package);
var cols1to3;
switch (namespan) {
case 3:
cols1to3 = name;
break;
case 2:
cols1to3 = name + package;
break;
default:
cols1to3 = name + link_to + package;
}
r = tr + cols1to3 + size + permission + owner + group + "</tr>"
return r;
}
function addRows(n, objs) {
rows = "";
for (i=0; i<objs.length; i++) {
rows += formatRow(objs[i]);
}
$("#dirtable").treetable("loadBranch", n, rows);
}
$.fn.isOffScreen = function(){
var win = $(window);
viewportBottom = win.scrollTop() + win.height();
var bounds = this.offset();
bounds.bottom = bounds.top + this.outerHeight();
return (bounds.bottom > viewportBottom);
};
function selectRow(path) {
var row = $('tr[data-tt-id="' + path + '"]');
row.addClass(" highlight");
if (row.isOffScreen()) {
$('html, body').animate({ scrollTop: row.offset().top - 150}, 2000);
}
}
</script>
<div class="span10">
<div class="page-header">
<h1> {{target.target}} </h1>
</div>
<ul class="nav nav-pills">
<li class="">
<a href="{% url 'target' build.id target.id %}">
<i class="icon-question-sign get-help" title="Of all the packages built, the subset installed in the root file system of this image"></i>
Packages included ({{target.package_count}} - {{packages_sum|filtered_filesizeformat}})
</a>
</li>
<li class="active">
<a href="{% url 'dirinfo' build.id target.id %}">
<i class="icon-question-sign get-help" title="The directories and files in the root file system of this image"></i>
Directory structure
</a>
</li>
</ul>
<div id="directory-structure" class="tab-pane active">
<table id="dirtable" class="table table-bordered table-hover treetable">
<thead>
<tr>
<th>Directory / File</th>
<th>Symbolic link to</th>
<th>Source package</th>
<th>Size</th>
<th>Permissions</th>
<th>Owner</th>
<th>Group</th>
</tr>
</thead>
<tbody>
<script type='text/javascript'>
setupTreetable();
addRows(null, {{ objects|safe }} );
{% if file_path %}
{% comment %}
link from package_included_detail specifies file path
{% endcomment %}
{% for dir_elem in dir_list %}
$("#dirtable").treetable("expandNode", "{{dir_elem}}");
{% endfor %}
selectRow("{{file_path}}");
{% endif %}
</script>
</tbody>
</table>
</div> <!-- directory-structure -->
</div> <!-- span10 -->
{% endblock buildinfomain %}