Skip to content

Commit

Permalink
[Infrastructure UI] Lens charts reload problem fix (#149517)
Browse files Browse the repository at this point in the history
## Summary

closes #149514

This PR fixes the problem with lens charts not always reloading when a
search is submitted.

### How to test

Go to Infrastructure > Hosts
- Select a relative date range of 15m from now and click on submit -
should always make all lens charts reload
- Select any absolute date and click on submit- should always make all
lens charts reload

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
crespocarlos and kibanamachine authored Jan 26, 2023
1 parent de7eb48 commit 7facd3b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const getBreakdownColumn = (
type: 'alphabetical',
fallback: false,
},
orderDirection: 'desc',
orderDirection: 'asc',
otherBucket: false,
missingBucket: false,
parentFormat: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('useHostTable hook', () => {
fallback: false,
type: 'alphabetical',
},
orderDirection: 'desc',
orderDirection: 'asc',
otherBucket: false,
parentFormat: {
id: 'terms',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useLensAttributes } from '../../../../../../hooks/use_lens_attributes';
import { useMetricsDataViewContext } from '../../../hooks/use_data_view';
import { useUnifiedSearchContext } from '../../../hooks/use_unified_search';
import { HostLensAttributesTypes } from '../../../../../../common/visualizations';
import { useHostsViewContext } from '../../../hooks/use_hosts_view';

export interface MetricChartProps {
title: string;
Expand All @@ -37,6 +38,7 @@ export const MetricChart = ({ title, type, breakdownSize }: MetricChartProps) =>
onSubmit,
} = useUnifiedSearchContext();
const { metricsDataView } = useMetricsDataViewContext();
const { baseRequest } = useHostsViewContext();
const {
services: { lens },
} = useKibana<InfraClientSetupDeps>();
Expand Down Expand Up @@ -111,6 +113,7 @@ export const MetricChart = ({ title, type, breakdownSize }: MetricChartProps) =>
query={unifiedSearchQuery}
filters={unifiedSearchFilters}
extraActions={extraAction}
lastReloadRequestTime={baseRequest.requestTs}
executionContext={{
type: 'infrastructure_observability_hosts_view',
name: `Hosts View ${type} Chart`,
Expand Down

0 comments on commit 7facd3b

Please sign in to comment.