diff --git a/packages/deeplinks/observability/locators/dataset_quality.ts b/packages/deeplinks/observability/locators/dataset_quality.ts index eaaaf23c959ae..bfa760bf62c06 100644 --- a/packages/deeplinks/observability/locators/dataset_quality.ts +++ b/packages/deeplinks/observability/locators/dataset_quality.ts @@ -12,8 +12,8 @@ export const DATASET_QUALITY_LOCATOR_ID = 'DATASET_QUALITY_LOCATOR'; // eslint-disable-next-line @typescript-eslint/consistent-type-definitions type RefreshInterval = { - isPaused: boolean; - interval: number; + pause: boolean; + value: number; }; // eslint-disable-next-line @typescript-eslint/consistent-type-definitions diff --git a/x-pack/plugins/observability_solution/dataset_quality/public/components/dataset_quality/filters/filters.tsx b/x-pack/plugins/observability_solution/dataset_quality/public/components/dataset_quality/filters/filters.tsx index ad9fd6c448560..268a7d07c690c 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/public/components/dataset_quality/filters/filters.tsx +++ b/x-pack/plugins/observability_solution/dataset_quality/public/components/dataset_quality/filters/filters.tsx @@ -69,8 +69,8 @@ export default function Filters() { onRefreshChange={onRefreshChange} commonlyUsedRanges={commonlyUsedRanges} showUpdateButton={true} - isPaused={timeRange.refresh.isPaused} - refreshInterval={timeRange.refresh.interval} + isPaused={timeRange.refresh.pause} + refreshInterval={timeRange.refresh.value} /> diff --git a/x-pack/plugins/observability_solution/dataset_quality/public/components/flyout/degraded_docs_trend/degraded_docs.tsx b/x-pack/plugins/observability_solution/dataset_quality/public/components/flyout/degraded_docs_trend/degraded_docs.tsx index 0f8dcb7e55b2e..bbb67690f9595 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/public/components/flyout/degraded_docs_trend/degraded_docs.tsx +++ b/x-pack/plugins/observability_solution/dataset_quality/public/components/flyout/degraded_docs_trend/degraded_docs.tsx @@ -27,7 +27,7 @@ import { TimeRangeConfig } from '../../../state_machines/dataset_quality_control import { useDatasetQualityContext } from '../../dataset_quality/context'; import { DegradedDocsChart } from './degraded_docs_chart'; -const DEFAULT_REFRESH = { interval: 60000, isPaused: false }; +const DEFAULT_REFRESH = { value: 60000, pause: false }; export function DegradedDocs({ dataStream, diff --git a/x-pack/plugins/observability_solution/dataset_quality/public/hooks/use_dataset_quality_filters.tsx b/x-pack/plugins/observability_solution/dataset_quality/public/hooks/use_dataset_quality_filters.tsx index 8eb842df0f636..f9a94c38d4b40 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/public/hooks/use_dataset_quality_filters.tsx +++ b/x-pack/plugins/observability_solution/dataset_quality/public/hooks/use_dataset_quality_filters.tsx @@ -53,8 +53,8 @@ export const useDatasetQualityFilters = () => { timeRange: { ...timeRange, refresh: { - isPaused, - interval: refreshInterval, + pause: isPaused, + value: refreshInterval, }, }, }); diff --git a/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/defaults.ts b/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/defaults.ts index 797cf0ae85310..6d5239c34812c 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/defaults.ts +++ b/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/defaults.ts @@ -31,8 +31,8 @@ export const DEFAULT_CONTEXT: DefaultDatasetQualityControllerState = { from: 'now-24h', to: 'now', refresh: { - isPaused: true, - interval: ONE_MINUTE_IN_MS, + pause: true, + value: ONE_MINUTE_IN_MS, }, }, integrations: [], diff --git a/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/types.ts b/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/types.ts index acdd7d5c16532..1ea8aea041980 100644 --- a/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/types.ts +++ b/x-pack/plugins/observability_solution/dataset_quality/public/state_machines/dataset_quality_controller/src/types.ts @@ -6,6 +6,7 @@ */ import { DoneInvokeEvent } from 'xstate'; +import { RefreshInterval, TimeRange } from '@kbn/data-plugin/common'; import { Integration } from '../../../../common/data_streams_stats/integration'; import { Direction, SortField } from '../../../hooks'; import { DegradedDocsStat } from '../../../../common/data_streams_stats/malformed_docs_stat'; @@ -30,14 +31,9 @@ interface TableCriteria { }; } -export interface TimeRangeConfig { - from: string; - to: string; - refresh: { - isPaused: boolean; - interval: number; - }; -} +export type TimeRangeConfig = Pick & { + refresh: RefreshInterval; +}; interface FiltersCriteria { inactive: boolean; diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/common/locators/locators.test.ts b/x-pack/plugins/observability_solution/observability_logs_explorer/common/locators/locators.test.ts index ba9c07651f585..cdc50af3f5471 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/common/locators/locators.test.ts +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/common/locators/locators.test.ts @@ -393,8 +393,8 @@ describe('Observability Logs Explorer Locators', () => { it('should create a link with correct timeRange', async () => { const refresh = { - isPaused: false, - interval: 0, + pause: false, + value: 0, }; const locatorParams = { filters: { @@ -410,7 +410,7 @@ describe('Observability Logs Explorer Locators', () => { expect(location).toMatchObject({ app: OBSERVABILITY_LOGS_EXPLORER_APP_ID, - path: '/dataset-quality?pageState=(filters:(timeRange:(from:now-30m,refresh:(interval:0,isPaused:!f),to:now)),v:1)', + path: '/dataset-quality?pageState=(filters:(timeRange:(from:now-30m,refresh:(pause:!f,value:0),to:now)),v:1)', state: {}, }); }); diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/common/url_schema/dataset_quality/url_schema_v1.ts b/x-pack/plugins/observability_solution/observability_logs_explorer/common/url_schema/dataset_quality/url_schema_v1.ts index afb798fd022ec..7395b70585afb 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/common/url_schema/dataset_quality/url_schema_v1.ts +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/common/url_schema/dataset_quality/url_schema_v1.ts @@ -50,8 +50,8 @@ const timeRangeRT = rt.strict({ from: rt.string, to: rt.string, refresh: rt.strict({ - isPaused: rt.boolean, - interval: rt.number, + pause: rt.boolean, + value: rt.number, }), }); diff --git a/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/dataset_quality_link.tsx b/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/dataset_quality_link.tsx index 1d27ae931093b..5d74e6de37a19 100644 --- a/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/dataset_quality_link.tsx +++ b/x-pack/plugins/observability_solution/observability_logs_explorer/public/components/dataset_quality_link.tsx @@ -50,12 +50,8 @@ const constructLocatorParams = ( const locatorParams: DatasetQualityLocatorParams = { filters: { timeRange: { - from: time?.from || 'now-24h', - to: time?.to || 'now', - refresh: { - isPaused: refreshInterval ? refreshInterval.pause : false, - interval: refreshInterval ? refreshInterval.value : 60000, - }, + ...(time ?? { from: 'now-24h', to: 'now' }), + refresh: refreshInterval ?? { pause: false, value: 60000 }, }, }, };