Skip to content

Commit

Permalink
feat(app): App support for downloading plate reader CSV files (#16551)
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored Oct 21, 2024
1 parent 0fc0db9 commit 0961a8b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 3 deletions.
1 change: 1 addition & 0 deletions api-client/src/runs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface LegacyGoodRunData {
export interface KnownGoodRunData extends LegacyGoodRunData {
ok: true
runTimeParameters: RunTimeParameter[]
outputFileIds: string[]
}

export interface KnownInvalidRunData extends LegacyGoodRunData {
Expand Down
3 changes: 3 additions & 0 deletions app/src/assets/localization/en/run_details.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"custom_values": "Custom values",
"data_out_of_date": "This data is likely out of date",
"date": "Date",
"device_details": "Device details",
"door_is_open": "Robot door is open",
"door_open_pause": "Current Step - Paused - Door Open",
"download": "Download",
"download_files": "Download files",
"download_run_log": "Download run log",
"downloading_run_log": "Downloading run log",
"drop_tip": "Dropping tip in {{well_name}} of {{labware}} in {{labware_location}}",
Expand All @@ -45,6 +47,7 @@
"error_info": "Error {{errorCode}}: {{errorType}}",
"error_type": "Error: {{errorType}}",
"failed_step": "Failed step",
"files_available_robot_details": "All files associated with the protocol run are available on the robot detail screen.",
"final_step": "Final Step",
"ignore_stored_data": "Ignore stored data",
"labware": "labware",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export function HistoricalProtocolRunDrawer(
return acc
}, [])
: []
if ('outputFileIds' in run && run.outputFileIds.length > 0) {
runDataFileIds.push(...run.outputFileIds)
}

const uniqueLabwareOffsets = allLabwareOffsets?.filter(
(offset, index, array) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'

import { Box, SPACING, Banner } from '@opentrons/components'
import {
Box,
StyledText,
Link,
SPACING,
Banner,
Flex,
DIRECTION_COLUMN,
JUSTIFY_SPACE_BETWEEN,
DIRECTION_ROW,
ALIGN_CENTER,
TEXT_DECORATION_UNDERLINE,
} from '@opentrons/components'

import { ProtocolAnalysisErrorBanner } from './ProtocolAnalysisErrorBanner'
import {
Expand All @@ -21,17 +34,25 @@ export type RunHeaderBannerContainerProps = ProtocolRunHeaderProps & {
isResetRunLoading: boolean
runErrors: UseRunErrorsResult
runHeaderModalContainerUtils: UseRunHeaderModalContainerResult
hasDownloadableFiles: boolean
}

// Holds all the various banners that render in ProtocolRunHeader.
export function RunHeaderBannerContainer(
props: RunHeaderBannerContainerProps
): JSX.Element | null {
const { runStatus, enteredER, runHeaderModalContainerUtils } = props
const navigate = useNavigate()
const {
runStatus,
enteredER,
runHeaderModalContainerUtils,
hasDownloadableFiles,
robotName,
} = props
const { analysisErrorModalUtils } = runHeaderModalContainerUtils

const { t } = useTranslation(['run_details', 'shared'])
const isDoorOpen = useIsDoorOpen(props.robotName)
const isDoorOpen = useIsDoorOpen(robotName)

const {
showRunCanceledBanner,
Expand Down Expand Up @@ -73,6 +94,36 @@ export function RunHeaderBannerContainer(
{...props}
/>
) : null}
{hasDownloadableFiles ? (
<Banner type="informing" marginTop={SPACING.spacing16}>
<Flex
width="100%"
flexDirection={DIRECTION_ROW}
justifyContent={JUSTIFY_SPACE_BETWEEN}
alignItems={ALIGN_CENTER}
>
<Flex flexDirection={DIRECTION_COLUMN}>
<StyledText
desktopStyle="captionSemiBold"
marginBottom={SPACING.spacing4}
>
{t('download_files')}
</StyledText>
<StyledText desktopStyle="captionRegular">
{t('files_available_robot_details')}
</StyledText>
</Flex>
<Link
textDecoration={TEXT_DECORATION_UNDERLINE}
onClick={() => {
navigate(`/devices/${robotName}`)
}}
>
{t('device_details')}
</Link>
</Flex>
</Banner>
) : null}
</Box>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export function ProtocolRunHeader(
isResetRunLoading={isResetRunLoadingRef.current}
runErrors={runErrors}
runHeaderModalContainerUtils={runHeaderModalContainerUtils}
hasDownloadableFiles={
runRecord?.data != null &&
'outputFileIds' in runRecord.data &&
runRecord.data.outputFileIds.length > 0
}
{...props}
/>
<RunHeaderContent
Expand Down

0 comments on commit 0961a8b

Please sign in to comment.