Skip to content

Commit

Permalink
fix(app,shared-data): change type name from boolean to bool
Browse files Browse the repository at this point in the history
change type name from `boolean` to `bool` because fe uses boolean but actually be returns `bool`.

fix AUTH-262
  • Loading branch information
koji committed Apr 2, 2024
1 parent bb680e2 commit 07e80fa
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const mockRunTimeParameters: RunTimeParameter[] = [
value: false,
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
},
{
Expand Down Expand Up @@ -226,7 +226,7 @@ describe('ChooseRobotSlideout', () => {
})

screen.getByText(param.displayName)
if (param.type === 'boolean' || 'choices' in param) {
if (param.type === 'bool' || 'choices' in param) {
screen.getByText(param.description)
} else {
if (param.type === 'int') {
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/ChooseRobotSlideout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export function ChooseRobotSlideout(
}}
/>
)
} else if (runtimeParam.type === 'boolean') {
} else if (runtimeParam.type === 'bool') {
return (
<Flex
flexDirection={DIRECTION_COLUMN}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function ChooseRobotToRunProtocolSlideoutComponent(
value: false,
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const mockRunTimeParameterData: RunTimeParameter[] = [
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
value: false,
},
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('ProtocolRunRuntimeParameters', () => {
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
value: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const mockRunTimeParameter: RunTimeParameter[] = [
variableName: 'TIP_TRASH',
description:
'to throw tip into the trash or to not throw tip into the trash',
type: 'boolean',
type: 'bool',
default: true,
value: true,
},
Expand Down
10 changes: 5 additions & 5 deletions app/src/organisms/ProtocolSetupParameters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export const mockData: RunTimeParameter[] = [
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
},
{
value: true,
displayName: 'Use Gripper',
variableName: 'USE_GRIPPER',
description: 'For using the gripper.',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand All @@ -41,15 +41,15 @@ export const mockData: RunTimeParameter[] = [
variableName: 'TIP_TRASH',
description:
'to throw tip into the trash or to not throw tip into the trash',
type: 'boolean',
type: 'bool',
default: true,
},
{
value: true,
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature on the module',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand Down Expand Up @@ -224,7 +224,7 @@ export function ProtocolSetupParameters({
return (
<React.Fragment key={`${parameter.displayName}_${index}`}>
<ProtocolSetupStep
hasIcon={!(parameter.type === 'boolean')}
hasIcon={!(parameter.type === 'bool')}
status="general"
title={parameter.displayName}
onClickSetupStep={() => console.log('TODO: wire this up')}
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/ProtocolDetails/Parameters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const Parameters = (props: { protocolId: string }): JSX.Element => {
}

switch (type) {
case 'boolean': {
case 'bool': {
return t('on_off')
}
case 'float':
Expand Down
8 changes: 4 additions & 4 deletions app/src/pages/ProtocolDetails/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ export const mockRunTimeParameterData: RunTimeParameter[] = [
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'a dry run description',
type: 'boolean',
type: 'bool',
default: false,
value: false,
},
{
displayName: 'Use Gripper',
variableName: 'USE_GRIPPER',
description: '',
type: 'boolean',
type: 'bool',
default: true,
value: true,
},
{
displayName: 'Trash Tips',
variableName: 'TIP_TRASH',
description: 'throw tip in trash',
type: 'boolean',
type: 'bool',
default: true,
value: true,
},
{
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature?',
type: 'boolean',
type: 'bool',
default: true,
value: true,
},
Expand Down
8 changes: 4 additions & 4 deletions app/src/pages/Protocols/hooks/__tests__/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ const mockRTPData = [
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'a dry run description',
type: 'boolean',
type: 'bool',
default: false,
},
{
displayName: 'Use Gripper',
variableName: 'USE_GRIPPER',
description: '',
type: 'boolean',
type: 'bool',
default: true,
},
{
displayName: 'Trash Tips',
variableName: 'TIP_TRASH',
description: 'throw tip in trash',
type: 'boolean',
type: 'bool',
default: true,
},
{
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature?',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand Down
8 changes: 4 additions & 4 deletions app/src/pages/Protocols/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ export const useRunTimeParameters = (
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
},
{
value: true,
displayName: 'Use Gripper',
variableName: 'USE_GRIPPER',
description: 'For using the gripper.',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand All @@ -223,15 +223,15 @@ export const useRunTimeParameters = (
variableName: 'TIP_TRASH',
description:
'to throw tip into the trash or to not throw tip into the trash',
type: 'boolean',
type: 'bool',
default: true,
},
{
value: true,
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature on the module',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ const runTimeParameters: RunTimeParameter[] = [
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
},
{
value: true,
displayName: 'Use Gripper',
variableName: 'USE_GRIPPER',
description: 'For using the gripper.',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand All @@ -34,15 +34,15 @@ const runTimeParameters: RunTimeParameter[] = [
variableName: 'TIP_TRASH',
description:
'to throw tip into the trash or to not throw tip into the trash',
type: 'boolean',
type: 'bool',
default: true,
},
{
value: true,
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature on the module',
type: 'boolean',
type: 'bool',
default: true,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const mockRunTimeParameter: RunTimeParameter[] = [
variableName: 'TIP_TRASH',
description:
'to throw tip into the trash or to not throw tip into the trash',
type: 'boolean',
type: 'bool',
default: true,
value: true,
},
Expand Down
2 changes: 1 addition & 1 deletion components/src/molecules/ParametersTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function ParametersTable({
case 'int':
case 'float':
return minMax
case 'boolean':
case 'bool':
return t != null ? t('on_off') : 'On, off'
case 'str':
if (count > 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('utils-formatRunTimeParameterValue', () => {
displayName: 'Deactivate Temperatures',
variableName: 'DEACTIVATE_TEMP',
description: 'deactivate temperature on the module',
type: 'boolean',
type: 'bool',
default: true,
} as RunTimeParameter
const result = formatRunTimeParameterValue(mockData, mockTFunction)
Expand All @@ -83,7 +83,7 @@ describe('utils-formatRunTimeParameterValue', () => {
displayName: 'Dry Run',
variableName: 'DRYRUN',
description: 'Is this a dry or wet run? Wet is true, dry is false',
type: 'boolean',
type: 'bool',
default: false,
} as RunTimeParameter
const result = formatRunTimeParameterValue(mockData, mockTFunction)
Expand Down
2 changes: 1 addition & 1 deletion shared-data/js/helpers/formatRunTimeParameterValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const formatRunTimeParameterValue = (
return suffix !== null
? `${defaultValue.toString()} ${suffix}`
: defaultValue.toString()
case 'boolean':
case 'bool':
if (t != null) {
return Boolean(defaultValue) ? t('on') : t('off')
} else {
Expand Down
2 changes: 1 addition & 1 deletion shared-data/js/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ interface BooleanParameter {
}

type NumberParameterType = 'int' | 'float'
type BooleanParameterType = 'boolean'
type BooleanParameterType = 'bool'
type StringParameterType = 'str'
type RunTimeParameterType =
| NumberParameter
Expand Down

0 comments on commit 07e80fa

Please sign in to comment.