Skip to content

Commit

Permalink
fix(app): fix add missing banner for runtime parameters (#16061)
Browse files Browse the repository at this point in the history
* fix(app): fix add missing banner for runtime parameters
  • Loading branch information
koji authored Aug 22, 2024
1 parent 8f77687 commit e367986
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 26 deletions.
18 changes: 10 additions & 8 deletions app/src/assets/localization/en/protocol_setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"add_to_slot": "Add to slot {{slotName}}",
"additional_labware": "{{count}} additional labware",
"additional_off_deck_labware": "Additional Off-Deck Labware",
"all_files_associated": "All files associated with the protocol run are available on the robot detail screen.",
"applied_labware_offsets": "applied labware offsets",
"are_you_sure_you_want_to_proceed": "Are you sure you want to proceed to run?",
"attach_gripper_failure_reason": "Attach the required gripper to continue",
Expand Down Expand Up @@ -49,9 +50,9 @@
"configured": "configured",
"confirm_heater_shaker_module_modal_description": "Before the run begins, module should have both anchors fully extended for a firm attachment. The thermal adapter should be attached to the module. ",
"confirm_heater_shaker_module_modal_title": "Confirm Heater-Shaker Module is attached",
"confirm_offsets": "Confirm offsets",
"confirm_liquids": "Confirm liquids",
"confirm_locations_and_volumes": "Confirm locations and volumes",
"confirm_offsets": "Confirm offsets",
"confirm_placements": "Confirm placements",
"confirm_selection": "Confirm selection",
"confirm_values": "Confirm values",
Expand All @@ -73,10 +74,11 @@
"deck_conflict_info_thermocycler": "<block>Update the deck configuration by removing the fixtures in locations <strong>A1 and B1</strong>. Either remove the fixtures from the deck configuration or update the protocol.</block>",
"deck_conflict_info": "<block>Update the deck configuration by removing the <strong>{{currentFixture}}</strong> in location <strong>{{cutout}}</strong>. Either remove the fixture from the deck configuration or update the protocol.</block>",
"deck_conflict": "Deck location conflict",
"deck_hardware": "Deck hardware",
"deck_hardware_ready": "Deck hardware ready",
"deck_hardware": "Deck hardware",
"deck_map": "Deck Map",
"default_values": "Default values",
"download_files": "Download files",
"example": "Example",
"exit_to_deck_configuration": "Exit to deck configuration",
"extension_mount": "extension mount",
Expand Down Expand Up @@ -126,13 +128,13 @@
"learn_more": "Learn more",
"liquid_information": "Liquid information",
"liquid_name": "Liquid name",
"liquids": "liquids",
"liquid_setup_step_description": "View liquid starting locations and volumes",
"liquid_setup_step_title": "Liquids",
"liquids_confirmed": "Liquids confirmed",
"liquids_not_in_setup": "No liquids used in this protocol",
"liquids_not_in_the_protocol": "no liquids are specified for this protocol.",
"liquids_ready": "Liquids ready",
"liquids_confirmed": "Liquids confirmed",
"liquids": "liquids",
"list_view": "List View",
"loading_data": "Loading data...",
"loading_labware_offsets": "Loading labware offsets",
Expand All @@ -158,8 +160,8 @@
"module_mismatch_body": "Check that the modules connected to this robot are of the right type and generation",
"module_name": "Module",
"module_not_connected": "Not connected",
"module_setup_step_title": "Deck hardware",
"module_setup_step_ready": "Calibration ready",
"module_setup_step_title": "Deck hardware",
"module_slot_location": "Slot {{slotName}}, {{moduleName}}",
"module": "Module",
"modules_connected_plural": "{{count}} modules attached",
Expand Down Expand Up @@ -218,8 +220,8 @@
"pipette_offset_cal_description": "This measures a pipette’s X, Y and Z values in relation to the pipette mount and the deck. Pipette Offset Calibration relies on Deck Calibration and Tip Length Calibration. ",
"pipette_offset_cal": "Pipette Offset Calibration",
"placement": "Placement",
"placements_ready": "Placements ready",
"placements_confirmed": "Placements confirmed",
"placements_ready": "Placements ready",
"plug_in_module_to_configure": "Plug in a {{module}} to add it to the slot",
"plug_in_required_module_plural": "Plug in and power up the required modules to continue",
"plug_in_required_module": "Plug in and power up the required module to continue",
Expand Down Expand Up @@ -260,13 +262,13 @@
"robot_cal_help_title": "How Robot Calibration Works",
"robot_calibration_step_description_pipettes_only": "Review required instruments and calibrations for this protocol.",
"robot_calibration_step_description": "Review required pipettes and tip length calibrations for this protocol.",
"robot_calibration_step_title": "Instruments",
"robot_calibration_step_ready": "Calibration ready",
"robot_calibration_step_title": "Instruments",
"run_disabled_calibration_not_complete": "Make sure robot calibration is complete before proceeding to run",
"run_disabled_modules_and_calibration_not_complete": "Make sure robot calibration is complete and all modules are connected before proceeding to run",
"run_disabled_modules_not_connected": "Make sure all modules are connected before proceeding to run",
"run_labware_position_check": "run labware position check",
"run_labware_position_check_to_get_offsets": "Run Labware Position Check to get your labware offset data.",
"run_labware_position_check": "run labware position check",
"run_never_started": "Run was never started",
"run": "Run",
"secure_labware_instructions": "Secure labware instructions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,7 @@ export function ProtocolRunRuntimeParameters({
) : null}
</Flex>
{hasRunTimeParameters ? (
<Banner
type="informing"
width="100%"
iconMarginLeft={SPACING.spacing4}
>
<Flex flexDirection={DIRECTION_COLUMN}>
<LegacyStyledText
as="p"
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
>
{t('values_are_view_only')}
</LegacyStyledText>
<LegacyStyledText as="p">
{t('cancel_and_restart_to_edit')}
</LegacyStyledText>
</Flex>
</Banner>
<RunTimeParametersBanner isRunTerminal={isRunTerminal} />
) : null}
</Flex>
{!hasRunTimeParameters ? (
Expand Down Expand Up @@ -171,6 +155,31 @@ export function ProtocolRunRuntimeParameters({
)
}

interface RunTimeParametersBannerProps {
isRunTerminal: boolean
}

function RunTimeParametersBanner({
isRunTerminal,
}: RunTimeParametersBannerProps): JSX.Element {
const { t } = useTranslation('protocol_setup')

return (
<Banner type="informing" width="100%" iconMarginLeft={SPACING.spacing4}>
<Flex flexDirection={DIRECTION_COLUMN}>
<LegacyStyledText as="p" fontWeight={TYPOGRAPHY.fontWeightSemiBold}>
{isRunTerminal ? t('download_files') : t('values_are_view_only')}
</LegacyStyledText>
<LegacyStyledText as="p">
{isRunTerminal
? t('all_files_associated')
: t('cancel_and_restart_to_edit')}
</LegacyStyledText>
</Flex>
</Banner>
)
}

interface StyledTableRowComponentProps {
parameter: RunTimeParameter
index: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { i18n } from '../../../../i18n'
import { useMostRecentCompletedAnalysis } from '../../../LabwarePositionCheck/useMostRecentCompletedAnalysis'
import { useRunStatus } from '../../../RunTimeControl/hooks'
import { useNotifyRunQuery } from '../../../../resources/runs'
import { mockSucceededRun } from '../../../RunTimeControl/__fixtures__'
import {
mockSucceededRun,
mockIdleUnstartedRun,
} from '../../../RunTimeControl/__fixtures__'
import { ProtocolRunRuntimeParameters } from '../ProtocolRunRunTimeParameters'

import type { UseQueryResult } from 'react-query'
Expand Down Expand Up @@ -128,6 +131,13 @@ describe('ProtocolRunRuntimeParameters', () => {
})

it('should render title, and banner when RunTimeParameters are not empty and all values are default', () => {
when(useNotifyRunQuery)
.calledWith(RUN_ID)
.thenReturn({
data: {
data: mockIdleUnstartedRun,
},
} as any)
render(props)
screen.getByText('Parameters')
screen.getByText('Default values')
Expand All @@ -151,6 +161,13 @@ describe('ProtocolRunRuntimeParameters', () => {
},
],
} as CompletedProtocolAnalysis)
when(useNotifyRunQuery)
.calledWith(RUN_ID)
.thenReturn({
data: {
data: mockIdleUnstartedRun,
},
} as any)
render(props)
screen.getByText('Parameters')
screen.getByText('Custom values')
Expand All @@ -160,6 +177,39 @@ describe('ProtocolRunRuntimeParameters', () => {
screen.getByText('Value')
})

it('should render title, and banner when RunTimeParameters from view protocol run record overflow menu button', () => {
when(useNotifyRunQuery)
.calledWith(RUN_ID)
.thenReturn({
data: {
data: {
...mockSucceededRun,
runTimeParameters: mockRunTimeParameterData,
},
},
} as any)
vi.mocked(useMostRecentCompletedAnalysis).mockReturnValue({
runTimeParameters: [
...mockRunTimeParameterData,
{
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,
},
],
} as CompletedProtocolAnalysis)

vi.mocked(useRunStatus).mockReturnValue('succeeded')
render(props)
screen.getByText('Download files')
screen.getByText(
'All files associated with the protocol run are available on the robot detail screen.'
)
})

it('should render RunTimeParameters when RunTimeParameters are not empty', () => {
render(props)
screen.getByText('Dry Run')
Expand Down

0 comments on commit e367986

Please sign in to comment.