1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/advancedconfigurationpage.js

82 lines
2.4 KiB
JavaScript
Raw Normal View History

define(['jQuery'], function ($) {
2013-02-20 20:33:05 -05:00
2013-04-23 15:17:21 -04:00
function loadPage(page, config, systemInfo) {
2013-02-20 20:33:05 -05:00
2016-02-16 12:39:09 -05:00
$('#chkEnableDashboardResponseCache', page).checked(config.EnableDashboardResponseCaching);
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
2015-01-18 00:45:10 -05:00
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
2013-02-20 20:33:05 -05:00
Dashboard.hideLoadingMsg();
2013-04-23 15:17:21 -04:00
}
2013-02-20 20:33:05 -05:00
2015-05-14 13:16:29 -04:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
2015-12-14 10:43:03 -05:00
ApiClient.getServerConfiguration().then(function (config) {
2015-05-14 13:16:29 -04:00
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
2015-12-14 10:43:03 -05:00
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
2015-05-14 13:16:29 -04:00
});
// Disable default form submission
return false;
}
2015-09-24 13:08:10 -04:00
$(document).on('pageshow', "#advancedConfigurationPage", function () {
2013-02-20 20:33:05 -05:00
Dashboard.showLoadingMsg();
2013-04-23 15:17:21 -04:00
var page = this;
2013-02-20 20:33:05 -05:00
2013-04-23 15:17:21 -04:00
var promise1 = ApiClient.getServerConfiguration();
2013-02-20 20:33:05 -05:00
2013-04-23 15:17:21 -04:00
var promise2 = ApiClient.getSystemInfo();
2013-02-20 20:33:05 -05:00
2015-12-14 10:43:03 -05:00
Promise.all([promise1, promise2]).then(function (responses) {
2013-04-23 15:17:21 -04:00
2015-12-14 10:43:03 -05:00
loadPage(page, responses[0], responses[1]);
2013-04-23 15:17:21 -04:00
});
2013-12-14 20:17:57 -05:00
2015-09-01 10:01:59 -04:00
}).on('pageinit', "#advancedConfigurationPage", function () {
var page = this;
$('#selectAutomaticUpdateLevel', page).on('change', function () {
if (this.value == "Dev") {
$('#devBuildWarning', page).show();
} else {
$('#devBuildWarning', page).hide();
}
});
2013-12-14 20:17:57 -05:00
2015-01-18 00:45:10 -05:00
$('#btnSelectDashboardSourcePath', page).on("click.selectDirectory", function () {
2015-10-13 15:22:45 -04:00
require(['directorybrowser'], function (directoryBrowser) {
2015-01-18 00:45:10 -05:00
2015-10-13 15:22:45 -04:00
var picker = new directoryBrowser();
2015-01-18 00:45:10 -05:00
2015-10-13 15:22:45 -04:00
picker.show({
2015-01-18 00:45:10 -05:00
2015-10-13 15:22:45 -04:00
callback: function (path) {
if (path) {
$('#txtDashboardSourcePath', page).val(path);
}
picker.close();
2015-01-18 00:45:10 -05:00
}
2015-10-13 15:22:45 -04:00
});
2015-01-18 00:45:10 -05:00
});
});
2015-05-14 13:16:29 -04:00
$('.advancedConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
2013-04-23 15:17:21 -04:00
});
});