Skip to content

Commit

Permalink
Merge branch 'main' into fix/x-pack-test-types
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Watson authored Sep 27, 2023
2 parents b0673b7 + 95f428f commit 555deac
Show file tree
Hide file tree
Showing 117 changed files with 966 additions and 800 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ export const buildNoPoliciesAvailableDefinition = (): AutocompleteCommandDefinit
insertText: '',
kind: 26,
detail: i18n.translate('monaco.esql.autocomplete.noPoliciesLabelsFound', {
defaultMessage: 'No policies found',
defaultMessage: 'Click to create',
}),
sortText: 'D',
command: {
id: 'esql.policies.create',
title: i18n.translate('monaco.esql.autocomplete.createNewPolicy', {
defaultMessage: 'Click to create',
}),
},
},
];

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-monaco/src/esql/lib/autocomplete/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ export interface UserDefinedVariables {
/** @internal **/
export type AutocompleteCommandDefinition = Pick<
monaco.languages.CompletionItem,
'label' | 'insertText' | 'kind' | 'detail' | 'documentation' | 'sortText'
'label' | 'insertText' | 'kind' | 'detail' | 'documentation' | 'sortText' | 'command'
>;
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
const language = getAggregateQueryMode(query);
const queryString: string = query[language] ?? '';
const kibana = useKibana<TextBasedEditorDeps>();
const { dataViews, expressions, indexManagementApiService } = kibana.services;
const { dataViews, expressions, indexManagementApiService, application } = kibana.services;
const [code, setCode] = useState(queryString ?? '');
const [codeOneLiner, setCodeOneLiner] = useState('');
const [editorHeight, setEditorHeight] = useState(
Expand All @@ -148,6 +148,16 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
useState<LanguageDocumentationSections>();

const policiesRef = useRef<SerializedEnrichPolicy[]>([]);

// Registers a command to redirect users to the index management page
// to create a new policy. The command is called by the buildNoPoliciesAvailableDefinition
monaco.editor.registerCommand('esql.policies.create', (...args) => {
application?.navigateToApp('management', {
path: 'data/index_management/enrich_policies/create',
openInNewTab: true,
});
});

const styles = textBasedLanguagedEditorStyles(
euiTheme,
isCompactFocused,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ async function fetchDocuments(esClient: ElasticsearchClient, index: string) {

const assertMigratedDocuments = (arr: any[], target: any[]) => target.every((v) => arr.includes(v));

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/160295
describe.skip('migration v2', () => {
describe('migration v2', () => {
let esServer: TestElasticsearchUtils;
let root: Root;
let startES: () => Promise<TestElasticsearchUtils>;
Expand Down Expand Up @@ -119,7 +118,7 @@ describe.skip('migration v2', () => {
await root.preboot();
await root.setup();
await expect(root.start()).rejects.toMatchInlineSnapshot(
`[Error: Unable to complete saved object migrations for the [.kibana] index: The document with _id "canvas-workpad-template:workpad-template-061d7868-2b4e-4dc8-8bf7-3772b52926e5" is 1715318 bytes which exceeds the configured maximum batch size of 1015275 bytes. To proceed, please increase the 'migrations.maxBatchSizeBytes' Kibana configuration option and ensure that the Elasticsearch 'http.max_content_length' configuration option is set to an equal or larger value.]`
`[Error: Unable to complete saved object migrations for the [.kibana] index: The document with _id "canvas-workpad-template:workpad-template-061d7868-2b4e-4dc8-8bf7-3772b52926e5" is 1715319 bytes which exceeds the configured maximum batch size of 1015275 bytes. To proceed, please increase the 'migrations.maxBatchSizeBytes' Kibana configuration option and ensure that the Elasticsearch 'http.max_content_length' configuration option is set to an equal or larger value.]`
);

await retryAsync(
Expand All @@ -132,7 +131,7 @@ describe.skip('migration v2', () => {
expect(
records.find((rec) =>
rec.message.startsWith(
`Unable to complete saved object migrations for the [.kibana] index: The document with _id "canvas-workpad-template:workpad-template-061d7868-2b4e-4dc8-8bf7-3772b52926e5" is 1715318 bytes which exceeds the configured maximum batch size of 1015275 bytes. To proceed, please increase the 'migrations.maxBatchSizeBytes' Kibana configuration option and ensure that the Elasticsearch 'http.max_content_length' configuration option is set to an equal or larger value.`
`Reason: Unable to complete saved object migrations for the [.kibana] index: The document with _id "canvas-workpad-template:workpad-template-061d7868-2b4e-4dc8-8bf7-3772b52926e5" is 1715319 bytes which exceeds the configured maximum batch size of 1015275 bytes. To proceed, please increase the 'migrations.maxBatchSizeBytes' Kibana configuration option and ensure that the Elasticsearch 'http.max_content_length' configuration option is set to an equal or larger value.`
)
)
).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,7 @@ export const runActionTestSuite = ({

// Reindex doesn't return any errors on it's own, so we have to test
// together with waitForReindexTask
// Failing: See https://github.com/elastic/kibana/issues/166190
describe.skip('reindex & waitForReindexTask', () => {
describe('reindex & waitForReindexTask', () => {
it('resolves right when reindex succeeds without reindex script', async () => {
const res = (await reindex({
client,
Expand Down Expand Up @@ -1120,15 +1119,17 @@ export const runActionTestSuite = ({
`);
});
it('resolves left wait_for_task_completion_timeout when the task does not finish within the timeout', async () => {
await waitForIndexStatus({
const readyTaskRes = await waitForIndexStatus({
client,
index: '.kibana_1',
index: 'existing_index_with_docs',
status: 'yellow',
})();

expect(Either.isRight(readyTaskRes)).toBe(true);

const res = (await reindex({
client,
sourceIndex: '.kibana_1',
sourceIndex: 'existing_index_with_docs',
targetIndex: 'reindex_target',
reindexScript: Option.none,
requireAlias: false,
Expand Down Expand Up @@ -1467,7 +1468,7 @@ export const runActionTestSuite = ({
it('resolves left wait_for_task_completion_timeout when the task does not complete within the timeout', async () => {
const res = (await pickupUpdatedMappings(
client,
'.kibana_1',
'existing_index_with_docs',
1000
)()) as Either.Right<UpdateByQueryResponse>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,17 @@

import React from 'react';
import PropTypes from 'prop-types';
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui';

export function NumberParameter({ id, label, value, setParameter }) {
const handleChange = (evt) => {
setParameter(id, parseFloat(evt.target.value));
};

return (
<div className="visEditorSidebar__formRow">
<label className="visEditorSidebar__formLabel" htmlFor={id}>
{label}
</label>
<div className="visEditorSidebar__formControl kuiFieldGroupSection--wide">
<input
className="kuiTextInput"
type="number"
value={value}
onChange={handleChange}
id={id}
/>
</div>
</div>
<EuiFormRow label={label}>
<EuiFieldNumber value={value} onChange={handleChange} fullWidth />
</EuiFormRow>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@

import React from 'react';
import PropTypes from 'prop-types';
import { EuiFormRow, EuiFieldText } from '@elastic/eui';

export function StringParameter({ id, label, value, setParameter }) {
const handleChange = (evt) => {
setParameter(id, evt.target.value);
};

return (
<div className="visEditorSidebar__formRow">
<label className="visEditorSidebar__formLabel">{label}</label>
<div className="visEditorSidebar__formControl kuiFieldGroupSection--wide">
<input className="kuiTextInput" type="text" value={value} onChange={handleChange} />
</div>
</div>
<EuiFormRow label={label}>
<EuiFieldText value={value} onChange={handleChange} fullWidth />
</EuiFormRow>
);
}

Expand Down
Loading

0 comments on commit 555deac

Please sign in to comment.