Skip to content

Commit e47e144

Browse files
Merge branch 'master' into remove-unuses-server-uuid
2 parents e68d58f + d9d8777 commit e47e144

File tree

7 files changed

+84
-31
lines changed

7 files changed

+84
-31
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878

7979
# Canvas
8080
/x-pack/plugins/canvas/ @elastic/kibana-canvas
81+
/x-pack/test/functional/apps/canvas/ @elastic/kibana-canvas
8182

8283
# Observability UIs
8384
/x-pack/legacy/plugins/infra/ @elastic/logs-metrics-ui

x-pack/plugins/apm/common/agent_configuration/setting_definitions/__snapshots__/index.test.ts.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/apm/common/agent_configuration/setting_definitions/java_settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ export const javaSettings: RawSettingDefinition[] = [
197197
'The minimum duration of an inferred span. Note that the min duration is also implicitly set by the sampling interval. However, increasing the sampling interval also decreases the accuracy of the duration of inferred spans.'
198198
}
199199
),
200-
includeAgents: ['java']
200+
includeAgents: ['java'],
201+
min: '0ms'
201202
},
202203
{
203204
key: 'profiling_inferred_spans_included_classes',

x-pack/plugins/lens/public/datatable_visualization/__snapshots__/expression.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/lens/public/datatable_visualization/expression.test.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { createMockExecutionContext } from '../../../../../src/plugins/expressio
1414
import { IFieldFormat } from '../../../../../src/plugins/data/public';
1515
import { IAggType } from 'src/plugins/data/public';
1616
const onClickValue = jest.fn();
17+
import { EmptyPlaceholder } from '../shared_components';
1718

1819
function sampleArgs() {
1920
const data: LensMultiTable = {
@@ -22,11 +23,11 @@ function sampleArgs() {
2223
l1: {
2324
type: 'kibana_datatable',
2425
columns: [
25-
{ id: 'a', name: 'a', meta: { type: 'count' } },
26+
{ id: 'a', name: 'a', meta: { type: 'terms' } },
2627
{ id: 'b', name: 'b', meta: { type: 'date_histogram', aggConfigParams: { field: 'b' } } },
27-
{ id: 'c', name: 'c', meta: { type: 'cardinality' } },
28+
{ id: 'c', name: 'c', meta: { type: 'count' } },
2829
],
29-
rows: [{ a: 10110, b: 1588024800000, c: 3 }],
30+
rows: [{ a: 'shoes', b: 1588024800000, c: 3 }],
3031
},
3132
},
3233
};
@@ -103,7 +104,7 @@ describe('datatable_expression', () => {
103104
column: 0,
104105
row: 0,
105106
table: data.tables.l1,
106-
value: 10110,
107+
value: 'shoes',
107108
},
108109
],
109110
negate: true,
@@ -148,5 +149,31 @@ describe('datatable_expression', () => {
148149
timeFieldName: 'b',
149150
});
150151
});
152+
153+
test('it shows emptyPlaceholder for undefined bucketed data', () => {
154+
const { args, data } = sampleArgs();
155+
const emptyData: LensMultiTable = {
156+
...data,
157+
tables: {
158+
l1: {
159+
...data.tables.l1,
160+
rows: [{ a: undefined, b: undefined, c: 0 }],
161+
},
162+
},
163+
};
164+
165+
const component = shallow(
166+
<DatatableComponent
167+
data={emptyData}
168+
args={args}
169+
formatFactory={x => x as IFieldFormat}
170+
onClickValue={onClickValue}
171+
getType={jest.fn(type =>
172+
type === 'count' ? ({ type: 'metrics' } as IAggType) : ({ type: 'buckets' } as IAggType)
173+
)}
174+
/>
175+
);
176+
expect(component.find(EmptyPlaceholder).prop('icon')).toEqual('visTable');
177+
});
151178
});
152179
});

x-pack/plugins/lens/public/datatable_visualization/expression.tsx

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import React from 'react';
7+
import React, { useMemo } from 'react';
88
import ReactDOM from 'react-dom';
99
import { i18n } from '@kbn/i18n';
1010
import { I18nProvider } from '@kbn/i18n/react';
@@ -21,6 +21,8 @@ import {
2121
ExpressionRenderDefinition,
2222
} from '../../../../../src/plugins/expressions/public';
2323
import { VisualizationContainer } from '../visualization_container';
24+
import { EmptyPlaceholder } from '../shared_components';
25+
2426
export interface DatatableColumns {
2527
columnIds: string[];
2628
}
@@ -158,26 +160,45 @@ export function DatatableComponent(props: DatatableRenderProps) {
158160
formatters[column.id] = props.formatFactory(column.formatHint);
159161
});
160162

161-
const handleFilterClick = (field: string, value: unknown, colIndex: number, negate = false) => {
162-
const col = firstTable.columns[colIndex];
163-
const isDateHistogram = col.meta?.type === 'date_histogram';
164-
const timeFieldName = negate && isDateHistogram ? undefined : col?.meta?.aggConfigParams?.field;
165-
const rowIndex = firstTable.rows.findIndex(row => row[field] === value);
163+
const handleFilterClick = useMemo(
164+
() => (field: string, value: unknown, colIndex: number, negate: boolean = false) => {
165+
const col = firstTable.columns[colIndex];
166+
const isDateHistogram = col.meta?.type === 'date_histogram';
167+
const timeFieldName =
168+
negate && isDateHistogram ? undefined : col?.meta?.aggConfigParams?.field;
169+
const rowIndex = firstTable.rows.findIndex(row => row[field] === value);
166170

167-
const data: LensFilterEvent['data'] = {
168-
negate,
169-
data: [
170-
{
171-
row: rowIndex,
172-
column: colIndex,
173-
value,
174-
table: firstTable,
175-
},
176-
],
177-
timeFieldName,
178-
};
179-
props.onClickValue(data);
180-
};
171+
const data: LensFilterEvent['data'] = {
172+
negate,
173+
data: [
174+
{
175+
row: rowIndex,
176+
column: colIndex,
177+
value,
178+
table: firstTable,
179+
},
180+
],
181+
timeFieldName,
182+
};
183+
props.onClickValue(data);
184+
},
185+
[firstTable]
186+
);
187+
188+
const bucketColumns = firstTable.columns
189+
.filter(col => {
190+
return col?.meta?.type && props.getType(col.meta.type)?.type === 'buckets';
191+
})
192+
.map(col => col.id);
193+
194+
const isEmpty =
195+
firstTable.rows.length === 0 ||
196+
(bucketColumns.length &&
197+
firstTable.rows.every(row => bucketColumns.every(col => typeof row[col] === 'undefined')));
198+
199+
if (isEmpty) {
200+
return <EmptyPlaceholder icon="visTable" />;
201+
}
181202

182203
return (
183204
<VisualizationContainer>
@@ -188,9 +209,8 @@ export function DatatableComponent(props: DatatableRenderProps) {
188209
columns={props.args.columns.columnIds
189210
.map(field => {
190211
const col = firstTable.columns.find(c => c.id === field);
212+
const filterable = bucketColumns.includes(field);
191213
const colIndex = firstTable.columns.findIndex(c => c.id === field);
192-
193-
const filterable = col?.meta?.type && props.getType(col.meta.type)?.type === 'buckets';
194214
return {
195215
field,
196216
name: (col && col.name) || '',

x-pack/test/functional/page_objects/canvas_page.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ export function CanvasPageProvider({ getService }: FtrProviderContext) {
3333

3434
async fillOutCustomElementForm(name: string, description: string) {
3535
// Fill out the custom element form and submit it
36-
await testSubjects.setValue('canvasCustomElementForm-name', name);
37-
await testSubjects.setValue('canvasCustomElementForm-description', description);
36+
await testSubjects.setValue('canvasCustomElementForm-name', name, {
37+
clearWithKeyboard: true,
38+
});
39+
await testSubjects.setValue('canvasCustomElementForm-description', description, {
40+
clearWithKeyboard: true,
41+
});
3842

3943
await testSubjects.click('canvasCustomElementForm-submit');
4044
},

0 commit comments

Comments
 (0)