import {Component, Fragment} from 'react'; import {InjectedRouter} from 'react-router'; import {Location} from 'history'; import {Client} from 'sentry/api'; import EventsRequest from 'sentry/components/charts/eventsRequest'; import LoadingPanel from 'sentry/components/charts/loadingPanel'; import {HeaderTitle} from 'sentry/components/charts/styles'; import {getInterval} from 'sentry/components/charts/utils'; import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse'; import {Panel} from 'sentry/components/panels'; import Placeholder from 'sentry/components/placeholder'; import QuestionTooltip from 'sentry/components/questionTooltip'; import {IconWarning} from 'sentry/icons'; import {Organization} from 'sentry/types'; import {getUtcToLocalDateObject} from 'sentry/utils/dates'; import EventView from 'sentry/utils/discover/eventView'; import getDynamicText from 'sentry/utils/getDynamicText'; import withApi from 'sentry/utils/withApi'; import {getAxisOptions} from '../data'; import {DoubleHeaderContainer, ErrorPanel} from '../styles'; import Chart from './chart'; import Footer from './footer'; type Props = { api: Client; eventView: EventView; location: Location; organization: Organization; router: InjectedRouter; }; class Container extends Component { getChartParameters() { const {location, organization} = this.props; const options = getAxisOptions(organization); const left = options.find(opt => opt.value === location.query.left) || options[0]; const right = options.find(opt => opt.value === location.query.right) || options[1]; return [left, right]; } render() { const {api, organization, location, eventView, router} = this.props; // construct request parameters for fetching chart data const globalSelection = eventView.getPageFilters(); const start = globalSelection.datetime.start ? getUtcToLocalDateObject(globalSelection.datetime.start) : null; const end = globalSelection.datetime.end ? getUtcToLocalDateObject(globalSelection.datetime.end) : null; const {utc} = normalizeDateTimeParams(location.query); const axisOptions = this.getChartParameters(); const apiPayload = eventView.getEventsAPIPayload(location); return ( opt.value)} partial > {({loading, reloading, errored, results}) => { if (errored) { return ( ); } return ( {axisOptions.map((option, i) => (
{option.label}
))}
{results ? ( getDynamicText({ value: ( ), fixed: , }) ) : ( )}
); }}