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

64 lines
1.9 KiB
JavaScript
Raw Normal View History

(function () {
2013-02-20 18:33:05 -07:00
2015-09-24 10:08:10 -07:00
$(document).on('pageshow', "#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
2016-02-07 14:16:02 -07:00
require(['paper-fab', 'paper-progress', 'paper-item-body', 'paper-icon-item'], function () {
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
var apiClient = ApiClient;
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
apiClient.getJSON(apiClient.getUrl('System/Logs')).then(function (logs) {
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
var html = '';
2013-11-30 11:32:39 -07:00
2016-02-07 14:16:02 -07:00
html += '<div class="paperList">';
2014-11-14 19:31:03 -07:00
2016-02-07 14:16:02 -07:00
html += logs.map(function (log) {
2014-11-14 19:31:03 -07:00
2016-02-07 14:16:02 -07:00
var logUrl = apiClient.getUrl('System/Logs/Log', {
name: log.Name
});
2013-11-30 11:32:39 -07:00
2016-02-07 14:16:02 -07:00
logUrl += "&api_key=" + apiClient.accessToken();
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
var logHtml = '';
logHtml += '<paper-icon-item>';
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += '<a item-icon class="clearLink" href="' + logUrl + '" target="_blank">';
logHtml += '<paper-fab mini icon="schedule" class="blue" item-icon></paper-fab>';
logHtml += "</a>";
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += '<paper-item-body two-line>';
logHtml += '<a class="clearLink" href="' + logUrl + '" target="_blank">';
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += "<div>" + log.Name + "</div>";
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
var date = parseISO8601Date(log.DateModified, { toLocal: true });
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
var text = date.toLocaleDateString();
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
text += ' ' + LibraryBrowser.getDisplayTime(date);
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += '<div secondary>' + text + '</div>';
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += "</a>";
logHtml += '</paper-item-body>';
2013-02-20 18:33:05 -07:00
2016-02-07 14:16:02 -07:00
logHtml += '</paper-icon-item>';
return logHtml;
})
.join('');
html += '</div>';
$('.serverLogs', page).html(html).trigger('create');
});
});
});
2013-02-20 18:33:05 -07:00
})();