Skip to content

Commit

Permalink
feat(app): Add command text for set rail lights (#16255)
Browse files Browse the repository at this point in the history
Fix an issue that's been around for a while where we just didn't have a
command text for setting rail lights.

Closes RQA-2858
  • Loading branch information
sfoster1 authored Sep 16, 2024
1 parent 69ee8f3 commit 4ddd1cf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"setting_temperature_module_temp": "Setting Temperature Module to {{temp}} (rounded to nearest integer)",
"setting_thermocycler_block_temp": "Setting Thermocycler block temperature to {{temp}} with hold time of {{hold_time_seconds}} seconds after target reached",
"setting_thermocycler_lid_temp": "Setting Thermocycler lid temperature to {{temp}}",
"turning_rail_lights_off": "Turning rail lights off",
"turning_rail_lights_on": "Turning rail lights on",
"slot": "Slot {{slot_name}}",
"target_temperature": "target temperature",
"tc_awaiting_for_duration": "Waiting for Thermocycler profile to complete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ export function useCommandTextString(
commandText: utils.getCustomCommandText({ ...fullParams, command }),
}

case 'setRailLights':
return {
commandText: utils.getRailLightsCommandText({ ...fullParams, command }),
}

case undefined:
case null:
return { commandText: '' }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { RunTimeCommand } from '@opentrons/shared-data/command'
import type { HandlesCommands } from './types'

type HandledCommands = Extract<RunTimeCommand, { commandType: 'setRailLights' }>

export type GetRailLightsCommandText = HandlesCommands<HandledCommands>

export function getRailLightsCommandText({
command,
t,
}: GetRailLightsCommandText): string {
return command.params.on
? t('turning_rail_lights_on')
: t('turning_rail_lights_off')
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export { getCustomCommandText } from './getCustomCommandText'
export { getUnknownCommandText } from './getUnknownCommandText'
export { getPipettingCommandText } from './getPipettingCommandText'
export { getLiquidProbeCommandText } from './getLiquidProbeCommandText'
export { getRailLightsCommandText } from './getRailLightsCommandText'
23 changes: 21 additions & 2 deletions shared-data/command/types/incidental.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type { CommonCommandRunTimeInfo, CommonCommandCreateInfo } from '.'
import type { StatusBarAnimation } from '../../js/types'

export type IncidentalCreateCommand = SetStatusBarCreateCommand
export type IncidentalCreateCommand =
| SetStatusBarCreateCommand
| SetRailLightsCreateCommand

export type IncidentalRunTimeCommand = SetStatusBarRunTimeCommand
export type IncidentalRunTimeCommand =
| SetStatusBarRunTimeCommand
| SetRailLightsRunTimeCommand

export interface SetStatusBarCreateCommand extends CommonCommandCreateInfo {
commandType: 'setStatusBar'
Expand All @@ -19,3 +23,18 @@ export interface SetStatusBarRunTimeCommand
interface SetStatusBarParams {
animation: StatusBarAnimation
}

export interface SetRailLightsCreateCommand extends CommonCommandCreateInfo {
commandType: 'setRailLights'
params: SetRailLightsParams
}

export interface SetRailLightsRunTimeCommand
extends CommonCommandRunTimeInfo,
SetRailLightsCreateCommand {
result?: any
}

interface SetRailLightsParams {
on: boolean
}

0 comments on commit 4ddd1cf

Please sign in to comment.