Skip to content

Commit

Permalink
[Infra UI] Replace usage of deprecated filter types (#120762)
Browse files Browse the repository at this point in the history
* Replace usage of deprecated filter types
  • Loading branch information
Kerry350 authored Dec 9, 2021
1 parent 443ad8e commit 6d732a1
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* 2.0.
*/

import { Query, Filter } from '@kbn/es-query';
import { CoreStart } from 'kibana/public';
import React from 'react';
import ReactDOM from 'react-dom';
import { Subscription } from 'rxjs';
import { Filter, Query, TimeRange } from '../../../../../../src/plugins/data/public';
import { TimeRange } from '../../../../../../src/plugins/data/public';
import {
Embeddable,
EmbeddableInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import { Query } from '@kbn/es-query';
import { EuiBasicTableColumn, EuiInMemoryTable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import * as rt from 'io-ts';
import React, { useMemo } from 'react';
import { Query } from '../../../../../../../src/plugins/data/public';
import { LogEntryField } from '../../../../common/log_entry';
import { LogEntry } from '../../../../common/search_strategies/log_entries/log_entry';
import { TimeKey } from '../../../../common/time';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import React, { useEffect } from 'react';
import type { Query } from '../../../../../../../src/plugins/data/public';
import type { Query } from '@kbn/es-query';
import { TimeKey } from '../../../../common/time';
import { useLogEntry } from '../../../containers/logs/log_entry';
import { CenteredEuiFlyoutBody } from '../../centered_flyout_body';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import * as rt from 'io-ts';
import React, { useContext } from 'react';
import { Query } from '../../../../../../../src/plugins/data/public';
import { Query } from '@kbn/es-query';
import { replaceStateKeyInQueryString, UrlStateContainer } from '../../../utils/url_state';
import { LogFilterState } from './log_filter_state';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import moment from 'moment';
import { stringify } from 'query-string';
import React, { useCallback, useMemo } from 'react';
import { encode, RisonValue } from 'rison-node';
import type { Query } from '../../../../../../../src/plugins/data/public';
import type { Query } from '@kbn/es-query';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { useTrackPageview } from '../../../../../observability/public';
import { TimeKey } from '../../../../common/time';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { Filter } from '@kbn/es-query';
import { useEffect, useReducer, useCallback } from 'react';
import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
import { Filter } from '../../../../../../../src/plugins/data/common';
import { CONTROLLED_BY_SWIM_LANE_FILTER } from '../../../../../ml/public';

interface ReducerState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { EuiSpacer } from '@elastic/eui';
import React, { useContext, useCallback, useMemo, useEffect } from 'react';
import usePrevious from 'react-use/lib/usePrevious';
import type { Query } from '../../../../../../../src/plugins/data/public';
import type { Query } from '@kbn/es-query';
import { euiStyled } from '../../../../../../../src/plugins/kibana_react/common';
import { LogEntry } from '../../../../common/log_entry';
import { TimeKey } from '../../../../common/time';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { useContext } from 'react';
import { Query, QueryStringInput } from '../../../../../../../src/plugins/data/public';
import { Query } from '@kbn/es-query';
import { QueryStringInput } from '../../../../../../../src/plugins/data/public';
import { LogCustomizationMenu } from '../../../components/logging/log_customization_menu';
import { LogDatepicker } from '../../../components/logging/log_datepicker';
import { LogHighlightsMenu } from '../../../components/logging/log_highlights_menu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { fromKueryExpression } from '@kbn/es-query';
import { useState, useMemo, useCallback, useEffect } from 'react';
import * as rt from 'io-ts';
import { pipe } from 'fp-ts/lib/pipeable';
Expand All @@ -15,11 +16,10 @@ import { useAlertPrefillContext } from '../../../../alerting/use_alert_prefill';
import { useUrlState } from '../../../../utils/use_url_state';
import { useSourceContext } from '../../../../containers/metrics_source';
import { convertKueryToElasticSearchQuery } from '../../../../utils/kuery';
import { esKuery } from '../../../../../../../../src/plugins/data/public';

const validateKuery = (expression: string) => {
try {
esKuery.fromKueryExpression(expression);
fromKueryExpression(expression);
} catch (err) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

import { i18n } from '@kbn/i18n';

import { fromKueryExpression } from '@kbn/es-query';
import React, { useEffect, useState } from 'react';
import { DataViewBase } from '@kbn/es-query';
import { WithKueryAutocompletion } from '../../../../containers/with_kuery_autocompletion';
import { AutocompleteField } from '../../../../components/autocomplete_field';
import { esKuery, QuerySuggestion } from '../../../../../../../../src/plugins/data/public';
import { QuerySuggestion } from '../../../../../../../../src/plugins/data/public';

type LoadSuggestionsFn = (
e: string,
Expand All @@ -32,7 +32,7 @@ interface Props {

function validateQuery(query: string) {
try {
esKuery.fromKueryExpression(query);
fromKueryExpression(query);
} catch (err) {
return false;
}
Expand Down
6 changes: 2 additions & 4 deletions x-pack/plugins/infra/public/utils/kuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* 2.0.
*/

import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query';
import { DataViewBase } from '@kbn/es-query';
import { esKuery } from '../../../../../src/plugins/data/public';

export const convertKueryToElasticSearchQuery = (
kueryExpression: string,
Expand All @@ -15,9 +15,7 @@ export const convertKueryToElasticSearchQuery = (
) => {
try {
return kueryExpression
? JSON.stringify(
esKuery.toElasticsearchQuery(esKuery.fromKueryExpression(kueryExpression), indexPattern)
)
? JSON.stringify(toElasticsearchQuery(fromKueryExpression(kueryExpression), indexPattern))
: '';
} catch (err) {
if (swallowErrors) {
Expand Down

0 comments on commit 6d732a1

Please sign in to comment.