Skip to content

Commit

Permalink
Merge branch 'master' into alerting/email-footer-url
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 15, 2020
2 parents 0ef3031 + 04d4e71 commit 4078870
Show file tree
Hide file tree
Showing 197 changed files with 4,174 additions and 6,474 deletions.
38 changes: 27 additions & 11 deletions packages/kbn-monaco/src/painless/diagnostics_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,41 @@ export class DiagnosticsAdapter {
constructor(private worker: WorkerAccessor) {
const onModelAdd = (model: monaco.editor.IModel): void => {
let handle: any;
model.onDidChangeContent(() => {
// Every time a new change is made, wait 500ms before validating
clearTimeout(handle);
handle = setTimeout(() => this.validate(model.uri), 500);
});

this.validate(model.uri);
if (model.getModeId() === ID) {
model.onDidChangeContent(() => {
// Do not validate if the language ID has changed
if (model.getModeId() !== ID) {
return;
}

// Every time a new change is made, wait 500ms before validating
clearTimeout(handle);
handle = setTimeout(() => this.validate(model.uri), 500);
});

model.onDidChangeLanguage(({ newLanguage }) => {
// Reset the model markers if the language ID has changed and is no longer "painless"
if (newLanguage !== ID) {
return monaco.editor.setModelMarkers(model, ID, []);
}
});

this.validate(model.uri);
}
};
monaco.editor.onDidCreateModel(onModelAdd);
monaco.editor.getModels().forEach(onModelAdd);
}

private async validate(resource: monaco.Uri): Promise<void> {
const worker = await this.worker(resource);
const errorMarkers = await worker.getSyntaxErrors();

const model = monaco.editor.getModel(resource);
const errorMarkers = await worker.getSyntaxErrors(resource.toString());

// Set the error markers and underline them with "Error" severity
monaco.editor.setModelMarkers(model!, ID, errorMarkers.map(toDiagnostics));
if (errorMarkers) {
const model = monaco.editor.getModel(resource);
// Set the error markers and underline them with "Error" severity
monaco.editor.setModelMarkers(model!, ID, errorMarkers.map(toDiagnostics));
}
}
}
16 changes: 10 additions & 6 deletions packages/kbn-monaco/src/painless/worker/painless_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ export class PainlessWorker {
this._ctx = ctx;
}

private getTextDocument(): string {
const model = this._ctx.getMirrorModels()[0];
return model.getValue();
private getTextDocument(modelUri: string): string | undefined {
const model = this._ctx.getMirrorModels().find((m) => m.uri.toString() === modelUri);

return model?.getValue();
}

public async getSyntaxErrors() {
const code = this.getTextDocument();
return parseAndGetSyntaxErrors(code);
public async getSyntaxErrors(modelUri: string) {
const code = this.getTextDocument(modelUri);

if (code) {
return parseAndGetSyntaxErrors(code);
}
}

public provideAutocompleteSuggestions(
Expand Down
1 change: 1 addition & 0 deletions src/dev/run_find_plugins_with_circular_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const allowedList: CircularDepList = new Set([
'src/plugins/vis_default_editor -> src/plugins/visualize',
'src/plugins/visualizations -> src/plugins/visualize',
'x-pack/plugins/actions -> x-pack/plugins/case',
'x-pack/plugins/case -> x-pack/plugins/security_solution',
'x-pack/plugins/apm -> x-pack/plugins/infra',
'x-pack/plugins/lists -> x-pack/plugins/security_solution',
'x-pack/plugins/security -> x-pack/plugins/spaces',
Expand Down
3 changes: 2 additions & 1 deletion test/api_integration/apis/saved_objects/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export default function ({ getService }) {
}));
});

describe('page beyond total', () => {
// FLAKY: https://github.com/elastic/kibana/issues/85911
describe.skip('page beyond total', () => {
it('should return 200 with empty response', async () =>
await supertest
.get('/api/saved_objects/_find?type=visualization&page=100&per_page=100')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useMemo, useState } from 'react';
import React, { useMemo, useState, useCallback } from 'react';

import { EuiIcon, EuiFlexItem, EuiCard, EuiFlexGroup } from '@elastic/eui';

Expand All @@ -16,15 +16,18 @@ export const CreateAlert = ({
}: Pick<AlertingExampleComponentParams, 'triggersActionsUi'>) => {
const [alertFlyoutVisible, setAlertFlyoutVisibility] = useState<boolean>(false);

const onCloseAlertFlyout = useCallback(() => setAlertFlyoutVisibility(false), [
setAlertFlyoutVisibility,
]);

const AddAlertFlyout = useMemo(
() =>
triggersActionsUi.getAddAlertFlyout({
consumer: ALERTING_EXAMPLE_APP_ID,
addFlyoutVisible: alertFlyoutVisible,
setAddFlyoutVisibility: setAlertFlyoutVisibility,
onClose: onCloseAlertFlyout,
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[alertFlyoutVisible]
[onCloseAlertFlyout]
);

return (
Expand All @@ -37,7 +40,7 @@ export const CreateAlert = ({
onClick={() => setAlertFlyoutVisibility(true)}
/>
</EuiFlexItem>
<EuiFlexItem>{AddAlertFlyout}</EuiFlexItem>
<EuiFlexItem>{alertFlyoutVisible && AddAlertFlyout}</EuiFlexItem>
</EuiFlexGroup>
);
};
3 changes: 0 additions & 3 deletions x-pack/plugins/actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ The ServiceNow action uses the [V2 Table API](https://developer.servicenow.com/a
| Property | Description | Type |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- |
| apiUrl | ServiceNow instance URL. | string |
| incidentConfiguration | Optional property and specific to **Cases only**. If defined, the object should contain an attribute called `mapping`. A `mapping` is an array of objects. Each mapping object should be of the form `{ source: string, target: string, actionType: string }`. `source` is the Case field. `target` is the ServiceNow field where `source` will be mapped to. `actionType` can be one of `nothing`, `overwrite` or `append`. For example the `{ source: 'title', target: 'short_description', actionType: 'overwrite' }` record, inside mapping array, means that the title of a case will be mapped to the short description of an incident in ServiceNow and will be overwrite on each update. | object _(optional)_ |

### `secrets`

Expand Down Expand Up @@ -600,7 +599,6 @@ The Jira action uses the [V2 API](https://developer.atlassian.com/cloud/jira/pla
| Property | Description | Type |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| apiUrl | Jira instance URL. | string |
| incidentConfiguration | Optional property and specific to **Cases only**. if defined, the object should contain an attribute called `mapping`. A `mapping` is an array of objects. Each mapping object should be of the form `{ source: string, target: string, actionType: string }`. `source` is the Case field. `target` is the Jira field where `source` will be mapped to. `actionType` can be one of `nothing`, `overwrite` or `append`. For example the `{ source: 'title', target: 'summary', actionType: 'overwrite' }` record, inside mapping array, means that the title of a case will be mapped to the short description of an incident in Jira and will be overwrite on each update. | object _(optional)_ |

### `secrets`

Expand Down Expand Up @@ -653,7 +651,6 @@ ID: `.resilient`
| Property | Description | Type |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ |
| apiUrl | IBM Resilient instance URL. | string |
| incidentConfiguration | Optional property and specific to **Cases only**. If defined, the object should contain an attribute called `mapping`. A `mapping` is an array of objects. Each mapping object should be of the form `{ source: string, target: string, actionType: string }`. `source` is the Case field. `target` is the Jira field where `source` will be mapped to. `actionType` can be one of `nothing`, `overwrite` or `append`. For example the `{ source: 'title', target: 'summary', actionType: 'overwrite' }` record, inside mapping array, means that the title of a case will be mapped to the short description of an incident in IBM Resilient and will be overwrite on each update. | object |

### `secrets`

Expand Down

This file was deleted.

43 changes: 0 additions & 43 deletions x-pack/plugins/actions/server/builtin_action_types/case/schema.ts

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4078870

Please sign in to comment.