index.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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, PageFilters, Project} from 'sentry/types';
  8. import {Event} from 'sentry/types/event';
  9. import useApi from 'sentry/utils/useApi';
  10. import withOrganization from 'sentry/utils/withOrganization';
  11. import withPageFilters from 'sentry/utils/withPageFilters';
  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. selection: PageFilters;
  25. }
  26. // Blocks rendering of the event until the environment is loaded
  27. export function GroupEventDetailsContainer(props: GroupEventDetailsProps) {
  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 {selection, ...otherProps} = props;
  43. const environments: Environment[] = state.environments.filter(env =>
  44. selection.environments.includes(env.name)
  45. );
  46. return <GroupEventDetails {...otherProps} api={api} environments={environments} />;
  47. }
  48. export default withOrganization(withPageFilters(GroupEventDetailsContainer));