Move Lens frontend to Kibana Platform (#62965)
* Move Lens frontend to Kibana platform * Fix line breaks * Fix jest tests * Fix remaining test * Remove old Lens plugin entry * Fix i18n prefix * Add config schema * Address review
|
@ -109,7 +109,7 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/lens/**/*.{js,ts,tsx}'],
|
||||
files: ['x-pack/plugins/lens/**/*.{js,ts,tsx}'],
|
||||
rules: {
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
'react-hooks/rules-of-hooks': 'off',
|
||||
|
@ -728,7 +728,7 @@ module.exports = {
|
|||
* Lens overrides
|
||||
*/
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/lens/**/*.{ts,tsx}', 'x-pack/plugins/lens/**/*.{ts,tsx}'],
|
||||
files: ['x-pack/plugins/lens/**/*.{ts,tsx}'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
},
|
||||
|
|
2
.github/CODEOWNERS
vendored
|
@ -3,7 +3,7 @@
|
|||
# For more info, see https://help.github.com/articles/about-codeowners/
|
||||
|
||||
# App
|
||||
/x-pack/legacy/plugins/lens/ @elastic/kibana-app
|
||||
/x-pack/plugins/lens/ @elastic/kibana-app
|
||||
/x-pack/legacy/plugins/graph/ @elastic/kibana-app
|
||||
/src/legacy/server/url_shortening/ @elastic/kibana-app
|
||||
/src/legacy/server/sample_data/ @elastic/kibana-app
|
||||
|
|
|
@ -8,9 +8,9 @@ files:
|
|||
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/triggers_actions_ui/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/lens/**/*.s+(a|c)ss'
|
||||
ignore:
|
||||
- 'x-pack/legacy/plugins/canvas/shareable_runtime/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/lens/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/maps/**/*.s+(a|c)ss'
|
||||
rules:
|
||||
quotes:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"xpack.indexLifecycleMgmt": "plugins/index_lifecycle_management",
|
||||
"xpack.infra": "plugins/infra",
|
||||
"xpack.ingestManager": "plugins/ingest_manager",
|
||||
"xpack.lens": "legacy/plugins/lens",
|
||||
"xpack.lens": "plugins/lens",
|
||||
"xpack.licenseMgmt": "plugins/license_management",
|
||||
"xpack.licensing": "plugins/licensing",
|
||||
"xpack.logstash": ["plugins/logstash", "legacy/plugins/logstash"],
|
||||
|
|
|
@ -29,7 +29,6 @@ import { uptime } from './legacy/plugins/uptime';
|
|||
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
|
||||
import { actions } from './legacy/plugins/actions';
|
||||
import { alerting } from './legacy/plugins/alerting';
|
||||
import { lens } from './legacy/plugins/lens';
|
||||
import { ingestManager } from './legacy/plugins/ingest_manager';
|
||||
import { triggersActionsUI } from './legacy/plugins/triggers_actions_ui';
|
||||
|
||||
|
@ -58,7 +57,6 @@ module.exports = function(kibana) {
|
|||
upgradeAssistant(kibana),
|
||||
uptime(kibana),
|
||||
encryptedSavedObjects(kibana),
|
||||
lens(kibana),
|
||||
actions(kibana),
|
||||
alerting(kibana),
|
||||
ingestManager(kibana),
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import * as Joi from 'joi';
|
||||
import { resolve } from 'path';
|
||||
import { LegacyPluginInitializer } from 'src/legacy/types';
|
||||
import { PLUGIN_ID, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../../../plugins/lens/common';
|
||||
|
||||
export const lens: LegacyPluginInitializer = kibana => {
|
||||
return new kibana.Plugin({
|
||||
id: PLUGIN_ID,
|
||||
configPrefix: `xpack.${PLUGIN_ID}`,
|
||||
// task_manager could be required, but is only used for telemetry
|
||||
require: ['kibana', 'elasticsearch', 'xpack_main', 'interpreter'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
|
||||
uiExports: {
|
||||
app: {
|
||||
title: NOT_INTERNATIONALIZED_PRODUCT_NAME,
|
||||
description: 'Explore and visualize data.',
|
||||
main: `plugins/${PLUGIN_ID}/redirect`,
|
||||
listed: false,
|
||||
},
|
||||
visualize: [`plugins/${PLUGIN_ID}/legacy`],
|
||||
embeddableFactories: [`plugins/${PLUGIN_ID}/legacy`],
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
},
|
||||
|
||||
config: () => {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
}).default();
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
@import './app';
|
|
@ -1 +0,0 @@
|
|||
@import './visualization';
|
|
@ -1 +0,0 @@
|
|||
@import './drag_drop'
|
|
@ -1 +0,0 @@
|
|||
@import './editor_frame/index';
|
|
@ -1,8 +0,0 @@
|
|||
@import './chart_switch';
|
||||
@import './config_panel_wrapper';
|
||||
@import './data_panel_wrapper';
|
||||
@import './expression_renderer';
|
||||
@import './frame_layout';
|
||||
@import './suggestion_panel';
|
||||
@import './workspace_panel_wrapper';
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
@import './datapanel';
|
||||
@import './field_item';
|
||||
|
||||
@import './dimension_panel/index';
|
|
@ -1,2 +0,0 @@
|
|||
@import './field_select';
|
||||
@import './popover';
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { npSetup, npStart } from 'ui/new_platform';
|
||||
|
||||
export * from './types';
|
||||
|
||||
import { plugin } from './index';
|
||||
|
||||
const pluginInstance = plugin();
|
||||
pluginInstance.setup(npSetup.core, {
|
||||
...npSetup.plugins,
|
||||
});
|
||||
pluginInstance.start(npStart.core, npStart.plugins);
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
// This file redirects lens urls starting with app/lens#... to their counterpart on app/kibana#lens/... to
|
||||
// make sure it's compatible with the 7.5 release
|
||||
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
import chrome from 'ui/chrome';
|
||||
|
||||
chrome.setRootController('lens', () => {
|
||||
// prefix the path in the hash with lens/
|
||||
const prefixedHashRoute = window.location.hash.replace(/^#\//, '#/lens/');
|
||||
|
||||
// redirect to the new lens url `app/kibana#/lens/...`
|
||||
window.location.href = npSetup.core.http.basePath.prepend('/app/kibana' + prefixedHashRoute);
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
@import './_xy_expression';
|
13
x-pack/plugins/lens/config.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
|
||||
export type ConfigSchema = TypeOf<typeof configSchema>;
|
|
@ -3,7 +3,15 @@
|
|||
"version": "8.0.0",
|
||||
"kibanaVersion": "kibana",
|
||||
"server": true,
|
||||
"ui": false,
|
||||
"optionalPlugins": ["usageCollection", "taskManager"],
|
||||
"ui": true,
|
||||
"requiredPlugins": [
|
||||
"data",
|
||||
"expressions",
|
||||
"navigation",
|
||||
"kibanaLegacy",
|
||||
"uiActions",
|
||||
"visualizations"
|
||||
],
|
||||
"optionalPlugins": ["embeddable", "usageCollection", "taskManager"],
|
||||
"configPath": ["xpack", "lens"]
|
||||
}
|
||||
|
|
1
x-pack/plugins/lens/public/app_plugin/_index.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@import 'app';
|
|
@ -9,7 +9,7 @@ import { ReactWrapper } from 'enzyme';
|
|||
import { act } from 'react-dom/test-utils';
|
||||
import { App } from './app';
|
||||
import { EditorFrameInstance } from '../types';
|
||||
import { Storage } from '../../../../../../src/plugins/kibana_utils/public';
|
||||
import { Storage } from '../../../../../src/plugins/kibana_utils/public';
|
||||
import { Document, SavedObjectStore } from '../persistence';
|
||||
import { mount } from 'enzyme';
|
||||
import {
|
||||
|
@ -17,25 +17,24 @@ import {
|
|||
FilterManager,
|
||||
IFieldType,
|
||||
IIndexPattern,
|
||||
} from '../../../../../../src/plugins/data/public';
|
||||
import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks';
|
||||
} from '../../../../../src/plugins/data/public';
|
||||
import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks';
|
||||
const dataStartMock = dataPluginMock.createStartContract();
|
||||
|
||||
import { TopNavMenuData } from '../../../../../../src/plugins/navigation/public';
|
||||
import { navigationPluginMock } from '../../../../../src/plugins/navigation/public/mocks';
|
||||
import { TopNavMenuData } from '../../../../../src/plugins/navigation/public';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
|
||||
jest.mock('ui/new_platform');
|
||||
jest.mock('../persistence');
|
||||
jest.mock('src/core/public');
|
||||
|
||||
import { npStart } from 'ui/new_platform';
|
||||
jest
|
||||
.spyOn(npStart.plugins.navigation.ui.TopNavMenu.prototype, 'constructor')
|
||||
.mockImplementation(() => {
|
||||
return <div className="topNavMenu" />;
|
||||
});
|
||||
const navigationStartMock = navigationPluginMock.createStartContract();
|
||||
|
||||
const { TopNavMenu } = npStart.plugins.navigation.ui;
|
||||
jest.spyOn(navigationStartMock.ui.TopNavMenu.prototype, 'constructor').mockImplementation(() => {
|
||||
return <div className="topNavMenu" />;
|
||||
});
|
||||
|
||||
const { TopNavMenu } = navigationStartMock.ui;
|
||||
|
||||
function createMockFrame(): jest.Mocked<EditorFrameInstance> {
|
||||
return {
|
||||
|
@ -99,6 +98,7 @@ describe('Lens App', () => {
|
|||
function makeDefaultArgs(): jest.Mocked<{
|
||||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
navigation: typeof navigationStartMock;
|
||||
core: typeof core;
|
||||
storage: Storage;
|
||||
docId?: string;
|
||||
|
@ -107,6 +107,7 @@ describe('Lens App', () => {
|
|||
addToDashboardMode?: boolean;
|
||||
}> {
|
||||
return ({
|
||||
navigation: navigationStartMock,
|
||||
editorFrame: createMockFrame(),
|
||||
core: {
|
||||
...core,
|
||||
|
@ -140,6 +141,7 @@ describe('Lens App', () => {
|
|||
},
|
||||
redirectTo: jest.fn(id => {}),
|
||||
} as unknown) as jest.Mocked<{
|
||||
navigation: typeof navigationStartMock;
|
||||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
|
@ -338,6 +340,7 @@ describe('Lens App', () => {
|
|||
|
||||
let defaultArgs: jest.Mocked<{
|
||||
editorFrame: EditorFrameInstance;
|
||||
navigation: typeof navigationStartMock;
|
||||
data: typeof dataStartMock;
|
||||
core: typeof core;
|
||||
storage: Storage;
|
||||
|
@ -654,6 +657,7 @@ describe('Lens App', () => {
|
|||
let defaultArgs: jest.Mocked<{
|
||||
editorFrame: EditorFrameInstance;
|
||||
data: typeof dataStartMock;
|
||||
navigation: typeof navigationStartMock;
|
||||
core: typeof core;
|
||||
storage: Storage;
|
||||
docId?: string;
|
|
@ -9,12 +9,12 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { Query, DataPublicPluginStart } from 'src/plugins/data/public';
|
||||
import { AppMountContext, NotificationsStart } from 'src/core/public';
|
||||
import { NavigationPublicPluginStart } from 'src/plugins/navigation/public';
|
||||
import { AppMountContext, NotificationsStart } from 'kibana/public';
|
||||
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
|
||||
import { SavedObjectSaveModal } from '../../../../../../src/plugins/saved_objects/public';
|
||||
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
|
||||
import { SavedObjectSaveModal } from '../../../../../src/plugins/saved_objects/public';
|
||||
import { Document, SavedObjectStore } from '../persistence';
|
||||
import { EditorFrameInstance } from '../types';
|
||||
import { NativeRenderer } from '../native_renderer';
|
||||
|
@ -25,7 +25,7 @@ import {
|
|||
IndexPattern as IndexPatternInstance,
|
||||
IndexPatternsContract,
|
||||
SavedQuery,
|
||||
} from '../../../../../../src/plugins/data/public';
|
||||
} from '../../../../../src/plugins/data/public';
|
||||
|
||||
interface State {
|
||||
isLoading: boolean;
|
||||
|
@ -53,9 +53,11 @@ export function App({
|
|||
docStorage,
|
||||
redirectTo,
|
||||
addToDashboardMode,
|
||||
navigation,
|
||||
}: {
|
||||
editorFrame: EditorFrameInstance;
|
||||
data: DataPublicPluginStart;
|
||||
navigation: NavigationPublicPluginStart;
|
||||
core: AppMountContext['core'];
|
||||
storage: IStorageWrapper;
|
||||
docId?: string;
|
||||
|
@ -188,7 +190,7 @@ export function App({
|
|||
[]
|
||||
);
|
||||
|
||||
const { TopNavMenu } = npStart.plugins.navigation.ui;
|
||||
const { TopNavMenu } = navigation.ui;
|
||||
|
||||
const confirmButton = addToDashboardMode ? (
|
||||
<FormattedMessage
|
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 816 B After Width: | Height: | Size: 816 B |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 868 B After Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 950 B After Width: | Height: | Size: 950 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
|
@ -0,0 +1 @@
|
|||
@import 'visualization';
|
|
@ -13,7 +13,7 @@ import {
|
|||
ExpressionFunctionDefinition,
|
||||
ExpressionRenderDefinition,
|
||||
IInterpreterRenderHandlers,
|
||||
} from '../../../../../../src/plugins/expressions/public';
|
||||
} from '../../../../../src/plugins/expressions/public';
|
||||
import { VisualizationContainer } from '../visualization_container';
|
||||
|
||||
export interface DatatableColumns {
|
|
@ -4,9 +4,9 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { CoreSetup } from 'src/core/public';
|
||||
import { CoreSetup } from 'kibana/public';
|
||||
import { datatableVisualization } from './visualization';
|
||||
import { ExpressionsSetup } from '../../../../../../src/plugins/expressions/public';
|
||||
import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public';
|
||||
import { datatable, datatableColumns, getDatatableRenderer } from './expression';
|
||||
import { EditorFrameSetup, FormatFactory } from '../types';
|
||||
|
1
x-pack/plugins/lens/public/drag_drop/_index.scss
Normal file
|
@ -0,0 +1 @@
|
|||
@import 'drag_drop';
|
|
@ -0,0 +1 @@
|
|||
@import 'editor_frame/index';
|
|
@ -7,12 +7,11 @@
|
|||
import React, { useMemo, memo, useContext, useState } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiPopover, EuiButtonIcon, EuiContextMenuPanel, EuiContextMenuItem } from '@elastic/eui';
|
||||
import { DatasourceDataPanelProps, Datasource } from '../../../public';
|
||||
import { NativeRenderer } from '../../native_renderer';
|
||||
import { Action } from './state_management';
|
||||
import { DragContext } from '../../drag_drop';
|
||||
import { StateSetter, FramePublicAPI } from '../../types';
|
||||
import { Query, Filter } from '../../../../../../../src/plugins/data/public';
|
||||
import { StateSetter, FramePublicAPI, DatasourceDataPanelProps, Datasource } from '../../types';
|
||||
import { Query, Filter } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
interface DataPanelWrapperProps {
|
||||
datasourceState: unknown;
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
import React, { useEffect, useReducer } from 'react';
|
||||
import { CoreSetup, CoreStart } from 'src/core/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { CoreSetup, CoreStart } from 'kibana/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import {
|
||||
Datasource,
|
||||
DatasourcePublicAPI,
|
||||
|
@ -25,7 +25,7 @@ import { RootDragDropProvider } from '../../drag_drop';
|
|||
import { getSavedObjectFormat } from './save';
|
||||
import { WorkspacePanelWrapper } from './workspace_panel_wrapper';
|
||||
import { generateId } from '../../id_generator';
|
||||
import { Filter, Query, SavedQuery } from '../../../../../../../src/plugins/data/public';
|
||||
import { Filter, Query, SavedQuery } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
export interface EditorFrameProps {
|
||||
doc?: Document;
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { Ast, fromExpression, ExpressionFunctionAST } from '@kbn/interpreter/common';
|
||||
import { Visualization, Datasource, FramePublicAPI } from '../../types';
|
||||
import { Filter, TimeRange, Query } from '../../../../../../../src/plugins/data/public';
|
||||
import { Filter, TimeRange, Query } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
export function prependDatasourceExpression(
|
||||
visualizationExpression: Ast | string | null,
|
|
@ -0,0 +1,8 @@
|
|||
@import 'chart_switch';
|
||||
@import 'config_panel_wrapper';
|
||||
@import 'data_panel_wrapper';
|
||||
@import 'expression_renderer';
|
||||
@import 'frame_layout';
|
||||
@import 'suggestion_panel';
|
||||
@import 'workspace_panel_wrapper';
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { getSavedObjectFormat, Props } from './save';
|
||||
import { createMockDatasource, createMockVisualization } from '../mocks';
|
||||
import { esFilters, IIndexPattern, IFieldType } from '../../../../../../../src/plugins/data/public';
|
||||
import { esFilters, IIndexPattern, IFieldType } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
describe('save editor frame state', () => {
|
||||
const mockVisualization = createMockVisualization();
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { getInitialState, reducer } from './state_management';
|
||||
import { EditorFrameProps } from '.';
|
||||
import { EditorFrameProps } from './index';
|
||||
import { Datasource, Visualization } from '../../types';
|
||||
import { createExpressionRendererMock } from '../mocks';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { EditorFrameProps } from '../editor_frame';
|
||||
import { EditorFrameProps } from './index';
|
||||
import { Document } from '../../persistence/saved_object_store';
|
||||
|
||||
export interface PreviewState {
|
|
@ -15,8 +15,8 @@ import {
|
|||
createMockFramePublicAPI,
|
||||
} from '../mocks';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { esFilters, IFieldType, IIndexPattern } from '../../../../../../../src/plugins/data/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import { esFilters, IFieldType, IIndexPattern } from '../../../../../../src/plugins/data/public';
|
||||
import { SuggestionPanel, SuggestionPanelProps } from './suggestion_panel';
|
||||
import { getSuggestions, Suggestion } from './suggestion_helpers';
|
||||
import { EuiIcon, EuiPanel, EuiToolTip } from '@elastic/eui';
|
|
@ -24,7 +24,7 @@ import classNames from 'classnames';
|
|||
import { Action, PreviewState } from './state_management';
|
||||
import { Datasource, Visualization, FramePublicAPI, DatasourcePublicAPI } from '../../types';
|
||||
import { getSuggestions, switchToSuggestion } from './suggestion_helpers';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import { prependDatasourceExpression, prependKibanaContext } from './expression_helpers';
|
||||
import { debouncedComponent } from '../../debounced_component';
|
||||
import { trackUiEvent, trackSuggestionEvent } from '../../lens_ui_telemetry';
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { ReactExpressionRendererProps } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { ReactExpressionRendererProps } from '../../../../../../src/plugins/expressions/public';
|
||||
import { FramePublicAPI, TableSuggestion, Visualization } from '../../types';
|
||||
import {
|
||||
createMockVisualization,
|
||||
|
@ -21,7 +21,7 @@ import { ReactWrapper } from 'enzyme';
|
|||
import { DragDrop, ChildDragDropProvider } from '../../drag_drop';
|
||||
import { Ast } from '@kbn/interpreter/common';
|
||||
import { coreMock } from 'src/core/public/mocks';
|
||||
import { esFilters, IFieldType, IIndexPattern } from '../../../../../../../src/plugins/data/public';
|
||||
import { esFilters, IFieldType, IIndexPattern } from '../../../../../../src/plugins/data/public';
|
||||
|
||||
describe('workspace_panel', () => {
|
||||
let mockVisualization: jest.Mocked<Visualization>;
|
|
@ -16,8 +16,8 @@ import {
|
|||
EuiBetaBadge,
|
||||
EuiButtonEmpty,
|
||||
} from '@elastic/eui';
|
||||
import { CoreStart, CoreSetup } from 'src/core/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { CoreStart, CoreSetup } from 'kibana/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import { Action } from './state_management';
|
||||
import { Datasource, Visualization, FramePublicAPI } from '../../types';
|
||||
import { DragDrop, DragContext } from '../../drag_drop';
|
|
@ -9,9 +9,9 @@ import { Embeddable } from './embeddable';
|
|||
import { ReactExpressionRendererProps } from 'src/plugins/expressions/public';
|
||||
import { Query, TimeRange, Filter, TimefilterContract } from 'src/plugins/data/public';
|
||||
import { Document } from '../../persistence';
|
||||
import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks';
|
||||
import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks';
|
||||
|
||||
jest.mock('../../../../../../../src/plugins/inspector/public/', () => ({
|
||||
jest.mock('../../../../../../src/plugins/inspector/public/', () => ({
|
||||
isAvailable: false,
|
||||
open: false,
|
||||
}));
|
|
@ -16,15 +16,15 @@ import {
|
|||
} from 'src/plugins/data/public';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
import { VIS_EVENT_TO_TRIGGER } from '../../../../../../../src/plugins/visualizations/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import { VIS_EVENT_TO_TRIGGER } from '../../../../../../src/plugins/visualizations/public';
|
||||
|
||||
import {
|
||||
Embeddable as AbstractEmbeddable,
|
||||
EmbeddableOutput,
|
||||
IContainer,
|
||||
EmbeddableInput,
|
||||
} from '../../../../../../../src/plugins/embeddable/public';
|
||||
} from '../../../../../../src/plugins/embeddable/public';
|
||||
import { Document, DOC_TYPE } from '../../persistence';
|
||||
import { ExpressionWrapper } from './expression_wrapper';
|
||||
|
|
@ -15,17 +15,17 @@ import {
|
|||
IndexPatternsContract,
|
||||
IndexPattern,
|
||||
TimefilterContract,
|
||||
} from '../../../../../../../src/plugins/data/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public';
|
||||
} from '../../../../../../src/plugins/data/public';
|
||||
import { ReactExpressionRendererType } from '../../../../../../src/plugins/expressions/public';
|
||||
import {
|
||||
EmbeddableFactoryDefinition,
|
||||
ErrorEmbeddable,
|
||||
EmbeddableInput,
|
||||
IContainer,
|
||||
} from '../../../../../../../src/plugins/embeddable/public';
|
||||
} from '../../../../../../src/plugins/embeddable/public';
|
||||
import { Embeddable } from './embeddable';
|
||||
import { SavedObjectIndexStore, DOC_TYPE } from '../../persistence';
|
||||
import { getEditPath } from '../../../../../../plugins/lens/common';
|
||||
import { getEditPath } from '../../../common';
|
||||
|
||||
interface StartServices {
|
||||
timefilter: TimefilterContract;
|
|
@ -8,8 +8,6 @@ import moment from 'moment';
|
|||
import { mergeTables } from './merge_tables';
|
||||
import { KibanaDatatable } from 'src/plugins/expressions';
|
||||
|
||||
jest.mock('ui/new_platform');
|
||||
|
||||
describe('lens_merge_tables', () => {
|
||||
it('should produce a row with the nested table as defined', () => {
|
||||
const sampleTable1: KibanaDatatable = {
|
|
@ -10,7 +10,7 @@ import {
|
|||
ExpressionValueSearchContext,
|
||||
KibanaDatatable,
|
||||
} from 'src/plugins/expressions/public';
|
||||
import { search } from '../../../../../../src/plugins/data/public';
|
||||
import { search } from '../../../../../src/plugins/data/public';
|
||||
const { toAbsoluteDates } = search.aggs;
|
||||
|
||||
import { LensMultiTable } from '../types';
|
|
@ -9,12 +9,12 @@ import {
|
|||
ReactExpressionRendererProps,
|
||||
ExpressionsSetup,
|
||||
ExpressionsStart,
|
||||
} from '../../../../../../src/plugins/expressions/public';
|
||||
import { embeddablePluginMock } from '../../../../../../src/plugins/embeddable/public/mocks';
|
||||
import { expressionsPluginMock } from '../../../../../../src/plugins/expressions/public/mocks';
|
||||
} from '../../../../../src/plugins/expressions/public';
|
||||
import { embeddablePluginMock } from '../../../../../src/plugins/embeddable/public/mocks';
|
||||
import { expressionsPluginMock } from '../../../../../src/plugins/expressions/public/mocks';
|
||||
import { DatasourcePublicAPI, FramePublicAPI, Datasource, Visualization } from '../types';
|
||||
import { EditorFrameSetupPlugins, EditorFrameStartPlugins } from './service';
|
||||
import { dataPluginMock } from '../../../../../../src/plugins/data/public/mocks';
|
||||
import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks';
|
||||
|
||||
export function createMockVisualization(): jest.Mocked<Visualization> {
|
||||
return {
|
|
@ -14,8 +14,6 @@ import {
|
|||
} from './mocks';
|
||||
import { CoreSetup } from 'kibana/public';
|
||||
|
||||
jest.mock('ui/new_platform');
|
||||
|
||||
// mock away actual dependencies to prevent all of it being loaded
|
||||
jest.mock('./embeddable/embeddable_factory', () => ({
|
||||
EmbeddableFactory: class Mock {},
|
|
@ -7,16 +7,13 @@
|
|||
import React from 'react';
|
||||
import { render, unmountComponentAtNode } from 'react-dom';
|
||||
import { I18nProvider } from '@kbn/i18n/react';
|
||||
import { CoreSetup, CoreStart } from 'src/core/public';
|
||||
import {
|
||||
ExpressionsSetup,
|
||||
ExpressionsStart,
|
||||
} from '../../../../../../src/plugins/expressions/public';
|
||||
import { EmbeddableSetup, EmbeddableStart } from '../../../../../../src/plugins/embeddable/public';
|
||||
import { CoreSetup, CoreStart } from 'kibana/public';
|
||||
import { ExpressionsSetup, ExpressionsStart } from '../../../../../src/plugins/expressions/public';
|
||||
import { EmbeddableSetup, EmbeddableStart } from '../../../../../src/plugins/embeddable/public';
|
||||
import {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
} from '../../../../../../src/plugins/data/public';
|
||||
} from '../../../../../src/plugins/data/public';
|
||||
import {
|
||||
Datasource,
|
||||
Visualization,
|
||||
|
@ -32,13 +29,13 @@ import { getActiveDatasourceIdFromDoc } from './editor_frame/state_management';
|
|||
|
||||
export interface EditorFrameSetupPlugins {
|
||||
data: DataPublicPluginSetup;
|
||||
embeddable: EmbeddableSetup;
|
||||
embeddable?: EmbeddableSetup;
|
||||
expressions: ExpressionsSetup;
|
||||
}
|
||||
|
||||
export interface EditorFrameStartPlugins {
|
||||
data: DataPublicPluginStart;
|
||||
embeddable: EmbeddableStart;
|
||||
embeddable?: EmbeddableStart;
|
||||
expressions: ExpressionsStart;
|
||||
}
|
||||
|
||||
|
@ -79,7 +76,9 @@ export class EditorFrameService {
|
|||
};
|
||||
};
|
||||
|
||||
plugins.embeddable.registerEmbeddableFactory('lens', new EmbeddableFactory(getStartServices));
|
||||
if (plugins.embeddable) {
|
||||
plugins.embeddable.registerEmbeddableFactory('lens', new EmbeddableFactory(getStartServices));
|
||||
}
|
||||
|
||||
return {
|
||||
registerDatasource: datasource => {
|
|
@ -4,16 +4,15 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';
|
||||
import { ChromeStart } from 'kibana/public';
|
||||
import { ChromeStart, DocLinksStart } from 'kibana/public';
|
||||
|
||||
export function addHelpMenuToAppChrome(chrome: ChromeStart) {
|
||||
export function addHelpMenuToAppChrome(chrome: ChromeStart, docLinks: DocLinksStart) {
|
||||
chrome.setHelpExtension({
|
||||
appName: 'Lens',
|
||||
links: [
|
||||
{
|
||||
linkType: 'documentation',
|
||||
href: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/lens.html`,
|
||||
href: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/kibana/${docLinks.DOC_LINK_VERSION}/lens.html`,
|
||||
},
|
||||
{
|
||||
linkType: 'github',
|