mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Migrate timelion vis (#62819)
This commit is contained in:
parent
eefafa2919
commit
4e56419ca4
205 changed files with 123 additions and 222 deletions
|
@ -9,14 +9,14 @@ bower_components
|
|||
/built_assets
|
||||
/html_docs
|
||||
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
|
||||
/src/legacy/core_plugins/vis_type_timelion/public/_generated_/**
|
||||
/src/plugins/vis_type_timelion/public/_generated_/**
|
||||
src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data
|
||||
/src/legacy/ui/public/flot-charts
|
||||
/test/fixtures/scenarios
|
||||
/src/legacy/core_plugins/console/public/webpackShims
|
||||
/src/legacy/core_plugins/console/public/tests/webpackShims
|
||||
/src/legacy/ui/public/utils/decode_geo_hash.js
|
||||
/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
|
||||
/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
|
||||
/src/core/lib/kbn_internal_native_observable
|
||||
/packages/*/target
|
||||
/packages/eslint-config-kibana
|
||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -14,7 +14,7 @@
|
|||
/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app
|
||||
/src/plugins/vis_type_xy/ @elastic/kibana-app
|
||||
/src/plugins/kibana_legacy/ @elastic/kibana-app
|
||||
/src/plugins/timelion/ @elastic/kibana-app
|
||||
/src/plugins/vis_type_timelion/ @elastic/kibana-app
|
||||
/src/plugins/dashboard/ @elastic/kibana-app
|
||||
/src/plugins/discover/ @elastic/kibana-app
|
||||
/src/plugins/visualize/ @elastic/kibana-app
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"src/plugins/telemetry_management_section"
|
||||
],
|
||||
"tileMap": "src/legacy/core_plugins/tile_map",
|
||||
"timelion": ["src/legacy/core_plugins/timelion", "src/legacy/core_plugins/vis_type_timelion", "src/plugins/timelion"],
|
||||
"timelion": ["src/legacy/core_plugins/timelion", "src/plugins/vis_type_timelion"],
|
||||
"uiActions": "src/plugins/ui_actions",
|
||||
"visDefaultEditor": "src/plugins/vis_default_editor",
|
||||
"visTypeMarkdown": "src/plugins/vis_type_markdown",
|
||||
|
|
|
@ -27,10 +27,11 @@ import { fatalError, toastNotifications } from 'ui/notify';
|
|||
import { timefilter } from 'ui/timefilter';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { getSavedSheetBreadcrumbs, getCreateBreadcrumbs } from './breadcrumbs';
|
||||
import { getTimezone } from '../../vis_type_timelion/public';
|
||||
import { getTimezone } from '../../../../plugins/vis_type_timelion/public';
|
||||
|
||||
import 'uiExports/savedObjectTypes';
|
||||
|
||||
require('ui/i18n');
|
||||
require('ui/autoload/all');
|
||||
|
||||
// TODO: remove ui imports completely (move to plugins)
|
||||
|
@ -57,7 +58,7 @@ require('plugins/timelion/directives/timelion_options_sheet');
|
|||
|
||||
document.title = 'Timelion - Kibana';
|
||||
|
||||
const app = require('ui/modules').get('apps/timelion', []);
|
||||
const app = require('ui/modules').get('apps/timelion', ['i18n', 'ngSanitize']);
|
||||
|
||||
require('ui/routes').enable();
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import PEG from 'pegjs';
|
||||
import grammar from 'raw-loader!../../../../../plugins/timelion/common/chain.peg';
|
||||
import grammar from 'raw-loader!../../../../../plugins/vis_type_timelion/common/chain.peg';
|
||||
import timelionExpressionInputTemplate from './timelion_expression_input.html';
|
||||
import {
|
||||
SUGGESTION_TYPE,
|
||||
|
@ -52,7 +52,7 @@ import {
|
|||
insertAtLocation,
|
||||
} from './timelion_expression_input_helpers';
|
||||
import { comboBoxKeyCodes } from '@elastic/eui';
|
||||
import { getArgValueSuggestions } from '../../../vis_type_timelion/public/helpers/arg_value_suggestions';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
|
||||
const Parser = PEG.generate(grammar);
|
||||
|
||||
|
@ -68,7 +68,7 @@ export function TimelionExpInput($http, $timeout) {
|
|||
replace: true,
|
||||
template: timelionExpressionInputTemplate,
|
||||
link: function(scope, elem) {
|
||||
const argValueSuggestions = getArgValueSuggestions();
|
||||
const argValueSuggestions = npStart.plugins.visTypeTimelion.getArgValueSuggestions();
|
||||
const expressionInput = elem.find('[data-expression-input]');
|
||||
const functionReference = {};
|
||||
let suggestibleFunctionLocation = {};
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import '../../../../vis_type_timelion/public/flot';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import '../../../../../../plugins/vis_type_timelion/public/flot';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import moment from 'moment-timezone';
|
||||
|
@ -28,11 +29,14 @@ import {
|
|||
calculateInterval,
|
||||
DEFAULT_TIME_FORMAT,
|
||||
// @ts-ignore
|
||||
} from '../../../../../../plugins/timelion/common/lib';
|
||||
import { tickFormatters } from '../../../../vis_type_timelion/public/helpers/tick_formatters';
|
||||
} from '../../../../../../plugins/vis_type_timelion/common/lib';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { tickFormatters } from '../../../../../../plugins/vis_type_timelion/public/helpers/tick_formatters';
|
||||
import { TimelionVisualizationDependencies } from '../../plugin';
|
||||
import { xaxisFormatterProvider } from '../../../../vis_type_timelion/public/helpers/xaxis_formatter';
|
||||
import { generateTicksProvider } from '../../../../vis_type_timelion/public/helpers/tick_generator';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { xaxisFormatterProvider } from '../../../../../../plugins/vis_type_timelion/public/helpers/xaxis_formatter';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
import { generateTicksProvider } from '../../../../../../plugins/vis_type_timelion/public/helpers/tick_generator';
|
||||
|
||||
const DEBOUNCE_DELAY = 50;
|
||||
|
||||
|
|
|
@ -1,44 +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 { resolve } from 'path';
|
||||
import { Legacy } from 'kibana';
|
||||
|
||||
import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types';
|
||||
|
||||
const timelionVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
|
||||
new Plugin({
|
||||
id: 'timelion_vis',
|
||||
require: ['kibana', 'elasticsearch'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
hacks: [resolve(__dirname, 'public/legacy')],
|
||||
injectDefaultVars: server => ({}),
|
||||
},
|
||||
init: (server: Legacy.Server) => ({}),
|
||||
config(Joi: any) {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
}).default();
|
||||
},
|
||||
});
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default timelionVisPluginInitializer;
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"name": "timelion_vis",
|
||||
"version": "kibana"
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
@import './panel';
|
||||
@import './timelion_expression_input';
|
|
@ -1,35 +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 { PluginInitializerContext } from 'kibana/public';
|
||||
|
||||
import { npSetup, npStart } from './legacy_imports';
|
||||
import { TimelionVisSetupDependencies } from './plugin';
|
||||
import { plugin } from '.';
|
||||
|
||||
const setupPlugins: Readonly<TimelionVisSetupDependencies> = {
|
||||
expressions: npSetup.plugins.expressions,
|
||||
data: npSetup.plugins.data,
|
||||
visualizations: npSetup.plugins.visualizations,
|
||||
};
|
||||
|
||||
const pluginInstance = plugin({} as PluginInitializerContext);
|
||||
|
||||
export const setup = pluginInstance.setup(npSetup.core, setupPlugins);
|
||||
export const start = pluginInstance.start(npStart.core, npStart.plugins);
|
|
@ -1,21 +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.
|
||||
*/
|
||||
|
||||
export { npSetup, npStart } from 'ui/new_platform';
|
||||
export { PluginsStart } from 'ui/new_platform/new_platform';
|
|
@ -69,6 +69,7 @@ import {
|
|||
VisualizationsSetup,
|
||||
VisualizationsStart,
|
||||
} from '../../../../plugins/visualizations/public';
|
||||
import { VisTypeTimelionPluginStart } from '../../../../plugins/vis_type_timelion/public';
|
||||
import { MapsLegacyPluginSetup } from '../../../../plugins/maps_legacy/public';
|
||||
|
||||
export interface PluginsSetup {
|
||||
|
@ -116,6 +117,7 @@ export interface PluginsStart {
|
|||
telemetry?: TelemetryPluginStart;
|
||||
dashboard: DashboardStart;
|
||||
savedObjectsManagement: SavedObjectsManagementPluginStart;
|
||||
visTypeTimelion: VisTypeTimelionPluginStart;
|
||||
indexPatternManagement: IndexPatternManagementStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"id": "timelion",
|
||||
"version": "8.0.0",
|
||||
"kibanaVersion": "kibana",
|
||||
"configPath": ["timelion"],
|
||||
"server": true,
|
||||
"ui": true
|
||||
}
|
|
@ -1,30 +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 { CoreStart, PluginInitializerContext } from 'kibana/public';
|
||||
import { ConfigSchema } from '../config';
|
||||
|
||||
export const plugin = (initializerContext: PluginInitializerContext<ConfigSchema>) => ({
|
||||
setup() {},
|
||||
start(core: CoreStart) {
|
||||
if (initializerContext.config.get().ui.enabled === false) {
|
||||
core.chrome.navLinks.update('timelion', { hidden: true });
|
||||
}
|
||||
},
|
||||
});
|
8
src/plugins/vis_type_timelion/kibana.json
Normal file
8
src/plugins/vis_type_timelion/kibana.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"id": "visTypeTimelion",
|
||||
"version": "8.0.0",
|
||||
"kibanaVersion": "kibana",
|
||||
"server": true,
|
||||
"ui": true,
|
||||
"requiredPlugins": ["visualizations", "data", "expressions"]
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
@import 'panel';
|
||||
@import 'timelion_expression_input';
|
|
@ -22,9 +22,9 @@ import $ from 'jquery';
|
|||
import moment from 'moment-timezone';
|
||||
import { debounce, compact, get, each, cloneDeep, last, map } from 'lodash';
|
||||
|
||||
import { useKibana } from '../../../../../plugins/kibana_react/public';
|
||||
import { useKibana } from '../../../kibana_react/public';
|
||||
import '../flot';
|
||||
import { DEFAULT_TIME_FORMAT } from '../../../../../plugins/timelion/common/lib';
|
||||
import { DEFAULT_TIME_FORMAT } from '../../common/lib';
|
||||
|
||||
import {
|
||||
buildSeriesData,
|
|
@ -22,13 +22,10 @@ import { EuiFormLabel } from '@elastic/eui';
|
|||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { monaco } from '@kbn/ui-shared-deps/monaco';
|
||||
|
||||
import { CodeEditor, useKibana } from '../../../../../plugins/kibana_react/public';
|
||||
import { CodeEditor, useKibana } from '../../../kibana_react/public';
|
||||
import { suggest, getSuggestion } from './timelion_expression_input_helpers';
|
||||
import { getArgValueSuggestions } from '../helpers/arg_value_suggestions';
|
||||
import {
|
||||
ITimelionFunction,
|
||||
TimelionFunctionArgs,
|
||||
} from '../../../../../plugins/timelion/common/types';
|
||||
import { ITimelionFunction, TimelionFunctionArgs } from '../../common/types';
|
||||
|
||||
const LANGUAGE_ID = 'timelion_expression';
|
||||
monaco.languages.register({ id: LANGUAGE_ID });
|
|
@ -22,7 +22,7 @@ import { getArgValueSuggestions } from '../helpers/arg_value_suggestions';
|
|||
import { setIndexPatterns, setSavedObjectsClient } from '../helpers/plugin_services';
|
||||
import { IndexPatternsContract } from 'src/plugins/data/public';
|
||||
import { SavedObjectsClient } from 'kibana/public';
|
||||
import { ITimelionFunction } from '../../../../../plugins/timelion/common/types';
|
||||
import { ITimelionFunction } from '../../common/types';
|
||||
|
||||
describe('Timelion expression suggestions', () => {
|
||||
setIndexPatterns({} as IndexPatternsContract);
|
|
@ -27,10 +27,7 @@ import { Parser } from 'pegjs';
|
|||
import { parse } from '../_generated_/chain';
|
||||
|
||||
import { ArgValueSuggestions, FunctionArg, Location } from '../helpers/arg_value_suggestions';
|
||||
import {
|
||||
ITimelionFunction,
|
||||
TimelionFunctionArgs,
|
||||
} from '../../../../../plugins/timelion/common/types';
|
||||
import { ITimelionFunction, TimelionFunctionArgs } from '../../common/types';
|
||||
|
||||
export enum SUGGESTION_TYPE {
|
||||
ARGUMENTS = 'arguments',
|
|
@ -21,9 +21,9 @@ import React, { useMemo, useCallback } from 'react';
|
|||
import { EuiFormRow, EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { search } from '../../../../../plugins/data/public';
|
||||
import { search } from '../../../data/public';
|
||||
const { isValidEsInterval } = search.aggs;
|
||||
import { useValidation } from '../../../../../plugins/vis_default_editor/public';
|
||||
import { useValidation } from '../../../vis_default_editor/public';
|
||||
|
||||
const intervalOptions = [
|
||||
{
|
|
@ -23,7 +23,7 @@ import { IUiSettingsClient } from 'kibana/public';
|
|||
import { ChartComponent } from './chart';
|
||||
import { VisParams } from '../timelion_vis_fn';
|
||||
import { TimelionSuccessResponse } from '../helpers/timelion_request_handler';
|
||||
import { ExprVis } from '../../../../../plugins/visualizations/public';
|
||||
import { ExprVis } from '../../../visualizations/public';
|
||||
|
||||
export interface TimelionVisComponentProp {
|
||||
config: IUiSettingsClient;
|
|
@ -17,10 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
require('jquery.flot');
|
||||
require('jquery.flot.time');
|
||||
require('jquery.flot.symbol');
|
||||
require('jquery.flot.crosshair');
|
||||
require('jquery.flot.selection');
|
||||
require('jquery.flot.stack');
|
||||
require('jquery.flot.axislabels');
|
||||
import './webpackShims/jquery.flot';
|
||||
import './webpackShims/jquery.flot.time';
|
||||
import './webpackShims/jquery.flot.symbol';
|
||||
import './webpackShims/jquery.flot.crosshair';
|
||||
import './webpackShims/jquery.flot.selection';
|
||||
import './webpackShims/jquery.flot.stack';
|
||||
import './webpackShims/jquery.flot.axislabels';
|
|
@ -19,11 +19,8 @@
|
|||
|
||||
import { get } from 'lodash';
|
||||
import { getIndexPatterns, getSavedObjectsClient } from './plugin_services';
|
||||
import { TimelionFunctionArgs } from '../../../../../plugins/timelion/common/types';
|
||||
import {
|
||||
indexPatterns as indexPatternsUtils,
|
||||
IndexPatternAttributes,
|
||||
} from '../../../../../plugins/data/public';
|
||||
import { TimelionFunctionArgs } from '../../common/types';
|
||||
import { indexPatterns as indexPatternsUtils, IndexPatternAttributes } from '../../../data/public';
|
||||
|
||||
export interface Location {
|
||||
min: number;
|
|
@ -23,7 +23,7 @@ import moment, { Moment } from 'moment-timezone';
|
|||
import { TimefilterContract } from 'src/plugins/data/public';
|
||||
import { IUiSettingsClient } from 'kibana/public';
|
||||
|
||||
import { calculateInterval } from '../../../../../plugins/timelion/common/lib';
|
||||
import { calculateInterval } from '../../common/lib';
|
||||
import { xaxisFormatterProvider } from './xaxis_formatter';
|
||||
import { Series } from './timelion_request_handler';
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { IndexPatternsContract } from 'src/plugins/data/public';
|
||||
import { SavedObjectsClientContract } from 'kibana/public';
|
||||
import { createGetterSetter } from '../../../../../plugins/kibana_utils/public';
|
||||
import { createGetterSetter } from '../../../kibana_utils/public';
|
||||
|
||||
export const [getIndexPatterns, setIndexPatterns] = createGetterSetter<IndexPatternsContract>(
|
||||
'IndexPatterns'
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { KIBANA_CONTEXT_NAME } from 'src/plugins/expressions/public';
|
||||
import { VisParams } from '../../../../../plugins/visualizations/public';
|
||||
import { TimeRange, Filter, esQuery, Query } from '../../../../../plugins/data/public';
|
||||
import { VisParams } from '../../../visualizations/public';
|
||||
import { TimeRange, Filter, esQuery, Query } from '../../../data/public';
|
||||
import { TimelionVisDependencies } from '../plugin';
|
||||
import { getTimezone } from './get_timezone';
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
@import 'src/legacy/ui/public/styles/styling_constants';
|
||||
|
||||
@import './timelion_vis';
|
||||
@import './timelion_editor';
|
||||
@import './components/index';
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from '../../../../core/public';
|
||||
import { PluginInitializerContext } from 'kibana/public';
|
||||
import { TimelionVisPlugin as Plugin } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
@ -25,3 +25,5 @@ export function plugin(initializerContext: PluginInitializerContext) {
|
|||
}
|
||||
|
||||
export { getTimezone } from './helpers/get_timezone';
|
||||
|
||||
export { VisTypeTimelionPluginStart } from './plugin';
|
|
@ -26,16 +26,21 @@ import {
|
|||
HttpSetup,
|
||||
} from 'kibana/public';
|
||||
import { Plugin as ExpressionsPlugin } from 'src/plugins/expressions/public';
|
||||
import { DataPublicPluginSetup, TimefilterContract } from 'src/plugins/data/public';
|
||||
import {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
TimefilterContract,
|
||||
} from 'src/plugins/data/public';
|
||||
|
||||
import { PluginsStart } from './legacy_imports';
|
||||
import { VisualizationsSetup } from '../../../../plugins/visualizations/public';
|
||||
import { VisualizationsSetup } from '../../visualizations/public';
|
||||
|
||||
import { getTimelionVisualizationConfig } from './timelion_vis_fn';
|
||||
import { getTimelionVisDefinition } from './timelion_vis_type';
|
||||
import { setIndexPatterns, setSavedObjectsClient } from './helpers/plugin_services';
|
||||
import { ConfigSchema } from '../config';
|
||||
|
||||
type TimelionVisCoreSetup = CoreSetup<TimelionVisSetupDependencies, void>;
|
||||
import './index.scss';
|
||||
import { getArgValueSuggestions } from './helpers/arg_value_suggestions';
|
||||
|
||||
/** @internal */
|
||||
export interface TimelionVisDependencies extends Partial<CoreStart> {
|
||||
|
@ -52,11 +57,28 @@ export interface TimelionVisSetupDependencies {
|
|||
}
|
||||
|
||||
/** @internal */
|
||||
export class TimelionVisPlugin implements Plugin<void, void> {
|
||||
constructor(public initializerContext: PluginInitializerContext) {}
|
||||
export interface TimelionVisStartDependencies {
|
||||
data: DataPublicPluginStart;
|
||||
}
|
||||
|
||||
public async setup(
|
||||
core: TimelionVisCoreSetup,
|
||||
/** @public */
|
||||
export interface VisTypeTimelionPluginStart {
|
||||
getArgValueSuggestions: typeof getArgValueSuggestions;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export class TimelionVisPlugin
|
||||
implements
|
||||
Plugin<
|
||||
void,
|
||||
VisTypeTimelionPluginStart,
|
||||
TimelionVisSetupDependencies,
|
||||
TimelionVisStartDependencies
|
||||
> {
|
||||
constructor(public initializerContext: PluginInitializerContext<ConfigSchema>) {}
|
||||
|
||||
public setup(
|
||||
core: CoreSetup,
|
||||
{ expressions, visualizations, data }: TimelionVisSetupDependencies
|
||||
) {
|
||||
const dependencies: TimelionVisDependencies = {
|
||||
|
@ -69,8 +91,15 @@ export class TimelionVisPlugin implements Plugin<void, void> {
|
|||
visualizations.createReactVisualization(getTimelionVisDefinition(dependencies));
|
||||
}
|
||||
|
||||
public start(core: CoreStart, plugins: PluginsStart) {
|
||||
public start(core: CoreStart, plugins: TimelionVisStartDependencies) {
|
||||
setIndexPatterns(plugins.data.indexPatterns);
|
||||
setSavedObjectsClient(core.savedObjects.client);
|
||||
if (this.initializerContext.config.get().ui.enabled === false) {
|
||||
core.chrome.navLinks.update('timelion', { hidden: true });
|
||||
}
|
||||
|
||||
return {
|
||||
getArgValueSuggestions,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -20,8 +20,8 @@
|
|||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { KibanaContextProvider } from '../../../../plugins/kibana_react/public';
|
||||
import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public';
|
||||
import { KibanaContextProvider } from '../../kibana_react/public';
|
||||
import { DefaultEditorSize } from '../../vis_default_editor/public';
|
||||
import { getTimelionRequestHandler } from './helpers/timelion_request_handler';
|
||||
import { TimelionVisComponent, TimelionVisComponentProp } from './components';
|
||||
import { TimelionOptions, TimelionOptionsProps } from './timelion_options';
|
|
@ -17,19 +17,23 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from '../../../../src/core/server';
|
||||
import { configSchema } from '../config';
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server';
|
||||
import { configSchema, ConfigSchema } from '../config';
|
||||
import { Plugin } from './plugin';
|
||||
|
||||
export { PluginSetupContract } from './plugin';
|
||||
|
||||
export const config = {
|
||||
export const config: PluginConfigDescriptor<ConfigSchema> = {
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
ui: {
|
||||
enabled: true,
|
||||
},
|
||||
ui: true,
|
||||
},
|
||||
deprecations: ({ renameFromRoot }) => [
|
||||
renameFromRoot('timelion_vis.enabled', 'vis_type_timelion.enabled'),
|
||||
renameFromRoot('timelion.enabled', 'vis_type_timelion.enabled'),
|
||||
renameFromRoot('timelion.graphiteUrls', 'vis_type_timelion.graphiteUrls'),
|
||||
renameFromRoot('timelion.ui.enabled', 'vis_type_timelion.ui.enabled'),
|
||||
],
|
||||
};
|
||||
export const plugin = (initializerContext: PluginInitializerContext) =>
|
||||
new Plugin(initializerContext);
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
const fn = require(`src/plugins/timelion/server/lib/load_functions`);
|
||||
const fn = require(`src/plugins/vis_type_timelion/server/lib/load_functions`);
|
||||
|
||||
const expect = require('chai').expect;
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue