* shim of kbn_vislib_vis_types (now vis_type_vislib) * Move vislib into vis_type_vislib plugin * Convert remaining plugin files to typescript * Rename vis to vis_type_vislib
This commit is contained in:
parent
5af82baccb
commit
2df5eb1ed6
|
@ -9,7 +9,7 @@ bower_components
|
||||||
/built_assets
|
/built_assets
|
||||||
/html_docs
|
/html_docs
|
||||||
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
|
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
|
||||||
/src/fixtures/vislib/mock_data
|
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data
|
||||||
/src/legacy/ui/public/angular-bootstrap
|
/src/legacy/ui/public/angular-bootstrap
|
||||||
/src/legacy/ui/public/flot-charts
|
/src/legacy/ui/public/flot-charts
|
||||||
/test/fixtures/scenarios
|
/test/fixtures/scenarios
|
||||||
|
|
|
@ -77,7 +77,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['src/legacy/core_plugins/kbn_vislib_vis_types/**/*.{js,ts,tsx}'],
|
files: ['src/legacy/core_plugins/vis_type_vislib/**/*.{js,ts,tsx}'],
|
||||||
rules: {
|
rules: {
|
||||||
'react-hooks/exhaustive-deps': 'off',
|
'react-hooks/exhaustive-deps': 'off',
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"interpreter": "src/legacy/core_plugins/interpreter",
|
"interpreter": "src/legacy/core_plugins/interpreter",
|
||||||
"kbn": "src/legacy/core_plugins/kibana",
|
"kbn": "src/legacy/core_plugins/kibana",
|
||||||
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
|
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
|
||||||
"kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types",
|
"kbnVislibVisTypes": "src/legacy/core_plugins/vis_type_vislib",
|
||||||
"management": ["src/legacy/core_plugins/management", "src/plugins/management"],
|
"management": ["src/legacy/core_plugins/management", "src/plugins/management"],
|
||||||
"kibana_react": "src/legacy/core_plugins/kibana_react",
|
"kibana_react": "src/legacy/core_plugins/kibana_react",
|
||||||
"kibana-react": "src/plugins/kibana_react",
|
"kibana-react": "src/plugins/kibana_react",
|
||||||
|
|
|
@ -2,7 +2,7 @@ files:
|
||||||
include:
|
include:
|
||||||
- 'src/legacy/core_plugins/metrics/**/*.s+(a|c)ss'
|
- 'src/legacy/core_plugins/metrics/**/*.s+(a|c)ss'
|
||||||
- 'src/legacy/core_plugins/timelion/**/*.s+(a|c)ss'
|
- 'src/legacy/core_plugins/timelion/**/*.s+(a|c)ss'
|
||||||
- 'src/legacy/ui/public/vislib/**/*.s+(a|c)ss'
|
- 'src/legacy/core_plugins/vis_type_vislib/**/*.s+(a|c)ss'
|
||||||
- 'x-pack/legacy/plugins/rollup/**/*.s+(a|c)ss'
|
- 'x-pack/legacy/plugins/rollup/**/*.s+(a|c)ss'
|
||||||
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
|
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
|
||||||
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
|
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
|
||||||
|
|
|
@ -120,7 +120,7 @@ export const TEMPORARILY_IGNORED_PATHS = [
|
||||||
'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/seriesList.js',
|
'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/seriesList.js',
|
||||||
'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/tlConfig.js',
|
'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/tlConfig.js',
|
||||||
'src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json',
|
'src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json',
|
||||||
'src/fixtures/vislib/mock_data/terms/_seriesMultiple.js',
|
'src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_seriesMultiple.js',
|
||||||
'src/legacy/ui/public/angular-bootstrap/bindHtml/bindHtml.js',
|
'src/legacy/ui/public/angular-bootstrap/bindHtml/bindHtml.js',
|
||||||
'src/legacy/ui/public/angular-bootstrap/tooltip/tooltip-html-unsafe-popup.html',
|
'src/legacy/ui/public/angular-bootstrap/tooltip/tooltip-html-unsafe-popup.html',
|
||||||
'src/legacy/ui/public/angular-bootstrap/tooltip/tooltip-popup.html',
|
'src/legacy/ui/public/angular-bootstrap/tooltip/tooltip-popup.html',
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"name": "kbn_vislib_vis_types",
|
|
||||||
"version": "kibana"
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import $ from 'jquery';
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
import {
|
|
||||||
CUSTOM_LEGEND_VIS_TYPES,
|
|
||||||
VisLegend,
|
|
||||||
} from '../../../ui/public/vis/vis_types/vislib_vis_legend';
|
|
||||||
import { VislibVisProvider } from '../../../ui/public/vislib/vis';
|
|
||||||
import chrome from '../../../ui/public/chrome';
|
|
||||||
import { mountReactNode } from '../../../../core/public/utils';
|
|
||||||
|
|
||||||
const legendClassName = {
|
|
||||||
top: 'visLib--legend-top',
|
|
||||||
bottom: 'visLib--legend-bottom',
|
|
||||||
left: 'visLib--legend-left',
|
|
||||||
right: 'visLib--legend-right',
|
|
||||||
};
|
|
||||||
|
|
||||||
export class vislibVisController {
|
|
||||||
constructor(el, vis) {
|
|
||||||
this.el = el;
|
|
||||||
this.vis = vis;
|
|
||||||
this.unmount = null;
|
|
||||||
this.legendRef = React.createRef();
|
|
||||||
|
|
||||||
// vis mount point
|
|
||||||
this.container = document.createElement('div');
|
|
||||||
this.container.className = 'visLib';
|
|
||||||
this.el.appendChild(this.container);
|
|
||||||
|
|
||||||
// chart mount point
|
|
||||||
this.chartEl = document.createElement('div');
|
|
||||||
this.chartEl.className = 'visLib__chart';
|
|
||||||
this.container.appendChild(this.chartEl);
|
|
||||||
// legend mount point
|
|
||||||
this.legendEl = document.createElement('div');
|
|
||||||
this.legendEl.className = 'visLib__legend';
|
|
||||||
this.container.appendChild(this.legendEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
render(esResponse, visParams) {
|
|
||||||
if (this.vislibVis) {
|
|
||||||
this.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise(async resolve => {
|
|
||||||
if (!this.vislib) {
|
|
||||||
const $injector = await chrome.dangerouslyGetActiveInjector();
|
|
||||||
const Private = $injector.get('Private');
|
|
||||||
this.Vislib = Private(VislibVisProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.el.clientWidth === 0 || this.el.clientHeight === 0) {
|
|
||||||
return resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.vislibVis = new this.Vislib(this.chartEl, visParams);
|
|
||||||
this.vislibVis.on('brush', this.vis.API.events.brush);
|
|
||||||
this.vislibVis.on('click', this.vis.API.events.filter);
|
|
||||||
this.vislibVis.on('renderComplete', resolve);
|
|
||||||
|
|
||||||
this.vislibVis.initVisConfig(esResponse, this.vis.getUiState());
|
|
||||||
|
|
||||||
if (visParams.addLegend) {
|
|
||||||
$(this.container)
|
|
||||||
.attr('class', (i, cls) => {
|
|
||||||
return cls.replace(/visLib--legend-\S+/g, '');
|
|
||||||
})
|
|
||||||
.addClass(legendClassName[visParams.legendPosition]);
|
|
||||||
|
|
||||||
this.mountLegend(esResponse, visParams.legendPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.vislibVis.render(esResponse, this.vis.getUiState());
|
|
||||||
|
|
||||||
// refreshing the legend after the chart is rendered.
|
|
||||||
// this is necessary because some visualizations
|
|
||||||
// provide data necessary for the legend only after a render cycle.
|
|
||||||
if (
|
|
||||||
visParams.addLegend &&
|
|
||||||
CUSTOM_LEGEND_VIS_TYPES.includes(this.vislibVis.visConfigArgs.type)
|
|
||||||
) {
|
|
||||||
this.unmountLegend();
|
|
||||||
this.mountLegend(esResponse, visParams.legendPosition);
|
|
||||||
this.vislibVis.render(esResponse, this.vis.getUiState());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
mountLegend(visData, position) {
|
|
||||||
this.unmount = mountReactNode(
|
|
||||||
<VisLegend
|
|
||||||
ref={this.legendRef}
|
|
||||||
vis={this.vis}
|
|
||||||
vislibVis={this.vislibVis}
|
|
||||||
visData={visData}
|
|
||||||
position={position}
|
|
||||||
uiState={this.vis.getUiState()}
|
|
||||||
/>
|
|
||||||
)(this.legendEl);
|
|
||||||
}
|
|
||||||
|
|
||||||
unmountLegend() {
|
|
||||||
if (this.unmount) {
|
|
||||||
this.unmount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
destroy() {
|
|
||||||
if (this.unmount) {
|
|
||||||
this.unmount();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.vislibVis) {
|
|
||||||
this.vislibVis.off('brush', this.vis.API.events.brush);
|
|
||||||
this.vislibVis.off('click', this.vis.API.events.filter);
|
|
||||||
this.vislibVis.destroy();
|
|
||||||
delete this.vislibVis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { RangeValues } from 'ui/vis/editors/default/controls/ranges';
|
|
||||||
import { Alignments, GaugeTypes } from './utils/collections';
|
|
||||||
import { ColorSchemaVislibParams, Labels, Style } from './types';
|
|
||||||
|
|
||||||
interface Gauge extends ColorSchemaVislibParams {
|
|
||||||
backStyle: 'Full';
|
|
||||||
gaugeStyle: 'Full';
|
|
||||||
orientation: 'vertical';
|
|
||||||
type: 'meter';
|
|
||||||
alignment: Alignments;
|
|
||||||
colorsRange: RangeValues[];
|
|
||||||
extendRange: boolean;
|
|
||||||
gaugeType: GaugeTypes;
|
|
||||||
labels: Labels;
|
|
||||||
percentageMode: boolean;
|
|
||||||
outline?: boolean;
|
|
||||||
scale: {
|
|
||||||
show: boolean;
|
|
||||||
labels: false;
|
|
||||||
color: 'rgba(105,112,125,0.2)';
|
|
||||||
};
|
|
||||||
style: Style;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GaugeVisParams {
|
|
||||||
type: 'gauge';
|
|
||||||
addTooltip: boolean;
|
|
||||||
addLegend: boolean;
|
|
||||||
isDisplayWarning: boolean;
|
|
||||||
gauge: Gauge;
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
|
||||||
import { RangeValues } from 'ui/vis/editors/default/controls/ranges';
|
|
||||||
import { TimeMarker } from 'ui/vislib/visualizations/time_marker';
|
|
||||||
import { CommonVislibParams, ColorSchemaVislibParams, ValueAxis } from './types';
|
|
||||||
import { Positions } from './utils/collections';
|
|
||||||
|
|
||||||
export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaVislibParams {
|
|
||||||
type: 'heatmap';
|
|
||||||
addLegend: boolean;
|
|
||||||
enableHover: boolean;
|
|
||||||
colorsNumber: number | '';
|
|
||||||
colorsRange: RangeValues[];
|
|
||||||
valueAxes: ValueAxis[];
|
|
||||||
setColorRange: boolean;
|
|
||||||
percentageMode: boolean;
|
|
||||||
times: TimeMarker[];
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { setup as visualizations } from '../../visualizations/public/np_ready/public/legacy';
|
|
||||||
|
|
||||||
import { histogramDefinition } from './histogram';
|
|
||||||
import { lineDefinition } from './line';
|
|
||||||
import { pieDefinition } from './pie';
|
|
||||||
import { areaDefinition } from './area';
|
|
||||||
import { heatmapDefinition } from './heatmap';
|
|
||||||
import { horizontalBarDefinition } from './horizontal_bar';
|
|
||||||
import { gaugeDefinition } from './gauge';
|
|
||||||
import { goalDefinition } from './goal';
|
|
||||||
|
|
||||||
visualizations.types.createBaseVisualization(histogramDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(lineDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(pieDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(areaDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(heatmapDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(horizontalBarDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(gaugeDefinition);
|
|
||||||
visualizations.types.createBaseVisualization(goalDefinition);
|
|
|
@ -7,6 +7,9 @@
|
||||||
// Public UI styles
|
// Public UI styles
|
||||||
@import 'src/legacy/ui/public/index';
|
@import 'src/legacy/ui/public/index';
|
||||||
|
|
||||||
|
// vis_type_vislib UI styles
|
||||||
|
@import 'src/legacy/core_plugins/vis_type_vislib/public/index';
|
||||||
|
|
||||||
// Dev tools styles
|
// Dev tools styles
|
||||||
@import './dev_tools/index';
|
@import './dev_tools/index';
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ import './visualize';
|
||||||
import './dashboard';
|
import './dashboard';
|
||||||
import './management';
|
import './management';
|
||||||
import './dev_tools';
|
import './dev_tools';
|
||||||
import 'ui/vislib';
|
import 'ui/color_maps';
|
||||||
import 'ui/agg_response';
|
import 'ui/agg_response';
|
||||||
import 'ui/agg_types';
|
import 'ui/agg_types';
|
||||||
import { showAppRedirectNotification } from 'ui/notify';
|
import { showAppRedirectNotification } from 'ui/notify';
|
||||||
|
|
|
@ -23,7 +23,7 @@ import _ from 'lodash';
|
||||||
import d3 from 'd3';
|
import d3 from 'd3';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { KibanaMapLayer } from 'ui/vis/map/kibana_map_layer';
|
import { KibanaMapLayer } from 'ui/vis/map/kibana_map_layer';
|
||||||
import { truncatedColorMaps } from 'ui/vislib/components/color/truncated_colormaps';
|
import { truncatedColorMaps } from 'ui/color_maps';
|
||||||
import * as topojson from 'topojson-client';
|
import * as topojson from 'topojson-client';
|
||||||
import { toastNotifications } from 'ui/notify';
|
import { toastNotifications } from 'ui/notify';
|
||||||
import * as colorUtil from 'ui/vis/map/color_util';
|
import * as colorUtil from 'ui/vis/map/color_util';
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
NumberInputOption,
|
NumberInputOption,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
SwitchOption,
|
SwitchOption,
|
||||||
} from '../../../kbn_vislib_vis_types/public/components';
|
} from '../../../vis_type_vislib/public/components';
|
||||||
import { WmsOptions } from '../../../tile_map/public/components/wms_options';
|
import { WmsOptions } from '../../../tile_map/public/components/wms_options';
|
||||||
import { RegionMapVisParams } from '../types';
|
import { RegionMapVisParams } from '../types';
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
import { Schemas } from 'ui/vis/editors/default/schemas';
|
||||||
import { colorSchemas } from 'ui/vislib/components/color/truncated_colormaps';
|
import { truncatedColorSchemas as colorSchemas } from 'ui/color_maps';
|
||||||
import { mapToLayerWithId } from './util';
|
import { mapToLayerWithId } from './util';
|
||||||
import { createRegionMapVisualization } from './region_map_visualization';
|
import { createRegionMapVisualization } from './region_map_visualization';
|
||||||
import { Status } from '../../visualizations/public';
|
import { Status } from '../../visualizations/public';
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import ChoroplethLayer from './choropleth_layer';
|
import ChoroplethLayer from './choropleth_layer';
|
||||||
import { truncatedColorMaps } from 'ui/vislib/components/color/truncated_colormaps';
|
import { truncatedColorMaps } from 'ui/color_maps';
|
||||||
import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
||||||
import { toastNotifications } from 'ui/notify';
|
import { toastNotifications } from 'ui/notify';
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
RangeOption,
|
RangeOption,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
SwitchOption,
|
SwitchOption,
|
||||||
} from '../../../kbn_vislib_vis_types/public/components';
|
} from '../../../vis_type_vislib/public/components';
|
||||||
import { WmsOptions } from './wms_options';
|
import { WmsOptions } from './wms_options';
|
||||||
import { TileMapVisParams } from '../types';
|
import { TileMapVisParams } from '../types';
|
||||||
import { MapTypes } from '../map_types';
|
import { MapTypes } from '../map_types';
|
||||||
|
|
|
@ -21,7 +21,7 @@ import React from 'react';
|
||||||
import { EuiLink, EuiSpacer, EuiText, EuiScreenReaderOnly } from '@elastic/eui';
|
import { EuiLink, EuiSpacer, EuiText, EuiScreenReaderOnly } from '@elastic/eui';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { TextInputOption } from '../../../kbn_vislib_vis_types/public/components';
|
import { TextInputOption } from '../../../vis_type_vislib/public/components';
|
||||||
import { WMSOptions } from '../types';
|
import { WMSOptions } from '../types';
|
||||||
|
|
||||||
interface WmsInternalOptions {
|
interface WmsInternalOptions {
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
import { TmsLayer } from 'ui/vis/map/service_settings';
|
import { TmsLayer } from 'ui/vis/map/service_settings';
|
||||||
import { Vis } from 'ui/vis';
|
import { Vis } from 'ui/vis';
|
||||||
import { RegionMapVisParams } from '../../../region_map/public/types';
|
import { RegionMapVisParams } from '../../../region_map/public/types';
|
||||||
import { SelectOption, SwitchOption } from '../../../kbn_vislib_vis_types/public/components';
|
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public/components';
|
||||||
import { WmsInternalOptions } from './wms_internal_options';
|
import { WmsInternalOptions } from './wms_internal_options';
|
||||||
import { WMSOptions, TileMapVisParams } from '../types';
|
import { WMSOptions, TileMapVisParams } from '../types';
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import _ from 'lodash';
|
||||||
import d3 from 'd3';
|
import d3 from 'd3';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { truncatedColorMaps } from 'ui/vislib/components/color/truncated_colormaps';
|
import { truncatedColorMaps } from 'ui/color_maps';
|
||||||
import * as colorUtil from 'ui/vis/map/color_util';
|
import * as colorUtil from 'ui/vis/map/color_util';
|
||||||
|
|
||||||
export class ScaledCirclesMarkers extends EventEmitter {
|
export class ScaledCirclesMarkers extends EventEmitter {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import React from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
import { Schemas } from 'ui/vis/editors/default/schemas';
|
||||||
import { colorSchemas } from 'ui/vislib/components/color/truncated_colormaps';
|
import { truncatedColorSchemas as colorSchemas } from 'ui/color_maps';
|
||||||
import { convertToGeoJson } from 'ui/vis/map/convert_to_geojson';
|
import { convertToGeoJson } from 'ui/vis/map/convert_to_geojson';
|
||||||
|
|
||||||
import { createTileMapVisualization } from './tile_map_visualization';
|
import { createTileMapVisualization } from './tile_map_visualization';
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { EuiPanel } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from 'ui/vis/editors/default';
|
||||||
import { RangeOption, SwitchOption } from '../../kbn_vislib_vis_types/public/components';
|
import { RangeOption, SwitchOption } from '../../vis_type_vislib/public/components';
|
||||||
import { MarkdownVisParams } from './types';
|
import { MarkdownVisParams } from './types';
|
||||||
|
|
||||||
function SettingsOptions({ stateParams, setValue }: VisOptionsProps<MarkdownVisParams>) {
|
function SettingsOptions({ stateParams, setValue }: VisOptionsProps<MarkdownVisParams>) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
import { last, findIndex, isNaN } from 'lodash';
|
import { last, findIndex, isNaN } from 'lodash';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { isColorDark } from '@elastic/eui';
|
import { isColorDark } from '@elastic/eui';
|
||||||
import { getHeatmapColors } from 'ui/vislib/components/color/heatmap_color';
|
import { getHeatmapColors } from 'ui/color_maps';
|
||||||
import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
import { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
||||||
|
|
||||||
import { MetricVisValue } from './metric_vis_value';
|
import { MetricVisValue } from './metric_vis_value';
|
||||||
|
|
|
@ -36,8 +36,8 @@ import {
|
||||||
SwitchOption,
|
SwitchOption,
|
||||||
RangeOption,
|
RangeOption,
|
||||||
SetColorSchemaOptionsValue,
|
SetColorSchemaOptionsValue,
|
||||||
} from '../../../kbn_vislib_vis_types/public/components';
|
} from '../../../vis_type_vislib/public/components';
|
||||||
import { ColorModes } from '../../../kbn_vislib_vis_types/public/utils/collections';
|
import { ColorModes } from '../../../vis_type_vislib/public/utils/collections';
|
||||||
import { MetricVisParam, VisParams } from '../types';
|
import { MetricVisParam, VisParams } from '../types';
|
||||||
|
|
||||||
function MetricVisOptions({
|
function MetricVisOptions({
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { vislibColorMaps, ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
import { vislibColorMaps, ColorSchemas } from 'ui/color_maps';
|
||||||
import {
|
import {
|
||||||
ExpressionFunction,
|
ExpressionFunction,
|
||||||
KibanaDatatable,
|
KibanaDatatable,
|
||||||
|
@ -27,7 +27,7 @@ import {
|
||||||
Render,
|
Render,
|
||||||
Style,
|
Style,
|
||||||
} from '../../../../plugins/expressions/public';
|
} from '../../../../plugins/expressions/public';
|
||||||
import { ColorModes } from '../../kbn_vislib_vis_types/public/utils/collections';
|
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||||
import { visType, DimensionsVisParam, VisParams } from './types';
|
import { visType, DimensionsVisParam, VisParams } from './types';
|
||||||
|
|
||||||
type Context = KibanaDatatable;
|
type Context = KibanaDatatable;
|
||||||
|
|
|
@ -23,13 +23,13 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
import { Schemas } from 'ui/vis/editors/default/schemas';
|
||||||
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { AggGroupNames } from 'ui/vis/editors/default';
|
||||||
import { colorSchemas, ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
import { colorSchemas, ColorSchemas } from 'ui/color_maps';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { MetricVisComponent } from './components/metric_vis_controller';
|
import { MetricVisComponent } from './components/metric_vis_controller';
|
||||||
|
|
||||||
import { MetricVisOptions } from './components/metric_vis_options';
|
import { MetricVisOptions } from './components/metric_vis_options';
|
||||||
import { ColorModes } from '../../kbn_vislib_vis_types/public/utils/collections';
|
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||||
|
|
||||||
export const metricVisDefinition = {
|
export const metricVisDefinition = {
|
||||||
name: 'metric',
|
name: 'metric',
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
import { ColorSchemas } from 'ui/color_maps';
|
||||||
import { RangeValues } from 'ui/vis/editors/default/controls/ranges';
|
import { RangeValues } from 'ui/vis/editors/default/controls/ranges';
|
||||||
import { SchemaConfig } from '../../visualizations/public';
|
import { SchemaConfig } from '../../visualizations/public';
|
||||||
import { ColorModes } from '../../kbn_vislib_vis_types/public/utils/collections';
|
import { ColorModes } from '../../vis_type_vislib/public/utils/collections';
|
||||||
import { Labels, Style } from '../../kbn_vislib_vis_types/public/types';
|
import { Labels, Style } from '../../vis_type_vislib/public/types';
|
||||||
|
|
||||||
export const visType = 'metric';
|
export const visType = 'metric';
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
NumberInputOption,
|
NumberInputOption,
|
||||||
SwitchOption,
|
SwitchOption,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
} from '../../../kbn_vislib_vis_types/public/components/common';
|
} from '../../../vis_type_vislib/public/components/common';
|
||||||
import { TableVisParams } from '../types';
|
import { TableVisParams } from '../types';
|
||||||
import { totalAggregations, isAggConfigNumeric } from './utils';
|
import { totalAggregations, isAggConfigNumeric } from './utils';
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { ValidatedDualRange } from 'ui/validated_range';
|
import { ValidatedDualRange } from 'ui/validated_range';
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from 'ui/vis/editors/default';
|
||||||
import { SelectOption, SwitchOption } from '../../../kbn_vislib_vis_types/public/components';
|
import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public/components';
|
||||||
import { TagCloudVisParams } from '../types';
|
import { TagCloudVisParams } from '../types';
|
||||||
|
|
||||||
function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps<TagCloudVisParams>) {
|
function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps<TagCloudVisParams>) {
|
||||||
|
|
44
src/legacy/core_plugins/vis_type_vislib/index.ts
Normal file
44
src/legacy/core_plugins/vis_type_vislib/index.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { resolve } from 'path';
|
||||||
|
import { Legacy } from 'kibana';
|
||||||
|
|
||||||
|
import { LegacyPluginApi, LegacyPluginInitializer } from '../../types';
|
||||||
|
|
||||||
|
const kbnVislibVisTypesPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||||
|
new Plugin({
|
||||||
|
id: 'vis_type_vislib',
|
||||||
|
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'],
|
||||||
|
publicDir: resolve(__dirname, 'public'),
|
||||||
|
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||||
|
uiExports: {
|
||||||
|
hacks: [resolve(__dirname, 'public/legacy')],
|
||||||
|
injectDefaultVars: server => ({}),
|
||||||
|
},
|
||||||
|
init: (server: Legacy.Server) => ({}),
|
||||||
|
config(Joi: any) {
|
||||||
|
return Joi.object({
|
||||||
|
enabled: Joi.boolean().default(true),
|
||||||
|
}).default();
|
||||||
|
},
|
||||||
|
} as Legacy.PluginSpecOptions);
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
export default kbnVislibVisTypesPluginInitializer;
|
4
src/legacy/core_plugins/vis_type_vislib/package.json
Normal file
4
src/legacy/core_plugins/vis_type_vislib/package.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"name": "vis_type_vislib",
|
||||||
|
"version": "kibana"
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
@import './vislib/index'
|
|
@ -18,8 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
// @ts-ignore
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { palettes } from '@elastic/eui/lib/services';
|
||||||
|
// @ts-ignore
|
||||||
|
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
||||||
|
|
||||||
|
import { Schemas, AggGroupNames } from './legacy_imports';
|
||||||
import {
|
import {
|
||||||
Positions,
|
Positions,
|
||||||
ChartTypes,
|
ChartTypes,
|
||||||
|
@ -33,17 +37,17 @@ import {
|
||||||
getConfigCollections,
|
getConfigCollections,
|
||||||
} from './utils/collections';
|
} from './utils/collections';
|
||||||
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
||||||
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
import { createVislibVisController } from './vis_controller';
|
||||||
import { vislibVisController } from './controller';
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const areaDefinition = {
|
export const createAreaVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'area',
|
name: 'area',
|
||||||
title: i18n.translate('kbnVislibVisTypes.area.areaTitle', { defaultMessage: 'Area' }),
|
title: i18n.translate('kbnVislibVisTypes.area.areaTitle', { defaultMessage: 'Area' }),
|
||||||
icon: 'visArea',
|
icon: 'visArea',
|
||||||
description: i18n.translate('kbnVislibVisTypes.area.areaDescription', {
|
description: i18n.translate('kbnVislibVisTypes.area.areaDescription', {
|
||||||
defaultMessage: 'Emphasize the quantity beneath a line chart',
|
defaultMessage: 'Emphasize the quantity beneath a line chart',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'area',
|
type: 'area',
|
||||||
|
@ -132,7 +136,9 @@ export const areaDefinition = {
|
||||||
{
|
{
|
||||||
group: AggGroupNames.Metrics,
|
group: AggGroupNames.Metrics,
|
||||||
name: 'metric',
|
name: 'metric',
|
||||||
title: i18n.translate('kbnVislibVisTypes.area.metricsTitle', { defaultMessage: 'Y-axis' }),
|
title: i18n.translate('kbnVislibVisTypes.area.metricsTitle', {
|
||||||
|
defaultMessage: 'Y-axis',
|
||||||
|
}),
|
||||||
aggFilter: ['!geo_centroid', '!geo_bounds'],
|
aggFilter: ['!geo_centroid', '!geo_bounds'],
|
||||||
min: 1,
|
min: 1,
|
||||||
defaults: [{ schema: 'metric', type: 'count' }],
|
defaults: [{ schema: 'metric', type: 'count' }],
|
||||||
|
@ -140,7 +146,9 @@ export const areaDefinition = {
|
||||||
{
|
{
|
||||||
group: AggGroupNames.Metrics,
|
group: AggGroupNames.Metrics,
|
||||||
name: 'radius',
|
name: 'radius',
|
||||||
title: i18n.translate('kbnVislibVisTypes.area.radiusTitle', { defaultMessage: 'Dot size' }),
|
title: i18n.translate('kbnVislibVisTypes.area.radiusTitle', {
|
||||||
|
defaultMessage: 'Dot size',
|
||||||
|
}),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality'],
|
aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality'],
|
||||||
|
@ -148,7 +156,9 @@ export const areaDefinition = {
|
||||||
{
|
{
|
||||||
group: AggGroupNames.Buckets,
|
group: AggGroupNames.Buckets,
|
||||||
name: 'segment',
|
name: 'segment',
|
||||||
title: i18n.translate('kbnVislibVisTypes.area.segmentTitle', { defaultMessage: 'X-axis' }),
|
title: i18n.translate('kbnVislibVisTypes.area.segmentTitle', {
|
||||||
|
defaultMessage: 'X-axis',
|
||||||
|
}),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
|
aggFilter: ['!geohash_grid', '!geotile_grid', '!filter'],
|
||||||
|
@ -175,4 +185,4 @@ export const areaDefinition = {
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -20,7 +20,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../legacy_imports';
|
||||||
import { SwitchOption } from './switch';
|
import { SwitchOption } from './switch';
|
||||||
import { SelectOption } from './select';
|
import { SelectOption } from './select';
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
|
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { last } from 'lodash';
|
import { last } from 'lodash';
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { RangeValues, RangesParamEditor } from 'ui/vis/editors/default/controls/ranges';
|
import { RangeValues, RangesParamEditor } from '../../legacy_imports';
|
||||||
|
|
||||||
interface ColorRangesProps {
|
interface ColorRangesProps {
|
||||||
'data-test-subj'?: string;
|
'data-test-subj'?: string;
|
|
@ -22,8 +22,7 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { EuiLink, EuiText } from '@elastic/eui';
|
import { EuiLink, EuiText } from '@elastic/eui';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps, ColorSchema } from '../../legacy_imports';
|
||||||
import { ColorSchema } from 'ui/vislib/components/color/colormaps';
|
|
||||||
import { SelectOption } from './select';
|
import { SelectOption } from './select';
|
||||||
import { SwitchOption } from './switch';
|
import { SwitchOption } from './switch';
|
||||||
import { ColorSchemaVislibParams } from '../../types';
|
import { ColorSchemaVislibParams } from '../../types';
|
|
@ -18,7 +18,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect, useState, useCallback } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
|
||||||
|
import { VisOptionsProps } from '../../legacy_imports';
|
||||||
|
|
||||||
export interface ValidationVisOptionsProps<T> extends VisOptionsProps<T> {
|
export interface ValidationVisOptionsProps<T> extends VisOptionsProps<T> {
|
||||||
setMultipleValidity(paramName: string, isValid: boolean): void;
|
setMultipleValidity(paramName: string, isValid: boolean): void;
|
|
@ -20,7 +20,7 @@
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
import { EuiSpacer } from '@elastic/eui';
|
import { EuiSpacer } from '@elastic/eui';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { GaugeVisParams } from '../../../gauge';
|
import { GaugeVisParams } from '../../../gauge';
|
||||||
import { RangesPanel } from './ranges_panel';
|
import { RangesPanel } from './ranges_panel';
|
||||||
import { StylePanel } from './style_panel';
|
import { StylePanel } from './style_panel';
|
|
@ -22,7 +22,7 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
import { ColorSchemas } from '../../../legacy_imports';
|
||||||
import { ColorRanges, ColorSchemaOptions, SwitchOption } from '../../common';
|
import { ColorRanges, ColorSchemaOptions, SwitchOption } from '../../common';
|
||||||
import { GaugeOptionsInternalProps } from '.';
|
import { GaugeOptionsInternalProps } from '.';
|
||||||
import { ColorSchemaVislibParams } from '../../../types';
|
import { ColorSchemaVislibParams } from '../../../types';
|
|
@ -22,7 +22,7 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { AggGroupNames } from '../../../legacy_imports';
|
||||||
import { SelectOption } from '../../common';
|
import { SelectOption } from '../../common';
|
||||||
import { GaugeOptionsInternalProps } from '.';
|
import { GaugeOptionsInternalProps } from '.';
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import {
|
import {
|
||||||
BasicOptions,
|
BasicOptions,
|
||||||
ColorRanges,
|
ColorRanges,
|
|
@ -18,11 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
|
|
||||||
import { EuiColorPicker, EuiFormRow, EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
import { EuiColorPicker, EuiFormRow, EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { ValueAxis } from '../../../types';
|
import { ValueAxis } from '../../../types';
|
||||||
import { HeatmapVisParams } from '../../../heatmap';
|
import { HeatmapVisParams } from '../../../heatmap';
|
||||||
import { SwitchOption } from '../../common';
|
import { SwitchOption } from '../../common';
|
|
@ -25,6 +25,8 @@ import { Positions, getPositions } from '../../../utils/collections';
|
||||||
import { LabelOptions } from './label_options';
|
import { LabelOptions } from './label_options';
|
||||||
import { categoryAxis } from './mocks';
|
import { categoryAxis } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const positions = getPositions();
|
const positions = getPositions();
|
||||||
|
|
||||||
describe('CategoryAxisPanel component', () => {
|
describe('CategoryAxisPanel component', () => {
|
|
@ -18,11 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
|
|
||||||
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { BasicVislibParams, Axis } from '../../../types';
|
import { BasicVislibParams, Axis } from '../../../types';
|
||||||
import { SelectOption, SwitchOption } from '../../common';
|
import { SelectOption, SwitchOption } from '../../common';
|
||||||
import { LabelOptions } from './label_options';
|
import { LabelOptions } from './label_options';
|
|
@ -31,6 +31,8 @@ import {
|
||||||
} from '../../../utils/collections';
|
} from '../../../utils/collections';
|
||||||
import { valueAxis, seriesParam } from './mocks';
|
import { valueAxis, seriesParam } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const interpolationModes = getInterpolationModes();
|
const interpolationModes = getInterpolationModes();
|
||||||
const chartTypes = getChartTypes();
|
const chartTypes = getChartTypes();
|
||||||
const chartModes = getChartModes();
|
const chartModes = getChartModes();
|
|
@ -18,10 +18,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useMemo, useCallback } from 'react';
|
import React, { useMemo, useCallback } from 'react';
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { BasicVislibParams, SeriesParam, ValueAxis } from '../../../types';
|
import { BasicVislibParams, SeriesParam, ValueAxis } from '../../../types';
|
||||||
import { ChartTypes } from '../../../utils/collections';
|
import { ChartTypes } from '../../../utils/collections';
|
||||||
import { SelectOption } from '../../common';
|
import { SelectOption } from '../../common';
|
|
@ -28,6 +28,8 @@ const DEFAULT_Y_EXTENTS = 'defaultYExtents';
|
||||||
const SCALE = 'scale';
|
const SCALE = 'scale';
|
||||||
const SET_Y_EXTENTS = 'setYExtents';
|
const SET_Y_EXTENTS = 'setYExtents';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
describe('CustomExtentsOptions component', () => {
|
describe('CustomExtentsOptions component', () => {
|
||||||
let setValueAxis: jest.Mock;
|
let setValueAxis: jest.Mock;
|
||||||
let setValueAxisScale: jest.Mock;
|
let setValueAxisScale: jest.Mock;
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount, shallow } from 'enzyme';
|
import { mount, shallow } from 'enzyme';
|
||||||
|
|
||||||
import { MetricsAxisOptions } from './index';
|
import { MetricsAxisOptions } from './index';
|
||||||
import { BasicVislibParams, SeriesParam, ValueAxis } from '../../../types';
|
import { BasicVislibParams, SeriesParam, ValueAxis } from '../../../types';
|
||||||
import { ValidationVisOptionsProps } from '../../common';
|
import { ValidationVisOptionsProps } from '../../common';
|
||||||
|
@ -26,10 +27,10 @@ import { Positions } from '../../../utils/collections';
|
||||||
import { ValueAxesPanel } from './value_axes_panel';
|
import { ValueAxesPanel } from './value_axes_panel';
|
||||||
import { CategoryAxisPanel } from './category_axis_panel';
|
import { CategoryAxisPanel } from './category_axis_panel';
|
||||||
import { ChartTypes } from '../../../utils/collections';
|
import { ChartTypes } from '../../../utils/collections';
|
||||||
import { AggConfig } from 'ui/vis';
|
import { AggConfig, AggType } from '../../../legacy_imports';
|
||||||
import { AggType } from 'ui/agg_types';
|
|
||||||
import { defaultValueAxisId, valueAxis, seriesParam, categoryAxis } from './mocks';
|
import { defaultValueAxisId, valueAxis, seriesParam, categoryAxis } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
jest.mock('./series_panel', () => ({
|
jest.mock('./series_panel', () => ({
|
||||||
SeriesPanel: () => 'SeriesPanel',
|
SeriesPanel: () => 'SeriesPanel',
|
||||||
}));
|
}));
|
|
@ -21,7 +21,7 @@ import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
||||||
import { cloneDeep, uniq, get } from 'lodash';
|
import { cloneDeep, uniq, get } from 'lodash';
|
||||||
import { EuiSpacer } from '@elastic/eui';
|
import { EuiSpacer } from '@elastic/eui';
|
||||||
|
|
||||||
import { AggConfig } from 'ui/vis';
|
import { AggConfig } from '../../../legacy_imports';
|
||||||
import { BasicVislibParams, ValueAxis, SeriesParam, Axis } from '../../../types';
|
import { BasicVislibParams, ValueAxis, SeriesParam, Axis } from '../../../types';
|
||||||
import { ValidationVisOptionsProps } from '../../common';
|
import { ValidationVisOptionsProps } from '../../common';
|
||||||
import { SeriesPanel } from './series_panel';
|
import { SeriesPanel } from './series_panel';
|
|
@ -23,6 +23,8 @@ import { LabelOptions, LabelOptionsProps } from './label_options';
|
||||||
import { TruncateLabelsOption } from '../../common';
|
import { TruncateLabelsOption } from '../../common';
|
||||||
import { valueAxis, categoryAxis } from './mocks';
|
import { valueAxis, categoryAxis } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const FILTER = 'filter';
|
const FILTER = 'filter';
|
||||||
const ROTATE = 'rotate';
|
const ROTATE = 'rotate';
|
||||||
const DISABLED = 'disabled';
|
const DISABLED = 'disabled';
|
|
@ -18,11 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { BasicVislibParams, Axis } from '../../../types';
|
import { BasicVislibParams, Axis } from '../../../types';
|
||||||
import { SelectOption, SwitchOption, TruncateLabelsOption } from '../../common';
|
import { SelectOption, SwitchOption, TruncateLabelsOption } from '../../common';
|
||||||
import { getRotateOptions } from '../../../utils/collections';
|
import { getRotateOptions } from '../../../utils/collections';
|
|
@ -24,6 +24,8 @@ import { NumberInputOption } from '../../common';
|
||||||
import { getInterpolationModes } from '../../../utils/collections';
|
import { getInterpolationModes } from '../../../utils/collections';
|
||||||
import { seriesParam } from './mocks';
|
import { seriesParam } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const LINE_WIDTH = 'lineWidth';
|
const LINE_WIDTH = 'lineWidth';
|
||||||
const DRAW_LINES = 'drawLinesBetweenPoints';
|
const DRAW_LINES = 'drawLinesBetweenPoints';
|
||||||
const interpolationModes = getInterpolationModes();
|
const interpolationModes = getInterpolationModes();
|
|
@ -18,10 +18,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
|
||||||
|
|
||||||
import { Vis } from 'ui/vis';
|
import { Vis } from '../../../legacy_imports';
|
||||||
import { SeriesParam } from '../../../types';
|
import { SeriesParam } from '../../../types';
|
||||||
import { NumberInputOption, SelectOption, SwitchOption } from '../../common';
|
import { NumberInputOption, SelectOption, SwitchOption } from '../../common';
|
||||||
import { SetChart } from './chart_options';
|
import { SetChart } from './chart_options';
|
|
@ -18,11 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui';
|
import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { BasicVislibParams } from '../../../types';
|
import { BasicVislibParams } from '../../../types';
|
||||||
import { ChartOptions } from './chart_options';
|
import { ChartOptions } from './chart_options';
|
||||||
import { SetParamByIndex, ChangeValueAxis } from './';
|
import { SetParamByIndex, ChangeValueAxis } from './';
|
|
@ -44,7 +44,7 @@ const makeSerie = (
|
||||||
};
|
};
|
||||||
|
|
||||||
const isAxisHorizontal = (position: Positions) =>
|
const isAxisHorizontal = (position: Positions) =>
|
||||||
[Positions.TOP, Positions.BOTTOM].includes(position);
|
[Positions.TOP, Positions.BOTTOM].includes(position as any);
|
||||||
|
|
||||||
const RADIX = 10;
|
const RADIX = 10;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import { Positions, getScaleTypes, getAxisModes, getPositions } from '../../../u
|
||||||
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
import { mountWithIntl } from 'test_utils/enzyme_helpers';
|
||||||
import { valueAxis, seriesParam } from './mocks';
|
import { valueAxis, seriesParam } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const positions = getPositions();
|
const positions = getPositions();
|
||||||
const axisModes = getAxisModes();
|
const axisModes = getAxisModes();
|
||||||
const scaleTypes = getScaleTypes();
|
const scaleTypes = getScaleTypes();
|
|
@ -32,6 +32,8 @@ import {
|
||||||
} from '../../../utils/collections';
|
} from '../../../utils/collections';
|
||||||
import { valueAxis, categoryAxis } from './mocks';
|
import { valueAxis, categoryAxis } from './mocks';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
const POSITION = 'position';
|
const POSITION = 'position';
|
||||||
const positions = getPositions();
|
const positions = getPositions();
|
||||||
const axisModes = getAxisModes();
|
const axisModes = getAxisModes();
|
|
@ -100,7 +100,7 @@ function ValueAxisOptions(props: ValueAxisOptionsParams) {
|
||||||
if (isCategoryAxisHorizontal) {
|
if (isCategoryAxisHorizontal) {
|
||||||
return isAxisHorizontal(position);
|
return isAxisHorizontal(position);
|
||||||
}
|
}
|
||||||
return [Positions.LEFT, Positions.RIGHT].includes(position);
|
return [Positions.LEFT, Positions.RIGHT].includes(position as any);
|
||||||
},
|
},
|
||||||
[isCategoryAxisHorizontal]
|
[isCategoryAxisHorizontal]
|
||||||
);
|
);
|
|
@ -23,6 +23,8 @@ import { YExtents, YExtentsProps } from './y_extents';
|
||||||
import { ScaleTypes } from '../../../utils/collections';
|
import { ScaleTypes } from '../../../utils/collections';
|
||||||
import { NumberInputOption } from '../../common';
|
import { NumberInputOption } from '../../common';
|
||||||
|
|
||||||
|
jest.mock('ui/new_platform');
|
||||||
|
|
||||||
describe('YExtents component', () => {
|
describe('YExtents component', () => {
|
||||||
let setMultipleValidity: jest.Mock;
|
let setMultipleValidity: jest.Mock;
|
||||||
let setScale: jest.Mock;
|
let setScale: jest.Mock;
|
|
@ -17,11 +17,12 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../legacy_imports';
|
||||||
import { BasicOptions, TruncateLabelsOption, SwitchOption } from '../common';
|
import { BasicOptions, TruncateLabelsOption, SwitchOption } from '../common';
|
||||||
import { PieVisParams } from '../../pie';
|
import { PieVisParams } from '../../pie';
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React, { useMemo, useEffect, useCallback } from 'react';
|
import React, { useMemo, useEffect, useCallback } from 'react';
|
||||||
|
|
||||||
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
|
||||||
import { VisOptionsProps } from 'ui/vis/editors/default';
|
import { VisOptionsProps } from '../../../legacy_imports';
|
||||||
import { SelectOption, SwitchOption } from '../../common';
|
import { SelectOption, SwitchOption } from '../../common';
|
||||||
import { BasicVislibParams, ValueAxis } from '../../../types';
|
import { BasicVislibParams, ValueAxis } from '../../../types';
|
||||||
|
|
|
@ -18,14 +18,43 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { Schemas, AggGroupNames, ColorSchemas, RangeValues } from './legacy_imports';
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
|
||||||
import { GaugeOptions } from './components/options';
|
import { GaugeOptions } from './components/options';
|
||||||
import { getGaugeCollections, Alignments, ColorModes, GaugeTypes } from './utils/collections';
|
import { getGaugeCollections, Alignments, ColorModes, GaugeTypes } from './utils/collections';
|
||||||
import { vislibVisController } from './controller';
|
import { createVislibVisController } from './vis_controller';
|
||||||
|
import { ColorSchemaVislibParams, Labels, Style } from './types';
|
||||||
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const gaugeDefinition = {
|
export interface Gauge extends ColorSchemaVislibParams {
|
||||||
|
backStyle: 'Full';
|
||||||
|
gaugeStyle: 'Full';
|
||||||
|
orientation: 'vertical';
|
||||||
|
type: 'meter';
|
||||||
|
alignment: Alignments;
|
||||||
|
colorsRange: RangeValues[];
|
||||||
|
extendRange: boolean;
|
||||||
|
gaugeType: GaugeTypes;
|
||||||
|
labels: Labels;
|
||||||
|
percentageMode: boolean;
|
||||||
|
outline?: boolean;
|
||||||
|
scale: {
|
||||||
|
show: boolean;
|
||||||
|
labels: false;
|
||||||
|
color: 'rgba(105,112,125,0.2)';
|
||||||
|
};
|
||||||
|
style: Style;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GaugeVisParams {
|
||||||
|
type: 'gauge';
|
||||||
|
addTooltip: boolean;
|
||||||
|
addLegend: boolean;
|
||||||
|
isDisplayWarning: boolean;
|
||||||
|
gauge: Gauge;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createGaugeVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'gauge',
|
name: 'gauge',
|
||||||
title: i18n.translate('kbnVislibVisTypes.gauge.gaugeTitle', { defaultMessage: 'Gauge' }),
|
title: i18n.translate('kbnVislibVisTypes.gauge.gaugeTitle', { defaultMessage: 'Gauge' }),
|
||||||
icon: 'visGauge',
|
icon: 'visGauge',
|
||||||
|
@ -79,7 +108,7 @@ export const gaugeDefinition = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
editorConfig: {
|
editorConfig: {
|
||||||
collections: getGaugeCollections(),
|
collections: getGaugeCollections(),
|
||||||
optionsTemplate: GaugeOptions,
|
optionsTemplate: GaugeOptions,
|
||||||
|
@ -115,4 +144,4 @@ export const gaugeDefinition = {
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
useCustomNoDataScreen: true,
|
useCustomNoDataScreen: true,
|
||||||
};
|
});
|
|
@ -18,21 +18,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { Schemas, AggGroupNames, ColorSchemas } from './legacy_imports';
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
|
||||||
import { GaugeOptions } from './components/options';
|
import { GaugeOptions } from './components/options';
|
||||||
import { getGaugeCollections, GaugeTypes, ColorModes } from './utils/collections';
|
import { getGaugeCollections, GaugeTypes, ColorModes } from './utils/collections';
|
||||||
import { vislibVisController } from './controller';
|
import { createVislibVisController } from './vis_controller';
|
||||||
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const goalDefinition = {
|
export const createGoalVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'goal',
|
name: 'goal',
|
||||||
title: i18n.translate('kbnVislibVisTypes.goal.goalTitle', { defaultMessage: 'Goal' }),
|
title: i18n.translate('kbnVislibVisTypes.goal.goalTitle', { defaultMessage: 'Goal' }),
|
||||||
icon: 'visGoal',
|
icon: 'visGoal',
|
||||||
description: i18n.translate('kbnVislibVisTypes.goal.goalDescription', {
|
description: i18n.translate('kbnVislibVisTypes.goal.goalDescription', {
|
||||||
defaultMessage: 'A goal chart indicates how close you are to your final goal.',
|
defaultMessage: 'A goal chart indicates how close you are to your final goal.',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
addTooltip: true,
|
addTooltip: true,
|
||||||
|
@ -108,4 +108,4 @@ export const goalDefinition = {
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
useCustomNoDataScreen: true,
|
useCustomNoDataScreen: true,
|
||||||
};
|
});
|
|
@ -18,21 +18,35 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { Schemas, AggGroupNames, ColorSchemas, RangeValues } from './legacy_imports';
|
||||||
import { ColorSchemas } from 'ui/vislib/components/color/colormaps';
|
|
||||||
import { AxisTypes, getHeatmapCollections, Positions, ScaleTypes } from './utils/collections';
|
import { AxisTypes, getHeatmapCollections, Positions, ScaleTypes } from './utils/collections';
|
||||||
import { HeatmapOptions } from './components/options';
|
import { HeatmapOptions } from './components/options';
|
||||||
import { vislibVisController } from './controller';
|
import { createVislibVisController } from './vis_controller';
|
||||||
|
import { TimeMarker } from './vislib/visualizations/time_marker';
|
||||||
|
import { CommonVislibParams, ColorSchemaVislibParams, ValueAxis } from './types';
|
||||||
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const heatmapDefinition = {
|
export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaVislibParams {
|
||||||
|
type: 'heatmap';
|
||||||
|
addLegend: boolean;
|
||||||
|
enableHover: boolean;
|
||||||
|
colorsNumber: number | '';
|
||||||
|
colorsRange: RangeValues[];
|
||||||
|
valueAxes: ValueAxis[];
|
||||||
|
setColorRange: boolean;
|
||||||
|
percentageMode: boolean;
|
||||||
|
times: TimeMarker[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createHeatmapVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'heatmap',
|
name: 'heatmap',
|
||||||
title: i18n.translate('kbnVislibVisTypes.heatmap.heatmapTitle', { defaultMessage: 'Heat Map' }),
|
title: i18n.translate('kbnVislibVisTypes.heatmap.heatmapTitle', { defaultMessage: 'Heat Map' }),
|
||||||
icon: 'visHeatmap',
|
icon: 'visHeatmap',
|
||||||
description: i18n.translate('kbnVislibVisTypes.heatmap.heatmapDescription', {
|
description: i18n.translate('kbnVislibVisTypes.heatmap.heatmapDescription', {
|
||||||
defaultMessage: 'Shade cells within a matrix',
|
defaultMessage: 'Shade cells within a matrix',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'heatmap',
|
type: 'heatmap',
|
||||||
|
@ -122,4 +136,4 @@ export const heatmapDefinition = {
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -18,8 +18,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
// @ts-ignore
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { palettes } from '@elastic/eui/lib/services';
|
||||||
|
// @ts-ignore
|
||||||
|
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
||||||
|
|
||||||
|
import { Schemas, AggGroupNames } from './legacy_imports';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Positions,
|
Positions,
|
||||||
ChartTypes,
|
ChartTypes,
|
||||||
|
@ -32,10 +37,10 @@ import {
|
||||||
getConfigCollections,
|
getConfigCollections,
|
||||||
} from './utils/collections';
|
} from './utils/collections';
|
||||||
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
||||||
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
import { createVislibVisController } from './vis_controller';
|
||||||
import { vislibVisController } from './controller';
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const histogramDefinition = {
|
export const createHistogramVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'histogram',
|
name: 'histogram',
|
||||||
title: i18n.translate('kbnVislibVisTypes.histogram.histogramTitle', {
|
title: i18n.translate('kbnVislibVisTypes.histogram.histogramTitle', {
|
||||||
defaultMessage: 'Vertical Bar',
|
defaultMessage: 'Vertical Bar',
|
||||||
|
@ -44,7 +49,7 @@ export const histogramDefinition = {
|
||||||
description: i18n.translate('kbnVislibVisTypes.histogram.histogramDescription', {
|
description: i18n.translate('kbnVislibVisTypes.histogram.histogramDescription', {
|
||||||
defaultMessage: 'Assign a continuous variable to each axis',
|
defaultMessage: 'Assign a continuous variable to each axis',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'histogram',
|
type: 'histogram',
|
||||||
|
@ -183,4 +188,4 @@ export const histogramDefinition = {
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -18,8 +18,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
// @ts-ignore
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { palettes } from '@elastic/eui/lib/services';
|
||||||
|
// @ts-ignore
|
||||||
|
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
||||||
|
|
||||||
|
import { Schemas, AggGroupNames } from './legacy_imports';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Positions,
|
Positions,
|
||||||
ChartTypes,
|
ChartTypes,
|
||||||
|
@ -32,10 +37,10 @@ import {
|
||||||
getConfigCollections,
|
getConfigCollections,
|
||||||
} from './utils/collections';
|
} from './utils/collections';
|
||||||
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
||||||
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
import { createVislibVisController } from './vis_controller';
|
||||||
import { vislibVisController } from './controller';
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const horizontalBarDefinition = {
|
export const createHorizontalBarVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'horizontal_bar',
|
name: 'horizontal_bar',
|
||||||
title: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarTitle', {
|
title: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarTitle', {
|
||||||
defaultMessage: 'Horizontal Bar',
|
defaultMessage: 'Horizontal Bar',
|
||||||
|
@ -44,7 +49,7 @@ export const horizontalBarDefinition = {
|
||||||
description: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarDescription', {
|
description: i18n.translate('kbnVislibVisTypes.horizontalBar.horizontalBarDescription', {
|
||||||
defaultMessage: 'Assign a continuous variable to each axis',
|
defaultMessage: 'Assign a continuous variable to each axis',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'histogram',
|
type: 'histogram',
|
||||||
|
@ -182,4 +187,4 @@ export const horizontalBarDefinition = {
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -17,16 +17,9 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CommonVislibParams } from './types';
|
import { PluginInitializerContext } from '../../../../core/public';
|
||||||
|
import { KbnVislibVisTypesPlugin as Plugin } from './plugin';
|
||||||
|
|
||||||
export interface PieVisParams extends CommonVislibParams {
|
export function plugin(initializerContext: PluginInitializerContext) {
|
||||||
type: 'pie';
|
return new Plugin(initializerContext);
|
||||||
addLegend: boolean;
|
|
||||||
isDonut: boolean;
|
|
||||||
labels: {
|
|
||||||
show: boolean;
|
|
||||||
values: boolean;
|
|
||||||
last_level: boolean;
|
|
||||||
truncate: number | null;
|
|
||||||
};
|
|
||||||
}
|
}
|
74
src/legacy/core_plugins/vis_type_vislib/public/legacy.ts
Normal file
74
src/legacy/core_plugins/vis_type_vislib/public/legacy.ts
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { npSetup, npStart } from 'ui/new_platform';
|
||||||
|
import { PluginInitializerContext } from 'kibana/public';
|
||||||
|
|
||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
import {
|
||||||
|
initializeHierarchicalTooltipFormatter,
|
||||||
|
getHierarchicalTooltipFormatter,
|
||||||
|
// @ts-ignore
|
||||||
|
} from 'ui/vis/components/tooltip/_hierarchical_tooltip_formatter';
|
||||||
|
import {
|
||||||
|
initializePointSeriesTooltipFormatter,
|
||||||
|
getPointSeriesTooltipFormatter,
|
||||||
|
// @ts-ignore
|
||||||
|
} from 'ui/vis/components/tooltip/_pointseries_tooltip_formatter';
|
||||||
|
import {
|
||||||
|
vislibSeriesResponseHandlerProvider,
|
||||||
|
vislibSlicesResponseHandlerProvider,
|
||||||
|
// @ts-ignore
|
||||||
|
} from 'ui/vis/response_handlers/vislib';
|
||||||
|
// @ts-ignore
|
||||||
|
import { vislibColor } from 'ui/vis/components/color/color';
|
||||||
|
|
||||||
|
import { plugin } from '.';
|
||||||
|
import {
|
||||||
|
KbnVislibVisTypesPluginSetupDependencies,
|
||||||
|
KbnVislibVisTypesPluginStartDependencies,
|
||||||
|
} from './plugin';
|
||||||
|
import {
|
||||||
|
setup as visualizationsSetup,
|
||||||
|
start as visualizationsStart,
|
||||||
|
} from '../../visualizations/public/np_ready/public/legacy';
|
||||||
|
|
||||||
|
const setupPlugins: Readonly<KbnVislibVisTypesPluginSetupDependencies> = {
|
||||||
|
expressions: npSetup.plugins.expressions,
|
||||||
|
visualizations: visualizationsSetup,
|
||||||
|
__LEGACY: {
|
||||||
|
initializeHierarchicalTooltipFormatter,
|
||||||
|
getHierarchicalTooltipFormatter,
|
||||||
|
initializePointSeriesTooltipFormatter,
|
||||||
|
getPointSeriesTooltipFormatter,
|
||||||
|
vislibSeriesResponseHandlerProvider,
|
||||||
|
vislibSlicesResponseHandlerProvider,
|
||||||
|
vislibColor,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const startPlugins: Readonly<KbnVislibVisTypesPluginStartDependencies> = {
|
||||||
|
expressions: npStart.plugins.expressions,
|
||||||
|
visualizations: visualizationsStart,
|
||||||
|
};
|
||||||
|
|
||||||
|
const pluginInstance = plugin({} as PluginInitializerContext);
|
||||||
|
|
||||||
|
export const setup = pluginInstance.setup(npSetup.core, setupPlugins);
|
||||||
|
export const start = pluginInstance.start(npStart.core, startPlugins);
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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 { AggGroupNames, VisOptionsProps } from 'ui/vis/editors/default';
|
||||||
|
export { Schemas } from 'ui/vis/editors/default/schemas';
|
||||||
|
export { RangeValues, RangesParamEditor } from 'ui/vis/editors/default/controls/ranges';
|
||||||
|
export { ColorSchema, ColorSchemas, colorSchemas, getHeatmapColors } from 'ui/color_maps';
|
||||||
|
export { AggConfig, Vis, VisParams } from 'ui/vis';
|
||||||
|
export { AggType } from 'ui/agg_types';
|
||||||
|
export { CUSTOM_LEGEND_VIS_TYPES, VisLegend } from 'ui/vis/vis_types/vislib_vis_legend';
|
||||||
|
// @ts-ignore
|
||||||
|
export { Tooltip } from 'ui/vis/components/tooltip';
|
||||||
|
// @ts-ignore
|
||||||
|
export { SimpleEmitter } from 'ui/utils/simple_emitter';
|
||||||
|
// @ts-ignore
|
||||||
|
export { Binder } from 'ui/binder';
|
||||||
|
export { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
|
||||||
|
// @ts-ignore
|
||||||
|
export { tabifyAggResponse } from 'ui/agg_response/tabify';
|
|
@ -18,8 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
// @ts-ignore
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { palettes } from '@elastic/eui/lib/services';
|
||||||
|
// @ts-ignore
|
||||||
|
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
||||||
|
|
||||||
|
import { Schemas, AggGroupNames } from './legacy_imports';
|
||||||
import {
|
import {
|
||||||
Positions,
|
Positions,
|
||||||
ChartTypes,
|
ChartTypes,
|
||||||
|
@ -32,18 +36,18 @@ import {
|
||||||
InterpolationModes,
|
InterpolationModes,
|
||||||
getConfigCollections,
|
getConfigCollections,
|
||||||
} from './utils/collections';
|
} from './utils/collections';
|
||||||
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
|
||||||
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
import { getAreaOptionTabs, countLabel } from './utils/common_config';
|
||||||
import { vislibVisController } from './controller';
|
import { createVislibVisController } from './vis_controller';
|
||||||
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const lineDefinition = {
|
export const createLineVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'line',
|
name: 'line',
|
||||||
title: i18n.translate('kbnVislibVisTypes.line.lineTitle', { defaultMessage: 'Line' }),
|
title: i18n.translate('kbnVislibVisTypes.line.lineTitle', { defaultMessage: 'Line' }),
|
||||||
icon: 'visLine',
|
icon: 'visLine',
|
||||||
description: i18n.translate('kbnVislibVisTypes.line.lineDescription', {
|
description: i18n.translate('kbnVislibVisTypes.line.lineDescription', {
|
||||||
defaultMessage: 'Emphasize trends',
|
defaultMessage: 'Emphasize trends',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
|
@ -175,4 +179,4 @@ export const lineDefinition = {
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
};
|
});
|
|
@ -18,20 +18,34 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { Schemas } from 'ui/vis/editors/default/schemas';
|
|
||||||
import { AggGroupNames } from 'ui/vis/editors/default';
|
import { Schemas, AggGroupNames } from './legacy_imports';
|
||||||
import { PieOptions } from './components/options';
|
import { PieOptions } from './components/options';
|
||||||
import { getPositions, Positions } from './utils/collections';
|
import { getPositions, Positions } from './utils/collections';
|
||||||
import { vislibVisController } from './controller';
|
import { createVislibVisController } from './vis_controller';
|
||||||
|
import { CommonVislibParams } from './types';
|
||||||
|
import { KbnVislibVisTypesDependencies } from './plugin';
|
||||||
|
|
||||||
export const pieDefinition = {
|
export interface PieVisParams extends CommonVislibParams {
|
||||||
|
type: 'pie';
|
||||||
|
addLegend: boolean;
|
||||||
|
isDonut: boolean;
|
||||||
|
labels: {
|
||||||
|
show: boolean;
|
||||||
|
values: boolean;
|
||||||
|
last_level: boolean;
|
||||||
|
truncate: number | null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const createPieVisTypeDefinition = (deps: KbnVislibVisTypesDependencies) => ({
|
||||||
name: 'pie',
|
name: 'pie',
|
||||||
title: i18n.translate('kbnVislibVisTypes.pie.pieTitle', { defaultMessage: 'Pie' }),
|
title: i18n.translate('kbnVislibVisTypes.pie.pieTitle', { defaultMessage: 'Pie' }),
|
||||||
icon: 'visPie',
|
icon: 'visPie',
|
||||||
description: i18n.translate('kbnVislibVisTypes.pie.pieDescription', {
|
description: i18n.translate('kbnVislibVisTypes.pie.pieDescription', {
|
||||||
defaultMessage: 'Compare parts of a whole',
|
defaultMessage: 'Compare parts of a whole',
|
||||||
}),
|
}),
|
||||||
visualization: vislibVisController,
|
visualization: createVislibVisController(deps),
|
||||||
visConfig: {
|
visConfig: {
|
||||||
defaults: {
|
defaults: {
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
|
@ -89,4 +103,4 @@ export const pieDefinition = {
|
||||||
},
|
},
|
||||||
hierarchicalData: true,
|
hierarchicalData: true,
|
||||||
responseHandler: 'vislib_slices',
|
responseHandler: 'vislib_slices',
|
||||||
};
|
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue