Skip to content

Commit

Permalink
Merge branch 'edge' into store_in_api
Browse files Browse the repository at this point in the history
Resolve conflicts in:
  * robot-server/robot_server/deck_configuration/store.py
  * robot-server/tests/integration/http_api/test_deck_configuration.tavern.yaml
  • Loading branch information
SyntaxColoring committed Nov 21, 2023
2 parents 4d8ef7f + a582169 commit b055494
Show file tree
Hide file tree
Showing 33 changed files with 310 additions and 169 deletions.
2 changes: 1 addition & 1 deletion api-client/src/deck_configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export interface UpdateDeckConfigurationRequest {
export interface DeckConfigurationResponse {
data: {
cutoutFixtures: DeckConfiguration
lastUpdatedAt: string
lastModifiedAt: string
}
}
31 changes: 18 additions & 13 deletions api/docs/v2/new_protocol_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,46 @@

.. _protocol-api-reference:

***********************
API Version 2 Reference
=======================
***********************

.. _protocol_api-protocols-and-instruments:

Protocols and Instruments
-------------------------
Protocols
=========
.. module:: opentrons.protocol_api

.. autoclass:: opentrons.protocol_api.ProtocolContext
:members:
:exclude-members: location_cache, cleanup, clear_commands, load_waste_chute
:exclude-members: location_cache, cleanup, clear_commands

Instruments
===========
.. autoclass:: opentrons.protocol_api.InstrumentContext
:members:
:exclude-members: delay, configure_nozzle_layout, prepare_to_aspirate

.. autoclass:: opentrons.protocol_api.Liquid
:exclude-members: delay

.. _protocol-api-labware:

Labware and Wells
-----------------
Labware
=======
.. autoclass:: opentrons.protocol_api.Labware
:members:
:exclude-members: next_tip, use_tips, previous_tip, return_tips

Wells and Liquids
=================
.. autoclass:: opentrons.protocol_api.Well
:members:
:exclude-members: geometry

.. autoclass:: opentrons.protocol_api.Liquid

.. _protocol-api-modules:

Modules
-------
=======

.. autoclass:: opentrons.protocol_api.HeaterShakerContext
:members:
Expand Down Expand Up @@ -66,8 +71,8 @@ Modules

.. _protocol-api-types:

Useful Types and Definitions
----------------------------
Useful Types
============

..
The opentrons.types module contains a mixture of public Protocol API things and private internal things.
Expand All @@ -80,7 +85,7 @@ Useful Types and Definitions
:no-value:

Executing and Simulating Protocols
----------------------------------
==================================

.. automodule:: opentrons.execute
:members:
Expand Down
8 changes: 2 additions & 6 deletions api/src/opentrons/protocol_engine/state/addressable_areas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Basic addressable area data state and store."""
from dataclasses import dataclass
from typing import Dict, Set, Union, List, Tuple
from typing import Dict, Set, Union, List

from opentrons_shared_data.deck.dev_types import DeckDefinitionV4, SlotDefV3

Expand Down Expand Up @@ -59,10 +59,6 @@ def _get_conflicting_addressable_areas(
return loaded_areas_on_cutout


# TODO make the below some sort of better type
DeckConfiguration = List[Tuple[str, str]] # cutout_id, cutout_fixture_id


class AddressableAreaStore(HasState[AddressableAreaState], HandlesActions):
"""Addressable area state container."""

Expand Down Expand Up @@ -126,7 +122,7 @@ def _handle_command(self, command: Command) -> None:

@staticmethod
def _get_addressable_areas_from_deck_configuration(
deck_config: DeckConfiguration, deck_definition: DeckDefinitionV4
deck_config: DeckConfigurationType, deck_definition: DeckDefinitionV4
) -> Dict[str, AddressableArea]:
"""Load all provided addressable areas with a valid deck configuration."""
# TODO uncomment once execute is hooked up with this properly
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,4 +776,4 @@ class QuadrantNozzleLayoutConfiguration(BaseModel):
]

# TODO make the below some sort of better type
DeckConfigurationType = List[Tuple[str, str]]
DeckConfigurationType = List[Tuple[str, str]] # cutout_id, cutout_fixture_id
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from opentrons.protocol_engine.state.addressable_areas import (
AddressableAreaStore,
AddressableAreaState,
DeckConfiguration,
)
from opentrons.protocol_engine.types import (
DeckConfigurationType,
DeckType,
ModuleModel,
LabwareMovementStrategy,
Expand All @@ -33,7 +33,7 @@
)


def _make_deck_config() -> DeckConfiguration:
def _make_deck_config() -> DeckConfigurationType:
return [
("cutoutA1", "singleLeftSlot"),
("cutoutB1", "singleLeftSlot"),
Expand Down
18 changes: 14 additions & 4 deletions app/src/organisms/DeviceDetailsDeckConfiguration/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { css } from 'styled-components'

import {
ALIGN_CENTER,
Expand All @@ -12,7 +13,6 @@ import {
Flex,
JUSTIFY_SPACE_BETWEEN,
Link,
SIZE_5,
SPACING,
TYPOGRAPHY,
} from '@opentrons/components'
Expand Down Expand Up @@ -162,7 +162,7 @@ export function DeviceDetailsDeckConfiguration({
{t('deck_configuration_is_not_available_when_robot_is_busy')}
</Banner>
) : null}
<Flex gridGap={SPACING.spacing40}>
<Flex css={DECK_CONFIG_SECTION_STYLE}>
<Flex
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
marginLeft={`-${SPACING.spacing32}`}
Expand Down Expand Up @@ -197,7 +197,7 @@ export function DeviceDetailsDeckConfiguration({
backgroundColor={COLORS.fundamentalsBackground}
gridGap={SPACING.spacing60}
padding={SPACING.spacing8}
width={SIZE_5}
width="100%"
css={TYPOGRAPHY.labelRegular}
>
<StyledText>
Expand All @@ -213,7 +213,7 @@ export function DeviceDetailsDeckConfiguration({
backgroundColor={COLORS.fundamentalsBackground}
gridGap={SPACING.spacing60}
padding={SPACING.spacing8}
width={SIZE_5}
width="100%"
css={TYPOGRAPHY.labelRegular}
>
<StyledText>{t('no_deck_fixtures')}</StyledText>
Expand All @@ -226,3 +226,13 @@ export function DeviceDetailsDeckConfiguration({
</>
)
}

const DECK_CONFIG_SECTION_STYLE = css`
flex-direction: ${DIRECTION_ROW};
grid-gap: ${SPACING.spacing40};
@media screen and (max-width: 1024px) {
flex-direction: ${DIRECTION_COLUMN};
align-items: ${ALIGN_CENTER};
grid-gap: ${SPACING.spacing32};
}
`
9 changes: 5 additions & 4 deletions app/src/pages/ProtocolDashboard/ProtocolCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ export function ProtocolCard(props: {
)

const isFailedAnalysis =
(mostRecentAnalysis != null &&
'result' in mostRecentAnalysis &&
(mostRecentAnalysis.result === 'error' ||
mostRecentAnalysis.result === 'not-ok')) ??
(mostRecentAnalysis == null ||
(mostRecentAnalysis != null &&
'result' in mostRecentAnalysis &&
(mostRecentAnalysis.result === 'error' ||
mostRecentAnalysis.result === 'not-ok'))) ??
false

const handleProtocolClick = (
Expand Down
19 changes: 19 additions & 0 deletions app/src/pages/ProtocolDashboard/__tests__/ProtocolCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,23 @@ describe('ProtocolCard', () => {
)
getByText('Delete protocol')
})

it('should display the analysis failed error modal when clicking on the protocol when doing a long pressing - undefined case', async () => {
mockUseProtocolAnalysisAsDocumentQuery.mockReturnValue({
data: undefined as any,
} as UseQueryResult<CompletedProtocolAnalysis>)
const [{ getByText, getByLabelText }] = render()
const name = getByText('yay mock protocol')
fireEvent.mouseDown(name)
jest.advanceTimersByTime(1005)
expect(props.longPress).toHaveBeenCalled()
getByLabelText('failedAnalysis_icon')
getByText('Failed analysis')
getByText('yay mock protocol').click()
getByText('Protocol analysis failed')
getByText(
'Delete the protocol, make changes to address the error, and resend the protocol to this robot from the Opentrons App.'
)
getByText('Delete protocol')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { css } from 'styled-components'

import { Icon } from '../../icons'
import { Btn, Flex } from '../../primitives'
import { Btn } from '../../primitives'
import { ALIGN_CENTER, DISPLAY_FLEX, JUSTIFY_CENTER } from '../../styles'
import { BORDERS, COLORS } from '../../ui-style-constants'
import { RobotCoordsForeignObject } from '../Deck/RobotCoordsForeignObject'
Expand Down Expand Up @@ -48,20 +48,18 @@ export function EmptyConfigFixture(
flexProps={{ flex: '1' }}
foreignObjectProps={{ flex: '1' }}
>
<Flex css={EMPTY_CONFIG_STYLE}>
<Btn
display={DISPLAY_FLEX}
justifyContent={JUSTIFY_CENTER}
onClick={() => handleClickAdd(fixtureLocation)}
>
<Icon name="add" color={COLORS.blueEnabled} height="2rem" />
</Btn>
</Flex>
<Btn
css={EMPTY_CONFIG_STYLE}
onClick={() => handleClickAdd(fixtureLocation)}
>
<Icon name="add" color={COLORS.blueEnabled} size="2rem" />
</Btn>
</RobotCoordsForeignObject>
)
}

const EMPTY_CONFIG_STYLE = css`
display: ${DISPLAY_FLEX};
align-items: ${ALIGN_CENTER};
justify-content: ${JUSTIFY_CENTER};
background-color: ${COLORS.mediumBlueEnabled};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { css } from 'styled-components'

import { Icon } from '../../icons'
import { Btn, Flex, Text } from '../../primitives'
import { Btn, Text } from '../../primitives'
import { ALIGN_CENTER, DISPLAY_FLEX, JUSTIFY_CENTER } from '../../styles'
import { BORDERS, COLORS, SPACING, TYPOGRAPHY } from '../../ui-style-constants'
import { RobotCoordsForeignObject } from '../Deck/RobotCoordsForeignObject'
Expand Down Expand Up @@ -44,25 +44,26 @@ export function StagingAreaConfigFixture(
flexProps={{ flex: '1' }}
foreignObjectProps={{ flex: '1' }}
>
<Flex css={STAGING_AREA_CONFIG_STYLE}>
<Btn
css={STAGING_AREA_CONFIG_STYLE}
cursor={handleClickRemove != null ? 'pointer' : 'none'}
onClick={
handleClickRemove != null
? () => handleClickRemove(fixtureLocation)
: () => {}
}
>
<Text css={TYPOGRAPHY.smallBodyTextSemiBold}>
{STAGING_AREA_DISPLAY_NAME}
</Text>
{handleClickRemove != null ? (
<Btn
display={DISPLAY_FLEX}
justifyContent={JUSTIFY_CENTER}
onClick={() => handleClickRemove(fixtureLocation)}
>
<Icon name="remove" color={COLORS.white} height="2.25rem" />
</Btn>
) : null}
</Flex>
<Icon name="remove" color={COLORS.white} size="2rem" />
</Btn>
</RobotCoordsForeignObject>
)
}

const STAGING_AREA_CONFIG_STYLE = css`
display: ${DISPLAY_FLEX};
align-items: ${ALIGN_CENTER};
background-color: ${COLORS.grey2};
border-radius: ${BORDERS.borderRadiusSize1};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { css } from 'styled-components'

import { Icon } from '../../icons'
import { Btn, Flex, Text } from '../../primitives'
import { Btn, Text } from '../../primitives'
import { ALIGN_CENTER, DISPLAY_FLEX, JUSTIFY_CENTER } from '../../styles'
import { BORDERS, COLORS, SPACING, TYPOGRAPHY } from '../../ui-style-constants'
import { RobotCoordsForeignObject } from '../Deck/RobotCoordsForeignObject'
Expand Down Expand Up @@ -50,25 +50,26 @@ export function TrashBinConfigFixture(
flexProps={{ flex: '1' }}
foreignObjectProps={{ flex: '1' }}
>
<Flex css={TRASH_BIN_CONFIG_STYLE}>
<Btn
css={TRASH_BIN_CONFIG_STYLE}
cursor={handleClickRemove != null ? 'pointer' : 'none'}
onClick={
handleClickRemove != null
? () => handleClickRemove(fixtureLocation)
: () => {}
}
>
<Text css={TYPOGRAPHY.smallBodyTextSemiBold}>
{TRASH_BIN_DISPLAY_NAME}
</Text>
{handleClickRemove != null ? (
<Btn
display={DISPLAY_FLEX}
justifyContent={JUSTIFY_CENTER}
onClick={() => handleClickRemove(fixtureLocation)}
>
<Icon name="remove" color={COLORS.white} height="2.25rem" />
</Btn>
) : null}
</Flex>
<Icon name="remove" color={COLORS.white} size="2rem" />
</Btn>
</RobotCoordsForeignObject>
)
}

const TRASH_BIN_CONFIG_STYLE = css`
display: ${DISPLAY_FLEX};
align-items: ${ALIGN_CENTER};
background-color: ${COLORS.grey2};
border-radius: ${BORDERS.borderRadiusSize1};
Expand Down
Loading

0 comments on commit b055494

Please sign in to comment.