diff --git a/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json b/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json index df8fcad1d98..e6f0a5bba3b 100644 --- a/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json +++ b/api-client/src/protocols/__fixtures__/simpleAnalysisFile.json @@ -3936,5 +3936,6 @@ "description": "", "displayColor": "#b925ff" } - ] + ], + "runTimeParameters": [] } diff --git a/app-shell/src/protocol-analysis/__tests__/writeFailedAnalysis.test.ts b/app-shell/src/protocol-analysis/__tests__/writeFailedAnalysis.test.ts index 2c4d5a911ae..4514887cb6d 100644 --- a/app-shell/src/protocol-analysis/__tests__/writeFailedAnalysis.test.ts +++ b/app-shell/src/protocol-analysis/__tests__/writeFailedAnalysis.test.ts @@ -41,6 +41,7 @@ describe('write failed analysis', () => { modules: [], pipettes: [], liquids: [], + runTimeParameters: [], }) }) }) diff --git a/app-shell/src/protocol-analysis/writeFailedAnalysis.ts b/app-shell/src/protocol-analysis/writeFailedAnalysis.ts index 519184a3d41..8723cd52d04 100644 --- a/app-shell/src/protocol-analysis/writeFailedAnalysis.ts +++ b/app-shell/src/protocol-analysis/writeFailedAnalysis.ts @@ -27,6 +27,7 @@ export function createFailedAnalysis( pipettes: [], modules: [], liquids: [], + runTimeParameters: [], // TODO(mc, 2022-05-04): this field does not make sense for an // analysis that was unable to complete, but is required by // ProtocolAnalysisOutput diff --git a/app-shell/src/protocol-storage/__tests__/protocol-storage.test.ts b/app-shell/src/protocol-storage/__tests__/protocol-storage.test.ts index c873f47242c..3ac1a106dbe 100644 --- a/app-shell/src/protocol-storage/__tests__/protocol-storage.test.ts +++ b/app-shell/src/protocol-storage/__tests__/protocol-storage.test.ts @@ -119,6 +119,7 @@ describe('protocol storage directory utilities', () => { pipettes: [], modules: [], labware: [], + runTimeParameters: [], }) }) }) diff --git a/app/src/organisms/Devices/hooks/__tests__/useStoredProtocolAnalysis.test.tsx b/app/src/organisms/Devices/hooks/__tests__/useStoredProtocolAnalysis.test.tsx index 34365a075e7..fa63db104c6 100644 --- a/app/src/organisms/Devices/hooks/__tests__/useStoredProtocolAnalysis.test.tsx +++ b/app/src/organisms/Devices/hooks/__tests__/useStoredProtocolAnalysis.test.tsx @@ -42,6 +42,8 @@ const modifiedStoredProtocolData = { commands: storedProtocolData?.mostRecentAnalysis?.commands, liquids: storedProtocolData?.mostRecentAnalysis?.liquids, errors: storedProtocolData?.mostRecentAnalysis?.errors, + runTimeParameters: + storedProtocolData?.mostRecentAnalysis?.runTimeParameters, }, } diff --git a/app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx b/app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx index 49243c2b790..cfba2402172 100644 --- a/app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx +++ b/app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx @@ -97,6 +97,7 @@ const mockStoredProtocolData = [ displayColor: '#ff4f4f', }, ], + runTimeParameters: [], errors: [], } as ProtocolAnalysisOutput, }, @@ -183,6 +184,7 @@ const mockStoredProtocolData = [ displayColor: '#ff4f4f', }, ], + runTimeParameters: [], errors: [], } as ProtocolAnalysisOutput, }, @@ -273,6 +275,7 @@ const mockStoredProtocolData = [ displayColor: '#ff4f4f', }, ], + runTimeParameters: [], errors: [], } as ProtocolAnalysisOutput, }, diff --git a/app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts b/app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts index e4383c842b9..1ff0d74f72a 100644 --- a/app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts +++ b/app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts @@ -1,5 +1,9 @@ import { describe, it, expect } from 'vitest' -import { getisFlexProtocol, getRobotTypeDisplayName } from '../utils' +import { + getAnalysisStatus, + getisFlexProtocol, + getRobotTypeDisplayName, +} from '../utils' import type { ProtocolAnalysisOutput } from '@opentrons/shared-data' const mockOT3ProtocolAnalysisOutput = { @@ -10,6 +14,36 @@ const mockOT2ProtocolAnalysisOutput = { robotType: 'OT-2 Standard', } as ProtocolAnalysisOutput +describe('getAnalysisStatus', () => { + it('should return stale if no liquids in analysis', () => { + const result = getAnalysisStatus(false, { + ...mockOT3ProtocolAnalysisOutput, + liquids: [], + errors: [], + }) + expect(result).toBe('stale') + }) + + it('should return stale if no runTimeParameters in analysis', () => { + const result = getAnalysisStatus(false, { + ...mockOT3ProtocolAnalysisOutput, + runTimeParameters: [], + errors: [], + }) + expect(result).toBe('stale') + }) + + it('should return complete if liquids and runTimeParameters in analysis', () => { + const result = getAnalysisStatus(false, { + ...mockOT3ProtocolAnalysisOutput, + liquids: [], + runTimeParameters: [], + errors: [], + }) + expect(result).toBe('complete') + }) +}) + describe('getisFlexProtocol', () => { it('should return true for protocols intended for a Flex', () => { const result = getisFlexProtocol(mockOT3ProtocolAnalysisOutput) diff --git a/app/src/organisms/ProtocolsLanding/utils.ts b/app/src/organisms/ProtocolsLanding/utils.ts index 59ccfc2e852..dfc9b4fafc3 100644 --- a/app/src/organisms/ProtocolsLanding/utils.ts +++ b/app/src/organisms/ProtocolsLanding/utils.ts @@ -10,7 +10,10 @@ export function getAnalysisStatus( ): AnalysisStatus { if (isAnalyzing) { return 'loading' - } else if (analysis != null && analysis?.liquids == null) { + } else if ( + analysis != null && + (analysis.liquids == null || analysis.runTimeParameters == null) + ) { return 'stale' } else if (analysis != null) { return analysis.errors.length > 0 ? 'error' : 'complete' diff --git a/shared-data/protocol/types/schemaV8/index.ts b/shared-data/protocol/types/schemaV8/index.ts index 0a6972fe271..d501abbe38e 100644 --- a/shared-data/protocol/types/schemaV8/index.ts +++ b/shared-data/protocol/types/schemaV8/index.ts @@ -4,6 +4,7 @@ import type { LoadedLabware, LoadedModule, Liquid, + RunTimeParameter, } from '../../../js' import type { CommandAnnotation } from '../../../commandAnnotation/types' import type { LabwareDefinition2, RobotType } from '../../../js/types' @@ -136,6 +137,7 @@ export interface ProtocolAnalysisOutput { modules: LoadedModule[] liquids: Liquid[] errors: AnalysisError[] + runTimeParameters: RunTimeParameter[] robotType?: RobotType }