Skip to content

Commit

Permalink
Merge branch 'main' into search-app-pageTemplate-cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
saarikabhasi committed Apr 25, 2023
2 parents 8140eff + bfe5aee commit 3c59244
Show file tree
Hide file tree
Showing 421 changed files with 13,064 additions and 1,975 deletions.
1 change: 1 addition & 0 deletions .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if is_pr_with_label "ci:build-cloud-image"; then
--docker-push \
--skip-docker-ubi \
--skip-docker-ubuntu \
--skip-docker-serverless \
--skip-docker-contexts
docker logout docker.elastic.co

Expand Down
5 changes: 3 additions & 2 deletions .buildkite/scripts/steps/artifacts/docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ node scripts/build \
--docker-images \
--docker-namespace="kibana-ci" \
--docker-tag="git-$GIT_ABBREV_COMMIT" \
--skip-docker-ubuntu \
--skip-docker-ubi \
--skip-docker-cloud \
--skip-docker-contexts

echo "--- Tag images"
docker rmi "$KIBANA_IMAGE"
docker load < "target/kibana-$BASE_VERSION-docker-image.tar.gz"
docker load < "target/kibana-serverless-$BASE_VERSION-docker-image.tar.gz"
docker tag "$KIBANA_IMAGE" "$KIBANA_IMAGE-amd64"

docker rmi "$KIBANA_IMAGE"
docker load < "target/kibana-$BASE_VERSION-docker-image-aarch64.tar.gz"
docker load < "target/kibana-serverless-$BASE_VERSION-docker-image-aarch64.tar.gz"
docker tag "$KIBANA_IMAGE" "$KIBANA_IMAGE-arm64"

echo "--- Push images"
Expand Down
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/cloud/build_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ else
--docker-push \
--skip-docker-ubi \
--skip-docker-ubuntu \
--skip-docker-serverless \
--skip-docker-contexts
fi

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/demo_env/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "$(dirname "${0}")/config.sh"
export KIBANA_IMAGE="gcr.io/elastic-kibana-184716/demo/kibana:$DEPLOYMENT_NAME-$(git rev-parse HEAD)"

echo '--- Build Kibana'
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi --skip-docker-cloud --skip-docker-contexts
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi --skip-docker-cloud --skip-docker-serverless --skip-docker-contexts

echo '--- Build Docker image with example plugins'
cd target/example_plugins
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/package_testing/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

.buildkite/scripts/bootstrap.sh

node scripts/build --all-platforms --debug --skip-docker-cloud --skip-docker-ubi --skip-docker-contexts
node scripts/build --all-platforms --debug --skip-docker-cloud --skip-docker-serverless --skip-docker-ubi --skip-docker-contexts

DOCKER_FILE="kibana-$KIBANA_PKG_VERSION-SNAPSHOT-docker-image.tar.gz"

Expand Down
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ packages/core/usage-data/core-usage-data-base-server-internal @elastic/kibana-co
packages/core/usage-data/core-usage-data-server @elastic/kibana-core
packages/core/usage-data/core-usage-data-server-internal @elastic/kibana-core
packages/core/usage-data/core-usage-data-server-mocks @elastic/kibana-core
packages/core/user-settings/core-user-settings-server @elastic/platform-security
packages/core/user-settings/core-user-settings-server-internal @elastic/platform-security
packages/core/user-settings/core-user-settings-server-mocks @elastic/platform-security
x-pack/plugins/cross_cluster_replication @elastic/platform-deployment-management
packages/kbn-crypto @elastic/kibana-security
packages/kbn-crypto-browser @elastic/kibana-core
Expand Down Expand Up @@ -479,6 +482,7 @@ x-pack/plugins/notifications @elastic/appex-sharedux
packages/kbn-object-versioning @elastic/appex-sharedux
x-pack/packages/observability/alert_details @elastic/actionable-observability
x-pack/test/cases_api_integration/common/plugins/observability @elastic/response-ops
x-pack/plugins/observability_onboarding @elastic/apm-ui
x-pack/plugins/observability @elastic/actionable-observability
x-pack/plugins/observability_shared @elastic/actionable-observability
x-pack/test/security_api_integration/plugins/oidc_provider @elastic/kibana-security
Expand Down
6 changes: 6 additions & 0 deletions docs/api/saved-objects/resolve_import_errors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ To resolve errors, you can:
(Optional, boolean) Creates copies of the saved objects, regenerates each object ID, and resets the origin. When enabled during the
initial import, also enable when resolving import errors.

`compatibilityMode`::
(Optional, boolean) Applies various adjustments to the saved objects that are being imported to maintain compatibility between different {kib}
versions. When enabled during the initial import, also enable when resolving import errors.
+
NOTE: This option cannot be used with the `createNewCopies` option.

[[saved-objects-api-resolve-import-errors-request-body]]
==== Request body

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 @@ -641,6 +641,10 @@ Elastic.
|This plugin provides shared components and services for use across observability solutions, as well as the observability landing page UI.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_onboarding/README.md[observabilityOnboarding]
|This plugin provides an onboarding framework for observability solutions: Logs and APM.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_shared/README.md[observabilityShared]
|A plugin that contains components and utilities shared by all Observability plugins.
Expand Down
8 changes: 5 additions & 3 deletions docs/user/alerting/create-and-manage-rules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ to re-open the flyout and change the rule properties.

Depending on the {kib} app and context, you might be prompted to choose the type of rule to create. Some apps will preselect the type of rule for you.

Each rule type provides its own way of defining the conditions to detect, but an expression formed by a series of clauses is a common pattern. For example, in an index threshold rule, the `WHEN` clause enables you to select an aggregation operation to apply to a numeric field.
Each rule type provides its own way of defining the conditions to detect, but an expression formed by a series of clauses is a common pattern. For example, in a metric threshold rule, the `WHEN` clause enables you to select an aggregation operation to apply to a numeric field.

[role="screenshot"]
image::images/rule-flyout-rule-conditions.png[UI for defining rule conditions on an index threshold rule,500]
image::images/rule-flyout-rule-conditions.png[UI for defining rule conditions on a metric threshold rule,500]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.

All rules must have a check interval, which defines how often to evaluate the rule conditions. Checks are queued; they run as close to the defined value as capacity allows.
Expand All @@ -67,14 +67,15 @@ Each action uses a connector, which provides connection information for a {kib}
After you select a connector, set the action frequency. If the rule type supports alert summaries, you can choose to create a summary of alerts on each check interval or on a custom interval. For example, if you create a metrics threshold rule, you can send email notifications that summarize the new, ongoing, and recovered alerts each day:

[role="screenshot"]
image::images/rule-flyout-action-summary.png[UI for defining rule conditions on an index threshold rule,500]
image::images/rule-flyout-action-summary.png[UI for defining rule conditions on a metric threshold rule,500]

TIP: If you choose a custom action interval, it cannot be shorter than the rule's check interval.

Alternatively, you can set the action frequency such that the action runs for each alert. If the rule type does not support alert summaries, this is your only available option. You must choose when the action runs (for example, at each check interval, only when the alert status changes, or at a custom action interval). You must also choose an action group, which affects whether the action runs (for example, the action runs when the issue is detected or when it is recovered). Each rule type has a specific set of valid action groups.

[role="screenshot"]
image::images/rule-flyout-action-details.png[UI for defining an email action,500]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.

Each connector enables different action properties. For example, an email connector enables you to set the recipients, the subject, and a message body in markdown format. For more information about connectors, refer to <<action-types>>.

Expand Down Expand Up @@ -107,6 +108,7 @@ To view the list of variables available for your rule, click the "add rule varia

[role="screenshot"]
image::images/rule-flyout-action-variables.png[Passing rule values to an action,500]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.

For more information about common action variables, refer to <<rule-action-variables>>.

Expand Down
Binary file modified docs/user/alerting/images/rule-flyout-action-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user/alerting/images/rule-flyout-action-variables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user/alerting/images/rule-flyout-rule-conditions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@
"@kbn/core-usage-data-base-server-internal": "link:packages/core/usage-data/core-usage-data-base-server-internal",
"@kbn/core-usage-data-server": "link:packages/core/usage-data/core-usage-data-server",
"@kbn/core-usage-data-server-internal": "link:packages/core/usage-data/core-usage-data-server-internal",
"@kbn/core-user-settings-server": "link:packages/core/user-settings/core-user-settings-server",
"@kbn/core-user-settings-server-internal": "link:packages/core/user-settings/core-user-settings-server-internal",
"@kbn/core-user-settings-server-mocks": "link:packages/core/user-settings/core-user-settings-server-mocks",
"@kbn/cross-cluster-replication-plugin": "link:x-pack/plugins/cross_cluster_replication",
"@kbn/crypto": "link:packages/kbn-crypto",
"@kbn/crypto-browser": "link:packages/kbn-crypto-browser",
Expand Down Expand Up @@ -494,6 +497,7 @@
"@kbn/object-versioning": "link:packages/kbn-object-versioning",
"@kbn/observability-alert-details": "link:x-pack/packages/observability/alert_details",
"@kbn/observability-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/observability",
"@kbn/observability-onboarding-plugin": "link:x-pack/plugins/observability_onboarding",
"@kbn/observability-plugin": "link:x-pack/plugins/observability",
"@kbn/observability-shared-plugin": "link:x-pack/plugins/observability_shared",
"@kbn/oidc-provider-plugin": "link:x-pack/test/security_api_integration/plugins/oidc_provider",
Expand Down Expand Up @@ -951,7 +955,7 @@
"whatwg-fetch": "^3.0.0",
"xml2js": "^0.4.22",
"xstate": "^4.35.2",
"xterm": "^5.0.0",
"xterm": "^5.1.0",
"yauzl": "^2.10.0",
"yazl": "^2.5.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { InternalStatusServiceSetup } from '@kbn/core-status-server-interna
import type { InternalUiSettingsServiceSetup } from '@kbn/core-ui-settings-server-internal';
import type { InternalCoreUsageDataSetup } from '@kbn/core-usage-data-base-server-internal';
import type { InternalCustomBrandingSetup } from '@kbn/core-custom-branding-server-internal';
import type { InternalUserSettingsServiceSetup } from '@kbn/core-user-settings-server-internal';

/** @internal */
export interface InternalCoreSetup {
Expand All @@ -47,4 +48,5 @@ export interface InternalCoreSetup {
deprecations: InternalDeprecationsServiceSetup;
coreUsageData: InternalCoreUsageDataSetup;
customBranding: InternalCustomBrandingSetup;
userSettings: InternalUserSettingsServiceSetup;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"@kbn/core-usage-data-base-server-internal",
"@kbn/core-usage-data-server",
"@kbn/core-custom-branding-server-internal",
"@kbn/core-custom-branding-server"
"@kbn/core-custom-branding-server",
"@kbn/core-user-settings-server-internal"
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { executionContextServiceMock } from '@kbn/core-execution-context-server-
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
import { customBrandingServiceMock } from '@kbn/core-custom-branding-server-mocks';
import { createCoreStartMock } from './core_start.mock';
import { userSettingsServiceMock } from '@kbn/core-user-settings-server-mocks';

type CoreSetupMockType = MockedKeys<CoreSetup> & {
elasticsearch: ReturnType<typeof elasticsearchServiceMock.createSetup>;
Expand Down Expand Up @@ -53,6 +54,7 @@ export function createCoreSetupMock({
analytics: analyticsServiceMock.createAnalyticsServiceSetup(),
capabilities: capabilitiesServiceMock.createSetupContract(),
customBranding: customBrandingServiceMock.createSetupContract(),
userSettings: userSettingsServiceMock.createSetupContract(),
docLinks: docLinksServiceMock.createSetupContract(),
elasticsearch: elasticsearchServiceMock.createSetup(),
http: httpMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { statusServiceMock } from '@kbn/core-status-server-mocks';
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks';
import { customBrandingServiceMock } from '@kbn/core-custom-branding-server-mocks';
import { userSettingsServiceMock } from '@kbn/core-user-settings-server-mocks';

export function createInternalCoreSetupMock() {
const setupDeps = {
Expand All @@ -47,6 +48,7 @@ export function createInternalCoreSetupMock() {
executionContext: executionContextServiceMock.createInternalSetupContract(),
coreUsageData: coreUsageDataServiceMock.createSetupContract(),
customBranding: customBrandingServiceMock.createSetupContract(),
userSettings: userSettingsServiceMock.createSetupContract(),
};
return setupDeps;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@kbn/core-http-request-handler-context-server",
"@kbn/core-logging-server-mocks",
"@kbn/core-custom-branding-server-mocks",
"@kbn/core-user-settings-server-mocks",
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { StatusServiceSetup } from '@kbn/core-status-server';
import { UiSettingsServiceSetup } from '@kbn/core-ui-settings-server';
import { CoreUsageDataSetup } from '@kbn/core-usage-data-server';
import { CustomBrandingSetup } from '@kbn/core-custom-branding-server';
import { UserSettingsServiceSetup } from '@kbn/core-user-settings-server';
import { CoreStart } from './core_start';

/**
Expand Down Expand Up @@ -64,6 +65,8 @@ export interface CoreSetup<TPluginsStart extends object = object, TStart = unkno
status: StatusServiceSetup;
/** {@link UiSettingsServiceSetup} */
uiSettings: UiSettingsServiceSetup;
/** {@link UserSettingsServiceSetup} */
userSettings: UserSettingsServiceSetup;
/** {@link DeprecationsServiceSetup} */
deprecations: DeprecationsServiceSetup;
/** {@link StartServicesAccessor} */
Expand Down
3 changes: 2 additions & 1 deletion packages/core/lifecycle/core-lifecycle-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@kbn/core-status-server",
"@kbn/core-ui-settings-server",
"@kbn/core-usage-data-server",
"@kbn/core-custom-branding-server"
"@kbn/core-custom-branding-server",
"@kbn/core-user-settings-server"
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ export function createPluginSetupContext<TPlugin, TPluginDependencies>(
register: deps.uiSettings.register,
registerGlobal: deps.uiSettings.registerGlobal,
},
userSettings: {
setUserProfileSettings: deps.userSettings.setUserProfileSettings,
},
getStartServices: () => plugin.startDependencies,
deprecations: deps.deprecations.getRegistry(plugin.name),
coreUsageData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
import { httpServiceMock, httpServerMock } from '@kbn/core-http-server-mocks';
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks';
import { bootstrapRendererFactory, BootstrapRenderer } from './bootstrap_renderer';
import { userSettingsServiceMock } from '@kbn/core-user-settings-server-mocks';

const createPackageInfo = (parts: Partial<PackageInfo> = {}): PackageInfo => ({
branch: 'master',
Expand All @@ -41,12 +42,14 @@ describe('bootstrapRenderer', () => {
let renderer: BootstrapRenderer;
let uiPlugins: UiPlugins;
let packageInfo: PackageInfo;
let userSettingsService: ReturnType<typeof userSettingsServiceMock.createSetupContract>;

beforeEach(() => {
auth = httpServiceMock.createAuth();
uiSettingsClient = uiSettingsServiceMock.createClient();
uiPlugins = createUiPlugins();
packageInfo = createPackageInfo();
userSettingsService = userSettingsServiceMock.createSetupContract();

getThemeTagMock.mockReturnValue('v8light');
getPluginsBundlePathsMock.mockReturnValue(new Map());
Expand Down Expand Up @@ -88,7 +91,7 @@ describe('bootstrapRenderer', () => {
expect(uiSettingsClient.get).toHaveBeenCalledWith('theme:darkMode');
});

it('calls getThemeTag with the correct parameters', async () => {
it('calls getThemeTag with the values from the UiSettingsClient when the UserSettingsService is not provided', async () => {
uiSettingsClient.get.mockResolvedValue(true);

const request = httpServerMock.createKibanaRequest();
Expand All @@ -104,6 +107,58 @@ describe('bootstrapRenderer', () => {
darkMode: true,
});
});

it('calls getThemeTag with values from the UserSettingsService when provided', async () => {
userSettingsService.getUserSettingDarkMode.mockReturnValueOnce(true);

renderer = bootstrapRendererFactory({
auth,
packageInfo,
uiPlugins,
serverBasePath: '/base-path',
userSettingsService,
});

uiSettingsClient.get.mockResolvedValue(false);
const request = httpServerMock.createKibanaRequest();

await renderer({
request,
uiSettingsClient,
});

expect(getThemeTagMock).toHaveBeenCalledTimes(1);
expect(getThemeTagMock).toHaveBeenCalledWith({
themeVersion: 'v8',
darkMode: true,
});
});

it('calls getThemeTag with values from the UiSettingsClient when values from UserSettingsService are `undefined`', async () => {
userSettingsService.getUserSettingDarkMode.mockReturnValueOnce(undefined);

renderer = bootstrapRendererFactory({
auth,
packageInfo,
uiPlugins,
serverBasePath: '/base-path',
userSettingsService,
});

uiSettingsClient.get.mockResolvedValue(false);
const request = httpServerMock.createKibanaRequest();

await renderer({
request,
uiSettingsClient,
});

expect(getThemeTagMock).toHaveBeenCalledTimes(1);
expect(getThemeTagMock).toHaveBeenCalledWith({
themeVersion: 'v8',
darkMode: false,
});
});
});

describe('when the auth status is `unknown`', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ThemeVersion } from '@kbn/ui-shared-deps-npm';
import type { KibanaRequest, HttpAuth } from '@kbn/core-http-server';
import type { IUiSettingsClient } from '@kbn/core-ui-settings-server';
import type { UiPlugins } from '@kbn/core-plugins-base-server-internal';
import { InternalUserSettingsServiceSetup } from '@kbn/core-user-settings-server-internal';
import { getPluginsBundlePaths } from './get_plugin_bundle_paths';
import { getJsDependencyPaths } from './get_js_dependency_paths';
import { getThemeTag } from './get_theme_tag';
Expand All @@ -25,6 +26,7 @@ interface FactoryOptions {
packageInfo: PackageInfo;
uiPlugins: UiPlugins;
auth: HttpAuth;
userSettingsService?: InternalUserSettingsServiceSetup;
}

interface RenderedOptions {
Expand All @@ -43,6 +45,7 @@ export const bootstrapRendererFactory: BootstrapRendererFactory = ({
serverBasePath,
uiPlugins,
auth,
userSettingsService,
}) => {
const isAuthenticated = (request: KibanaRequest) => {
const { status: authStatus } = auth.get(request);
Expand All @@ -56,7 +59,16 @@ export const bootstrapRendererFactory: BootstrapRendererFactory = ({

try {
const authenticated = isAuthenticated(request);
darkMode = authenticated ? await uiSettingsClient.get('theme:darkMode') : false;

if (authenticated) {
const userSettingDarkMode = await userSettingsService?.getUserSettingDarkMode(request);

if (userSettingDarkMode) {
darkMode = userSettingDarkMode;
} else {
darkMode = await uiSettingsClient.get('theme:darkMode');
}
}
} catch (e) {
// just use the default values in case of connectivity issues with ES
}
Expand Down
Loading

0 comments on commit 3c59244

Please sign in to comment.