-
Notifications
You must be signed in to change notification settings - Fork 178
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
fix(app, odd): run summery error list bug fixes #15953
Changes from 6 commits
9bc4866
5d20145
91523b5
8d8113a
d850730
f7e5db1
b3993b4
713b9c4
8fb6aa0
5da9748
1e02e9d
12511b5
e4ddf56
f4c54e2
a1af052
da53912
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,12 @@ import { | |
import { LegacyModal } from '../../../molecules/LegacyModal' | ||
import { useDownloadRunLog } from '../hooks' | ||
|
||
import type { RunError, RunCommandErrors } from '@opentrons/api-client' | ||
import type { | ||
RunError, | ||
RunCommandErrors, | ||
RunStatus, | ||
} from '@opentrons/api-client' | ||
import { RUN_STATUS_SUCCEEDED } from '@opentrons/api-client' | ||
import type { LegacyModalProps } from '../../../molecules/LegacyModal' | ||
import type { RunCommandError } from '@opentrons/shared-data' | ||
|
||
|
@@ -45,6 +50,7 @@ interface RunFailedModalProps { | |
setShowRunFailedModal: (showRunFailedModal: boolean) => void | ||
highestPriorityError?: RunError | null | ||
commandErrorList?: RunCommandErrors | null | ||
runStatus: RunStatus | ||
} | ||
|
||
export function RunFailedModal({ | ||
|
@@ -53,11 +59,17 @@ export function RunFailedModal({ | |
setShowRunFailedModal, | ||
highestPriorityError, | ||
commandErrorList, | ||
runStatus, | ||
}: RunFailedModalProps): JSX.Element | null { | ||
const { i18n, t } = useTranslation(['run_details', 'shared', 'branded']) | ||
const modalProps: LegacyModalProps = { | ||
type: 'error', | ||
title: t('run_failed_modal_title'), | ||
type: runStatus === RUN_STATUS_SUCCEEDED ? 'warning' : 'error', | ||
title: | ||
commandErrorList == null || commandErrorList?.data.length === 0 | ||
? t('run_failed_modal_title') | ||
: runStatus === RUN_STATUS_SUCCEEDED | ||
? t('warning_details') | ||
: t('error_details'), | ||
onClose: () => { | ||
setShowRunFailedModal(false) | ||
}, | ||
|
@@ -95,7 +107,9 @@ export function RunFailedModal({ | |
errorType: errors[0].errorType, | ||
errorCode: errors[0].errorCode, | ||
}) | ||
: `${errors.length} errors`} | ||
: `${errors.length} ${ | ||
TamarZanzouri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
runStatus === RUN_STATUS_SUCCEEDED ? t('warning') : t('error') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this won't translate properly, right? if you translated it into say chinese, if there was more than one error it would have an "s" at the end of the chinese characters, and because the translation isn't number-aware it wouldn't have the right counting word. we should be using the i18n pluralization tools here |
||
}${errors.length > 1 ? 's' : ''}`} | ||
</LegacyStyledText> | ||
<Flex css={ERROR_MESSAGE_STYLE}> | ||
{' '} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,12 @@ import { SmallButton } from '../../../atoms/buttons' | |
import { Modal } from '../../../molecules/Modal' | ||
|
||
import type { ModalHeaderBaseProps } from '../../../molecules/Modal/types' | ||
import type { RunCommandErrors, RunError } from '@opentrons/api-client' | ||
import type { | ||
RunCommandErrors, | ||
RunError, | ||
RunStatus, | ||
} from '@opentrons/api-client' | ||
import { RUN_STATUS_SUCCEEDED } from '@opentrons/api-client' | ||
|
||
import type { RunCommandError } from '@opentrons/shared-data' | ||
|
||
|
@@ -29,13 +34,15 @@ interface RunFailedModalProps { | |
setShowRunFailedModal: (showRunFailedModal: boolean) => void | ||
errors?: RunError[] | ||
commandErrorList?: RunCommandErrors | ||
runStatus: RunStatus | ||
} | ||
|
||
export function RunFailedModal({ | ||
runId, | ||
setShowRunFailedModal, | ||
errors, | ||
commandErrorList, | ||
runStatus, | ||
}: RunFailedModalProps): JSX.Element | null { | ||
const { t, i18n } = useTranslation(['run_details', 'shared', 'branded']) | ||
const navigate = useNavigate() | ||
|
@@ -48,7 +55,12 @@ export function RunFailedModal({ | |
) | ||
return null | ||
const modalHeader: ModalHeaderBaseProps = { | ||
title: t('run_failed_modal_title'), | ||
title: | ||
commandErrorList == null || commandErrorList?.data.length === 0 | ||
? t('run_failed_modal_title') | ||
: runStatus === RUN_STATUS_SUCCEEDED | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing re: plural details |
||
? t('warning_details') | ||
: t('error_details'), | ||
} | ||
|
||
const highestPriorityError = getHighestPriorityError(errors ?? []) | ||
|
@@ -85,7 +97,9 @@ export function RunFailedModal({ | |
errorType: errors[0].errorType, | ||
errorCode: errors[0].errorCode, | ||
}) | ||
: `${errors.length} errors`} | ||
: `${errors.length} ${ | ||
runStatus === RUN_STATUS_SUCCEEDED ? t('warning') : t('error') | ||
}${errors.length > 1 ? 's' : ''}`} | ||
</LegacyStyledText> | ||
<Flex | ||
width="100%" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really? this will affect all the rest of the modals on the ODD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a gap in the div above it. I think we can remove this. can test more if needed!