From 0f7d1ff49cf0f026cc693947e096445e29744840 Mon Sep 17 00:00:00 2001 From: Nick Diehl <47604184+ncdiehl11@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:46:24 -0400 Subject: [PATCH] chore(app, api-client): remove mock RTP datafrom ProtocolDetails (#14791) closes AUTH-266 --- .../__fixtures__/simpleAnalysisFile.json | 54 ++++++- .../index.tsx | 58 +------ app/src/organisms/ProtocolDetails/index.tsx | 8 +- app/src/pages/Protocols/hooks/index.ts | 145 +----------------- 4 files changed, 60 insertions(+), 205 deletions(-) diff --git a/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json b/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json index e6f0a5bba3b..74faa60fcb6 100644 --- a/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json +++ b/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json @@ -3937,5 +3937,57 @@ "displayColor": "#b925ff" } ], - "runTimeParameters": [] + "runTimeParameters": [ + { + "type": "int", + "displayName": "number of samples", + "variableName": "num_samples", + "description": "How many samples do you want to run?", + "value": 96, + "min": 1, + "max": 96, + "default": 96 + }, + { + "type": "float", + "displayName": "samples volume", + "variableName": "vol_sample", + "description": "What sample volume are you using?", + "value": 10.0, + "min": 1, + "max": 20.0, + "default": 10.0 + }, + { + "displayName": "Additional mix for reagent 2?", + "variableName": "extra_mix", + "description": "When on, we do an extra mix for reagent 2.", + "type": "bool", + "default": false, + "value": false + }, + { + "displayName": "Number of PCR Cycles", + "variableName": "real_mode", + "description": "Cycle map", + "type": "int", + "unit": "cycles", + "default": 15, + "value": 15, + "choices": [ + { + "displayName": "1 & 10ng (15 cycles)", + "value": 15 + }, + { + "displayName": "100ng (15 cycles)", + "value": 15 + }, + { + "displayName": "1ug (10 cycles)", + "value": 10 + } + ] + } + ] } diff --git a/app/src/organisms/ChooseRobotToRunProtocolSlideout/index.tsx b/app/src/organisms/ChooseRobotToRunProtocolSlideout/index.tsx index 09b7f4e0fe8..39cf498b0e5 100644 --- a/app/src/organisms/ChooseRobotToRunProtocolSlideout/index.tsx +++ b/app/src/organisms/ChooseRobotToRunProtocolSlideout/index.tsx @@ -62,62 +62,8 @@ export function ChooseRobotToRunProtocolSlideoutComponent( ) // TODO: (nd: 3/20/24) remove stubs and pull parameters from analysis - // const runTimeParameters = - // storedProtocolData.mostRecentAnalysis?.runTimeParameters ?? [] - const mockRunTimeParameters: RunTimeParameter[] = [ - { - displayName: 'Dry Run', - value: false, - variableName: 'DRYRUN', - description: 'Is this a dry or wet run? Wet is true, dry is false', - type: 'bool', - default: false, - }, - { - value: 4, - displayName: 'Columns of Samples', - variableName: 'COLUMNS', - description: 'How many columns do you want?', - type: 'int', - min: 1, - max: 14, - default: 4, - }, - { - value: 6.5, - displayName: 'EtoH Volume', - variableName: 'ETOH_VOLUME', - description: '70% ethanol volume', - type: 'float', - suffix: 'mL', - min: 1.5, - max: 10.0, - default: 6.5, - }, - { - value: 'none', - displayName: 'Default Module Offsets', - variableName: 'DEFAULT_OFFSETS', - description: 'default module offsets for temp, H-S, and none', - type: 'str', - choices: [ - { - displayName: 'No offsets', - value: 'none', - }, - { - displayName: 'temp offset', - value: '1', - }, - { - displayName: 'heater-shaker offset', - value: '2', - }, - ], - default: 'none', - }, - ] - const runTimeParameters: RunTimeParameter[] = mockRunTimeParameters + const runTimeParameters = + storedProtocolData.mostRecentAnalysis?.runTimeParameters ?? [] const [ runTimeParametersOverrides, setRunTimeParametersOverrides, diff --git a/app/src/organisms/ProtocolDetails/index.tsx b/app/src/organisms/ProtocolDetails/index.tsx index 02d897c3b4e..90add9f023a 100644 --- a/app/src/organisms/ProtocolDetails/index.tsx +++ b/app/src/organisms/ProtocolDetails/index.tsx @@ -73,7 +73,6 @@ import { ProtocolLabwareDetails } from './ProtocolLabwareDetails' import { ProtocolLiquidsDetails } from './ProtocolLiquidsDetails' import { RobotConfigurationDetails } from './RobotConfigurationDetails' import { ProtocolParameters } from './ProtocolParameters' -import { useRunTimeParameters } from '../../pages/Protocols/hooks' import type { JsonConfig, PythonConfig } from '@opentrons/shared-data' import type { StoredProtocolData } from '../../redux/protocol-storage' @@ -201,9 +200,12 @@ export function ProtocolDetails( const { t, i18n } = useTranslation(['protocol_details', 'shared']) const enableProtocolStats = useFeatureFlag('protocolStats') const enableRunTimeParameters = useFeatureFlag('enableRunTimeParameters') + const runTimeParameters = mostRecentAnalysis?.runTimeParameters ?? [] + const hasRunTimeParameters = + enableRunTimeParameters && runTimeParameters.length > 0 const [currentTab, setCurrentTab] = React.useState< 'robot_config' | 'labware' | 'liquids' | 'stats' | 'parameters' - >('robot_config') + >(hasRunTimeParameters ? 'parameters' : 'robot_config') const [ showChooseRobotToRunProtocolSlideout, setShowChooseRobotToRunProtocolSlideout, @@ -218,8 +220,6 @@ export function ProtocolDetails( getIsProtocolAnalysisInProgress(state, protocolKey) ) - const runTimeParameters = useRunTimeParameters(protocolKey) - const analysisStatus = getAnalysisStatus(isAnalyzing, mostRecentAnalysis) if (analysisStatus === 'stale') { diff --git a/app/src/pages/Protocols/hooks/index.ts b/app/src/pages/Protocols/hooks/index.ts index c873ff35a9f..964103dc5c5 100644 --- a/app/src/pages/Protocols/hooks/index.ts +++ b/app/src/pages/Protocols/hooks/index.ts @@ -200,150 +200,7 @@ export const useRunTimeParameters = ( { enabled: protocolData != null } ) - const mockData: RunTimeParameter[] = [ - { - value: false, - displayName: 'Dry Run', - variableName: 'DRYRUN', - description: 'Is this a dry or wet run? Wet is true, dry is false', - type: 'bool', - default: false, - }, - { - value: true, - displayName: 'Use Gripper', - variableName: 'USE_GRIPPER', - description: 'For using the gripper.', - type: 'bool', - default: true, - }, - { - value: true, - displayName: 'Trash Tips', - variableName: 'TIP_TRASH', - description: - 'to throw tip into the trash or to not throw tip into the trash', - type: 'bool', - default: true, - }, - { - value: true, - displayName: 'Deactivate Temperatures', - variableName: 'DEACTIVATE_TEMP', - description: 'deactivate temperature on the module', - type: 'bool', - default: true, - }, - { - value: 4, - displayName: 'Columns of Samples', - variableName: 'COLUMNS', - description: 'How many columns do you want?', - type: 'int', - min: 1, - max: 14, - default: 4, - }, - { - value: 6, - displayName: 'PCR Cycles', - variableName: 'PCR_CYCLES', - description: 'number of PCR cycles on a thermocycler', - type: 'int', - min: 1, - max: 10, - default: 6, - }, - { - value: 6.5, - displayName: 'EtoH Volume', - variableName: 'ETOH_VOLUME', - description: '70% ethanol volume', - type: 'float', - suffix: 'mL', - min: 1.5, - max: 10.0, - default: 6.5, - }, - { - value: 'none', - displayName: 'Default Module Offsets', - variableName: 'DEFAULT_OFFSETS', - description: 'default module offsets for temp, H-S, and none', - type: 'str', - choices: [ - { - displayName: 'No offsets', - value: 'none', - }, - { - displayName: 'temp offset', - value: '1', - }, - { - displayName: 'heater-shaker offset', - value: '2', - }, - ], - default: 'none', - }, - { - value: 'left', - displayName: 'pipette mount', - variableName: 'mont', - description: 'pipette mount', - type: 'str', - choices: [ - { - displayName: 'Left', - value: 'left', - }, - { - displayName: 'Right', - value: 'right', - }, - ], - default: 'left', - }, - { - value: 'flex', - displayName: 'short test case', - variableName: 'short 2 options', - description: 'this play 2 short options', - type: 'str', - choices: [ - { - displayName: 'OT-2', - value: 'ot2', - }, - { - displayName: 'Flex', - value: 'flex', - }, - ], - default: 'flex', - }, - { - value: 'flex', - displayName: 'long test case', - variableName: 'long 2 options', - description: 'this play 2 long options', - type: 'str', - choices: [ - { - displayName: 'I am kind of long text version', - value: 'ot2', - }, - { - displayName: 'I am kind of long text version. Today is 3/15', - value: 'flex', - }, - ], - default: 'flex', - }, - ] - // TODO(jr, 3/14/24): remove the mockData - return analysis?.runTimeParameters ?? mockData + return analysis?.runTimeParameters ?? [] } /**