Skip to content

Commit

Permalink
[Rename] Refactored src/plugins/vis_default_editor directory (#96)
Browse files Browse the repository at this point in the history
Signed-off-by: Mihir Soni <[email protected]>
  • Loading branch information
mihirsoni authored Mar 11, 2021
1 parent bfb0cc8 commit dd5c196
Show file tree
Hide file tree
Showing 60 changed files with 105 additions and 105 deletions.
6 changes: 0 additions & 6 deletions src/plugins/vis_default_editor/kibana.json

This file was deleted.

6 changes: 6 additions & 0 deletions src/plugins/vis_default_editor/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "visDefaultEditor",
"version": "opensearchDashboards",
"ui": true,
"requiredBundles": ["opensearchDashboardsUtils", "opensearchDashboardsReact", "data"]
}
2 changes: 1 addition & 1 deletion src/plugins/vis_default_editor/public/components/agg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
EuiSpacer,
EuiIconTip,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { IAggConfig, TimeRange } from 'src/plugins/data/public';
import { DefaultEditorAggParams } from './agg_params';
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_default_editor/public/components/agg_add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
EuiPopover,
EuiPopoverTitle,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { IAggConfig, AggGroupNames } from '../../../data/public';
import { Schema } from '../schemas';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
EuiPanel,
EuiFormErrorText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { AggGroupNames, AggGroupLabels, IAggConfig, TimeRange } from '../../../data/public';
import { DefaultEditorAgg } from './agg';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
DefaultEditorAggParams as PureDefaultEditorAggParams,
DefaultEditorAggParamsProps,
} from './agg_params';
import { KibanaContextProvider } from '../../../kibana_react/public';
import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public';
import { dataPluginMock } from '../../../data/public/mocks';
import { EditorVisState } from './sidebar/state/reducers';

Expand All @@ -39,9 +39,9 @@ const mockEditorConfig = {
},
};
const DefaultEditorAggParams = (props: DefaultEditorAggParamsProps) => (
<KibanaContextProvider services={{ data: dataPluginMock.createStartContract() }}>
<OpenSearchDashboardsContextProvider services={{ data: dataPluginMock.createStartContract() }}>
<PureDefaultEditorAggParams {...props} />
</KibanaContextProvider>
</OpenSearchDashboardsContextProvider>
);

jest.mock('./utils', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React, { useCallback, useReducer, useEffect, useMemo } from 'react';
import { EuiForm, EuiAccordion, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import useUnmount from 'react-use/lib/useUnmount';

import { IAggConfig, IndexPattern, AggGroupNames } from '../../../data/public';
Expand All @@ -40,8 +40,8 @@ import {
import { DefaultEditorCommonProps } from './agg_common_props';
import { EditorParamConfig, TimeIntervalParam, FixedParam, getEditorConfig } from './utils';
import { Schema, getSchemaByName } from '../schemas';
import { useKibana } from '../../../kibana_react/public';
import { VisDefaultEditorKibanaServices } from '../types';
import { useOpenSearchDashboards } from '../../../opensearch_dashboards_react/public';
import { VisDefaultEditorOpenSearchDashboardsServices } from '../types';

const FIXED_VALUE_PROP = 'fixedValue';
const DEFAULT_PROP = 'default';
Expand Down Expand Up @@ -89,7 +89,7 @@ function DefaultEditorAggParams({
allowedAggs,
schema.aggFilter,
]);
const { services } = useKibana<VisDefaultEditorKibanaServices>();
const { services } = useOpenSearchDashboards<VisDefaultEditorOpenSearchDashboardsServices>();
const aggTypes = useMemo(() => services.data.search.aggs.types.getAll(), [
services.data.search.aggs.types,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import { get, has } from 'lodash';
import React, { useEffect, useCallback, useState } from 'react';

import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow, EuiLink, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { IAggType, IndexPattern } from 'src/plugins/data/public';

import { DocLinksStart } from '../../../../core/public';
import { useKibana } from '../../../kibana_react/public';
import { useOpenSearchDashboards } from '../../../opensearch_dashboards_react/public';
import { ComboBoxGroupedOptions } from '../utils';
import { AGG_TYPE_ACTION_KEYS, AggTypeAction } from './agg_params_state';

Expand Down Expand Up @@ -53,7 +53,7 @@ function DefaultEditorAggSelect({
onChangeAggType,
}: DefaultEditorAggSelectProps) {
const [isDirty, setIsDirty] = useState(false);
const { services } = useKibana<{ docLinks: DocLinksStart }>();
const { services } = useOpenSearchDashboards<{ docLinks: DocLinksStart }>();
const selectedOptions: ComboBoxGroupedOptions<IAggType> = value
? [{ label: value.title, target: value }]
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';

import { EuiSwitch, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { AggParamEditorProps } from '../agg_param_props';

function AutoPrecisionParamEditor({ value = false, setValue }: AggParamEditorProps<boolean>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React, { useCallback } from 'react';
import { EuiFieldText, EuiFlexItem, EuiIcon } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { search } from '../../../../../data/public';
import { InputList, InputListConfig, InputModel, InputObject, InputItem } from './input_list';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
htmlIdGenerator,
EuiButtonEmpty,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';

export interface InputListConfig {
defaultValue: InputItemModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React, { useCallback } from 'react';
import { EuiFieldText, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { InputList, InputListConfig, InputObject, InputModel, InputItem } from './input_list';
import { search } from '../../../../../data/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React, { Fragment, useState, useEffect, useMemo, useCallback } from 'react';

import { EuiSpacer, EuiButtonEmpty, EuiFlexItem, EuiFormErrorText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';
import { NumberRow, NumberRowModel } from './number_row';
import {
parse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React, { useCallback } from 'react';

import { EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiButtonIcon } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { NumberListRange } from './range';

export interface NumberRowProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { last } from 'lodash';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { htmlIdGenerator } from '@elastic/eui';

import { parseRange, NumberListRange } from './range';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
import { isArray } from 'lodash';
import { EuiButtonEmpty, EuiFlexItem, EuiFormRow, EuiSpacer, htmlIdGenerator } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';
import { EMPTY_STRING, getInitModelList, getRange, parse } from './number_list/utils';
import { NumberRow, NumberRowModel } from './number_list/number_row';
import { AggParamEditorProps } from '../../agg_param_props';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { DateRangesParamEditor } from './date_ranges';
import { KibanaContextProvider } from '../../../../kibana_react/public';
import { OpenSearchDashboardsContextProvider } from '../../../../opensearch_dashboards_react/public';
import { docLinksServiceMock } from '../../../../../core/public/mocks';

describe('DateRangesParamEditor component', () => {
Expand Down Expand Up @@ -53,9 +53,9 @@ describe('DateRangesParamEditor component', () => {
docLinks: docLinksServiceMock.createStartContract(),
};
return (
<KibanaContextProvider services={services}>
<OpenSearchDashboardsContextProvider services={services}>
<DateRangesParamEditor {...props} />
</KibanaContextProvider>
</OpenSearchDashboardsContextProvider>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import {
EuiFormRow,
} from '@elastic/eui';
import dateMath from '@elastic/datemath';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { isEqual, omit } from 'lodash';
import { useMount } from 'react-use';
import { DocLinksStart } from 'src/core/public';

import { useKibana } from '../../../../kibana_react/public';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { AggParamEditorProps } from '../agg_param_props';

const FROM_PLACEHOLDER = '\u2212\u221E';
Expand Down Expand Up @@ -68,7 +68,7 @@ function DateRangesParamEditor({
setValue,
setValidity,
}: AggParamEditorProps<DateRangeValues[]>) {
const { services } = useKibana<{ docLinks: DocLinksStart }>();
const { services } = useOpenSearchDashboards<{ docLinks: DocLinksStart }>();
const [ranges, setRanges] = useState(() =>
value.map((range) => ({ ...range, id: generateId() }))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import React from 'react';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { SwitchParamEditor } from './switch';
import { AggParamEditorProps } from '../agg_param_props';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React, { ChangeEvent } from 'react';

import { EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { isUndefined } from 'lodash';

import { useValidation } from './utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import React, { useState, useCallback } from 'react';
import { useMount } from 'react-use';

import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { AggParam, IAggConfig, IFieldParamType, IndexPatternField } from 'src/plugins/data/public';
import { formatListAsProse, parseCommaSeparatedList, useValidation } from './utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

import React, { useState } from 'react';
import { EuiForm, EuiButtonIcon, EuiFieldText, EuiFormRow, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import {
IAggConfig,
Query,
QueryStringInput,
DataPublicPluginStart,
} from '../../../../data/public';
import { useKibana } from '../../../../kibana_react/public';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';

interface FilterRowProps {
id: string;
Expand All @@ -54,7 +54,7 @@ function FilterRow({
onChangeValue,
onRemoveFilter,
}: FilterRowProps) {
const { services } = useKibana<{ data: DataPublicPluginStart; appName: string }>();
const { services } = useOpenSearchDashboards<{ data: DataPublicPluginStart; appName: string }>();
const [showCustomLabel, setShowCustomLabel] = useState(false);
const filterLabel = i18n.translate('visDefaultEditor.controls.filters.filterLabel', {
defaultMessage: 'Filter {index}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import React, { useState, useEffect } from 'react';
import { omit, isEqual } from 'lodash';
import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { FormattedMessage } from '@osd/i18n/react';
import { useMount } from 'react-use';

import { Query, DataPublicPluginStart } from '../../../../data/public';
import { IUiSettingsClient } from '../../../../../core/public';
import { useKibana } from '../../../../kibana_react/public';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { FilterRow } from './filter';
import { AggParamEditorProps } from '../agg_param_props';

Expand Down Expand Up @@ -65,7 +65,7 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps<F
setFilters(updatedFilters);
};

const { services } = useKibana<{ uiSettings: IUiSettingsClient; data: DataPublicPluginStart }>();
const { services } = useOpenSearchDashboards<{ uiSettings: IUiSettingsClient; data: DataPublicPluginStart }>();

const onAddFilter = () =>
updateFilters([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import React, { useEffect, useRef } from 'react';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { search } from '../../../../data/public';
import { SwitchParamEditor } from './switch';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';

import { EuiButtonGroup, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { AggParamEditorProps } from '../agg_param_props';

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

import React from 'react';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { SwitchParamEditor } from './switch';
import { AggParamEditorProps } from '../agg_param_props';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

import React, { useCallback, useEffect } from 'react';
import { EuiFormRow, EuiFieldNumber, EuiFieldNumberProps, EuiIconTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import { useKibana } from '../../../../kibana_react/public';
import { FormattedMessage } from '@osd/i18n/react';
import { i18n } from '@osd/i18n';
import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
import { AggParamEditorProps } from '../agg_param_props';
import { UI_SETTINGS } from '../../../../data/public';

Expand Down Expand Up @@ -63,7 +63,7 @@ function MaxBarsParamEditor({
setValidity,
setTouched,
}: SizeParamEditorProps) {
const { services } = useKibana();
const { services } = useOpenSearchDashboards();
const uiSettingMaxBars = services.uiSettings?.get(UI_SETTINGS.HISTOGRAM_MAX_BARS);
const isValid =
disabled ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React, { useMemo, useCallback } from 'react';
import { EuiFormRow, EuiSelect } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';

import { useAvailableOptions, useFallbackMetric, useValidation } from './utils';
import { AggParamEditorProps } from '../agg_param_props';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import React from 'react';

import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { SwitchParamEditor } from './switch';
import { AggParamEditorProps } from '../agg_param_props';

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

import React, { useEffect } from 'react';
import { i18n } from '@kbn/i18n';
import { i18n } from '@osd/i18n';
import { SwitchParamEditor } from './switch';

import { search } from '../../../../data/public';
Expand Down Expand Up @@ -48,7 +48,7 @@ function MissingBucketParamEditor(props: AggParamEditorProps<boolean>) {
'Only works for fields of type "string". When enabled, include documents with missing ' +
'values in the search. If this bucket is in the top N, it appears in the chart. ' +
'If not in the top N, and you enable "Group other values in separate bucket", ' +
'Elasticsearch adds the missing values to the "other" bucket.',
'OpenSearch adds the missing values to the "other" bucket.',
}
)}
disabled={fieldTypeIsNotString}
Expand Down
Loading

0 comments on commit dd5c196

Please sign in to comment.