Skip to content

Commit f72f8e0

Browse files
author
Spencer
authored
Merge branch 'main' into implement/eslint/no-unused-imports
2 parents bde3558 + 640bc62 commit f72f8e0

112 files changed

Lines changed: 1565 additions & 1511 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/kbn-optimizer/limits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,5 @@ pageLoadAssetSize:
127127
eventAnnotation: 19334
128128
screenshotting: 22870
129129
synthetics: 40958
130-
expressionXY: 29000
130+
expressionXY: 30000
131131
kibanaUsageCollection: 16463

src/plugins/bfetch/public/batching/create_streaming_batched_function.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,33 @@ describe('createStreamingBatchedFunction()', () => {
196196
});
197197
});
198198

199+
test("doesn't send batch request if all items have been aborted", async () => {
200+
const { fetchStreaming } = setup();
201+
const fn = createStreamingBatchedFunction({
202+
url: '/test',
203+
fetchStreaming,
204+
maxItemAge: 5,
205+
flushOnMaxItems: 3,
206+
getIsCompressionDisabled: () => true,
207+
});
208+
209+
const abortController = new AbortController();
210+
abortController.abort();
211+
212+
expect.assertions(3);
213+
const req1 = fn({ foo: 'bar' }, abortController.signal).catch((e) =>
214+
expect(e).toBeInstanceOf(AbortError)
215+
);
216+
const req2 = fn({ baz: 'quix' }, abortController.signal).catch((e) =>
217+
expect(e).toBeInstanceOf(AbortError)
218+
);
219+
220+
jest.advanceTimersByTime(6);
221+
expect(fetchStreaming).not.toBeCalled();
222+
223+
await Promise.all([req1, req2]);
224+
});
225+
199226
test('sends POST request to correct endpoint with items in array batched sorted in call order', async () => {
200227
const { fetchStreaming } = setup();
201228
const fn = createStreamingBatchedFunction({

src/plugins/bfetch/public/batching/create_streaming_batched_function.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export const createStreamingBatchedFunction = <Payload, Result extends object>(
8888
return !item.signal?.aborted;
8989
});
9090

91+
if (items.length === 0) {
92+
return; // all items have been aborted before a request has been sent
93+
}
94+
9195
const donePromises: Array<Promise<any>> = items.map((item) => {
9296
return new Promise<void>((resolve) => {
9397
const { promise: abortPromise, cleanup } = item.signal

src/plugins/bfetch/server/streaming/create_compressed_stream.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const createCompressedStream = <Response>(
3737
): Stream => {
3838
const output = new PassThrough();
3939

40-
const sub = results
40+
results
4141
.pipe(
4242
concatMap((message: Response) => {
4343
const strMessage = JSON.stringify(message);
@@ -50,7 +50,6 @@ export const createCompressedStream = <Response>(
5050
}),
5151
finalize(() => {
5252
output.end();
53-
sub.unsubscribe();
5453
})
5554
)
5655
.subscribe();

src/plugins/chart_expressions/expression_gauge/common/expression_functions/gauge_function.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ describe('interpreter/functions#gauge', () => {
111111
logDatatable: (name: string, datatable: Datatable) => {
112112
loggedTable = datatable;
113113
},
114+
reset: () => {},
114115
},
115116
},
116117
};

src/plugins/chart_expressions/expression_gauge/common/expression_functions/gauge_function.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ export const gaugeFunction = (): GaugeExpressionFunctionDefinition => ({
194194
}
195195

196196
if (handlers?.inspectorAdapters?.tables) {
197+
handlers.inspectorAdapters.tables.reset();
198+
handlers.inspectorAdapters.tables.allowCsvExport = true;
199+
197200
const logTable = prepareLogTable(
198201
data,
199202
[

src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe('interpreter/functions#heatmap', () => {
6969
logDatatable: (name: string, datatable: Datatable) => {
7070
loggedTable = datatable;
7171
},
72+
reset: () => {},
7273
},
7374
},
7475
};

src/plugins/chart_expressions/expression_heatmap/common/expression_functions/heatmap_function.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ export const heatmapFunction = (): HeatmapExpressionFunctionDefinition => ({
161161
validateAccessor(args.splitColumnAccessor, data.columns);
162162

163163
if (handlers?.inspectorAdapters?.tables) {
164+
handlers.inspectorAdapters.tables.reset();
165+
handlers.inspectorAdapters.tables.allowCsvExport = true;
166+
164167
const argsTable: Dimension[] = [];
165168
if (args.valueAccessor) {
166169
prepareHeatmapLogTable(

src/plugins/chart_expressions/expression_metric/common/expression_functions/metric_vis_function.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ describe('interpreter/functions#metric', () => {
6868
logDatatable: (name: string, datatable: Datatable) => {
6969
loggedTable = datatable;
7070
},
71+
reset: () => {},
7172
},
7273
},
7374
};

src/plugins/chart_expressions/expression_metric/common/expression_functions/metric_vis_function.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ export const metricVisFunction = (): MetricVisExpressionFunctionDefinition => ({
146146
validateAccessor(args.bucket, input.columns);
147147

148148
if (handlers?.inspectorAdapters?.tables) {
149+
handlers.inspectorAdapters.tables.reset();
150+
handlers.inspectorAdapters.tables.allowCsvExport = true;
151+
149152
const argsTable: Dimension[] = [
150153
[
151154
args.metric,

0 commit comments

Comments
 (0)