Skip to content

Commit

Permalink
Shorten Import Statements (#688) (#888)
Browse files Browse the repository at this point in the history
Signed-off-by: Merwane Hamadi <[email protected]>
  • Loading branch information
Tommy Markley authored Oct 26, 2021
1 parent 14e6bef commit c6cb8d6
Show file tree
Hide file tree
Showing 70 changed files with 87 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
OverlayStart,
} from 'opensearch-dashboards/public';
import { DataPublicPluginStart, IndexPatternsContract } from '../../../../plugins/data/public';
import { SavedObjectLoader } from '../../../../plugins/saved_objects/public';
import { SavedObjectLoader } from '../../../saved_objects/public';
import { createSavedDashboardClass } from './saved_dashboard';

interface Services {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/common/search/aggs/param_types/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import { i18n } from '@osd/i18n';
import { IAggConfig } from '../agg_config';
import { SavedObjectNotFound } from '../../../../../../plugins/opensearch_dashboards_utils/common';
import { SavedObjectNotFound } from '../../../../../opensearch_dashboards_utils/common';
import { BaseParamType } from './base';
import { propFilter } from '../utils';
import { OSD_FIELD_TYPES } from '../../../osd_field_types/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
OpenSearchDashboardsContext,
OpenSearchDashboardsDatatable,
ExpressionFunctionDefinition,
} from '../../../../../plugins/expressions/common';
} from '../../../common/search';

type Input = OpenSearchDashboardsContext | null;
type Output = Promise<OpenSearchDashboardsDatatable>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import { OpenSearchDashboardsDatatable } from '../../../../../plugins/expressions/public';
import { deserializeAggConfig } from '../../search/expressions';
import { opensearchFilters, Filter } from '../../../public';
import { getIndexPatterns } from '../../../public/services';
import { getIndexPatterns } from '../../services';
import type { ValueClickContext } from '../../../../embeddable/public';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/actions/select_range_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
APPLY_FILTER_TRIGGER,
createAction,
UiActionsStart,
} from '../../../../plugins/ui_actions/public';
} from '../../../ui_actions/public';
import { createFiltersFromRangeSelectAction } from './filters/create_filters_from_range_select';
import type { RangeSelectContext } from '../../../embeddable/public';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/actions/value_click_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
APPLY_FILTER_TRIGGER,
createAction,
UiActionsStart,
} from '../../../../plugins/ui_actions/public';
} from '../../../ui_actions/public';
import { createFiltersFromValueClickAction } from './filters/create_filters_from_value_click';
import type { Filter } from '../../common/opensearch_query/filters';
import type { ValueClickContext } from '../../../embeddable/public';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/public/search/aggs/aggs_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import { BehaviorSubject, Subscription } from 'rxjs';

import { coreMock } from '../../../../../core/public/mocks';
import { expressionsPluginMock } from '../../../../../plugins/expressions/public/mocks';
import { expressionsPluginMock } from '../../../../expressions/public/mocks';
import { BucketAggType, getAggTypes, MetricAggType } from '../../../common';
import { fieldFormatsServiceMock } from '../../field_formats/mocks';

Expand Down
6 changes: 3 additions & 3 deletions src/plugins/data/public/search/expressions/opensearchaggs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import {
OpenSearchDashboardsDatatable,
OpenSearchDashboardsDatatableColumn,
} from 'src/plugins/expressions/public';
import { PersistedState } from '../../../../../plugins/visualizations/public';
import { Adapters } from '../../../../../plugins/inspector/public';
import { PersistedState } from '../../../../visualizations/public';
import { Adapters } from '../../../../inspector';

import {
calculateBounds,
Expand All @@ -55,7 +55,7 @@ import {
IAggConfigs,
ISearchSource,
tabifyAggResponse,
} from '../../../common/search';
} from '../../../common';

import { FilterManager } from '../../query';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import { OpenSearchDashboardsDatatableColumnMeta } from '../../../../../../plugins/expressions/public';
import { IAggConfig } from '../../../../common';
import { IndexPattern } from '../../../index_patterns';
import { getSearchService } from '../../../../public/services';
import { getSearchService } from '../../../services';

/** @internal */
export const serializeAggConfig = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { FilterableEmbeddableFactory } from '../../../../test_samples/embeddable
import { FilterableContainer } from '../../../../test_samples/embeddables/filterable_container';
import { coreMock } from '../../../../../../../../core/public/mocks';
import { ContactCardEmbeddable } from '../../../../test_samples';
import { opensearchFilters, Filter } from '../../../../../../../../plugins/data/public';
import { opensearchFilters, Filter } from '../../../../../../../data/public';
import { EmbeddableStart } from '../../../../../plugin';
import { embeddablePluginMock } from '../../../../../mocks';
import { defaultTrigger } from '../../../../../../../ui_actions/public/triggers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ import {
FilterableEmbeddable,
ContactCardEmbeddable,
} from '../../../test_samples';
import { inspectorPluginMock } from '../../../../../../../plugins/inspector/public/mocks';
import { inspectorPluginMock } from '../../../../../../inspector/public/mocks';
import { EmbeddableOutput, isErrorEmbeddable, ErrorEmbeddable } from '../../../embeddables';
import { of } from '../../../../tests/helpers';
import { opensearchFilters } from '../../../../../../../plugins/data/public';
import { opensearchFilters } from '../../../../../../data/public';
import { embeddablePluginMock } from '../../../../mocks';
import { EmbeddableStart } from '../../../../plugin';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { FilterableEmbeddableFactory } from '../../../test_samples/embeddables/f
import { FilterableContainer } from '../../../test_samples/embeddables/filterable_container';
import { ViewMode } from '../../../types';
import { ContactCardEmbeddable } from '../../../test_samples/embeddables/contact_card/contact_card_embeddable';
import { opensearchFilters, Filter } from '../../../../../../../plugins/data/public';
import { opensearchFilters, Filter } from '../../../../../../data/public';
import { embeddablePluginMock } from '../../../../mocks';

const { setup, doStart } = embeddablePluginMock.createInstance();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/embeddable/public/tests/container.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
import { coreMock } from '../../../../core/public/mocks';
import { testPlugin } from './test_plugin';
import { of } from './helpers';
import { opensearchFilters, Filter } from '../../../../plugins/data/public';
import { opensearchFilters, Filter } from '../../../data/public';
import { createEmbeddablePanelMock } from '../mocks';

async function creatHelloWorldContainerAndEmbeddable(
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/embeddable/public/tests/explicit_input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { FilterableContainer } from '../lib/test_samples/embeddables/filterable_
import { isErrorEmbeddable } from '../lib';
import { HelloWorldContainer } from '../lib/test_samples/embeddables/hello_world_container';
import { coreMock } from '../../../../core/public/mocks';
import { opensearchFilters, Filter } from '../../../../plugins/data/public';
import { opensearchFilters, Filter } from '../../../data/public';
import { createEmbeddablePanelMock } from '../mocks';

const { setup, doStart, coreStart, uiActions } = testPlugin(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { EuiBetaBadge, EuiSpacer, EuiTitle, EuiText, EuiCode, EuiLink } from '@e
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { DocLinksStart } from 'opensearch-dashboards/public';
import { useOpenSearchDashboards } from '../../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../../types';

export const Header = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ import React, { Component } from 'react';
import { EuiSpacer, EuiCallOut, EuiSwitchEvent } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import {
indexPatterns,
IndexPatternAttributes,
UI_SETTINGS,
} from '../../../../../../../plugins/data/public';
import { indexPatterns, IndexPatternAttributes, UI_SETTINGS } from '../../../../../../data/public';
import {
getIndices,
containsIllegalCharacters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { withRouter, RouteComponentProps } from 'react-router-dom';
import { EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { IndexPattern, IndexPatternField } from '../../../../../../plugins/data/public';
import { useOpenSearchDashboards } from '../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../types';
import { IndexHeader } from '../index_header';
import { TAB_SCRIPTED_FIELDS, TAB_INDEXED_FIELDS } from '../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { withRouter, RouteComponentProps } from 'react-router-dom';

import { IndexPattern } from '../../../../../../plugins/data/public';
import { getEditFieldBreadcrumbs, getCreateFieldBreadcrumbs } from '../../breadcrumbs';
import { useOpenSearchDashboards } from '../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../types';
import { CreateEditField } from './create_edit_field';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { IndexPattern, IndexPatternField } from '../../../../../plugins/data/public';
import { useOpenSearchDashboards } from '../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../types';
import { Tabs } from './tabs';
import { IndexHeader } from './index_header';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import React, { useEffect, useState } from 'react';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import { IndexPattern } from '../../../../../plugins/data/public';
import { useOpenSearchDashboards } from '../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../types';
import { getEditBreadcrumbs } from '../breadcrumbs';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
UI_SETTINGS,
DataPublicPluginStart,
} from '../../../../../../plugins/data/public';
import { useOpenSearchDashboards } from '../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../types';
import { createEditIndexPatternPageStateContainer } from '../edit_index_pattern_state_container';
import { TAB_INDEXED_FIELDS, TAB_SCRIPTED_FIELDS, TAB_SOURCE_FILTERS } from '../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { DefaultFormatEditor, FormatEditorProps } from '../default';

import { fieldFormats } from '../../../../../../../../../plugins/data/public';
import { fieldFormats } from '../../../../../../../../data/public';

interface Color {
range?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { EuiCallOut, EuiIcon, EuiLink, EuiSpacer } from '@elastic/eui';

import { FormattedMessage } from '@osd/i18n/react';

import { useOpenSearchDashboards } from '../../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../../types';

export interface ScriptingWarningCallOutProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import React, { Fragment } from 'react';
import { EuiCode, EuiIcon, EuiLink, EuiText, EuiSpacer } from '@elastic/eui';

import { FormattedMessage } from '@osd/i18n/react';
import { useOpenSearchDashboards } from '../../../../../../../plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../../../types';

export const ScriptingSyntax = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
import { FormattedMessage } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';

import { opensearchQuery, IndexPattern, Query } from '../../../../../../../plugins/data/public';
import { opensearchQuery, IndexPattern, Query } from '../../../../../../data/public';
import { context as contextType } from '../../../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContextValue } from '../../../../types';
import { ExecuteScript } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {
EuiText,
} from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { reactRouterNavigate } from '../../../../../../plugins/opensearch_dashboards_react/public';
import { reactRouterNavigate } from '../../../../../opensearch_dashboards_react/public';
import { MlCardState } from '../../../types';

export const EmptyState = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { i18n } from '@osd/i18n';
import {
reactRouterNavigate,
useOpenSearchDashboards,
} from '../../../../../plugins/opensearch_dashboards_react/public';
} from '../../../../opensearch_dashboards_react/public';
import { IndexPatternManagmentContext } from '../../types';
import { CreateButton } from '../create_button';
import { IndexPatternTableItem, IndexPatternCreationOption } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from '../types';

import { coreMock } from '../../../../core/public/mocks';
import { dataPluginMock, createSearchSourceMock } from '../../../../plugins/data/public/mocks';
import { dataPluginMock, createSearchSourceMock } from '../../../data/public/mocks';
import { getStubIndexPattern, StubIndexPattern } from '../../../../plugins/data/public/test_utils';
import { SavedObjectAttributes, SimpleSavedObject } from 'opensearch-dashboards/public';
import { IIndexPattern } from '../../../data/common/index_patterns';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_table/public/table_vis_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { tableVisResponseHandler } from './table_vis_response_handler';
import tableVisTemplate from './table_vis.html';
import { TableOptions } from './components/table_vis_options_lazy';
import { getTableVisualizationControllerClass } from './vis_controller';
import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';
import { VIS_EVENT_TO_TRIGGER } from '../../visualizations/public';

export function getTableVisTypeDefinition(
core: CoreSetup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import _ from 'lodash';
import { buildAggBody } from './agg_body';
import { search } from '../../../../../../plugins/data/server';
import { search } from '../../../../../data/server';
const { dateHistogramInterval } = search.aggs;

export default function createDateAgg(config, tlConfig, scriptedFields) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import { includes } from 'lodash';
import { injectI18n } from '@osd/i18n/react';
import { EuiComboBox } from '@elastic/eui';
import { calculateSiblings } from '../lib/calculate_siblings';
import { calculateLabel } from '../../../../../../plugins/vis_type_timeseries/common/calculate_label';
import { basicAggs } from '../../../../../../plugins/vis_type_timeseries/common/basic_aggs';
import { toPercentileNumber } from '../../../../../../plugins/vis_type_timeseries/common/to_percentile_number';
import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';
import { calculateLabel } from '../../../../common/calculate_label';
import { basicAggs } from '../../../../common/basic_aggs';
import { toPercentileNumber } from '../../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../../common/metric_types';

function createTypeFilter(restrict, exclude) {
return (metric) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
EuiFieldNumber,
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { MODEL_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/model_options';
import { MODEL_TYPES } from '../../../../common/model_options';

const DEFAULTS = {
model_type: MODEL_TYPES.UNWEIGHTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@osd/i18n/react';
import { OSD_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { PANEL_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/panel_types';
import { PANEL_TYPES } from '../../../../common/panel_types';

const isFieldTypeEnabled = (fieldRestrictions, fieldType) =>
fieldRestrictions.length ? fieldRestrictions.includes(fieldType) : true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,8 @@ import {
AUTO_INTERVAL,
} from './lib/get_interval';
import { i18n } from '@osd/i18n';
import {
TIME_RANGE_DATA_MODES,
TIME_RANGE_MODE_KEY,
} from '../../../../../plugins/vis_type_timeseries/common/timerange_data_modes';
import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';
import { TIME_RANGE_DATA_MODES, TIME_RANGE_MODE_KEY } from '../../../common/timerange_data_modes';
import { PANEL_TYPES } from '../../../common/panel_types';
import { isTimerangeModeEnabled } from '../lib/check_ui_restrictions';
import { VisDataContext } from '../contexts/vis_data_context';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import { set } from '@elastic/safer-lodash-set';
import _ from 'lodash';
import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { getLastValue } from '../../../../common/get_last_value';
import { createTickFormatter } from './tick_formatter';
import moment from 'moment';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import moment from 'moment';
import { i18n } from '@osd/i18n';
import { get } from 'lodash';
import { search } from '../../../../../../plugins/data/public';
import { search } from '../../../../../data/public';
const { parseOpenSearchInterval } = search.aggs;
import { GTE_INTERVAL_RE } from '../../../../../../plugins/vis_type_timeseries/common/interval_regexp';
import { GTE_INTERVAL_RE } from '../../../../common/interval_regexp';

export const AUTO_INTERVAL = 'auto';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/

import { OSD_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';
import { METRIC_TYPES } from '../../../../common/metric_types';

export function getSupportedFieldsByMetricType(type) {
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import _ from 'lodash';
import { newMetricAggFn } from './new_metric_agg_fn';
import { isBasicAgg } from '../../../../../../plugins/vis_type_timeseries/common/agg_lookup';
import { isBasicAgg } from '../../../../common/agg_lookup';
import { handleAdd, handleChange } from './collection_actions';

export const seriesChangeHandler = (props, items) => (doc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import React from 'react';
import classNames from 'classnames';
import uuid from 'uuid';
import { get } from 'lodash';
import { Markdown } from '../../../../../../../plugins/opensearch_dashboards_react/public';
import { Markdown } from '../../../../../../opensearch_dashboards_react/public';

import { ErrorComponent } from '../../error';
import { replaceVars } from '../../lib/replace_vars';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { visWithSplits } from '../../vis_with_splits';
import { createTickFormatter } from '../../lib/tick_formatter';
import _, { get, isUndefined, assign, includes, pick } from 'lodash';
import { Metric } from '../../../visualizations/views/metric';
import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { getLastValue } from '../../../../../common/get_last_value';
import { isBackgroundInverted } from '../../../lib/set_is_reversed';

function getColors(props) {
Expand Down
Loading

0 comments on commit c6cb8d6

Please sign in to comment.