Skip to content

Commit

Permalink
Merge branch 'master' into security/api-keys-enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Apr 23, 2020
2 parents 6a65e6e + 3e0907f commit 5daaf30
Show file tree
Hide file tree
Showing 41 changed files with 365 additions and 292 deletions.
4 changes: 0 additions & 4 deletions docs/visualize/color-picker.asciidoc

This file was deleted.

14 changes: 0 additions & 14 deletions docs/visualize/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ beta[]

* Save your visualization for use in a dashboard.

[float]
[[lens-aggregation]]
=== Supported aggregations

Lens supports the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

* <<visualize-bucket-aggregations,Bucket>>

[float]
[[drag-drop]]
=== Drag and drop
Expand Down
14 changes: 0 additions & 14 deletions docs/visualize/most-frequent.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ The most frequently used visualizations include:

[[metric-chart]]

[float]
[[frequently-used-viz-aggregation]]
=== Supported aggregations

The most frequently used visualizations support the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

* <<visualize-bucket-aggregations,Bucket>>

[float]
=== Configure your visualization

Expand Down
13 changes: 0 additions & 13 deletions docs/visualize/tilemap.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ Display graphical representations of data where the individual values are repres
[role="screenshot"]
image::images/visualize_heat_map_example.png[]

[float]
[[build-heat-map]]
=== Build a heat map

To display your data on the heat map, use the supported aggregations.

Heat maps support the following aggregations:

* <<visualize-metric-aggregations,Metric>>
* <<visualize-parent-pipeline-aggregations,Parent pipeline>>
* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>
* <<visualize-bucket-aggregations,Bucket>>

[float]
[[navigate-heatmap]]
=== Change the color ranges
Expand Down
12 changes: 0 additions & 12 deletions docs/visualize/tsvb.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ Table:: Display data from multiple time series by defining the field group to sh
[role="screenshot"]
image:images/tsvb-table.png["Table visualization"]

[float]
[[tsvb-aggregation]]
=== Supported aggregations

TSVB supports the following aggregations:

* <<visualize-metric-aggregations,Metric>>

* <<visualize-parent-pipeline-aggregations,Parent pipeline>>

* <<visualize-sibling-pipeline-aggregations,Sibling pipeline>>

[float]
[[create-tsvb-visualization]]
=== Create TSVB visualizations
Expand Down
43 changes: 0 additions & 43 deletions docs/visualize/visualize_rollup_data.asciidoc

This file was deleted.

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { Bundle, WorkerConfig, parseDirPath, DisallowedSyntaxPlugin } from '../c

const IS_CODE_COVERAGE = !!process.env.CODE_COVERAGE;
const ISTANBUL_PRESET_PATH = require.resolve('@kbn/babel-preset/istanbul_preset');
const PUBLIC_PATH_PLACEHOLDER = '__REPLACE_WITH_PUBLIC_PATH__';
const BABEL_PRESET_PATH = require.resolve('@kbn/babel-preset/webpack_preset');

const STATIC_BUNDLE_PLUGINS = [
Expand Down Expand Up @@ -105,7 +104,6 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
output: {
path: bundle.outputDir,
filename: `[name].${bundle.type}.js`,
publicPath: PUBLIC_PATH_PLACEHOLDER,
devtoolModuleFilenameTemplate: info =>
`/${bundle.type}:${bundle.id}/${Path.relative(
bundle.sourceRoot,
Expand Down Expand Up @@ -146,6 +144,13 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
],

rules: [
{
include: Path.join(bundle.contextDir, bundle.entry),
loader: UiSharedDeps.publicPathLoader,
options: {
key: bundle.id,
},
},
{
test: /\.css$/,
include: /node_modules/,
Expand Down Expand Up @@ -289,6 +294,7 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {

resolve: {
extensions: ['.js', '.ts', '.tsx', '.json'],
mainFields: ['browser', 'main'],
alias: {
tinymath: require.resolve('tinymath/lib/tinymath.es5.js'),
},
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-ui-shared-deps/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ export const lightCssDistFilename: string;
export const externals: {
[key: string]: string;
};

/**
* Webpack loader for configuring the public path lookup from `window.__kbnPublicPath__`.
*/
export const publicPathLoader: string;
1 change: 1 addition & 0 deletions packages/kbn-ui-shared-deps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ exports.externals = {
'elasticsearch-browser': '__kbnSharedDeps__.ElasticsearchBrowser',
'elasticsearch-browser/elasticsearch': '__kbnSharedDeps__.ElasticsearchBrowser',
};
exports.publicPathLoader = require.resolve('./public_path_loader');
23 changes: 23 additions & 0 deletions packages/kbn-ui-shared-deps/public_path_loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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.
*/

module.exports = function(source) {
const options = this.query;
return `__webpack_public_path__ = window.__kbnPublicPath__['${options.key}'];${source}`;
};
12 changes: 11 additions & 1 deletion packages/kbn-ui-shared-deps/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ exports.getWebpackConfig = ({ dev = false } = {}) => ({
path: UiSharedDeps.distDir,
filename: '[name].js',
sourceMapFilename: '[file].map',
publicPath: '__REPLACE_WITH_PUBLIC_PATH__',
devtoolModuleFilenameTemplate: info =>
`kbn-ui-shared-deps/${Path.relative(REPO_ROOT, info.absoluteResourcePath)}`,
library: '__kbnSharedDeps__',
Expand All @@ -55,6 +54,17 @@ exports.getWebpackConfig = ({ dev = false } = {}) => ({
module: {
noParse: [MOMENT_SRC],
rules: [
{
include: [require.resolve('./entry.js')],
use: [
{
loader: UiSharedDeps.publicPathLoader,
options: {
key: 'kbn-ui-shared-deps',
},
},
],
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
Expand Down
13 changes: 13 additions & 0 deletions src/legacy/core_plugins/tests_bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ export default kibana => {
.type('text/css');
},
});

// Sets global variables normally set by the bootstrap.js script
kbnServer.server.route({
path: '/test_bundle/karma/globals.js',
method: 'GET',
async handler(req, h) {
const basePath = config.get('server.basePath');

const file = `window.__kbnPublicPath__ = { 'kbn-ui-shared-deps': "${basePath}/bundles/kbn-ui-shared-deps/" };`;

return h.response(file).header('content-type', 'application/json');
},
});
},

__globalImportAliases__: {
Expand Down
1 change: 1 addition & 0 deletions src/legacy/ui/ui_render/bootstrap/template.js.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var kbnCsp = JSON.parse(document.querySelector('kbn-csp').getAttribute('data'));
window.__kbnStrictCsp__ = kbnCsp.strictCsp;
window.__kbnDarkMode__ = {{darkMode}};
window.__kbnPublicPath__ = {{publicPathMap}};

if (window.__kbnStrictCsp__ && window.__kbnCspNotEnforced__) {
var legacyBrowserError = document.getElementById('kbn_legacy_browser_error');
Expand Down
14 changes: 14 additions & 0 deletions src/legacy/ui/ui_render/ui_render_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,25 @@ export function uiRenderMixin(kbnServer, server, config) {
`${regularBundlePath}/plugin/kibanaReact/kibanaReact.plugin.js`,
];

const uiPluginIds = [...kbnServer.newPlatform.__internals.uiPlugins.public.keys()];

// These paths should align with the bundle routes configured in
// src/optimize/bundles_route/bundles_route.js
const publicPathMap = JSON.stringify({
core: `${regularBundlePath}/core/`,
'kbn-ui-shared-deps': `${regularBundlePath}/kbn-ui-shared-deps/`,
...uiPluginIds.reduce(
(acc, pluginId) => ({ ...acc, [pluginId]: `${regularBundlePath}/plugin/${pluginId}/` }),
{}
),
});

const bootstrap = new AppBootstrap({
templateData: {
darkMode,
jsDependencyPaths,
styleSheetPaths,
publicPathMap,
entryBundlePath: isCore
? `${regularBundlePath}/core/core.entry.js`
: `${regularBundlePath}/${app.getId()}.bundle.js`,
Expand Down
79 changes: 47 additions & 32 deletions src/optimize/bundles_route/bundles_route.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,43 +72,57 @@ export function createBundlesRoute({
}

return [
buildRouteForBundles(
`${basePublicPath}/bundles/kbn-ui-shared-deps/`,
'/bundles/kbn-ui-shared-deps/',
UiSharedDeps.distDir,
fileHashCache
),
buildRouteForBundles({
publicPath: `${basePublicPath}/bundles/kbn-ui-shared-deps/`,
routePath: '/bundles/kbn-ui-shared-deps/',
bundlesPath: UiSharedDeps.distDir,
fileHashCache,
replacePublicPath: false,
}),
...npUiPluginPublicDirs.map(({ id, path }) =>
buildRouteForBundles(
`${basePublicPath}/bundles/plugin/${id}/`,
`/bundles/plugin/${id}/`,
path,
fileHashCache
)
),
buildRouteForBundles(
`${basePublicPath}/bundles/core/`,
`/bundles/core/`,
fromRoot(join('src', 'core', 'target', 'public')),
fileHashCache
),
buildRouteForBundles(
`${basePublicPath}/bundles/`,
'/bundles/',
regularBundlesPath,
fileHashCache
buildRouteForBundles({
publicPath: `${basePublicPath}/bundles/plugin/${id}/`,
routePath: `/bundles/plugin/${id}/`,
bundlesPath: path,
fileHashCache,
replacePublicPath: false,
})
),
buildRouteForBundles(
`${basePublicPath}/built_assets/dlls/`,
'/built_assets/dlls/',
dllBundlesPath,
fileHashCache
),
buildRouteForBundles(`${basePublicPath}/`, '/built_assets/css/', builtCssPath, fileHashCache),
buildRouteForBundles({
publicPath: `${basePublicPath}/bundles/core/`,
routePath: `/bundles/core/`,
bundlesPath: fromRoot(join('src', 'core', 'target', 'public')),
fileHashCache,
replacePublicPath: false,
}),
buildRouteForBundles({
publicPath: `${basePublicPath}/bundles/`,
routePath: '/bundles/',
bundlesPath: regularBundlesPath,
fileHashCache,
}),
buildRouteForBundles({
publicPath: `${basePublicPath}/built_assets/dlls/`,
routePath: '/built_assets/dlls/',
bundlesPath: dllBundlesPath,
fileHashCache,
}),
buildRouteForBundles({
publicPath: `${basePublicPath}/`,
routePath: '/built_assets/css/',
bundlesPath: builtCssPath,
fileHashCache,
}),
];
}

function buildRouteForBundles(publicPath, routePath, bundlesPath, fileHashCache) {
function buildRouteForBundles({
publicPath,
routePath,
bundlesPath,
fileHashCache,
replacePublicPath = true,
}) {
return {
method: 'GET',
path: `${routePath}{path*}`,
Expand All @@ -129,6 +143,7 @@ function buildRouteForBundles(publicPath, routePath, bundlesPath, fileHashCache)
bundlesPath,
fileHashCache,
publicPath,
replacePublicPath,
});
},
},
Expand Down
Loading

0 comments on commit 5daaf30

Please sign in to comment.