Skip to content

Commit

Permalink
Rename legacy/plugins/canvas paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Robertson committed May 5, 2020
1 parent 4d19fe6 commit 4884d8d
Show file tree
Hide file tree
Showing 31 changed files with 715 additions and 42 deletions.
8 changes: 4 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ target
/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.*
/x-pack/legacy/plugins/**/__tests__/fixtures/**
/x-pack/legacy/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
Expand Down
22 changes: 11 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -878,7 +878,7 @@ module.exports = {
* Canvas overrides
*/
{
files: ['x-pack/legacy/plugins/canvas/**/*.js'],
files: ['x-pack/plugins/canvas/**/*.js'],
rules: {
radix: 'error',

Expand Down Expand Up @@ -922,12 +922,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': [
Expand All @@ -940,7 +940,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': [
Expand All @@ -952,13 +952,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,
},
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cluster/cluster_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

Expand Down
6 changes: 3 additions & 3 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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__}/**/*',
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion test/scripts/jenkins_xpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions x-pack/.kibana-plugin-helpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
60 changes: 60 additions & 0 deletions x-pack/plugins/canvas/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# OS
.DS_Store

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

target
build
.kibana-plugin-helpers.dev.json

# JetBrains IDEs
.idea
*.iml

# TEMPORARY: sass build output
public/style/index.css

# Don't commit built plugin files
canvas_plugin/*

# Don't commit the Webpack statistics
webpack_stats.json

# Don't commit storybook builds
storybook
6 changes: 6 additions & 0 deletions x-pack/plugins/canvas/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"semi": true,
"printWidth": 100,
"trailingComma": "es5"
}
9 changes: 9 additions & 0 deletions x-pack/plugins/canvas/.storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"env": {
"test": {
"plugins": [
"require-context-hook"
]
}
}
}
9 changes: 9 additions & 0 deletions x-pack/plugins/canvas/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
import '@storybook/addon-console';
79 changes: 79 additions & 0 deletions x-pack/plugins/canvas/.storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* 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 React from 'react';
import { configure, addDecorator, addParameters } from '@storybook/react';
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';

// If we're running Storyshots, be sure to register the require context hook.
// Otherwise, add the other decorators.
if (process.env.NODE_ENV === 'test') {
require('babel-plugin-require-context-hook/register')();
} else {
// Customize the info for each story.
addDecorator(
withInfo({
inline: true,
styles: {
infoBody: {
margin: 20,
},
infoStory: {
margin: '40px 60px',
},
},
})
);

// Add optional knobs to customize each story.
addDecorator(withKnobs);
}

// Add New Platform Context for any stories that need it
const settings = new Map();
settings.set('darkMode', true);
const platform = {
uiSettings: settings,
};
addDecorator(fn => <KibanaContextProvider services={platform}>{fn()}</KibanaContextProvider>);

function loadStories() {
require('./dll_contexts');

// 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',
true,
/plugins\/(?=canvas).*light\.css/
);
css.keys().forEach(filename => css(filename));

// Find all files ending in *.examples.ts
const req = require.context('./..', true, /.(stories|examples).tsx$/);
req.keys().forEach(filename => req(filename));
}

// Set up the Storybook environment with custom settings.
addParameters({
options: {
theme: create({
base: 'light',
brandTitle: 'Canvas Storybook',
brandUrl: 'https://github.com/elastic/kibana/tree/master/x-pack/plugins/canvas',
}),
showPanel: true,
isFullscreen: false,
panelPosition: 'bottom',
isToolshown: true,
},
});

configure(loadStories, module);
19 changes: 19 additions & 0 deletions x-pack/plugins/canvas/.storybook/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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.
*/

const path = require('path');

const DLL_NAME = 'canvas_storybook_dll';
const KIBANA_ROOT = path.resolve(__dirname, '../../../../..');
const BUILT_ASSETS = path.resolve(KIBANA_ROOT, 'built_assets');
const DLL_OUTPUT = path.resolve(BUILT_ASSETS, DLL_NAME);

module.exports = {
DLL_NAME,
KIBANA_ROOT,
BUILT_ASSETS,
DLL_OUTPUT,
};
Loading

0 comments on commit 4884d8d

Please sign in to comment.