2013-04-23 12:17:21 -07:00
|
|
|
|
(function ($, document, window) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-23 12:17:21 -07:00
|
|
|
|
function loadPage(page, config, systemInfo) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-09-30 08:15:47 -07:00
|
|
|
|
var os = systemInfo.OperatingSystem.toLowerCase();
|
2013-12-14 18:17:57 -07:00
|
|
|
|
|
2013-09-30 08:15:47 -07:00
|
|
|
|
if (os.indexOf('windows') != -1) {
|
|
|
|
|
$('#windowsStartupDescription', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#windowsStartupDescription', page).hide();
|
|
|
|
|
}
|
2014-09-22 14:56:54 -07:00
|
|
|
|
|
2014-01-05 18:59:21 -07:00
|
|
|
|
if (systemInfo.SupportsAutoRunAtStartup) {
|
|
|
|
|
$('#fldRunAtStartup', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#fldRunAtStartup', page).hide();
|
|
|
|
|
}
|
2015-07-13 14:26:11 -07:00
|
|
|
|
|
|
|
|
|
if (systemInfo.CanSelfUpdate) {
|
|
|
|
|
$('.fldAutomaticUpdates', page).show();
|
2015-09-13 16:16:33 -07:00
|
|
|
|
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevel'));
|
2015-07-13 14:26:11 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('.fldAutomaticUpdates', page).hide();
|
2015-09-13 16:16:33 -07:00
|
|
|
|
$('.lnlAutomaticUpdateLevel', page).html(Globalize.translate('LabelAutomaticUpdateLevelForPlugins'));
|
2015-07-13 14:26:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-16 10:39:09 -07:00
|
|
|
|
$('#chkEnableAutomaticServerUpdates', page).checked(config.EnableAutoUpdate);
|
|
|
|
|
$('#chkEnableAutomaticRestart', page).checked(config.EnableAutomaticRestart);
|
2016-03-02 22:17:00 -07:00
|
|
|
|
$('#chkUsageData', page).checked(config.EnableAnonymousUsageReporting);
|
2014-01-11 13:13:18 -07:00
|
|
|
|
|
|
|
|
|
if (systemInfo.CanSelfRestart) {
|
|
|
|
|
$('#fldEnableAutomaticRestart', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#fldEnableAutomaticRestart', page).hide();
|
|
|
|
|
}
|
2013-12-14 18:17:57 -07:00
|
|
|
|
|
2015-09-03 10:01:51 -07:00
|
|
|
|
$('#selectAutomaticUpdateLevel', page).val(config.SystemUpdateLevel).trigger('change');
|
2016-02-16 10:39:09 -07:00
|
|
|
|
$('#chkDebugLog', page).checked(config.EnableDebugLevelLogging);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-02-16 10:39:09 -07:00
|
|
|
|
$('#chkRunAtStartup', page).checked(config.RunAtStartup);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2016-02-16 10:39:09 -07:00
|
|
|
|
$('#chkEnableDashboardResponseCache', page).checked(config.EnableDashboardResponseCaching);
|
|
|
|
|
$('#chkEnableMinification', page).checked(config.EnableDashboardResourceMinification);
|
2015-01-17 22:45:10 -07:00
|
|
|
|
$('#txtDashboardSourcePath', page).val(config.DashboardSourcePath).trigger('change');
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2013-04-23 12:17:21 -07:00
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-05-14 10:16:29 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
2015-05-14 10:16:29 -07:00
|
|
|
|
|
|
|
|
|
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
|
|
|
|
|
|
|
|
|
|
config.RunAtStartup = $('#chkRunAtStartup', form).checked();
|
|
|
|
|
config.SystemUpdateLevel = $('#selectAutomaticUpdateLevel', form).val();
|
|
|
|
|
config.EnableAutomaticRestart = $('#chkEnableAutomaticRestart', form).checked();
|
2015-07-13 14:26:11 -07:00
|
|
|
|
config.EnableAutoUpdate = $('#chkEnableAutomaticServerUpdates', form).checked();
|
2016-03-02 22:17:00 -07:00
|
|
|
|
config.EnableAnonymousUsageReporting = $('#chkUsageData', form).checked();
|
2015-05-14 10:16:29 -07:00
|
|
|
|
|
|
|
|
|
config.EnableDashboardResourceMinification = $('#chkEnableMinification', form).checked();
|
|
|
|
|
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
|
|
|
|
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
2015-05-14 10:16:29 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
$(document).on('pageshow', "#advancedConfigurationPage", function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2013-04-23 12:17:21 -07:00
|
|
|
|
var page = this;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-23 12:17:21 -07:00
|
|
|
|
var promise1 = ApiClient.getServerConfiguration();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-04-23 12:17:21 -07:00
|
|
|
|
var promise2 = ApiClient.getSystemInfo();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
Promise.all([promise1, promise2]).then(function (responses) {
|
2013-04-23 12:17:21 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
loadPage(page, responses[0], responses[1]);
|
2013-04-23 12:17:21 -07:00
|
|
|
|
|
|
|
|
|
});
|
2013-12-14 18:17:57 -07:00
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
}).on('pageinit', "#advancedConfigurationPage", function () {
|
2013-09-04 11:26:32 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#selectAutomaticUpdateLevel', page).on('change', function () {
|
|
|
|
|
|
|
|
|
|
if (this.value == "Dev") {
|
|
|
|
|
$('#devBuildWarning', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('#devBuildWarning', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
2013-12-14 18:17:57 -07:00
|
|
|
|
|
2015-01-17 22:45:10 -07:00
|
|
|
|
$('#btnSelectDashboardSourcePath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2015-01-17 22:45:10 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2015-01-17 22:45:10 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
picker.show({
|
2015-01-17 22:45:10 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
callback: function (path) {
|
|
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtDashboardSourcePath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
2015-01-17 22:45:10 -07:00
|
|
|
|
}
|
2015-10-13 12:22:45 -07:00
|
|
|
|
});
|
2015-01-17 22:45:10 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-05-14 10:16:29 -07:00
|
|
|
|
$('.advancedConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
|
2013-04-23 12:17:21 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})(jQuery, document, window);
|