Skip to content

Commit

Permalink
Merge branch 'main' into revert-fs-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsonpl authored Apr 24, 2024
2 parents 4cb13f4 + 2b2fe39 commit afa4b90
Show file tree
Hide file tree
Showing 108 changed files with 547 additions and 121 deletions.
8 changes: 7 additions & 1 deletion .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,15 @@ enabled:
- test/functional/apps/discover/classic/config.ts
- test/functional/apps/discover/embeddable/config.ts
- test/functional/apps/discover/group1/config.ts
- test/functional/apps/discover/group2/config.ts
- test/functional/apps/discover/group2_data_grid1/config.ts
- test/functional/apps/discover/group2_data_grid2/config.ts
- test/functional/apps/discover/group2_data_grid3/config.ts
- test/functional/apps/discover/group3/config.ts
- test/functional/apps/discover/group4/config.ts
- test/functional/apps/discover/group5/config.ts
- test/functional/apps/discover/group6/config.ts
- test/functional/apps/discover/group7/config.ts
- test/functional/apps/discover/group8/config.ts
- test/functional/apps/getting_started/config.ts
- test/functional/apps/home/config.ts
- test/functional/apps/kibana_overview/config.ts
Expand Down
6 changes: 1 addition & 5 deletions .buildkite/pipelines/artifacts_container_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ steps:
- command: .buildkite/scripts/steps/artifacts/docker_image.sh
label: Build serverless container images
agents:
queue: n2-16-spot
queue: c2-16
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ describe('decodeRequestParams', () => {
};

expect(decode).toThrowErrorMatchingInlineSnapshot(`
"Excess keys are not allowed:
"Failed to validate:
Excess keys are not allowed:
path.extraKey"
`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import * as t from 'io-ts';
import { omitBy, isPlainObject, isEmpty } from 'lodash';
import { isLeft } from 'fp-ts/lib/Either';
import Boom from '@hapi/boom';
import { strictKeysRt } from '@kbn/io-ts-utils';
import { formatErrors } from '@kbn/securitysolution-io-ts-utils';
import { formatErrors, strictKeysRt } from '@kbn/io-ts-utils';
import { isLeft } from 'fp-ts/lib/Either';
import * as t from 'io-ts';
import { isEmpty, isPlainObject, omitBy } from 'lodash';
import { RouteParamsRT } from './typings';

interface KibanaRequestParams {
Expand All @@ -36,7 +35,7 @@ export function decodeRequestParams<T extends RouteParamsRT>(
const result = strictKeysRt(paramsRt).decode(paramMap);

if (isLeft(result)) {
throw Boom.badRequest(formatErrors(result.left).join('|'));
throw Boom.badRequest(formatErrors(result.left));
}

return result.right;
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-server-route-repository/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"@kbn/core-http-server",
"@kbn/core-lifecycle-server",
"@kbn/logging",
"@kbn/securitysolution-io-ts-utils"
],
"exclude": [
"target/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const EDITOR_INITIAL_HEIGHT_EXPANDED = 140;
export const EDITOR_MIN_HEIGHT = 40;
export const EDITOR_MAX_HEIGHT = 400;

export const textBasedLanguagedEditorStyles = (
export const textBasedLanguageEditorStyles = (
euiTheme: EuiThemeComputed,
isCompactFocused: boolean,
editorHeight: number,
Expand Down
45 changes: 18 additions & 27 deletions packages/kbn-text-based-editor/src/text_based_languages_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
import { CodeEditor, CodeEditorProps } from '@kbn/code-editor';

import {
textBasedLanguagedEditorStyles,
textBasedLanguageEditorStyles,
EDITOR_INITIAL_HEIGHT,
EDITOR_INITIAL_HEIGHT_EXPANDED,
EDITOR_MAX_HEIGHT,
Expand Down Expand Up @@ -189,7 +189,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
kibana.services;
const timeZone = core?.uiSettings?.get('dateFormat:tz');
const [code, setCode] = useState<string>(queryString ?? '');
const [codeOneLiner, setCodeOneLiner] = useState('');
const [codeOneLiner, setCodeOneLiner] = useState<string | null>(null);
// To make server side errors less "sticky", register the state of the code when submitting
const [codeWhenSubmitted, setCodeStateOnSubmission] = useState(code);
const [editorHeight, setEditorHeight] = useState(
Expand Down Expand Up @@ -273,7 +273,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
});
});

const styles = textBasedLanguagedEditorStyles(
const styles = textBasedLanguageEditorStyles(
euiTheme,
isCompactFocused,
editorHeight,
Expand Down Expand Up @@ -342,34 +342,24 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
updateLinesFromModel = false;
clickedOutside = true;
if (editor1.current) {
const editorElement = editor1.current.getDomNode();
if (editorElement) {
editorElement.style.height = `${EDITOR_INITIAL_HEIGHT}px`;
const contentWidth = Number(editorElement?.style.width.replace('px', ''));
calculateVisibleCode(contentWidth, true);
editor1.current.layout({ width: contentWidth, height: EDITOR_INITIAL_HEIGHT });
}
const contentWidth = editor1.current.getLayoutInfo().width;
calculateVisibleCode(contentWidth, true);
editor1.current.layout({ width: contentWidth, height: EDITOR_INITIAL_HEIGHT });
}
};

const updateHeight = useCallback((editor: monaco.editor.IStandaloneCodeEditor) => {
if (lines === 1 || clickedOutside || initialRender) return;
const editorElement = editor.getDomNode();
if (clickedOutside || initialRender) return;
const contentHeight = Math.min(MAX_COMPACT_VIEW_LENGTH, editor.getContentHeight());

if (editorElement) {
editorElement.style.height = `${contentHeight}px`;
}
const contentWidth = Number(editorElement?.style.width.replace('px', ''));
editor.layout({ width: contentWidth, height: contentHeight });
setEditorHeight(contentHeight);
editor.layout({ width: editor.getLayoutInfo().width, height: contentHeight });
}, []);

const onEditorFocus = useCallback(() => {
setIsCompactFocused(true);
setIsCodeEditorExpandedFocused(true);
setShowLineNumbers(true);
setCodeOneLiner('');
setCodeOneLiner(null);
clickedOutside = false;
initialRender = false;
updateLinesFromModel = true;
Expand Down Expand Up @@ -598,13 +588,9 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({

useEffect(() => {
if (editor1.current && !isCompactFocused) {
const editorElement = editor1.current.getDomNode();
if (editorElement) {
const contentWidth = Number(editorElement?.style.width.replace('px', ''));
if (code !== queryString) {
setCode(queryString);
calculateVisibleCode(contentWidth);
}
if (code !== queryString) {
setCode(queryString);
calculateVisibleCode(editor1.current.getLayoutInfo().width);
}
}
}, [calculateVisibleCode, code, isCompactFocused, queryString]);
Expand Down Expand Up @@ -944,9 +930,14 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter,
onQuerySubmit
);

if (!isCodeEditorExpanded) {
editor.onDidContentSizeChange((e) => {
updateHeight(editor);
// @ts-expect-error the property _oldContentHeight exists on the event object received but
// is not available on the type definition
if (e.contentHeight !== e._oldContentHeight) {
updateHeight(editor);
}
});
}
}}
Expand Down
10 changes: 0 additions & 10 deletions test/functional/apps/discover/group1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,13 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_no_data'));
loadTestFile(require.resolve('./_discover'));
loadTestFile(require.resolve('./_discover_accessibility'));
loadTestFile(require.resolve('./_discover_histogram_breakdown'));
loadTestFile(require.resolve('./_discover_histogram'));
loadTestFile(require.resolve('./_doc_accessibility'));
loadTestFile(require.resolve('./_filter_editor'));
loadTestFile(require.resolve('./_errors'));
loadTestFile(require.resolve('./_field_data'));
loadTestFile(require.resolve('./_field_data_with_fields_api'));
loadTestFile(require.resolve('./_shared_links'));
loadTestFile(require.resolve('./_source_filters'));
loadTestFile(require.resolve('./_large_string'));
loadTestFile(require.resolve('./_greeting_screen'));
loadTestFile(require.resolve('./_inspector'));
loadTestFile(require.resolve('./_date_nanos'));
loadTestFile(require.resolve('./_date_nanos_mixed'));
loadTestFile(require.resolve('./_url_state'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');

describe('discover/group2', function () {
describe('discover/group2/data_grid1', function () {
before(async function () {
await browser.setWindowSize(1600, 1200);
});
Expand All @@ -22,16 +22,8 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {

loadTestFile(require.resolve('./_data_grid'));
loadTestFile(require.resolve('./_data_grid_context'));
loadTestFile(require.resolve('./_data_grid_field_data'));
loadTestFile(require.resolve('./_data_grid_doc_navigation'));
loadTestFile(require.resolve('./_data_grid_row_navigation'));
loadTestFile(require.resolve('./_data_grid_doc_table'));
loadTestFile(require.resolve('./_data_grid_copy_to_clipboard'));
loadTestFile(require.resolve('./_data_grid_row_height'));
loadTestFile(require.resolve('./_data_grid_new_line'));
loadTestFile(require.resolve('./_data_grid_sample_size'));
loadTestFile(require.resolve('./_data_grid_pagination'));
loadTestFile(require.resolve('./_data_grid_footer'));
loadTestFile(require.resolve('./_data_grid_field_tokens'));
});
}
18 changes: 18 additions & 0 deletions test/functional/apps/discover/group2_data_grid2/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js'));

return {
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
};
}
28 changes: 28 additions & 0 deletions test/functional/apps/discover/group2_data_grid2/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');

describe('discover/group2/data_grid2', function () {
before(async function () {
await browser.setWindowSize(1600, 1200);
});

after(async function unloadMakelogs() {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_data_grid_new_line'));
loadTestFile(require.resolve('./_data_grid_footer'));
loadTestFile(require.resolve('./_data_grid_field_data'));
loadTestFile(require.resolve('./_data_grid_field_tokens'));
});
}
18 changes: 18 additions & 0 deletions test/functional/apps/discover/group2_data_grid3/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js'));

return {
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
};
}
28 changes: 28 additions & 0 deletions test/functional/apps/discover/group2_data_grid3/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { FtrProviderContext } from '../ftr_provider_context';

export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const browser = getService('browser');

describe('discover/group2/data_grid3', function () {
before(async function () {
await browser.setWindowSize(1600, 1200);
});

after(async function unloadMakelogs() {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_data_grid_row_navigation'));
loadTestFile(require.resolve('./_data_grid_row_height'));
loadTestFile(require.resolve('./_data_grid_sample_size'));
loadTestFile(require.resolve('./_data_grid_pagination'));
});
}
5 changes: 0 additions & 5 deletions test/functional/apps/discover/group3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
});

loadTestFile(require.resolve('./_default_columns'));
loadTestFile(require.resolve('./_time_field_column'));
loadTestFile(require.resolve('./_drag_drop'));
loadTestFile(require.resolve('./_sidebar'));
loadTestFile(require.resolve('./_sidebar_field_stats'));
loadTestFile(require.resolve('./_request_counts'));
loadTestFile(require.resolve('./_doc_viewer'));
loadTestFile(require.resolve('./_view_mode_toggle'));
loadTestFile(require.resolve('./_unsaved_changes_badge'));
loadTestFile(require.resolve('./_panels_toggle'));
loadTestFile(require.resolve('./_lens_vis'));
});
Expand Down
8 changes: 0 additions & 8 deletions test/functional/apps/discover/group4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional');
});

loadTestFile(require.resolve('./_indexpattern_without_timefield'));
loadTestFile(require.resolve('./_discover_fields_api'));
loadTestFile(require.resolve('./_adhoc_data_views'));
loadTestFile(require.resolve('./_esql_view'));
loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields'));
loadTestFile(require.resolve('./_runtime_fields_editor'));
loadTestFile(require.resolve('./_huge_fields'));
loadTestFile(require.resolve('./_date_nested'));
loadTestFile(require.resolve('./_search_on_page_load'));
loadTestFile(require.resolve('./_chart_hidden'));
loadTestFile(require.resolve('./_context_encoded_url_params'));
loadTestFile(require.resolve('./_hide_announcements'));
loadTestFile(require.resolve('./_data_view_edit'));
loadTestFile(require.resolve('./_field_list_new_fields'));
loadTestFile(require.resolve('./_request_cancellation'));
loadTestFile(require.resolve('./_new_search'));
loadTestFile(require.resolve('./_document_comparison'));
});
}
18 changes: 18 additions & 0 deletions test/functional/apps/discover/group5/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js'));

return {
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
};
}
Loading

0 comments on commit afa4b90

Please sign in to comment.