From 77c981cbcfe77bb07d757ce9e04d347b2719f5f9 Mon Sep 17 00:00:00 2001 From: Lucas Ponce Date: Thu, 3 Dec 2020 23:21:55 +0100 Subject: [PATCH] Fix from time parameters on tracing tabs (#2021) --- .../JaegerIntegration/TracesComponent.tsx | 15 ++++++++++----- src/pages/AppDetails/AppDetailsPage.tsx | 2 +- src/pages/ServiceDetails/ServiceDetailsPage.tsx | 2 +- src/pages/WorkloadDetails/WorkloadDetailsPage.tsx | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/JaegerIntegration/TracesComponent.tsx b/src/components/JaegerIntegration/TracesComponent.tsx index d85e4b7706..3adf65203f 100644 --- a/src/components/JaegerIntegration/TracesComponent.tsx +++ b/src/components/JaegerIntegration/TracesComponent.tsx @@ -28,8 +28,8 @@ import { config } from '../../config'; import { TracesFetcher } from './TracesFetcher'; import { getTimeRangeMicros, buildTags } from './JaegerHelper'; import { SpanDetails } from './JaegerResults/SpanDetails'; -import { TargetKind, TimeInMilliseconds } from 'types/Common'; -import { durationSelector } from '../../store/Selectors'; +import { isEqualTimeRange, TargetKind, TimeInMilliseconds, TimeRange } from 'types/Common'; +import { timeRangeSelector } from '../../store/Selectors'; interface TracesProps { namespace: string; @@ -37,7 +37,7 @@ interface TracesProps { targetKind: TargetKind; urlJaeger: string; namespaceSelector: boolean; - duration: number; + timeRange: TimeRange; selectedTrace?: JaegerTrace; lastRefreshAt: TimeInMilliseconds; } @@ -143,7 +143,12 @@ class TracesComponent extends React.Component { this.setState({ traces: traces }); } } - if (prevProps.duration !== this.props.duration || prevProps.lastRefreshAt !== this.props.lastRefreshAt) { + + const changedTimeRange = !isEqualTimeRange(this.props.timeRange, prevProps.timeRange); + if (this.props.lastRefreshAt !== prevProps.lastRefreshAt || changedTimeRange) { + if (changedTimeRange) { + this.fetcher.resetLastFetchTime(); + } this.fetchTraces(); } } @@ -418,7 +423,7 @@ class TracesComponent extends React.Component { const mapStateToProps = (state: KialiAppState) => { return { - duration: durationSelector(state), + timeRange: timeRangeSelector(state), urlJaeger: state.jaegerState.info ? state.jaegerState.info.url : '', namespaceSelector: state.jaegerState.info ? state.jaegerState.info.namespaceSelector : true, selectedTrace: state.jaegerState.selectedTrace, diff --git a/src/pages/AppDetails/AppDetailsPage.tsx b/src/pages/AppDetails/AppDetailsPage.tsx index d257dc6965..2427f7978b 100644 --- a/src/pages/AppDetails/AppDetailsPage.tsx +++ b/src/pages/AppDetails/AppDetailsPage.tsx @@ -194,11 +194,11 @@ class AppDetails extends React.Component { switch (this.state.currentTab) { case 'info': case 'traffic': - case 'traces': useCustomTime = false; break; case 'in_metrics': case 'out_metrics': + case 'traces': useCustomTime = true; break; } diff --git a/src/pages/ServiceDetails/ServiceDetailsPage.tsx b/src/pages/ServiceDetails/ServiceDetailsPage.tsx index 852472ec68..14b2aeb6a7 100644 --- a/src/pages/ServiceDetails/ServiceDetailsPage.tsx +++ b/src/pages/ServiceDetails/ServiceDetailsPage.tsx @@ -188,10 +188,10 @@ class ServiceDetails extends React.Component