Skip to content

Commit

Permalink
Merge branch 'master' into make-actions-exportable
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 18, 2021
2 parents 5f59bae + a4f6988 commit c33a860
Show file tree
Hide file tree
Showing 146 changed files with 3,633 additions and 1,808 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started/quick-start-guide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ image::images/dashboard_sampleDataAddFilter_7.15.0.png[The [eCommerce] Revenue D
[[quick-start-whats-next]]
== What's next?

*Add your own data.* Ready to add your own data? Go to {fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack] to learn how to ingest your data, or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.
*Add your own data.* Ready to add your own data? Go to {observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}], or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.

*Explore your own data in Discover.* Ready to learn more about exploring your data in *Discover*? Go to <<discover, Discover>>.

Expand Down
2 changes: 1 addition & 1 deletion docs/osquery/osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ The following is an example of an **error response** for an undefined action que
== System requirements

* {fleet-guide}/fleet-overview.html[Fleet] is enabled on your cluster, and
one or more {fleet-guide}/elastic-agent-installation-configuration.html[Elastic Agents] is enrolled.
one or more {fleet-guide}/elastic-agent-installation.html[Elastic Agents] is enrolled.
* The https://docs.elastic.co/en/integrations/osquery_manager[*Osquery Manager*] integration
has been added and configured
for an agent policy through Fleet.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/connect-to-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ so you can quickly get insights into your data, and {fleet} mode offers several
image::images/addData_fleet_7.15.0.png[Add data using Fleet]

To get started, refer to
{fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].
{observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}].

[discrete]
[[upload-data-kibana]]
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ that the {kib} server uses to perform maintenance on the {kib} index at startup.
is an alternative to `elasticsearch.username` and `elasticsearch.password`.

| `enterpriseSearch.host`
| The URL of your Enterprise Search instance
| The http(s) URL of your Enterprise Search instance. For example, in a local self-managed setup, set this to `http://localhost:3002`. Authentication between Kibana and the Enterprise Search host URL, such as via OAuth, is not supported. You can also {enterprise-search-ref}/configure-ssl-tls.html#configure-ssl-tls-in-kibana[configure Kibana to trust your Enterprise Search TLS certificate authority].

| `interpreter.enableInVisualize`
| Enables use of interpreter in Visualize. *Default: `true`*
Expand Down
1 change: 1 addition & 0 deletions src/plugins/custom_integrations/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const INTEGRATION_CATEGORY_DISPLAY = {
project_management: 'Project Management',
software_development: 'Software Development',
upload_file: 'Upload a file',
website_search: 'Website Search',
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/table/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export interface TableVisParams {
showTotal: boolean;
totalFunc: AggTypes;
percentageCol: string;
autoFitRowToContent?: boolean;
row?: boolean;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('TableVisBasic', () => {
});

it('should sort rows by column and pass the sorted rows for consumers', () => {
(createTableVisCell as jest.Mock).mockClear();
const uiStateProps = {
...props.uiStateProps,
sort: {
Expand Down Expand Up @@ -96,7 +97,7 @@ describe('TableVisBasic', () => {
visConfig={{ ...props.visConfig, showToolbar: true }}
/>
);
expect(createTableVisCell).toHaveBeenCalledWith(sortedRows, table.formattedColumns);
expect(createTableVisCell).toHaveBeenCalledWith(sortedRows, table.formattedColumns, undefined);
expect(createGridColumns).toHaveBeenCalledWith(
table.columns,
sortedRows,
Expand Down
36 changes: 33 additions & 3 deletions src/plugins/vis_types/table/public/components/table_vis_basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import React, { memo, useCallback, useMemo } from 'react';
import React, { memo, useCallback, useMemo, useEffect, useState, useRef } from 'react';
import { EuiDataGrid, EuiDataGridProps, EuiDataGridSorting, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { orderBy } from 'lodash';
Expand Down Expand Up @@ -47,8 +47,16 @@ export const TableVisBasic = memo(

// renderCellValue is a component which renders a cell based on column and row indexes
const renderCellValue = useMemo(
() => createTableVisCell(sortedRows, formattedColumns),
[formattedColumns, sortedRows]
() => createTableVisCell(sortedRows, formattedColumns, visConfig.autoFitRowToContent),
[formattedColumns, sortedRows, visConfig.autoFitRowToContent]
);

const rowHeightsOptions = useMemo(
() =>
visConfig.autoFitRowToContent
? ({ defaultHeight: 'auto' } as unknown as EuiDataGridProps['rowHeightsOptions'])
: undefined,
[visConfig.autoFitRowToContent]
);

// Columns config
Expand Down Expand Up @@ -103,6 +111,26 @@ export const TableVisBasic = memo(
[columns, setColumnsWidth]
);

const firstRender = useRef(true);
const [dataGridUpdateCounter, setDataGridUpdateCounter] = useState(0);

// key was added as temporary solution to force re-render if we change autoFitRowToContent or we get new data
// cause we have problem with correct updating height cache in EUI datagrid when we use auto-height
// will be removed as soon as fix problem on EUI side
useEffect(() => {
// skip first render
if (firstRender.current) {
firstRender.current = false;
return;
}
// skip if auto height was turned off
if (!visConfig.autoFitRowToContent) {
return;
}
// update counter to remount grid from scratch
setDataGridUpdateCounter((counter) => counter + 1);
}, [visConfig.autoFitRowToContent, table, sort, pagination, columnsWidth]);

return (
<>
{title && (
Expand All @@ -111,12 +139,14 @@ export const TableVisBasic = memo(
</EuiTitle>
)}
<EuiDataGrid
key={String(dataGridUpdateCounter)}
aria-label={dataGridAriaLabel}
columns={gridColumns}
gridStyle={{
border: 'horizontal',
header: 'underline',
}}
rowHeightsOptions={rowHeightsOptions}
rowCount={rows.length}
columnVisibility={{
visibleColumns: columns.map(({ id }) => id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DatatableRow } from 'src/plugins/expressions';
import { FormattedColumns } from '../types';

export const createTableVisCell =
(rows: DatatableRow[], formattedColumns: FormattedColumns) =>
(rows: DatatableRow[], formattedColumns: FormattedColumns, autoFitRowToContent?: boolean) =>
({ rowIndex, columnId }: EuiDataGridCellValueElementProps) => {
const rowValue = rows[rowIndex][columnId];
const column = formattedColumns[columnId];
Expand All @@ -28,7 +28,7 @@ export const createTableVisCell =
*/
dangerouslySetInnerHTML={{ __html: content }} // eslint-disable-line react/no-danger
data-test-subj="tbvChartCellContent"
className="tbvChartCellContent"
className={autoFitRowToContent ? '' : 'tbvChartCellContent'}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ function TableOptions({
data-test-subj="showMetricsAtAllLevels"
/>

<SwitchOption
label={i18n.translate('visTypeTable.params.autoFitRow', {
defaultMessage: 'Auto fit rows to content',
})}
paramName="autoFitRowToContent"
value={stateParams.autoFitRowToContent}
setValue={setValue}
data-test-subj="autoFitRowToContent"
/>

<SwitchOption
label={i18n.translate('visTypeTable.params.showPartialRowsLabel', {
defaultMessage: 'Show partial rows',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/table/public/table_vis_fn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('interpreter/functions#table', () => {
splitColumn: undefined,
splitRow: undefined,
showMetricsAtAllLevels: false,
autoFitRowToContent: false,
sort: {
columnIndex: null,
direction: null,
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/vis_types/table/public/table_vis_fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export const createTableVisFn = (): TableExpressionFunctionDefinition => ({
defaultMessage: 'Specifies calculating function for the total row. Possible options are: ',
}),
},
autoFitRowToContent: {
types: ['boolean'],
help: '',
default: false,
},
},
fn(input, args, handlers) {
const convertedData = tableVisResponseHandler(input, args);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/table/public/table_vis_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const tableVisTypeDefinition: VisTypeDefinition<TableVisParams> = {
showToolbar: false,
totalFunc: 'sum',
percentageCol: '',
autoFitRowToContent: false,
},
},
editorConfig: {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_types/table/public/to_ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const toExpressionAst: VisToExpressionAst<TableVisParams> = (vis, params)
showMetricsAtAllLevels: vis.params.showMetricsAtAllLevels,
showToolbar: vis.params.showToolbar,
showTotal: vis.params.showTotal,
autoFitRowToContent: vis.params.autoFitRowToContent,
totalFunc: vis.params.totalFunc,
title: vis.title,
metrics: metrics.map(prepareDimension),
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"lib": [
"esnext",
// includes support for browser APIs
"dom"
"dom",
"DOM.Iterable"
],
// Node 8 should support everything output by esnext, we override this
// in webpack with loader-level compiler options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
* 2.0.
*/

import {
FieldValuePair,
HistogramItem,
RawResponseBase,
SearchStrategyClientParams,
} from '../types';
import { FieldValuePair, HistogramItem } from '../types';

import { FAILED_TRANSACTIONS_IMPACT_THRESHOLD } from './constants';
import { FieldStats } from '../field_stats_types';
Expand All @@ -33,11 +28,7 @@ export interface FailedTransactionsCorrelationsParams {
percentileThreshold: number;
}

export type FailedTransactionsCorrelationsRequestParams =
FailedTransactionsCorrelationsParams & SearchStrategyClientParams;

export interface FailedTransactionsCorrelationsRawResponse
extends RawResponseBase {
export interface FailedTransactionsCorrelationsRawResponse {
log: string[];
failedTransactionsCorrelations?: FailedTransactionsCorrelation[];
percentileThresholdValue?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
* 2.0.
*/

import {
FieldValuePair,
HistogramItem,
RawResponseBase,
SearchStrategyClientParams,
} from '../types';
import { FieldValuePair, HistogramItem } from '../types';
import { FieldStats } from '../field_stats_types';

export interface LatencyCorrelation extends FieldValuePair {
Expand All @@ -33,10 +28,7 @@ export interface LatencyCorrelationsParams {
analyzeCorrelations: boolean;
}

export type LatencyCorrelationsRequestParams = LatencyCorrelationsParams &
SearchStrategyClientParams;

export interface LatencyCorrelationsRawResponse extends RawResponseBase {
export interface LatencyCorrelationsRawResponse {
log: string[];
overallHistogram?: HistogramItem[];
percentileThresholdValue?: number;
Expand Down
12 changes: 11 additions & 1 deletion x-pack/plugins/apm/common/search_strategies/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,26 @@ export interface RawResponseBase {
took: number;
}

export interface SearchStrategyClientParams {
export interface SearchStrategyClientParamsBase {
environment: string;
kuery: string;
serviceName?: string;
transactionName?: string;
transactionType?: string;
}

export interface RawSearchStrategyClientParams
extends SearchStrategyClientParamsBase {
start?: string;
end?: string;
}

export interface SearchStrategyClientParams
extends SearchStrategyClientParamsBase {
start: number;
end: number;
}

export interface SearchStrategyServerParams {
index: string;
includeFrozen?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type { IKibanaSearchResponse } from 'src/plugins/data/public';
import { EuiThemeProvider } from 'src/plugins/kibana_react/common';
import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
import type { LatencyCorrelationsRawResponse } from '../../../../common/search_strategies/latency_correlations/types';
import type { RawResponseBase } from '../../../../common/search_strategies/types';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
import { ApmPluginContextValue } from '../../../context/apm_plugin/apm_plugin_context';
import {
Expand All @@ -34,7 +35,9 @@ function Wrapper({
dataSearchResponse,
}: {
children?: ReactNode;
dataSearchResponse: IKibanaSearchResponse<LatencyCorrelationsRawResponse>;
dataSearchResponse: IKibanaSearchResponse<
LatencyCorrelationsRawResponse & RawResponseBase
>;
}) {
const mockDataSearch = jest.fn(() => of(dataSearchResponse));

Expand Down
Loading

0 comments on commit c33a860

Please sign in to comment.