Commit e2464a82 authored by Leo Iannacone's avatar Leo Iannacone

Merge branch 'master' into portable

parents 8423a427 5d814471
...@@ -106,7 +106,7 @@ function __send_distribution_packages(event_name, socket, data) { ...@@ -106,7 +106,7 @@ function __send_distribution_packages(event_name, socket, data) {
}); });
} }
function __send_file(event_name, socket, data) { function __send_file(event_name, socket, data, last_lines) {
var file_path = utils.get_file_path(data); var file_path = utils.get_file_path(data);
fs.readFile(file_path, 'utf8', function (err, content) { fs.readFile(file_path, 'utf8', function (err, content) {
if (err) { if (err) {
...@@ -114,7 +114,10 @@ function __send_file(event_name, socket, data) { ...@@ -114,7 +114,10 @@ function __send_file(event_name, socket, data) {
return; return;
} }
data.file.orig_name = file_path.split('/').pop(); data.file.orig_name = file_path.split('/').pop();
data.file.content = content; if (last_lines > 0)
data.file.content = content.split('\n').slice(-25).join('\n');
else
data.file.content = content;
data.file.path = file_path.replace(config.debomatic.path, config.routes.debomatic); data.file.path = file_path.replace(config.debomatic.path, config.routes.debomatic);
socket.emit(event_name, data); socket.emit(event_name, data);
}); });
...@@ -126,7 +129,10 @@ function __handler_get_file(socket, data) { ...@@ -126,7 +129,10 @@ function __handler_get_file(socket, data) {
data.file.content = null; data.file.content = null;
socket.emit(event_name, data); socket.emit(event_name, data);
}); });
__send_file(_e.file.set, socket, data); if (config.web.file.preview.indexOf(data.file.name) >= 0 && !data.file.force)
__send_file(_e.file.set, socket, data, config.web.file.num_lines);
else
__send_file(_e.file.set, socket, data);
} }
function Client(socket) { function Client(socket) {
...@@ -165,7 +171,7 @@ function Client(socket) { ...@@ -165,7 +171,7 @@ function Client(socket) {
for (var key in socket_watchers) { for (var key in socket_watchers) {
try { try {
socket_watchers[key].close(); socket_watchers[key].close();
} catch (err) {} } catch (error_watch) {}
} }
}); });
}); });
......
...@@ -47,6 +47,11 @@ config.web.debomatic.dput.login = 'debomatic'; ...@@ -47,6 +47,11 @@ config.web.debomatic.dput.login = 'debomatic';
config.web.debomatic.dput.method = 'scp'; config.web.debomatic.dput.method = 'scp';
config.web.debomatic.dput.unsigned_uploads = false; config.web.debomatic.dput.unsigned_uploads = false;
// list of files get preview
config.web.file = {};
config.web.file.preview = ['buildlog'];
config.web.file.num_lines = 25;
// default ui settings // default ui settings
config.web.preferences = {}; config.web.preferences = {};
config.web.preferences.autoscroll = true; config.web.preferences.autoscroll = true;
...@@ -62,7 +67,7 @@ config.web.preferences.debug = 0; // debug level - 0 means disabled ...@@ -62,7 +67,7 @@ config.web.preferences.debug = 0; // debug level - 0 means disabled
// DO NOT TOUCH these ones // DO NOT TOUCH these ones
config.version = '0.2.4'; config.version = '0.3.0';
// A simple function to quickly have // A simple function to quickly have
// get and set strings for client events // get and set strings for client events
......
...@@ -13,5 +13,8 @@ ...@@ -13,5 +13,8 @@
}, },
"scripts": { "scripts": {
"install": "bash scripts/install.sh" "install": "bash scripts/install.sh"
},
"bin": {
"debomatic-webui": "./debomatic-webui"
} }
} }
...@@ -94,10 +94,17 @@ function Page_Distrubion(socket) { ...@@ -94,10 +94,17 @@ function Page_Distrubion(socket) {
if (Utils.check_view_file(view)) { if (Utils.check_view_file(view)) {
var complete_name = view.package.orig_name + '.' + view.file.name; var complete_name = view.package.orig_name + '.' + view.file.name;
window_title = complete_name; window_title = complete_name;
if (!view.file.path); label = complete_name;
view.file.path = config.paths.debomatic + '/' + view.distribution.name + '/pool/' + view.package.orig_name + '/' + complete_name; if (!view.file.path)
label = complete_name + '<a class="btn btn-link btn-lg" title="Download" href="' + view.file.path + '"> ' + view.file.path = config.paths.debomatic + '/' + view.distribution.name + '/pool/' + view.package.orig_name + '/' + complete_name;
label += ' <a class="btn btn-link btn-lg" title="Download" href="' + view.file.path + '"> ' +
'<span class="glyphicon glyphicon-download-alt"></span></a>'; '<span class="glyphicon glyphicon-download-alt"></span></a>';
if (config.file.preview.indexOf(view.file.name) >= 0) {
var view_all = $('<a id="get-whole-file" class="btn btn-link btn-lg" title="View the whole file"></a>');
view_all.html('<span class="glyphicon glyphicon-eye-open"></span>');
label += view_all.get(0).outerHTML;
}
} else if (Utils.check_view_package(view)) } else if (Utils.check_view_package(view))
label = view.package.orig_name; label = view.package.orig_name;
else if (Utils.check_view_distribution(view)) else if (Utils.check_view_distribution(view))
...@@ -106,6 +113,11 @@ function Page_Distrubion(socket) { ...@@ -106,6 +113,11 @@ function Page_Distrubion(socket) {
if (window_title) if (window_title)
label = window_title; label = window_title;
page_generic.set_window_title(label); page_generic.set_window_title(label);
// set onclick get-whole-file
$("#get-whole-file").on('click', function () {
file.get(true);
});
}, },
clean: function () { clean: function () {
$('#title').html(''); $('#title').html('');
...@@ -286,13 +298,14 @@ function Page_Distrubion(socket) { ...@@ -286,13 +298,14 @@ function Page_Distrubion(socket) {
} }
} }
}, },
get: function () { get: function (force) {
if (Utils.check_view_file(view)) { if (Utils.check_view_file(view)) {
var query_data = {}; var query_data = {};
query_data.distribution = view.distribution; query_data.distribution = view.distribution;
query_data.package = view.package; query_data.package = view.package;
query_data.file = view.file; query_data.file = view.file;
query_data.file.content = null; query_data.file.content = null;
query_data.file.force = force;
// get a feedback to user while downloading file // get a feedback to user while downloading file
$('#file pre').html('Downloading file, please wait a while ...'); $('#file pre').html('Downloading file, please wait a while ...');
$('#file').show(); $('#file').show();
......
...@@ -45,7 +45,7 @@ aside .nav-pills li { ...@@ -45,7 +45,7 @@ aside .nav-pills li {
} }
#sidebar { #sidebar {
position: relative; position: relative;
} }
#sidebar .fixed { #sidebar .fixed {
...@@ -151,3 +151,8 @@ footer { ...@@ -151,3 +151,8 @@ footer {
border: none; border: none;
color: #101010; color: #101010;
} }
#title a.btn {
padding-right: 0;
float: right;
}
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