Skip to content

Commit 0e987f0

Browse files
ncdiehl11Carlos-fernandez
authored andcommitted
refactor(app): switch ODD update modal progress bar with spinner (#14838)
closes RQA-2553
1 parent a57693c commit 0e987f0

File tree

4 files changed

+16
-35
lines changed

4 files changed

+16
-35
lines changed

app/src/organisms/UpdateRobotSoftware/UpdateSoftware.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,21 @@ import { useTranslation } from 'react-i18next'
44
import {
55
ALIGN_CENTER,
66
BORDERS,
7-
Box,
87
COLORS,
98
DIRECTION_COLUMN,
109
Flex,
10+
Icon,
1111
JUSTIFY_CENTER,
1212
SPACING,
1313
StyledText,
1414
TYPOGRAPHY,
1515
} from '@opentrons/components'
1616

17-
import { ProgressBar } from '../../atoms/ProgressBar'
18-
1917
interface UpdateSoftwareProps {
2018
updateType: 'downloading' | 'validating' | 'sendingFile' | 'installing' | null
21-
processProgress: number
2219
}
2320
export function UpdateSoftware({
2421
updateType,
25-
processProgress,
2622
}: UpdateSoftwareProps): JSX.Element {
2723
const { t } = useTranslation('device_settings')
2824
const renderText = (): string | null => {
@@ -52,6 +48,13 @@ export function UpdateSoftware({
5248
height="33rem"
5349
borderRadius={BORDERS.borderRadius12}
5450
>
51+
<Icon
52+
name="ot-spinner"
53+
size="5rem"
54+
spin={true}
55+
color={COLORS.grey60}
56+
data-testid="Icon_update"
57+
/>
5558
<Flex
5659
flexDirection={DIRECTION_COLUMN}
5760
gridGap={SPACING.spacing4}
@@ -68,9 +71,6 @@ export function UpdateSoftware({
6871
{renderText()}
6972
</StyledText>
7073
</Flex>
71-
<Box width="47.5rem">
72-
<ProgressBar percentComplete={processProgress} />
73-
</Box>
7474
</Flex>
7575
)
7676
}

app/src/organisms/UpdateRobotSoftware/__tests__/UpdateRobotSoftware.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('UpdateRobotSoftware', () => {
113113
render()
114114
expect(mockBeforeCommitting).toBeCalled()
115115
expect(UpdateSoftware).toBeCalledWith(
116-
{ updateType: 'installing', processProgress: 0 },
116+
{ updateType: 'installing' },
117117
expect.anything()
118118
)
119119
screen.getByText('mock UpdateSoftware')
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as React from 'react'
22
import { screen } from '@testing-library/react'
3-
import { describe, it, beforeEach, expect } from 'vitest'
3+
import { describe, it, beforeEach } from 'vitest'
44
import '@testing-library/jest-dom/vitest'
55
import { renderWithProviders } from '../../../__testing-utils__'
6-
import { COLORS } from '@opentrons/components'
76
import { i18n } from '../../../i18n'
87
import { UpdateSoftware } from '../UpdateSoftware'
98

@@ -18,47 +17,34 @@ describe('UpdateSoftware', () => {
1817
beforeEach(() => {
1918
props = {
2019
updateType: 'downloading',
21-
processProgress: 50,
2220
}
2321
})
24-
it('should render text and progressbar - downloading software', () => {
22+
it('should render text - downloading software', () => {
2523
render(props)
2624
screen.getByText('Downloading software...')
27-
const bar = screen.getByTestId('ProgressBar_Bar')
28-
expect(bar).toHaveStyle(`background: ${String(COLORS.blue50)}`)
29-
expect(bar).toHaveStyle('width: 50%')
3025
})
31-
it('should render text and progressbar - sending software', () => {
26+
it('should render text - sending software', () => {
3227
props = {
3328
...props,
34-
processProgress: 20,
3529
updateType: 'sendingFile',
3630
}
3731
render(props)
3832
screen.getByText('Sending software...')
39-
const bar = screen.getByTestId('ProgressBar_Bar')
40-
expect(bar).toHaveStyle('width: 20%')
4133
})
42-
it('should render text and progressbar - validating software', () => {
34+
it('should render text - validating software', () => {
4335
props = {
4436
...props,
45-
processProgress: 80,
4637
updateType: 'validating',
4738
}
4839
render(props)
4940
screen.getByText('Validating software...')
50-
const bar = screen.getByTestId('ProgressBar_Bar')
51-
expect(bar).toHaveStyle('width: 80%')
5241
})
53-
it('should render text and progressbar - installing software', () => {
42+
it('should render text - installing software', () => {
5443
props = {
5544
...props,
56-
processProgress: 5,
5745
updateType: 'installing',
5846
}
5947
render(props)
6048
screen.getByText('Installing software...')
61-
const bar = screen.getByTestId('ProgressBar_Bar')
62-
expect(bar).toHaveStyle('width: 5%')
6349
})
6450
})

app/src/organisms/UpdateRobotSoftware/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function UpdateRobotSoftware(
3737
const dispatch = useDispatch<Dispatch>()
3838

3939
const session = useSelector(getRobotUpdateSession)
40-
const { step, stage, progress, error: sessionError } = session ?? {
40+
const { step, stage, error: sessionError } = session ?? {
4141
step: null,
4242
error: null,
4343
}
@@ -76,11 +76,6 @@ export function UpdateRobotSoftware(
7676
beforeCommittingSuccessfulUpdate && beforeCommittingSuccessfulUpdate()
7777
}
7878
}
79-
return (
80-
<UpdateSoftware
81-
updateType={updateType}
82-
processProgress={progress != null ? progress : 0}
83-
/>
84-
)
79+
return <UpdateSoftware updateType={updateType} />
8580
}
8681
}

0 commit comments

Comments
 (0)