Skip to content

Commit

Permalink
Merge branch 'main' into advanced-settings-hide-unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 21, 2022
2 parents a212207 + fadfe2e commit de45f82
Show file tree
Hide file tree
Showing 220 changed files with 5,067 additions and 2,217 deletions.
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=16.13.2
ARG NODE_VERSION=16.14.2

FROM node:${NODE_VERSION} AS base

Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.2
16.14.2
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.2
16.14.2
14 changes: 7 additions & 7 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ check_rules_nodejs_version(minimum_version_string = "4.0.0")
# we can update that rule.
node_repositories(
node_repositories = {
"16.13.2-darwin_amd64": ("node-v16.13.2-darwin-x64.tar.gz", "node-v16.13.2-darwin-x64", "900a952bb77533d349e738ff8a5179a4344802af694615f36320a888b49b07e6"),
"16.13.2-darwin_arm64": ("node-v16.13.2-darwin-arm64.tar.gz", "node-v16.13.2-darwin-arm64", "09d300008ad58792c12622a5eafdb14c931587bb88713df4df64cdf4ff2188d1"),
"16.13.2-linux_arm64": ("node-v16.13.2-linux-arm64.tar.xz", "node-v16.13.2-linux-arm64", "a3cf8e4e9fbea27573eee6da84720bf7227ddd22842b842d48049d6dfe55fb03"),
"16.13.2-linux_s390x": ("node-v16.13.2-linux-s390x.tar.xz", "node-v16.13.2-linux-s390x", "c4ba46fc19366f7377d28a60a98f741bfa38045d7924306244c51d1660afcc8d"),
"16.13.2-linux_amd64": ("node-v16.13.2-linux-x64.tar.xz", "node-v16.13.2-linux-x64", "7f5e9a42d6e86147867d35643c7b1680c27ccd45db85666fc52798ead5e74421"),
"16.13.2-windows_amd64": ("node-v16.13.2-win-x64.zip", "node-v16.13.2-win-x64", "107e3ece84b7fa1e80b3bdf03181d395246c7867e27b17b6d7e6fa9c7932b467"),
"16.14.2-darwin_amd64": ("node-v16.14.2-darwin-x64.tar.gz", "node-v16.14.2-darwin-x64", "d3076ca7fcc7269c8ff9b03fe7d1c277d913a7e84a46a14eff4af7791ff9d055"),
"16.14.2-darwin_arm64": ("node-v16.14.2-darwin-arm64.tar.gz", "node-v16.14.2-darwin-arm64", "a66d9217d2003bd416d3dd06dfd2c7a044c4c9ff2e43a27865790bd0d59c682d"),
"16.14.2-linux_arm64": ("node-v16.14.2-linux-arm64.tar.xz", "node-v16.14.2-linux-arm64", "f7c5a573c06a520d6c2318f6ae204141b8420386553a692fc359f8ae3d88df96"),
"16.14.2-linux_s390x": ("node-v16.14.2-linux-s390x.tar.xz", "node-v16.14.2-linux-s390x", "3197925919ca357e17a31132dc6ef4e5afae819fa09905cfe9f7ff7924a00bf5"),
"16.14.2-linux_amd64": ("node-v16.14.2-linux-x64.tar.xz", "node-v16.14.2-linux-x64", "e40c6f81bfd078976d85296b5e657be19e06862497741ad82902d0704b34bb1b"),
"16.14.2-windows_amd64": ("node-v16.14.2-win-x64.zip", "node-v16.14.2-win-x64", "4731da4fbb2015d414e871fa9118cabb643bdb6dbdc8a69a3ed563266ac93229"),
},
node_version = "16.13.2",
node_version = "16.14.2",
node_urls = [
"https://nodejs.org/dist/v{version}/{filename}",
],
Expand Down
25 changes: 9 additions & 16 deletions docs/developer/advanced/upgrading-nodejs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,26 @@ These files must be updated when upgrading Node.js:
- {kib-repo}blob/{branch}/WORKSPACE.bazel[`WORKSPACE.bazel`] - The version is specified in the `node_version` property.
Besides this property, the list of files under `node_repositories` must be updated along with their respective SHA256 hashes.
These can be found on the https://nodejs.org[nodejs.org] website.
Example for Node.js v14.16.1: https://nodejs.org/dist/v14.16.1/SHASUMS256.txt.asc
Example for Node.js v16.14.2: https://nodejs.org/dist/v16.14.2/SHASUMS256.txt.asc

See PR {kib-repo}pull/96382[#96382] for an example of how the Node.js version has been upgraded previously.

In the 6.8 branch, neither the `.ci/Dockerfile` file nor the `WORKSPACE.bazel` file exists, so when upgrading Node.js in that branch, just skip those files.
See PR {kib-repo}pull/128123[#128123] for an example of how the Node.js version has been upgraded previously.

=== Backporting

The following rules are not set in stone.
Use best judgement when backporting.

Currently version 7.11 and newer run Node.js 14, while 7.10 and older run Node.js 10.
Hence, upgrades to either Node.js 14 or Node.js 10 should be done as separate PRs.

==== Node.js patch upgrades

Typically, you want to backport Node.js *patch* upgrades to all supported release branches that run the same *major* Node.js version:
Typically, you want to backport Node.js *patch* upgrades to all supported release branches that run the same *major* Node.js version (which currently is all of them, but this might change in the future once Node.js v18 is released and becomes LTS):

- If upgrading Node.js 14, and the current release is 7.11.1, the main PR should target `master` and be backported to `7.x` and `7.11`.
- If upgrading Node.js 10, the main PR should target `6.8` only.
- If upgrading Node.js 16, and the current release is 8.1.x, the main PR should target `main` and be backported to `7.17` and `8.1`.

==== Node.js minor upgrades

Typically, you want to backport Node.js *minor* upgrades to the next minor {kib} release branch that runs the same *major* Node.js version:

- If upgrading Node.js 14, and the current release is 7.11.1, the main PR should target `master` and be backported to `7.x`, while leaving the `7.11` branch as-is.
- If upgrading Node.js 10, the main PR should target `6.8` only.
- If upgrading Node.js 16, and the current release is 8.1.x, the main PR should target `main` and be backported to `7.17`, while leaving the `8.1` branch as-is.

=== Upgrading installed Node.js version

Expand All @@ -56,11 +49,11 @@ Run the following to install the new Node.js version. Replace `<version>` with t
nvm install <version>
----

To get the same global npm modules installed with the new version of Node.js as is currently installed, use the `--reinstall-packages-from` command-line argument (optionally replace `14` with the desired source version):
To get the same global npm modules installed with the new version of Node.js as is currently installed, use the `--reinstall-packages-from` command-line argument (optionally replace `16` with the desired source version):

[source,bash]
----
nvm install <version> --reinstall-packages-from=14
nvm install <version> --reinstall-packages-from=16
----

If needed, uninstall the old version of Node.js by running the following. Replace `<old-version>` with the full version number of the version that should be uninstalled:
Expand All @@ -70,11 +63,11 @@ If needed, uninstall the old version of Node.js by running the following. Replac
nvm uninstall <old-version>
----

Optionally, tell nvm to always use the "highest" installed Node.js 14 version. Replace `14` if a different major version is desired:
Optionally, tell nvm to always use the "highest" installed Node.js 16 version. Replace `16` if a different major version is desired:

[source,bash]
----
nvm alias default 14
nvm alias default 16
----

Alternatively, include the full version number at the end to specify a specific default version.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
"url": "https://github.com/elastic/kibana.git"
},
"engines": {
"node": "16.13.2",
"node": "16.14.2",
"yarn": "^1.21.1"
},
"resolutions": {
"**/@babel/runtime": "^7.17.2",
"**/@types/node": "16.10.2",
"**/@types/node": "16.11.7",
"**/chokidar": "^3.4.3",
"**/deepmerge": "^4.2.2",
"**/fast-deep-equal": "^3.1.1",
Expand Down Expand Up @@ -655,7 +655,7 @@
"@types/mustache": "^0.8.31",
"@types/ncp": "^2.0.1",
"@types/nock": "^10.0.3",
"@types/node": "16.10.2",
"@types/node": "16.11.7",
"@types/node-fetch": "^2.6.0",
"@types/node-forge": "^1.0.1",
"@types/nodemailer": "^6.4.0",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
droppedTransactionSpans: `${APM_DOCS}guide/${DOC_LINK_VERSION}/data-model-spans.html#data-model-dropped-spans`,
upgrading: `${APM_DOCS}guide/${DOC_LINK_VERSION}/upgrade.html`,
metaData: `${APM_DOCS}guide/${DOC_LINK_VERSION}/data-model-metadata.html`,
tailSamplingPolicies: `${APM_DOCS}guide/${DOC_LINK_VERSION}/configure-tail-based-sampling.html`,
},
canvas: {
guide: `${KIBANA_DOCS}canvas.html`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface DocLinks {
readonly droppedTransactionSpans: string;
readonly upgrading: string;
readonly metaData: string;
readonly tailSamplingPolicies: string;
};
readonly canvas: {
readonly guide: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function registerThemeSwitcherAddon() {
'eui-theme-css'
) as HTMLLinkElement | null;

if (stylesheet) {
if (stylesheet && globals.euiTheme) {
stylesheet.href = `kbn-ui-shared-deps-npm.${globals.euiTheme}.css`;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const EditIndexPattern = withRouter(
}

const warning =
indexPattern.namespaces.length > 1 ? (
indexPattern.namespaces.length > 1 || indexPattern.namespaces.includes('*') ? (
<FormattedMessage
id="indexPatternManagement.editDataView.deleteWarning"
defaultMessage="When you delete {dataViewName}, you remove it from every space it is shared in. You can't undo this action."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export const IndexPatternTable = ({
spaceIds={dataView.namespaces || []}
id={dataView.id}
title={dataView.title}
refresh={loadDataViews}
refresh={() => {
dataViews.clearCache(dataView.id);
loadDataViews();
}}
/>
) : (
<></>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_types/timelion/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"requiredPlugins": ["visualizations", "data", "expressions", "charts"],
"requiredPlugins": ["visualizations", "data", "expressions", "charts", "dataViews"],
"requiredBundles": ["kibanaUtils", "kibanaReact", "visDefaultEditor"],
"owner": {
"name": "Vis Editors",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import { SUGGESTION_TYPE, suggest } from './timelion_expression_input_helpers';
import { getArgValueSuggestions } from '../helpers/arg_value_suggestions';
import { setIndexPatterns } from '../helpers/plugin_services';
import { IndexPatternsContract } from 'src/plugins/data/public';
import { DataViewsContract } from 'src/plugins/data_views/public';
import { ITimelionFunction } from '../../common/types';

describe('Timelion expression suggestions', () => {
setIndexPatterns({} as IndexPatternsContract);
setIndexPatterns({} as DataViewsContract);

const argValueSuggestions = getArgValueSuggestions();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
*/

import { get } from 'lodash';
import { isNestedField } from '../../../..//data_views/common';
import { getIndexPatterns } from './plugin_services';
import { TimelionFunctionArgs } from '../../common/types';
import { TimelionExpressionFunction, TimelionExpressionArgument } from '../../common/parser';
import { indexPatterns as indexPatternsUtils, KBN_FIELD_TYPES } from '../../../../data/public';
import { KBN_FIELD_TYPES } from '../../../../data/public';

export function getArgValueSuggestions() {
const indexPatterns = getIndexPatterns();
Expand Down Expand Up @@ -71,9 +72,7 @@ export function getArgValueSuggestions() {
.getByType(KBN_FIELD_TYPES.NUMBER)
.filter(
(field) =>
field.aggregatable &&
containsFieldName(valueSplit[1], field) &&
!indexPatternsUtils.isNestedField(field)
field.aggregatable && containsFieldName(valueSplit[1], field) && !isNestedField(field)
)
.map((field) => {
const suggestionValue = field.name.replaceAll(':', '\\:');
Expand Down Expand Up @@ -103,7 +102,7 @@ export function getArgValueSuggestions() {
KBN_FIELD_TYPES.STRING,
].includes(field.type as KBN_FIELD_TYPES) &&
containsFieldName(partial, field) &&
!indexPatternsUtils.isNestedField(field)
!isNestedField(field)
)
.map((field) => ({ name: field.name, help: field.type, insertText: field.name }));
},
Expand All @@ -115,9 +114,7 @@ export function getArgValueSuggestions() {

return indexPattern.fields
.getByType(KBN_FIELD_TYPES.DATE)
.filter(
(field) => containsFieldName(partial, field) && !indexPatternsUtils.isNestedField(field)
)
.filter((field) => containsFieldName(partial, field) && !isNestedField(field))
.map((field) => ({ name: field.name, insertText: field.name }));
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
* Side Public License, v 1.
*/

import type { IndexPatternsContract, ISearchStart } from 'src/plugins/data/public';
import type { ISearchStart } from 'src/plugins/data/public';
import type { DataViewsContract } from 'src/plugins/data_views/public';
import type { ChartsPluginStart } from 'src/plugins/charts/public';
import { createGetterSetter } from '../../../../kibana_utils/public';

export const [getIndexPatterns, setIndexPatterns] =
createGetterSetter<IndexPatternsContract>('IndexPatterns');
createGetterSetter<DataViewsContract>('dataViews');

export const [getDataSearch, setDataSearch] = createGetterSetter<ISearchStart>('Search');

Expand Down
6 changes: 4 additions & 2 deletions src/plugins/vis_types/timelion/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
DataPublicPluginStart,
TimefilterContract,
} from 'src/plugins/data/public';
import type { DataViewsPublicPluginStart } from 'src/plugins/data_views/public';
import type { VisualizationsSetup } from 'src/plugins/visualizations/public';
import type { ChartsPluginSetup, ChartsPluginStart } from 'src/plugins/charts/public';

Expand Down Expand Up @@ -52,6 +53,7 @@ export interface TimelionVisSetupDependencies {
/** @internal */
export interface TimelionVisStartDependencies {
data: DataPublicPluginStart;
dataViews: DataViewsPublicPluginStart;
charts: ChartsPluginStart;
}

Expand Down Expand Up @@ -88,8 +90,8 @@ export class TimelionVisPlugin
visualizations.createBaseVisualization(getTimelionVisDefinition(dependencies));
}

public start(core: CoreStart, { data, charts }: TimelionVisStartDependencies) {
setIndexPatterns(data.indexPatterns);
public start(core: CoreStart, { data, charts, dataViews }: TimelionVisStartDependencies) {
setIndexPatterns(dataViews);
setDataSearch(data.search);
setCharts(charts);

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/vis_types/timelion/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
PluginStart,
DataRequestHandlerContext,
} from '../../../../../src/plugins/data/server';
import type { PluginStart as DataViewPluginStart } from '../../../../../src/plugins/data_views/server';
import { CoreSetup, PluginInitializerContext, Plugin } from '../../../../../src/core/server';
import { configSchema } from '../config';
import loadFunctions from './lib/load_functions';
Expand All @@ -23,6 +24,7 @@ import { getUiSettings } from './ui_settings';

export interface TimelionPluginStartDeps {
data: PluginStart;
dataViews: DataViewPluginStart;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_types/timelion/server/routes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export function runRoute(
},
},
router.handleLegacyErrors(async (context, request, response) => {
const [, { data }] = await core.getStartServices();
const [, { dataViews }] = await core.getStartServices();
const uiSettings = await context.core.uiSettings.client.getAll();
const indexPatternsService = await data.indexPatterns.indexPatternsServiceFactory(
const indexPatternsService = await dataViews.dataViewsServiceFactory(
context.core.savedObjects.client,
context.core.elasticsearch.client.asCurrentUser
);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/timelion/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{ "path": "../../../core/tsconfig.json" },
{ "path": "../../visualizations/tsconfig.json" },
{ "path": "../../data/tsconfig.json" },
{ "path": "../../data_views/tsconfig.json" },
{ "path": "../../expressions/tsconfig.json" },
{ "path": "../../kibana_utils/tsconfig.json" },
{ "path": "../../kibana_react/tsconfig.json" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
fetchIndexPattern,
} from './index_patterns_utils';
import { Panel } from './types';
import { IndexPattern, IndexPatternsService } from '../../../data/common';
import type { DataView, DataViewsService } from '../../../data_views/public';

describe('isStringTypeIndexPattern', () => {
test('should returns true on string-based index', () => {
Expand Down Expand Up @@ -54,8 +54,8 @@ describe('extractIndexPatterns', () => {
});

describe('fetchIndexPattern', () => {
let mockedIndices: IndexPattern[] | [];
let indexPatternsService: IndexPatternsService;
let mockedIndices: DataView[] | [];
let indexPatternsService: DataViewsService;

beforeEach(() => {
mockedIndices = [];
Expand All @@ -64,7 +64,7 @@ describe('fetchIndexPattern', () => {
getDefault: jest.fn(() => Promise.resolve({ id: 'default', title: 'index' })),
get: jest.fn(() => Promise.resolve(mockedIndices[0])),
find: jest.fn(() => Promise.resolve(mockedIndices || [])),
} as unknown as IndexPatternsService;
} as unknown as DataViewsService;
});

test('should return default index on no input value', async () => {
Expand All @@ -87,7 +87,7 @@ describe('fetchIndexPattern', () => {
id: 'indexId',
title: 'indexTitle',
},
] as IndexPattern[];
] as DataView[];

const value = await fetchIndexPattern('indexTitle', indexPatternsService, {
fetchKibanaIndexForStringIndexes: true,
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('fetchIndexPattern', () => {
id: 'indexId',
title: 'indexTitle',
},
] as IndexPattern[];
] as DataView[];

const value = await fetchIndexPattern({ id: 'indexId' }, indexPatternsService);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { uniq } from 'lodash';
import type { Panel, IndexPatternValue, FetchedIndexPattern } from '../common/types';
import { IndexPatternsService } from '../../../data/common';
import { DataViewsService } from '../../../data_views/common';

export const isStringTypeIndexPattern = (
indexPatternValue: IndexPatternValue
Expand Down Expand Up @@ -45,7 +45,7 @@ export const extractIndexPatternValues = (panel: Panel, defaultIndexId?: string)

export const fetchIndexPattern = async (
indexPatternValue: IndexPatternValue | undefined,
indexPatternsService: Pick<IndexPatternsService, 'getDefault' | 'get' | 'find'>,
indexPatternsService: Pick<DataViewsService, 'getDefault' | 'get' | 'find'>,
options: {
fetchKibanaIndexForStringIndexes: boolean;
} = {
Expand Down
Loading

0 comments on commit de45f82

Please sign in to comment.