Skip to content

Commit

Permalink
Merge branch 'main' into de_8_18/deprecate-signals-migration-apis
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliidm authored Dec 3, 2024
2 parents eaf6555 + 27e828c commit df718ab
Show file tree
Hide file tree
Showing 174 changed files with 1,279 additions and 7,905 deletions.
1 change: 0 additions & 1 deletion .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ enabled:
- test/functional/apps/dashboard/group5/config.ts
- test/functional/apps/dashboard/group6/config.ts
- test/functional/apps/discover/ccs_compatibility/config.ts
- test/functional/apps/discover/classic/config.ts
- test/functional/apps/discover/embeddable/config.ts
- test/functional/apps/discover/esql/config.ts
- test/functional/apps/discover/group1/config.ts
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@ x-pack/plugins/ai_infra/llm_tasks @elastic/appex-ai-infra
x-pack/plugins/ai_infra/product_doc_base @elastic/appex-ai-infra
x-pack/plugins/aiops @elastic/ml-ui
x-pack/plugins/alerting @elastic/response-ops
x-pack/plugins/asset_inventory @elastic/kibana-cloud-security-posture
x-pack/plugins/banners @elastic/appex-sharedux
x-pack/plugins/canvas @elastic/kibana-presentation
x-pack/plugins/cases @elastic/response-ops
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 @@ -470,6 +470,10 @@ The plugin exposes the static DefaultEditorController class to consume.
|WARNING: Missing README.
|{kib-repo}blob/{branch}/x-pack/plugins/asset_inventory/README.md[assetInventory]
|Centralized asset inventory experience within the Elastic Security solution. A central place for users to view and manage all their assets from different environments.
|{kib-repo}blob/{branch}/x-pack/plugins/banners/README.md[banners]
|Allow to add a header banner that will be displayed on every page of the Kibana application
Expand Down
12 changes: 0 additions & 12 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,6 @@ The default refresh interval for the time filter. Example:
[[timepicker-timedefaults]]`timepicker:timeDefaults`::
The default selection in the time filter.

[[truncate-maxheight]]`truncate:maxHeight`::
deprecated:[8.16.0]The maximum height that a cell occupies in a table. Set to 0 to disable
truncation.

[[enableESQL]]`enableESQL`::
This setting enables ES|QL in Kibana.

Expand Down Expand Up @@ -340,14 +336,6 @@ Hides the "Time" column in *Discover* and in all saved searches on dashboards.
Highlights results in *Discover* and saved searches on dashboards. Highlighting
slows requests when working on big documents.

[[doctable-legacy]]`doc_table:legacy`::
deprecated:[8.15.0] Controls the way the document table looks and works.
To use the new *Document Explorer* instead of the classic view, turn off this option.
The *Document Explorer* offers better data sorting, resizable columns, and a full screen view.

[[truncate-max-height]]`truncate:maxHeight`::
The maximum height that a cell in a table can occupy. To disable truncation, set to 0.


[float]
[[kibana-ml-settings]]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"@kbn/apm-utils": "link:packages/kbn-apm-utils",
"@kbn/app-link-test-plugin": "link:test/plugin_functional/plugins/app_link_test",
"@kbn/application-usage-test-plugin": "link:x-pack/test/usage_collection/plugins/application_usage_test",
"@kbn/asset-inventory-plugin": "link:x-pack/plugins/asset_inventory",
"@kbn/audit-log-plugin": "link:x-pack/test/security_api_integration/plugins/audit_log",
"@kbn/avc-banner": "link:packages/kbn-avc-banner",
"@kbn/banners-plugin": "link:x-pack/plugins/banners",
Expand Down
4 changes: 0 additions & 4 deletions packages/kbn-discover-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export {
DEFAULT_ALLOWED_LOGS_BASE_PATTERNS,
DEFAULT_COLUMNS_SETTING,
DOC_HIDE_TIME_COLUMN_SETTING,
DOC_TABLE_LEGACY,
FIELDS_LIMIT_SETTING,
HIDE_ANNOUNCEMENTS,
MAX_DOC_FIELDS_DISPLAYED,
Expand All @@ -28,8 +27,6 @@ export {
SHOW_FIELD_STATISTICS,
SHOW_MULTIFIELDS,
SORT_DEFAULT_ORDER_SETTING,
TRUNCATE_MAX_HEIGHT,
TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE,
IgnoredReason,
buildDataTableRecord,
buildDataTableRecordList,
Expand All @@ -45,7 +42,6 @@ export {
getMessageFieldWithFallbacks,
getShouldShowFieldHandler,
isNestedFieldParent,
isLegacyTableEnabled,
usePager,
calcFieldCounts,
getLogLevelColor,
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-discover-utils/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const CONTEXT_STEP_SETTING = 'context:step';
export const CONTEXT_TIE_BREAKER_FIELDS_SETTING = 'context:tieBreakerFields';
export const DEFAULT_COLUMNS_SETTING = 'defaultColumns';
export const DOC_HIDE_TIME_COLUMN_SETTING = 'doc_table:hideTimeColumn';
export const DOC_TABLE_LEGACY = 'doc_table:legacy';
export const FIELDS_LIMIT_SETTING = 'fields:popularLimit';
export const HIDE_ANNOUNCEMENTS = 'hideAnnouncements';
export const MAX_DOC_FIELDS_DISPLAYED = 'discover:maxDocFieldsDisplayed';
Expand All @@ -26,5 +25,3 @@ export const SEARCH_ON_PAGE_LOAD_SETTING = 'discover:searchOnPageLoad';
export const SHOW_FIELD_STATISTICS = 'discover:showFieldStatistics';
export const SHOW_MULTIFIELDS = 'discover:showMultiFields';
export const SORT_DEFAULT_ORDER_SETTING = 'discover:sort:defaultOrder';
export const TRUNCATE_MAX_HEIGHT = 'truncate:maxHeight';
export const TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE = 115;
2 changes: 1 addition & 1 deletion packages/kbn-discover-utils/src/utils/build_data_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type { DataTableRecord, EsHitRecord } from '../types';
import { getDocId } from './get_doc_id';

/**
* Build a record for data table, explorer + classic one
* Build a record for data grid
* @param doc the document returned from Elasticsearch
* @param dataView this current data view
* @param isAnchor determines if the given doc is the anchor doc when viewing surrounding documents
Expand Down
30 changes: 30 additions & 0 deletions packages/kbn-discover-utils/src/utils/format_hit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,36 @@ describe('formatHit', () => {
]);
});

it('should highlight a subfield even shouldShowFieldHandler determines it should not be shown ', () => {
const highlightHit = buildDataTableRecord(
{
_id: '2',
_index: 'logs',
fields: {
object: ['object'],
'object.value': [42, 13],
},
highlight: { 'object.value': ['%%'] },
},
dataViewMock
);

const formatted = formatHit(
highlightHit,
dataViewMock,
(fieldName) => ['object'].includes(fieldName),
220,
fieldFormatsMock
);

expect(formatted).toEqual([
['object.value', 'formatted:42,13', 'object.value'],
['object', ['object'], 'object'],
['_index', 'formatted:logs', '_index'],
['_score', undefined, '_score'],
]);
});

it('should filter fields based on their real name not displayName', () => {
const formatted = formatHit(
row,
Expand Down
9 changes: 7 additions & 2 deletions packages/kbn-discover-utils/src/utils/format_hit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ export function formatHit(
const pairs = highlights[key] ? renderedPairs : otherPairs;

// If the field is a mapped field, we first check if it should be shown,
// if not we always include it into the result.
// or if it's highlighted, but the parent is not.
// If not we always include it into the result.
if (displayKey) {
if (shouldShowFieldHandler(key)) {
const multiParent = field.getSubtypeMulti?.()?.multi.parent;
const isHighlighted = Boolean(highlights[key]);
const isParentHighlighted = Boolean(multiParent && highlights[multiParent]);

if ((isHighlighted && !isParentHighlighted) || shouldShowFieldHandler(key)) {
pairs.push([displayKey, undefined, key]);
}
} else {
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-discover-utils/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ export * from './nested_fields';
export * from './get_field_value';
export * from './calc_field_counts';
export * from './get_visible_columns';
export { isLegacyTableEnabled } from './is_legacy_table_enabled';
export { DiscoverFlyouts, dismissAllFlyoutsExceptFor, dismissFlyouts } from './dismiss_flyouts';
25 changes: 0 additions & 25 deletions packages/kbn-discover-utils/src/utils/is_legacy_table_enabled.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/kbn-discover-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@kbn/field-formats-plugin",
"@kbn/field-types",
"@kbn/i18n",
"@kbn/core-ui-settings-browser",
"@kbn/expressions-plugin",
"@kbn/logs-data-access-plugin",
"@kbn/i18n-react",
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-management/settings/setting_ids/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ export const DISCOVER_SHOW_MULTI_FIELDS_ID = 'discover:showMultiFields';
export const DISCOVER_SORT_DEFAULT_ORDER_ID = 'discover:sort:defaultOrder';
export const DOC_TABLE_HIDE_TIME_COLUMNS_ID = 'doc_table:hideTimeColumn';
export const DOC_TABLE_HIGHLIGHT_ID = 'doc_table:highlight';
export const DOC_TABLE_LEGACY_ID = 'doc_table:legacy';
export const TRUNCATE_MAX_HEIGHT_ID = 'truncate:maxHeight';

// Machine learning settings
export const ML_ANOMALY_DETECTION_RESULTS_ENABLE_TIME_DEFAULTS_ID =
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pageLoadAssetSize:
aiops: 17680
alerting: 106936
apm: 64385
assetInventory: 18478
banners: 17946
bfetch: 22837
canvas: 29355
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Unified data table source document cell rendering', function () {
/>
);
expect(component.html()).toMatchInlineSnapshot(
`"<dl class=\\"euiDescriptionList unifiedDataTable__descriptionList unifiedDataTable__cellValue css-id58dh-euiDescriptionList-inline-left\\" data-test-subj=\\"discoverCellDescriptionList\\" data-type=\\"inline\\"><dt class=\\"euiDescriptionList__title unifiedDataTable__descriptionListTitle css-1fizlic-euiDescriptionList__title-inline-compressed\\">_index</dt><dd class=\\"euiDescriptionList__description unifiedDataTable__descriptionListDescription css-11rdew2-euiDescriptionList__description-inline-compressed\\">test</dd><dt class=\\"euiDescriptionList__title unifiedDataTable__descriptionListTitle css-1fizlic-euiDescriptionList__title-inline-compressed\\">_score</dt><dd class=\\"euiDescriptionList__description unifiedDataTable__descriptionListDescription css-11rdew2-euiDescriptionList__description-inline-compressed\\">1</dd></dl>"`
`"<dl class=\\"euiDescriptionList unifiedDataTable__descriptionList unifiedDataTable__cellValue css-id58dh-euiDescriptionList-inline-left\\" data-test-subj=\\"discoverCellDescriptionList\\" data-type=\\"inline\\"><dt class=\\"euiDescriptionList__title unifiedDataTable__descriptionListTitle css-1fizlic-euiDescriptionList__title-inline-compressed\\">extension</dt><dd class=\\"euiDescriptionList__description unifiedDataTable__descriptionListDescription css-11rdew2-euiDescriptionList__description-inline-compressed\\">.gz</dd><dt class=\\"euiDescriptionList__title unifiedDataTable__descriptionListTitle css-1fizlic-euiDescriptionList__title-inline-compressed\\">_index</dt><dd class=\\"euiDescriptionList__description unifiedDataTable__descriptionListDescription css-11rdew2-euiDescriptionList__description-inline-compressed\\">test</dd><dt class=\\"euiDescriptionList__title unifiedDataTable__descriptionListTitle css-1fizlic-euiDescriptionList__title-inline-compressed\\">_score</dt><dd class=\\"euiDescriptionList__description unifiedDataTable__descriptionListDescription css-11rdew2-euiDescriptionList__description-inline-compressed\\">1</dd></dl>"`
);
});
});
4 changes: 0 additions & 4 deletions packages/kbn-unified-doc-viewer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

This package contains components and services for the unified doc viewer component.

Discover (Classic view → Expanded document)

![image](https://github.com/elastic/kibana/assets/1178348/a0a360bf-2697-4427-a32e-c728f06f5a7e)

Discover (Document explorer → Toggle dialog with details)

![image](https://github.com/elastic/kibana/assets/1178348/c9c11587-c53f-4bcd-8d48-aaceb64981ea)
Expand Down
28 changes: 2 additions & 26 deletions packages/kbn-unified-doc-viewer/src/services/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { DataView, DataViewField } from '@kbn/data-views-plugin/public';
import type { DataView } from '@kbn/data-views-plugin/public';
import type { AggregateQuery, Query } from '@kbn/es-query';
import type {
DataTableRecord,
DataTableColumnsMeta,
IgnoredReason,
} from '@kbn/discover-utils/types';
import type { DataTableRecord, DataTableColumnsMeta } from '@kbn/discover-utils/types';
import { DocViewsRegistry } from './doc_views_registry';

export interface FieldMapping {
Expand Down Expand Up @@ -77,23 +73,3 @@ interface ComponentDocViewInput extends BaseDocViewInput {
export type DocView = ComponentDocViewInput | RenderDocViewInput;

export type DocViewFactory = () => DocView;

export interface FieldRecordLegacy {
action: {
isActive: boolean;
onFilter?: DocViewFilterFn;
onToggleColumn: ((field: string) => void) | undefined;
flattenedField: unknown;
};
field: {
displayName: string;
field: string;
scripted: boolean;
fieldType?: string;
fieldMapping?: DataViewField;
};
value: {
formattedValue: string;
ignored?: IgnoredReason;
};
}
1 change: 0 additions & 1 deletion packages/kbn-unified-doc-viewer/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export type {
DocViewFilterFn,
DocViewRenderFn,
DocViewRenderProps,
FieldRecordLegacy,
} from './services/types';
2 changes: 1 addition & 1 deletion packages/kbn-unified-doc-viewer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export type { ElasticRequestState } from '.';
export type { DocViewFilterFn, DocViewRenderProps, FieldRecordLegacy } from './src/types';
export type { DocViewFilterFn, DocViewRenderProps } from './src/types';
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import type { EditorRequest } from '../../types';

import { useServicesContext } from '../../../../contexts';
import { StorageKeys } from '../../../../../services';
import { DEFAULT_LANGUAGE, AVAILABLE_LANGUAGES } from '../../../../../../common/constants';
import {
DEFAULT_LANGUAGE,
AVAILABLE_LANGUAGES,
KIBANA_API_PREFIX,
} from '../../../../../../common/constants';

interface Props {
getRequests: () => Promise<EditorRequest[]>;
Expand Down Expand Up @@ -90,9 +94,24 @@ export const ContextMenu = ({
// Get all the selected requests
const requests = await getRequests();

// If we have any kbn requests, we should not allow the user to copy as
// anything other than curl
const hasKbnRequests = requests.some((req) => req.url.startsWith(KIBANA_API_PREFIX));

if (hasKbnRequests && withLanguage !== 'curl') {
notifications.toasts.addDanger({
title: i18n.translate('console.consoleMenu.copyAsMixedRequestsMessage', {
defaultMessage: 'Kibana requests can only be copied as curl',
}),
});

return;
}

const { data: requestsAsCode, error: requestError } = await convertRequestToLanguage({
language: withLanguage,
esHost: esHostService.getHost(),
kibanaHost: window.location.origin,
requests,
});

Expand Down
4 changes: 3 additions & 1 deletion src/plugins/console/public/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ export async function convertRequestToLanguage({
requests,
language,
esHost,
kibanaHost,
}: {
language: string;
esHost: string;
kibanaHost: string;
requests: EditorRequest[];
}) {
return sendRequest({
path: `/api/console/convert_request_to_language`,
method: 'post',
query: { language, esHost },
query: { language, esHost, kibanaHost },
body: requests,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const routeValidationConfig = {
query: schema.object({
language: schema.string(),
esHost: schema.string(),
kibanaHost: schema.string(),
}),
body: schema.maybe(
schema.arrayOf(
Expand All @@ -39,7 +40,7 @@ export const registerConvertRequestRoute = ({
}: RouteDependencies) => {
const handler: RequestHandler<unknown, Query, Body> = async (ctx, req, response) => {
const { body, query } = req;
const { language, esHost } = query;
const { language, esHost, kibanaHost } = query;

try {
// Iterate over each request and build all the requests into a single string
Expand All @@ -60,6 +61,9 @@ export const registerConvertRequestRoute = ({
printResponse: true,
complete: true,
elasticsearchUrl: esHost,
otherUrls: {
kbn: kibanaHost,
},
});

return response.ok({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { identity } from 'lodash';
import { IUiSettingsClient } from '@kbn/core/public';
import {
DEFAULT_COLUMNS_SETTING,
DOC_TABLE_LEGACY,
MAX_DOC_FIELDS_DISPLAYED,
ROW_HEIGHT_OPTION,
SAMPLE_SIZE_SETTING,
Expand All @@ -39,8 +38,6 @@ export const uiSettingsMock = {
return 10;
} else if (key === DEFAULT_COLUMNS_SETTING) {
return ['default_column'];
} else if (key === DOC_TABLE_LEGACY) {
return false;
} else if (key === SEARCH_FIELDS_FROM_SOURCE) {
return false;
} else if (key === SHOW_MULTIFIELDS) {
Expand Down
Loading

0 comments on commit df718ab

Please sign in to comment.