autofixCard.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import styled from '@emotion/styled';
  2. import {AutofixDoneLogs} from 'sentry/components/events/autofix/autofixDoneLogs';
  3. import {AutofixSteps} from 'sentry/components/events/autofix/autofixSteps';
  4. import {AutofixResult} from 'sentry/components/events/autofix/fixResult';
  5. import type {AutofixData} from 'sentry/components/events/autofix/types';
  6. import Panel from 'sentry/components/panels/panel';
  7. import {t} from 'sentry/locale';
  8. import {space} from 'sentry/styles/space';
  9. export function AutofixCard({data, onRetry}: {data: AutofixData; onRetry: () => void}) {
  10. const hasSteps = data.steps && data.steps.length > 0;
  11. const isDone = data.status !== 'PROCESSING';
  12. return (
  13. <AutofixPanel>
  14. <Title>{t('Autofix')}</Title>
  15. <AutofixResult autofixData={data} onRetry={onRetry} />
  16. {hasSteps && !isDone ? <AutofixSteps data={data} /> : null}
  17. {hasSteps && isDone ? <AutofixDoneLogs data={data} /> : null}
  18. </AutofixPanel>
  19. );
  20. }
  21. const Title = styled('div')`
  22. font-size: ${p => p.theme.fontSizeExtraLarge};
  23. font-weight: bold;
  24. margin-bottom: ${space(2)};
  25. `;
  26. const AutofixPanel = styled(Panel)`
  27. margin-bottom: 0;
  28. overflow: hidden;
  29. background: ${p => p.theme.backgroundSecondary};
  30. padding: ${space(2)} ${space(3)} ${space(3)} ${space(3)};
  31. `;