[Infrastructure UI] Lens charts reload problem fix (#149517)

## 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 <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Carlos Crespo 2023-01-26 14:18:45 +01:00 committed by GitHub
parent de7eb48f91
commit 7facd3be50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -46,7 +46,7 @@ export const getBreakdownColumn = (
type: 'alphabetical',
fallback: false,
},
orderDirection: 'desc',
orderDirection: 'asc',
otherBucket: false,
missingBucket: false,
parentFormat: {

View file

@ -79,7 +79,7 @@ describe('useHostTable hook', () => {
fallback: false,
type: 'alphabetical',
},
orderDirection: 'desc',
orderDirection: 'asc',
otherBucket: false,
parentFormat: {
id: 'terms',

View file

@ -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;
@ -37,6 +38,7 @@ export const MetricChart = ({ title, type, breakdownSize }: MetricChartProps) =>
onSubmit,
} = useUnifiedSearchContext();
const { metricsDataView } = useMetricsDataViewContext();
const { baseRequest } = useHostsViewContext();
const {
services: { lens },
} = useKibana<InfraClientSetupDeps>();
@ -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`,