Commit 270be602 authored by Leo Iannacone's avatar Leo Iannacone

handle new file size when receive package info event

parent 5738ae54
...@@ -270,8 +270,8 @@ function Page_Distrubion(socket) { ...@@ -270,8 +270,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 +286,7 @@ function Page_Distrubion(socket) { ...@@ -286,7 +286,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 +297,7 @@ function Page_Distrubion(socket) { ...@@ -297,7 +297,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 +338,13 @@ function Page_Distrubion(socket) { ...@@ -338,8 +338,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 +372,15 @@ function Page_Distrubion(socket) { ...@@ -367,11 +372,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);
}
} }
} }
......
...@@ -141,6 +141,22 @@ footer .info { ...@@ -141,6 +141,22 @@ footer .info {
margin-top: -3px; margin-top: -3px;
} }
#files .size {
margin: 0 8px;
font-size: 70%;
color: rgba(0,0,0,0.3);
float: right;
}
#logs .size {
float: 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