);
}
- const newDates = this.getStateZoomDates(
- this.props,
- nextProps,
- newSeries ? newSeries : this.state.series
- );
+ const newDates = this.getStateZoomDates(this.props, nextProps, newSeries);
if (newSeries || newDates) {
let newState = {};
getStateZoomDates = (
props: ?Props,
nextProps: Props,
- series: Array<Serie>
+ newSeries: ?Array<Serie>
): ?{ graphEndDate: ?Date, graphStartDate: ?Date } => {
const newDates = { from: nextProps.query.from || null, to: nextProps.query.to || null };
- if (props && datesQueryChanged(props.query, nextProps.query)) {
+ if (!props || datesQueryChanged(props.query, nextProps.query)) {
return { graphEndDate: newDates.to, graphStartDate: newDates.from };
}
- if (newDates.to == null && newDates.from == null) {
+
+ if (newDates.to == null && newDates.from == null && newSeries != null) {
+ const series = newSeries ? newSeries : this.state.series;
const firstValid = minBy(series.map(serie => serie.data.find(p => p.y || p.y === 0)), 'x');
const lastValid = maxBy(
series.map(serie => findLast(serie.data, p => p.y || p.y === 0)),
graphStartDate: firstValid ? firstValid.x : newDates.from
};
}
- if (!props) {
- return { graphEndDate: newDates.to, graphStartDate: newDates.from };
- }
};
addCustomMetric = (metric: string) => {
}
eventFilter=""
graph="overview"
- graphEndDate={2016-10-27T14:33:50.000Z}
- graphStartDate={2016-10-26T10:17:29.000Z}
+ graphEndDate={null}
+ graphStartDate={null}
leakPeriodDate="2017-05-16T13:50:02+0200"
loading={false}
measuresHistory={
updateSelectedDate={[Function]}
/>
<GraphsZoom
- graphEndDate={2016-10-27T14:33:50.000Z}
- graphStartDate={2016-10-26T10:17:29.000Z}
+ graphEndDate={null}
+ graphStartDate={null}
leakPeriodDate="2017-05-16T13:50:02+0200"
loading={false}
metricsType="INT"