awsLambdaFailureDetails.tsx 2.5 KB

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