index.tsx 2.0 KB

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