New: Set Branch, Update Mech from PackageInfo

This commit is contained in:
Qstick
2020-04-02 22:25:09 -04:00
parent 16d6fd90a9
commit 0a1eb877e0
8 changed files with 270 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import titleCase from 'Utilities/String/titleCase';
import { inputTypes, sizes } from 'Helpers/Props';
import FieldSet from 'Components/FieldSet';
import FormGroup from 'Components/Form/FormGroup';
@@ -11,6 +12,7 @@ function UpdateSettings(props) {
advancedSettings,
settings,
isWindows,
packageUpdateMechanism,
onInputChange
} = props;
@@ -25,10 +27,20 @@ function UpdateSettings(props) {
return null;
}
const updateOptions = [
{ key: 'builtIn', value: 'Built-In' },
{ key: 'script', value: 'Script' }
];
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' });
return (
<FieldSet legend="Updates">
@@ -41,10 +53,11 @@ function UpdateSettings(props) {
<FormInputGroup
type={inputTypes.TEXT}
name="branch"
helpText="Branch to use to update Radarr"
helpText={usingExternalUpdateMechanism ? 'Branch used by external update mechanism' : 'Branch to use to update Radarr'}
helpLink="https://github.com/Radarr/Radarr/wiki/Release-Branches"
onChange={onInputChange}
{...branch}
onChange={onInputChange}
readOnly={usingExternalUpdateMechanism}
/>
</FormGroup>
@@ -111,6 +124,7 @@ UpdateSettings.propTypes = {
advancedSettings: PropTypes.bool.isRequired,
settings: PropTypes.object.isRequired,
isWindows: PropTypes.bool.isRequired,
packageUpdateMechanism: PropTypes.string.isRequired,
onInputChange: PropTypes.func.isRequired
};

View File

@@ -15,6 +15,8 @@ class About extends Component {
render() {
const {
version,
packageVersion,
packageAuthor,
isNetCore,
isMono,
isDocker,
@@ -36,6 +38,14 @@ class About extends Component {
data={version}
/>
{
packageVersion &&
<DescriptionListItem
title="Package Version"
data={(packageAuthor ? `${packageVersion} by ${packageAuthor}` : packageVersion)}
/>
}
{
isMono &&
<DescriptionListItem
@@ -99,6 +109,8 @@ class About extends Component {
About.propTypes = {
version: PropTypes.string.isRequired,
packageVersion: PropTypes.string,
packageAuthor: PropTypes.string,
isNetCore: PropTypes.bool.isRequired,
isMono: PropTypes.bool.isRequired,
runtimeVersion: PropTypes.string.isRequired,

View File

@@ -1,6 +1,6 @@
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import React, { Component, Fragment } from 'react';
import { icons, kinds } from 'Helpers/Props';
import formatDate from 'Utilities/Date/formatDate';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
@@ -26,6 +26,7 @@ class Updates extends Component {
generalSettingsError,
items,
isInstallingUpdate,
updateMechanism,
isDocker,
shortDateFormat,
onInstallLatestPress
@@ -37,6 +38,12 @@ class Updates extends Component {
const hasUpdateToInstall = hasUpdates && _.some(items, { installable: true, latest: true });
const noUpdateToInstall = hasUpdates && !hasUpdateToInstall;
const externalUpdaterMessages = {
external: 'Unable to update Radarr directly, Radarr is configured to use an external update mechanism',
apt: 'Unable to update Radarr directly, use apt to install the update',
docker: 'Unable to update Radarr directly, update the docker container to receive the update'
};
return (
<PageContent title="Updates">
<PageContentBodyConnector>
@@ -52,9 +59,9 @@ class Updates extends Component {
{
hasUpdateToInstall &&
<div className={styles.updateAvailable}>
<div className={styles.messageContainer}>
{
!isDocker &&
(updateMechanism === 'builtIn' || updateMechanism === 'script') && !isDocker ?
<SpinnerButton
className={styles.updateAvailable}
kind={kinds.PRIMARY}
@@ -62,14 +69,19 @@ class Updates extends Component {
onPress={onInstallLatestPress}
>
Install Latest
</SpinnerButton>
}
</SpinnerButton> :
{
isDocker &&
<div className={styles.upToDateMessage}>
An update is available. Please update your Docker image and re-create the container.
</div>
<Fragment>
<Icon
name={icons.WARNING}
kind={kinds.WARNING}
size={30}
/>
<div className={styles.message}>
{externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external}
</div>
</Fragment>
}
{