Skip to content

Commit

Permalink
Merge branch 'main' into add-ownership-of-mswjs-http-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
jeramysoucy authored Sep 18, 2024
2 parents d3b6df8 + 181d617 commit 64d21e2
Show file tree
Hide file tree
Showing 108 changed files with 1,694 additions and 1,308 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-esql-ast/src/antlr_error_listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ErrorListener } from 'antlr4';
import type { EditorError } from './types';
import { getPosition } from './ast_position_utils';

const REPLACE_DEV = /,*\s*DEV_\w+\s*/g;
const REPLACE_DEV = /,{0,1}(?<!\s)\s*DEV_\w+\s*/g;
export class ESQLErrorListener extends ErrorListener<any> {
protected errors: EditorError[] = [];

Expand Down
27 changes: 15 additions & 12 deletions packages/kbn-monaco/src/console/lexer_rules/console_output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ export const consoleOutputLexerRules: monaco.languages.IMonarchLanguage = {
comments: [
// Line comment indicated by #
// Everything after the # character is matched, stopping right before the status code and status text at the end if they are present
matchTokensWithEOL('comment', /# .+?(?=\s+\d{3}(?: \w+)*$)/, 'root', 'status'),
matchTokensWithEOL('comment.default', /# .+?(?=\s+\[\b1\d{2}(?: \w+)*\]$)/, 'root', 'status'),
matchTokensWithEOL('comment.success', /# .+?(?=\s+\[\b2\d{2}(?: \w+)*\]$)/, 'root', 'status'),
matchTokensWithEOL('comment.primary', /# .+?(?=\s+\[\b3\d{2}(?: \w+)*\]$)/, 'root', 'status'),
matchTokensWithEOL('comment.warning', /# .+?(?=\s+\[\b4\d{2}(?: \w+)*\]$)/, 'root', 'status'),
matchTokensWithEOL('comment.danger', /# .+?(?=\s+\[\b5\d{2}(?: \w+)*\]$)/, 'root', 'status'),
...consoleSharedLexerRules.tokenizer.comments,
],
status: [
// Following HTTP response status codes conventions
// Informational responses (status codes 100 – 199)
matchTokensWithEOL('status.info', /\b1\d{2}(?: \w+)*$/, 'root'),
// Successful responses (status codes 200 – 299)
matchTokensWithEOL('status.success', /\b2\d{2}(?: \w+)*$/, 'root'),
// Redirection messages (status codes 300 – 399)
matchTokensWithEOL('status.redirect', /\b3\d{2}(?: \w+)*$/, 'root'),
// Client error responses (status codes 400 – 499)
matchTokensWithEOL('status.warning', /\b4\d{2}(?: \w+)*$/, 'root'),
// Server error responses (status codes 500 – 599)
matchTokensWithEOL('status.error', /\b5\d{2}(?: \w+)*$/, 'root'),
// Status codes 100 – 199
matchTokensWithEOL('status.default', /\[\b1\d{2}(?: \w+)*\]$/, 'root'),
// Status codes 200 – 299
matchTokensWithEOL('status.success', /\[\b2\d{2}(?: \w+)*\]$/, 'root'),
// Status codes 300 – 399
matchTokensWithEOL('status.primary', /\[\b3\d{2}(?: \w+)*\]$/, 'root'),
// Status codes 400 – 499
matchTokensWithEOL('status.warning', /\[\b4\d{2}(?: \w+)*\]$/, 'root'),
// Status codes 500 – 599
matchTokensWithEOL('status.danger', /\[\b5\d{2}(?: \w+)*\]$/, 'root'),
],
},
};
50 changes: 42 additions & 8 deletions packages/kbn-monaco/src/console/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const background = euiThemeVars.euiFormBackgroundColor;
const booleanTextColor = '#585CF6';
const methodTextColor = '#DD0A73';
const urlTextColor = '#00A69B';
const defaultStatusBackgroundColor = darkMode ? '#191B20' : '#F7F8FA';
const successStatusBackgroundColor = darkMode ? '#212B30' : '#E7F5F5';
const primaryStatusBackgroundColor = darkMode ? '#1E232D' : '#EBF1F7';
const warningStatusBackgroundColor = darkMode ? '#2C2B25' : '#FBF6E9';
const dangerStatusBackgroundColor = darkMode ? '#2E2024' : '#F6E6E7';
export const buildConsoleTheme = (): monaco.editor.IStandaloneThemeData => {
const euiTheme = darkMode ? buildDarkTheme() : buildLightTheme();
return {
Expand All @@ -39,27 +44,56 @@ export const buildConsoleTheme = (): monaco.editor.IStandaloneThemeData => {
makeHighContrastColor(euiThemeVars.euiColorAccentText)(background)
),
...buildRuleGroup(
['status.info'],
makeHighContrastColor(euiThemeVars.euiTextColor)(background)
['comment.default'],
makeHighContrastColor(euiThemeVars.euiTextColor)(defaultStatusBackgroundColor)
),
...buildRuleGroup(
['comment.success'],
makeHighContrastColor(euiThemeVars.euiColorSuccessText)(successStatusBackgroundColor)
),
...buildRuleGroup(
['comment.primary'],
makeHighContrastColor(euiThemeVars.euiTextColor)(primaryStatusBackgroundColor)
),
...buildRuleGroup(
['comment.warning'],
makeHighContrastColor(euiThemeVars.euiColorWarningText)(warningStatusBackgroundColor)
),
...buildRuleGroup(
['comment.danger'],
makeHighContrastColor(euiThemeVars.euiColorDangerText)(dangerStatusBackgroundColor)
),
...buildRuleGroup(
['status.default'],
makeHighContrastColor(euiThemeVars.euiTextColor)(defaultStatusBackgroundColor),
true
),
...buildRuleGroup(
['status.success'],
makeHighContrastColor(euiThemeVars.euiTextColor)(euiThemeVars.euiColorSuccess)
makeHighContrastColor(euiThemeVars.euiColorSuccessText)(successStatusBackgroundColor),
true
),
...buildRuleGroup(
['status.redirect'],
makeHighContrastColor(euiThemeVars.euiTextColor)(background)
['status.primary'],
makeHighContrastColor(euiThemeVars.euiTextColor)(primaryStatusBackgroundColor),
true
),
...buildRuleGroup(
['status.warning'],
makeHighContrastColor(euiThemeVars.euiTextColor)(euiThemeVars.euiColorWarning)
makeHighContrastColor(euiThemeVars.euiColorWarningText)(warningStatusBackgroundColor),
true
),
...buildRuleGroup(
['status.error'],
makeHighContrastColor('#FFFFFF')(euiThemeVars.euiColorDanger)
['status.danger'],
makeHighContrastColor(euiThemeVars.euiColorDangerText)(dangerStatusBackgroundColor),
true
),
...buildRuleGroup(['method'], makeHighContrastColor(methodTextColor)(background)),
...buildRuleGroup(['url'], makeHighContrastColor(urlTextColor)(background)),
],
colors: {
...euiTheme.colors,
'editorLineNumber.foreground': euiThemeVars.euiTextColor,
},
};
};
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pageLoadAssetSize:
observabilityAiAssistantManagement: 19279
observabilityLogsExplorer: 46650
observabilityOnboarding: 19573
observabilityShared: 72039
observabilityShared: 80000
osquery: 107090
painlessLab: 179748
presentationPanel: 55463
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: CreateEndpointList
summary: Creates an endpoint list
description: Creates an endpoint list or does nothing if the list already exists
summary: Create an endpoint exception list
description: Create an endpoint exception list, which groups endpoint exception list items. If an endpoint exception list already exists, an empty response is returned.
responses:
200:
description: Successful response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: CreateEndpointListItem
summary: Creates an endpoint list item
summary: Create an endpoint exception list item
description: Create an endpoint exception list item, and associate it with the endpoint exception list.
requestBody:
description: Exception list item's properties
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: DeleteEndpointListItem
summary: Deletes an endpoint list item
summary: Delete an endpoint exception list item
description: Delete an endpoint exception list item using the `id` or `item_id` field.
parameters:
- name: id
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: FindEndpointListItems
summary: Finds endpoint list items
summary: Get endpoint exception list items
description: Get a list of all endpoint exception list items.
parameters:
- name: filter
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: ReadEndpointListItem
summary: Reads an endpoint list item
summary: Get an endpoint exception list item
description: Get the details of an endpoint exception list item using the `id` or `item_id` field.
parameters:
- name: id
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: UpdateEndpointListItem
summary: Updates an endpoint list item
summary: Update an endpoint exception list item
description: Update an endpoint exception list item using the `id` or `item_id` field.
requestBody:
description: Exception list item's properties
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ servers:
paths:
/api/endpoint_list:
post:
description: Creates an endpoint list or does nothing if the list already exists
description: >-
Create an endpoint exception list, which groups endpoint exception list
items. If an endpoint exception list already exists, an empty response
is returned.
operationId: CreateEndpointList
responses:
'200':
Expand Down Expand Up @@ -48,9 +51,12 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Creates an endpoint list
summary: Create an endpoint exception list
/api/endpoint_list/items:
delete:
description: >-
Delete an endpoint exception list item using the `id` or `item_id`
field.
operationId: DeleteEndpointListItem
parameters:
- description: Either `id` or `item_id` must be specified
Expand Down Expand Up @@ -104,8 +110,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Deletes an endpoint list item
summary: Delete an endpoint exception list item
get:
description: >-
Get the details of an endpoint exception list item using the `id` or
`item_id` field.
operationId: ReadEndpointListItem
parameters:
- description: Either `id` or `item_id` must be specified
Expand Down Expand Up @@ -161,8 +170,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Reads an endpoint list item
summary: Get an endpoint exception list item
post:
description: >-
Create an endpoint exception list item, and associate it with the
endpoint exception list.
operationId: CreateEndpointListItem
requestBody:
content:
Expand Down Expand Up @@ -237,8 +249,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Creates an endpoint list item
summary: Create an endpoint exception list item
put:
description: >-
Update an endpoint exception list item using the `id` or `item_id`
field.
operationId: UpdateEndpointListItem
requestBody:
content:
Expand Down Expand Up @@ -318,9 +333,10 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Updates an endpoint list item
summary: Update an endpoint exception list item
/api/endpoint_list/items/_find:
get:
description: Get a list of all endpoint exception list items.
operationId: FindEndpointListItems
parameters:
- description: >
Expand Down Expand Up @@ -422,7 +438,7 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Finds endpoint list items
summary: Get endpoint exception list items
components:
schemas:
EndpointList:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ servers:
paths:
/api/endpoint_list:
post:
description: Creates an endpoint list or does nothing if the list already exists
description: >-
Create an endpoint exception list, which groups endpoint exception list
items. If an endpoint exception list already exists, an empty response
is returned.
operationId: CreateEndpointList
responses:
'200':
Expand Down Expand Up @@ -48,9 +51,12 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Creates an endpoint list
summary: Create an endpoint exception list
/api/endpoint_list/items:
delete:
description: >-
Delete an endpoint exception list item using the `id` or `item_id`
field.
operationId: DeleteEndpointListItem
parameters:
- description: Either `id` or `item_id` must be specified
Expand Down Expand Up @@ -104,8 +110,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Deletes an endpoint list item
summary: Delete an endpoint exception list item
get:
description: >-
Get the details of an endpoint exception list item using the `id` or
`item_id` field.
operationId: ReadEndpointListItem
parameters:
- description: Either `id` or `item_id` must be specified
Expand Down Expand Up @@ -161,8 +170,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Reads an endpoint list item
summary: Get an endpoint exception list item
post:
description: >-
Create an endpoint exception list item, and associate it with the
endpoint exception list.
operationId: CreateEndpointListItem
requestBody:
content:
Expand Down Expand Up @@ -237,8 +249,11 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Creates an endpoint list item
summary: Create an endpoint exception list item
put:
description: >-
Update an endpoint exception list item using the `id` or `item_id`
field.
operationId: UpdateEndpointListItem
requestBody:
content:
Expand Down Expand Up @@ -318,9 +333,10 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Updates an endpoint list item
summary: Update an endpoint exception list item
/api/endpoint_list/items/_find:
get:
description: Get a list of all endpoint exception list items.
operationId: FindEndpointListItems
parameters:
- description: >
Expand Down Expand Up @@ -422,7 +438,7 @@ paths:
schema:
$ref: '#/components/schemas/SiemErrorResponse'
description: Internal server error
summary: Finds endpoint list items
summary: Get endpoint exception list items
components:
schemas:
EndpointList:
Expand Down
14 changes: 8 additions & 6 deletions packages/kbn-text-based-editor/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ export const parseWarning = (warning: string): MonacoMessage[] => {
startColumn = Number(encodedColumn);
startLineNumber = Number(encodedLine.replace('Line ', ''));
}
// extract the length of the "expression" within the message
// and try to guess the correct size for the editor marker to highlight
if (/\[.*\]/.test(warningMessage)) {
const [_, wordWithError] = warningMessage.split('[');
if (wordWithError) {
errorLength = wordWithError.length;
const openingSquareBracketIndex = warningMessage.indexOf('[');
if (openingSquareBracketIndex !== -1) {
const closingSquareBracketIndex = warningMessage.indexOf(
']',
openingSquareBracketIndex
);
if (closingSquareBracketIndex !== -1) {
errorLength = warningMessage.length - openingSquareBracketIndex - 1;
}
}
}
Expand Down
Loading

0 comments on commit 64d21e2

Please sign in to comment.