Skip to content

Commit

Permalink
Merge branch 'master' into tsvb-new-mode-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jul 1, 2021
2 parents 5b745bc + a06c0f1 commit e56a86e
Show file tree
Hide file tree
Showing 164 changed files with 3,314 additions and 1,159 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Delete any items that are not applicable to this PR.
- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the [cloud](https://github.com/elastic/cloud) and added to the [docker list](https://github.com/elastic/kibana/blob/c29adfef29e921cc447d2a5ed06ac2047ceab552/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker)
- [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/master/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch Node.js rules
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4a5d654a4ccd4a4c24eca5d319d85a88a650edf119601550c95bf400c8cc897e",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.5.1/rules_nodejs-3.5.1.tar.gz"],
sha256 = "0fa2d443571c9e02fcb7363a74ae591bdcce2dd76af8677a95965edf329d778a",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.6.0/rules_nodejs-3.6.0.tar.gz"],
)

# Now that we have the rules let's import from them to complete the work
load("@build_bazel_rules_nodejs//:index.bzl", "check_rules_nodejs_version", "node_repositories", "yarn_install")

# Assure we have at least a given rules_nodejs version
check_rules_nodejs_version(minimum_version_string = "3.5.1")
check_rules_nodejs_version(minimum_version_string = "3.6.0")

# Setup the Node.js toolchain for the architectures we want to support
#
Expand Down
50 changes: 48 additions & 2 deletions docs/setup/upgrade.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
[[upgrade]]
== Upgrade {kib}

Depending on the {kib} version you're upgrading from, the upgrade process to 7.0
varies.
Depending on the {kib} version you're upgrading from, the upgrade process to {version}
varies. The following upgrades are supported:

* Between minor versions
* From 5.6 to 6.8
* From 6.8 to {prev-major-version}
* From {prev-major-version} to {version}
ifeval::[ "{version}" != "{minor-version}.0" ]
* From any version since {minor-version}.0 to {version}
endif::[]

The following table shows the recommended upgrade paths to {version}.

[cols="<1,3",options="header",]
|====
|Upgrade from
|Recommended upgrade path to {version}

ifeval::[ "{version}" != "{minor-version}.0" ]
|A previous {minor-version} version (e.g., {minor-version}.0)
|Upgrade to {version}
endif::[]

|{prev-major-version}
|Upgrade to {version}

|7.0–7.7
a|
. Upgrade to {prev-major-version}
. Upgrade to {version}

|6.8
a|
. Upgrade to {prev-major-version}
. Upgrade to {version}

|6.0–6.7
a|

. Upgrade to 6.8
. Upgrade to {prev-major-version}
. Upgrade to {version}
|====

[WARNING]
====
The upgrade path from 6.8 to 7.0 is *not* supported.
====

[float]
[[upgrade-before-you-begin]]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@
"@babel/traverse": "^7.12.12",
"@babel/types": "^7.12.12",
"@bazel/ibazel": "^0.15.10",
"@bazel/typescript": "^3.5.1",
"@bazel/typescript": "^3.6.0",
"@cypress/snapshot": "^2.1.7",
"@cypress/webpack-preprocessor": "^5.6.0",
"@elastic/eslint-config-kibana": "link:bazel-bin/packages/elastic-eslint-config-kibana",
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class DocLinksService {
},
apis: {
bulkIndexAlias: `${ELASTICSEARCH_DOCS}indices-aliases.html`,
byteSizeUnits: `${ELASTICSEARCH_DOCS}common-options.html#byte-units`,
byteSizeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#byte-units`,
createAutoFollowPattern: `${ELASTICSEARCH_DOCS}ccr-put-auto-follow-pattern.html`,
createFollower: `${ELASTICSEARCH_DOCS}ccr-put-follow.html`,
createIndex: `${ELASTICSEARCH_DOCS}indices-create-index.html`,
Expand All @@ -353,7 +353,7 @@ export class DocLinksService {
putSnapshotLifecyclePolicy: `${ELASTICSEARCH_DOCS}slm-api-put-policy.html`,
putWatch: `${ELASTICSEARCH_DOCS}watcher-api-put-watch.html`,
simulatePipeline: `${ELASTICSEARCH_DOCS}simulate-pipeline-api.html`,
timeUnits: `${ELASTICSEARCH_DOCS}common-options.html#time-units`,
timeUnits: `${ELASTICSEARCH_DOCS}api-conventions.html#time-units`,
updateTransform: `${ELASTICSEARCH_DOCS}update-transform.html`,
},
plugins: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,16 @@ kibana_vars=(
xpack.security.session.idleTimeout
xpack.security.session.lifespan
xpack.security.sessionTimeout
xpack.securitySolution.alertMergeStrategy
xpack.securitySolution.alertResultListDefaultDateRange
xpack.securitySolution.endpointResultListDefaultFirstPageIndex
xpack.securitySolution.endpointResultListDefaultPageSize
xpack.securitySolution.maxRuleImportExportSize
xpack.securitySolution.maxRuleImportPayloadBytes
xpack.securitySolution.maxTimelineImportExportSize
xpack.securitySolution.maxTimelineImportPayloadBytes
xpack.securitySolution.packagerTaskInterval
xpack.securitySolution.validateArtifactDownloads
xpack.spaces.enabled
xpack.spaces.maxSpaces
xpack.task_manager.enabled
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/presentation_util/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ export {
getStubPluginServices,
} from './services';

export {
KibanaPluginServiceFactory,
PluginServiceFactory,
PluginServices,
PluginServiceProviders,
PluginServiceProvider,
PluginServiceRegistry,
KibanaPluginServiceParams,
} from './services/create';

export { PresentationUtilPluginSetup, PresentationUtilPluginStart } from './types';
export { SaveModalDashboardProps } from './components/types';
export { projectIDs, ProjectID, Project } from '../common/labs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function ConfirmSwitchModal({
<p>
{i18n.translate('xpack.apm.settings.schema.confirm.descriptionText', {
defaultMessage:
'If you have custom dashboards, machine learning jobs, or source maps that use classic APM indices, you must reconfigure them for data streams. Stack monitoring is not currently supported with Fleet-managed APM.',
'Please note Stack monitoring is not currently supported with Fleet-managed APM.',
})}
</p>
{!hasUnsupportedConfigs && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const PrependContainer = euiStyled.div`
display: flex;
justify-content: center;
align-items: center;
background-color: ${({ theme }) => theme.eui.euiGradientMiddle};
background-color: ${({ theme }) =>
theme.eui.euiFormInputGroupLabelBackground};
padding: 0 ${px(unit)};
`;

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const createRuleTypeMocks = () => {
bulk: jest.fn(),
};
},
isWriteEnabled: jest.fn(() => true),
} as unknown) as RuleDataClient,
},
services,
Expand Down
24 changes: 11 additions & 13 deletions x-pack/plugins/apm/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
import { mapValues, once } from 'lodash';
import { TECHNICAL_COMPONENT_TEMPLATE_NAME } from '../../rule_registry/common/assets';
import { mappingFromFieldMap } from '../../rule_registry/common/mapping_from_field_map';
import { RuleDataClient } from '../../rule_registry/server';
import { APMConfig, APMXPackConfig } from '.';
import { mergeConfigs } from './index';
import { UI_SETTINGS } from '../../../../src/plugins/data/common';
Expand Down Expand Up @@ -128,7 +127,7 @@ export class APMPlugin
const getCoreStart = () =>
core.getStartServices().then(([coreStart]) => coreStart);

const ready = once(async () => {
const initializeRuleDataTemplates = once(async () => {
const componentTemplateName = ruleDataService.getFullAssetName(
'apm-mappings'
);
Expand Down Expand Up @@ -176,18 +175,17 @@ export class APMPlugin
});
});

ready().catch((err) => {
this.logger!.error(err);
});
// initialize eagerly
const initializeRuleDataTemplatesPromise = initializeRuleDataTemplates().catch(
(err) => {
this.logger!.error(err);
}
);

const ruleDataClient = new RuleDataClient({
alias: ruleDataService.getFullAssetName('observability-apm'),
getClusterClient: async () => {
const coreStart = await getCoreStart();
return coreStart.elasticsearch.client.asInternalUser;
},
ready,
});
const ruleDataClient = ruleDataService.getRuleDataClient(
ruleDataService.getFullAssetName('observability-apm'),
() => initializeRuleDataTemplatesPromise
);

const resourcePlugins = mapValues(plugins, (value, key) => {
return {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/canvas/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/plugins/canvas'],
transform: {
'^.+\\.stories\\.tsx?$': '@storybook/addon-storyshots/injectFileName',
},
};
57 changes: 35 additions & 22 deletions x-pack/plugins/canvas/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { includes, remove } from 'lodash';

import { AppMountParameters, CoreStart, CoreSetup, AppUpdater } from 'kibana/public';

import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public';
import { PluginServices } from '../../../../src/plugins/presentation_util/public';

import { CanvasStartDeps, CanvasSetupDeps } from './plugin';
import { App } from './components/app';
import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public';
import { registerLanguage } from './lib/monaco_language_def';
import { SetupRegistries } from './plugin_api';
import { initRegistries, populateRegistries, destroyRegistries } from './registries';
Expand All @@ -30,7 +32,7 @@ import { init as initStatsReporter } from './lib/ui_metric';

import { CapabilitiesStrings } from '../i18n';

import { startServices, services, ServicesProvider } from './services';
import { startServices, services, LegacyServicesProvider, CanvasPluginServices } from './services';
import { initFunctions } from './functions';
// @ts-expect-error untyped local
import { appUnload } from './state/actions/app';
Expand All @@ -44,27 +46,38 @@ import './style/index.scss';

const { ReadOnlyBadge: strings } = CapabilitiesStrings;

export const renderApp = (
coreStart: CoreStart,
plugins: CanvasStartDeps,
{ element }: AppMountParameters,
canvasStore: Store
) => {
const { presentationUtil } = plugins;
export const renderApp = ({
coreStart,
startPlugins,
params,
canvasStore,
pluginServices,
}: {
coreStart: CoreStart;
startPlugins: CanvasStartDeps;
params: AppMountParameters;
canvasStore: Store;
pluginServices: PluginServices<CanvasPluginServices>;
}) => {
const { presentationUtil } = startPlugins;
const { element } = params;
element.classList.add('canvas');
element.classList.add('canvasContainerWrapper');
const ServicesContextProvider = pluginServices.getContextProvider();

ReactDOM.render(
<KibanaContextProvider services={{ ...plugins, ...coreStart }}>
<ServicesProvider providers={services}>
<presentationUtil.ContextProvider>
<I18nProvider>
<Provider store={canvasStore}>
<App />
</Provider>
</I18nProvider>
</presentationUtil.ContextProvider>
</ServicesProvider>
<KibanaContextProvider services={{ ...startPlugins, ...coreStart }}>
<ServicesContextProvider>
<LegacyServicesProvider providers={services}>
<presentationUtil.ContextProvider>
<I18nProvider>
<Provider store={canvasStore}>
<App />
</Provider>
</I18nProvider>
</presentationUtil.ContextProvider>
</LegacyServicesProvider>
</ServicesContextProvider>
</KibanaContextProvider>,
element
);
Expand All @@ -89,7 +102,7 @@ export const initializeCanvas = async (
// of our bundle entry point. Moving them here pushes that load to when canvas is actually loaded.
const canvasFunctions = initFunctions({
timefilter: setupPlugins.data.query.timefilter.timefilter,
prependBasePath: coreSetup.http.basePath.prepend,
prependBasePath: coreStart.http.basePath.prepend,
types: setupPlugins.expressions.getTypes(),
paletteService: await setupPlugins.charts.palettes.getPalettes(),
});
Expand All @@ -99,7 +112,7 @@ export const initializeCanvas = async (
}

// Create Store
const canvasStore = await createStore(coreSetup, setupPlugins);
const canvasStore = await createStore(coreSetup);

registerLanguage(Object.values(services.expressions.getService().getFunctions()));

Expand Down Expand Up @@ -147,7 +160,7 @@ export const initializeCanvas = async (
return canvasStore;
};

export const teardownCanvas = (coreStart: CoreStart, startPlugins: CanvasStartDeps) => {
export const teardownCanvas = (coreStart: CoreStart) => {
destroyRegistries();

// Canvas pollutes the jQuery plot plugins collection with custom plugins that only work in Canvas.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { debounce } from 'lodash';

interface Props {
interface HeightProps {
elementId: string;
height: number;
width?: never;
}
interface WidthProps {
elementId: string;
width: number;
height?: never;
}

export class DomPreview extends PureComponent<Props> {
export class DomPreview extends PureComponent<HeightProps | WidthProps> {
static propTypes = {
elementId: PropTypes.string.isRequired,
height: PropTypes.number.isRequired,
height: PropTypes.number,
width: PropTypes.number,
};

_container: HTMLDivElement | null = null;
Expand Down Expand Up @@ -78,9 +85,19 @@ export class DomPreview extends PureComponent<Props> {
const originalWidth = parseInt(originalStyle.getPropertyValue('width'), 10);
const originalHeight = parseInt(originalStyle.getPropertyValue('height'), 10);

const thumbHeight = this.props.height;
const scale = thumbHeight / originalHeight;
const thumbWidth = originalWidth * scale;
let thumbHeight = 0;
let thumbWidth = 0;
let scale = 1;

if (this.props.height) {
thumbHeight = this.props.height;
scale = thumbHeight / originalHeight;
thumbWidth = originalWidth * scale;
} else if (this.props.width) {
thumbWidth = this.props.width;
scale = thumbWidth / originalWidth;
thumbHeight = originalHeight * scale;
}

if (this._content.firstChild) {
this._content.removeChild(this._content.firstChild);
Expand Down
Loading

0 comments on commit e56a86e

Please sign in to comment.