adminPackages.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {Fragment} from 'react';
  2. import LoadingError from 'sentry/components/loadingError';
  3. import LoadingIndicator from 'sentry/components/loadingIndicator';
  4. import {t} from 'sentry/locale';
  5. import {useApiQuery} from 'sentry/utils/queryClient';
  6. type Data = {
  7. extensions: [key: string, value: string][];
  8. modules: [key: string, value: string][];
  9. };
  10. export default function AdminPackages() {
  11. const {data, isLoading, isError} = useApiQuery<Data>(['/internal/packages/'], {
  12. staleTime: 0,
  13. });
  14. if (isError) {
  15. return <LoadingError />;
  16. }
  17. if (isLoading) {
  18. return <LoadingIndicator />;
  19. }
  20. return (
  21. <div>
  22. <h3>{t('Extensions')}</h3>
  23. {data?.extensions && data?.extensions.length > 0 ? (
  24. <dl className="vars">
  25. {data?.extensions.map(([key, value]) => (
  26. <Fragment key={key}>
  27. <dt>{key}</dt>
  28. <dd>
  29. <pre className="val">{value}</pre>
  30. </dd>
  31. </Fragment>
  32. ))}
  33. </dl>
  34. ) : (
  35. <p>{t('No extensions registered')}</p>
  36. )}
  37. <h3>{t('Modules')}</h3>
  38. {data?.modules && data?.modules.length > 0 ? (
  39. <dl className="vars">
  40. {data?.modules.map(([key, value]) => (
  41. <Fragment key={key}>
  42. <dt>{key}</dt>
  43. <dd>
  44. <pre className="val">{value}</pre>
  45. </dd>
  46. </Fragment>
  47. ))}
  48. </dl>
  49. ) : (
  50. <p>{t('No modules registered')}</p>
  51. )}
  52. </div>
  53. );
  54. }