Commit bb1eba1d authored by Leo Iannacone's avatar Leo Iannacone

set url to distribution and package in history page - add className to success column

parent dc527ee3
...@@ -13,13 +13,6 @@ function Page_Generic() { ...@@ -13,13 +13,6 @@ function Page_Generic() {
return result; return result;
} }
function __get_status_html_href(status_data) {
var result = config.paths.distribution + '#' + status_data.distribution;
if (status_data.hasOwnProperty('package'))
result += '/' + status_data.package.replace('_', '/') + '/buildlog';
return result;
}
function __get_status_html_title(status_data) { function __get_status_html_title(status_data) {
var result = status_data.status + ': ' + status_data.distribution; var result = status_data.status + ': ' + status_data.distribution;
if (status_data.hasOwnProperty('package')) if (status_data.hasOwnProperty('package'))
...@@ -43,7 +36,7 @@ function Page_Generic() { ...@@ -43,7 +36,7 @@ function Page_Generic() {
button.addClass('btn btn-xs'); button.addClass('btn btn-xs');
button.addClass(_s.status); button.addClass(_s.status);
button.attr('title', __get_status_html_title(_s)); button.attr('title', __get_status_html_title(_s));
button.attr('href', __get_status_html_href(_s)); button.attr('href', Utils.get_url_to_package(_s));
button.html(__get_status_html_inner(_s)); button.html(__get_status_html_inner(_s));
var info = Utils.get_status_icon_and_class(_s); var info = Utils.get_status_icon_and_class(_s);
button.addClass('btn-' + info.className); button.addClass('btn-' + info.className);
......
...@@ -7,16 +7,23 @@ ...@@ -7,16 +7,23 @@
/* global dom_history: false */ /* global dom_history: false */
function Page_History() { function Page_History() {
// init table // init table
for (var i = 0; i < dom_history.length; i++) { for (var i = 0; i < dom_history.length; i++) {
var p = dom_history[i]; var p = dom_history[i];
var info = Utils.get_status_icon_and_class(p);
var label = info.label || 'building';
var row = '<tr>'; var row = '<tr>';
row += '<td>' + p.distribution + '</td>'; var distribution_url = Utils.get_url_to_package({
row += '<td>' + p.package + '</td>'; 'distribution': p.distribution
});
var package_url = Utils.get_url_to_package(p);
row += '<td><a href="' + distribution_url + '">' + p.distribution + '</a></td>';
row += '<td><a href="' + package_url + '">' + p.package + '</td>';
row += '<td>' + p.uploader + '</td>'; row += '<td>' + p.uploader + '</td>';
row += '<td>' + Utils.format_time(p.start) + '</td>'; row += '<td>' + Utils.format_time(p.start) + '</td>';
row += '<td>' + Utils.format_time(p.end) + '</td>'; row += '<td>' + Utils.format_time(p.end) + '</td>';
row += '<td>' + p.status + '</td>'; row += '<td class="' + info.className + ' text-' + info.className + '">' + label + '</td>';
row += '</tr>'; row += '</tr>';
$('.table tbody').append(row); $('.table tbody').append(row);
} }
......
...@@ -58,13 +58,16 @@ var Utils = { ...@@ -58,13 +58,16 @@ var Utils = {
var _s = status_data; var _s = status_data;
var className = null; var className = null;
var icon = null; var icon = null;
var label = null;
if (_s.hasOwnProperty('success')) { if (_s.hasOwnProperty('success')) {
if (_s.success === true) { if (_s.success === true) {
className = _c.success; className = _c.success;
icon = _i.success; icon = _i.success;
label = 'success';
} else { } else {
className = _c.fail; className = _c.fail;
icon = _i.fail; icon = _i.fail;
label = 'fail';
} }
} else { } else {
className = _c[_s.status]; className = _c[_s.status];
...@@ -79,7 +82,8 @@ var Utils = { ...@@ -79,7 +82,8 @@ var Utils = {
return { return {
className: className, className: className,
icon: icon icon: icon,
label: label
}; };
}, },
...@@ -126,6 +130,14 @@ var Utils = { ...@@ -126,6 +130,14 @@ var Utils = {
var result_time = Utils.num_two_digits(date.getHours()) + ':' + Utils.num_two_digits(date.getMinutes()); var result_time = Utils.num_two_digits(date.getHours()) + ':' + Utils.num_two_digits(date.getMinutes());
if (time_in_bold) result_time = '<b>' + result_time + '</b>'; if (time_in_bold) result_time = '<b>' + result_time + '</b>';
return result_date + ' ' + result_time; return result_date + ' ' + result_time;
},
// get href url from status object
get_url_to_package: function (status_data) {
var result = config.paths.distribution + '#' + status_data.distribution;
if (status_data.hasOwnProperty('package'))
result += '/' + status_data.package.replace('_', '/') + '/buildlog';
return result;
} }
}; };
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