2016-07-22 12:48:47 -07:00
|
|
|
|
define(['datetime', 'listViewStyle'], function (datetime) {
|
2016-10-22 22:11:46 -07:00
|
|
|
|
'use strict';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-03-27 20:37:33 -07:00
|
|
|
|
return function (view, params) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-03-27 20:37:33 -07:00
|
|
|
|
view.querySelector('#chkDebugLog').addEventListener('change', function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-03-27 20:37:33 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
|
|
|
|
|
|
config.EnableDebugLevelLogging = view.querySelector('#chkDebugLog').checked;
|
|
|
|
|
|
|
|
|
|
ApiClient.updateServerConfiguration(config);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
view.addEventListener('viewbeforeshow', function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
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 = '';
|
2016-07-22 12:48:47 -07:00
|
|
|
|
logHtml += '<div class="listItem">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
logHtml += '<a item-icon class="clearLink" href="' + logUrl + '" target="_blank">';
|
2016-07-22 12:48:47 -07:00
|
|
|
|
logHtml += '<i class="md-icon listItemIcon">schedule</i>';
|
2016-02-07 14:16:02 -07:00
|
|
|
|
logHtml += "</a>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
logHtml += '<div class="listItemBody two-line">';
|
2016-02-07 14:16:02 -07:00
|
|
|
|
logHtml += '<a class="clearLink" href="' + logUrl + '" target="_blank">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
logHtml += "<h3 class='listItemBodyText'>" + log.Name + "</h3>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-05-05 21:50:06 -07:00
|
|
|
|
var date = datetime.parseISO8601Date(log.DateModified, true);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-09-16 05:21:22 -07:00
|
|
|
|
var text = datetime.toLocaleDateString(date);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-05-05 19:55:15 -07:00
|
|
|
|
text += ' ' + datetime.getDisplayTime(date);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-08-05 12:34:10 -07:00
|
|
|
|
logHtml += '<div class="listItemBodyText secondary">' + text + '</div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-02-07 14:16:02 -07:00
|
|
|
|
logHtml += "</a>";
|
2016-07-22 12:48:47 -07:00
|
|
|
|
logHtml += '</div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-07-22 12:48:47 -07:00
|
|
|
|
logHtml += '</div>';
|
2016-02-07 14:16:02 -07:00
|
|
|
|
|
|
|
|
|
return logHtml;
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.join('');
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2016-07-22 12:48:47 -07:00
|
|
|
|
view.querySelector('.serverLogs').innerHTML = html;
|
2016-02-07 14:48:08 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2016-03-27 20:37:33 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
apiClient.getServerConfiguration().then(function (config) {
|
2016-02-07 14:16:02 -07:00
|
|
|
|
|
2016-03-27 20:37:33 -07:00
|
|
|
|
view.querySelector('#chkDebugLog').checked = config.EnableDebugLevelLogging;
|
2016-02-07 14:16:02 -07:00
|
|
|
|
});
|
2014-07-03 19:22:57 -07:00
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-03-27 20:37:33 -07:00
|
|
|
|
};
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|