Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): Add command text for set rail lights #16255

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading