Skip to content

Commit

Permalink
Move tsvb server to new platform (#55310)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Jan 30, 2020
1 parent c504c40 commit 74b9ed6
Show file tree
Hide file tree
Showing 218 changed files with 405 additions and 385 deletions.
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"visTypeMetric": "src/legacy/core_plugins/vis_type_metric",
"visTypeTable": "src/legacy/core_plugins/vis_type_table",
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
"visTypeTimeseries": "src/legacy/core_plugins/vis_type_timeseries",
"visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"],
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
"visTypeVislib": "src/legacy/core_plugins/vis_type_vislib",
"visualizations": [
Expand Down
6 changes: 0 additions & 6 deletions src/legacy/core_plugins/vis_type_timeseries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { resolve } from 'path';
import { Legacy } from 'kibana';

import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types';
import { VisTypeTimeseriesSetup } from '../../../plugins/vis_type_timeseries/server';

const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
new Plugin({
Expand All @@ -47,11 +46,6 @@ const metricsPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPlu
},
},
},
init: (server: Legacy.Server) => {
const visTypeTimeSeriesPlugin = server.newPlatform.setup.plugins
.metrics as VisTypeTimeseriesSetup;
visTypeTimeSeriesPlugin.__legacy.registerLegacyAPI({ server });
},
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { METRIC_TYPES } from '../../../common/metric_types';
import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';

export const FilterRatioAgg = props => {
const { series, fields, panel } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import { includes } from 'lodash';
import { injectI18n } from '@kbn/i18n/react';
import { EuiComboBox } from '@elastic/eui';
import { calculateSiblings } from '../lib/calculate_siblings';
import { calculateLabel } from '../../../common/calculate_label';
import { basicAggs } from '../../../common/basic_aggs';
import { toPercentileNumber } from '../../../common/to_percentile_number';
import { METRIC_TYPES } from '../../../common/metric_types';
import { calculateLabel } from '../../../../../../plugins/vis_type_timeseries/common/calculate_label';
import { basicAggs } from '../../../../../../plugins/vis_type_timeseries/common/basic_aggs';
import { toPercentileNumber } from '../../../../../../plugins/vis_type_timeseries/common/to_percentile_number';
import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';

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

const DEFAULTS = {
model_type: MODEL_TYPES.UNWEIGHTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { METRIC_TYPES } from '../../../common/metric_types';
import { METRIC_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/metric_types';

export function StandardAgg(props) {
const { model, panel, series, fields, uiRestrictions } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { KBN_FIELD_TYPES } from '../../../../../../plugins/data/public';
import { PANEL_TYPES } from '../../../common/panel_types';
import { PANEL_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/panel_types';

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

Expand Down Expand Up @@ -138,8 +141,8 @@ export const IndexPattern = ({ fields, prefix, onChange, disabled, model: _model
</EuiFormRow>
<EuiText size="xs" style={{ margin: 0 }}>
{i18n.translate('visTypeTimeseries.indexPattern.timeRange.hint', {
defaultMessage: `This setting controls the timespan used for matching documents.
"Entire timerange" will match all the documents selected in the timepicker.
defaultMessage: `This setting controls the timespan used for matching documents.
"Entire timerange" will match all the documents selected in the timepicker.
"Last value" will match only the documents for the specified interval from the end of the timerange.`,
})}
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import _ from 'lodash';
import { getLastValue } from '../../../common/get_last_value';
import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { createTickFormatter } from './tick_formatter';
import moment from 'moment';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import moment from 'moment';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { parseEsInterval } from '../../../../data/public';
import { GTE_INTERVAL_RE } from '../../../common/interval_regexp';
import { GTE_INTERVAL_RE } from '../../../../../../plugins/vis_type_timeseries/common/interval_regexp';

export const AUTO_INTERVAL = 'auto';

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

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

export const seriesChangeHandler = (props, items) => doc => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
EuiFieldText,
} from '@elastic/eui';
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { FIELD_TYPES } from '../../../common/field_types';
import { FIELD_TYPES } from '../../../../../../plugins/vis_type_timeseries/common/field_types';
import { STACKED_OPTIONS } from '../../visualizations/constants';

const DEFAULTS = { terms_direction: 'desc', terms_size: 10, terms_order_by: '_count' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { VisPicker } from './vis_picker';
import { PanelConfig } from './panel_config';
import { createBrushHandler } from '../lib/create_brush_handler';
import { fetchFields } from '../lib/fetch_fields';
import { extractIndexPatterns } from '../../common/extract_index_patterns';
import { extractIndexPatterns } from '../../../../../plugins/vis_type_timeseries/common/extract_index_patterns';
import { esKuery } from '../../../../../plugins/data/public';

import { npStart } from 'ui/new_platform';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
isGteInterval,
AUTO_INTERVAL,
} from './lib/get_interval';
import { PANEL_TYPES } from '../../common/panel_types';
import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';

const MIN_CHART_HEIGHT = 300;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { EuiTabs, EuiTab } from '@elastic/eui';
import { injectI18n } from '@kbn/i18n/react';
import { PANEL_TYPES } from '../../common/panel_types';
import { PANEL_TYPES } from '../../../../../plugins/vis_type_timeseries/common/panel_types';

function VisPickerItem(props) {
const { label, type, selected } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { visWithSplits } from '../../vis_with_splits';
import { createTickFormatter } from '../../lib/tick_formatter';
import _, { get, isUndefined, assign, includes } from 'lodash';
import { Gauge } from '../../../visualizations/views/gauge';
import { getLastValue } from '../../../../common/get_last_value';
import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';

function getColors(props) {
const { model, visData } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Markdown } from '../../../../../kibana_react/public';
import { ErrorComponent } from '../../error';
import { replaceVars } from '../../lib/replace_vars';
import { convertSeriesToVars } from '../../lib/convert_series_to_vars';
import { isBackgroundInverted } from '../../../../common/set_is_reversed';
import { isBackgroundInverted } from '../../../lib/set_is_reversed';

const getMarkdownId = id => `markdown-${id}`;

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

function getColors(props) {
const { model, visData } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { basicAggs } from '../../../../common/basic_aggs';
import { basicAggs } from '../../../../../../../plugins/vis_type_timeseries/common/basic_aggs';

export function isSortable(metric) {
return basicAggs.includes(metric.type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { npStart } from 'ui/new_platform';
import { createTickFormatter } from '../../lib/tick_formatter';
import { calculateLabel } from '../../../../common/calculate_label';
import { calculateLabel } from '../../../../../../../plugins/vis_type_timeseries/common/calculate_label';
import { isSortable } from './is_sortable';
import { EuiToolTip, EuiIcon } from '@elastic/eui';
import { replaceVars } from '../../lib/replace_vars';
import { fieldFormats } from '../../../../../../../plugins/data/public';
import { FormattedMessage } from '@kbn/i18n/react';

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

function getColor(rules, colorKey, value) {
let color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
import { Split } from '../../split';
import { createTextHandler } from '../../lib/create_text_handler';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
import { PANEL_TYPES } from '../../../../common/panel_types';
import { PANEL_TYPES } from '../../../../../../../plugins/vis_type_timeseries/common/panel_types';

const TimeseriesSeriesUI = injectI18n(function(props) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { getAxisLabelString } from '../../lib/get_axis_label_string';
import { getInterval } from '../../lib/get_interval';
import { areFieldsDifferent } from '../../lib/charts';
import { createXaxisFormatter } from '../../lib/create_xaxis_formatter';
import { isBackgroundDark } from '../../../../common/set_is_reversed';
import { isBackgroundDark } from '../../../lib/set_is_reversed';
import { STACKED_OPTIONS } from '../../../visualizations/constants';

export class TimeseriesVisualization extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import { createTickFormatter } from '../../lib/tick_formatter';
import { TopN } from '../../../visualizations/views/top_n';
import { getLastValue } from '../../../../common/get_last_value';
import { isBackgroundInverted } from '../../../../common/set_is_reversed';
import { getLastValue } from '../../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { isBackgroundInverted } from '../../../lib/set_is_reversed';
import { replaceVars } from '../../lib/replace_vars';
import PropTypes from 'prop-types';
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import React from 'react';
import { getDisplayName } from './lib/get_display_name';
import { last, findIndex, first } from 'lodash';
import { calculateLabel } from '../../common/calculate_label';
import { calculateLabel } from '../../../../../plugins/vis_type_timeseries/common/calculate_label';

export function visWithSplits(WrappedComponent) {
function SplitVisComponent(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*/

import { get } from 'lodash';
import { RESTRICTIONS_KEYS, DEFAULT_UI_RESTRICTION } from '../../common/ui_restrictions';
import {
RESTRICTIONS_KEYS,
DEFAULT_UI_RESTRICTION,
} from '../../../../../plugins/vis_type_timeseries/common/ui_restrictions';

/**
* Generic method for checking all types of the UI Restrictions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { kfetch } from 'ui/kfetch';
import { toastNotifications } from 'ui/notify';
import { i18n } from '@kbn/i18n';
import { extractIndexPatterns } from '../../common/extract_index_patterns';
import { extractIndexPatterns } from '../../../../../plugins/vis_type_timeseries/common/extract_index_patterns';

export async function fetchFields(indexPatterns = ['*']) {
const patterns = Array.isArray(indexPatterns) ? indexPatterns : [indexPatterns];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

import color from 'color';
import chrome from '../../../ui/public/chrome';
import { getUISettings } from '../services';

const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
const isDarkTheme = () => getUISettings().get('theme:darkMode');

/**
* Returns true if the color that is passed has low luminosity
Expand All @@ -34,7 +34,7 @@ const isColorDark = c => {
* Defaults to checking `theme:darkMode`.
*/
export const isThemeDark = currentTheme => {
let themeIsDark = currentTheme || IS_DARK_THEME;
let themeIsDark = currentTheme || isDarkTheme();

// If passing a string, check the luminosity
if (typeof currentTheme === 'string') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { GTE_INTERVAL_RE } from '../../common/interval_regexp';
import { GTE_INTERVAL_RE } from '../../../../../plugins/vis_type_timeseries/common/interval_regexp';
import { i18n } from '@kbn/i18n';
import { parseInterval } from '../../../../../plugins/data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { metricsRequestHandler } from './request_handler';
// @ts-ignore
import { EditorController } from './editor_controller';
// @ts-ignore
import { PANEL_TYPES } from '../common/panel_types';
import { PANEL_TYPES } from '../../../../plugins/vis_type_timeseries/common/panel_types';

export const metricsVisDefinition = {
name: 'metrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import classNames from 'classnames';
import { isBackgroundInverted, isBackgroundDark } from '../../../common/set_is_reversed';
import { getLastValue } from '../../../common/get_last_value';
import { isBackgroundInverted, isBackgroundDark } from '../../lib/set_is_reversed';
import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import { getValueBy } from '../lib/get_value_by';
import { GaugeVis } from './gauge_vis';
import reactcss from 'reactcss';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import _ from 'lodash';
import { getLastValue } from '../../../common/get_last_value';
import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import reactcss from 'reactcss';
import { calculateCoordinates } from '../lib/calculate_coordinates';

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

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { getLastValue } from '../../../common/get_last_value';
import { getLastValue } from '../../../../../../plugins/vis_type_timeseries/common/get_last_value';
import reactcss from 'reactcss';

const RENDER_MODES = {
Expand Down
44 changes: 0 additions & 44 deletions src/legacy/core_plugins/vis_type_timeseries/server/init.ts

This file was deleted.

Loading

0 comments on commit 74b9ed6

Please sign in to comment.