mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Added UpdateMechanismMessage to allow package maintainers provide custom message
This commit is contained in:
parent
5288b61378
commit
c8d2fcb223
@ -5,6 +5,7 @@ import { icons, kinds } from 'Helpers/Props';
|
|||||||
import formatDate from 'Utilities/Date/formatDate';
|
import formatDate from 'Utilities/Date/formatDate';
|
||||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||||
import SpinnerButton from 'Components/Link/SpinnerButton';
|
import SpinnerButton from 'Components/Link/SpinnerButton';
|
||||||
|
import InlineMarkdown from 'Components/Markdown/InlineMarkdown';
|
||||||
import Icon from 'Components/Icon';
|
import Icon from 'Components/Icon';
|
||||||
import Label from 'Components/Label';
|
import Label from 'Components/Label';
|
||||||
import PageContent from 'Components/Page/PageContent';
|
import PageContent from 'Components/Page/PageContent';
|
||||||
@ -27,6 +28,7 @@ class Updates extends Component {
|
|||||||
items,
|
items,
|
||||||
isInstallingUpdate,
|
isInstallingUpdate,
|
||||||
updateMechanism,
|
updateMechanism,
|
||||||
|
updateMechanismMessage,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
onInstallLatestPress
|
onInstallLatestPress
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@ -37,10 +39,11 @@ class Updates extends Component {
|
|||||||
const hasUpdateToInstall = hasUpdates && _.some(items, { installable: true, latest: true });
|
const hasUpdateToInstall = hasUpdates && _.some(items, { installable: true, latest: true });
|
||||||
const noUpdateToInstall = hasUpdates && !hasUpdateToInstall;
|
const noUpdateToInstall = hasUpdates && !hasUpdateToInstall;
|
||||||
|
|
||||||
|
const externalUpdaterPrefix = 'Unable to update Sonarr directly,';
|
||||||
const externalUpdaterMessages = {
|
const externalUpdaterMessages = {
|
||||||
external: 'Unable to update Sonarr directly, Sonarr is configured to use an external update mechanism',
|
external: 'Sonarr is configured to use an external update mechanism',
|
||||||
apt: 'Unable to update Sonarr directly, use apt to install the update',
|
apt: 'use apt to install the update',
|
||||||
docker: 'Unable to update Sonarr directly, update the docker container to receive the update'
|
docker: 'update the docker container to receive the update'
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -78,7 +81,7 @@ class Updates extends Component {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={styles.message}>
|
<div className={styles.message}>
|
||||||
{externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external}
|
{externalUpdaterPrefix} <InlineMarkdown data={updateMechanismMessage || externalUpdaterMessages[updateMechanism] || externalUpdaterMessages.external} />
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
@ -210,6 +213,7 @@ Updates.propTypes = {
|
|||||||
items: PropTypes.array.isRequired,
|
items: PropTypes.array.isRequired,
|
||||||
isInstallingUpdate: PropTypes.bool.isRequired,
|
isInstallingUpdate: PropTypes.bool.isRequired,
|
||||||
updateMechanism: PropTypes.string,
|
updateMechanism: PropTypes.string,
|
||||||
|
updateMechanismMessage: PropTypes.string,
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
shortDateFormat: PropTypes.string.isRequired,
|
||||||
onInstallLatestPress: PropTypes.func.isRequired
|
onInstallLatestPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@ -7,18 +7,21 @@ import { fetchUpdates } from 'Store/Actions/systemActions';
|
|||||||
import { executeCommand } from 'Store/Actions/commandActions';
|
import { executeCommand } from 'Store/Actions/commandActions';
|
||||||
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
|
||||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||||
|
import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector';
|
||||||
import * as commandNames from 'Commands/commandNames';
|
import * as commandNames from 'Commands/commandNames';
|
||||||
import Updates from './Updates';
|
import Updates from './Updates';
|
||||||
|
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state) => state.app.version,
|
(state) => state.app.version,
|
||||||
|
createSystemStatusSelector(),
|
||||||
(state) => state.system.updates,
|
(state) => state.system.updates,
|
||||||
(state) => state.settings.general,
|
(state) => state.settings.general,
|
||||||
createUISettingsSelector(),
|
createUISettingsSelector(),
|
||||||
createCommandExecutingSelector(commandNames.APPLICATION_UPDATE),
|
createCommandExecutingSelector(commandNames.APPLICATION_UPDATE),
|
||||||
(
|
(
|
||||||
currentVersion,
|
currentVersion,
|
||||||
|
status,
|
||||||
updates,
|
updates,
|
||||||
generalSettings,
|
generalSettings,
|
||||||
uiSettings,
|
uiSettings,
|
||||||
@ -41,6 +44,7 @@ function createMapStateToProps() {
|
|||||||
items,
|
items,
|
||||||
isInstallingUpdate,
|
isInstallingUpdate,
|
||||||
updateMechanism: generalSettings.item.updateMechanism,
|
updateMechanism: generalSettings.item.updateMechanism,
|
||||||
|
updateMechanismMessage: status.packageUpdateMechanismMessage,
|
||||||
shortDateFormat: uiSettings.shortDateFormat
|
shortDateFormat: uiSettings.shortDateFormat
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ public interface IDeploymentInfoProvider
|
|||||||
string PackageAuthor { get; }
|
string PackageAuthor { get; }
|
||||||
string PackageBranch { get; }
|
string PackageBranch { get; }
|
||||||
UpdateMechanism PackageUpdateMechanism { get; }
|
UpdateMechanism PackageUpdateMechanism { get; }
|
||||||
|
string PackageUpdateMechanismMessage { get; }
|
||||||
|
|
||||||
string ReleaseVersion { get; }
|
string ReleaseVersion { get; }
|
||||||
string ReleaseBranch { get; }
|
string ReleaseBranch { get; }
|
||||||
@ -45,6 +46,7 @@ public DeploymentInfoProvider(IAppFolderInfo appFolderInfo, IDiskProvider diskPr
|
|||||||
PackageVersion = ReadValue(data, "PackageVersion");
|
PackageVersion = ReadValue(data, "PackageVersion");
|
||||||
PackageAuthor = ReadValue(data, "PackageAuthor");
|
PackageAuthor = ReadValue(data, "PackageAuthor");
|
||||||
PackageUpdateMechanism = ReadEnumValue(data, "UpdateMethod", UpdateMechanism.BuiltIn);
|
PackageUpdateMechanism = ReadEnumValue(data, "UpdateMethod", UpdateMechanism.BuiltIn);
|
||||||
|
PackageUpdateMechanismMessage = ReadValue(data, "UpdateMethodMessage");
|
||||||
PackageBranch = ReadValue(data, "Branch");
|
PackageBranch = ReadValue(data, "Branch");
|
||||||
|
|
||||||
ReleaseVersion = ReadValue(data, "ReleaseVersion");
|
ReleaseVersion = ReadValue(data, "ReleaseVersion");
|
||||||
@ -98,6 +100,7 @@ private static T ReadEnumValue<T>(string fileData, string key, T defaultValue)
|
|||||||
public string PackageAuthor { get; private set; }
|
public string PackageAuthor { get; private set; }
|
||||||
public string PackageBranch { get; private set; }
|
public string PackageBranch { get; private set; }
|
||||||
public UpdateMechanism PackageUpdateMechanism { get; private set; }
|
public UpdateMechanism PackageUpdateMechanism { get; private set; }
|
||||||
|
public string PackageUpdateMechanismMessage { get; private set; }
|
||||||
|
|
||||||
public string ReleaseVersion { get; private set; }
|
public string ReleaseVersion { get; private set; }
|
||||||
public string ReleaseBranch { get; set; }
|
public string ReleaseBranch { get; set; }
|
||||||
|
@ -75,7 +75,8 @@ private object GetStatus()
|
|||||||
StartTime = _runtimeInfo.StartTime,
|
StartTime = _runtimeInfo.StartTime,
|
||||||
PackageVersion = _deploymentInfoProvider.PackageVersion,
|
PackageVersion = _deploymentInfoProvider.PackageVersion,
|
||||||
PackageAuthor = _deploymentInfoProvider.PackageAuthor,
|
PackageAuthor = _deploymentInfoProvider.PackageAuthor,
|
||||||
PackageUpdateMechanism = _deploymentInfoProvider.PackageUpdateMechanism
|
PackageUpdateMechanism = _deploymentInfoProvider.PackageUpdateMechanism,
|
||||||
|
PackageUpdateMechanismMessage = _deploymentInfoProvider.PackageUpdateMechanismMessage
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user