Skip to content

Commit

Permalink
Merge branch 'elastic:main' into fix-index-management-link-in-es3
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiul-TheSoccerFan authored Nov 18, 2024
2 parents 8a9c591 + 853b59c commit ceffc7a
Show file tree
Hide file tree
Showing 166 changed files with 2,212 additions and 3,489 deletions.
63 changes: 53 additions & 10 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ packages/core/plugins/core-plugins-server-mocks @elastic/kibana-core
packages/core/preboot/core-preboot-server @elastic/kibana-core
packages/core/preboot/core-preboot-server-internal @elastic/kibana-core
packages/core/preboot/core-preboot-server-mocks @elastic/kibana-core
packages/core/rendering/core-rendering-browser @elastic/kibana-core
packages/core/rendering/core-rendering-browser-internal @elastic/kibana-core
packages/core/rendering/core-rendering-browser-mocks @elastic/kibana-core
packages/core/rendering/core-rendering-server-internal @elastic/kibana-core
Expand Down Expand Up @@ -1368,7 +1369,23 @@ x-pack/test_serverless/**/test_suites/observability/ai_assistant @elastic/obs-ai
### END Observability Plugins

# Presentation
/x-pack/test/disable_ems @elastic/kibana-presentation
/test/interpreter_functional/snapshots @elastic/kibana-presentation # Assigned per https://github.com/elastic/kibana/pull/54342
/test/functional/services/inspector.ts @elastic/kibana-presentation
/x-pack/test/functional/services/canvas_element.ts @elastic/kibana-presentation
/x-pack/test/functional/page_objects/canvas_page.ts @elastic/kibana-presentation
/x-pack/test/accessibility/apps/group3/canvas.ts @elastic/kibana-presentation
/x-pack/test/upgrade/apps/canvas @elastic/kibana-presentation
/x-pack/test/upgrade/apps/dashboard @elastic/kibana-presentation
/test/functional/screenshots/baseline/tsvb_dashboard.png @elastic/kibana-presentation
/test/functional/screenshots/baseline/dashboard_*.png @elastic/kibana-presentation
/test/functional/screenshots/baseline/area_chart.png @elastic/kibana-presentation
/x-pack/test/disable_ems @elastic/kibana-presentation # Assigned per https://github.com/elastic/kibana/pull/165986
/x-pack/test/functional/fixtures/kbn_archiver/dashboard* @elastic/kibana-presentation
/test/functional/page_objects/dashboard_page* @elastic/kibana-presentation
/test/functional/firefox/dashboard.config.ts @elastic/kibana-presentation # Assigned per: https://github.com/elastic/kibana/issues/15023
/test/functional/fixtures/es_archiver/dashboard @elastic/kibana-presentation # Assigned per: https://github.com/elastic/kibana/issues/15023
/test/accessibility/apps/dashboard.ts @elastic/kibana-presentation
/test/accessibility/apps/filter_panel.ts @elastic/kibana-presentation
/x-pack/test/functional/apps/dashboard @elastic/kibana-presentation
/x-pack/test/accessibility/apps/group3/maps.ts @elastic/kibana-presentation
/x-pack/test/accessibility/apps/group1/dashboard_panel_options.ts @elastic/kibana-presentation
Expand All @@ -1382,6 +1399,17 @@ x-pack/test_serverless/**/test_suites/observability/ai_assistant @elastic/obs-ai
/test/plugin_functional/test_suites/panel_actions @elastic/kibana-presentation
/x-pack/test/functional/es_archives/canvas/logstash_lens @elastic/kibana-presentation
#CC# /src/plugins/kibana_react/public/code_editor/ @elastic/kibana-presentation
/x-pack/test/upgrade/services/maps_upgrade_services.ts @elastic/kibana-presentation
/x-pack/test/stack_functional_integration/apps/maps @elastic/kibana-presentation
/x-pack/test/functional/page_objects/geo_file_upload.ts @elastic/kibana-presentation
/x-pack/test/functional/page_objects/gis_page.ts @elastic/kibana-presentation
/x-pack/test/upgrade/apps/maps @elastic/kibana-presentation
/x-pack/test/api_integration/apis/maps/ @elastic/kibana-presentation
/x-pack/test/functional/apps/maps/ @elastic/kibana-presentation
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-presentation
/x-pack/plugins/stack_alerts/server/rule_types/geo_containment @elastic/kibana-presentation
/x-pack/plugins/stack_alerts/public/rule_types/geo_containment @elastic/kibana-presentation


# Machine Learning
/x-pack/test/stack_functional_integration/apps/ml @elastic/ml-ui
Expand Down Expand Up @@ -1421,15 +1449,6 @@ x-pack/test_serverless/**/test_suites/observability/ai_assistant @elastic/obs-ai
/x-pack/test/functional/services/aiops @elastic/ml-ui
/x-pack/test/functional_basic/apps/transform/ @elastic/ml-ui

# Maps
#CC# /x-pack/plugins/maps/ @elastic/kibana-gis
/x-pack/test/api_integration/apis/maps/ @elastic/kibana-gis
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/rule_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/rule_types/geo_containment @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis

# Operations
/test/package @elastic/kibana-operations
/test/package/roles @elastic/kibana-operations
Expand Down Expand Up @@ -1584,6 +1603,8 @@ x-pack/test/api_integration/deployment_agnostic/services/ @elastic/appex-qa
x-pack/test/**/deployment_agnostic/ @elastic/appex-qa #temporarily to monitor tests migration

# Core
/test/api_integration/apis/general/*.js @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/199795/files/894a8ede3f9d0398c5af56bf5a82654a9bc0610b#r1846691639
/x-pack/test/plugin_api_integration/plugins/feature_usage_test @elastic/kibana-core
/test/plugin_functional/plugins/rendering_plugin @elastic/kibana-core
/test/plugin_functional/plugins/session_notifications @elastic/kibana-core
/x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core
Expand Down Expand Up @@ -1640,6 +1661,28 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
#CC# /x-pack/plugins/translations/ @elastic/kibana-localization @elastic/kibana-core

# Kibana Platform Security
# security
/x-pack/test_serverless/functional/test_suites/observability/role_management @elastic/kibana-security
/x-pack/test/functional/config_security_basic.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/user_profile_page.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/space_selector_page.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/security_page.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/role_mappings_page.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/copy_saved_objects_to_space_page.ts @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/39002
/x-pack/test/functional/page_objects/api_keys_page.ts @elastic/kibana-security
/x-pack/test/functional/page_objects/account_settings_page.ts @elastic/kibana-security
/x-pack/test/functional/apps/user_profiles @elastic/kibana-security
/x-pack/test/common/services/spaces.ts @elastic/kibana-security
/x-pack/test/api_integration/config_security_*.ts @elastic/kibana-security
/x-pack/test/functional/apps/api_keys @elastic/kibana-security
/x-pack/test/ftr_apis/security_and_spaces @elastic/kibana-security
/test/server_integration/services/supertest.js @elastic/kibana-security @elastic/kibana-core
/test/server_integration/http/ssl @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/53810
/test/server_integration/http/ssl_with_p12 @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/199795#discussion_r1846522206
/test/server_integration/http/ssl_with_p12_intermediate @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/199795#discussion_r1846522206

/test/server_integration/config.base.js @elastic/kibana-security @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/199795#discussion_r1846510782
/test/server_integration/__fixtures__ @elastic/kibana-security # Assigned per https://github.com/elastic/kibana/pull/53810
/.github/codeql @elastic/kibana-security
/.github/workflows/codeql.yml @elastic/kibana-security
/.github/workflows/codeql-stats.yml @elastic/kibana-security
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@
"@kbn/core-preboot-server": "link:packages/core/preboot/core-preboot-server",
"@kbn/core-preboot-server-internal": "link:packages/core/preboot/core-preboot-server-internal",
"@kbn/core-provider-plugin": "link:test/plugin_functional/plugins/core_provider_plugin",
"@kbn/core-rendering-browser": "link:packages/core/rendering/core-rendering-browser",
"@kbn/core-rendering-browser-internal": "link:packages/core/rendering/core-rendering-browser-internal",
"@kbn/core-rendering-server-internal": "link:packages/core/rendering/core-rendering-server-internal",
"@kbn/core-root-browser-internal": "link:packages/core/root/core-root-browser-internal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { I18nStart } from '@kbn/core-i18n-browser';
import type { OverlayStart } from '@kbn/core-overlays-browser';
import type { ThemeServiceStart } from '@kbn/core-theme-browser';
import { KibanaRootContextProvider } from '@kbn/react-kibana-context-root';
import { APP_FIXED_VIEWPORT_ID } from '@kbn/core-rendering-browser';
import { AppWrapper } from './app_containers';

interface StartServices {
Expand Down Expand Up @@ -68,7 +69,7 @@ export class RenderingService {
{/* The App Wrapper outside of the fixed headers that accepts custom class names from apps */}
<AppWrapper chromeVisible$={chrome.getIsVisible$()}>
{/* Affixes a div to restrict the position of charts tooltip to the visible viewport minus the header */}
<div id="app-fixed-viewport" />
<div id={APP_FIXED_VIEWPORT_ID} />

{/* The actual plugin/app */}
{appComponent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"@kbn/core-analytics-browser-mocks",
"@kbn/core-analytics-browser",
"@kbn/core-i18n-browser",
"@kbn/core-theme-browser"
"@kbn/core-theme-browser",
"@kbn/core-rendering-browser"
],
"exclude": [
"target/**/*",
Expand Down
4 changes: 4 additions & 0 deletions packages/core/rendering/core-rendering-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @kbn/core-rendering-browser

This package contains the types and implementation for Core's browser-side rendering service.

10 changes: 10 additions & 0 deletions packages/core/rendering/core-rendering-browser/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 { APP_FIXED_VIEWPORT_ID, useAppFixedViewport } from './src';
14 changes: 14 additions & 0 deletions packages/core/rendering/core-rendering-browser/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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".
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../../..',
roots: ['<rootDir>/packages/core/rendering/core-rendering-browser'],
};
5 changes: 5 additions & 0 deletions packages/core/rendering/core-rendering-browser/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "shared-browser",
"id": "@kbn/core-rendering-browser",
"owner": "@elastic/kibana-core"
}
7 changes: 7 additions & 0 deletions packages/core/rendering/core-rendering-browser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@kbn/core-rendering-browser",
"private": true,
"version": "1.0.0",
"author": "Kibana Core",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
}
10 changes: 10 additions & 0 deletions packages/core/rendering/core-rendering-browser/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 { APP_FIXED_VIEWPORT_ID, useAppFixedViewport } from './use_app_fixed_viewport';
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".
*/

import { useRef } from 'react';

export const APP_FIXED_VIEWPORT_ID = 'app-fixed-viewport';

export function useAppFixedViewport() {
const ref = useRef(document.getElementById(APP_FIXED_VIEWPORT_ID) ?? undefined);
return ref.current;
}
19 changes: 19 additions & 0 deletions packages/core/rendering/core-rendering-browser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node",
"react"
]
},
"include": [
"**/*.ts",
"**/*.tsx",
],
"kbn_references": [],
"exclude": [
"target/**/*",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,36 @@ describe('validateReferences()', () => {
'Error fetching references for imported objects'
);
});

// test that when references are missing returns only deduplicated errors
test('returns only deduplicated errors when references are missing', async () => {
const params = setup({
objects: [
{
id: '2',
type: 'visualization',
attributes: { title: 'My Visualization 2' },
references: [
{ name: 'ref_0', type: 'index-pattern', id: '3' },
{ name: 'ref_0', type: 'index-pattern', id: '3' },
],
},
],
});
params.savedObjectsClient.bulkGet.mockResolvedValue({
saved_objects: [createNotFoundError({ type: 'index-pattern', id: '3' })],
});

const result = await validateReferences(params);
expect(result).toEqual([
expect.objectContaining({
type: 'visualization',
id: '2',
error: {
type: 'missing_references',
references: [{ type: 'index-pattern', id: '3' }],
},
}),
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,35 @@ export async function validateReferences(params: ValidateReferencesParams) {
const nonExistingReferenceKeys = await getNonExistingReferenceAsKeys(params);

// Filter out objects with missing references, add to error object
objects.forEach(({ type, id, references, attributes }) => {
if (objectsToSkip.has(`${type}:${id}`)) {
for (const obj of objects) {
const { type, id, references, attributes } = obj;
const objectKey = `${type}:${id}`;
if (objectsToSkip.has(objectKey)) {
// skip objects with retries that have specified `ignoreMissingReferences`
return;
continue;
}

const missingReferences = [];
const enforcedTypeReferences = (references || []).filter(filterReferencesToValidate);
const missingReferences: Array<{ type: string; id: string }> = [];
const enforcedTypeReferences = references?.filter(filterReferencesToValidate) || [];

const seenReferences = new Set();
for (const { type: refType, id: refId } of enforcedTypeReferences) {
if (nonExistingReferenceKeys.includes(`${refType}:${refId}`)) {
const refKey = `${refType}:${refId}`;

if (nonExistingReferenceKeys.includes(refKey) && !seenReferences.has(refKey)) {
missingReferences.push({ type: refType, id: refId });
seenReferences.add(refKey);
}
}
if (missingReferences.length === 0) {
return;
if (missingReferences.length > 0) {
errorMap[objectKey] = {
id,
type,
meta: { title: attributes.title },
error: { type: 'missing_references', references: missingReferences },
};
}
const { title } = attributes;
errorMap[`${type}:${id}`] = {
id,
type,
meta: { title },
error: { type: 'missing_references', references: missingReferences },
};
});
}

return Object.values(errorMap);
}
7 changes: 2 additions & 5 deletions packages/kbn-esql-editor/src/esql_editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,20 @@ import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { ESQLEditor } from './esql_editor';
import type { ESQLEditorProps } from './types';
import { ReactWrapper } from 'enzyme';
import { of } from 'rxjs';
import { coreMock } from '@kbn/core/server/mocks';

describe('ESQLEditor', () => {
const uiConfig: Record<string, any> = {};
const uiSettings = {
get: (key: string) => uiConfig[key],
} as IUiSettingsClient;
const theme = {
theme$: of({ darkMode: false }),
};

const services = {
uiSettings,
settings: {
client: uiSettings,
},
theme,
core: coreMock.createStart(),
};

function renderESQLEditorComponent(testProps: ESQLEditorProps) {
Expand Down
14 changes: 11 additions & 3 deletions packages/kbn-esql-editor/src/esql_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { AggregateQuery } from '@kbn/es-query';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { ESQLLang, ESQL_LANG_ID, ESQL_THEME_ID, monaco, type ESQLCallbacks } from '@kbn/monaco';
import {
ESQLLang,
ESQL_LANG_ID,
ESQL_DARK_THEME_ID,
ESQL_LIGHT_THEME_ID,
monaco,
type ESQLCallbacks,
} from '@kbn/monaco';
import memoize from 'lodash/memoize';
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
Expand Down Expand Up @@ -91,7 +98,8 @@ export const ESQLEditor = memo(function ESQLEditor({
fieldsMetadata,
uiSettings,
} = kibana.services;
const timeZone = core?.uiSettings?.get('dateFormat:tz');
const darkMode = core.theme?.getTheme().darkMode;
const timeZone = uiSettings?.get('dateFormat:tz');
const histogramBarTarget = uiSettings?.get('histogram:barTarget') ?? 50;
const [code, setCode] = useState<string>(query.esql ?? '');
// To make server side errors less "sticky", register the state of the code when submitting
Expand Down Expand Up @@ -597,7 +605,7 @@ export const ESQLEditor = memo(function ESQLEditor({
vertical: 'auto',
},
scrollBeyondLastLine: false,
theme: ESQL_THEME_ID,
theme: darkMode ? ESQL_DARK_THEME_ID : ESQL_LIGHT_THEME_ID,
wordWrap: 'on',
wrappingIndent: 'none',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import { ESQLRealField } from '../validation/types';
import { fieldTypes } from '../definitions/types';

export const fields: ESQLRealField[] = [
...fieldTypes
.map((type) => ({ name: `${camelCase(type)}Field`, type }))
.filter((f) => f.type !== 'unsupported'),
...fieldTypes.map((type) => ({ name: `${camelCase(type)}Field`, type })),
{ name: 'any#Char$Field', type: 'double' },
{ name: 'kubernetes.something.something', type: 'double' },
{ name: '@timestamp', type: 'date' },
Expand Down
Loading

0 comments on commit ceffc7a

Please sign in to comment.