Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Visualizations] Remove charts - editor plugins cyclic dependencies #84887

Merged
merged 14 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/dev/run_find_plugins_with_circular_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type CircularDepList = Set<string>;

const allowedList: CircularDepList = new Set([
'src/plugins/charts -> src/plugins/expressions',
'src/plugins/charts -> src/plugins/vis_default_editor',
'src/plugins/data -> src/plugins/embeddable',
'src/plugins/data -> src/plugins/expressions',
'src/plugins/data -> src/plugins/ui_actions',
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/charts/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"version": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["expressions"],
"requiredBundles": ["visDefaultEditor"]
"requiredPlugins": ["expressions"]
}
9 changes: 0 additions & 9 deletions src/plugins/charts/public/static/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,5 @@
* under the License.
*/

export { BasicOptions } from './basic_options';
export { ColorModes, Rotates } from './collections';
export { ColorRanges, SetColorRangeValue } from './color_ranges';
export { ColorSchemaOptions, SetColorSchemaOptionsValue } from './color_schema';
export { ColorSchemaParams, Labels, Style } from './types';
export { NumberInputOption } from './number_input';
export { RangeOption } from './range';
export { RequiredNumberInputOption } from './required_number_input';
export { SelectOption } from './select';
export { SwitchOption } from './switch';
export { TextInputOption } from './text_input';
2 changes: 1 addition & 1 deletion src/plugins/maps_legacy/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"ui": true,
"server": true,
"extraPublicDirs": ["common"],
"requiredBundles": ["kibanaReact", "charts"]
"requiredBundles": ["kibanaReact", "visDefaultEditor"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React from 'react';
import { EuiLink, EuiSpacer, EuiText, EuiScreenReaderOnly } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { TextInputOption } from '../../../charts/public';
import { TextInputOption } from '../../../vis_default_editor/public';
import { WMSOptions } from '../common/types/external_basemap_types';

interface WmsInternalOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/maps_legacy/public/components/wms_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { TmsLayer } from '../index';
import { Vis } from '../../../visualizations/public';
import { RegionMapVisParams } from '../common/types/region_map_types';
import { SelectOption, SwitchOption } from '../../../charts/public';
import { SelectOption, SwitchOption } from '../../../vis_default_editor/public';
import { WmsInternalOptions } from './wms_internal_options';
import { WMSOptions, TileMapVisParams } from '../common/types/external_basemap_types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { FileLayerField, VectorLayer, IServiceSettings } from '../../../maps_legacy/public';
import { NumberInputOption, SelectOption, SwitchOption } from '../../../charts/public';
import { SelectOption, SwitchOption, NumberInputOption } from '../../../vis_default_editor/public';
import { RegionMapVisParams, WmsOptions } from '../../../maps_legacy/public';

const mapLayerForOption = ({ layerId, name }: VectorLayer) => ({
Expand Down
9 changes: 7 additions & 2 deletions src/plugins/tile_map/public/components/tile_map_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ import React, { useEffect } from 'react';
import { EuiPanel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { BasicOptions, RangeOption, SelectOption, SwitchOption } from '../../../charts/public';
import {
VisOptionsProps,
BasicOptions,
SelectOption,
SwitchOption,
RangeOption,
} from '../../../vis_default_editor/public';
import { WmsOptions, TileMapVisParams, MapTypes } from '../../../maps_legacy/public';

export type TileMapOptionsProps = VisOptionsProps<TileMapVisParams>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { i18n } from '@kbn/i18n';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { VisOptionsProps } from '../../vis_options_props';
import { SwitchOption } from './switch';
import { SelectOption } from './select';

Expand All @@ -37,7 +37,7 @@ function BasicOptions<VisParams extends BasicOptionsParams>({
return (
<>
<SelectOption
label={i18n.translate('charts.controls.vislibBasicOptions.legendPositionLabel', {
label={i18n.translate('visDefaultEditor.options.vislibBasicOptions.legendPositionLabel', {
defaultMessage: 'Legend position',
})}
options={vis.type.editorConfig.collections.legendPositions}
Expand All @@ -46,7 +46,7 @@ function BasicOptions<VisParams extends BasicOptionsParams>({
setValue={setValue}
/>
<SwitchOption
label={i18n.translate('charts.controls.vislibBasicOptions.showTooltipLabel', {
label={i18n.translate('visDefaultEditor.options.vislibBasicOptions.showTooltipLabel', {
defaultMessage: 'Show tooltip',
})}
paramName="addTooltip"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { last } from 'lodash';

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

import { RangeValues, RangesParamEditor } from '../../../../vis_default_editor/public';
import { RangeValues, RangesParamEditor } from '../controls/ranges';

export type SetColorRangeValue = (paramName: string, value: RangeValues[]) => void;

Expand Down Expand Up @@ -71,7 +71,7 @@ function ColorRanges({
return (
<RangesParamEditor
data-test-subj={dataTestSubj}
error={i18n.translate('charts.controls.colorRanges.errorText', {
error={i18n.translate('visDefaultEditor.options.colorRanges.errorText', {
defaultMessage: 'Each range should be greater than previous.',
})}
hidePlaceholders={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import { i18n } from '@kbn/i18n';
import { EuiLink, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { ColorSchemaParams, ColorSchema } from 'src/plugins/charts/public';
import { VisOptionsProps } from '../../vis_options_props';
import { SelectOption } from './select';
import { SwitchOption } from './switch';
import { ColorSchemaParams } from './types';
import { ColorSchema } from '../color_maps';

export type SetColorSchemaOptionsValue = <T extends keyof ColorSchemaParams>(
paramName: T,
Expand Down Expand Up @@ -67,7 +66,7 @@ function ColorSchemaOptions({
}}
>
<FormattedMessage
id="charts.controls.colorSchema.resetColorsButtonLabel"
id="visDefaultEditor.options.colorSchema.resetColorsButtonLabel"
defaultMessage="Reset colors"
/>
</EuiLink>
Expand All @@ -80,11 +79,11 @@ function ColorSchemaOptions({
disabled={disabled}
helpText={
showHelpText &&
i18n.translate('charts.controls.colorSchema.howToChangeColorsDescription', {
i18n.translate('visDefaultEditor.options.colorSchema.howToChangeColorsDescription', {
defaultMessage: 'Individual colors can be changed in the legend.',
})
}
label={i18n.translate('charts.controls.colorSchema.colorSchemaLabel', {
label={i18n.translate('visDefaultEditor.options.colorSchema.colorSchemaLabel', {
defaultMessage: 'Color schema',
})}
labelAppend={isCustomColors && resetColorsButton}
Expand All @@ -96,7 +95,7 @@ function ColorSchemaOptions({

<SwitchOption
disabled={disabled}
label={i18n.translate('charts.controls.colorSchema.reverseColorSchemaLabel', {
label={i18n.translate('visDefaultEditor.options.colorSchema.reverseColorSchemaLabel', {
defaultMessage: 'Reverse schema',
})}
paramName="invertColors"
Expand Down
28 changes: 28 additions & 0 deletions src/plugins/vis_default_editor/public/components/options/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { BasicOptions } from './basic_options';
export { SwitchOption } from './switch';
export { SelectOption } from './select';
export { ColorRanges, SetColorRangeValue } from './color_ranges';
export { ColorSchemaOptions, SetColorSchemaOptionsValue } from './color_schema';
export { NumberInputOption } from './number_input';
export { RangeOption } from './range';
export { RequiredNumberInputOption } from './required_number_input';
export { TextInputOption } from './text_input';
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function RangeOption<ParamName extends string>({
const [stateValue, setStateValue] = useState(value);
const [isValidState, setIsValidState] = useState(true);

const error = i18n.translate('charts.controls.rangeErrorMessage', {
const error = i18n.translate('visDefaultEditor.options.rangeErrorMessage', {
defaultMessage: 'Values must be on or between {min} and {max}',
values: { min, max },
});
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_default_editor/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

export { DefaultEditorController } from './default_editor_controller';
export { useValidation } from './components/controls/utils';
export * from './components/options';
export { RangesParamEditor, RangeValues } from './components/controls/ranges';
export * from './editor_size';
export * from './vis_options_props';
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_markdown/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"ui": true,
"server": true,
"requiredPlugins": ["expressions", "visualizations"],
"requiredBundles": ["kibanaReact", "charts", "visualizations", "expressions", "visDefaultEditor"]
"requiredBundles": ["kibanaReact", "visualizations", "expressions", "visDefaultEditor"]
}
3 changes: 1 addition & 2 deletions src/plugins/vis_type_markdown/public/settings_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { RangeOption, SwitchOption } from '../../charts/public';
import { VisOptionsProps, SwitchOption, RangeOption } from '../../vis_default_editor/public';
import { MarkdownVisParams } from './types';

function SettingsOptions({ stateParams, setValue }: VisOptionsProps<MarkdownVisParams>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import {
ColorModes,
VisOptionsProps,
ColorRanges,
ColorSchemaOptions,
SetColorRangeValue,
SwitchOption,
RangeOption,
SetColorSchemaOptionsValue,
SetColorRangeValue,
} from '../../../charts/public';
ColorSchemaOptions,
RangeOption,
} from '../../../vis_default_editor/public';
import { ColorModes } from '../../../charts/public';
import { MetricVisParam, VisParams } from '../types';

function MetricVisOptions({
Expand Down
1 change: 0 additions & 1 deletion src/plugins/vis_type_table/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"requiredBundles": [
"kibanaUtils",
"share",
"charts",
"visDefaultEditor"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ import { EuiIconTip, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { search } from '../../../data/public';
import { SwitchOption, SelectOption, NumberInputOption } from '../../../charts/public';
import {
SwitchOption,
SelectOption,
NumberInputOption,
VisOptionsProps,
} from '../../../vis_default_editor/public';
import { TableVisParams } from '../types';
import { totalAggregations } from './utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { VisOptionsProps } from '../../../vis_default_editor/public';
import { VisOptionsProps, SelectOption, SwitchOption } from '../../../vis_default_editor/public';
import { ValidatedDualRange } from '../../../kibana_react/public';
import { SelectOption, SwitchOption } from '../../../charts/public';
import { TagCloudVisParams } from '../types';

function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps<TagCloudVisParams>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import React from 'react';
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { SwitchOption, TextInputOption } from '../../../../../charts/public';
import { SwitchOption, TextInputOption } from '../../../../../vis_default_editor/public';
import { GaugeOptionsInternalProps } from '../gauge';

function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInternalProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ import React, { useCallback } from 'react';
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import {
ColorRanges,
ColorSchemaOptions,
ColorSchemaParams,
SetColorRangeValue,
SwitchOption,
ColorSchemas,
} from '../../../../../charts/public';
ColorSchemaOptions,
} from '../../../../../vis_default_editor/public';
import { ColorSchemaParams, ColorSchemas } from '../../../../../charts/public';
import { GaugeOptionsInternalProps } from '../gauge';
import { Gauge } from '../../../gauge';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { SelectOption } from '../../../../../charts/public';
import { SelectOption } from '../../../../../vis_default_editor/public';
import { GaugeOptionsInternalProps } from '../gauge';
import { AggGroupNames } from '../../../../../data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import {
VisOptionsProps,
BasicOptions,
ColorRanges,
ColorSchemaOptions,
NumberInputOption,
SelectOption,
SwitchOption,
SetColorSchemaOptionsValue,
ColorRanges,
SetColorRangeValue,
} from '../../../../../charts/public';
SetColorSchemaOptionsValue,
ColorSchemaOptions,
NumberInputOption,
} from '../../../../../vis_default_editor/public';
import { HeatmapVisParams } from '../../../heatmap';
import { ValueAxis } from '../../../types';
import { LabelsPanel } from './labels_panel';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ import { EuiColorPicker, EuiFormRow, EuiPanel, EuiSpacer, EuiTitle } from '@elas
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { VisOptionsProps, SwitchOption } from '../../../../../vis_default_editor/public';
import { ValueAxis } from '../../../types';
import { HeatmapVisParams } from '../../../heatmap';
import { SwitchOption } from '../../../../../charts/public';

const VERTICAL_ROTATION = 270;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import {
VisOptionsProps,
SelectOption,
SwitchOption,
} from '../../../../../vis_default_editor/public';
import { Axis } from '../../../types';
import { SelectOption, SwitchOption } from '../../../../../charts/public';
import { LabelOptions, SetAxisLabel } from './label_options';
import { Positions } from '../../../utils/collections';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { Vis } from '../../../../../visualizations/public';
import { SeriesParam, ValueAxis } from '../../../types';
import { ChartTypes } from '../../../utils/collections';
import { SelectOption } from '../../../../../charts/public';
import { SelectOption } from '../../../../../vis_default_editor/public';
import { LineOptions } from './line_options';
import { SetParamByIndex, ChangeValueAxis } from '.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import React, { useCallback, useEffect } from 'react';
import { i18n } from '@kbn/i18n';

import { ValueAxis } from '../../../types';
import { NumberInputOption, SwitchOption } from '../../../../../charts/public';
import { SwitchOption, NumberInputOption } from '../../../../../vis_default_editor/public';
import { YExtents } from './y_extents';
import { SetScale } from './value_axis_options';

Expand Down
Loading