Commit 13d18993 authored by Leo Iannacone's avatar Leo Iannacone

Merge remote-tracking branch 'github/master' into portable

parents 268bc556 a7c2e911
# unreleased
* [new] show file size for package files
* [new] disable autoscroll pressing on "back on top" panel
# 1.0.0 (2014-07-23)
* Migrate to coffee-script, code refactory
* [new] style - more focus on files content
* [new] removed useless header, save space
* [new] move git repo to debomatic organization in github
* [fix] merge correctly user configuration - closes #1
* [fix] read correctly user configuration with absolute path - closes #2
* [fix] wait for the creation of the json log if does not exists - #closes 3
* [fix] merge correctly user configuration - closes #2
* [fix] read correctly user configuration with absolute path - closes #3
* [fix] wait for the creation of the json log if does not exists - closes #4
# 0.6.0 (2014-07-10)
* [new] [module] write a JSON file about package status in its own directory
......@@ -16,7 +20,7 @@
* [new] double click on a package in the list make an automatic search
* [new] add slide up and down effect while searching packages
* [new] set files list to not send to client as configurable
* [fix] prevent crashes filtering out request to chroots - send back 403 HTTP status
* [fix] prevent crashes filtering out request to chroots - send back 403 HTTP status - closes #1
* [fix] escape correctly HTML in file content
* [fix] auto-populate page on socket connect instead of on page loads
* [fix] preferences does not set correctly if value is false
......
......@@ -119,6 +119,12 @@ class DebomaticModule_JSONLogger:
json = toJSON(info, indent=4, sort_keys=True)
infofd.write(json + '\n')
def _get_human_size(self, num):
for x in ['b', 'KB', 'MB', 'GB', 'TB']:
if num < 1024.0:
return "%3.1f %s" % (num, x)
num /= 1024.0
def pre_chroot(self, args):
distribution = self._get_distribution_status(args)
self._append_json_logfile(args, distribution)
......@@ -139,18 +145,21 @@ class DebomaticModule_JSONLogger:
def post_build(self, args):
status = self._get_package_status(args)
status['status'] = 'build'
status['success'] = False
status['tags'] = {}
status['success'] = args['success']
status['files'] = {}
resultdir = os.path.join(args['directory'], 'pool', args['package'])
for filename in os.listdir(resultdir):
if filename.endswith('.dsc'):
status['success'] = True
else:
if filename.endswith('.json'):
continue
full_path = os.path.join(resultdir, filename)
info = {}
info['size'] = self._get_human_size(os.path.getsize(full_path))
tag = LogParser(full_path).parse()
if tag:
status['tags'][filename] = tag
info['tags'] = tag
status['files'][filename] = info
self._write_package_json(args, status)
status.pop('files', None)
self._append_json_logfile(args, status)
......
......@@ -73,6 +73,7 @@ function Page_Distrubion(socket) {
var sidebarOffset = 0;
var new_lines = [];
var current_file_in_preview = false;
var back_on_top_pressed = false;
function __check_hash_makes_sense() {
if (window.location.hash.indexOf('..') >= 0) {
......@@ -270,8 +271,8 @@ function Page_Distrubion(socket) {
var html_file = $('<li id="file-' + f.orig_name + '">' +
'<a title="' + f.orig_name + '" href="' +
Utils.from_view_to_hash(tmp) + '">' +
'<span class="status pull-right"></span>' +
f.name + '</a></li>');
'<span class="tags pull-right"></span>' +
'<span class="name">' + f.name + '</span></a></li>');
html_file.on('click', function () {
files.select(this);
});
......@@ -286,7 +287,7 @@ function Page_Distrubion(socket) {
view.package.debs = Utils.clone(socket_data.package.debs);
// update.html
socket_data.package.debs.forEach(function (f) {
$('#debs ul').append('<li><a title="' + f.orig_name + '" href="' + f.path + '">' +
$('#debs ul').append('<li id="file-' + f.orig_name + '"><a title="' + f.orig_name + '" href="' + f.path + '">' +
f.name + '</a> <span>.' + f.extension + '</span></li>');
});
$('#debs').show();
......@@ -297,7 +298,7 @@ function Page_Distrubion(socket) {
view.package.sources = Utils.clone(socket_data.package.sources);
// update html
socket_data.package.sources.forEach(function (f) {
$('#sources ul').append('<li><a title="' + f.orig_name + '" href="' + f.path + '">' + f.name + '</a></li>');
$('#sources ul').append('<li id="file-' + f.orig_name + '"><a title="' + f.orig_name + '" href="' + f.path + '">' + f.name + '</a></li>');
});
$('#sources').show();
}
......@@ -338,8 +339,13 @@ function Page_Distrubion(socket) {
show: function () {
$('#files').show();
},
set_status: function (file, status) {
$('#logs li[id="file-' + file + '"] .status').html(status);
set_tags: function (file, tags) {
console.log(file, tags);
$('li[id="file-' + file + '"] .tags').html(tags);
},
set_size: function (file, size) {
//console.log(file, size);
$('[id="file-' + file + '"] a').append('<span class="size">' + size + '</span>');
}
};
......@@ -367,11 +373,15 @@ function Page_Distrubion(socket) {
return result;
}
if (socket_data.hasOwnProperty('tags')) {
var tags = socket_data.tags;
for (var file in tags) {
if (tags.hasOwnProperty(file))
files.set_status(file, tags[file]);
if (socket_data.hasOwnProperty('files')) {
var s_files = socket_data.files;
for (var file in s_files) {
if (s_files.hasOwnProperty(file)) {
if (s_files[file].hasOwnProperty('tags'))
files.set_tags(file, s_files[file].tags);
if (s_files[file].hasOwnProperty('size'))
files.set_size(file, s_files[file].size);
}
}
}
......@@ -407,6 +417,7 @@ function Page_Distrubion(socket) {
var file = {
set: function (socket_data) {
back_on_top_pressed = false;
var new_content = Utils.escape_html(socket_data.file.content);
var file_content = $('#file .content');
view.file = Utils.clone(socket_data.file);
......@@ -424,7 +435,7 @@ function Page_Distrubion(socket) {
new_content = Utils.escape_html(new_content);
if (!current_file_in_preview) {
file_content.append(new_content);
if (config.preferences.autoscroll) {
if (config.preferences.autoscroll && !back_on_top_pressed) {
// scroll down if file is covering footer
var file_height = $('#fileOffset').offset().top;
var footerOffset = $('footer').offset().top;
......@@ -793,6 +804,8 @@ function Page_Distrubion(socket) {
// Init sticky-package back_on_top on click
$('#sticky-package').on('click', function () {
back_on_top_pressed = true;
debug(1, 'back on top pressed, disabling autoscroll')
page.go.up(100);
});
......
......@@ -188,12 +188,12 @@ function Page_Generic() {
this.preferences();
// show the smile face
$('#footer .copyright').mouseenter(function () {
$('#smile').animate({
$('#footer .copyright a').mouseenter(function () {
$('#smile').delay(250).animate({
'background-position-y': '-50px'
}, 200);
}).mouseleave(function () {
$('#smile').animate({
$('#smile').stop().stop().animate({
'background-position-y': '20px'
}, 150);
});
......
......@@ -141,6 +141,32 @@ footer .info {
margin-top: -3px;
}
#files .size {
margin: 0 8px 0 0;
font-size: 70%;
color: rgba(0,0,0,0.25);
float: right;
min-width: 60px;
text-align: right;
display: inline-block;
line-height: 20px;
text-shadow: 0 1px 1px white;
}
#logs .size {
float: none;
line-height: inherit;
}
#logs .active .size {
text-shadow: none;
}
#logs .name {
min-width: 75px;
display: inline-block;
}
#status span {
font-weight: bold;
font-size: small;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment