Skip to content

Commit

Permalink
Merge branch 'master' into disable-interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Feb 16, 2020
2 parents 1815dce + 67087e3 commit 92d4ff0
Show file tree
Hide file tree
Showing 572 changed files with 10,760 additions and 7,979 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
/x-pack/legacy/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/legacy/plugins/index_management/ @elastic/es-ui
/x-pack/legacy/plugins/license_management/ @elastic/es-ui
/x-pack/legacy/plugins/remote_clusters/ @elastic/es-ui
/x-pack/plugins/remote_clusters/ @elastic/es-ui
/x-pack/legacy/plugins/rollup/ @elastic/es-ui
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
Expand Down
5 changes: 5 additions & 0 deletions docs/developer/plugin/development-plugin-resources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
TypeScript code is automatically converted into JavaScript during development,
but not in the distributable version of Kibana. If you use the
{repo}blob/{branch}/packages/kbn-plugin-helpers[@kbn/plugin-helpers] to build your plugin, then your `.ts` and `.tsx` files will be permanently transpiled before your plugin is archived. If you have your own build process, make sure to run the TypeScript compiler on your source files and ship the compilation output so that your plugin will work with the distributable version of Kibana.

==== {kib} platform migration guide

{repo}blob/{branch}/src/core/MIGRATION.md#migrating-legacy-plugins-to-the-new-platform[This guide]
provides an action plan for moving a legacy plugin to the new platform.
29 changes: 15 additions & 14 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ for displayed decimal values.
. Go to *Management > {kib} > Advanced Settings*.
. Scroll or search for the setting you want to modify.
. Enter a new value for the setting.
. Click *Save changes*.


[float]
Expand All @@ -34,7 +35,7 @@ removes it from {kib} permanently.

[float]
[[kibana-general-settings]]
=== General settings
==== General

[horizontal]
`csv:quoteValues`:: Set this property to `true` to quote exported values.
Expand Down Expand Up @@ -109,22 +110,22 @@ cluster alert notifications from Monitoring.

[float]
[[kibana-accessibility-settings]]
=== Accessibility settings
==== Accessibility

[horizontal]
`accessibility:disableAnimations`:: Turns off all unnecessary animations in the
{kib} UI. Refresh the page to apply the changes.

[float]
[[kibana-dashboard-settings]]
=== Dashboard settings
==== Dashboard

[horizontal]
`xpackDashboardMode:roles`:: The roles that belong to <<xpack-dashboard-only-mode, dashboard only mode>>.

[float]
[[kibana-discover-settings]]
=== Discover settings
==== Discover

[horizontal]
`context:defaultSize`:: The number of surrounding entries to display in the context view. The default value is 5.
Expand All @@ -150,7 +151,7 @@ working on big documents.

[float]
[[kibana-notification-settings]]
=== Notifications settings
==== Notifications

[horizontal]
`notifications:banner`:: A custom banner intended for temporary notices to all users.
Expand All @@ -169,15 +170,15 @@ displays. The default value is 10000. Set this field to `Infinity` to disable wa

[float]
[[kibana-reporting-settings]]
=== Reporting settings
==== Reporting

[horizontal]
`xpackReporting:customPdfLogo`:: A custom image to use in the footer of the PDF.


[float]
[[kibana-rollups-settings]]
=== Rollup settings
==== Rollup

[horizontal]
`rollups:enableIndexPatterns`:: Enables the creation of index patterns that
Expand All @@ -187,7 +188,7 @@ Refresh the page to apply the changes.

[float]
[[kibana-search-settings]]
=== Search settings
==== Search

[horizontal]
`courier:batchSearches`:: **Deprecated in 7.6. Starting in 8.0, this setting will be optimized internally.**
Expand Down Expand Up @@ -215,21 +216,21 @@ might increase the search time. This setting is off by default. Users must opt-i

[float]
[[kibana-siem-settings]]
=== SIEM settings
==== SIEM

[horizontal]
`siem:defaultAnomalyScore`:: The threshold above which Machine Learning job anomalies are displayed in the SIEM app.
`siem:defaultIndex`:: A comma-delimited list of Elasticsearch indices from which the SIEM app collects events.
`siem:enableNewsFeed`:: Enables the security news feed on the SIEM *Overview*
`siem:enableNewsFeed`:: Enables the security news feed on the SIEM *Overview*
page.
`siem:newsFeedUrl`:: The URL from which the security news feed content is
`siem:newsFeedUrl`:: The URL from which the security news feed content is
retrieved.
`siem:refreshIntervalDefaults`:: The default refresh interval for the SIEM time filter, in milliseconds.
`siem:timeDefaults`:: The default period of time in the SIEM time filter.

[float]
[[kibana-timelion-settings]]
=== Timelion settings
==== Timelion

[horizontal]
`timelion:default_columns`:: The default number of columns to use on a Timelion sheet.
Expand All @@ -252,7 +253,7 @@ this is the number of buckets to try to represent.

[float]
[[kibana-visualization-settings]]
=== Visualization settings
==== Visualization

[horizontal]
`visualization:colorMapping`:: Maps values to specified colors in visualizations.
Expand All @@ -273,7 +274,7 @@ If disabled, only visualizations that are considered production-ready are availa

[float]
[[kibana-telemetry-settings]]
=== Usage data settings
==== Usage data

Helps improve the Elastic Stack by providing usage statistics for
basic features. This data will not be shared outside of Elastic.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"@elastic/charts": "^17.0.2",
"@elastic/datemath": "5.0.2",
"@elastic/ems-client": "7.6.0",
"@elastic/eui": "18.3.0",
"@elastic/eui": "19.0.0",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.5",
Expand Down Expand Up @@ -294,8 +294,8 @@
"@kbn/eslint-import-resolver-kibana": "2.0.0",
"@kbn/eslint-plugin-eslint": "1.0.0",
"@kbn/expect": "1.0.0",
"@kbn/plugin-generator": "1.0.0",
"@kbn/optimizer": "1.0.0",
"@kbn/plugin-generator": "1.0.0",
"@kbn/test": "1.0.0",
"@kbn/utility-types": "1.0.0",
"@microsoft/api-documenter": "7.7.2",
Expand Down Expand Up @@ -394,7 +394,7 @@
"chai": "3.5.0",
"chance": "1.0.18",
"cheerio": "0.22.0",
"chromedriver": "79.0.0",
"chromedriver": "^80.0.1",
"classnames": "2.2.6",
"dedent": "^0.7.0",
"delete-empty": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-config-schema/src/types/duration_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('#defaultValue', () => {
source: duration({ defaultValue: 600 }),
target: duration({ defaultValue: siblingRef('source') }),
fromContext: duration({ defaultValue: contextRef('val') }),
}).validate(undefined, { val: momentDuration(700, 'ms') })
}).validate({}, { val: momentDuration(700, 'ms') })
).toMatchInlineSnapshot(`
Object {
"fromContext": "PT0.7S",
Expand All @@ -115,7 +115,7 @@ Object {
source: duration({ defaultValue: '1h' }),
target: duration({ defaultValue: siblingRef('source') }),
fromContext: duration({ defaultValue: contextRef('val') }),
}).validate(undefined, { val: momentDuration(2, 'hour') })
}).validate({}, { val: momentDuration(2, 'hour') })
).toMatchInlineSnapshot(`
Object {
"fromContext": "PT2H",
Expand All @@ -129,7 +129,7 @@ Object {
source: duration({ defaultValue: momentDuration(1, 'hour') }),
target: duration({ defaultValue: siblingRef('source') }),
fromContext: duration({ defaultValue: contextRef('val') }),
}).validate(undefined, { val: momentDuration(2, 'hour') })
}).validate({}, { val: momentDuration(2, 'hour') })
).toMatchInlineSnapshot(`
Object {
"fromContext": "PT2H",
Expand Down
38 changes: 38 additions & 0 deletions packages/kbn-config-schema/src/types/maybe_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,41 @@ test('includes namespace in failure', () => {
const type = schema.maybe(schema.string());
expect(() => type.validate(null, {}, 'foo-namespace')).toThrowErrorMatchingSnapshot();
});

describe('maybe + object', () => {
test('returns undefined if undefined object', () => {
const type = schema.maybe(schema.object({}));
expect(type.validate(undefined)).toEqual(undefined);
});

test('returns undefined if undefined object with no defaults', () => {
const type = schema.maybe(
schema.object({
type: schema.string(),
id: schema.string(),
})
);

expect(type.validate(undefined)).toEqual(undefined);
});

test('returns empty object if maybe keys', () => {
const type = schema.object({
name: schema.maybe(schema.string()),
});
expect(type.validate({})).toEqual({});
});

test('returns empty object if maybe nested object', () => {
const type = schema.object({
name: schema.maybe(
schema.object({
type: schema.string(),
id: schema.string(),
})
),
});

expect(type.validate({})).toEqual({});
});
});
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/src/types/maybe_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class MaybeType<V> extends Type<V | undefined> {
type
.getSchema()
.optional()
.default()
.default(() => undefined, 'undefined')
);
}
}
22 changes: 21 additions & 1 deletion packages/kbn-config-schema/src/types/object_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ test('returns value by default', () => {
expect(type.validate(value)).toEqual({ name: 'test' });
});

test('returns empty object if undefined', () => {
const type = schema.object({});
expect(type.validate(undefined)).toEqual({});
});

test('properly parse the value if input is a string', () => {
const type = schema.object({
name: schema.string(),
Expand Down Expand Up @@ -112,21 +117,36 @@ test('undefined object within object', () => {
}),
});

expect(type.validate(undefined)).toEqual({
foo: {
bar: 'hello world',
},
});

expect(type.validate({})).toEqual({
foo: {
bar: 'hello world',
},
});

expect(type.validate({ foo: {} })).toEqual({
foo: {
bar: 'hello world',
},
});
});

test('object within object with required', () => {
test('object within object with key without defaultValue', () => {
const type = schema.object({
foo: schema.object({
bar: schema.string(),
}),
});
const value = { foo: {} };

expect(() => type.validate(undefined)).toThrowErrorMatchingInlineSnapshot(
`"[foo.bar]: expected value of type [string] but got [undefined]"`
);
expect(() => type.validate(value)).toThrowErrorMatchingInlineSnapshot(
`"[foo.bar]: expected value of type [string] but got [undefined]"`
);
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-config-schema/src/types/object_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ export type ObjectResultType<P extends Props> = Readonly<{ [K in keyof P]: TypeO
export type ObjectTypeOptions<P extends Props = any> = TypeOptions<
{ [K in keyof P]: TypeOf<P[K]> }
> & {
/** Should uknown keys not be defined in the schema be allowed. Defaults to `false` */
allowUnknowns?: boolean;
};

export class ObjectType<P extends Props = any> extends Type<ObjectResultType<P>> {
private props: Record<string, AnySchema>;

constructor(props: P, options: ObjectTypeOptions<P> = {}) {
constructor(props: P, { allowUnknowns = false, ...typeOptions }: ObjectTypeOptions<P> = {}) {
const schemaKeys = {} as Record<string, AnySchema>;
for (const [key, value] of Object.entries(props)) {
schemaKeys[key] = value.getSchema();
}
const { allowUnknowns, ...typeOptions } = options;
const schema = internals
.object()
.keys(schemaKeys)
.optional()
.default()
.optional()
.unknown(Boolean(allowUnknowns));

super(schema, typeOptions);
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-optimizer/src/common/rxjs_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ type Operator<T1, T2> = (source: Rx.Observable<T1>) => Rx.Observable<T2>;
type MapFn<T1, T2> = (item: T1, index: number) => T2;

/**
* Wrap an operator chain in a closure so that is can have some local
* state. The `fn` is called each time the final observable is
* subscribed so the pipeline/closure is setup for each subscription.
* Wrap an operator chain in a closure so that it can have some local
* state. The `fn` is called each time the returned observable is
* subscribed; the closure is recreated for each subscription.
*/
export const pipeClosure = <T1, T2>(fn: Operator<T1, T2>): Operator<T1, T2> => {
return (source: Rx.Observable<T1>) => {
Expand Down
Loading

0 comments on commit 92d4ff0

Please sign in to comment.