Skip to content

Commit

Permalink
Merge branch 'master' into 102622
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Jul 19, 2021
2 parents 15c01e3 + df1882e commit 497f8cc
Show file tree
Hide file tree
Showing 174 changed files with 5,088 additions and 2,193 deletions.
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
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
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
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
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
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
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
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
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
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
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
42 changes: 27 additions & 15 deletions docs/settings/security-settings.asciidoc
Expand Up @@ -337,24 +337,12 @@ For more details and a reference of audit events, refer to <<xpack-security-audi
[cols="2*<"]
|======
| `xpack.security.audit.enabled` {ess-icon}
| Set to `true` to enable audit logging for security events. *Default:* `false`
|======

[float]
[[ecs-audit-logging-settings]]
==== ECS audit logging settings

To enable the <<xpack-security-ecs-audit-logging, ECS audit logger>>, specify where you want to write the audit events using `xpack.security.audit.appender`.

[cols="2*<,*50"]
|======
| `xpack.security.audit.appender`
| Optional. Specifies where audit logs should be written to and how they should be formatted.
| Set to `true` _and_ configure an appender with `xpack.security.audit.appender` to enable ECS audit logging`. *Default:* `false`

2+a| For example:

[source,yaml]
----------------------------------------
xpack.security.audit.enabled: true
xpack.security.audit.appender:
type: rolling-file
fileName: ./audit.log
Expand All @@ -370,7 +358,31 @@ xpack.security.audit.appender:
<1> Rotates log files every 24 hours.
<2> Keeps maximum of 10 log files before deleting older ones.

| `xpack.security.audit.appender.type`
[NOTE]
============
{ess} does not support custom log file policies. To enable audit logging on {ess} only specify:
[source,yaml]
----------------------------------------
xpack.security.audit.enabled: true
xpack.security.audit.appender.type: rolling-file
----------------------------------------
============

[NOTE]
============
deprecated:[7.15.0,"In 8.0 and later, the legacy audit logger will be removed, and this setting will enable the ECS audit logger with a default appender."] To enable the legacy audit logger only specify:
[source,yaml]
----------------------------------------
xpack.security.audit.enabled: true
----------------------------------------
============

| `xpack.security.audit.appender` {ess-icon}
| Optional. Specifies where audit logs should be written to and how they should be formatted.

| `xpack.security.audit.appender.type` {ess-icon}
| Required. Specifies where audit logs should be written to. Allowed values are `console`, `file`, or `rolling-file`.

Refer to <<audit-logging-file-appender>> and <<audit-logging-rolling-file-appender>> for appender specific settings.
Expand Down
18 changes: 13 additions & 5 deletions docs/user/security/audit-logging.asciidoc
Expand Up @@ -14,16 +14,24 @@ by cluster-wide privileges. For more information on enabling audit logging in

[IMPORTANT]
============================================================================
Kibana offers two audit logs: a **deprecated** legacy audit logger, and a new
ECS-compliant audit logger. We strongly advise using the <<xpack-security-ecs-audit-logging, ECS audit logger>>,
as the legacy audit logger will be removed in an upcoming version.
============================================================================

[NOTE]
============================================================================
Audit logs are **disabled** by default. To enable this functionality, you must
set `xpack.security.audit.enabled` to `true` in `kibana.yml`.
set `xpack.security.audit.enabled` to `true` in `kibana.yml`, and configure
an <<audit-logging-settings, appender>> to write the audit log to a location of your choosing.
============================================================================

The current version of the audit logger uses the standard {kib} logging output,
The legacy audit logger uses the standard {kib} logging output,
which can be configured in `kibana.yml`. For more information, refer to <<settings>>.
The audit logger uses a separate logger and can be configured using
The <<xpack-security-ecs-audit-logging, ECS audit logger>> uses a separate logger and can be configured using
the options in <<audit-logging-settings>>.

==== Audit event types
==== Legacy audit event types

When you are auditing security events, each request can generate multiple audit
events. The following is a list of the events that can be generated:
Expand All @@ -42,7 +50,7 @@ events. The following is a list of the events that can be generated:
============================================================================
The following events are only logged if the ECS audit logger is enabled.
For information on how to configure `xpack.security.audit.appender`, refer to
<<ecs-audit-logging-settings>>.
<<audit-logging-settings>>.
============================================================================

Refer to the table of events that can be logged for auditing purposes.
Expand Down
8 changes: 8 additions & 0 deletions packages/kbn-monaco/src/painless/diagnostics_adapter.ts
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
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
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>;
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
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
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
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
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
37 changes: 37 additions & 0 deletions src/plugins/data/common/query/persistable_state.test.ts
@@ -0,0 +1,37 @@
/*
* 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.
*/

import { extract, inject } from './persistable_state';
import { Filter } from '../es_query/filters';

describe('filter manager persistable state tests', () => {
const filters: Filter[] = [
{ meta: { alias: 'test', disabled: false, negate: false, index: 'test' } },
];
describe('reference injection', () => {
test('correctly inserts reference to filter', () => {
const updatedFilters = inject(filters, [{ type: 'index_pattern', name: 'test', id: '123' }]);
expect(updatedFilters[0]).toHaveProperty('meta.index', '123');
});

test('drops index setting if reference is missing', () => {
const updatedFilters = inject(filters, [
{ type: 'index_pattern', name: 'test123', id: '123' },
]);
expect(updatedFilters[0]).toHaveProperty('meta.index', undefined);
});
});

describe('reference extraction', () => {
test('correctly extracts references', () => {
const { state, references } = extract(filters);
expect(state[0]).toHaveProperty('meta.index');
expect(references[0]).toHaveProperty('id', 'test');
});
});
});

0 comments on commit 497f8cc

Please sign in to comment.