Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[7.x] Migrate timelion vis (#62819) #63826

Merged
merged 3 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/legacy/core_plugins/timelion/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Expand All @@ -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 = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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;

Expand Down
44 changes: 0 additions & 44 deletions src/legacy/core_plugins/vis_type_timelion/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/legacy/core_plugins/vis_type_timelion/package.json

This file was deleted.

This file was deleted.

35 changes: 0 additions & 35 deletions src/legacy/core_plugins/vis_type_timelion/public/legacy.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/legacy/core_plugins/vis_type_timelion/public/legacy_imports.ts

This file was deleted.

2 changes: 2 additions & 0 deletions src/legacy/ui/public/new_platform/new_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -116,6 +117,7 @@ export interface PluginsStart {
telemetry?: TelemetryPluginStart;
dashboard: DashboardStart;
savedObjectsManagement: SavedObjectsManagementPluginStart;
visTypeTimelion: VisTypeTimelionPluginStart;
indexPatternManagement: IndexPatternManagementStart;
}

Expand Down
8 changes: 0 additions & 8 deletions src/plugins/timelion/kibana.json

This file was deleted.

30 changes: 0 additions & 30 deletions src/plugins/timelion/public/index.ts

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions src/plugins/vis_type_timelion/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "visTypeTimelion",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["visualizations", "data", "expressions"]
}
2 changes: 2 additions & 0 deletions src/plugins/vis_type_timelion/public/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import 'panel';
@import 'timelion_expression_input';
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Loading