mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-08 05:51:47 -07:00
Added UpdateMechanismMessage to allow package maintainers provide custom message
This commit is contained in:
parent
08b2aef5b7
commit
14e13217ba
4 changed files with 19 additions and 5 deletions
|
@ -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';
|
||||
|
@ -27,6 +28,7 @@ class Updates extends Component {
|
|||
isInstallingUpdate,
|
||||
updateMechanism,
|
||||
isDocker,
|
||||
updateMechanismMessage,
|
||||
shortDateFormat,
|
||||
onInstallLatestPress
|
||||
} = this.props;
|
||||
|
@ -36,10 +38,11 @@ class Updates extends Component {
|
|||
const hasUpdateToInstall = hasUpdates && _.some(items, { installable: true, latest: true });
|
||||
const noUpdateToInstall = hasUpdates && !hasUpdateToInstall;
|
||||
|
||||
const externalUpdaterPrefix = 'Unable to update Lidarr directly,';
|
||||
const externalUpdaterMessages = {
|
||||
external: 'Unable to update Lidarr directly, Lidarr is configured to use an external update mechanism',
|
||||
apt: 'Unable to update Lidarr directly, use apt to install the update',
|
||||
docker: 'Unable to update Lidarr directly, update the docker container to receive the update'
|
||||
external: 'Lidarr 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 (
|
||||
|
@ -77,7 +80,7 @@ class Updates extends Component {
|
|||
/>
|
||||
|
||||
<div className={styles.message}>
|
||||
{externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external}
|
||||
{externalUpdaterPrefix} <InlineMarkdown data={updateMechanismMessage || externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external} />
|
||||
</div>
|
||||
</Fragment>
|
||||
}
|
||||
|
@ -201,6 +204,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
|
||||
};
|
||||
|
|
|
@ -13,13 +13,17 @@ import Updates from './Updates';
|
|||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.app.version,
|
||||
createSystemStatusSelector(),
|
||||
(state) => state.system.updates,
|
||||
(state) => state.settings.general,
|
||||
createUISettingsSelector(),
|
||||
createCommandExecutingSelector(commandNames.APPLICATION_UPDATE),
|
||||
createSystemStatusSelector(),
|
||||
(
|
||||
currentVersion,
|
||||
status,
|
||||
updates,
|
||||
generalSettings,
|
||||
uiSettings,
|
||||
isInstallingUpdate,
|
||||
systemStatus
|
||||
|
@ -39,6 +43,8 @@ function createMapStateToProps() {
|
|||
items,
|
||||
isInstallingUpdate,
|
||||
isDocker: systemStatus.isDocker,
|
||||
updateMechanism: generalSettings.item.updateMechanism,
|
||||
updateMechanismMessage: status.packageUpdateMechanismMessage,
|
||||
shortDateFormat: uiSettings.shortDateFormat
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue