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