Added UpdateMechanismMessage to allow package maintainers provide custom message

This commit is contained in:
Taloth Saldono 2020-05-03 17:28:18 +02:00 committed by Qstick
parent ac37285be6
commit dbc784e94b
4 changed files with 16 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import { icons, kinds } from 'Helpers/Props';
import formatDate from 'Utilities/Date/formatDate';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import SpinnerButton from 'Components/Link/SpinnerButton';
import InlineMarkdown from 'Components/Markdown/InlineMarkdown';
import Icon from 'Components/Icon';
import Label from 'Components/Label';
import PageContent from 'Components/Page/PageContent';
@ -28,6 +29,7 @@ class Updates extends Component {
isInstallingUpdate,
updateMechanism,
isDocker,
updateMechanismMessage,
shortDateFormat,
onInstallLatestPress
} = this.props;
@ -38,10 +40,11 @@ class Updates extends Component {
const hasUpdateToInstall = hasUpdates && _.some(items, { installable: true, latest: true });
const noUpdateToInstall = hasUpdates && !hasUpdateToInstall;
const externalUpdaterPrefix = 'Unable to update Radarr directly,';
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'
external: 'Radarr is configured to use an external update mechanism',
apt: 'use apt to install the update',
docker: 'update the docker container to receive the update'
};
return (
@ -79,7 +82,7 @@ class Updates extends Component {
/>
<div className={styles.message}>
{externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external}
{externalUpdaterPrefix} <InlineMarkdown data={updateMechanismMessage || externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external} />
</div>
</Fragment>
}
@ -212,6 +215,7 @@ Updates.propTypes = {
isInstallingUpdate: PropTypes.bool.isRequired,
isDocker: PropTypes.bool.isRequired,
updateMechanism: PropTypes.string,
updateMechanismMessage: PropTypes.string,
shortDateFormat: PropTypes.string.isRequired,
onInstallLatestPress: PropTypes.func.isRequired
};

View File

@ -14,6 +14,7 @@ import Updates from './Updates';
function createMapStateToProps() {
return createSelector(
(state) => state.app.version,
createSystemStatusSelector(),
(state) => state.system.updates,
(state) => state.settings.general,
createUISettingsSelector(),
@ -21,6 +22,7 @@ function createMapStateToProps() {
createCommandExecutingSelector(commandNames.APPLICATION_UPDATE),
(
currentVersion,
status,
updates,
generalSettings,
uiSettings,
@ -45,6 +47,7 @@ function createMapStateToProps() {
isInstallingUpdate,
isDocker: systemStatus.isDocker,
updateMechanism: generalSettings.item.updateMechanism,
updateMechanismMessage: status.packageUpdateMechanismMessage,
shortDateFormat: uiSettings.shortDateFormat
};
}

View File

@ -14,6 +14,7 @@ namespace NzbDrone.Core.Configuration
string PackageAuthor { get; }
string PackageBranch { get; }
UpdateMechanism PackageUpdateMechanism { get; }
string PackageUpdateMechanismMessage { get; }
string ReleaseVersion { get; }
string ReleaseBranch { get; }
@ -41,6 +42,7 @@ namespace NzbDrone.Core.Configuration
PackageVersion = ReadValue(data, "PackageVersion");
PackageAuthor = ReadValue(data, "PackageAuthor");
PackageUpdateMechanism = ReadEnumValue(data, "UpdateMethod", UpdateMechanism.BuiltIn);
PackageUpdateMechanismMessage = ReadValue(data, "UpdateMethodMessage");
PackageBranch = ReadValue(data, "Branch");
ReleaseVersion = ReadValue(data, "ReleaseVersion");
@ -94,6 +96,7 @@ namespace NzbDrone.Core.Configuration
public string PackageAuthor { get; private set; }
public string PackageBranch { get; private set; }
public UpdateMechanism PackageUpdateMechanism { get; private set; }
public string PackageUpdateMechanismMessage { get; private set; }
public string ReleaseVersion { get; private set; }
public string ReleaseBranch { get; set; }

View File

@ -77,7 +77,8 @@ namespace Radarr.Api.V3.System
StartTime = _runtimeInfo.StartTime,
PackageVersion = _deploymentInfoProvider.PackageVersion,
PackageAuthor = _deploymentInfoProvider.PackageAuthor,
PackageUpdateMechanism = _deploymentInfoProvider.PackageUpdateMechanism
PackageUpdateMechanism = _deploymentInfoProvider.PackageUpdateMechanism,
PackageUpdateMechanismMessage = _deploymentInfoProvider.PackageUpdateMechanismMessage
};
}