mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Canvas] move files from legacy/plugins to plugins (#65283)
* Moves the files * Rename legacy/plugins/canvas paths * Correct paths * Fix shareable_runtime and storybook * ESLint Fixes * Fix jest test and paths
This commit is contained in:
parent
a5fe3ce92a
commit
b8bea5b8b2
1263 changed files with 219 additions and 535 deletions
|
@ -26,10 +26,10 @@ target
|
|||
/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
|
||||
/x-pack/legacy/plugins/**/__tests__/fixtures/**
|
||||
/x-pack/plugins/apm/e2e/cypress/**/snapshots.js
|
||||
/x-pack/legacy/plugins/canvas/canvas_plugin
|
||||
/x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts
|
||||
/x-pack/legacy/plugins/canvas/shareable_runtime/build
|
||||
/x-pack/legacy/plugins/canvas/storybook
|
||||
/x-pack/plugins/canvas/canvas_plugin
|
||||
/x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts
|
||||
/x-pack/plugins/canvas/shareable_runtime/build
|
||||
/x-pack/plugins/canvas/storybook
|
||||
/x-pack/plugins/monitoring/public/lib/jquery_flot
|
||||
/x-pack/legacy/plugins/infra/common/graphql/types.ts
|
||||
/x-pack/legacy/plugins/infra/public/graphql/types.ts
|
||||
|
|
22
.eslintrc.js
22
.eslintrc.js
|
@ -89,7 +89,7 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/canvas/**/*.{js,ts,tsx}'],
|
||||
files: ['x-pack/plugins/canvas/**/*.{js,ts,tsx}'],
|
||||
rules: {
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
'jsx-a11y/click-events-have-key-events': 'off',
|
||||
|
@ -893,7 +893,7 @@ module.exports = {
|
|||
* Canvas overrides
|
||||
*/
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/canvas/**/*.js'],
|
||||
files: ['x-pack/plugins/canvas/**/*.js'],
|
||||
rules: {
|
||||
radix: 'error',
|
||||
|
||||
|
@ -937,12 +937,12 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
files: [
|
||||
'x-pack/legacy/plugins/canvas/gulpfile.js',
|
||||
'x-pack/legacy/plugins/canvas/scripts/*.js',
|
||||
'x-pack/legacy/plugins/canvas/tasks/*.js',
|
||||
'x-pack/legacy/plugins/canvas/tasks/**/*.js',
|
||||
'x-pack/legacy/plugins/canvas/__tests__/**/*.js',
|
||||
'x-pack/legacy/plugins/canvas/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*.js',
|
||||
'x-pack/plugins/canvas/gulpfile.js',
|
||||
'x-pack/plugins/canvas/scripts/*.js',
|
||||
'x-pack/plugins/canvas/tasks/*.js',
|
||||
'x-pack/plugins/canvas/tasks/**/*.js',
|
||||
'x-pack/plugins/canvas/__tests__/**/*.js',
|
||||
'x-pack/plugins/canvas/**/{__tests__,__test__,__jest__,__fixtures__,__mocks__}/**/*.js',
|
||||
],
|
||||
rules: {
|
||||
'import/no-extraneous-dependencies': [
|
||||
|
@ -955,7 +955,7 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/canvas/canvas_plugin_src/**/*.js'],
|
||||
files: ['x-pack/plugins/canvas/canvas_plugin_src/**/*.js'],
|
||||
globals: { canvas: true, $: true },
|
||||
rules: {
|
||||
'import/no-unresolved': [
|
||||
|
@ -967,13 +967,13 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/canvas/public/**/*.js'],
|
||||
files: ['x-pack/plugins/canvas/public/**/*.js'],
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['x-pack/legacy/plugins/canvas/canvas_plugin_src/lib/flot-charts/**/*.js'],
|
||||
files: ['x-pack/plugins/canvas/canvas_plugin_src/lib/flot-charts/**/*.js'],
|
||||
env: {
|
||||
jquery: true,
|
||||
},
|
||||
|
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -77,7 +77,7 @@
|
|||
/x-pack/legacy/plugins/beats_management/ @elastic/beats
|
||||
|
||||
# Canvas
|
||||
/x-pack/legacy/plugins/canvas/ @elastic/kibana-canvas
|
||||
/x-pack/plugins/canvas/ @elastic/kibana-canvas
|
||||
|
||||
# Observability UIs
|
||||
/x-pack/legacy/plugins/infra/ @elastic/logs-metrics-ui
|
||||
|
|
|
@ -5,14 +5,14 @@ files:
|
|||
- 'src/plugins/vis_type_vislib/**/*.s+(a|c)ss'
|
||||
- 'src/plugins/vis_type_xy/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/canvas/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/triggers_actions_ui/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/lens/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/cross_cluster_replication/**/*.s+(a|c)ss'
|
||||
- 'x-pack/legacy/plugins/maps/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/maps/**/*.s+(a|c)ss'
|
||||
ignore:
|
||||
- 'x-pack/legacy/plugins/canvas/shareable_runtime/**/*.s+(a|c)ss'
|
||||
- 'x-pack/plugins/canvas/shareable_runtime/**/*.s+(a|c)ss'
|
||||
rules:
|
||||
quotes:
|
||||
- 2
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
"test:ftr:server": "node scripts/functional_tests_server",
|
||||
"test:ftr:runner": "node scripts/functional_test_runner",
|
||||
"test:coverage": "grunt test:coverage",
|
||||
"typespec": "typings-tester --config x-pack/legacy/plugins/canvas/public/lib/aeroelastic/tsconfig.json x-pack/legacy/plugins/canvas/public/lib/aeroelastic/__fixtures__/typescript/typespec_tests.ts",
|
||||
"typespec": "typings-tester --config x-pack/plugins/canvas/public/lib/aeroelastic/tsconfig.json x-pack/plugins/canvas/public/lib/aeroelastic/__fixtures__/typescript/typespec_tests.ts",
|
||||
"checkLicenses": "node scripts/check_licenses --dev",
|
||||
"build": "node scripts/build --all-platforms",
|
||||
"start": "node scripts/kibana --dev",
|
||||
|
|
|
@ -268,7 +268,7 @@ export class ClusterManager {
|
|||
fromRoot('x-pack/plugins/siem/cypress'),
|
||||
fromRoot('x-pack/plugins/apm/e2e'),
|
||||
fromRoot('x-pack/plugins/apm/scripts'),
|
||||
fromRoot('x-pack/legacy/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
|
||||
fromRoot('x-pack/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
|
||||
'plugins/java_languageserver',
|
||||
];
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ export const IGNORE_FILE_GLOBS = [
|
|||
'**/Gruntfile.js',
|
||||
'tasks/config/**/*',
|
||||
'**/{Dockerfile,docker-compose.yml}',
|
||||
'x-pack/legacy/plugins/canvas/tasks/**/*',
|
||||
'x-pack/legacy/plugins/canvas/canvas_plugin_src/**/*',
|
||||
'x-pack/plugins/canvas/tasks/**/*',
|
||||
'x-pack/plugins/canvas/canvas_plugin_src/**/*',
|
||||
'x-pack/plugins/monitoring/public/lib/jquery_flot/**/*',
|
||||
'**/.*',
|
||||
'**/{webpackShims,__mocks__}/**/*',
|
||||
|
@ -48,7 +48,7 @@ export const IGNORE_FILE_GLOBS = [
|
|||
'vars/*',
|
||||
|
||||
// Files in this directory must match a pre-determined name in some cases.
|
||||
'x-pack/legacy/plugins/canvas/.storybook/*',
|
||||
'x-pack/plugins/canvas/.storybook/*',
|
||||
|
||||
// filename must match language code which requires capital letters
|
||||
'**/translations/*.json',
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
export const storybookAliases = {
|
||||
advanced_ui_actions: 'x-pack/plugins/advanced_ui_actions/scripts/storybook.js',
|
||||
apm: 'x-pack/plugins/apm/scripts/storybook.js',
|
||||
canvas: 'x-pack/legacy/plugins/canvas/scripts/storybook_new.js',
|
||||
canvas: 'x-pack/plugins/canvas/scripts/storybook_new.js',
|
||||
codeeditor: 'src/plugins/kibana_react/public/code_editor/scripts/storybook.ts',
|
||||
dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/scripts/storybook.js',
|
||||
drilldowns: 'x-pack/plugins/drilldowns/scripts/storybook.js',
|
||||
|
|
|
@ -38,7 +38,7 @@ else
|
|||
cd "$XPACK_DIR"
|
||||
# build runtime for canvas
|
||||
echo "NODE_ENV=$NODE_ENV"
|
||||
node ./legacy/plugins/canvas/scripts/shareable_runtime
|
||||
node ./plugins/canvas/scripts/shareable_runtime
|
||||
node --max-old-space-size=6144 scripts/jest --ci --verbose --detectOpenHandles --coverage
|
||||
# rename file in order to be unique one
|
||||
test -f ../target/kibana-coverage/jest/coverage-final.json \
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"xpack.alertingBuiltins": "plugins/alerting_builtins",
|
||||
"xpack.apm": ["legacy/plugins/apm", "plugins/apm"],
|
||||
"xpack.beatsManagement": "legacy/plugins/beats_management",
|
||||
"xpack.canvas": "legacy/plugins/canvas",
|
||||
"xpack.canvas": "plugins/canvas",
|
||||
"xpack.dashboard": "plugins/dashboard_enhanced",
|
||||
"xpack.crossClusterReplication": "plugins/cross_cluster_replication",
|
||||
"xpack.dashboardMode": "legacy/plugins/dashboard_mode",
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
"!legacy/plugins/**/__snapshots__",
|
||||
"!legacy/plugins/**/__snapshots__/*",
|
||||
"!legacy/plugins/**/__mocks__/*",
|
||||
"!legacy/plugins/canvas/shareable_runtime/test",
|
||||
"!legacy/plugins/canvas/shareable_runtime/test/**/*"
|
||||
"!plugins/canvas/shareable_runtime/test",
|
||||
"!plugins/canvas/shareable_runtime/test/**/*"
|
||||
],
|
||||
"skipInstallDependencies": true
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
export * from './capabilities';
|
||||
export * from './components';
|
||||
export * from './constants';
|
||||
export * from './errors';
|
||||
export * from './expression_types';
|
||||
export * from './elements';
|
||||
export * from './functions';
|
||||
export * from './renderers';
|
||||
export * from './shortcuts';
|
||||
export * from './tags';
|
||||
export * from './transitions';
|
||||
export * from './ui';
|
||||
export * from './units';
|
|
@ -1,68 +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 { resolve } from 'path';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
|
||||
import { CANVAS_APP, CANVAS_TYPE, CUSTOM_ELEMENT_TYPE } from './common/lib';
|
||||
|
||||
export function canvas(kibana) {
|
||||
return new kibana.Plugin({
|
||||
id: CANVAS_APP,
|
||||
configPrefix: 'xpack.canvas',
|
||||
require: ['kibana', 'elasticsearch', 'xpack_main'],
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
uiExports: {
|
||||
app: {
|
||||
title: 'Canvas',
|
||||
description: 'Data driven workpads',
|
||||
icon: 'plugins/canvas/icon.svg',
|
||||
euiIconType: 'canvasApp',
|
||||
main: 'plugins/canvas/legacy_start',
|
||||
category: DEFAULT_APP_CATEGORIES.analyze,
|
||||
},
|
||||
interpreter: ['plugins/canvas/legacy_register_interpreter'],
|
||||
styleSheetPaths: resolve(__dirname, 'public/style/index.scss'),
|
||||
hacks: [
|
||||
// window.onerror override
|
||||
'plugins/canvas/lib/window_error_handler.js',
|
||||
],
|
||||
home: ['plugins/canvas/legacy_register_feature'],
|
||||
savedObjectsManagement: {
|
||||
[CANVAS_TYPE]: {
|
||||
icon: 'canvasApp',
|
||||
defaultSearchField: 'name',
|
||||
isImportableAndExportable: true,
|
||||
getTitle(obj) {
|
||||
return obj.attributes.name;
|
||||
},
|
||||
getInAppUrl(obj) {
|
||||
return {
|
||||
path: `/app/canvas#/workpad/${encodeURIComponent(obj.id)}`,
|
||||
uiCapabilitiesPath: 'canvas.show',
|
||||
};
|
||||
},
|
||||
},
|
||||
[CUSTOM_ELEMENT_TYPE]: {
|
||||
icon: 'canvasApp',
|
||||
defaultSearchField: 'name',
|
||||
isImportableAndExportable: true,
|
||||
getTitle(obj) {
|
||||
return obj.attributes.displayName;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
config: Joi => {
|
||||
return Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
indexPrefix: Joi.string().default('.canvas'),
|
||||
}).default();
|
||||
},
|
||||
|
||||
init: () => undefined,
|
||||
});
|
||||
}
|
|
@ -1,31 +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 {
|
||||
PluginInitializer,
|
||||
PluginInitializerContext,
|
||||
CoreStart,
|
||||
} from '../../../../../src/core/public';
|
||||
import { CanvasSetup, CanvasStart, CanvasSetupDeps, CanvasStartDeps, CanvasPlugin } from './plugin';
|
||||
import { CanvasServices } from './services';
|
||||
|
||||
export const plugin: PluginInitializer<
|
||||
CanvasSetup,
|
||||
CanvasStart,
|
||||
CanvasSetupDeps,
|
||||
CanvasStartDeps
|
||||
> = (initializerContext: PluginInitializerContext) => {
|
||||
return new CanvasPlugin();
|
||||
};
|
||||
|
||||
export interface WithKibanaProps {
|
||||
kibana: {
|
||||
services: CoreStart & CanvasStartDeps & { canvas: CanvasServices };
|
||||
};
|
||||
}
|
||||
|
||||
// These are your public types & static code
|
||||
export { CanvasSetup, CanvasStart };
|
|
@ -1,53 +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';
|
||||
import { CanvasStartDeps, CanvasSetupDeps } from './plugin'; // eslint-disable-line import/order
|
||||
|
||||
// @ts-ignore Untyped Kibana Lib
|
||||
import chrome, { loadingCount } from 'ui/chrome'; // eslint-disable-line import/order
|
||||
// @ts-ignore Untyped Kibana Lib
|
||||
import { formatMsg } from '../../../../../src/plugins/kibana_legacy/public'; // eslint-disable-line import/order
|
||||
|
||||
const shimCoreSetup = {
|
||||
...npSetup.core,
|
||||
};
|
||||
const shimCoreStart = {
|
||||
...npStart.core,
|
||||
};
|
||||
|
||||
const shimSetupPlugins: CanvasSetupDeps = {
|
||||
data: npSetup.plugins.data,
|
||||
expressions: npSetup.plugins.expressions,
|
||||
home: npSetup.plugins.home,
|
||||
usageCollection: npSetup.plugins.usageCollection,
|
||||
};
|
||||
const shimStartPlugins: CanvasStartDeps = {
|
||||
...npStart.plugins,
|
||||
embeddable: npStart.plugins.embeddable,
|
||||
expressions: npStart.plugins.expressions,
|
||||
inspector: npStart.plugins.inspector,
|
||||
uiActions: npStart.plugins.uiActions,
|
||||
};
|
||||
|
||||
// These methods are intended to be a replacement for import from 'ui/whatever'
|
||||
// These will go away once all of this one plugin start/setup properly
|
||||
// injects wherever these need to go.
|
||||
export function getCoreSetup() {
|
||||
return shimCoreSetup;
|
||||
}
|
||||
|
||||
export function getCoreStart() {
|
||||
return shimCoreStart;
|
||||
}
|
||||
|
||||
export function getSetupPlugins() {
|
||||
return shimSetupPlugins;
|
||||
}
|
||||
|
||||
export function getStartPlugins() {
|
||||
return shimStartPlugins;
|
||||
}
|
|
@ -1,47 +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.
|
||||
*/
|
||||
|
||||
// @ts-ignore
|
||||
import { Registry, registryFactory } from '@kbn/interpreter/common';
|
||||
|
||||
type specFn = (...args: any[]) => { name: string };
|
||||
|
||||
const fnWrapper = (fn: specFn) => {
|
||||
const obj = fn();
|
||||
return () => ({
|
||||
name: obj.name,
|
||||
fn,
|
||||
});
|
||||
};
|
||||
|
||||
class LegacyRegistry extends Registry<any, any> {
|
||||
register(fn: specFn) {
|
||||
super.register(fnWrapper(fn));
|
||||
}
|
||||
|
||||
getOriginalFns() {
|
||||
return this.toArray().map(entry => entry.fn);
|
||||
}
|
||||
}
|
||||
|
||||
export const legacyRegistries = {
|
||||
browserFunctions: new LegacyRegistry(),
|
||||
renderers: new LegacyRegistry(),
|
||||
types: new LegacyRegistry(),
|
||||
elements: new LegacyRegistry(),
|
||||
transformUIs: new LegacyRegistry(),
|
||||
datasourceUIs: new LegacyRegistry(),
|
||||
modelUIs: new LegacyRegistry(),
|
||||
viewUIs: new LegacyRegistry(),
|
||||
argumentUIs: new LegacyRegistry(),
|
||||
templates: new LegacyRegistry(),
|
||||
tagUIs: new LegacyRegistry(),
|
||||
};
|
||||
|
||||
(global as any).kbnInterpreter = Object.assign(
|
||||
(global as any).kbnInterpreter || {},
|
||||
registryFactory(legacyRegistries)
|
||||
);
|
|
@ -1,18 +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 } from 'ui/new_platform';
|
||||
import { functions } from '../canvas_plugin_src/functions/browser';
|
||||
import { typeFunctions } from '../canvas_plugin_src/expression_types';
|
||||
// @ts-ignore untyped local
|
||||
import { renderFunctions } from '../canvas_plugin_src/renderers';
|
||||
|
||||
functions.forEach(npSetup.plugins.expressions.registerFunction);
|
||||
typeFunctions.forEach(npSetup.plugins.expressions.registerType);
|
||||
renderFunctions.forEach(npSetup.plugins.expressions.registerRenderer);
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default functions;
|
|
@ -1,27 +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.
|
||||
*/
|
||||
|
||||
// TODO: These are legacy imports. We should work to have all of these come from New Platform
|
||||
// Import the uiExports that the application uses
|
||||
// These will go away as these plugins are converted to NP
|
||||
import 'ui/autoload/all';
|
||||
import 'uiExports/savedObjectTypes';
|
||||
import 'uiExports/spyModes';
|
||||
import 'uiExports/embeddableFactories';
|
||||
import 'uiExports/interpreter';
|
||||
|
||||
import './legacy_plugin_support';
|
||||
// load application code
|
||||
import 'uiExports/canvas';
|
||||
|
||||
import { PluginInitializerContext } from '../../../../../src/core/public';
|
||||
import { plugin } from './';
|
||||
import { getCoreStart, getStartPlugins, getSetupPlugins, getCoreSetup } from './legacy';
|
||||
const pluginInstance = plugin({} as PluginInitializerContext);
|
||||
|
||||
// Setup and Startup the plugin
|
||||
export const setup = pluginInstance.setup(getCoreSetup(), getSetupPlugins());
|
||||
export const start = pluginInstance.start(getCoreStart(), getStartPlugins());
|
|
@ -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 uniqBy from 'lodash.uniqby';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { getServerFunctions } from '../state/selectors/app';
|
||||
|
||||
export async function getFunctionDefinitions(state) {
|
||||
const serverFunctions = getServerFunctions(state);
|
||||
return uniqBy(
|
||||
serverFunctions.concat(Object.values(npStart.plugins.expressions.getFunctions())),
|
||||
'name'
|
||||
);
|
||||
}
|
|
@ -1,16 +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.
|
||||
*/
|
||||
|
||||
export * from '../../../../../src/plugins/expressions/common';
|
||||
export * from './assets';
|
||||
export * from './canvas';
|
||||
export * from './elements';
|
||||
export * from './functions';
|
||||
export * from './renderers';
|
||||
export * from './shortcuts';
|
||||
export * from './state';
|
||||
export * from './style';
|
||||
export * from './telemetry';
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Elastic-License",
|
||||
"scripts": {
|
||||
"kbn": "node ../scripts/kbn",
|
||||
"kbn:bootstrap": "node legacy/plugins/canvas/scripts/storybook --clean",
|
||||
"kbn:bootstrap": "node plugins/canvas/scripts/storybook --clean",
|
||||
"start": "gulp dev",
|
||||
"build": "gulp build",
|
||||
"testonly": "echo 'Deprecated, use `yarn test`' && gulp test",
|
||||
|
|
|
@ -10,7 +10,7 @@ import { withKnobs } from '@storybook/addon-knobs/react';
|
|||
import { withInfo } from '@storybook/addon-info';
|
||||
import { create } from '@storybook/theming';
|
||||
|
||||
import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public';
|
||||
import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public';
|
||||
|
||||
// If we're running Storyshots, be sure to register the require context hook.
|
||||
// Otherwise, add the other decorators.
|
||||
|
@ -50,7 +50,7 @@ function loadStories() {
|
|||
// Only gather and require CSS files related to Canvas. The other CSS files
|
||||
// are built into the DLL.
|
||||
const css = require.context(
|
||||
'../../../../../built_assets/css',
|
||||
'../../../../built_assets/css',
|
||||
true,
|
||||
/plugins\/(?=canvas).*light\.css/
|
||||
);
|
||||
|
@ -67,7 +67,7 @@ addParameters({
|
|||
theme: create({
|
||||
base: 'light',
|
||||
brandTitle: 'Canvas Storybook',
|
||||
brandUrl: 'https://github.com/elastic/kibana/tree/master/x-pack/legacy/plugins/canvas',
|
||||
brandUrl: 'https://github.com/elastic/kibana/tree/master/x-pack/plugins/canvas',
|
||||
}),
|
||||
showPanel: true,
|
||||
isFullscreen: false,
|
|
@ -7,7 +7,7 @@
|
|||
const path = require('path');
|
||||
|
||||
const DLL_NAME = 'canvas_storybook_dll';
|
||||
const KIBANA_ROOT = path.resolve(__dirname, '../../../../..');
|
||||
const KIBANA_ROOT = path.resolve(__dirname, '../../../..');
|
||||
const BUILT_ASSETS = path.resolve(KIBANA_ROOT, 'built_assets');
|
||||
const DLL_OUTPUT = path.resolve(BUILT_ASSETS, DLL_NAME);
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
// Pull in the built CSS produced by the Kibana server, but not
|
||||
// the Canvas CSS-- we want that in the HMR service.
|
||||
const css = require.context(
|
||||
'../../../../../built_assets/css',
|
||||
'../../../../built_assets/css',
|
||||
true,
|
||||
/\.\/plugins\/(?!canvas).*light\.css/
|
||||
);
|
||||
|
@ -21,15 +21,11 @@ css.keys().forEach(filename => {
|
|||
|
||||
// Include Legacy styles
|
||||
const uiStyles = require.context(
|
||||
'../../../../../src/legacy/ui/public/styles',
|
||||
'../../../../src/legacy/ui/public/styles',
|
||||
false,
|
||||
/[\/\\](?!mixins|variables|_|\.|bootstrap_(light|dark))[^\/\\]+\.less/
|
||||
);
|
||||
uiStyles.keys().forEach(key => uiStyles(key));
|
||||
|
||||
const json = require.context(
|
||||
'../shareable_runtime/test/workpads',
|
||||
false,
|
||||
/\.json$/
|
||||
);
|
||||
const json = require.context('../shareable_runtime/test/workpads', false, /\.json$/);
|
||||
json.keys().forEach(key => json(key));
|
|
@ -7,7 +7,7 @@
|
|||
import path from 'path';
|
||||
import moment from 'moment';
|
||||
import 'moment-timezone';
|
||||
import ReactDOM from "react-dom";
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';
|
||||
import styleSheetSerializer from 'jest-styled-components/src/styleSheetSerializer';
|
||||
|
@ -25,8 +25,8 @@ moment.tz.setDefault('UTC');
|
|||
const testTime = new Date(Date.UTC(2019, 5, 1)); // June 1 2019
|
||||
Date.now = jest.fn(() => testTime);
|
||||
|
||||
// Mock telemetry service
|
||||
jest.mock('../public/lib/ui_metric', () => ({ trackCanvasUiMetric: () => { } }));
|
||||
// Mock telemetry service
|
||||
jest.mock('../public/lib/ui_metric', () => ({ trackCanvasUiMetric: () => {} }));
|
||||
|
||||
// Mock EUI generated ids to be consistently predictable for snapshots.
|
||||
jest.mock(`@elastic/eui/lib/components/form/form_row/make_id`, () => () => `generated-id`);
|
||||
|
@ -65,9 +65,8 @@ jest.mock('@elastic/eui/packages/react-datepicker', () => {
|
|||
};
|
||||
});
|
||||
|
||||
|
||||
// Mock React Portal for components that use modals, tooltips, etc
|
||||
ReactDOM.createPortal = jest.fn((element) => {
|
||||
ReactDOM.createPortal = jest.fn(element => {
|
||||
return element;
|
||||
});
|
||||
|
|
@ -5,6 +5,6 @@
|
|||
*/
|
||||
|
||||
import { functions as browserFns } from '../../canvas_plugin_src/functions/browser';
|
||||
import { ExpressionFunction } from '../../../../../../src/plugins/expressions';
|
||||
import { ExpressionFunction } from '../../../../../src/plugins/expressions';
|
||||
|
||||
export const functionSpecs = browserFns.map(fn => new ExpressionFunction(fn()));
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { get, has, noop } from 'lodash';
|
||||
import { get, has } from 'lodash';
|
||||
import mockElasticsearch from './elasticsearch_plugin';
|
||||
|
||||
const config = {
|
|
@ -4,8 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { ExpressionTypeDefinition } from '../../../../../../src/plugins/expressions';
|
||||
import { EmbeddableInput } from '../../../../../../src/plugins/embeddable/public';
|
||||
import { ExpressionTypeDefinition } from '../../../../../src/plugins/expressions';
|
||||
import { EmbeddableInput } from '../../../../../src/plugins/embeddable/public';
|
||||
import { EmbeddableTypes } from './embeddable_types';
|
||||
|
||||
export const EmbeddableExpressionType = 'embeddable';
|
|
@ -3,11 +3,10 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/public';
|
||||
import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/visualizations/public';
|
||||
import { LENS_EMBEDDABLE_TYPE } from '../../../../../plugins/lens/common/constants';
|
||||
import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/discover/public';
|
||||
import { MAP_SAVED_OBJECT_TYPE } from '../../../../plugins/maps/public';
|
||||
import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../src/plugins/visualizations/public';
|
||||
import { LENS_EMBEDDABLE_TYPE } from '../../../../plugins/lens/common/constants';
|
||||
import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../src/plugins/discover/public';
|
||||
|
||||
export const EmbeddableTypes: {
|
||||
lens: string;
|
|
@ -39,63 +39,63 @@ const testTable: Datatable = {
|
|||
rows: [
|
||||
{
|
||||
name: 'product1',
|
||||
time: 1517842800950, //05 Feb 2018 15:00:00 GMT
|
||||
time: 1517842800950, // 05 Feb 2018 15:00:00 GMT
|
||||
price: 605,
|
||||
quantity: 100,
|
||||
in_stock: true,
|
||||
},
|
||||
{
|
||||
name: 'product1',
|
||||
time: 1517929200950, //06 Feb 2018 15:00:00 GMT
|
||||
time: 1517929200950, // 06 Feb 2018 15:00:00 GMT
|
||||
price: 583,
|
||||
quantity: 200,
|
||||
in_stock: true,
|
||||
},
|
||||
{
|
||||
name: 'product1',
|
||||
time: 1518015600950, //07 Feb 2018 15:00:00 GMT
|
||||
time: 1518015600950, // 07 Feb 2018 15:00:00 GMT
|
||||
price: 420,
|
||||
quantity: 300,
|
||||
in_stock: true,
|
||||
},
|
||||
{
|
||||
name: 'product2',
|
||||
time: 1517842800950, //05 Feb 2018 15:00:00 GMT
|
||||
time: 1517842800950, // 05 Feb 2018 15:00:00 GMT
|
||||
price: 216,
|
||||
quantity: 350,
|
||||
in_stock: false,
|
||||
},
|
||||
{
|
||||
name: 'product2',
|
||||
time: 1517929200950, //06 Feb 2018 15:00:00 GMT
|
||||
time: 1517929200950, // 06 Feb 2018 15:00:00 GMT
|
||||
price: 200,
|
||||
quantity: 256,
|
||||
in_stock: false,
|
||||
},
|
||||
{
|
||||
name: 'product2',
|
||||
time: 1518015600950, //07 Feb 2018 15:00:00 GMT
|
||||
time: 1518015600950, // 07 Feb 2018 15:00:00 GMT
|
||||
price: 190,
|
||||
quantity: 231,
|
||||
in_stock: false,
|
||||
},
|
||||
{
|
||||
name: 'product3',
|
||||
time: 1517842800950, //05 Feb 2018 15:00:00 GMT
|
||||
time: 1517842800950, // 05 Feb 2018 15:00:00 GMT
|
||||
price: 67,
|
||||
quantity: 240,
|
||||
in_stock: true,
|
||||
},
|
||||
{
|
||||
name: 'product4',
|
||||
time: 1517842800950, //05 Feb 2018 15:00:00 GMT
|
||||
time: 1517842800950, // 05 Feb 2018 15:00:00 GMT
|
||||
price: 311,
|
||||
quantity: 447,
|
||||
in_stock: false,
|
||||
},
|
||||
{
|
||||
name: 'product5',
|
||||
time: 1517842800950, //05 Feb 2018 15:00:00 GMT
|
||||
time: 1517842800950, // 05 Feb 2018 15:00:00 GMT
|
||||
price: 288,
|
||||
quantity: 384,
|
||||
in_stock: true,
|
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