Skip to content

Commit

Permalink
Merge branch 'main' into obs-ai-assistant-visualize-esql
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula authored Jan 18, 2024
2 parents c8b3896 + 51b8993 commit b5fe67b
Show file tree
Hide file tree
Showing 517 changed files with 15,750 additions and 14,778 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,15 @@ packages/kbn-peggy @elastic/kibana-operations
packages/kbn-peggy-loader @elastic/kibana-operations
packages/kbn-performance-testing-dataset-extractor @elastic/kibana-performance-testing
packages/kbn-picomatcher @elastic/kibana-operations
packages/kbn-plugin-check @elastic/appex-sharedux
packages/kbn-plugin-generator @elastic/kibana-operations
packages/kbn-plugin-helpers @elastic/kibana-operations
examples/portable_dashboards_example @elastic/kibana-presentation
examples/preboot_example @elastic/kibana-security @elastic/kibana-core
packages/presentation/presentation_containers @elastic/kibana-presentation
packages/presentation/presentation_library @elastic/kibana-presentation
src/plugins/presentation_panel @elastic/kibana-presentation
packages/presentation/presentation_publishing @elastic/kibana-presentation
src/plugins/presentation_util @elastic/kibana-presentation
x-pack/plugins/profiling_data_access @elastic/obs-ux-infra_services-team
x-pack/plugins/profiling @elastic/obs-ux-infra_services-team
Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"discover": ["src/plugins/discover", "packages/kbn-discover-utils"],
"savedSearch": "src/plugins/saved_search",
"embeddableApi": "src/plugins/embeddable",
"presentationPanel": "src/plugins/presentation_panel",
"embeddableExamples": "examples/embeddable_examples",
"esQuery": "packages/kbn-es-query/src",
"esUi": "src/plugins/es_ui_shared",
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Discover::
Elastic Security::
For the Elastic Security 8.12.0 release information, refer to {security-guide}/release-notes.html[_Elastic Security Solution Release Notes_].
Elastic Search::
* Split details panel from model selection list ({kibana-pull}173434[#173434]).
* Trained models can now be deployed and started directly from the Machine Learning inference pipeline configuration flyout ({kibana-pull}173434[#173434]).
Fleet::
* Adds support for Elasticsearch output performance presets ({kibana-pull}172359[#172359]).
* Adds a new `keep_monitoring_alive` flag to agent policies ({kibana-pull}168865[#168865]).
Expand Down
5 changes: 4 additions & 1 deletion docs/api/osquery-manager/live-queries/create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ experimental[] Create live queries.

`metadata`:: (Optional, object) Custom metadata object associated to the live query.

`timeout`:: (Optional, number) A timeout period, in seconds, after which the query will stop running. Overwriting the default timeout allows you to support queries that require more time to complete. The default and minimum supported value is `60`. The maximum supported value is `900`.


[[osquery-manager-live-queries-api-create-request-codes]]
==== Response code
Expand All @@ -69,13 +71,13 @@ Run a live query on all supported agents:
$ curl -X POST api/osquery/live_queries \
{
"query": "select * from uptime;",
"ecs_mapping": {
"host.uptime": {
"field": "total_seconds"
}
},
"agent_all": true,
"timeout": 120
}
--------------------------------------------------
Expand Down Expand Up @@ -110,6 +112,7 @@ The API returns the live query object:
"action_id": "609c4c66-ba3d-43fa-afdd-53e244577aa0", # unique ID of the query, use it when querying the live query API to get the single query results
"id": "6724a474-cbba-41ef-a1aa-66aebf0879e2", # ID of the query, doesn't have to be unique
"query": "select * from uptime;",
"timeout": 120,
"ecs_mapping": {
"host.uptime": {
"field": "total_seconds"
Expand Down
1 change: 1 addition & 0 deletions docs/api/osquery-manager/packs/create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ $ curl -X POST api/osquery/packs \
"my_query": {
"query": "SELECT * FROM listening_ports;",
"interval": 60,
"timeout": 120,
"ecs_mapping": {
"client.port": {
"field": "port"
Expand Down
5 changes: 4 additions & 1 deletion docs/api/osquery-manager/saved-queries/create.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ experimental[] Create saved queries.

`version`:: (Optional, string) Uses the Osquery versions greater than or equal to the specified version string.

`interval`:: (Optional, integer) An interval, in seconds, to run the query.
`interval`:: (Optional, string) An interval, in seconds, on which to run the query.

`ecs_mapping`:: (Optional, object) Maps Osquery results columns or static values to ECS fields.

`timeout`:: (Optional, number) A timeout period, in seconds, after which the query will stop running. Overwriting the default timeout allows you to support queries that require more time to complete. The default and minimum supported value is `60`. The maximum supported value is `900`.


[[osquery-manager-saved-queries-api-create-request-codes]]
==== Response code
Expand All @@ -60,6 +62,7 @@ $ curl -X POST api/osquery/saved_queries \
"description": "Saved query description",
"query": "select * from uptime;",
"interval": "60",
"timeout": 120,
"version": "2.8.0",
"platform": "linux,darwin",
"ecs_mapping": {
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ Content is fetched from the remote (https://feeds.elastic.co) once a day, with p
|Helps to globally configure the no data page components
|{kib-repo}blob/{branch}/src/plugins/presentation_panel/README.md[presentationPanel]
|The Presentation Panel is the point of contact between any React component and any registered UI actions. Components provided to the Presentation Panel should use an imperative handle to expose methods and state.
|{kib-repo}blob/{branch}/src/plugins/presentation_util/README.mdx[presentationUtil]
|The Presentation Utility Plugin is a set of common, shared components and toolkits for solutions within the Presentation space, (e.g. Dashboards, Canvas).
Expand Down
12 changes: 9 additions & 3 deletions docs/osquery/osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ then view the results.
. Select one or more agents or groups to query. Start typing in the search field,
and you'll get suggestions for agents by name, ID, platform, and policy.
. Specify the query or pack to run:
** *Query*: Select a saved query or enter a new one in the text box. After you enter the query, you can expand the **Advanced** section to view or set <<osquery-map-fields,mapped ECS fields>> included in the results from the live query. Mapping ECS fields is optional.
** *Query*: Select a saved query or enter a new one in the text box. After you enter the query, you can expand the **Advanced** section to set a timeout period for the query, and view or set <<osquery-map-fields,mapped ECS fields>> included in the results from the live query (optional).
+
NOTE: Overwriting the query's default timeout period allows you to support queries that require more time to complete. The default and minimum supported value for the **Timeout** field is `60`. The maximum supported value is `900`.
** *Pack*: Select from available query packs. After you select a pack, all of the queries in the pack are displayed.
+
TIP: Refer to <<osquery-prebuilt-packs,prebuilt packs>> to learn about using and managing Elastic prebuilt packs.
+
[role="screenshot"]
image::images/enter-query.png[Select saved query dropdown name showing query name and description]

. Click **Submit**. Queries will timeout after 5 minutes if there are no responses.
. Click **Submit**.
+
TIP: To save a single query for future use, click *Save for later* and define the ID, description, and other <<osquery-manage-query,details>>.

Expand Down Expand Up @@ -104,8 +106,10 @@ NOTE: When defining pack deployment details, you cannot configure the same polic

** Click *Add query* and then add a saved query or enter a new query.
Each query must include a unique query ID and the interval at which it should run.
Optionally, set the minimum Osquery version and platform,
Optionally, set the minimum Osquery version and platform, specify a timeout period,
or <<osquery-map-fields,map ECS fields>>. When you add a saved query to a pack, this adds a copy of the query. A connection is not maintained between saved queries and packs.
+
NOTE: Overwriting the query's default timeout period allows you to support queries that require more time to complete. The default and minimum supported value for the **Timeout** field is `60`. The maximum supported value is `900`.

** Upload queries from a `.conf` query pack by dragging the pack to the drop zone under the query table. To explore the community packs that Osquery publishes, click *Example packs*.

Expand Down Expand Up @@ -147,6 +151,8 @@ Once you save a query, you can only edit it from the *Saved queries* tab:

* The SQL query (required). Osquery supports multi-line queries.

* A timeout period (optional). Increase the query's default timeout period to support queries that require more time to complete. The default and minimum supported value for the **Timeout** field is `60`. The maximum supported value is `900`.

* The <<osquery-map-fields,ECS fields>> to populate when the query is run (optional). These fields are also copied in when you add this query to a pack.

* The defaults to set when you add the query to a pack.
Expand Down
Binary file added docs/user/images/maintenance-window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/user/whats-new.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ The supported hash functions for case files are MD5, SHA-1, and SHA-256.

[discrete]
==== Connector improvements

PagerDuty alert action is now supported by 2 new fields `links` and `custom_details`.
ServiceNow ITSM alert action allows users to define incident resolution when alert is recovered to ensure bi-directional sync between the Elastic Alerts and ServiceNow Incidents.

Expand Down
2 changes: 1 addition & 1 deletion fleet_packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
{
"name": "endpoint",
"version": "8.11.1"
"version": "8.12.0"
},
{
"name": "fleet_server",
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,13 @@
"@kbn/paertial-results-example-plugin": "link:examples/partial_results_example",
"@kbn/painless-lab-plugin": "link:x-pack/plugins/painless_lab",
"@kbn/panel-loader": "link:packages/kbn-panel-loader",
"@kbn/plugin-check": "link:packages/kbn-plugin-check",
"@kbn/portable-dashboards-example": "link:examples/portable_dashboards_example",
"@kbn/preboot-example-plugin": "link:examples/preboot_example",
"@kbn/presentation-containers": "link:packages/presentation/presentation_containers",
"@kbn/presentation-library": "link:packages/presentation/presentation_library",
"@kbn/presentation-panel-plugin": "link:src/plugins/presentation_panel",
"@kbn/presentation-publishing": "link:packages/presentation/presentation_publishing",
"@kbn/presentation-util-plugin": "link:src/plugins/presentation_util",
"@kbn/profiling-data-access-plugin": "link:x-pack/plugins/profiling_data_access",
"@kbn/profiling-plugin": "link:x-pack/plugins/profiling",
Expand Down Expand Up @@ -1655,7 +1660,7 @@
"terser-webpack-plugin": "^4.2.3",
"tough-cookie": "^4.1.3",
"tree-kill": "^1.2.2",
"ts-morph": "^13.0.2",
"ts-morph": "^15.1.0",
"tsd": "^0.20.0",
"typescript": "4.7.4",
"url-loader": "^2.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { toArray } from 'rxjs/operators';
import { injectedMetadataServiceMock } from '@kbn/core-injected-metadata-browser-mocks';
import { docLinksServiceMock } from '@kbn/core-doc-links-browser-mocks';
import { httpServiceMock } from '@kbn/core-http-browser-mocks';
import { coreContextMock } from '@kbn/core-base-browser-mocks';
import type { App, PublicAppInfo } from '@kbn/core-application-browser';
import { applicationServiceMock } from '@kbn/core-application-browser-mocks';
import { notificationServiceMock } from '@kbn/core-notifications-browser-mocks';
Expand Down Expand Up @@ -75,6 +76,7 @@ function defaultStartTestOptions({
return {
browserSupportsCsp,
kibanaVersion,
coreContext: coreContextMock.create(),
};
}

Expand All @@ -83,7 +85,10 @@ async function start({
cspConfigMock = { warnLegacyBrowsers: true },
startDeps = defaultStartDeps(),
}: { options?: any; cspConfigMock?: any; startDeps?: ReturnType<typeof defaultStartDeps> } = {}) {
const service = new ChromeService(options);
const service = new ChromeService({
...options,
coreContext: options.coreContext ?? coreContextMock.create(),
});

if (cspConfigMock) {
startDeps.injectedMetadata.getCspConfig.mockReturnValue(cspConfigMock);
Expand Down Expand Up @@ -200,22 +205,6 @@ describe('start', () => {
expect(shallow(React.createElement(() => chrome.getHeaderComponent()))).toBeDefined();
});

it('renders the default project side navigation', async () => {
const { chrome } = await start({
startDeps: defaultStartDeps([{ id: 'foo', title: 'Foo' } as App], 'foo'),
});

chrome.setChromeStyle('project');

const component = mount(chrome.getHeaderComponent());

const projectHeader = findTestSubject(component, 'kibanaProjectHeader');
expect(projectHeader.length).toBe(1);

const defaultProjectSideNav = findTestSubject(component, 'defaultProjectSideNav');
expect(defaultProjectSideNav.length).toBe(1);
});

it('renders the custom project side navigation', async () => {
const { chrome } = await start({
startDeps: defaultStartDeps([{ id: 'foo', title: 'Foo' } as App], 'foo'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* Side Public License, v 1.
*/

import React from 'react';
import React, { useMemo } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { BehaviorSubject, combineLatest, merge, type Observable, of, ReplaySubject } from 'rxjs';
import { mergeMap, map, takeUntil } from 'rxjs/operators';
import { parse } from 'url';
import { EuiLink } from '@elastic/eui';
import useObservable from 'react-use/lib/useObservable';

import type { CoreContext } from '@kbn/core-base-browser-internal';
import type { InternalInjectedMetadataStart } from '@kbn/core-injected-metadata-browser-internal';
import type { AnalyticsServiceSetup } from '@kbn/core-analytics-browser';
import { type DocLinksStart } from '@kbn/core-doc-links-browser';
Expand All @@ -29,21 +31,24 @@ import type {
ChromeHelpExtension,
ChromeUserBanner,
ChromeStyle,
ChromeProjectNavigation,
ChromeSetProjectBreadcrumbsParams,
NavigationTreeDefinition,
AppDeepLinkId,
CloudURLs,
} from '@kbn/core-chrome-browser';
import type { CustomBrandingStart } from '@kbn/core-custom-branding-browser';
import type {
SideNavComponent as ISideNavComponent,
ChromeHelpMenuLink,
} from '@kbn/core-chrome-browser';

import { Logger } from '@kbn/logging';
import { DocTitleService } from './doc_title';
import { NavControlsService } from './nav_controls';
import { NavLinksService } from './nav_links';
import { ProjectNavigationService } from './project_navigation';
import { RecentlyAccessedService } from './recently_accessed';
import { Header, LoadingIndicator, ProjectHeader, ProjectSideNavigation } from './ui';
import { Header, LoadingIndicator, ProjectHeader } from './ui';
import { registerAnalyticsContextProvider } from './register_analytics_context_provider';
import type { InternalChromeStart } from './types';
import { HeaderTopBanner } from './ui/header/header_top_banner';
Expand All @@ -54,6 +59,7 @@ const SNAPSHOT_REGEX = /-snapshot/i;
interface ConstructorParams {
browserSupportsCsp: boolean;
kibanaVersion: string;
coreContext: CoreContext;
}

export interface SetupDeps {
Expand Down Expand Up @@ -81,8 +87,11 @@ export class ChromeService {
private readonly projectNavigation = new ProjectNavigationService();
private mutationObserver: MutationObserver | undefined;
private readonly isSideNavCollapsed$ = new BehaviorSubject<boolean>(true);
private logger: Logger;

constructor(private readonly params: ConstructorParams) {}
constructor(private readonly params: ConstructorParams) {
this.logger = params.coreContext.logger.get('chrome-browser');
}

/**
* These observables allow consumers to toggle the chrome visibility via either:
Expand Down Expand Up @@ -225,9 +234,10 @@ export class ChromeService {
const navLinks = this.navLinks.start({ application, http });
const projectNavigation = this.projectNavigation.start({
application,
navLinks,
navLinksService: navLinks,
http,
chromeBreadcrumbs$: breadcrumbs$,
logger: this.logger,
});
const recentlyAccessed = await this.recentlyAccessed.start({ http });
const docTitle = this.docTitle.start();
Expand Down Expand Up @@ -265,13 +275,20 @@ export class ChromeService {

const setProjectSideNavComponent = (component: ISideNavComponent | null) => {
validateChromeStyle();
projectNavigation.setProjectSideNavComponent(component);
projectNavigation.setSideNavComponent(component);
};

const setProjectNavigation = (config: ChromeProjectNavigation) => {
function initProjectNavigation<
LinkId extends AppDeepLinkId = AppDeepLinkId,
Id extends string = string,
ChildrenId extends string = Id
>(
navigationTree$: Observable<NavigationTreeDefinition<LinkId, Id, ChildrenId>>,
deps: { cloudUrls: CloudURLs }
) {
validateChromeStyle();
projectNavigation.setProjectNavigation(config);
};
projectNavigation.initNavigation(navigationTree$, deps);
}

const setProjectBreadcrumbs = (
breadcrumbs: ChromeBreadcrumb[] | ChromeBreadcrumb,
Expand Down Expand Up @@ -362,20 +379,19 @@ export class ChromeService {
const activeNodes$ = projectNavigation.getActiveNodes$();

const ProjectHeaderWithNavigationComponent = () => {
const CustomSideNavComponent = useObservable(projectNavigationComponent$, undefined);
const CustomSideNavComponent = useObservable(projectNavigationComponent$, {
current: null,
});
const activeNodes = useObservable(activeNodes$, []);

const currentProjectBreadcrumbs$ = projectBreadcrumbs$;

let SideNavComponent: ISideNavComponent = () => null;

if (CustomSideNavComponent !== undefined) {
// We have the state from the Observable
SideNavComponent =
CustomSideNavComponent.current !== null
? CustomSideNavComponent.current
: ProjectSideNavigation;
}
const SideNavComponent = useMemo<ISideNavComponent>(() => {
if (CustomSideNavComponent.current) {
return CustomSideNavComponent.current;
}
return () => null;
}, [CustomSideNavComponent]);

return (
<ProjectHeader
Expand Down Expand Up @@ -526,7 +542,8 @@ export class ChromeService {
setProjectsUrl,
setProjectUrl,
setProjectName,
setNavigation: setProjectNavigation,
initNavigation: initProjectNavigation,
getNavigationTreeUi$: () => projectNavigation.getNavigationTreeUi$(),
setSideNavComponent: setProjectSideNavComponent,
setBreadcrumbs: setProjectBreadcrumbs,
getActiveNavigationNodes$: () => projectNavigation.getActiveNodes$(),
Expand Down
Loading

0 comments on commit b5fe67b

Please sign in to comment.