awsLambdaFailureDetails.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import ExternalLink from 'sentry/components/links/externalLink';
  4. import Panel from 'sentry/components/panels/panel';
  5. import PanelItem from 'sentry/components/panels/panelItem';
  6. import {IconCheckmark, IconWarning} from 'sentry/icons';
  7. import {t, tct, tn} from 'sentry/locale';
  8. import FooterWithButtons from './components/footerWithButtons';
  9. import HeaderWithHelp from './components/headerWithHelp';
  10. type ErrorDetail = {error: string; name: string};
  11. type Props = {
  12. lambdaFunctionFailures: ErrorDetail[];
  13. successCount: number;
  14. };
  15. export default function AwsLambdaFailureDetails({
  16. lambdaFunctionFailures,
  17. successCount,
  18. }: Props) {
  19. const baseDocsUrl =
  20. 'https://docs.sentry.io/product/integrations/cloud-monitoring/aws-lambda/';
  21. return (
  22. <Fragment>
  23. <HeaderWithHelp docsUrl={baseDocsUrl} />
  24. <Wrapper>
  25. <div>
  26. <StyledCheckmark isCircled color="successText" />
  27. <h3>
  28. {tn(
  29. 'successfully updated %s function',
  30. 'successfully updated %s functions',
  31. successCount
  32. )}
  33. </h3>
  34. </div>
  35. <div>
  36. <StyledWarning color="errorText" />
  37. <h3>
  38. {tn(
  39. 'Failed to update %s function',
  40. 'Failed to update %s functions',
  41. lambdaFunctionFailures.length
  42. )}
  43. </h3>
  44. <Troubleshooting>
  45. {tct('See [link:Troubleshooting Docs]', {
  46. link: <ExternalLink href={baseDocsUrl + '#troubleshooting'} />,
  47. })}
  48. </Troubleshooting>
  49. </div>
  50. <StyledPanel>{lambdaFunctionFailures.map(SingleFailure)}</StyledPanel>
  51. </Wrapper>
  52. <FooterWithButtons buttonText={t('Finish Setup')} href="?finish_pipeline=1" />
  53. </Fragment>
  54. );
  55. }
  56. function SingleFailure(errorDetail: ErrorDetail) {
  57. return (
  58. <StyledRow key={errorDetail.name}>
  59. <span>{errorDetail.name}</span>
  60. <Error>{errorDetail.error}</Error>
  61. </StyledRow>
  62. );
  63. }
  64. const Wrapper = styled('div')`
  65. padding: 100px 50px 50px 50px;
  66. `;
  67. const StyledRow = styled(PanelItem)`
  68. display: flex;
  69. flex-direction: column;
  70. `;
  71. const Error = styled('span')`
  72. color: ${p => p.theme.subText};
  73. `;
  74. const StyledPanel = styled(Panel)`
  75. overflow: hidden;
  76. margin-left: 34px;
  77. `;
  78. const Troubleshooting = styled('p')`
  79. margin-left: 34px;
  80. `;
  81. const StyledCheckmark = styled(IconCheckmark)`
  82. float: left;
  83. margin-right: 10px;
  84. height: 24px;
  85. width: 24px;
  86. `;
  87. const StyledWarning = styled(IconWarning)`
  88. float: left;
  89. margin-right: 10px;
  90. height: 24px;
  91. width: 24px;
  92. `;