Skip to content

Commit

Permalink
Merge branch '8.x' into backport/8.x/pr-199885
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan authored Dec 9, 2024
2 parents bbfbc65 + bf23999 commit 34dca1b
Show file tree
Hide file tree
Showing 61 changed files with 1,604 additions and 935 deletions.
117 changes: 117 additions & 0 deletions docs/settings/ai-assistant-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
[role="xpack"]
[[ai-assistant-settings-kb]]
=== AI Assistant settings in {kib}
++++
<titleabbrev>AI Assistant settings</titleabbrev>
++++

`xpack.productDocBase.artifactRepositoryUrl`::
Url of the repository to use to download and install the Elastic product documentation artifacts for the AI assistants.
Defaults to `https://kibana-knowledge-base-artifacts.elastic.co`

[[configuring-product-doc-for-airgap]]
==== Configuring product documentation for air-gapped environments

Installing product documentation requires network access to its artifact repository.
For air-gapped environments, or environments where remote network traffic is blocked or filtered,
the artifact repository must be manually deployed somewhere accessible by the Kibana deployment.

Deploying a custom product documentation repository can be done in 2 ways: using a S3 bucket, or using a CDN.

===== Deploying using a S3 bucket

*1. Download the artifacts for your current {kib} version*

The artifact names follow this pattern: `kb-product-doc-{productName}-{versionMajor}.{versionMinor}.zip`

The available products are:
- elasticsearch
- kibana
- observability
- security

You must download, from the source repository (`https://kibana-knowledge-base-artifacts.elastic.co/`),
the artifacts for your current version of Kibana.

For example, for Kibana 8.16:
- `kb-product-doc-elasticsearch-8.16.zip`
- `kb-product-doc-kibana-8.16.zip`
- `kb-product-doc-observability-8.16.zip`
- `kb-product-doc-security-8.16.zip`

*2. Upload the artifacts to your local S3 bucket*

Upload the artifact files to your custom S3 bucket, then make sure that they are properly listed in the bucket's index, similar to
the bucket listing displayed when accessing `https://kibana-knowledge-base-artifacts.elastic.co/` in a browser.

*3. Configure {kib} to use the custom repository*

Add the following line to your {kib} configuration file:

[source,yaml]
----
# Replace with the root of your custom bucket
xpack.productDocBase.artifactRepositoryUrl: "https://my-custom-repository.example.com"
----

*4. Restart {kib}*

You should then be able to install the product documentation feature from the AI assistant management page.

===== Deploying using a CDN

Deploying using a CDN is quite similar to the S3 bucket approach. The main difference will be that we will need to manually
generate the bucket listing and set it as the CDN folder's index page.

*1. Download the artifacts for your current {kib} version*

Following the step from the `Deploying using a S3 bucket` section

*2. Upload the artifacts to the CDN*

Create a folder in your CDN, and upload the artifacts to it.

*3. Create and upload the bucket listing*

Generate the S3 bucket listing xml file for the folder.

To do that, copy the following template, and replace the versions in the `<Key>` tags with your current version of {kib}.

For example for {kib} 8.17, replace all `8.16` occurrences in the file with `8.17`.

[source,xml]
----
<ListBucketResult>
<Name>kibana-ai-assistant-kb-artifacts</Name>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>kb-product-doc-elasticsearch-8.16.zip</Key>
</Contents>
<Contents>
<Key>kb-product-doc-kibana-8.16.zip</Key>
</Contents>
<Contents>
<Key>kb-product-doc-observability-8.16.zip</Key>
</Contents>
<Contents>
<Key>kb-product-doc-security-8.16.zip</Key>
</Contents>
</ListBucketResult>
----

Then upload that xml file to the same CDN folder where the artifacts were uploaded, and then configure the folder to have that file
served as the folder's index.

*4. Configure {kib} to use the custom repository*

Add the following line to your {kib} configuration file:

[source,yaml]
----
# Replace with the path to the CDN folder previously configured
xpack.productDocBase.artifactRepositoryUrl: "https://my-custom-repository.example.com"
----

*5. Restart {kib}*

You should then be able to install the product documentation feature from the AI assistant management page.
1 change: 1 addition & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ Set this value to false to disable the Upgrade Assistant UI. *Default: true*
Set this value to change the {kib} interface language.
Valid locales are: `en`, `zh-CN`, `ja-JP`, `fr-FR`. *Default: `en`*

include::{kibana-root}/docs/settings/ai-assistant-settings.asciidoc[]
include::{kibana-root}/docs/settings/alert-action-settings.asciidoc[leveloffset=+1]
include::{kibana-root}/docs/settings/apm-settings.asciidoc[]
include::{kibana-root}/docs/settings/banners-settings.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export class ChromeService {
};

// Ensure developers are notified if working in a context that lacks the EUI Provider.
// @ts-expect-error
private handleEuiDevProviderWarning = (notifications: NotificationsStart) => {
const isDev = this.params.coreContext.env.mode.name === 'development';
if (isDev) {
Expand Down Expand Up @@ -240,7 +241,8 @@ export class ChromeService {
}: StartDeps): Promise<InternalChromeStart> {
this.initVisibility(application);
this.handleEuiFullScreenChanges();
this.handleEuiDevProviderWarning(notifications);
// commented out until https://github.com/elastic/kibana/issues/201805 can be fixed
// this.handleEuiDevProviderWarning(notifications);

const globalHelpExtensionMenuLinks$ = new BehaviorSubject<ChromeGlobalHelpExtensionMenuLink[]>(
[]
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-management/settings/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const KibanaSettingsApplication = ({
i18n,
notifications,
settings,
userProfile,
theme,
history,
sectionRegistry,
Expand All @@ -36,6 +37,7 @@ export const KibanaSettingsApplication = ({
<SettingsApplicationKibanaProvider
{...{
settings,
userProfile,
theme,
i18n,
notifications,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -31,10 +32,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-management/settings/application/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const SettingsApplicationKibanaProvider: FC<
const {
docLinks,
notifications,
userProfile,
theme,
i18n,
settings,
Expand Down Expand Up @@ -194,7 +195,7 @@ export const SettingsApplicationKibanaProvider: FC<

return (
<SettingsApplicationContext.Provider value={services}>
<FormKibanaProvider {...{ docLinks, notifications, theme, i18n, settings }}>
<FormKibanaProvider {...{ docLinks, notifications, userProfile, theme, i18n, settings }}>
{children}
</FormKibanaProvider>
</SettingsApplicationContext.Provider>
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-management/settings/application/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
"@kbn/management-settings-section-registry",
"@kbn/core-notifications-browser",
"@kbn/core-chrome-browser",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { I18nProvider } from '@kbn/i18n-react';
import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';

import { FieldInputProvider } from '../services';
import { FieldInputServices } from '../types';

const createRootMock = () => {
const analytics = analyticsServiceMock.createAnalyticsServiceStart();
const userProfile = userProfileServiceMock.createStart();
const i18n: I18nStart = {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
Expand All @@ -28,6 +30,7 @@ const createRootMock = () => {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"@kbn/core-analytics-browser-mocks",
"@kbn/core-ui-settings-browser",
"@kbn/code-editor",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -26,10 +27,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"@kbn/core-theme-browser-mocks",
"@kbn/core-i18n-browser",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-user-profile-browser-mocks",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React, { ReactChild } from 'react';
import { I18nProvider } from '@kbn/i18n-react';

import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { userProfileServiceMock } from '@kbn/core-user-profile-browser-mocks';
import { themeServiceMock } from '@kbn/core-theme-browser-mocks';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
Expand All @@ -25,10 +26,12 @@ const createRootMock = () => {
Context: ({ children }) => <I18nProvider>{children}</I18nProvider>,
};
const theme = themeServiceMock.createStartContract();
const userProfile = userProfileServiceMock.createStart();
return {
analytics,
i18n,
theme,
userProfile,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,23 @@ import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { ToastInput } from '@kbn/core-notifications-browser';
import { I18nStart } from '@kbn/core-i18n-browser';
import { ThemeServiceStart } from '@kbn/core-theme-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';

export const DATA_TEST_SUBJ_PAGE_RELOAD_BUTTON = 'pageReloadButton';

interface StartDeps {
theme: ThemeServiceStart;
i18n: I18nStart;
userProfile: UserProfileService;
}

/**
* Utility function for returning a {@link ToastInput} for displaying a prompt for reloading the page.
* @param theme The {@link ThemeServiceStart} contract.
* @param i18nStart The {@link I18nStart} contract.
* @returns A toast.
*/
export const reloadPageToast = (theme: ThemeServiceStart, i18nStart: I18nStart): ToastInput => {
export const reloadPageToast = (startDeps: StartDeps): ToastInput => {
return {
title: i18n.translate('management.settings.form.requiresPageReloadToastDescription', {
defaultMessage: 'One or more settings require you to reload the page to take effect.',
Expand All @@ -43,7 +50,7 @@ export const reloadPageToast = (theme: ThemeServiceStart, i18nStart: I18nStart):
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>,
{ i18n: i18nStart, theme }
startDeps
),
color: 'success',
toastLifeTimeMs: 15000,
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-management/settings/components/form/services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FormKibanaProvider: FC<PropsWithChildren<FormKibanaDependencies>> =
children,
...deps
}) => {
const { settings, notifications, docLinks, theme, i18n } = deps;
const { settings, notifications, docLinks, ...startDeps } = deps;

const services: Services = {
saveChanges: (changes, scope: UiSettingsScope) => {
Expand All @@ -57,7 +57,7 @@ export const FormKibanaProvider: FC<PropsWithChildren<FormKibanaDependencies>> =
return Promise.all(arr);
},
showError: (message: string) => notifications.toasts.addDanger(message),
showReloadPagePrompt: () => notifications.toasts.add(reloadPageToast(theme, i18n)),
showReloadPagePrompt: () => notifications.toasts.add(reloadPageToast(startDeps)),
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"@kbn/management-settings-utilities",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-ui-settings-common",
"@kbn/core-user-profile-browser-mocks",
"@kbn/core-user-profile-browser",
]
}
2 changes: 2 additions & 0 deletions packages/kbn-management/settings/components/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { I18nStart } from '@kbn/core-i18n-browser';
import { ThemeServiceStart } from '@kbn/core-theme-browser';
import { ToastsStart } from '@kbn/core-notifications-browser';
import { UiSettingsScope } from '@kbn/core-ui-settings-common';
import { UserProfileService } from '@kbn/core-user-profile-browser';

/**
* Contextual services used by a {@link Form} component.
Expand All @@ -42,6 +43,7 @@ interface KibanaDependencies {
globalClient: Pick<IUiSettingsClient, 'set'>;
};
theme: ThemeServiceStart;
userProfile: UserProfileService;
i18n: I18nStart;
/** The portion of the {@link ToastsStart} contract used by this component. */
notifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ kibana_vars=(
xpack.observability.unsafe.alertDetails.uptime.enabled
xpack.observability.unsafe.alertDetails.observability.enabled
xpack.observability.unsafe.thresholdRule.enabled
xpack.productDocBase.artifactRepositoryUrl
xpack.reporting.capture.browser.autoDownload
xpack.reporting.capture.browser.chromium.disableSandbox
xpack.reporting.capture.browser.chromium.inspect
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/console/public/types/plugin_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
*/

import type { FC } from 'react';
import type { AnalyticsServiceStart, I18nStart, ThemeServiceStart } from '@kbn/core/public';
import type {
AnalyticsServiceStart,
I18nStart,
ThemeServiceStart,
UserProfileService,
} from '@kbn/core/public';
import { HomePublicPluginSetup, HomePublicPluginStart } from '@kbn/home-plugin/public';
import { DevToolsSetup } from '@kbn/dev-tools-plugin/public';
import { UsageCollectionSetup, UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
Expand All @@ -21,6 +26,7 @@ export interface ConsoleStartServices {
analytics: Pick<AnalyticsServiceStart, 'reportEvent'>;
i18n: I18nStart;
theme: Pick<ThemeServiceStart, 'theme$'>;
userProfile: UserProfileService;
}

export interface AppSetupUIPluginDependencies {
Expand Down
Loading

0 comments on commit 34dca1b

Please sign in to comment.