From fd2fb7da20114ae0de7c0818d44d4189eba8ffa7 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 4 Aug 2019 21:42:06 -0400 Subject: [PATCH] New: Extra warning for Windows Service issues when prompted to restart --- .../src/Settings/General/GeneralSettings.js | 35 ++++++++++--------- .../General/GeneralSettingsConnector.js | 3 +- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/frontend/src/Settings/General/GeneralSettings.js b/frontend/src/Settings/General/GeneralSettings.js index 66ad32375..485763610 100644 --- a/frontend/src/Settings/General/GeneralSettings.js +++ b/frontend/src/Settings/General/GeneralSettings.js @@ -16,6 +16,19 @@ import ProxySettings from './ProxySettings'; import SecuritySettings from './SecuritySettings'; import UpdateSettings from './UpdateSettings'; +const requiresRestartKeys = [ + 'bindAddress', + 'port', + 'urlBase', + 'enableSsl', + 'sslPort', + 'sslCertHash', + 'authenticationMethod', + 'username', + 'password', + 'apiKey' +]; + class GeneralSettings extends Component { // @@ -42,20 +55,7 @@ class GeneralSettings extends Component { const prevSettings = prevProps.settings; - const keys = [ - 'bindAddress', - 'port', - 'urlBase', - 'enableSsl', - 'sslPort', - 'sslCertHash', - 'authenticationMethod', - 'username', - 'password', - 'apiKey' - ]; - - const pendingRestart = _.some(keys, (key) => { + const pendingRestart = _.some(requiresRestartKeys, (key) => { const setting = settings[key]; const prevSetting = prevSettings[key]; @@ -98,6 +98,7 @@ class GeneralSettings extends Component { isResettingApiKey, isMono, isWindows, + isWindowsService, isDocker, mode, onInputChange, @@ -171,7 +172,6 @@ class GeneralSettings extends Component { settings={settings} onInputChange={onInputChange} /> - } @@ -180,7 +180,9 @@ class GeneralSettings extends Component { isOpen={this.state.isRestartRequiredModalOpen} kind={kinds.DANGER} title="Restart Lidarr" - message="Lidarr requires a restart to apply changes, do you want to restart now?" + message={ + `Lidarr requires a restart to apply changes, do you want to restart now? ${isWindowsService ? 'Depending which user is running the Lidarr service you may need to restart Lidarr as admin once before the service will start automatically.' : ''}` + } cancelLabel="I'll restart later" confirmLabel="Restart Now" onConfirm={this.onConfirmRestart} @@ -204,6 +206,7 @@ GeneralSettings.propTypes = { hasSettings: PropTypes.bool.isRequired, isMono: PropTypes.bool.isRequired, isWindows: PropTypes.bool.isRequired, + isWindowsService: PropTypes.bool.isRequired, isDocker: PropTypes.bool.isRequired, mode: PropTypes.string.isRequired, onInputChange: PropTypes.func.isRequired, diff --git a/frontend/src/Settings/General/GeneralSettingsConnector.js b/frontend/src/Settings/General/GeneralSettingsConnector.js index 73eb63fd5..1c64b5724 100644 --- a/frontend/src/Settings/General/GeneralSettingsConnector.js +++ b/frontend/src/Settings/General/GeneralSettingsConnector.js @@ -26,6 +26,7 @@ function createMapStateToProps() { isResettingApiKey, isMono: systemStatus.isMono, isWindows: systemStatus.isWindows, + isWindowsService: systemStatus.isWindows && systemStatus.mode === 'service', isDocker: systemStatus.isDocker, mode: systemStatus.mode, ...sectionSettings @@ -59,7 +60,7 @@ class GeneralSettingsConnector extends Component { } componentWillUnmount() { - this.props.clearPendingChanges({ section: 'settings.general' }); + this.props.clearPendingChanges({ section: `settings.${SECTION}` }); } //