Skip to content

Commit

Permalink
Fix from time parameters on tracing tabs (kiali#2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce authored Dec 3, 2020
1 parent b6d36ac commit 77c981c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/components/JaegerIntegration/TracesComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ 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;
target: string;
targetKind: TargetKind;
urlJaeger: string;
namespaceSelector: boolean;
duration: number;
timeRange: TimeRange;
selectedTrace?: JaegerTrace;
lastRefreshAt: TimeInMilliseconds;
}
Expand Down Expand Up @@ -143,7 +143,12 @@ class TracesComponent extends React.Component<TracesProps, TracesState> {
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();
}
}
Expand Down Expand Up @@ -418,7 +423,7 @@ class TracesComponent extends React.Component<TracesProps, TracesState> {

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,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AppDetails/AppDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ class AppDetails extends React.Component<AppDetailsProps, AppDetailsState> {
switch (this.state.currentTab) {
case 'info':
case 'traffic':
case 'traces':
useCustomTime = false;
break;
case 'in_metrics':
case 'out_metrics':
case 'traces':
useCustomTime = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceDetails/ServiceDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ class ServiceDetails extends React.Component<ServiceDetailsProps, ServiceDetails
switch (this.state.currentTab) {
case 'info':
case 'traffic':
case 'traces':
useCustomTime = false;
break;
case 'metrics':
case 'traces':
useCustomTime = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/WorkloadDetails/WorkloadDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ class WorkloadDetails extends React.Component<WorkloadDetailsPageProps, Workload
switch (this.state.currentTab) {
case 'info':
case 'traffic':
case 'traces':
useCustomTime = false;
break;
case 'in_metrics':
case 'out_metrics':
case 'logs':
case 'traces':
useCustomTime = true;
break;
}
Expand Down

0 comments on commit 77c981c

Please sign in to comment.