From 012e55ebf87559f2d782e5400fb885df8b80a445 Mon Sep 17 00:00:00 2001 From: kytwb <412895+kytwb@users.noreply.github.com> Date: Fri, 23 Jul 2021 10:04:43 +0100 Subject: Fix hibernation mode (#1486) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use hibernation strategy from settings instead of hardcoded 5 minutes * Fix conditions with isHibernationEnabled, previously disableHibernation * Make service hibernation obey global setting Also refactors hibernation to move some hibernation enablement logic into the Service model * Remove global hibernation enable switch Implements option 4 from https://github.com/getferdi/ferdi/pull/1486#issuecomment-860290992 according to https://github.com/getferdi/ferdi/pull/1486#issuecomment-876558694 * Implements #865 : Add 'hibernate service' and 'wake up service' in the sidebar context menu. * Removed 'hibernationEnabled' check on main settings screen Since this is an (imo) incongruous behavior for the first time user. They will see a message, but with no ability to choose the hibernation strategy. * Autogenerated files from conflict fixes Co-authored-by: Kristóf Marussy Co-authored-by: Vijay A --- src/components/settings/services/EditServiceForm.js | 14 ++++---------- src/components/settings/settings/EditSettingsForm.js | 11 ++--------- 2 files changed, 6 insertions(+), 19 deletions(-) (limited to 'src/components/settings') diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 0f7c29de5..56e5f9c94 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js @@ -145,7 +145,6 @@ export default @observer class EditServiceForm extends Component { isSaving: PropTypes.bool.isRequired, isDeleting: PropTypes.bool.isRequired, isProxyFeatureEnabled: PropTypes.bool.isRequired, - isHibernationFeatureActive: PropTypes.bool.isRequired, }; static defaultProps = { @@ -208,7 +207,6 @@ export default @observer class EditServiceForm extends Component { onDelete, openRecipeFile, isProxyFeatureEnabled, - isHibernationFeatureActive, } = this.props; const { intl } = this.context; @@ -341,14 +339,10 @@ export default @observer class EditServiceForm extends Component {

{intl.formatMessage(messages.headlineGeneral)}

- {isHibernationFeatureActive && ( - <> - -

- {intl.formatMessage(messages.isHibernationEnabledInfo)} -

- - )} + +

+ {intl.formatMessage(messages.isHibernationEnabledInfo)} +

{form.$('isDarkModeEnabled').value && ( diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index a8ba8748d..d2a9eb6e0 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js @@ -171,7 +171,6 @@ export default @observer class EditSettingsForm extends Component { isTodosActivated: PropTypes.bool.isRequired, isWorkspaceEnabled: PropTypes.bool.isRequired, automaticUpdates: PropTypes.bool.isRequired, - hibernationEnabled: PropTypes.bool.isRequired, isDarkmodeEnabled: PropTypes.bool.isRequired, isAdaptableDarkModeEnabled: PropTypes.bool.isRequired, isNightlyEnabled: PropTypes.bool.isRequired, @@ -225,7 +224,6 @@ export default @observer class EditSettingsForm extends Component { isTodosEnabled, isWorkspaceEnabled, automaticUpdates, - hibernationEnabled, isDarkmodeEnabled, isTodosActivated, isNightlyEnabled, @@ -336,13 +334,8 @@ export default @observer class EditSettingsForm extends Component {
- - {hibernationEnabled && ( - <> - +