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

[Console] Enable monaco by default #184862

Merged
merged 38 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0e593e8
[Console] Enable monaco by default
yuliacech Jun 5, 2024
851a23e
[Console] Revert changes to console page helpers
yuliacech Jun 7, 2024
32db829
[Console] Fix functional tests
yuliacech Jun 7, 2024
cdcdab0
[Console] Revert changes to ace tests
yuliacech Jun 7, 2024
f10182a
[Console] Revert changes to ace tests
yuliacech Jun 7, 2024
0dd528d
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 7, 2024
a16b929
Merge branch 'main' into console/enable_migration
yuliacech Jun 10, 2024
ae25dda
Merge branch 'main' into console/enable_migration
yuliacech Jun 10, 2024
fc63ccb
[Console] Add a link for the comma related issue for monaco
yuliacech Jun 10, 2024
f4ba975
[Console] Fix more tests
yuliacech Jun 10, 2024
3567320
[Console] Fix ace tests
yuliacech Jun 11, 2024
286f1b1
[Console] Monaco autocomplete tests
yuliacech Jun 11, 2024
cd661b0
[Console] Fix default request test
yuliacech Jun 11, 2024
8420598
[Console] Fix monaco tests
yuliacech Jun 11, 2024
b9f6ffd
[Console] Fix monaco tests
yuliacech Jun 11, 2024
4b979ca
[Console] Fix monaco tests (comments)
yuliacech Jun 11, 2024
82d0bb0
[Console] Fix monaco tests
yuliacech Jun 11, 2024
3b30ecd
[Console] Fix monaco tests
yuliacech Jun 11, 2024
215203d
[Console] Fix monaco tests
yuliacech Jun 11, 2024
29e20e9
[Console] Fix monaco tests
yuliacech Jun 11, 2024
5b2e025
[Console] Fix monaco tests
yuliacech Jun 11, 2024
71f0603
[Console] Fix monaco tests
yuliacech Jun 11, 2024
b716b0d
[Console] Fix eslint issues
yuliacech Jun 11, 2024
ae5cfc9
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jun 11, 2024
180809e
[Console] Fix tests
yuliacech Jun 12, 2024
65df417
[Console] Fix tests
yuliacech Jun 12, 2024
123610b
[Console] Skip flaky tests
yuliacech Jun 12, 2024
80d4af4
[Console] Fix linting errors
yuliacech Jun 12, 2024
12fb065
Merge branch 'main' into console/enable_migration
yuliacech Jun 12, 2024
d647cf9
[Console] Fix linting errors
yuliacech Jun 12, 2024
3ac4a6f
[Console] Fix tests
yuliacech Jun 12, 2024
8361ad9
[Console] Skip flaky tests
yuliacech Jun 13, 2024
6a2acb7
[Console] Fix ccs tests
yuliacech Jun 13, 2024
9be5798
Merge branch 'main' into console/enable_migration
yuliacech Jun 13, 2024
53cc67b
Merge branch 'main' into console/enable_migration
yuliacech Jun 17, 2024
5553dc2
[Console] Fix the output text helper
yuliacech Jun 17, 2024
08a3d3e
[Console] Fix tests
yuliacech Jun 18, 2024
142eb5d
[Console] Skip flaky tests
yuliacech Jun 19, 2024
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
3 changes: 2 additions & 1 deletion .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ enabled:
- test/api_integration/config.js
- test/examples/config.js
- test/functional/apps/bundles/config.ts
- test/functional/apps/console/config.ts
- test/functional/apps/console/monaco/config.ts
- test/functional/apps/console/ace/config.ts
- test/functional/apps/context/config.ts
- test/functional/apps/dashboard_elements/controls/common/config.ts
- test/functional/apps/dashboard_elements/controls/options_list/config.ts
Expand Down
2 changes: 2 additions & 0 deletions config/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ xpack.index_management.enableDataStreamsStorageColumn: false
xpack.index_management.enableMappingsSourceFieldSection: false
# Disable toggle for enabling data retention in DSL form from Index Management UI
xpack.index_management.enableTogglingDataRetention: false
# Disable the Monaco migration in Console
console.dev.enableMonaco: false

# Keep deeplinks visible so that they are shown in the sidenav
dev_tools.deeplinks.navLinkStatus: visible
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-monaco/src/console/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ParsedRequest {
startOffset: number;
endOffset?: number;
method: string;
url: string;
url?: string;
data?: Array<Record<string, unknown>>;
}
export interface ConsoleParserResult {
Expand Down

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

6 changes: 5 additions & 1 deletion packages/shared-ux/code_editor/impl/code_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export interface CodeEditorProps {
* Enables the editor to get disabled when pressing ESC to resolve focus trapping for accessibility.
*/
accessibilityOverlayEnabled?: boolean;

dataTestSubj?: string;
}

export const CodeEditor: React.FC<CodeEditorProps> = ({
Expand Down Expand Up @@ -186,6 +188,7 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({
}),
fitToContent,
accessibilityOverlayEnabled = true,
dataTestSubj,
}) => {
const { colorMode, euiTheme } = useEuiTheme();
const useDarkTheme = useDarkThemeProp ?? colorMode === 'DARK';
Expand Down Expand Up @@ -280,6 +283,7 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({

return (
<EuiToolTip
data-test-subj="codeEditorAccessibilityOverlay"
display="block"
content={
<>
Expand Down Expand Up @@ -485,7 +489,7 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({
<div
css={styles.container}
onKeyDown={onKeyDown}
data-test-subj="kibanaCodeEditor"
data-test-subj={dataTestSubj ?? 'kibanaCodeEditor'}
className="kibanaCodeEditor"
>
{accessibilityOverlayEnabled && renderPrompt()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const MonacoEditor = ({ initialTextValue }: EditorProps) => {
width: 100%;
`}
ref={divRef}
data-test-subj="consoleMonacoEditorContainer"
>
<EuiFlexGroup
className="conApp__editorActions"
Expand Down Expand Up @@ -151,6 +152,7 @@ export const MonacoEditor = ({ initialTextValue }: EditorProps) => {
</EuiFlexItem>
</EuiFlexGroup>
<CodeEditor
dataTestSubj={'consoleMonacoEditor'}
languageId={CONSOLE_LANG_ID}
value={value}
onChange={setValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const MonacoEditorOutput: FunctionComponent = () => {
</label>
</EuiScreenReaderOnly>
<CodeEditor
dataTestSubj={'consoleMonacoOutput'}
languageId={mode}
value={value}
fullWidth={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { AdjustedParsedRequest } from '../types';
* - the request body is stringified from an object using JSON.stringify
*/
export const stringifyRequest = (parsedRequest: ParsedRequest): EditorRequest => {
const url = removeTrailingWhitespaces(parsedRequest.url);
const method = parsedRequest.method.toUpperCase();
const url = parsedRequest.url ? removeTrailingWhitespaces(parsedRequest.url) : '';
const method = parsedRequest.method?.toUpperCase() ?? '';
const data = parsedRequest.data?.map((parsedData) => JSON.stringify(parsedData, null, 2));
return { url, method, data: data ?? [] };
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const parseLine = (line: string): ParsedLineTokens => {
// try to parse into method and url (split on whitespace)
const parts = line.split(whitespacesRegex);
// 1st part is the method
const method = parts[0];
const method = parts[0].toUpperCase();
// 2nd part is the url
const url = parts[1];
// try to parse into url path and url params (split on question mark)
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const schemaLatest = schema.object(
defaultValue: 'stack',
}),
}),
dev: schema.object({ enableMonaco: schema.boolean({ defaultValue: false }) }),
dev: schema.object({ enableMonaco: schema.boolean({ defaultValue: true }) }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge, this has been a loong time coming! Great work @yuliacech !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jloleysens! We are super excited to get the new editor in front of real users!

},
{ defaultValue: undefined }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import _ from 'lodash';
import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,8 @@

import expect from '@kbn/expect';
import { asyncForEach } from '@kbn/std';
import { FtrProviderContext } from '../../ftr_provider_context';

const DEFAULT_REQUEST = `
# Welcome to the Dev Tools Console!
#
# You can use Console to explore the Elasticsearch API. See the \n Elasticsearch API reference to learn more:
# https://www.elastic.co/guide/en/elasticsearch/reference/current\n /rest-apis.html
#
# Here are a few examples to get you started.


# Create an index
PUT /my-index


# Add a document to my-index
POST /my-index/_doc
{
"id": "park_rocky-mountain",
"title": "Rocky Mountain",
"description": "Bisected north to south by the Continental \n Divide, this portion of the Rockies has ecosystems varying \n from over 150 riparian lakes to montane and subalpine forests \n to treeless alpine tundra."
}


# Perform a search in my-index
GET /my-index/_search?q="rocky mountain"
`.trim();
import { DEFAULT_INPUT_VALUE } from '@kbn/console-plugin/common/constants';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand All @@ -58,7 +33,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await retry.try(async () => {
const actualRequest = await PageObjects.console.getRequest();
log.debug(actualRequest);
expect(actualRequest.trim()).to.eql(DEFAULT_REQUEST);
expect(actualRequest.replace(/\s/g, '')).to.eql(DEFAULT_INPUT_VALUE.replace(/\s/g, ''));
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getService, getPageObjects }: FtrProviderContext) => {
const retry = getService('retry');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'console', 'header', 'home']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import expect from '@kbn/expect';
import { rgbToHex } from '@elastic/eui';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getService, getPageObjects }: FtrProviderContext) => {
const retry = getService('retry');
Expand Down
27 changes: 27 additions & 0 deletions test/functional/apps/console/ace/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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';
import { configureHTTP2 } from '../../../../common/configure_http2';

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

return configureHTTP2({
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
kbnTestServer: {
...functionalConfig.get('kbnTestServer'),
serverArgs: [
...functionalConfig.get('kbnTestServer.serverArgs'),
// disabling the monaco editor to run tests for ace
`--console.dev.enableMonaco=false`,
],
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Side Public License, v 1.
*/

export default function ({ getService, loadTestFile }) {
import { FtrProviderContext } from '../../../ftr_provider_context';

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

Expand Down
Loading