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

[feature][Canvas] Share Workpads in other Websites #46278

Merged
merged 27 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bb60377
[Canvas] Embedding Workpads in other Websites (#42545)
clintandrewhall Aug 28, 2019
a240a25
Testing for Workpad Snapshots
clintandrewhall Sep 3, 2019
99ceaf3
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Sep 24, 2019
73a9b77
Rename Snapshots to Shareables; update documentation. (#46513)
clintandrewhall Sep 25, 2019
6fa5257
[canvas][shareables] Add Localization + Tweaks (#46632)
clintandrewhall Sep 26, 2019
2350aaa
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Sep 27, 2019
f10dbcd
[shareables] Unsupported Renderer Warning (#46862)
clintandrewhall Sep 30, 2019
22e4200
[canvas][shareables] Simplify and complete testing (#47328)
clintandrewhall Oct 4, 2019
c0c1a2d
Merge branch 'master' into feature/canvas-snapshots
clintandrewhall Oct 4, 2019
ab41613
Merge branch 'feature/canvas-snapshots' of https://github.com/elastic…
clintandrewhall Oct 4, 2019
032eb3a
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 7, 2019
4445357
Fix CI build of runtime; assorted visual tweaks
clintandrewhall Oct 7, 2019
8c497ba
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 7, 2019
2806612
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 7, 2019
c44fe2a
Update x-pack/legacy/plugins/canvas/shareable_runtime/test/index.ts
clintandrewhall Oct 8, 2019
031c000
Addressing feedback
clintandrewhall Oct 8, 2019
71da514
Merge branch 'feature/canvas-snapshots' of https://github.com/elastic…
clintandrewhall Oct 8, 2019
cb15592
Remove null-loader from root package
clintandrewhall Oct 8, 2019
c62a906
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 8, 2019
5a40b2c
re-add null-loader until mitigation is found
clintandrewhall Oct 8, 2019
9fb50f9
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 8, 2019
c647a73
[perf] Fix unsupported renderers performance issue (#47769)
clintandrewhall Oct 10, 2019
a37fe85
Addressing review feedback (#47775)
clintandrewhall Oct 10, 2019
247da14
Addressing feedback
clintandrewhall Oct 10, 2019
aace4b4
Merge remote-tracking branch 'elastic' into feature/canvas-snapshots
clintandrewhall Oct 10, 2019
dafa93d
Addressing feedback (#47883)
clintandrewhall Oct 10, 2019
6faca42
Branding Changes (#47913)
clintandrewhall Oct 11, 2019
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
2 changes: 2 additions & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ files:
- 'x-pack/legacy/plugins/rollup/**/*.s+(a|c)ss'
- 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss'
- 'x-pack/legacy/plugins/canvas/**/*.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:
Expand Down
8 changes: 8 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,14 @@
'@types/zen-observable',
],
},
{
groupSlug: 'archiver',
groupName: 'archiver related packages',
packageNames: [
'archiver',
'@types/archiver',
],
},
{
groupSlug: 'base64-js',
groupName: 'base64-js related packages',
Expand Down
14 changes: 9 additions & 5 deletions src/dev/build/build_distributables.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function buildDistributables(options) {
const config = await getConfig({
isRelease,
versionQualifier,
targetAllPlatforms
targetAllPlatforms,
});

const run = createRunner({
Expand Down Expand Up @@ -143,16 +143,20 @@ export async function buildDistributables(options) {
* package platform-specific builds into archives
* or os-specific packages in the target directory
*/
if (createArchives) { // control w/ --skip-archives
if (createArchives) {
// control w/ --skip-archives
await run(CreateArchivesTask);
}
if (createDebPackage) { // control w/ --deb or --skip-os-packages
if (createDebPackage) {
// control w/ --deb or --skip-os-packages
await run(CreateDebPackageTask);
}
if (createRpmPackage) { // control w/ --rpm or --skip-os-packages
if (createRpmPackage) {
// control w/ --rpm or --skip-os-packages
await run(CreateRpmPackageTask);
}
if (createDockerPackage) { // control w/ --docker or --skip-os-packages
if (createDockerPackage) {
// control w/ --docker or --skip-os-packages
await run(CreateDockerPackageTask);
}

Expand Down
114 changes: 58 additions & 56 deletions src/dev/build/tasks/clean_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,36 @@ export const CleanTask = {
description: 'Cleaning artifacts from previous builds',

async run(config, log) {
await deleteAll([
spalger marked this conversation as resolved.
Show resolved Hide resolved
config.resolveFromRepo('build'),
config.resolveFromRepo('target'),
config.resolveFromRepo('.node_binaries'),
], log);
await deleteAll(
[
config.resolveFromRepo('build'),
config.resolveFromRepo('target'),
config.resolveFromRepo('.node_binaries'),
],
log
);
},
};

export const CleanPackagesTask = {
description:
'Cleaning source for packages that are now installed in node_modules',
description: 'Cleaning source for packages that are now installed in node_modules',

async run(config, log, build) {
await deleteAll([
build.resolvePath('packages'),
build.resolvePath('yarn.lock'),
], log);
await deleteAll([build.resolvePath('packages'), build.resolvePath('yarn.lock')], log);
},
};


export const CleanTypescriptTask = {
description:
'Cleaning typescript source files that have been transpiled to JS',
description: 'Cleaning typescript source files that have been transpiled to JS',

async run(config, log, build) {
log.info('Deleted %d files', await scanDelete({
directory: build.resolvePath(),
regularExpressions: [
/\.(ts|tsx|d\.ts)$/,
/tsconfig.*\.json$/
]
}));
log.info(
'Deleted %d files',
await scanDelete({
directory: build.resolvePath(),
regularExpressions: [/\.(ts|tsx|d\.ts)$/, /tsconfig.*\.json$/],
})
);
},
};

Expand All @@ -70,9 +67,7 @@ export const CleanExtraFilesFromModulesTask = {

async run(config, log, build) {
const makeRegexps = patterns =>
patterns.map(pattern =>
minimatch.makeRe(pattern, { nocase: true })
);
patterns.map(pattern => minimatch.makeRe(pattern, { nocase: true }));

const regularExpressions = makeRegexps([
// tests
Expand Down Expand Up @@ -169,19 +164,23 @@ export const CleanExtraFilesFromModulesTask = {
'**/docker-compose.yml',
]);

log.info('Deleted %d files', await scanDelete({
directory: build.resolvePath('node_modules'),
regularExpressions,
excludePaths: [
build.resolvePath('node_modules/@elastic/ctags-langserver/vendor')
]
}));
log.info(
'Deleted %d files',
await scanDelete({
directory: build.resolvePath('node_modules'),
regularExpressions,
excludePaths: [build.resolvePath('node_modules/@elastic/ctags-langserver/vendor')],
})
);

if (!build.isOss()) {
log.info('Deleted %d files', await scanDelete({
directory: build.resolvePath('x-pack/node_modules'),
regularExpressions
}));
log.info(
'Deleted %d files',
await scanDelete({
directory: build.resolvePath('x-pack/node_modules'),
regularExpressions,
})
);
}
},
};
Expand All @@ -192,14 +191,15 @@ export const CleanExtraBinScriptsTask = {
async run(config, log, build) {
for (const platform of config.getNodePlatforms()) {
if (platform.isWindows()) {
await deleteAll([
build.resolvePathForPlatform(platform, 'bin', '*'),
`!${build.resolvePathForPlatform(platform, 'bin', '*.bat')}`,
], log);
await deleteAll(
[
build.resolvePathForPlatform(platform, 'bin', '*'),
`!${build.resolvePathForPlatform(platform, 'bin', '*.bat')}`,
],
log
);
} else {
await deleteAll([
build.resolvePathForPlatform(platform, 'bin', '*.bat'),
], log);
await deleteAll([build.resolvePathForPlatform(platform, 'bin', '*.bat')], log);
}
}
},
Expand Down Expand Up @@ -251,22 +251,18 @@ export const CleanEmptyFoldersTask = {
// Delete every single empty folder from
// the distributable except the plugins
// and data folder.
await deleteEmptyFolders(
log,
build.resolvePath('.'),
[
build.resolvePath('plugins'),
build.resolvePath('data')
]
);
await deleteEmptyFolders(log, build.resolvePath('.'), [
build.resolvePath('plugins'),
build.resolvePath('data'),
]);
},
};

export const CleanCtagBuildTask = {
description: 'Cleaning extra platform-specific files from @elastic/node-ctag build dir',

async run(config, log, build) {
const getPlatformId = (platform) => {
const getPlatformId = platform => {
if (platform.isWindows()) {
return 'win32';
} else if (platform.isLinux()) {
Expand All @@ -283,11 +279,17 @@ export const CleanCtagBuildTask = {
}

const ctagsBuildDir = build.resolvePathForPlatform(platform, RELATIVE_CTAGS_BUILD_DIR);
await deleteAll([
resolve(ctagsBuildDir, '*'),
`!${resolve(ctagsBuildDir, `ctags-node-v${process.versions.modules}-${getPlatformId(platform)}-x64`)}`
], log);
await deleteAll(
[
resolve(ctagsBuildDir, '*'),
`!${resolve(
ctagsBuildDir,
`ctags-node-v${process.versions.modules}-${getPlatformId(platform)}-x64`
)}`,
],
log
);
})
);
}
},
};
36 changes: 36 additions & 0 deletions src/dev/jest/mocks/css_module_mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
*/

/**
* This proxy allows for CSS Modules to be interpreted properly by
* Jest. Given a CSS Module class `thisClass`, we'd expect it to
* be obfuscated at runtime. With this mock, `thisClass` will be
* returned. This allows for consistent enzyme and snapshot tests.
*/
module.exports = new Proxy(
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
{},
{
get: function getter(target, key) {
if (key === '__esModule') {
return false;
}
return key;
},
}
);
4 changes: 3 additions & 1 deletion x-pack/.kibana-plugin-helpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"!legacy/plugins/**/*.test.{js,ts}",
"!legacy/plugins/**/__snapshots__",
"!legacy/plugins/**/__snapshots__/*",
"!legacy/plugins/**/__mocks__/*"
"!legacy/plugins/**/__mocks__/*",
"!legacy/plugins/canvas/shareable_runtime/test",
"!legacy/plugins/canvas/shareable_runtime/test/**/*"
],
"skipInstallDependencies": true
}
5 changes: 2 additions & 3 deletions x-pack/dev-tools/jest/create_jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ export function createJestConfig({ kibanaDirectory, xPackKibanaDirectory }) {
'^plugins/([^/.]*)(.*)': `${kibanaDirectory}/src/legacy/core_plugins/$1/public$2`,
'^legacy/plugins/xpack_main/(.*);': `${xPackKibanaDirectory}/legacy/plugins/xpack_main/public/$1`,
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': fileMockPath,
'\\.module.(css|scss)$': `${kibanaDirectory}/src/dev/jest/mocks/css_module_mock.js`,
clintandrewhall marked this conversation as resolved.
Show resolved Hide resolved
'\\.(css|less|scss)$': `${kibanaDirectory}/src/dev/jest/mocks/style_mock.js`,
'^test_utils/enzyme_helpers': `${xPackKibanaDirectory}/test_utils/enzyme_helpers.tsx`,
'^test_utils/find_test_subject': `${xPackKibanaDirectory}/test_utils/find_test_subject.ts`,
},
coverageDirectory: '<rootDir>/../target/kibana-coverage/jest',
coverageReporters: [
'html',
],
coverageReporters: ['html'],
setupFiles: [
`${kibanaDirectory}/src/dev/jest/setup/babel_polyfill.js`,
`<rootDir>/dev-tools/jest/setup/polyfills.js`,
Expand Down
18 changes: 18 additions & 0 deletions x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-story
import styleSheetSerializer from 'jest-styled-components/src/styleSheetSerializer';
import { addSerializer } from 'jest-specific-snapshot';

// Several of the renderers, used by the runtime, use jQuery.
import jquery from 'jquery';
global.$ = jquery;
spalger marked this conversation as resolved.
Show resolved Hide resolved
global.jQuery = jquery;

// Set our default timezone to UTC for tests so we can generate predictable snapshots
moment.tz.setDefault('UTC');

Expand Down Expand Up @@ -53,6 +58,19 @@ jest.mock(
}
);

// Disabling this test due to https://github.com/elastic/eui/issues/2242
jest.mock(
'../public/components/workpad_header/workpad_export/flyout/__examples__/share_website_flyout.examples',
() => {
return 'Disabled Panel';
}
);

// This element uses a `ref` and cannot be rendered by Jest snapshots.
import { RenderedElement } from '../shareable_runtime/components/rendered_element';
jest.mock('../shareable_runtime/components/rendered_element');
RenderedElement.mockImplementation(() => 'RenderedElement');

addSerializer(styleSheetSerializer);

// Initialize Storyshots and build the Jest Snapshots
Expand Down
Loading