adminPackages.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {Fragment} from 'react';
  2. import {t} from 'sentry/locale';
  3. import AsyncView from 'sentry/views/asyncView';
  4. type Data = {
  5. extensions: [key: string, value: string][];
  6. modules: [key: string, value: string][];
  7. };
  8. type State = AsyncView['state'] & {data: Data};
  9. export default class AdminPackages extends AsyncView<{}, State> {
  10. getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
  11. return [['data', '/internal/packages/']];
  12. }
  13. renderBody() {
  14. const {data} = this.state;
  15. const {extensions, modules} = data;
  16. return (
  17. <div>
  18. <h3>{t('Extensions')}</h3>
  19. {extensions.length > 0 ? (
  20. <dl className="vars">
  21. {extensions.map(([key, value]) => (
  22. <Fragment key={key}>
  23. <dt>{key}</dt>
  24. <dd>
  25. <pre className="val">{value}</pre>
  26. </dd>
  27. </Fragment>
  28. ))}
  29. </dl>
  30. ) : (
  31. <p>{t('No extensions registered')}</p>
  32. )}
  33. <h3>{t('Modules')}</h3>
  34. {modules.length > 0 ? (
  35. <dl className="vars">
  36. {modules.map(([key, value]) => (
  37. <Fragment key={key}>
  38. <dt>{key}</dt>
  39. <dd>
  40. <pre className="val">{value}</pre>
  41. </dd>
  42. </Fragment>
  43. ))}
  44. </dl>
  45. ) : (
  46. <p>{t('No modules registered')}</p>
  47. )}
  48. </div>
  49. );
  50. }
  51. }