import React from 'react'; import { Loader, NoContent } from 'UI'; import { widgetHOC, Styles, AvgLabel } from '../common'; import { withRequest } from 'HOCs'; import { ResponsiveContainer, AreaChart, XAxis, YAxis, CartesianGrid, Area, Tooltip } from 'recharts'; import WidgetAutoComplete from 'Shared/WidgetAutoComplete'; import { toUnderscore } from 'App/utils'; import { LAST_24_HOURS, LAST_30_MINUTES, YESTERDAY, LAST_7_DAYS } from 'Types/app/period'; const WIDGET_KEY = 'timeToRender'; const customParams = rangeName => { const params = { density: 70 } if (rangeName === LAST_24_HOURS) params.density = 70 if (rangeName === LAST_30_MINUTES) params.density = 70 if (rangeName === YESTERDAY) params.density = 70 if (rangeName === LAST_7_DAYS) params.density = 70 return params } @withRequest({ dataName: "options", initialData: [], dataWrapper: data => data, loadingName: "optionsLoading", requestName: "fetchOptions", endpoint: '/dashboard/' + toUnderscore(WIDGET_KEY) + '/search', method: 'GET' }) @widgetHOC(WIDGET_KEY, { customParams }) export default class TimeToRender extends React.PureComponent { onSelect = (params) => { const _params = customParams(this.props.period.rangeName) this.props.fetchWidget(WIDGET_KEY, this.props.period, this.props.platform, { ..._params, url: params.value }, this.props.filters) } render() { const { data, loading, optionsLoading, period, compare = false, showSync = false } = this.props; const colors = compare ? Styles.compareColors : Styles.colors; const params = customParams(period.rangeName) const gradientDef = Styles.gradientDef(); return (
{gradientDef} Styles.tickFormatter(val)} />
); } }