Skip to content

Commit 8cdf2b7

Browse files
authored
chore(app): remove enableCsvFile feature flag (#15863)
remove enableCsvFile feature flag from app
1 parent c40a009 commit 8cdf2b7

File tree

18 files changed

+124
-213
lines changed

18 files changed

+124
-213
lines changed

app/src/assets/localization/en/app_settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"__dev_internal__protocolTimeline": "Protocol Timeline",
55
"__dev_internal__enableRunNotes": "Display Notes During a Protocol Run",
66
"__dev_internal__enableQuickTransfer": "Enable Quick Transfer",
7-
"__dev_internal__enableCsvFile": "Enable CSV File",
87
"__dev_internal__enableLabwareCreator": "Enable App Labware Creator",
98
"add_folder_button": "Add labware source folder",
109
"add_ip_button": "Add",

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { simpleAnalysisFileFixture } from '@opentrons/api-client'
77
import { OT2_ROBOT_TYPE } from '@opentrons/shared-data'
88
import { renderWithProviders } from '../../../__testing-utils__'
99
import { i18n } from '../../../i18n'
10-
import { useFeatureFlag } from '../../../redux/config'
1110
import { getStoredProtocols } from '../../../redux/protocol-storage'
1211
import { mockConnectableRobot } from '../../../redux/discovery/__fixtures__'
1312
import {
@@ -19,7 +18,6 @@ import { useCreateRunFromProtocol } from '../../ChooseRobotToRunProtocolSlideout
1918
import { ChooseProtocolSlideout } from '../'
2019
import { useNotifyDataReady } from '../../../resources/useNotifyDataReady'
2120
import type { ProtocolAnalysisOutput } from '@opentrons/shared-data'
22-
import { when } from 'vitest-when'
2321

2422
vi.mock('../../ChooseRobotToRunProtocolSlideout/useCreateRunFromProtocol')
2523
vi.mock('../../../redux/protocol-storage')
@@ -69,7 +67,6 @@ describe('ChooseProtocolSlideout', () => {
6967
trackCreateProtocolRunEvent: mockTrackCreateProtocolRunEvent,
7068
})
7169
vi.mocked(useNotifyDataReady).mockReturnValue({} as any)
72-
when(vi.mocked(useFeatureFlag)).calledWith('enableCsvFile').thenReturn(true)
7370
})
7471

7572
it('renders slideout if showSlideout true', () => {

app/src/organisms/ChooseProtocolSlideout/index.tsx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
import { sortRuntimeParameters } from '@opentrons/shared-data'
3737

3838
import { useLogger } from '../../logger'
39-
import { useFeatureFlag } from '../../redux/config'
4039
import { OPENTRONS_USB } from '../../redux/discovery'
4140
import { getStoredProtocols } from '../../redux/protocol-storage'
4241
import { appShellRequestor } from '../../redux/shell/remote'
@@ -117,7 +116,6 @@ export function ChooseProtocolSlideoutComponent(
117116
) ?? false
118117
)
119118
const [isInputFocused, setIsInputFocused] = React.useState<boolean>(false)
120-
const enableCsvFile = useFeatureFlag('enableCsvFile')
121119

122120
React.useEffect(() => {
123121
setRunTimeParametersOverrides(
@@ -239,20 +237,12 @@ export function ChooseProtocolSlideoutComponent(
239237
runTimeParametersOverrides,
240238
mappedResolvedCsvVariableToFileId
241239
)
242-
if (enableCsvFile) {
243-
createRunFromProtocolSource({
244-
files: srcFileObjects,
245-
protocolKey: selectedProtocol.protocolKey,
246-
runTimeParameterValues,
247-
runTimeParameterFiles,
248-
})
249-
} else {
250-
createRunFromProtocolSource({
251-
files: srcFileObjects,
252-
protocolKey: selectedProtocol.protocolKey,
253-
runTimeParameterValues,
254-
})
255-
}
240+
createRunFromProtocolSource({
241+
files: srcFileObjects,
242+
protocolKey: selectedProtocol.protocolKey,
243+
runTimeParameterValues,
244+
runTimeParameterFiles,
245+
})
256246
})
257247
} else {
258248
logger.warn('failed to create protocol, no protocol selected')
@@ -441,7 +431,7 @@ export function ChooseProtocolSlideoutComponent(
441431
if (error != null) {
442432
errors.push(error as string)
443433
}
444-
return !enableCsvFile ? null : (
434+
return (
445435
<Flex
446436
flexDirection={DIRECTION_COLUMN}
447437
alignItems={ALIGN_CENTER}

app/src/organisms/ChooseRobotSlideout/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import {
3232
OT2_ROBOT_TYPE,
3333
sortRuntimeParameters,
3434
} from '@opentrons/shared-data'
35-
import { useFeatureFlag } from '../../redux/config'
3635
import {
3736
getConnectableRobots,
3837
getReachableRobots,
@@ -153,7 +152,6 @@ export function ChooseRobotSlideout(
153152
resetRunTimeParameters,
154153
setHasMissingFileParam,
155154
} = props
156-
const enableCsvFile = useFeatureFlag('enableCsvFile')
157155

158156
const dispatch = useDispatch<Dispatch>()
159157
const isScanning = useSelector((state: State) => getScanning(state))
@@ -530,8 +528,9 @@ export function ChooseRobotSlideout(
530528
if (error != null) {
531529
errors.push(error as string)
532530
}
533-
return !enableCsvFile ? null : (
531+
return (
534532
<Flex
533+
key={runtimeParam.variableName}
535534
flexDirection={DIRECTION_COLUMN}
536535
alignItems={ALIGN_CENTER}
537536
gridgap={SPACING.spacing8}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { i18n } from '../../../i18n'
99
import { useTrackCreateProtocolRunEvent } from '../../../organisms/Devices/hooks'
1010
import { useCloseCurrentRun } from '../../../organisms/ProtocolUpload/hooks'
1111
import { useCurrentRunStatus } from '../../../organisms/RunTimeControl/hooks'
12-
import { useFeatureFlag } from '../../../redux/config'
1312
import {
1413
getConnectableRobots,
1514
getReachableRobots,
@@ -192,7 +191,6 @@ describe('ChooseRobotToRunProtocolSlideout', () => {
192191
{ ...mockConnectableRobot, name: 'otherRobot', ip: 'otherIp' },
193192
mockConnectableRobot,
194193
])
195-
vi.mocked(useFeatureFlag).mockReturnValue(true)
196194

197195
provideNullCurrentRunIdFor('otherIp')
198196
render({
@@ -267,6 +265,7 @@ describe('ChooseRobotToRunProtocolSlideout', () => {
267265
files: [expect.any(File)],
268266
protocolKey: storedProtocolDataFixture.protocolKey,
269267
runTimeParameterValues: expect.any(Object),
268+
runTimeParameterFiles: expect.any(Object),
270269
})
271270
)
272271
expect(mockTrackCreateProtocolRunEvent).toHaveBeenCalled()
@@ -300,6 +299,7 @@ describe('ChooseRobotToRunProtocolSlideout', () => {
300299
files: [expect.any(File)],
301300
protocolKey: storedProtocolDataFixture.protocolKey,
302301
runTimeParameterValues: expect.any(Object),
302+
runTimeParameterFiles: expect.any(Object),
303303
})
304304
)
305305
expect(mockTrackCreateProtocolRunEvent).toHaveBeenCalled()
@@ -353,6 +353,7 @@ describe('ChooseRobotToRunProtocolSlideout', () => {
353353
files: [expect.any(File)],
354354
protocolKey: storedProtocolDataFixture.protocolKey,
355355
runTimeParameterValues: expect.any(Object),
356+
runTimeParameterFiles: expect.any(Object),
356357
})
357358
})
358359
})

app/src/organisms/ChooseRobotToRunProtocolSlideout/index.tsx

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { useUploadCsvFileMutation } from '@opentrons/react-api-client'
1818

1919
import { Tooltip } from '../../atoms/Tooltip'
2020
import { getRobotUpdateDisplayInfo } from '../../redux/robot-update'
21-
import { useFeatureFlag } from '../../redux/config'
2221
import { OPENTRONS_USB } from '../../redux/discovery'
2322
import { appShellRequestor } from '../../redux/shell/remote'
2423
import { useTrackCreateProtocolRunEvent } from '../Devices/hooks'
@@ -96,8 +95,6 @@ export function ChooseRobotToRunProtocolSlideoutComponent(
9695
: null
9796
)
9897

99-
const enableCsvFile = useFeatureFlag('enableCsvFile')
100-
10198
const {
10299
createRunFromProtocolSource,
103100
runCreationError,
@@ -139,52 +136,41 @@ export function ChooseRobotToRunProtocolSlideoutComponent(
139136
)
140137
const handleProceed: React.MouseEventHandler<HTMLButtonElement> = () => {
141138
trackCreateProtocolRunEvent({ name: 'createProtocolRecordRequest' })
142-
if (enableCsvFile) {
143-
const dataFilesForProtocolMap = runTimeParametersOverrides.reduce<
144-
Record<string, File>
145-
>(
146-
(acc, parameter) =>
147-
parameter.type === 'csv_file' && parameter.file?.file != null
148-
? { ...acc, [parameter.variableName]: parameter.file.file }
149-
: acc,
150-
{}
151-
)
152-
Promise.all(
153-
Object.entries(dataFilesForProtocolMap).map(([key, file]) => {
154-
const fileResponse = uploadCsvFile(file)
155-
const varName = Promise.resolve(key)
156-
return Promise.all([fileResponse, varName])
157-
})
158-
).then(responseTuples => {
159-
const mappedResolvedCsvVariableToFileId = responseTuples.reduce<
160-
Record<string, string>
161-
>((acc, [uploadedFileResponse, variableName]) => {
162-
return { ...acc, [variableName]: uploadedFileResponse.data.id }
163-
}, {})
164-
const runTimeParameterValues = getRunTimeParameterValuesForRun(
165-
runTimeParametersOverrides
166-
)
167-
const runTimeParameterFiles = getRunTimeParameterFilesForRun(
168-
runTimeParametersOverrides,
169-
mappedResolvedCsvVariableToFileId
170-
)
171-
createRunFromProtocolSource({
172-
files: srcFileObjects,
173-
protocolKey,
174-
runTimeParameterValues,
175-
runTimeParameterFiles,
176-
})
139+
const dataFilesForProtocolMap = runTimeParametersOverrides.reduce<
140+
Record<string, File>
141+
>(
142+
(acc, parameter) =>
143+
parameter.type === 'csv_file' && parameter.file?.file != null
144+
? { ...acc, [parameter.variableName]: parameter.file.file }
145+
: acc,
146+
{}
147+
)
148+
Promise.all(
149+
Object.entries(dataFilesForProtocolMap).map(([key, file]) => {
150+
const fileResponse = uploadCsvFile(file)
151+
const varName = Promise.resolve(key)
152+
return Promise.all([fileResponse, varName])
177153
})
178-
} else {
154+
).then(responseTuples => {
155+
const mappedResolvedCsvVariableToFileId = responseTuples.reduce<
156+
Record<string, string>
157+
>((acc, [uploadedFileResponse, variableName]) => {
158+
return { ...acc, [variableName]: uploadedFileResponse.data.id }
159+
}, {})
179160
const runTimeParameterValues = getRunTimeParameterValuesForRun(
180161
runTimeParametersOverrides
181162
)
163+
const runTimeParameterFiles = getRunTimeParameterFilesForRun(
164+
runTimeParametersOverrides,
165+
mappedResolvedCsvVariableToFileId
166+
)
182167
createRunFromProtocolSource({
183168
files: srcFileObjects,
184169
protocolKey,
185170
runTimeParameterValues,
171+
runTimeParameterFiles,
186172
})
187-
}
173+
})
188174
}
189175

190176
const { autoUpdateAction } = useSelector((state: State) =>

app/src/organisms/Devices/HistoricalProtocolRun.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
LegacyStyledText,
1515
} from '@opentrons/components'
1616
import { useAllCsvFilesQuery } from '@opentrons/react-api-client'
17-
import { useFeatureFlag } from '../../redux/config'
1817
import { formatInterval } from '../RunTimeControl/utils'
1918
import { formatTimestamp } from './utils'
2019
import { EMPTY_TIMESTAMP } from './constants'
@@ -55,7 +54,6 @@ export function HistoricalProtocolRun(
5554
duration = formatInterval(run.startedAt, new Date().toString())
5655
}
5756
}
58-
const enableCsvFile = useFeatureFlag('enableCsvFile')
5957

6058
return (
6159
<>
@@ -89,15 +87,13 @@ export function HistoricalProtocolRun(
8987
>
9088
{protocolName}
9189
</LegacyStyledText>
92-
{enableCsvFile ? (
93-
<LegacyStyledText
94-
as="p"
95-
width="5%"
96-
data-testid={`RecentProtocolRuns_Files_${protocolKey}`}
97-
>
98-
{allProtocolDataFiles.length}
99-
</LegacyStyledText>
100-
) : null}
90+
<LegacyStyledText
91+
as="p"
92+
width="5%"
93+
data-testid={`RecentProtocolRuns_Files_${protocolKey}`}
94+
>
95+
{allProtocolDataFiles.length}
96+
</LegacyStyledText>
10197
<LegacyStyledText
10298
as="p"
10399
width="14%"

app/src/organisms/Devices/HistoricalProtocolRunDrawer.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
} from '@opentrons/shared-data'
2828
import { useAllCsvFilesQuery } from '@opentrons/react-api-client'
2929
import { DownloadCsvFileLink } from './DownloadCsvFileLink'
30-
import { useFeatureFlag } from '../../redux/config'
3130
import { Banner } from '../../atoms/Banner'
3231
import { useMostRecentCompletedAnalysis } from '../LabwarePositionCheck/useMostRecentCompletedAnalysis'
3332
import { useDeckCalibrationData } from './hooks'
@@ -68,7 +67,6 @@ export function HistoricalProtocolRunDrawer(
6867
? deckCalibrationData.lastModified
6968
: null
7069
const protocolDetails = useMostRecentCompletedAnalysis(run.id)
71-
const enableCsvFile = useFeatureFlag('enableCsvFile')
7270

7371
const isOutOfDate =
7472
typeof lastModifiedDeckCal === 'string' &&
@@ -290,7 +288,7 @@ export function HistoricalProtocolRunDrawer(
290288
width="100%"
291289
padding={SPACING.spacing16}
292290
>
293-
{enableCsvFile ? protocolFilesData : null}
291+
{protocolFilesData}
294292
{labwareOffsets}
295293
</Flex>
296294
)

app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { i18n } from '../../../../i18n'
88
import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis'
99
import { useRunStatus } from '../../../RunTimeControl/hooks'
1010
import { useNotifyRunQuery } from '../../../../resources/runs'
11-
import { useFeatureFlag } from '../../../../redux/config'
1211
import { mockSucceededRun } from '../../../RunTimeControl/__fixtures__'
1312
import { ProtocolRunRuntimeParameters } from '../ProtocolRunRunTimeParameters'
1413

@@ -122,9 +121,6 @@ describe('ProtocolRunRuntimeParameters', () => {
122121
vi.mocked(useNotifyRunQuery).mockReturnValue(({
123122
data: { data: mockSucceededRun },
124123
} as unknown) as UseQueryResult<Run>)
125-
when(vi.mocked(useFeatureFlag))
126-
.calledWith('enableCsvFile')
127-
.thenReturn(false)
128124
})
129125

130126
afterEach(() => {
@@ -189,7 +185,6 @@ describe('ProtocolRunRuntimeParameters', () => {
189185
})
190186

191187
it('should render csv row if a protocol requires a csv', () => {
192-
when(vi.mocked(useFeatureFlag)).calledWith('enableCsvFile').thenReturn(true)
193188
vi.mocked(useMostRecentCompletedAnalysis).mockReturnValue({
194189
runTimeParameters: [...mockRunTimeParameterData, mockCsvRtp],
195190
} as CompletedProtocolAnalysis)

app/src/organisms/Devices/RecentProtocolRuns.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
import { HistoricalProtocolRun } from './HistoricalProtocolRun'
2020
import { useIsRobotViewable, useRunStatuses } from './hooks'
2121
import { useNotifyAllRunsQuery, useCurrentRunId } from '../../resources/runs'
22-
import { useFeatureFlag } from '../../redux/config'
2322

2423
interface RecentProtocolRunsProps {
2524
robotName: string
@@ -36,7 +35,6 @@ export function RecentProtocolRuns({
3635
const currentRunId = useCurrentRunId()
3736
const { isRunTerminal } = useRunStatuses()
3837
const robotIsBusy = currentRunId != null ? !isRunTerminal : false
39-
const enableCsvFile = useFeatureFlag('enableCsvFile')
4038

4139
return (
4240
<Flex
@@ -90,15 +88,13 @@ export function RecentProtocolRuns({
9088
>
9189
{t('protocol')}
9290
</LegacyStyledText>
93-
{enableCsvFile ? (
94-
<LegacyStyledText
95-
as="p"
96-
width="5%"
97-
data-testid="RecentProtocolRuns_FilesTitle"
98-
>
99-
{t('files')}
100-
</LegacyStyledText>
101-
) : null}
91+
<LegacyStyledText
92+
as="p"
93+
width="5%"
94+
data-testid="RecentProtocolRuns_FilesTitle"
95+
>
96+
{t('files')}
97+
</LegacyStyledText>
10298
<LegacyStyledText
10399
as="p"
104100
width="14%"

0 commit comments

Comments
 (0)