Skip to content

Commit

Permalink
Merge branch 'master' into remove-es-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 15, 2020
2 parents 3ae9d72 + 579ead8 commit 4bb090b
Show file tree
Hide file tree
Showing 178 changed files with 3,840 additions and 6,211 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: 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.

This file was deleted.

Loading

0 comments on commit 4bb090b

Please sign in to comment.