diff --git a/app/src/components/RobotSettings/InformationCard.js b/app/src/components/RobotSettings/InformationCard.js index db69eec567e6..158164d3cd25 100644 --- a/app/src/components/RobotSettings/InformationCard.js +++ b/app/src/components/RobotSettings/InformationCard.js @@ -14,6 +14,10 @@ import { makeGetRobotUpdateInfo, } from '../../http-api-client' +import { + checkShellUpdate, +} from '../../shell' + import {RefreshCard, LabeledValue, OutlineButton} from '@opentrons/components' import {CardContentQuarter} from '../layout' @@ -28,6 +32,7 @@ type StateProps = { type DispatchProps = { fetchHealth: () => mixed, + checkAppUpdate: () => mixed, } type Props = OwnProps & StateProps & DispatchProps @@ -45,6 +50,7 @@ function InformationCard (props: Props) { updateInfo, fetchHealth, updateUrl, + checkAppUpdate, healthRequest: {inProgress, response: health}, } = props @@ -82,6 +88,7 @@ function InformationCard (props: Props) { {updateText} @@ -106,5 +113,6 @@ function mapDispatchToProps ( ): DispatchProps { return { fetchHealth: () => dispatch(fetchHealthAndIgnored(ownProps)), + checkAppUpdate: () => dispatch(checkShellUpdate()), } } diff --git a/app/src/components/RobotSettings/UpdateAppMessage.js b/app/src/components/RobotSettings/UpdateAppMessage.js new file mode 100644 index 000000000000..830331a8cefc --- /dev/null +++ b/app/src/components/RobotSettings/UpdateAppMessage.js @@ -0,0 +1,11 @@ +// @flow +import * as React from 'react' +import {Link} from 'react-router-dom' + +export default function UpdateAppMessage () { + return ( +

+ There is an app update available. Please update your app to receive the latest robot updates. +

+ ) +} diff --git a/app/src/components/RobotSettings/UpdateModal.js b/app/src/components/RobotSettings/UpdateModal.js index 37b7f72ea215..2afcae566343 100644 --- a/app/src/components/RobotSettings/UpdateModal.js +++ b/app/src/components/RobotSettings/UpdateModal.js @@ -16,11 +16,19 @@ import { setIgnoredUpdate, } from '../../http-api-client' +import { + getShellUpdateState, +} from '../../shell' + +import type {ShellUpdateState} from '../../shell' + import {AlertModal, Icon} from '@opentrons/components' +import UpdateAppMessage from './UpdateAppMessage' type OP = Robot type SP = { + appUpdate: ShellUpdateState, updateInfo: RobotUpdateInfo, updateRequest: RobotServerUpdate, restartRequest: RobotServerRestart, @@ -45,7 +53,15 @@ const Spinner = () => () export default connect(makeMapStateToProps, null, mergeProps)(UpdateModal) function UpdateModal (props: Props) { - const {updateInfo, ignoreUpdate, update, restart, updateRequest, restartRequest} = props + const { + updateInfo, + ignoreUpdate, + update, + restart, + updateRequest, + restartRequest, + appUpdate: {available}, + } = props const inProgress = updateRequest.inProgress || restartRequest.inProgress let closeButtonText = 'not now' let message @@ -87,7 +103,8 @@ function UpdateModal (props: Props) { ]} alertOverlay > - {message} + {available && } +

{message}

) } @@ -98,6 +115,7 @@ function makeMapStateToProps (): (State, OP) => SP { const getRobotRestartRequest = makeGetRobotRestartRequest() return (state, ownProps) => ({ + appUpdate: getShellUpdateState(state), updateInfo: getRobotUpdateInfo(state, ownProps), updateRequest: getRobotUpdateRequest(state, ownProps), restartRequest: getRobotRestartRequest(state, ownProps),