Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from elastic:main #764

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@types/react": "~18.2.0",
"@types/react-dom": "~18.2.0",
"@xstate5/react/**/xstate": "^5.18.1",
"globby/fast-glob": "^3.2.11"
"globby/fast-glob": "^3.3.2"
},
"dependencies": {
"@appland/sql-parser": "^1.5.1",
Expand Down Expand Up @@ -1032,7 +1032,7 @@
"@langchain/google-vertexai": "^0.1.0",
"@langchain/langgraph": "0.2.19",
"@langchain/openai": "^0.3.11",
"@langtrase/trace-attributes": "^3.0.8",
"@langtrase/trace-attributes": "^7.5.0",
"@launchdarkly/node-server-sdk": "^9.7.2",
"@launchdarkly/openfeature-node-server": "^1.0.0",
"@loaders.gl/core": "^3.4.7",
Expand All @@ -1059,12 +1059,12 @@
"@reduxjs/toolkit": "1.9.7",
"@slack/webhook": "^7.0.1",
"@smithy/eventstream-codec": "^3.1.1",
"@smithy/eventstream-serde-node": "^3.0.3",
"@smithy/eventstream-serde-node": "^3.0.12",
"@smithy/middleware-stack": "^3.0.10",
"@smithy/node-http-handler": "^3.3.1",
"@smithy/protocol-http": "^4.1.7",
"@smithy/signature-v4": "^3.1.1",
"@smithy/types": "^3.2.0",
"@smithy/signature-v4": "^4.2.3",
"@smithy/types": "^3.7.1",
"@smithy/util-utf8": "^3.0.0",
"@tanstack/react-query": "^4.29.12",
"@tanstack/react-query-devtools": "^4.29.12",
Expand All @@ -1083,12 +1083,12 @@
"@xyflow/react": "^12.3.5",
"adm-zip": "^0.5.9",
"ai": "^2.2.33",
"ajv": "^8.12.0",
"ajv": "^8.17.1",
"ansi-regex": "^6.1.0",
"antlr4": "^4.13.1-patch-1",
"archiver": "^7.0.1",
"async": "^3.2.3",
"aws4": "^1.12.0",
"aws4": "^1.13.2",
"axios": "^1.7.4",
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
Expand Down Expand Up @@ -1131,7 +1131,7 @@
"dotenv": "^16.4.5",
"elastic-apm-node": "^4.8.1",
"email-addresses": "^5.0.0",
"eventsource-parser": "^1.1.1",
"eventsource-parser": "^3.0.0",
"execa": "^5.1.1",
"expiry-js": "0.1.7",
"exponential-backoff": "^3.1.1",
Expand All @@ -1149,7 +1149,7 @@
"getos": "^3.1.0",
"globby": "^11.1.0",
"google-auth-library": "^9.10.0",
"gpt-tokenizer": "^2.1.2",
"gpt-tokenizer": "^2.6.2",
"handlebars": "4.7.8",
"he": "^1.2.0",
"history": "^4.9.0",
Expand Down Expand Up @@ -1177,7 +1177,7 @@
"jsts": "^1.6.2",
"kea": "^2.6.0",
"langchain": "^0.3.5",
"langsmith": "^0.2.3",
"langsmith": "^0.2.5",
"launchdarkly-js-client-sdk": "^3.5.0",
"load-json-file": "^6.2.0",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -1206,7 +1206,7 @@
"nunjucks": "^3.2.4",
"object-hash": "^1.3.1",
"object-path-immutable": "^3.1.1",
"openai": "^4.68.0",
"openai": "^4.72.0",
"openpgp": "5.10.1",
"ora": "^4.0.4",
"p-limit": "^3.0.1",
Expand Down Expand Up @@ -1592,7 +1592,7 @@
"@types/js-search": "^1.4.0",
"@types/js-yaml": "^4.0.9",
"@types/jsdom": "^20.0.1",
"@types/json-schema": "^7",
"@types/json-schema": "^7.0.15",
"@types/json-stable-stringify": "^1.0.32",
"@types/json5": "^2.2.0",
"@types/jsonwebtoken": "^9.0.0",
Expand Down Expand Up @@ -1835,7 +1835,7 @@
"svgo": "^2.8.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1",
"table": "^6.8.1",
"table": "^6.8.2",
"tape": "^5.0.1",
"terser": "^5.36.0",
"terser-webpack-plugin": "^4.2.3",
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-esql-editor/src/esql_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ export const ESQLEditor = memo(function ESQLEditor({
lightbulb: {
enabled: false,
},
lineDecorationsWidth: 12,
lineDecorationsWidth: 20,
lineNumbers: 'on',
lineNumbersMinChars: 3,
minimap: { enabled: false },
Expand All @@ -601,7 +601,9 @@ export const ESQLEditor = memo(function ESQLEditor({
renderLineHighlightOnlyWhenFocus: true,
scrollbar: {
horizontal: 'hidden',
horizontalScrollbarSize: 6,
vertical: 'auto',
verticalScrollbarSize: 6,
},
scrollBeyondLastLine: false,
theme: darkMode ? ESQL_DARK_THEME_ID : ESQL_LIGHT_THEME_ID,
Expand Down
14 changes: 5 additions & 9 deletions packages/kbn-esql-editor/src/overwrite.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
@include euiTextBreakWord;
}

// All scrollable containers (e.g. main container and suggest menu)
.ESQLEditor .monaco-editor .monaco-scrollable-element {
margin-left: $euiSizeS;
// Space between the autocomplete menu and expanded suggestion details
.ESQLEditor .monaco-editor .suggest-details {
padding-left: $euiSizeS;
}

.ESQLEditor .monaco-editor .monaco-list .monaco-scrollable-element {
margin-left: 0;

.monaco-list-row.focused {
border-radius: $euiBorderRadius;
}
.ESQLEditor .monaco-editor .monaco-list .monaco-scrollable-element .monaco-list-row.focused {
border-radius: $euiBorderRadius;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export function createObservableFromHttpResponse(
}

return new Observable<string>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
subscriber.next(event.data);
}
},
});

const readStream = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function createObservableFromHttpResponse<T extends ServerSentEvent = nev
}

return new Observable<T>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event')
const parser = createParser({
onEvent: (event) => {
try {
const data = JSON.parse(event.data);
if (event.event === 'error') {
Expand All @@ -48,6 +48,7 @@ export function createObservableFromHttpResponse<T extends ServerSentEvent = nev
} catch (error) {
subscriber.error(createSSEInternalError(`Failed to parse JSON`));
}
},
});

const readStream = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/dev/build/tasks/os_packages/docker_generator/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function runDockerGenerator(
*/
if (flags.baseImage === 'wolfi')
baseImageName =
'docker.elastic.co/wolfi/chainguard-base:latest@sha256:32f06b169bb4b0f257fbb10e8c8379f06d3ee1355c89b3327cb623781a29590e';
'docker.elastic.co/wolfi/chainguard-base:latest@sha256:ad2e15a6b7fbd893990fd9bd39fb0f367282a9ba65e350655540e470858ef382';

let imageFlavor = '';
if (flags.baseImage === 'ubi') imageFlavor += `-ubi`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('test fetchAll', () => {
customFilters: [],
overriddenVisContextAfterInvalidation: undefined,
resetDefaultProfileState: {
resetId: 'test',
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down Expand Up @@ -269,6 +270,7 @@ describe('test fetchAll', () => {
customFilters: [],
overriddenVisContextAfterInvalidation: undefined,
resetDefaultProfileState: {
resetId: 'test',
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down Expand Up @@ -392,6 +394,7 @@ describe('test fetchAll', () => {
customFilters: [],
overriddenVisContextAfterInvalidation: undefined,
resetDefaultProfileState: {
resetId: 'test',
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { DiscoverStateContainer } from '../state_management/discover_state';
import { VIEW_MODE } from '@kbn/saved-search-plugin/public';
import { dataViewAdHoc } from '../../../__mocks__/data_view_complex';
import { buildDataTableRecord, EsHitRecord } from '@kbn/discover-utils';
import { omit } from 'lodash';

function getHookProps(
query: AggregateQuery | Query | undefined,
Expand Down Expand Up @@ -501,7 +502,7 @@ describe('useEsqlMode', () => {
FetchStatus.LOADING
);
const documents$ = stateContainer.dataState.data$.documents$;
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand All @@ -516,7 +517,7 @@ describe('useEsqlMode', () => {
query: { esql: 'from pattern1' },
});
await waitFor(() =>
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: true,
rowHeight: true,
breakdownField: true,
Expand All @@ -537,7 +538,7 @@ describe('useEsqlMode', () => {
query: { esql: 'from pattern1' },
});
await waitFor(() =>
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand All @@ -553,7 +554,7 @@ describe('useEsqlMode', () => {
query: { esql: 'from pattern2' },
});
await waitFor(() =>
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: true,
rowHeight: true,
breakdownField: true,
Expand All @@ -570,7 +571,7 @@ describe('useEsqlMode', () => {
const documents$ = stateContainer.dataState.data$.documents$;
const result1 = [buildDataTableRecord({ message: 'foo' } as EsHitRecord)];
const result2 = [buildDataTableRecord({ message: 'foo', extension: 'bar' } as EsHitRecord)];
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand All @@ -581,7 +582,7 @@ describe('useEsqlMode', () => {
result: result1,
});
await waitFor(() =>
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand All @@ -593,7 +594,7 @@ describe('useEsqlMode', () => {
result: result2,
});
await waitFor(() =>
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: true,
rowHeight: false,
breakdownField: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
getSavedSearchContainer,
} from './discover_saved_search_container';
import { getDiscoverGlobalStateContainer } from './discover_global_state_container';
import { omit } from 'lodash';

let history: History;
let stateStorage: IKbnUrlStateStorage;
Expand Down Expand Up @@ -269,13 +270,13 @@ describe('Test discover app state container', () => {
describe('initAndSync', () => {
it('should call setResetDefaultProfileState correctly with no initial state', () => {
const state = getStateContainer();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
});
state.initAndSync();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: true,
rowHeight: true,
breakdownField: true,
Expand All @@ -286,13 +287,13 @@ describe('Test discover app state container', () => {
const stateStorageGetSpy = jest.spyOn(stateStorage, 'get');
stateStorageGetSpy.mockReturnValue({ columns: ['test'] });
const state = getStateContainer();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
});
state.initAndSync();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: true,
breakdownField: true,
Expand All @@ -303,13 +304,13 @@ describe('Test discover app state container', () => {
const stateStorageGetSpy = jest.spyOn(stateStorage, 'get');
stateStorageGetSpy.mockReturnValue({ rowHeight: 5 });
const state = getStateContainer();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
});
state.initAndSync();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: true,
rowHeight: false,
breakdownField: true,
Expand All @@ -326,13 +327,13 @@ describe('Test discover app state container', () => {
managed: false,
});
const state = getStateContainer();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
});
state.initAndSync();
expect(internalState.get().resetDefaultProfileState).toEqual({
expect(omit(internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,12 @@ export const getDiscoverAppStateContainer = ({

addLog('[appState] initialize state and sync with URL', currentSavedSearch);

// Set the default profile state only if not loading a saved search,
// to avoid overwriting saved search state
if (!currentSavedSearch.id) {
const { breakdownField, columns, rowHeight } = getCurrentUrlState(stateStorage, services);

// Only set default state which is not already set in the URL
internalStateContainer.transitions.setResetDefaultProfileState({
columns: columns === undefined,
rowHeight: rowHeight === undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { FetchStatus } from '../../types';
import { DataDocuments$ } from './discover_data_state_container';
import { getDiscoverStateMock } from '../../../__mocks__/discover_state.mock';
import { fetchDocuments } from '../data_fetching/fetch_documents';
import { omit } from 'lodash';

jest.mock('../data_fetching/fetch_documents', () => ({
fetchDocuments: jest.fn().mockResolvedValue({ records: [] }),
Expand Down Expand Up @@ -190,7 +191,7 @@ describe('test getDataStateContainer', () => {
await waitFor(() => {
expect(dataState.data$.main$.value.fetchStatus).toBe(FetchStatus.COMPLETE);
});
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down Expand Up @@ -221,7 +222,7 @@ describe('test getDataStateContainer', () => {
await waitFor(() => {
expect(dataState.data$.main$.value.fetchStatus).toBe(FetchStatus.COMPLETE);
});
expect(stateContainer.internalState.get().resetDefaultProfileState).toEqual({
expect(omit(stateContainer.internalState.get().resetDefaultProfileState, 'resetId')).toEqual({
columns: false,
rowHeight: false,
breakdownField: false,
Expand Down
Loading
Loading