publicKey.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {motion} from 'framer-motion';
  2. import LoadingIndicator from 'sentry/components/loadingIndicator';
  3. import {IconFile} from 'sentry/icons/iconFile';
  4. import {t} from 'sentry/locale';
  5. import testableTransition from 'sentry/utils/testableTransition';
  6. import ContinueButton from 'sentry/views/relocation/components/continueButton';
  7. import RelocationCodeBlock from 'sentry/views/relocation/components/relocationCodeBlock';
  8. import StepHeading from 'sentry/views/relocation/components/stepHeading';
  9. import Wrapper from 'sentry/views/relocation/components/wrapper';
  10. import type {StepProps} from './types';
  11. export function PublicKey({publicKeys, relocationState, onComplete}: StepProps) {
  12. const {regionUrl} = relocationState;
  13. const publicKey = publicKeys.get(regionUrl);
  14. const handleContinue = (event: any) => {
  15. event.preventDefault();
  16. onComplete();
  17. };
  18. return (
  19. <Wrapper data-test-id="public-key">
  20. <StepHeading step={2}>{t("Save Sentry's public key to your machine")}</StepHeading>
  21. {publicKey ? (
  22. <motion.div
  23. transition={testableTransition()}
  24. variants={{
  25. initial: {y: 30, opacity: 0},
  26. animate: {y: 0, opacity: 1},
  27. exit: {opacity: 0},
  28. }}
  29. >
  30. <p>
  31. {t(
  32. "To do so, you'll need to save the following public key to a file accessible from wherever your self-hosted repository is currently installed. You'll need to have this public key file available for the next step."
  33. )}
  34. </p>
  35. <RelocationCodeBlock
  36. dark
  37. filename="key.pub"
  38. icon={<IconFile />}
  39. hideCopyButton={false}
  40. >
  41. {publicKey}
  42. </RelocationCodeBlock>
  43. <ContinueButton priority="primary" type="submit" onClick={handleContinue} />
  44. </motion.div>
  45. ) : (
  46. <motion.div
  47. transition={testableTransition()}
  48. variants={{
  49. initial: {y: 30, opacity: 0},
  50. animate: {y: 0, opacity: 1},
  51. exit: {opacity: 0},
  52. }}
  53. >
  54. <LoadingIndicator />
  55. </motion.div>
  56. )}
  57. </Wrapper>
  58. );
  59. }
  60. export default PublicKey;