Skip to content

Commit

Permalink
Merge branch 'inference-connector-dynamic-settings' of github.com:Yul…
Browse files Browse the repository at this point in the history
…Naumenko/kibana into inference-connector-dynamic-settings
  • Loading branch information
YulNaumenko committed Nov 6, 2024
2 parents 2935ff5 + 018b1a3 commit 0f1213a
Show file tree
Hide file tree
Showing 75 changed files with 2,239 additions and 497 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: bk-kibana-package-registry-promote
description: Promote package-registry/distribution:lite
links:
- url: 'https://buildkite.com/elastic/kibana-package-registry-promote'
title: Pipeline link
spec:
type: buildkite-pipeline
owner: 'group:kibana-operations'
system: buildkite
implementation:
apiVersion: buildkite.elastic.dev/v1
kind: Pipeline
metadata:
name: kibana / package registry promote
description: Promote package-registry/distribution:lite
spec:
env:
SLACK_NOTIFICATIONS_CHANNEL: "#kibana-operations-alerts"
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "false"
repository: elastic/kibana
branch_configuration: main
default_branch: main
pipeline_file: ".buildkite/pipelines/fleet/package_registry.yml"
provider_settings:
trigger_mode: none
teams:
everyone:
access_level: BUILD_AND_READ
kibana-operations:
access_level: MANAGE_BUILD_AND_READ
tags:
- kibana
1 change: 1 addition & 0 deletions .buildkite/pipeline-resource-definitions/locations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spec:
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-migration-staging.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-on-merge-unsupported-ftrs.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-on-merge.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-package-registry.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-performance-daily.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-performance-data-set-extraction-daily.yml
- https://github.com/elastic/kibana/blob/main/.buildkite/pipeline-resource-definitions/kibana-pointer-compression.yml
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/pipelines/fleet/package_registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
steps:
- command: echo "Placeholder"
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,9 @@ module.exports = {
*/
{
files: ['x-pack/plugins/fleet/**/*.{js,mjs,ts,tsx}'],
plugins: ['testing-library'],
rules: {
'testing-library/await-async-utils': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'import/order': [
'warn',
Expand Down Expand Up @@ -1954,6 +1956,16 @@ module.exports = {
},
},

/**
* Cloud Security Team overrides
*/
{
files: ['x-pack/plugins/cloud_security_posture/**/*.{js,mjs,ts,tsx}'],
plugins: ['testing-library'],
rules: {
'testing-library/await-async-utils': 'error',
},
},
/**
* Code inside .buildkite runs separately from everything else in CI, before bootstrap, with ts-node. It needs a few tweaks because of this.
*/
Expand Down
7 changes: 5 additions & 2 deletions dev_docs/tutorials/saved_objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SavedObjectsType } from 'src/core/server';

export const dashboardVisualization: SavedObjectsType = {
name: 'dashboard_visualization', [1]
hidden: true,
hidden: true, [3]
switchToModelVersionAt: '8.10.0', // this is the default, feel free to omit it unless you intend to switch to using model versions before 8.10.0
namespaceType: 'multiple-isolated', [2]
mappings: {
Expand Down Expand Up @@ -46,6 +46,9 @@ these should follow our API URL path convention and always be written in snake c
that objects of this type can only exist in a single space. See
<DocLink id="kibDevDocsSavedObjectsIntro" section="sharing-saved-objects" text="Sharing Saved Objects"/> for more information.

[3] This field determines whether repositories have access to the type by default. Hidden types will not be automatically exposed via the Saved Objects Client APIs.
Hidden types must be listed in `SavedObjectsClientProviderOptions[includedHiddenTypes]` to be accessible by the client.

**src/plugins/my_plugin/server/saved_objects/index.ts**

```ts
Expand Down Expand Up @@ -301,4 +304,4 @@ export const foo: SavedObjectsType = {

[1] Needs to be `false` to use the `hiddenFromHttpApis` option

[2] Set this to `true` to build your own HTTP API and have complete control over the route handler.
[2] Set this to `true` to build your own HTTP API and have complete control over the route handler.
16 changes: 10 additions & 6 deletions examples/guided_onboarding_example/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { AppMountParameters, CoreStart } from '@kbn/core/public';
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
import { AppPluginStartDependencies } from './types';
import { GuidedOnboardingExampleApp } from './components/app';

export const renderApp = (
{ notifications }: CoreStart,
coreStart: CoreStart,
{ guidedOnboarding }: AppPluginStartDependencies,
{ element, history }: AppMountParameters
) => {
const { notifications } = coreStart;
ReactDOM.render(
<GuidedOnboardingExampleApp
notifications={notifications}
guidedOnboarding={guidedOnboarding}
history={history}
/>,
<KibanaRenderContextProvider {...coreStart}>
<GuidedOnboardingExampleApp
notifications={notifications}
guidedOnboarding={guidedOnboarding}
history={history}
/>
</KibanaRenderContextProvider>,
element
);

Expand Down
111 changes: 54 additions & 57 deletions examples/guided_onboarding_example/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
*/

import React from 'react';
import { FormattedMessage, I18nProvider } from '@kbn/i18n-react';
import { FormattedMessage } from '@kbn/i18n-react';
import { Routes, Router, Route } from '@kbn/shared-ux-router';
import { EuiPageTemplate } from '@elastic/eui';
import { CoreStart, ScopedHistory } from '@kbn/core/public';

import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public/types';
import { StepTwo } from './step_two';
import { StepOne } from './step_one';
Expand All @@ -30,62 +29,60 @@ export const GuidedOnboardingExampleApp = (props: GuidedOnboardingExampleAppDeps
const { notifications, guidedOnboarding, history } = props;

return (
<I18nProvider>
<EuiPageTemplate restrictWidth={true} panelled={true}>
<EuiPageTemplate.Header
pageTitle={
<FormattedMessage
id="guidedOnboardingExample.title"
defaultMessage="Guided onboarding examples"
/>
<EuiPageTemplate restrictWidth={true} panelled={true}>
<EuiPageTemplate.Header
pageTitle={
<FormattedMessage
id="guidedOnboardingExample.title"
defaultMessage="Guided onboarding examples"
/>
}
/>
{guidedOnboarding?.guidedOnboardingApi?.isEnabled ? (
<EuiPageTemplate.Section>
<Router history={history}>
<Routes>
<Route exact path="/">
<Main notifications={notifications} guidedOnboarding={guidedOnboarding} />
</Route>
<Route exact path="/stepOne">
<StepOne guidedOnboarding={guidedOnboarding} />
</Route>
<Route exact path="/stepTwo">
<StepTwo />
</Route>
<Route exact path="/stepThree">
<StepThree guidedOnboarding={guidedOnboarding} />
</Route>
<Route path="/stepFour/:indexName?">
<StepFour guidedOnboarding={guidedOnboarding} />
</Route>
</Routes>
</Router>
</EuiPageTemplate.Section>
) : (
<EuiPageTemplate.EmptyPrompt
iconType="error"
color="danger"
title={
<h2>
<FormattedMessage
id="guidedOnboardingExample.errorTitle"
defaultMessage="Guided onboarding is disabled"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="guidedOnboardingExample.errorDescription"
defaultMessage="Make sure your Kibana instance runs on Cloud and/or
your user has access to Setup guides feature."
/>
</p>
}
/>
{guidedOnboarding?.guidedOnboardingApi?.isEnabled ? (
<EuiPageTemplate.Section>
<Router history={history}>
<Routes>
<Route exact path="/">
<Main notifications={notifications} guidedOnboarding={guidedOnboarding} />
</Route>
<Route exact path="/stepOne">
<StepOne guidedOnboarding={guidedOnboarding} />
</Route>
<Route exact path="/stepTwo">
<StepTwo />
</Route>
<Route exact path="/stepThree">
<StepThree guidedOnboarding={guidedOnboarding} />
</Route>
<Route path="/stepFour/:indexName?">
<StepFour guidedOnboarding={guidedOnboarding} />
</Route>
</Routes>
</Router>
</EuiPageTemplate.Section>
) : (
<EuiPageTemplate.EmptyPrompt
iconType="error"
color="danger"
title={
<h2>
<FormattedMessage
id="guidedOnboardingExample.errorTitle"
defaultMessage="Guided onboarding is disabled"
/>
</h2>
}
body={
<p>
<FormattedMessage
id="guidedOnboardingExample.errorDescription"
defaultMessage="Make sure your Kibana instance runs on Cloud and/or
your user has access to Setup guides feature."
/>
</p>
}
/>
)}
</EuiPageTemplate>
</I18nProvider>
)}
</EuiPageTemplate>
);
};
1 change: 1 addition & 0 deletions examples/guided_onboarding_example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@kbn/i18n",
"@kbn/guided-onboarding",
"@kbn/shared-ux-router",
"@kbn/react-kibana-context-render",
],
"exclude": [
"target/**/*",
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1027,10 +1027,10 @@
"@mapbox/mapbox-gl-rtl-text": "0.2.3",
"@mapbox/mapbox-gl-supported": "2.0.1",
"@mapbox/vector-tile": "1.3.1",
"@openfeature/core": "^1.4.0",
"@openfeature/core": "^1.5.0",
"@openfeature/launchdarkly-client-provider": "^0.3.0",
"@openfeature/server-sdk": "^1.15.1",
"@openfeature/web-sdk": "^1.2.4",
"@openfeature/server-sdk": "^1.16.1",
"@openfeature/web-sdk": "^1.3.1",
"@opentelemetry/api": "^1.1.0",
"@opentelemetry/api-metrics": "^0.31.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.34.0",
Expand Down Expand Up @@ -1497,7 +1497,7 @@
"@octokit/rest": "^17.11.2",
"@parcel/watcher": "^2.1.0",
"@playwright/test": "=1.46.0",
"@redocly/cli": "^1.25.8",
"@redocly/cli": "^1.25.9",
"@statoscope/webpack-plugin": "^5.28.2",
"@storybook/addon-a11y": "^6.5.16",
"@storybook/addon-actions": "^6.5.16",
Expand Down Expand Up @@ -1714,6 +1714,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-perf": "^3.3.1",
"eslint-plugin-testing-library": "^6.4.0",
"eslint-traverse": "^1.0.0",
"exit-hook": "^2.2.0",
"expect": "^29.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export interface SavedObjectsType<Attributes = any> {
* The hidden types will not be automatically exposed via the HTTP API.
* Therefore, that should prevent unexpected behavior in the client code, as all the interactions will be done via the plugin API.
*
* Hidden types must be listed to be accessible by the client.
*
* (await context.core).savedObjects.getClient({ includeHiddenTypes: [MY_PLUGIN_HIDDEN_SAVED_OBJECT_TYPE] })
*
* See {@link SavedObjectsServiceStart.createInternalRepository | createInternalRepository}.
*
*/
hidden: boolean;
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-visualization-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ export { getTimeZone } from './src/get_timezone';
export { getLensAttributesFromSuggestion } from './src/get_lens_attributes';
export { TooltipWrapper } from './src/tooltip_wrapper';
export { useDebouncedValue } from './src/debounced_value';
export { ChartType } from './src/types';
export { getDatasourceId } from './src/get_datasource_id';
export { mapVisToChartType } from './src/map_vis_to_chart_type';
17 changes: 17 additions & 0 deletions packages/kbn-visualization-utils/src/get_datasource_id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export const getDatasourceId = (datasourceStates: Record<string, unknown>) => {
const datasourceId: 'formBased' | 'textBased' | undefined = [
'formBased' as const,
'textBased' as const,
].find((key) => Boolean(datasourceStates[key]));

return datasourceId;
};
32 changes: 32 additions & 0 deletions packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { ChartType, LensVisualizationType } from './types';

type ValueOf<T> = T[keyof T];
type LensToChartMap = {
[K in ValueOf<typeof LensVisualizationType>]: ChartType;
};
const lensTypesToChartTypes: LensToChartMap = {
[LensVisualizationType.XY]: ChartType.XY,
[LensVisualizationType.Metric]: ChartType.Metric,
[LensVisualizationType.LegacyMetric]: ChartType.Metric,
[LensVisualizationType.Pie]: ChartType.Pie,
[LensVisualizationType.Heatmap]: ChartType.Heatmap,
[LensVisualizationType.Gauge]: ChartType.Gauge,
[LensVisualizationType.Datatable]: ChartType.Table,
};
function isLensVisualizationType(value: string): value is LensVisualizationType {
return Object.values(LensVisualizationType).includes(value as LensVisualizationType);
}
export const mapVisToChartType = (visualizationType: string) => {
if (isLensVisualizationType(visualizationType)) {
return lensTypesToChartTypes[visualizationType];
}
};
Loading

0 comments on commit 0f1213a

Please sign in to comment.