2018-11-23 07:04:42 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
import FieldSet from 'Components/FieldSet';
|
|
|
|
import FormGroup from 'Components/Form/FormGroup';
|
|
|
|
import FormInputGroup from 'Components/Form/FormInputGroup';
|
2020-07-28 18:47:25 +00:00
|
|
|
import FormLabel from 'Components/Form/FormLabel';
|
|
|
|
import { inputTypes, sizes } from 'Helpers/Props';
|
|
|
|
import titleCase from 'Utilities/String/titleCase';
|
2020-07-08 14:40:53 +00:00
|
|
|
import translate from 'Utilities/String/translate';
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
function UpdateSettings(props) {
|
|
|
|
const {
|
|
|
|
advancedSettings,
|
|
|
|
settings,
|
2019-10-14 21:42:30 +00:00
|
|
|
isWindows,
|
2020-04-03 02:25:09 +00:00
|
|
|
packageUpdateMechanism,
|
2018-11-23 07:04:42 +00:00
|
|
|
onInputChange
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
const {
|
|
|
|
branch,
|
|
|
|
updateAutomatically,
|
|
|
|
updateMechanism,
|
|
|
|
updateScriptPath
|
|
|
|
} = settings;
|
|
|
|
|
|
|
|
if (!advancedSettings) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-04-03 02:25:09 +00:00
|
|
|
const usingExternalUpdateMechanism = packageUpdateMechanism !== 'builtIn';
|
|
|
|
|
|
|
|
const updateOptions = [];
|
|
|
|
|
|
|
|
if (usingExternalUpdateMechanism) {
|
|
|
|
updateOptions.push({
|
|
|
|
key: packageUpdateMechanism,
|
|
|
|
value: titleCase(packageUpdateMechanism)
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
updateOptions.push({ key: 'builtIn', value: 'Built-In' });
|
|
|
|
}
|
|
|
|
|
|
|
|
updateOptions.push({ key: 'script', value: 'Script' });
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
return (
|
2020-07-08 14:40:53 +00:00
|
|
|
<FieldSet legend={translate('Updates')}>
|
2018-11-23 07:04:42 +00:00
|
|
|
<FormGroup
|
|
|
|
advancedSettings={advancedSettings}
|
|
|
|
isAdvanced={true}
|
|
|
|
>
|
2020-08-29 03:56:13 +00:00
|
|
|
<FormLabel>{translate('Branch')}</FormLabel>
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.TEXT}
|
|
|
|
name="branch"
|
2020-09-01 03:41:20 +00:00
|
|
|
helpText={usingExternalUpdateMechanism ? translate('BranchUpdateMechanism') : translate('BranchUpdate')}
|
2020-11-12 22:54:27 +00:00
|
|
|
helpLink="https://wiki.servarr.com/Radarr_Settings#Updates"
|
2018-11-23 07:04:42 +00:00
|
|
|
{...branch}
|
2020-04-03 02:25:09 +00:00
|
|
|
onChange={onInputChange}
|
|
|
|
readOnly={usingExternalUpdateMechanism}
|
2018-11-23 07:04:42 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
|
|
|
|
{
|
2019-10-14 21:42:30 +00:00
|
|
|
!isWindows &&
|
2019-12-07 02:38:58 +00:00
|
|
|
<div>
|
|
|
|
<FormGroup
|
|
|
|
advancedSettings={advancedSettings}
|
|
|
|
isAdvanced={true}
|
|
|
|
size={sizes.MEDIUM}
|
|
|
|
>
|
2020-08-29 03:56:13 +00:00
|
|
|
<FormLabel>{translate('Automatic')}</FormLabel>
|
2018-11-23 07:04:42 +00:00
|
|
|
|
2019-12-07 02:38:58 +00:00
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.CHECK}
|
|
|
|
name="updateAutomatically"
|
2020-08-29 03:56:13 +00:00
|
|
|
helpText={translate('UpdateAutomaticallyHelpText')}
|
2019-12-07 02:38:58 +00:00
|
|
|
onChange={onInputChange}
|
|
|
|
{...updateAutomatically}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
<FormGroup
|
|
|
|
advancedSettings={advancedSettings}
|
|
|
|
isAdvanced={true}
|
|
|
|
>
|
2020-08-29 03:56:13 +00:00
|
|
|
<FormLabel>{translate('Mechanism')}</FormLabel>
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
<FormInputGroup
|
2019-12-07 02:38:58 +00:00
|
|
|
type={inputTypes.SELECT}
|
|
|
|
name="updateMechanism"
|
|
|
|
values={updateOptions}
|
2020-08-29 03:56:13 +00:00
|
|
|
helpText={translate('UpdateMechanismHelpText')}
|
2020-11-12 22:54:27 +00:00
|
|
|
helpLink="https://wiki.servarr.com/Radarr_Settings#Updates"
|
2018-11-23 07:04:42 +00:00
|
|
|
onChange={onInputChange}
|
2019-12-07 02:38:58 +00:00
|
|
|
{...updateMechanism}
|
2018-11-23 07:04:42 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2019-12-07 02:38:58 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
updateMechanism.value === 'script' &&
|
|
|
|
<FormGroup
|
|
|
|
advancedSettings={advancedSettings}
|
|
|
|
isAdvanced={true}
|
|
|
|
>
|
2020-08-29 03:56:13 +00:00
|
|
|
<FormLabel>{translate('ScriptPath')}</FormLabel>
|
2019-12-07 02:38:58 +00:00
|
|
|
|
|
|
|
<FormInputGroup
|
|
|
|
type={inputTypes.TEXT}
|
|
|
|
name="updateScriptPath"
|
2020-08-29 03:56:13 +00:00
|
|
|
helpText={translate('UpdateScriptPathHelpText')}
|
2019-12-07 02:38:58 +00:00
|
|
|
onChange={onInputChange}
|
|
|
|
{...updateScriptPath}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
}
|
|
|
|
</div>
|
2018-11-23 07:04:42 +00:00
|
|
|
}
|
|
|
|
</FieldSet>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateSettings.propTypes = {
|
|
|
|
advancedSettings: PropTypes.bool.isRequired,
|
|
|
|
settings: PropTypes.object.isRequired,
|
2019-10-14 21:42:30 +00:00
|
|
|
isWindows: PropTypes.bool.isRequired,
|
2020-04-03 02:25:09 +00:00
|
|
|
packageUpdateMechanism: PropTypes.string.isRequired,
|
2018-11-23 07:04:42 +00:00
|
|
|
onInputChange: PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
export default UpdateSettings;
|