jellyfin-web/dashboard-ui/scripts/logpage.js

53 lines
1.2 KiB
JavaScript
Raw Normal View History

(function () {
2013-02-20 18:33:05 -07:00
$(document).on('pagebeforeshow', "#logPage", function () {
2013-02-20 18:33:05 -07:00
2013-11-30 11:32:39 -07:00
var page = this;
2013-02-20 18:33:05 -07:00
2014-11-14 19:31:03 -07:00
var apiClient = ApiClient;
apiClient.getJSON(apiClient.getUrl('System/Logs')).done(function (logs) {
2013-02-20 18:33:05 -07:00
var html = '';
2013-02-20 18:33:05 -07:00
html += '<ul data-role="listview" data-inset="true">';
2013-02-20 18:33:05 -07:00
html += logs.map(function (log) {
2013-11-30 11:32:39 -07:00
2014-11-14 19:31:03 -07:00
var logUrl = apiClient.getUrl('System/Logs/Log', {
name: log.Name
});
2014-11-14 19:31:03 -07:00
logUrl += "&api_key=" + apiClient.accessToken();
var logHtml = '<li><a href="' + logUrl + '" target="_blank">';
2013-11-30 11:32:39 -07:00
logHtml += '<h3>';
logHtml += log.Name;
logHtml += '</h3>';
2013-02-20 18:33:05 -07:00
var date = parseISO8601Date(log.DateModified, { toLocal: true });
2013-02-20 18:33:05 -07:00
var text = date.toLocaleDateString();
2013-02-20 18:33:05 -07:00
text += ' ' + LiveTvHelpers.getDisplayTime(date);
2013-02-20 18:33:05 -07:00
logHtml += '<p>' + text + '</p>';
2013-02-20 18:33:05 -07:00
logHtml += '</li>';
2013-02-20 18:33:05 -07:00
return logHtml;
2013-02-20 18:33:05 -07:00
})
.join('');
2013-02-20 18:33:05 -07:00
html += '</ul>';
2013-02-20 18:33:05 -07:00
$('.serverLogs', page).html(html).trigger('create');
2013-02-20 18:33:05 -07:00
});
2013-02-20 18:33:05 -07:00
});
2013-02-20 18:33:05 -07:00
})();