2020-08-14 08:46:34 +02:00
|
|
|
import datetime from '../../scripts/datetime';
|
|
|
|
import loading from '../../components/loading/loading';
|
2024-08-14 13:31:34 -04:00
|
|
|
import globalize from '../../lib/globalize';
|
2020-08-14 08:46:34 +02:00
|
|
|
import '../../elements/emby-button/emby-button';
|
2021-01-26 16:25:38 -05:00
|
|
|
import '../../components/listview/listview.scss';
|
2023-02-26 01:01:31 +02:00
|
|
|
import '../../styles/flexstyles.scss';
|
2022-04-10 02:22:13 -04:00
|
|
|
import Dashboard from '../../utils/dashboard';
|
2021-04-11 19:24:47 +02:00
|
|
|
import alert from '../../components/alert';
|
2020-06-06 17:04:16 +09:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
function onSubmit(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
loading.show();
|
|
|
|
const form = this;
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
|
|
|
config.EnableSlowResponseWarning = form.querySelector('#chkSlowResponseWarning').checked;
|
|
|
|
config.SlowResponseThresholdMs = form.querySelector('#txtSlowResponseWarning').value;
|
|
|
|
ApiClient.updateServerConfiguration(config).then(function() {
|
|
|
|
Dashboard.processServerConfigurationUpdateResult();
|
|
|
|
}, function () {
|
|
|
|
alert(globalize.translate('ErrorDefault'));
|
|
|
|
Dashboard.processServerConfigurationUpdateResult();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-06 17:04:16 +09:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
export default function(view) {
|
|
|
|
view.querySelector('.logsForm').addEventListener('submit', onSubmit);
|
|
|
|
view.addEventListener('viewbeforeshow', function() {
|
2021-04-11 18:44:53 +02:00
|
|
|
loading.show();
|
2023-04-19 01:56:05 -04:00
|
|
|
const apiClient = ApiClient;
|
|
|
|
apiClient.getJSON(apiClient.getUrl('System/Logs')).then(function(logs) {
|
|
|
|
let html = '';
|
|
|
|
html += '<div class="paperList">';
|
|
|
|
html += logs.map(function(log) {
|
|
|
|
let logUrl = apiClient.getUrl('System/Logs/Log', {
|
|
|
|
name: log.Name
|
|
|
|
});
|
|
|
|
logUrl += '&api_key=' + apiClient.accessToken();
|
|
|
|
let logHtml = '';
|
|
|
|
logHtml += '<a is="emby-linkbutton" href="' + logUrl + '" target="_blank" class="listItem listItem-border" style="color:inherit;">';
|
|
|
|
logHtml += '<div class="listItemBody two-line">';
|
|
|
|
logHtml += "<h3 class='listItemBodyText' dir='ltr' style='text-align: left'>" + log.Name + '</h3>';
|
|
|
|
const date = datetime.parseISO8601Date(log.DateModified, true);
|
|
|
|
let text = datetime.toLocaleDateString(date);
|
|
|
|
text += ' ' + datetime.getDisplayTime(date);
|
|
|
|
logHtml += '<div class="listItemBodyText secondary">' + text + '</div>';
|
|
|
|
logHtml += '</div>';
|
|
|
|
logHtml += '</a>';
|
|
|
|
return logHtml;
|
|
|
|
}).join('');
|
|
|
|
html += '</div>';
|
|
|
|
view.querySelector('.serverLogs').innerHTML = html;
|
2021-04-11 18:44:53 +02:00
|
|
|
});
|
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
apiClient.getServerConfiguration().then(function (config) {
|
|
|
|
view.querySelector('#chkSlowResponseWarning').checked = config.EnableSlowResponseWarning;
|
|
|
|
view.querySelector('#txtSlowResponseWarning').value = config.SlowResponseThresholdMs;
|
2019-04-24 23:59:44 -07:00
|
|
|
});
|
2020-06-06 17:04:16 +09:00
|
|
|
|
2023-04-19 01:56:05 -04:00
|
|
|
loading.hide();
|
|
|
|
});
|
|
|
|
}
|