index.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {RouteComponentProps} from 'react-router';
  2. import LoadingError from 'sentry/components/loadingError';
  3. import LoadingIndicator from 'sentry/components/loadingIndicator';
  4. import {t} from 'sentry/locale';
  5. import OrganizationEnvironmentsStore from 'sentry/stores/organizationEnvironmentsStore';
  6. import {useLegacyStore} from 'sentry/stores/useLegacyStore';
  7. import {Environment, Group, Organization, Project} from 'sentry/types';
  8. import {Event} from 'sentry/types/event';
  9. import useApi from 'sentry/utils/useApi';
  10. import usePageFilters from 'sentry/utils/usePageFilters';
  11. import withOrganization from 'sentry/utils/withOrganization';
  12. import {ReprocessingStatus} from '../utils';
  13. import GroupEventDetails from './groupEventDetails';
  14. export interface GroupEventDetailsProps
  15. extends RouteComponentProps<{groupId: string; eventId?: string}, {}> {
  16. event: Event;
  17. eventError: boolean;
  18. group: Group;
  19. groupReprocessingStatus: ReprocessingStatus;
  20. loadingEvent: boolean;
  21. onRetry: () => void;
  22. organization: Organization;
  23. project: Project;
  24. }
  25. // Blocks rendering of the event until the environment is loaded
  26. export function GroupEventDetailsContainer(props: GroupEventDetailsProps) {
  27. const {selection} = usePageFilters();
  28. const api = useApi();
  29. // fetchOrganizationEnvironments is called in groupDetails.tsx
  30. const state = useLegacyStore(OrganizationEnvironmentsStore);
  31. if (state.error) {
  32. return (
  33. <LoadingError
  34. message={t("There was an error loading your organization's environments")}
  35. />
  36. );
  37. }
  38. // null implies loading state
  39. if (!state.environments) {
  40. return <LoadingIndicator />;
  41. }
  42. const environments: Environment[] = state.environments.filter(env =>
  43. selection.environments.includes(env.name)
  44. );
  45. return <GroupEventDetails {...props} api={api} environments={environments} />;
  46. }
  47. export default withOrganization(GroupEventDetailsContainer);