Skip to content

Commit

Permalink
Merge branch 'main' into feat/kql-filter-in-apm-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
benakansara committed Aug 14, 2023
2 parents 04fd593 + 1546490 commit 55e5235
Show file tree
Hide file tree
Showing 223 changed files with 3,689 additions and 1,377 deletions.
2 changes: 1 addition & 1 deletion .buildkite/ftr_configs.yml
Expand Up @@ -149,7 +149,7 @@ enabled:
- test/plugin_functional/config.ts
- test/server_integration/http/platform/config.status.ts
- test/server_integration/http/platform/config.ts
- test/server_integration/http/ssl_redirect/config.js
- test/server_integration/http/ssl_redirect/config.ts
- test/server_integration/http/ssl_with_p12_intermediate/config.js
- test/server_integration/http/ssl_with_p12/config.js
- test/server_integration/http/ssl/config.js
Expand Down
2 changes: 1 addition & 1 deletion .ci/Dockerfile
@@ -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=18.17.0
ARG NODE_VERSION=18.17.1

FROM node:${NODE_VERSION} AS base

Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -596,6 +596,7 @@ module.exports = {
'test/*/config_open.ts',
'test/*/*.config.ts',
'test/*/{tests,test_suites,apis,apps}/**/*',
'test/server_integration/**/*.ts',
'x-pack/test/*/{tests,test_suites,apis,apps}/**/*',
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',
Expand Down
5 changes: 4 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -9,7 +9,7 @@ x-pack/test/alerting_api_integration/common/plugins/aad @elastic/response-ops
packages/kbn-ace @elastic/platform-deployment-management
x-pack/plugins/actions @elastic/response-ops
x-pack/test/alerting_api_integration/common/plugins/actions_simulators @elastic/response-ops
src/plugins/advanced_settings @elastic/appex-sharedux
src/plugins/advanced_settings @elastic/appex-sharedux @elastic/platform-deployment-management
x-pack/packages/ml/aiops_components @elastic/ml-ui
x-pack/plugins/aiops @elastic/ml-ui
x-pack/packages/ml/aiops_utils @elastic/ml-ui
Expand Down Expand Up @@ -478,6 +478,7 @@ packages/kbn-managed-vscode-config @elastic/kibana-operations
packages/kbn-managed-vscode-config-cli @elastic/kibana-operations
packages/kbn-management/cards_navigation @elastic/platform-deployment-management
src/plugins/management @elastic/platform-deployment-management
packages/kbn-management/settings/section_registry @elastic/appex-sharedux @elastic/platform-deployment-management
packages/kbn-management/storybook/config @elastic/platform-deployment-management
test/plugin_functional/plugins/management_test_plugin @elastic/kibana-app-services
packages/kbn-mapbox-gl @elastic/kibana-gis
Expand Down Expand Up @@ -1197,6 +1198,8 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
/x-pack/plugins/security_solution/server/lib/detection_engine/rule_schema @elastic/security-detection-rule-management @elastic/security-detection-engine
/x-pack/plugins/security_solution/server/utils @elastic/security-detection-rule-management

/x-pack/plugins/security_solution/scripts/openapi @elastic/security-detection-rule-management

## Security Solution sub teams - Detection Engine

/x-pack/plugins/security_solution/common/api/detection_engine @elastic/security-detection-engine
Expand Down
2 changes: 1 addition & 1 deletion .node-version
@@ -1 +1 @@
18.17.0
18.17.1
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
18.17.0
18.17.1
12 changes: 6 additions & 6 deletions WORKSPACE.bazel
Expand Up @@ -22,13 +22,13 @@ load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install
# Setup the Node.js toolchain for the architectures we want to support
node_repositories(
node_repositories = {
"18.17.0-darwin_amd64": ("node-v18.17.0-darwin-x64.tar.gz", "node-v18.17.0-darwin-x64", "2f381442381f7fbde2ca644c3275bec9c9c2a8d361f467b40e39428acdd6ccff"),
"18.17.0-darwin_arm64": ("node-v18.17.0-darwin-arm64.tar.gz", "node-v18.17.0-darwin-arm64", "19731ef427e77ad9c5f476eb62bfb02a7f179d3012feed0bbded62e45f23e679"),
"18.17.0-linux_arm64": ("node-v18.17.0-linux-arm64.tar.xz", "node-v18.17.0-linux-arm64", "fbd2904178ee47da6e0386bc9704a12b1f613da6ad194878a517d4a69ba56544"),
"18.17.0-linux_amd64": ("node-v18.17.0-linux-x64.tar.xz", "node-v18.17.0-linux-x64", "f36facda28c4d5ce76b3a1b4344e688d29d9254943a47f2f1909b1a10acb1959"),
"18.17.0-windows_amd64": ("node-v18.17.0-win-x64.zip", "node-v18.17.0-win-x64", "06e30b4e70b18d794651ef132c39080e5eaaa1187f938721d57edae2824f4e96"),
"18.17.1-darwin_amd64": ("node-v18.17.1-darwin-x64.tar.gz", "node-v18.17.1-darwin-x64", "b3e083d2715f07ec3f00438401fb58faa1e0bdf3c7bde9f38b75ed17809d92fa"),
"18.17.1-darwin_arm64": ("node-v18.17.1-darwin-arm64.tar.gz", "node-v18.17.1-darwin-arm64", "18ca716ea57522b90473777cb9f878467f77fdf826d37beb15a0889fdd74533e"),
"18.17.1-linux_arm64": ("node-v18.17.1-linux-arm64.tar.xz", "node-v18.17.1-linux-arm64", "3f933716a468524acb68c2514d819b532131eb50399ee946954d4a511303e1bb"),
"18.17.1-linux_amd64": ("node-v18.17.1-linux-x64.tar.xz", "node-v18.17.1-linux-x64", "07e76408ddb0300a6f46fcc9abc61f841acde49b45020ec4e86bb9b25df4dced"),
"18.17.1-windows_amd64": ("node-v18.17.1-win-x64.zip", "node-v18.17.1-win-x64", "afc83f5cf6e8b45a4d3fb842904f604dcd271fefada31ad6654f8302f8da28c9"),
},
node_version = "18.17.0",
node_version = "18.17.1",
node_urls = [
"https://nodejs.org/dist/v{version}/{filename}",
],
Expand Down
7 changes: 5 additions & 2 deletions config/serverless.yml
Expand Up @@ -32,15 +32,18 @@ xpack.remote_clusters.enabled: false
xpack.snapshot_restore.enabled: false
xpack.license_management.enabled: false

# Disable index management actions from the UI
# Management team UI configurations
# Disable index actions from the Index Management UI
xpack.index_management.enableIndexActions: false
# Disable legacy index templates from Index Management UI
xpack.index_management.enableLegacyTemplates: false

# Keep deeplinks visible so that they are shown in the sidenav
dev_tools.deeplinks.navLinkStatus: visible
management.deeplinks.navLinkStatus: visible

# Other disabled plugins
#xpack.canvas.enabled: false #only disabable in dev-mode
xpack.canvas.enabled: false
xpack.cloud_integrations.data_migration.enabled: false
data.search.sessions.enabled: false
advanced_settings.enabled: false
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/advanced/upgrading-nodejs.asciidoc
Expand Up @@ -17,7 +17,7 @@ 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 v18.17.0: https://nodejs.org/dist/v18.17.0/SHASUMS256.txt.asc
Example for Node.js v18.17.1: https://nodejs.org/dist/v18.17.1/SHASUMS256.txt.asc

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

Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -73,7 +73,7 @@
"url": "https://github.com/elastic/kibana.git"
},
"engines": {
"node": "18.17.0",
"node": "18.17.1",
"yarn": "^1.22.19"
},
"resolutions": {
Expand Down Expand Up @@ -495,6 +495,7 @@
"@kbn/logstash-plugin": "link:x-pack/plugins/logstash",
"@kbn/management-cards-navigation": "link:packages/kbn-management/cards_navigation",
"@kbn/management-plugin": "link:src/plugins/management",
"@kbn/management-settings-section-registry": "link:packages/kbn-management/settings/section_registry",
"@kbn/management-test-plugin": "link:test/plugin_functional/plugins/management_test_plugin",
"@kbn/mapbox-gl": "link:packages/kbn-mapbox-gl",
"@kbn/maps-custom-raster-source-plugin": "link:x-pack/examples/third_party_maps_source_example",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-apm-synthtrace/src/cli/utils/get_service_urls.ts
Expand Up @@ -80,8 +80,8 @@ async function getKibanaUrl({ target, logger }: { target: string; logger: Logger
export async function getServiceUrls({ logger, target, kibana }: RunOptions & { logger: Logger }) {
if (!target) {
// assume things are running locally
kibana = kibana || 'http://localhost:5601';
target = 'http://localhost:9200';
kibana = kibana || 'http://127.0.0.1:5601';
target = 'http://127.0.0.1:9200';
}

if (!target) {
Expand Down
56 changes: 56 additions & 0 deletions packages/kbn-management/settings/section_registry/README.mdx
@@ -0,0 +1,56 @@
---
id: kbn-management/settings/SectionRegistry
slug: /kbn-management/settings/section-registry/
title: Section Registry
description: A registry which allows a consumer to add sections to Advanced Settings.
tags: ['management', 'settings']
date: 2023-08-04
---

This registry is fairly straightforward: it allows a consumer to add a section to the Advanced Settings page. This registry would be consumed by a plugin and exposed on the `start` and `setup` contracts:

```ts

const registry = new SectionRegistry();

export class PluginBar
implements Plugin<PluginBarSetup, PluginBarStart, PluginBarSetupDeps, PluginBarStartDeps>
{
public setup(
_core: CoreSetup,
_setupDeps: PluginFooSetupDeps
) {
return {
sectionRegistry: sectionRegistry.setup,
};
}

public start(
_core: CoreStart,
_startDeps: PluginFooStartDeps
) {
return {
sectionRegistry: sectionRegistry.start,
};
}
}

export class PluginFoo
implements Plugin<PluginFooSetup, PluginFooStart, PluginFooSetupDeps, PluginFooStartDeps>
{
public setup(
core: CoreSetup,
{ pluginBar: { sectionRegistry } }: PluginFooSetupDeps
) {
const Component = (props: RegistryComponentProps) => <SomeComponent {...props} />;

const queryMatch = (query: string) => {
const searchTerm = query.toLowerCase();
return SEARCH_TERMS.some((term) => term.indexOf(searchTerm) >= 0);
};

sectionRegistry.setup.addGlobalSection(Component, queryMatch);
}
}

```
Expand Up @@ -6,4 +6,10 @@
* Side Public License, v 1.
*/

export { PageSubtitle } from './page_subtitle';
export { SectionRegistry } from './section_registry';
export type {
SectionRegistrySetup,
SectionRegistryStart,
RegistryComponentProps,
RegistryEntry,
} from './section_registry';
19 changes: 19 additions & 0 deletions packages/kbn-management/settings/section_registry/jest.config.js
@@ -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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/kbn-management/settings/section_registry'],
coverageDirectory:
'<rootDir>/target/kibana-coverage/jest/packages/kbn-management/settings/section_registry',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/packages/kbn-management/settings/section_registry/**/*.{ts,tsx}',
],
};
@@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/management-settings-section-registry",
"owner": "@elastic/appex-sharedux @elastic/platform-deployment-management"
}
@@ -0,0 +1,6 @@
{
"name": "@kbn/management-settings-section-registry",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { SectionRegistry } from './section_registry';

describe('SectionRegistry', () => {
let registry = new SectionRegistry();

beforeEach(() => {
registry = new SectionRegistry();
});

describe('register', () => {
it('should allow a global component to be registered', () => {
const Component = () => <div />;
const queryMatch = () => true;
registry.setup.addGlobalSection(Component, queryMatch);

const entries = registry.start.getGlobalSections();
expect(entries).toHaveLength(1);
expect(entries[0].Component).toBe(Component);
expect(entries[0].queryMatch).toBe(queryMatch);
expect(registry.start.getSpacesSections()).toHaveLength(0);
});

it('should allow a spaces component to be registered', () => {
const Component = () => <div />;
const queryMatch = () => true;
registry.setup.addSpaceSection(Component, queryMatch);

const entries = registry.start.getSpacesSections();
expect(entries).toHaveLength(1);
expect(entries[0].Component).toBe(Component);
expect(entries[0].queryMatch).toBe(queryMatch);
expect(registry.start.getGlobalSections()).toHaveLength(0);
});
});
});
@@ -0,0 +1,90 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { ComponentType } from 'react';
import { ToastsStart } from '@kbn/core-notifications-browser';
import { UiSettingsScope } from '@kbn/core-ui-settings-common';

/**
* Props provided to a `RegistryComponent`.
*/
export interface RegistryComponentProps {
toasts: ToastsStart;
enableSaving: Record<UiSettingsScope, boolean>;
}

/**
* A registry entry for a section.
*/
export interface RegistryEntry {
Component: RegistryComponent;
queryMatch: QueryMatchFn;
}

type RegistryComponent = ComponentType<RegistryComponentProps>;
type PageType = 'space' | 'global';
type QueryMatchFn = (term: string) => boolean;
type Registry = Record<PageType, RegistryEntry[]>;

/**
* A registry of sections to add to pages within Advanced Settings.
*/
export class SectionRegistry {
private registry: Registry = {
space: [],
global: [],
};

setup = {
/**
* Registers a section within the "Space" page.
*
* @param Component - A React component to render.
* @param queryMatch - A function that, given a search term, returns true if the section should be rendered.
*/
addSpaceSection: (Component: RegistryComponent, queryMatch: QueryMatchFn) => {
this.registry.space.push({ Component, queryMatch });
},

/**
* Registers a section within the "Global" page.
*
* @param Component - A React component to render.
* @param queryMatch - A function that, given a search term, returns true if the section should be rendered.
*/
addGlobalSection: (Component: RegistryComponent, queryMatch: QueryMatchFn) => {
this.registry.global.push({ Component, queryMatch });
},
};

start = {
/**
* Retrieve components registered for the "Space" page.
*/
getGlobalSections: (): RegistryEntry[] => {
return this.registry.global;
},

/**
* Retrieve components registered for the "Global" page.
*/
getSpacesSections: (): RegistryEntry[] => {
return this.registry.space;
},
};
}

/**
* The `setup` contract provided by a `SectionRegistry`.
*/
export type SectionRegistrySetup = SectionRegistry['setup'];

/**
* The `start` contract provided by a `SectionRegistry`.
*/
export type SectionRegistryStart = SectionRegistry['start'];
22 changes: 22 additions & 0 deletions packages/kbn-management/settings/section_registry/tsconfig.json
@@ -0,0 +1,22 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/core-notifications-browser",
"@kbn/core-ui-settings-common",
]
}

0 comments on commit 55e5235

Please sign in to comment.