mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Dataset quality] using common data types for timeRange (#177630)
This is a [follow up](https://github.com/elastic/kibana/pull/177000#discussion_r1495686459) PR of https://github.com/elastic/kibana/pull/177000. ## Changes - Replace custom types for `timeRangeConfig` in dataset quality with common types coming from data plugin.
This commit is contained in:
parent
d738c2cf2e
commit
623177fc90
9 changed files with 20 additions and 28 deletions
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -53,8 +53,8 @@ export const useDatasetQualityFilters = () => {
|
|||
timeRange: {
|
||||
...timeRange,
|
||||
refresh: {
|
||||
isPaused,
|
||||
interval: refreshInterval,
|
||||
pause: isPaused,
|
||||
value: refreshInterval,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -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<TimeRange, 'from' | 'to'> & {
|
||||
refresh: RefreshInterval;
|
||||
};
|
||||
|
||||
interface FiltersCriteria {
|
||||
inactive: boolean;
|
||||
|
|
|
@ -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: {},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
@ -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 },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue