Skip to content

Commit

Permalink
Merge branch 'master' into add_comunity_id_processor
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Jul 19, 2021
2 parents 77d00ea + e9988b1 commit 8497055
Show file tree
Hide file tree
Showing 210 changed files with 5,985 additions and 4,620 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
exporters: {
datatableToCSV: typeof datatableToCSV;
CSV_MIME_TYPE: string;
cellHasFormulas: (val: string) => boolean;
tableHasFormulas: (columns: import("../../expressions").DatatableColumn[], rows: Record<string, any>[]) => boolean;
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<b>Signature:</b>

```typescript
export declare class FilterManager
export declare class FilterManager implements PersistableStateService
```
## Constructors
Expand All @@ -16,6 +16,16 @@ export declare class FilterManager
| --- | --- | --- |
| [(constructor)(uiSettings)](./kibana-plugin-plugins-data-public.filtermanager._constructor_.md) | | Constructs a new instance of the <code>FilterManager</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [extract](./kibana-plugin-plugins-data-public.filtermanager.extract.md) | | <code>any</code> | |
| [getAllMigrations](./kibana-plugin-plugins-data-public.filtermanager.getallmigrations.md) | | <code>() =&gt; {}</code> | |
| [inject](./kibana-plugin-plugins-data-public.filtermanager.inject.md) | | <code>any</code> | |
| [migrateToLatest](./kibana-plugin-plugins-data-public.filtermanager.migratetolatest.md) | | <code>any</code> | |
| [telemetry](./kibana-plugin-plugins-data-public.filtermanager.telemetry.md) | | <code>(filters: import(&quot;../../../../kibana_utils/common/persistable_state&quot;).SerializableState, collector: unknown) =&gt; {}</code> | |
## Methods
| Method | Modifiers | Description |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<b>Signature:</b>

```typescript
export declare function getCapabilitiesForRollupIndices(indices: {
[key: string]: any;
}): {
export declare function getCapabilitiesForRollupIndices(indices: Record<string, {
rollup_jobs: any;
}>): {
[key: string]: any;
};
```
Expand All @@ -18,7 +18,7 @@ export declare function getCapabilitiesForRollupIndices(indices: {

| Parameter | Type | Description |
| --- | --- | --- |
| indices | <code>{</code><br/><code> [key: string]: any;</code><br/><code>}</code> | |
| indices | <code>Record&lt;string, {</code><br/><code> rollup_jobs: any;</code><br/><code>}&gt;</code> | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
```typescript
mergeCapabilitiesWithFields: (rollupIndexCapabilities: {
[key: string]: any;
}, fieldsFromFieldCapsApi: {
[key: string]: any;
}, previousFields?: FieldDescriptor[]) => FieldDescriptor[]
}, fieldsFromFieldCapsApi: Record<string, FieldDescriptor>, previousFields?: FieldDescriptor[]) => FieldDescriptor[]
```
Binary file modified docs/management/watcher-ui/images/advanced-watch/advanced-watch-create.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/watcher-ui/images/advanced-watch/advanced-watch-simulate.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/watcher-ui/images/alerts-status.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/watcher-ui/images/execution-history.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ...management/watcher-ui/images/threshold-alert/create-threshold-alert-created.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified docs/management/watcher-ui/images/threshold-alert/threshold-alert-condition.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/management/watcher-ui/images/watches.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions docs/management/watcher-ui/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ in {es} for this example to work.
you want to send the message when the condition is met.

. Enter a subject and body for the email.
+
[role="screenshot"]
image:management/watcher-ui/images/threshold-alert/threshold-alert-action.png["Action for threshold alert"]

. To test the action before saving the watch, click *Send test email*.
+
Expand Down
18 changes: 15 additions & 3 deletions docs/user/dashboard/lens.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,16 @@ Each *Layer* in a visualization is associated with an index pattern and mutiple
You can also change the index pattern for a single *Layer*.

[float]
[[why-my-field-x-is-missing-from-the-fields-list]]
===== Why is my field X missing from the fields list?
[[why-my-field-is-missing-from-the-fields-list]]
===== Why is my field missing from the fields list?

*Lens* does not support the visualization of full-text fields, therefore it is not showing them in the data summary.
Fields do not appear in the *Available fields* in the following scenarios:
* The field is a full-text field.
* The field is a `geo_point` field
* The field is a `flattened` field.
* The field is a `object` field.

Verify if the field appears in the *Empty fields* list. *Lens* uses heuristics to determine if the fields contain values. For sparse data sets, the heuristics are less precise.

[float]
[[how-to-handle-gaps-in-time-series-visualizations]]
Expand Down Expand Up @@ -370,3 +376,9 @@ Here's a short list of few different aspects to check:
** If a custom `Number` configuration is used, check that the color stop values are covering the current data range.

** If a `Percent` configuration is used, and the data range changes, the colors displayed are affected.

[float]
[[is-it-possible-to-show-icons-in-datatable]]
===== Is it possible to display icons in data tables?

You can display icons with <<managing-index-patterns, field formatter>> in data tables.
8 changes: 8 additions & 0 deletions packages/kbn-monaco/src/painless/diagnostics_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,23 @@ export class DiagnosticsAdapter {
return;
}

// Reset the model markers if an empty string is provided on change
if (model.getValue().trim() === '') {
return monaco.editor.setModelMarkers(model, ID, []);
}

// 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"
// Otherwise, re-validate
if (newLanguage !== ID) {
return monaco.editor.setModelMarkers(model, ID, []);
} else {
this.validate(model.uri);
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pageLoadAssetSize:
dataVisualizer: 27530
banners: 17946
mapsEms: 26072
timelines: 230410
timelines: 251886
screenshotMode: 17856
visTypePie: 35583
expressionRevealImage: 25675
Expand Down
5 changes: 4 additions & 1 deletion packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { ValuesType } from 'utility-types';

const ALERT_NAMESPACE = 'kibana.rac.alert';
const ALERT_NAMESPACE = 'kibana.rac.alert' as const;

const TIMESTAMP = '@timestamp' as const;
const EVENT_KIND = 'event.kind' as const;
Expand All @@ -28,6 +28,7 @@ const ALERT_DURATION = `${ALERT_NAMESPACE}.duration.us` as const;
const ALERT_SEVERITY_LEVEL = `${ALERT_NAMESPACE}.severity.level` as const;
const ALERT_SEVERITY_VALUE = `${ALERT_NAMESPACE}.severity.value` as const;
const ALERT_STATUS = `${ALERT_NAMESPACE}.status` as const;
const SPACE_IDS = 'kibana.space_ids' as const;
const ALERT_EVALUATION_THRESHOLD = `${ALERT_NAMESPACE}.evaluation.threshold` as const;
const ALERT_EVALUATION_VALUE = `${ALERT_NAMESPACE}.evaluation.value` as const;

Expand All @@ -52,6 +53,7 @@ const fields = {
ALERT_STATUS,
ALERT_EVALUATION_THRESHOLD,
ALERT_EVALUATION_VALUE,
SPACE_IDS,
};

export {
Expand All @@ -75,6 +77,7 @@ export {
ALERT_STATUS,
ALERT_EVALUATION_THRESHOLD,
ALERT_EVALUATION_VALUE,
SPACE_IDS,
};

export type TechnicalRuleDataFieldName = ValuesType<typeof fields>;
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ describe('createRouter', () => {
router.getParams('/service-map', history.location);
}).toThrowError('No matching route found for /service-map');
});

it('does not throw an error if the given path does not match any routes but is marked as optional', () => {
expect(() => {
router.getParams('/service-map', history.location, true);
}).not.toThrowError();
});
});

describe('matchRoutes', () => {
Expand Down
13 changes: 10 additions & 3 deletions packages/kbn-typed-react-router-config/src/create_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ export function createRouter<TRoutes extends Route[]>(routes: TRoutes): Router<T
const matchRoutes = (...args: any[]) => {
let path: string = args[0];
let location: Location = args[1];
let optional: boolean = args[2];

if (args.length === 1) {
location = args[0] as Location;
path = location.pathname;
optional = args[1];
}

const greedy = path.endsWith('/*') || args.length === 1;
Expand All @@ -64,6 +66,9 @@ export function createRouter<TRoutes extends Route[]>(routes: TRoutes): Router<T
: findLastIndex(matches, (match) => match.route.path === path);

if (matchIndex === -1) {
if (optional) {
return [];
}
throw new Error(`No matching route found for ${path}`);
}

Expand Down Expand Up @@ -144,9 +149,11 @@ export function createRouter<TRoutes extends Route[]>(routes: TRoutes): Router<T
link: (path, ...args) => {
return link(path, ...args);
},
getParams: (path, location) => {
const matches = matchRoutes(path, location);
return merge({ path: {}, query: {} }, ...matches.map((match) => match.match.params));
getParams: (...args: any[]) => {
const matches = matchRoutes(...args);
return matches.length
? merge({ path: {}, query: {} }, ...matches.map((match) => match.match.params))
: undefined;
},
matchRoutes: (...args: any[]) => {
return matchRoutes(...args) as any;
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-typed-react-router-config/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ export interface Router<TRoutes extends Route[]> {
path: TPath,
location: Location
): OutputOf<TRoutes, TPath>;
getParams<TPath extends PathsOf<TRoutes>, TOptional extends boolean>(
path: TPath,
location: Location,
optional: TOptional
): TOptional extends true ? OutputOf<TRoutes, TPath> | undefined : OutputOf<TRoutes, TPath>;
link<TPath extends PathsOf<TRoutes>>(
path: TPath,
...args: TypeAsArgs<TypeOf<TRoutes, TPath>>
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-typed-react-router-config/src/use_params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import { useLocation } from 'react-router-dom';
import { useRouter } from './use_router';

export function useParams(path: string) {
export function useParams(path: string, optional: boolean = false) {
const router = useRouter();
const location = useLocation();

return router.getParams(path as never, location);
return router.getParams(path as never, location, optional);
}
12 changes: 7 additions & 5 deletions src/core/public/i18n/i18n_eui_mapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -712,11 +712,13 @@ export const getEuiContextMapping = () => {
defaultMessage: 'Next page, {page}',
values: { page },
}),
'euiPagination.pageOfTotalCompressed': ({ page, total }: EuiValues) =>
i18n.translate('core.euiPagination.pageOfTotalCompressed', {
defaultMessage: '{page} of {total}',
values: { page, total },
}),
'euiPagination.pageOfTotalCompressed': ({ page, total }: EuiValues) => (
<FormattedMessage
id="core.euiPagination.pageOfTotalCompressed"
defaultMessage="{page} of {total}"
values={{ page, total }}
/>
),
'euiPagination.previousPage': ({ page }: EuiValues) =>
i18n.translate('core.euiPagination.previousPage', {
defaultMessage: 'Previous page, {page}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Export CSV action', () => {
| Record<string, { content: string; type: string }>;
expect(result).toEqual({
'Hello Kibana.csv': {
content: `First Name,Last Name${LINE_FEED_CHARACTER}Kibana,undefined${LINE_FEED_CHARACTER}`,
content: `First Name,Last Name${LINE_FEED_CHARACTER}Kibana,${LINE_FEED_CHARACTER}`,
type: 'text/plain;charset=utf-8',
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class ExportCSVAction implements Action<ExportContext> {
csvSeparator: this.params.core.uiSettings.get('csv:separator', ','),
quoteValues: this.params.core.uiSettings.get('csv:quoteValues', true),
formatFactory,
escapeFormulaValues: false,
}),
type: exporters.CSV_MIME_TYPE,
};
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/data/common/exports/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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.
*/

export const CSV_FORMULA_CHARS = ['=', '+', '-', '@'];
export const nonAlphaNumRE = /[^a-zA-Z0-9]/;
export const allDoubleQuoteRE = /"/g;
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 expect from '@kbn/expect';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
* 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 { allDoubleQuoteRE, nonAlphaNumRE } from './constants';
import { cellHasFormulas } from './formula_checks';

import { RawValue } from '../types';
import { cellHasFormulas } from './cell_has_formula';

const nonAlphaNumRE = /[^a-zA-Z0-9]/;
const allDoubleQuoteRE = /"/g;
type RawValue = string | object | null | undefined;

export function createEscapeValue(
quoteValues: boolean,
Expand All @@ -22,7 +21,6 @@ export function createEscapeValue(
return `"${formulasEscaped.replace(allDoubleQuoteRE, '""')}"`;
}
}

return val == null ? '' : val.toString();
};
}
13 changes: 13 additions & 0 deletions src/plugins/data/common/exports/export_csv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function getDefaultOptions() {
csvSeparator: ',',
quoteValues: true,
formatFactory,
escapeFormulaValues: false,
};
}

Expand Down Expand Up @@ -71,4 +72,16 @@ describe('CSV exporter', () => {
'columnOne\r\n"Formatted_""value"""\r\n'
);
});

test('should escape formulas', () => {
const datatable = getDataTable();
datatable.rows[0].col1 = '=1';
expect(
datatableToCSV(datatable, {
...getDefaultOptions(),
escapeFormulaValues: true,
formatFactory: () => ({ convert: (v: unknown) => v } as FieldFormat),
})
).toMatch('columnOne\r\n"\'=1"\r\n');
});
});
Loading

0 comments on commit 8497055

Please sign in to comment.