import {Component} from 'react'; import {RouteComponentProps} from 'react-router'; import styled from '@emotion/styled'; import {Client} from 'sentry/api'; import NotFound from 'sentry/components/errors/notFound'; import {BorderlessEventEntries} from 'sentry/components/events/eventEntries'; import Footer from 'sentry/components/footer'; import Link from 'sentry/components/links/link'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {t} from 'sentry/locale'; import SentryTypes from 'sentry/sentryTypes'; import space from 'sentry/styles/space'; import {Group} from 'sentry/types'; import withApi from 'sentry/utils/withApi'; import {OrganizationContext} from '../organizationContext'; import SharedGroupHeader from './sharedGroupHeader'; type Props = RouteComponentProps<{shareId: string}, {}> & { api: Client; }; type State = { error: boolean; group: Group | null; loading: boolean; }; class SharedGroupDetails extends Component { static childContextTypes = { group: SentryTypes.Group, }; state: State = this.getInitialState(); getInitialState() { return { group: null, loading: true, error: false, }; } getChildContext() { return { group: this.state.group, }; } componentWillMount() { document.body.classList.add('shared-group'); } componentDidMount() { this.fetchData(); } componentWillUnmount() { document.body.classList.remove('shared-group'); } async fetchData() { const {params, api} = this.props; const {shareId} = params; try { const group = await api.requestPromise(`/shared/issues/${shareId}/`); this.setState({loading: false, group}); } catch { this.setState({loading: false, error: true}); } } handleRetry = () => { this.setState(this.getInitialState()); this.fetchData(); }; getTitle() { const {group} = this.state; return group?.title ?? 'Sentry'; } render() { const {group, loading, error} = this.state; if (loading) { return ; } if (!group) { return ; } if (error) { return ; } const {location, api, route, router} = this.props; const {permalink, latestEvent, project} = group; const title = this.getTitle(); return (
{permalink && ( {t('Details')} )}
); } } const Container = styled('div')` padding: ${space(4)}; `; export {SharedGroupDetails}; export default withApi(SharedGroupDetails);