Advanced Settings management => typescript (#54477) (#55716)

* advanced settings => typescript
This commit is contained in:
Matthew Kime 2020-01-23 12:05:17 -06:00 committed by GitHub
parent 112a93530a
commit ced9f76723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
112 changed files with 1945 additions and 1945 deletions

View file

@ -91,5 +91,6 @@ readonly links: {
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
};
```

View file

@ -17,5 +17,5 @@ export interface DocLinksStart
| --- | --- | --- |
| [DOC\_LINK\_VERSION](./kibana-plugin-public.doclinksstart.doc_link_version.md) | <code>string</code> | |
| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-public.doclinksstart.elastic_website_url.md) | <code>string</code> | |
| [links](./kibana-plugin-public.doclinksstart.links.md) | <code>{</code><br/><code> readonly filebeat: {</code><br/><code> readonly base: string;</code><br/><code> readonly installation: string;</code><br/><code> readonly configuration: string;</code><br/><code> readonly elasticsearchOutput: string;</code><br/><code> readonly startup: string;</code><br/><code> readonly exportedFields: string;</code><br/><code> };</code><br/><code> readonly auditbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly metricbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly heartbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly logstash: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly functionbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly winlogbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly aggs: {</code><br/><code> readonly date_histogram: string;</code><br/><code> readonly date_range: string;</code><br/><code> readonly filter: string;</code><br/><code> readonly filters: string;</code><br/><code> readonly geohash_grid: string;</code><br/><code> readonly histogram: string;</code><br/><code> readonly ip_range: string;</code><br/><code> readonly range: string;</code><br/><code> readonly significant_terms: string;</code><br/><code> readonly terms: string;</code><br/><code> readonly avg: string;</code><br/><code> readonly avg_bucket: string;</code><br/><code> readonly max_bucket: string;</code><br/><code> readonly min_bucket: string;</code><br/><code> readonly sum_bucket: string;</code><br/><code> readonly cardinality: string;</code><br/><code> readonly count: string;</code><br/><code> readonly cumulative_sum: string;</code><br/><code> readonly derivative: string;</code><br/><code> readonly geo_bounds: string;</code><br/><code> readonly geo_centroid: string;</code><br/><code> readonly max: string;</code><br/><code> readonly median: string;</code><br/><code> readonly min: string;</code><br/><code> readonly moving_avg: string;</code><br/><code> readonly percentile_ranks: string;</code><br/><code> readonly serial_diff: string;</code><br/><code> readonly std_dev: string;</code><br/><code> readonly sum: string;</code><br/><code> readonly top_hits: string;</code><br/><code> };</code><br/><code> readonly scriptedFields: {</code><br/><code> readonly scriptFields: string;</code><br/><code> readonly scriptAggs: string;</code><br/><code> readonly painless: string;</code><br/><code> readonly painlessApi: string;</code><br/><code> readonly painlessSyntax: string;</code><br/><code> readonly luceneExpressions: string;</code><br/><code> };</code><br/><code> readonly indexPatterns: {</code><br/><code> readonly loadingData: string;</code><br/><code> readonly introduction: string;</code><br/><code> };</code><br/><code> readonly kibana: string;</code><br/><code> readonly siem: {</code><br/><code> readonly guide: string;</code><br/><code> readonly gettingStarted: string;</code><br/><code> };</code><br/><code> readonly query: {</code><br/><code> readonly luceneQuerySyntax: string;</code><br/><code> readonly queryDsl: string;</code><br/><code> readonly kueryQuerySyntax: string;</code><br/><code> };</code><br/><code> readonly date: {</code><br/><code> readonly dateMath: string;</code><br/><code> };</code><br/><code> }</code> | |
| [links](./kibana-plugin-public.doclinksstart.links.md) | <code>{</code><br/><code> readonly filebeat: {</code><br/><code> readonly base: string;</code><br/><code> readonly installation: string;</code><br/><code> readonly configuration: string;</code><br/><code> readonly elasticsearchOutput: string;</code><br/><code> readonly startup: string;</code><br/><code> readonly exportedFields: string;</code><br/><code> };</code><br/><code> readonly auditbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly metricbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly heartbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly logstash: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly functionbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly winlogbeat: {</code><br/><code> readonly base: string;</code><br/><code> };</code><br/><code> readonly aggs: {</code><br/><code> readonly date_histogram: string;</code><br/><code> readonly date_range: string;</code><br/><code> readonly filter: string;</code><br/><code> readonly filters: string;</code><br/><code> readonly geohash_grid: string;</code><br/><code> readonly histogram: string;</code><br/><code> readonly ip_range: string;</code><br/><code> readonly range: string;</code><br/><code> readonly significant_terms: string;</code><br/><code> readonly terms: string;</code><br/><code> readonly avg: string;</code><br/><code> readonly avg_bucket: string;</code><br/><code> readonly max_bucket: string;</code><br/><code> readonly min_bucket: string;</code><br/><code> readonly sum_bucket: string;</code><br/><code> readonly cardinality: string;</code><br/><code> readonly count: string;</code><br/><code> readonly cumulative_sum: string;</code><br/><code> readonly derivative: string;</code><br/><code> readonly geo_bounds: string;</code><br/><code> readonly geo_centroid: string;</code><br/><code> readonly max: string;</code><br/><code> readonly median: string;</code><br/><code> readonly min: string;</code><br/><code> readonly moving_avg: string;</code><br/><code> readonly percentile_ranks: string;</code><br/><code> readonly serial_diff: string;</code><br/><code> readonly std_dev: string;</code><br/><code> readonly sum: string;</code><br/><code> readonly top_hits: string;</code><br/><code> };</code><br/><code> readonly scriptedFields: {</code><br/><code> readonly scriptFields: string;</code><br/><code> readonly scriptAggs: string;</code><br/><code> readonly painless: string;</code><br/><code> readonly painlessApi: string;</code><br/><code> readonly painlessSyntax: string;</code><br/><code> readonly luceneExpressions: string;</code><br/><code> };</code><br/><code> readonly indexPatterns: {</code><br/><code> readonly loadingData: string;</code><br/><code> readonly introduction: string;</code><br/><code> };</code><br/><code> readonly kibana: string;</code><br/><code> readonly siem: {</code><br/><code> readonly guide: string;</code><br/><code> readonly gettingStarted: string;</code><br/><code> };</code><br/><code> readonly query: {</code><br/><code> readonly luceneQuerySyntax: string;</code><br/><code> readonly queryDsl: string;</code><br/><code> readonly kueryQuerySyntax: string;</code><br/><code> };</code><br/><code> readonly date: {</code><br/><code> readonly dateMath: string;</code><br/><code> };</code><br/><code> readonly management: Record&lt;string, string&gt;;</code><br/><code> }</code> | |

View file

@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ImageValidation](./kibana-plugin-public.imagevalidation.md) &gt; [maxSize](./kibana-plugin-public.imagevalidation.maxsize.md)
## ImageValidation.maxSize property
<b>Signature:</b>
```typescript
maxSize: {
length: number;
description: string;
};
```

View file

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ImageValidation](./kibana-plugin-public.imagevalidation.md)
## ImageValidation interface
<b>Signature:</b>
```typescript
export interface ImageValidation
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [maxSize](./kibana-plugin-public.imagevalidation.maxsize.md) | <code>{</code><br/><code> length: number;</code><br/><code> description: string;</code><br/><code> }</code> | |

View file

@ -76,6 +76,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IHttpInterceptController](./kibana-plugin-public.ihttpinterceptcontroller.md) | Used to halt a request Promise chain in a [HttpInterceptor](./kibana-plugin-public.httpinterceptor.md)<!-- -->. |
| [IHttpResponse](./kibana-plugin-public.ihttpresponse.md) | |
| [IHttpResponseInterceptorOverrides](./kibana-plugin-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. |
| [ImageValidation](./kibana-plugin-public.imagevalidation.md) | |
| [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) | Client-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. [IUiSettingsClient](./kibana-plugin-public.iuisettingsclient.md) |
| [LegacyCoreSetup](./kibana-plugin-public.legacycoresetup.md) | Setup interface exposed to the legacy platform via the <code>ui/new_platform</code> module. |
| [LegacyCoreStart](./kibana-plugin-public.legacycorestart.md) | Start interface exposed to the legacy platform via the <code>ui/new_platform</code> module. |
@ -110,7 +111,11 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsMigrationVersion](./kibana-plugin-public.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. |
| [SavedObjectsStart](./kibana-plugin-public.savedobjectsstart.md) | |
| [SavedObjectsUpdateOptions](./kibana-plugin-public.savedobjectsupdateoptions.md) | |
| [StringValidationRegex](./kibana-plugin-public.stringvalidationregex.md) | StringValidation with regex object |
| [StringValidationRegexString](./kibana-plugin-public.stringvalidationregexstring.md) | StringValidation as regex string |
| [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | |
| [UserProvidedValues](./kibana-plugin-public.userprovidedvalues.md) | Describes the values explicitly set by user. |
## Type Aliases
@ -144,10 +149,12 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [SavedObjectAttributeSingle](./kibana-plugin-public.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-public.savedobjectattribute.md) |
| [SavedObjectsClientContract](./kibana-plugin-public.savedobjectsclientcontract.md) | SavedObjectsClientContract as implemented by the [SavedObjectsClient](./kibana-plugin-public.savedobjectsclient.md) |
| [StringValidation](./kibana-plugin-public.stringvalidation.md) | Allows regex objects or a regex string |
| [Toast](./kibana-plugin-public.toast.md) | |
| [ToastInput](./kibana-plugin-public.toastinput.md) | Inputs for [IToasts](./kibana-plugin-public.itoasts.md) APIs. |
| [ToastInputFields](./kibana-plugin-public.toastinputfields.md) | Allowed fields for [ToastInput](./kibana-plugin-public.toastinput.md)<!-- -->. |
| [ToastsSetup](./kibana-plugin-public.toastssetup.md) | [IToasts](./kibana-plugin-public.itoasts.md) |
| [ToastsStart](./kibana-plugin-public.toastsstart.md) | [IToasts](./kibana-plugin-public.itoasts.md) |
| [UiSettingsType](./kibana-plugin-public.uisettingstype.md) | UI element type to represent the settings. |
| [UnmountCallback](./kibana-plugin-public.unmountcallback.md) | A function that will unmount the element previously mounted by the associated [MountPoint](./kibana-plugin-public.mountpoint.md) |

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidation](./kibana-plugin-public.stringvalidation.md)
## StringValidation type
Allows regex objects or a regex string
<b>Signature:</b>
```typescript
export declare type StringValidation = StringValidationRegex | StringValidationRegexString;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegex](./kibana-plugin-public.stringvalidationregex.md)
## StringValidationRegex interface
StringValidation with regex object
<b>Signature:</b>
```typescript
export interface StringValidationRegex
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-public.stringvalidationregex.message.md) | <code>string</code> | |
| [regex](./kibana-plugin-public.stringvalidationregex.regex.md) | <code>RegExp</code> | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegex](./kibana-plugin-public.stringvalidationregex.md) &gt; [message](./kibana-plugin-public.stringvalidationregex.message.md)
## StringValidationRegex.message property
<b>Signature:</b>
```typescript
message: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegex](./kibana-plugin-public.stringvalidationregex.md) &gt; [regex](./kibana-plugin-public.stringvalidationregex.regex.md)
## StringValidationRegex.regex property
<b>Signature:</b>
```typescript
regex: RegExp;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegexString](./kibana-plugin-public.stringvalidationregexstring.md)
## StringValidationRegexString interface
StringValidation as regex string
<b>Signature:</b>
```typescript
export interface StringValidationRegexString
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-public.stringvalidationregexstring.message.md) | <code>string</code> | |
| [regexString](./kibana-plugin-public.stringvalidationregexstring.regexstring.md) | <code>string</code> | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegexString](./kibana-plugin-public.stringvalidationregexstring.md) &gt; [message](./kibana-plugin-public.stringvalidationregexstring.message.md)
## StringValidationRegexString.message property
<b>Signature:</b>
```typescript
message: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [StringValidationRegexString](./kibana-plugin-public.stringvalidationregexstring.md) &gt; [regexString](./kibana-plugin-public.stringvalidationregexstring.regexstring.md)
## StringValidationRegexString.regexString property
<b>Signature:</b>
```typescript
regexString: string;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [category](./kibana-plugin-public.uisettingsparams.category.md)
## UiSettingsParams.category property
used to group the configured setting in the UI
<b>Signature:</b>
```typescript
category?: string[];
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [deprecation](./kibana-plugin-public.uisettingsparams.deprecation.md)
## UiSettingsParams.deprecation property
optional deprecation information. Used to generate a deprecation warning.
<b>Signature:</b>
```typescript
deprecation?: DeprecationSettings;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [description](./kibana-plugin-public.uisettingsparams.description.md)
## UiSettingsParams.description property
description provided to a user in UI
<b>Signature:</b>
```typescript
description?: string;
```

View file

@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md)
## UiSettingsParams interface
UiSettings parameters defined by the plugins.
<b>Signature:</b>
```typescript
export interface UiSettingsParams
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [category](./kibana-plugin-public.uisettingsparams.category.md) | <code>string[]</code> | used to group the configured setting in the UI |
| [deprecation](./kibana-plugin-public.uisettingsparams.deprecation.md) | <code>DeprecationSettings</code> | optional deprecation information. Used to generate a deprecation warning. |
| [description](./kibana-plugin-public.uisettingsparams.description.md) | <code>string</code> | description provided to a user in UI |
| [name](./kibana-plugin-public.uisettingsparams.name.md) | <code>string</code> | title in the UI |
| [optionLabels](./kibana-plugin-public.uisettingsparams.optionlabels.md) | <code>Record&lt;string, string&gt;</code> | text labels for 'select' type UI element |
| [options](./kibana-plugin-public.uisettingsparams.options.md) | <code>string[]</code> | array of permitted values for this setting |
| [readonly](./kibana-plugin-public.uisettingsparams.readonly.md) | <code>boolean</code> | a flag indicating that value cannot be changed |
| [requiresPageReload](./kibana-plugin-public.uisettingsparams.requirespagereload.md) | <code>boolean</code> | a flag indicating whether new value applying requires page reloading |
| [type](./kibana-plugin-public.uisettingsparams.type.md) | <code>UiSettingsType</code> | defines a type of UI element [UiSettingsType](./kibana-plugin-public.uisettingstype.md) |
| [validation](./kibana-plugin-public.uisettingsparams.validation.md) | <code>ImageValidation &#124; StringValidation</code> | |
| [value](./kibana-plugin-public.uisettingsparams.value.md) | <code>SavedObjectAttribute</code> | default value to fall back to if a user doesn't provide any |

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [name](./kibana-plugin-public.uisettingsparams.name.md)
## UiSettingsParams.name property
title in the UI
<b>Signature:</b>
```typescript
name?: string;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [optionLabels](./kibana-plugin-public.uisettingsparams.optionlabels.md)
## UiSettingsParams.optionLabels property
text labels for 'select' type UI element
<b>Signature:</b>
```typescript
optionLabels?: Record<string, string>;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [options](./kibana-plugin-public.uisettingsparams.options.md)
## UiSettingsParams.options property
array of permitted values for this setting
<b>Signature:</b>
```typescript
options?: string[];
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [readonly](./kibana-plugin-public.uisettingsparams.readonly.md)
## UiSettingsParams.readonly property
a flag indicating that value cannot be changed
<b>Signature:</b>
```typescript
readonly?: boolean;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [requiresPageReload](./kibana-plugin-public.uisettingsparams.requirespagereload.md)
## UiSettingsParams.requiresPageReload property
a flag indicating whether new value applying requires page reloading
<b>Signature:</b>
```typescript
requiresPageReload?: boolean;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [type](./kibana-plugin-public.uisettingsparams.type.md)
## UiSettingsParams.type property
defines a type of UI element [UiSettingsType](./kibana-plugin-public.uisettingstype.md)
<b>Signature:</b>
```typescript
type?: UiSettingsType;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [validation](./kibana-plugin-public.uisettingsparams.validation.md)
## UiSettingsParams.validation property
<b>Signature:</b>
```typescript
validation?: ImageValidation | StringValidation;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsParams](./kibana-plugin-public.uisettingsparams.md) &gt; [value](./kibana-plugin-public.uisettingsparams.value.md)
## UiSettingsParams.value property
default value to fall back to if a user doesn't provide any
<b>Signature:</b>
```typescript
value?: SavedObjectAttribute;
```

View file

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UiSettingsType](./kibana-plugin-public.uisettingstype.md)
## UiSettingsType type
UI element type to represent the settings.
<b>Signature:</b>
```typescript
export declare type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string' | 'array' | 'image';
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UserProvidedValues](./kibana-plugin-public.userprovidedvalues.md) &gt; [isOverridden](./kibana-plugin-public.userprovidedvalues.isoverridden.md)
## UserProvidedValues.isOverridden property
<b>Signature:</b>
```typescript
isOverridden?: boolean;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UserProvidedValues](./kibana-plugin-public.userprovidedvalues.md)
## UserProvidedValues interface
Describes the values explicitly set by user.
<b>Signature:</b>
```typescript
export interface UserProvidedValues<T = any>
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [isOverridden](./kibana-plugin-public.userprovidedvalues.isoverridden.md) | <code>boolean</code> | |
| [userValue](./kibana-plugin-public.userprovidedvalues.uservalue.md) | <code>T</code> | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [UserProvidedValues](./kibana-plugin-public.userprovidedvalues.md) &gt; [userValue](./kibana-plugin-public.userprovidedvalues.uservalue.md)
## UserProvidedValues.userValue property
<b>Signature:</b>
```typescript
userValue?: T;
```

View file

@ -4,6 +4,7 @@
## ImageValidation interface
<b>Signature:</b>
```typescript

View file

@ -1,226 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md)
## kibana-plugin-server package
The Kibana Core APIs for server-side plugins.
A plugin requires a `kibana.json` file at it's root directory that follows [the manfiest schema](./kibana-plugin-server.pluginmanifest.md) to define static plugin information required to load the plugin.
A plugin's `server/index` file must contain a named import, `plugin`<!-- -->, that implements [PluginInitializer](./kibana-plugin-server.plugininitializer.md) which returns an object that implements [Plugin](./kibana-plugin-server.plugin.md)<!-- -->.
The plugin integrates with the core system via lifecycle events: `setup`<!-- -->, `start`<!-- -->, and `stop`<!-- -->. In each lifecycle method, the plugin will receive the corresponding core services available (either [CoreSetup](./kibana-plugin-server.coresetup.md) or [CoreStart](./kibana-plugin-server.corestart.md)<!-- -->) and any interfaces returned by dependency plugins' lifecycle method. Anything returned by the plugin's lifecycle method will be exposed to downstream dependencies when their corresponding lifecycle methods are invoked.
## Classes
| Class | Description |
| --- | --- |
| [BasePath](./kibana-plugin-server.basepath.md) | Access or manipulate the Kibana base path |
| [ClusterClient](./kibana-plugin-server.clusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-server.clusterclient.md)<!-- -->. |
| [CspConfig](./kibana-plugin-server.cspconfig.md) | CSP configuration for use in Kibana. |
| [ElasticsearchErrorHelpers](./kibana-plugin-server.elasticsearcherrorhelpers.md) | Helpers for working with errors returned from the Elasticsearch service.Since the internal data of errors are subject to change, consumers of the Elasticsearch service should always use these helpers to classify errors instead of checking error internals such as <code>body.error.header[WWW-Authenticate]</code> |
| [KibanaRequest](./kibana-plugin-server.kibanarequest.md) | Kibana specific abstraction for an incoming request. |
| [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) | Error to return when the validation is not successful. |
| [SavedObjectsClient](./kibana-plugin-server.savedobjectsclient.md) | |
| [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) | |
| [SavedObjectsRepository](./kibana-plugin-server.savedobjectsrepository.md) | |
| [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!-- -->See [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md)<!-- -->. |
## Enumerations
| Enumeration | Description |
| --- | --- |
| [AuthResultType](./kibana-plugin-server.authresulttype.md) | |
| [AuthStatus](./kibana-plugin-server.authstatus.md) | Status indicating an outcome of the authentication. |
## Interfaces
| Interface | Description |
| --- | --- |
| [APICaller](./kibana-plugin-server.apicaller.md) | |
| [AssistanceAPIResponse](./kibana-plugin-server.assistanceapiresponse.md) | |
| [AssistantAPIClientParams](./kibana-plugin-server.assistantapiclientparams.md) | |
| [Authenticated](./kibana-plugin-server.authenticated.md) | |
| [AuthResultParams](./kibana-plugin-server.authresultparams.md) | Result of an incoming request authentication. |
| [AuthToolkit](./kibana-plugin-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. |
| [CallAPIOptions](./kibana-plugin-server.callapioptions.md) | The set of options that defines how API call should be made and result be processed. |
| [Capabilities](./kibana-plugin-server.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. |
| [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) | APIs to manage the [Capabilities](./kibana-plugin-server.capabilities.md) that will be used by the application.<!-- -->Plugins relying on capabilities to toggle some of their features should register them during the setup phase using the <code>registerProvider</code> method.<!-- -->Plugins having the responsibility to restrict capabilities depending on a given context should register their capabilities switcher using the <code>registerSwitcher</code> method.<!-- -->Refers to the methods documentation for complete description and examples. |
| [CapabilitiesStart](./kibana-plugin-server.capabilitiesstart.md) | APIs to access the application [Capabilities](./kibana-plugin-server.capabilities.md)<!-- -->. |
| [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) | Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md)<!-- -->.<!-- -->See methods documentation for more detailed examples. |
| [ContextSetup](./kibana-plugin-server.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. |
| [CoreSetup](./kibana-plugin-server.coresetup.md) | Context passed to the plugins <code>setup</code> method. |
| [CoreStart](./kibana-plugin-server.corestart.md) | Context passed to the plugins <code>start</code> method. |
| [CustomHttpResponseOptions](./kibana-plugin-server.customhttpresponseoptions.md) | HTTP response parameters for a response with adjustable status code. |
| [DeprecationAPIClientParams](./kibana-plugin-server.deprecationapiclientparams.md) | |
| [DeprecationAPIResponse](./kibana-plugin-server.deprecationapiresponse.md) | |
| [DeprecationInfo](./kibana-plugin-server.deprecationinfo.md) | |
| [DeprecationSettings](./kibana-plugin-server.deprecationsettings.md) | UiSettings deprecation field options. |
| [DiscoveredPlugin](./kibana-plugin-server.discoveredplugin.md) | Small container object used to expose information about discovered plugins that may or may not have been started. |
| [ElasticsearchError](./kibana-plugin-server.elasticsearcherror.md) | |
| [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) | |
| [EnvironmentMode](./kibana-plugin-server.environmentmode.md) | |
| [ErrorHttpResponseOptions](./kibana-plugin-server.errorhttpresponseoptions.md) | HTTP response parameters |
| [FakeRequest](./kibana-plugin-server.fakerequest.md) | Fake request object created manually by Kibana plugins. |
| [HttpResponseOptions](./kibana-plugin-server.httpresponseoptions.md) | HTTP response parameters |
| [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md) | Kibana HTTP Service provides own abstraction for work with HTTP stack. Plugins don't have direct access to <code>hapi</code> server and its primitives anymore. Moreover, plugins shouldn't rely on the fact that HTTP Service uses one or another library under the hood. This gives the platform flexibility to upgrade or changing our internal HTTP stack without breaking plugins. If the HTTP Service lacks functionality you need, we are happy to discuss and support your needs. |
| [HttpServiceStart](./kibana-plugin-server.httpservicestart.md) | |
| [IContextContainer](./kibana-plugin-server.icontextcontainer.md) | An object that handles registration of context providers and configuring handlers with context. |
| [ICspConfig](./kibana-plugin-server.icspconfig.md) | CSP configuration for use in Kibana. |
| [IKibanaResponse](./kibana-plugin-server.ikibanaresponse.md) | A response data object, expected to returned as a result of [RequestHandler](./kibana-plugin-server.requesthandler.md) execution |
| [IKibanaSocket](./kibana-plugin-server.ikibanasocket.md) | A tiny abstraction for TCP socket. |
| [ImageValidation](./kibana-plugin-server.imagevalidation.md) | |
| [IndexSettingsDeprecationInfo](./kibana-plugin-server.indexsettingsdeprecationinfo.md) | |
| [IRenderOptions](./kibana-plugin-server.irenderoptions.md) | |
| [IRouter](./kibana-plugin-server.irouter.md) | Registers route handlers for specified resource path and method. See [RouteConfig](./kibana-plugin-server.routeconfig.md) and [RequestHandler](./kibana-plugin-server.requesthandler.md) for more information about arguments to route registrations. |
| [IScopedRenderingClient](./kibana-plugin-server.iscopedrenderingclient.md) | |
| [IUiSettingsClient](./kibana-plugin-server.iuisettingsclient.md) | Server-side client that provides access to the advanced settings stored in elasticsearch. The settings provide control over the behavior of the Kibana application. For example, a user can specify how to display numeric or date fields. Users can adjust the settings via Management UI. |
| [KibanaRequestEvents](./kibana-plugin-server.kibanarequestevents.md) | Request events. |
| [KibanaRequestRoute](./kibana-plugin-server.kibanarequestroute.md) | Request specific route information exposed to a handler. |
| [LegacyRequest](./kibana-plugin-server.legacyrequest.md) | |
| [LegacyServiceSetupDeps](./kibana-plugin-server.legacyservicesetupdeps.md) | |
| [LegacyServiceStartDeps](./kibana-plugin-server.legacyservicestartdeps.md) | |
| [Logger](./kibana-plugin-server.logger.md) | Logger exposes all the necessary methods to log any type of information and this is the interface used by the logging consumers including plugins. |
| [LoggerFactory](./kibana-plugin-server.loggerfactory.md) | The single purpose of <code>LoggerFactory</code> interface is to define a way to retrieve a context-based logger instance. |
| [LogMeta](./kibana-plugin-server.logmeta.md) | Contextual metadata |
| [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md) | A tool set defining an outcome of OnPostAuth interceptor for incoming request. |
| [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. |
| [OnPreResponseExtensions](./kibana-plugin-server.onpreresponseextensions.md) | Additional data to extend a response. |
| [OnPreResponseInfo](./kibana-plugin-server.onpreresponseinfo.md) | Response status code. |
| [OnPreResponseToolkit](./kibana-plugin-server.onpreresponsetoolkit.md) | A tool set defining an outcome of OnPreAuth interceptor for incoming request. |
| [PackageInfo](./kibana-plugin-server.packageinfo.md) | |
| [Plugin](./kibana-plugin-server.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginConfigDescriptor](./kibana-plugin-server.pluginconfigdescriptor.md) | Describes a plugin configuration properties. |
| [PluginInitializerContext](./kibana-plugin-server.plugininitializercontext.md) | Context that's available to plugins during initialization stage. |
| [PluginManifest](./kibana-plugin-server.pluginmanifest.md) | Describes the set of required and optional properties plugin can define in its mandatory JSON manifest file. |
| [PluginsServiceSetup](./kibana-plugin-server.pluginsservicesetup.md) | |
| [PluginsServiceStart](./kibana-plugin-server.pluginsservicestart.md) | |
| [RequestHandlerContext](./kibana-plugin-server.requesthandlercontext.md) | Plugin specific context passed to a route handler.<!-- -->Provides the following clients: - [rendering](./kibana-plugin-server.iscopedrenderingclient.md) - Rendering client which uses the data of the incoming request - [savedObjects.client](./kibana-plugin-server.savedobjectsclient.md) - Saved Objects client which uses the credentials of the incoming request - [elasticsearch.dataClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch data client which uses the credentials of the incoming request - [elasticsearch.adminClient](./kibana-plugin-server.scopedclusterclient.md) - Elasticsearch admin client which uses the credentials of the incoming request - [uiSettings.client](./kibana-plugin-server.iuisettingsclient.md) - uiSettings client which uses the credentials of the incoming request |
| [RouteConfig](./kibana-plugin-server.routeconfig.md) | Route specific configuration. |
| [RouteConfigOptions](./kibana-plugin-server.routeconfigoptions.md) | Additional route options. |
| [RouteConfigOptionsBody](./kibana-plugin-server.routeconfigoptionsbody.md) | Additional body options for a route |
| [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) | Validation result factory to be used in the custom validation function to return the valid data or validation errors<!-- -->See [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md)<!-- -->. |
| [RouteValidatorConfig](./kibana-plugin-server.routevalidatorconfig.md) | The configuration object to the RouteValidator class. Set <code>params</code>, <code>query</code> and/or <code>body</code> to specify the validation logic to follow for that property. |
| [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) | Additional options for the RouteValidator class to modify its default behaviour. |
| [SavedObject](./kibana-plugin-server.savedobject.md) | |
| [SavedObjectAttributes](./kibana-plugin-server.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the <code>attributes</code> property. |
| [SavedObjectReference](./kibana-plugin-server.savedobjectreference.md) | A reference to another saved object. |
| [SavedObjectsBaseOptions](./kibana-plugin-server.savedobjectsbaseoptions.md) | |
| [SavedObjectsBulkCreateObject](./kibana-plugin-server.savedobjectsbulkcreateobject.md) | |
| [SavedObjectsBulkGetObject](./kibana-plugin-server.savedobjectsbulkgetobject.md) | |
| [SavedObjectsBulkResponse](./kibana-plugin-server.savedobjectsbulkresponse.md) | |
| [SavedObjectsBulkUpdateObject](./kibana-plugin-server.savedobjectsbulkupdateobject.md) | |
| [SavedObjectsBulkUpdateOptions](./kibana-plugin-server.savedobjectsbulkupdateoptions.md) | |
| [SavedObjectsBulkUpdateResponse](./kibana-plugin-server.savedobjectsbulkupdateresponse.md) | |
| [SavedObjectsClientProviderOptions](./kibana-plugin-server.savedobjectsclientprovideroptions.md) | Options to control the creation of the Saved Objects Client. |
| [SavedObjectsClientWrapperOptions](./kibana-plugin-server.savedobjectsclientwrapperoptions.md) | Options passed to each SavedObjectsClientWrapperFactory to aid in creating the wrapper instance. |
| [SavedObjectsCreateOptions](./kibana-plugin-server.savedobjectscreateoptions.md) | |
| [SavedObjectsDeleteByNamespaceOptions](./kibana-plugin-server.savedobjectsdeletebynamespaceoptions.md) | |
| [SavedObjectsDeleteOptions](./kibana-plugin-server.savedobjectsdeleteoptions.md) | |
| [SavedObjectsExportOptions](./kibana-plugin-server.savedobjectsexportoptions.md) | Options controlling the export operation. |
| [SavedObjectsExportResultDetails](./kibana-plugin-server.savedobjectsexportresultdetails.md) | Structure of the export result details entry |
| [SavedObjectsFindOptions](./kibana-plugin-server.savedobjectsfindoptions.md) | |
| [SavedObjectsFindResponse](./kibana-plugin-server.savedobjectsfindresponse.md) | Return type of the Saved Objects <code>find()</code> method.<!-- -->\*Note\*: this type is different between the Public and Server Saved Objects clients. |
| [SavedObjectsImportConflictError](./kibana-plugin-server.savedobjectsimportconflicterror.md) | Represents a failure to import due to a conflict. |
| [SavedObjectsImportError](./kibana-plugin-server.savedobjectsimporterror.md) | Represents a failure to import. |
| [SavedObjectsImportMissingReferencesError](./kibana-plugin-server.savedobjectsimportmissingreferenceserror.md) | Represents a failure to import due to missing references. |
| [SavedObjectsImportOptions](./kibana-plugin-server.savedobjectsimportoptions.md) | Options to control the import operation. |
| [SavedObjectsImportResponse](./kibana-plugin-server.savedobjectsimportresponse.md) | The response describing the result of an import. |
| [SavedObjectsImportRetry](./kibana-plugin-server.savedobjectsimportretry.md) | Describes a retry operation for importing a saved object. |
| [SavedObjectsImportUnknownError](./kibana-plugin-server.savedobjectsimportunknownerror.md) | Represents a failure to import due to an unknown reason. |
| [SavedObjectsImportUnsupportedTypeError](./kibana-plugin-server.savedobjectsimportunsupportedtypeerror.md) | Represents a failure to import due to having an unsupported saved object type. |
| [SavedObjectsIncrementCounterOptions](./kibana-plugin-server.savedobjectsincrementcounteroptions.md) | |
| [SavedObjectsMigrationLogger](./kibana-plugin-server.savedobjectsmigrationlogger.md) | |
| [SavedObjectsMigrationVersion](./kibana-plugin-server.savedobjectsmigrationversion.md) | Information about the migrations that have been applied to this SavedObject. When Kibana starts up, KibanaMigrator detects outdated documents and migrates them based on this value. For each migration that has been applied, the plugin's name is used as a key and the latest migration version as the value. |
| [SavedObjectsRawDoc](./kibana-plugin-server.savedobjectsrawdoc.md) | A raw document as represented directly in the saved object index. |
| [SavedObjectsRepositoryFactory](./kibana-plugin-server.savedobjectsrepositoryfactory.md) | Factory provided when invoking a [client factory provider](./kibana-plugin-server.savedobjectsclientfactoryprovider.md) See [SavedObjectsServiceSetup.setClientFactoryProvider](./kibana-plugin-server.savedobjectsservicesetup.setclientfactoryprovider.md) |
| [SavedObjectsResolveImportErrorsOptions](./kibana-plugin-server.savedobjectsresolveimporterrorsoptions.md) | Options to control the "resolve import" operation. |
| [SavedObjectsServiceSetup](./kibana-plugin-server.savedobjectsservicesetup.md) | Saved Objects is Kibana's data persistence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceSetup API exposes methods for creating and registering Saved Object client wrappers. |
| [SavedObjectsServiceStart](./kibana-plugin-server.savedobjectsservicestart.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing and querying state. The SavedObjectsServiceStart API provides a scoped Saved Objects client for interacting with Saved Objects. |
| [SavedObjectsUpdateOptions](./kibana-plugin-server.savedobjectsupdateoptions.md) | |
| [SavedObjectsUpdateResponse](./kibana-plugin-server.savedobjectsupdateresponse.md) | |
| [SessionCookieValidationResult](./kibana-plugin-server.sessioncookievalidationresult.md) | Return type from a function to validate cookie contents. |
| [SessionStorage](./kibana-plugin-server.sessionstorage.md) | Provides an interface to store and retrieve data across requests. |
| [SessionStorageCookieOptions](./kibana-plugin-server.sessionstoragecookieoptions.md) | Configuration used to create HTTP session storage based on top of cookie mechanism. |
| [SessionStorageFactory](./kibana-plugin-server.sessionstoragefactory.md) | SessionStorage factory to bind one to an incoming request |
| [StringValidation](./kibana-plugin-server.stringvalidation.md) | |
| [UiSettingsParams](./kibana-plugin-server.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsServiceSetup](./kibana-plugin-server.uisettingsservicesetup.md) | |
| [UiSettingsServiceStart](./kibana-plugin-server.uisettingsservicestart.md) | |
| [UserProvidedValues](./kibana-plugin-server.userprovidedvalues.md) | Describes the values explicitly set by user. |
| [UuidServiceSetup](./kibana-plugin-server.uuidservicesetup.md) | APIs to access the application's instance uuid. |
## Variables
| Variable | Description |
| --- | --- |
| [kibanaResponseFactory](./kibana-plugin-server.kibanaresponsefactory.md) | Set of helpers used to create <code>KibanaResponse</code> to form HTTP response on an incoming request. Should be returned as a result of [RequestHandler](./kibana-plugin-server.requesthandler.md) execution. |
| [validBodyOutput](./kibana-plugin-server.validbodyoutput.md) | The set of valid body.output |
## Type Aliases
| Type Alias | Description |
| --- | --- |
| [AuthenticationHandler](./kibana-plugin-server.authenticationhandler.md) | See [AuthToolkit](./kibana-plugin-server.authtoolkit.md)<!-- -->. |
| [AuthHeaders](./kibana-plugin-server.authheaders.md) | Auth Headers map |
| [AuthResult](./kibana-plugin-server.authresult.md) | |
| [CapabilitiesProvider](./kibana-plugin-server.capabilitiesprovider.md) | See [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) |
| [CapabilitiesSwitcher](./kibana-plugin-server.capabilitiesswitcher.md) | See [CapabilitiesSetup](./kibana-plugin-server.capabilitiessetup.md) |
| [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) | Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) that handles a single deprecation from the configuration. |
| [ConfigDeprecationLogger](./kibana-plugin-server.configdeprecationlogger.md) | Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) |
| [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) | A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md)<!-- -->.<!-- -->See [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) for more usage examples. |
| [ConfigPath](./kibana-plugin-server.configpath.md) | |
| [ElasticsearchClientConfig](./kibana-plugin-server.elasticsearchclientconfig.md) | |
| [GetAuthHeaders](./kibana-plugin-server.getauthheaders.md) | Get headers to authenticate a user against Elasticsearch. |
| [GetAuthState](./kibana-plugin-server.getauthstate.md) | Get authentication state for a request. Returned by <code>auth</code> interceptor. |
| [HandlerContextType](./kibana-plugin-server.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-server.handlerfunction.md) to represent the type of the context. |
| [HandlerFunction](./kibana-plugin-server.handlerfunction.md) | A function that accepts a context object and an optional number of additional arguments. Used for the generic types in [IContextContainer](./kibana-plugin-server.icontextcontainer.md) |
| [HandlerParameters](./kibana-plugin-server.handlerparameters.md) | Extracts the types of the additional arguments of a [HandlerFunction](./kibana-plugin-server.handlerfunction.md)<!-- -->, excluding the [HandlerContextType](./kibana-plugin-server.handlercontexttype.md)<!-- -->. |
| [Headers](./kibana-plugin-server.headers.md) | Http request headers to read. |
| [HttpResponsePayload](./kibana-plugin-server.httpresponsepayload.md) | Data send to the client as a response payload. |
| [IBasePath](./kibana-plugin-server.ibasepath.md) | Access or manipulate the Kibana base path[BasePath](./kibana-plugin-server.basepath.md) |
| [IClusterClient](./kibana-plugin-server.iclusterclient.md) | Represents an Elasticsearch cluster API client created by the platform. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-server.clusterclient.md)<!-- -->. |
| [IContextProvider](./kibana-plugin-server.icontextprovider.md) | A function that returns a context value for a specific key of given context type. |
| [ICustomClusterClient](./kibana-plugin-server.icustomclusterclient.md) | Represents an Elasticsearch cluster API client created by a plugin. It allows to call API on behalf of the internal Kibana user and the actual user that is derived from the request headers (via <code>asScoped(...)</code>).<!-- -->See [ClusterClient](./kibana-plugin-server.clusterclient.md)<!-- -->. |
| [IsAuthenticated](./kibana-plugin-server.isauthenticated.md) | Return authentication status for a request. |
| [ISavedObjectsRepository](./kibana-plugin-server.isavedobjectsrepository.md) | See [SavedObjectsRepository](./kibana-plugin-server.savedobjectsrepository.md) |
| [IScopedClusterClient](./kibana-plugin-server.iscopedclusterclient.md) | Serves the same purpose as "normal" <code>ClusterClient</code> but exposes additional <code>callAsCurrentUser</code> method that doesn't use credentials of the Kibana internal user (as <code>callAsInternalUser</code> does) to request Elasticsearch API, but rather passes HTTP headers extracted from the current user request to the API.<!-- -->See [ScopedClusterClient](./kibana-plugin-server.scopedclusterclient.md)<!-- -->. |
| [KibanaRequestRouteOptions](./kibana-plugin-server.kibanarequestrouteoptions.md) | Route options: If 'GET' or 'OPTIONS' method, body options won't be returned. |
| [KibanaResponseFactory](./kibana-plugin-server.kibanaresponsefactory.md) | Creates an object containing request response payload, HTTP headers, error details, and other data transmitted to the client. |
| [KnownHeaders](./kibana-plugin-server.knownheaders.md) | Set of well-known HTTP headers. |
| [LifecycleResponseFactory](./kibana-plugin-server.lifecycleresponsefactory.md) | Creates an object containing redirection or error response with error details, HTTP headers, and other data transmitted to the client. |
| [MIGRATION\_ASSISTANCE\_INDEX\_ACTION](./kibana-plugin-server.migration_assistance_index_action.md) | |
| [MIGRATION\_DEPRECATION\_LEVEL](./kibana-plugin-server.migration_deprecation_level.md) | |
| [MutatingOperationRefreshSetting](./kibana-plugin-server.mutatingoperationrefreshsetting.md) | Elasticsearch Refresh setting for mutating operation |
| [OnPostAuthHandler](./kibana-plugin-server.onpostauthhandler.md) | See [OnPostAuthToolkit](./kibana-plugin-server.onpostauthtoolkit.md)<!-- -->. |
| [OnPreAuthHandler](./kibana-plugin-server.onpreauthhandler.md) | See [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md)<!-- -->. |
| [OnPreResponseHandler](./kibana-plugin-server.onpreresponsehandler.md) | See [OnPreAuthToolkit](./kibana-plugin-server.onpreauthtoolkit.md)<!-- -->. |
| [PluginConfigSchema](./kibana-plugin-server.pluginconfigschema.md) | Dedicated type for plugin configuration schema. |
| [PluginInitializer](./kibana-plugin-server.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>server</code> directory should conform to this interface. |
| [PluginName](./kibana-plugin-server.pluginname.md) | Dedicated type for plugin name/id that is supposed to make Map/Set/Arrays that use it as a key or value more obvious. |
| [PluginOpaqueId](./kibana-plugin-server.pluginopaqueid.md) | |
| [RecursiveReadonly](./kibana-plugin-server.recursivereadonly.md) | |
| [RedirectResponseOptions](./kibana-plugin-server.redirectresponseoptions.md) | HTTP response parameters for redirection response |
| [RequestHandler](./kibana-plugin-server.requesthandler.md) | A function executed when route path matched requested resource path. Request handler is expected to return a result of one of [KibanaResponseFactory](./kibana-plugin-server.kibanaresponsefactory.md) functions. |
| [RequestHandlerContextContainer](./kibana-plugin-server.requesthandlercontextcontainer.md) | An object that handles registration of http request context providers. |
| [RequestHandlerContextProvider](./kibana-plugin-server.requesthandlercontextprovider.md) | Context provider for request handler. Extends request context object with provided functionality or data. |
| [ResponseError](./kibana-plugin-server.responseerror.md) | Error message and optional data send to the client in case of error. |
| [ResponseErrorAttributes](./kibana-plugin-server.responseerrorattributes.md) | Additional data to provide error details. |
| [ResponseHeaders](./kibana-plugin-server.responseheaders.md) | Http response headers to set. |
| [RouteContentType](./kibana-plugin-server.routecontenttype.md) | The set of supported parseable Content-Types |
| [RouteMethod](./kibana-plugin-server.routemethod.md) | The set of common HTTP methods supported by Kibana routing. |
| [RouteRegistrar](./kibana-plugin-server.routeregistrar.md) | Route handler common definition |
| [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) | The custom validation function if @<!-- -->kbn/config-schema is not a valid solution for your specific plugin requirements. |
| [RouteValidationSpec](./kibana-plugin-server.routevalidationspec.md) | Allowed property validation options: either @<!-- -->kbn/config-schema validations or custom validation functions<!-- -->See [RouteValidationFunction](./kibana-plugin-server.routevalidationfunction.md) for custom validation. |
| [RouteValidatorFullConfig](./kibana-plugin-server.routevalidatorfullconfig.md) | Route validations config and options merged into one object |
| [SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md) | Type definition for a Saved Object attribute value |
| [SavedObjectAttributeSingle](./kibana-plugin-server.savedobjectattributesingle.md) | Don't use this type, it's simply a helper type for [SavedObjectAttribute](./kibana-plugin-server.savedobjectattribute.md) |
| [SavedObjectsClientContract](./kibana-plugin-server.savedobjectsclientcontract.md) | Saved Objects is Kibana's data persisentence mechanism allowing plugins to use Elasticsearch for storing plugin state.<!-- -->\#\# SavedObjectsClient errors<!-- -->Since the SavedObjectsClient has its hands in everything we are a little paranoid about the way we present errors back to to application code. Ideally, all errors will be either:<!-- -->1. Caused by bad implementation (ie. undefined is not a function) and as such unpredictable 2. An error that has been classified and decorated appropriately by the decorators in [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md)<!-- -->Type 1 errors are inevitable, but since all expected/handle-able errors should be Type 2 the <code>isXYZError()</code> helpers exposed at <code>SavedObjectsErrorHelpers</code> should be used to understand and manage error responses from the <code>SavedObjectsClient</code>.<!-- -->Type 2 errors are decorated versions of the source error, so if the elasticsearch client threw an error it will be decorated based on its type. That means that rather than looking for <code>error.body.error.type</code> or doing substring checks on <code>error.body.error.reason</code>, just use the helpers to understand the meaning of the error:<!-- -->\`\`\`<!-- -->js if (SavedObjectsErrorHelpers.isNotFoundError(error)) { // handle 404 }<!-- -->if (SavedObjectsErrorHelpers.isNotAuthorizedError(error)) { // 401 handling should be automatic, but in case you wanted to know }<!-- -->// always rethrow the error unless you handle it throw error; \`\`\`<!-- -->\#\#\# 404s from missing index<!-- -->From the perspective of application code and APIs the SavedObjectsClient is a black box that persists objects. One of the internal details that users have no control over is that we use an elasticsearch index for persistance and that index might be missing.<!-- -->At the time of writing we are in the process of transitioning away from the operating assumption that the SavedObjects index is always available. Part of this transition is handling errors resulting from an index missing. These used to trigger a 500 error in most cases, and in others cause 404s with different error messages.<!-- -->From my (Spencer) perspective, a 404 from the SavedObjectsApi is a 404; The object the request/call was targeting could not be found. This is why \#14141 takes special care to ensure that 404 errors are generic and don't distinguish between index missing or document missing.<!-- -->\#\#\# 503s from missing index<!-- -->Unlike all other methods, create requests are supposed to succeed even when the Kibana index does not exist because it will be automatically created by elasticsearch. When that is not the case it is because Elasticsearch's <code>action.auto_create_index</code> setting prevents it from being created automatically so we throw a special 503 with the intention of informing the user that their Elasticsearch settings need to be updated.<!-- -->See [SavedObjectsClient](./kibana-plugin-server.savedobjectsclient.md) See [SavedObjectsErrorHelpers](./kibana-plugin-server.savedobjectserrorhelpers.md) |
| [SavedObjectsClientFactory](./kibana-plugin-server.savedobjectsclientfactory.md) | Describes the factory used to create instances of the Saved Objects Client. |
| [SavedObjectsClientFactoryProvider](./kibana-plugin-server.savedobjectsclientfactoryprovider.md) | Provider to invoke to retrieve a [SavedObjectsClientFactory](./kibana-plugin-server.savedobjectsclientfactory.md)<!-- -->. |
| [SavedObjectsClientWrapperFactory](./kibana-plugin-server.savedobjectsclientwrapperfactory.md) | Describes the factory used to create instances of Saved Objects Client Wrappers. |
| [ScopeableRequest](./kibana-plugin-server.scopeablerequest.md) | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.<!-- -->See [KibanaRequest](./kibana-plugin-server.kibanarequest.md)<!-- -->. |
| [SharedGlobalConfig](./kibana-plugin-server.sharedglobalconfig.md) | |
| [UiSettingsType](./kibana-plugin-server.uisettingstype.md) | UI element type to represent the settings. |

View file

@ -2,18 +2,12 @@
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidation](./kibana-plugin-server.stringvalidation.md)
## StringValidation interface
## StringValidation type
Allows regex objects or a regex string
<b>Signature:</b>
```typescript
export interface StringValidation
export declare type StringValidation = StringValidationRegex | StringValidationRegexString;
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-server.stringvalidation.message.md) | <code>string</code> | |
| [regexString](./kibana-plugin-server.stringvalidation.regexstring.md) | <code>string</code> | |

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidation](./kibana-plugin-server.stringvalidation.md) &gt; [message](./kibana-plugin-server.stringvalidation.message.md)
## StringValidation.message property
<b>Signature:</b>
```typescript
message: string;
```

View file

@ -1,11 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidation](./kibana-plugin-server.stringvalidation.md) &gt; [regexString](./kibana-plugin-server.stringvalidation.regexstring.md)
## StringValidation.regexString property
<b>Signature:</b>
```typescript
regexString: string;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegex](./kibana-plugin-server.stringvalidationregex.md)
## StringValidationRegex interface
StringValidation with regex object
<b>Signature:</b>
```typescript
export interface StringValidationRegex
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-server.stringvalidationregex.message.md) | <code>string</code> | |
| [regex](./kibana-plugin-server.stringvalidationregex.regex.md) | <code>RegExp</code> | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegex](./kibana-plugin-server.stringvalidationregex.md) &gt; [message](./kibana-plugin-server.stringvalidationregex.message.md)
## StringValidationRegex.message property
<b>Signature:</b>
```typescript
message: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegex](./kibana-plugin-server.stringvalidationregex.md) &gt; [regex](./kibana-plugin-server.stringvalidationregex.regex.md)
## StringValidationRegex.regex property
<b>Signature:</b>
```typescript
regex: RegExp;
```

View file

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegexString](./kibana-plugin-server.stringvalidationregexstring.md)
## StringValidationRegexString interface
StringValidation as regex string
<b>Signature:</b>
```typescript
export interface StringValidationRegexString
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [message](./kibana-plugin-server.stringvalidationregexstring.message.md) | <code>string</code> | |
| [regexString](./kibana-plugin-server.stringvalidationregexstring.regexstring.md) | <code>string</code> | |

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegexString](./kibana-plugin-server.stringvalidationregexstring.md) &gt; [message](./kibana-plugin-server.stringvalidationregexstring.message.md)
## StringValidationRegexString.message property
<b>Signature:</b>
```typescript
message: string;
```

View file

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [StringValidationRegexString](./kibana-plugin-server.stringvalidationregexstring.md) &gt; [regexString](./kibana-plugin-server.stringvalidationregexstring.regexstring.md)
## StringValidationRegexString.regexString property
<b>Signature:</b>
```typescript
regexString: string;
```

View file

@ -9,5 +9,5 @@ UI element type to represent the settings.
<b>Signature:</b>
```typescript
export declare type UiSettingsType = 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string';
export declare type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string' | 'array' | 'image';
```

View file

@ -214,5 +214,6 @@ export interface DocLinksStart {
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
};
}

View file

@ -79,7 +79,16 @@ import {
/** @interal */
export { CoreContext, CoreSystem } from './core_system';
export { RecursiveReadonly, DEFAULT_APP_CATEGORIES } from '../utils';
export { AppCategory } from '../types';
export {
AppCategory,
UiSettingsParams,
UserProvidedValues,
UiSettingsType,
ImageValidation,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from '../types';
export {
ApplicationSetup,

View file

@ -531,6 +531,7 @@ export interface DocLinksStart {
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
};
}
@ -730,6 +731,15 @@ export interface IHttpResponseInterceptorOverrides<TResponseBody = any> {
readonly response?: Readonly<Response>;
}
// @public (undocumented)
export interface ImageValidation {
// (undocumented)
maxSize: {
length: number;
description: string;
};
}
// @public
export type IToasts = Pick<ToastsApi, 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError'>;
@ -1166,6 +1176,25 @@ export class SimpleSavedObject<T extends SavedObjectAttributes> {
_version?: SavedObject<T>['version'];
}
// @public
export type StringValidation = StringValidationRegex | StringValidationRegexString;
// @public
export interface StringValidationRegex {
// (undocumented)
message: string;
// (undocumented)
regex: RegExp;
}
// @public
export interface StringValidationRegexString {
// (undocumented)
message: string;
// (undocumented)
regexString: string;
}
// Warning: (ae-missing-release-tag) "Toast" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@ -1207,14 +1236,42 @@ export type ToastsSetup = IToasts;
// @public (undocumented)
export type ToastsStart = IToasts;
// @public
export interface UiSettingsParams {
category?: string[];
// Warning: (ae-forgotten-export) The symbol "DeprecationSettings" needs to be exported by the entry point index.d.ts
deprecation?: DeprecationSettings;
description?: string;
name?: string;
optionLabels?: Record<string, string>;
options?: string[];
readonly?: boolean;
requiresPageReload?: boolean;
type?: UiSettingsType;
// (undocumented)
validation?: ImageValidation | StringValidation;
value?: SavedObjectAttribute;
}
// @public (undocumented)
export interface UiSettingsState {
// (undocumented)
[key: string]: UiSettingsParams_2 & UserProvidedValues_2;
}
// @public
export type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string' | 'array' | 'image';
// @public
export type UnmountCallback = () => void;
// @public
export interface UserProvidedValues<T = any> {
// (undocumented)
isOverridden?: boolean;
// (undocumented)
userValue?: T;
}
```

View file

@ -17,6 +17,14 @@
* under the License.
*/
export {
UiSettingsParams,
UserProvidedValues,
UiSettingsType,
ImageValidation,
StringValidationRegex,
} from '../../core/types';
/**
* A function that should mount DOM content inside the provided container element
* and return a handler to unmount it.

View file

@ -222,6 +222,8 @@ export {
ImageValidation,
DeprecationSettings,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from './ui_settings';
export { RecursiveReadonly } from '../utils';

View file

@ -33,6 +33,13 @@ export {
SavedObjectsImportRetry,
} from './import/types';
import { SavedObjectAttributes } from '../../types';
export {
SavedObjectAttributes,
SavedObjectAttribute,
SavedObjectAttributeSingle,
} from '../../types';
/**
* Information about the migrations that have been applied to this SavedObject.
* When Kibana starts up, KibanaMigrator detects outdated documents and
@ -52,36 +59,6 @@ export interface SavedObjectsMigrationVersion {
[pluginName: string]: string;
}
/**
* Don't use this type, it's simply a helper type for {@link SavedObjectAttribute}
*
* @public
*/
export type SavedObjectAttributeSingle =
| string
| number
| boolean
| null
| undefined
| SavedObjectAttributes;
/**
* Type definition for a Saved Object attribute value
*
* @public
*/
export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[];
/**
* The data for a Saved Object is stored as an object in the `attributes`
* property.
*
* @public
*/
export interface SavedObjectAttributes {
[key: string]: SavedObjectAttribute;
}
/**
*
* @public

View file

@ -803,8 +803,6 @@ export interface IKibanaSocket {
getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate | null;
}
// Warning: (ae-missing-release-tag) "ImageValidation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ImageValidation {
// (undocumented)
@ -1957,10 +1955,19 @@ export type SharedGlobalConfig = RecursiveReadonly_2<{
path: Pick<PathConfigType, typeof SharedGlobalConfigKeys.path[number]>;
}>;
// Warning: (ae-missing-release-tag) "StringValidation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface StringValidation {
// @public
export type StringValidation = StringValidationRegex | StringValidationRegexString;
// @public
export interface StringValidationRegex {
// (undocumented)
message: string;
// (undocumented)
regex: RegExp;
}
// @public
export interface StringValidationRegexString {
// (undocumented)
message: string;
// (undocumented)
@ -1994,7 +2001,7 @@ export interface UiSettingsServiceStart {
}
// @public
export type UiSettingsType = 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string';
export type UiSettingsType = 'undefined' | 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string' | 'array' | 'image';
// @public
export interface UserProvidedValues<T = any> {

View file

@ -34,4 +34,6 @@ export {
ImageValidation,
DeprecationSettings,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from './types';

View file

@ -16,7 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
import { SavedObjectsClientContract, SavedObjectAttribute } from '../saved_objects/types';
import { SavedObjectsClientContract } from '../saved_objects/types';
import { UiSettingsParams, UserProvidedValues } from '../../types';
export {
UiSettingsParams,
StringValidationRegexString,
StringValidationRegex,
StringValidation,
DeprecationSettings,
ImageValidation,
UiSettingsType,
UserProvidedValues,
} from '../../types';
/**
* Server-side client that provides access to the advanced settings stored in elasticsearch.
* The settings provide control over the behavior of the Kibana application.
@ -64,76 +76,6 @@ export interface IUiSettingsClient {
isOverridden: (key: string) => boolean;
}
/**
* Describes the values explicitly set by user.
* @public
* */
export interface UserProvidedValues<T = any> {
userValue?: T;
isOverridden?: boolean;
}
/**
* UiSettings deprecation field options.
* @public
* */
export interface DeprecationSettings {
/** Deprecation message */
message: string;
/** Key to documentation links */
docLinksKey: string;
}
/**
* UI element type to represent the settings.
* @public
* */
export type UiSettingsType = 'json' | 'markdown' | 'number' | 'select' | 'boolean' | 'string';
/**
* UiSettings parameters defined by the plugins.
* @public
* */
export interface UiSettingsParams {
/** title in the UI */
name?: string;
/** default value to fall back to if a user doesn't provide any */
value?: SavedObjectAttribute;
/** description provided to a user in UI */
description?: string;
/** used to group the configured setting in the UI */
category?: string[];
/** array of permitted values for this setting */
options?: string[];
/** text labels for 'select' type UI element */
optionLabels?: Record<string, string>;
/** a flag indicating whether new value applying requires page reloading */
requiresPageReload?: boolean;
/** a flag indicating that value cannot be changed */
readonly?: boolean;
/** defines a type of UI element {@link UiSettingsType} */
type?: UiSettingsType;
/** optional deprecation information. Used to generate a deprecation warning. */
deprecation?: DeprecationSettings;
/*
* Allows defining a custom validation applicable to value change on the client.
* @deprecated
*/
validation?: ImageValidation | StringValidation;
}
export interface StringValidation {
regexString: string;
message: string;
}
export interface ImageValidation {
maxSize: {
length: number;
description: string;
};
}
/** @internal */
export interface InternalUiSettingsServiceSetup {
/**

View file

@ -24,3 +24,5 @@
export * from './core_service';
export * from './capabilities';
export * from './app_category';
export * from './ui_settings';
export * from './saved_objects';

View file

@ -0,0 +1,48 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Don't use this type, it's simply a helper type for {@link SavedObjectAttribute}
*
* @public
*/
export type SavedObjectAttributeSingle =
| string
| number
| boolean
| null
| undefined
| SavedObjectAttributes;
/**
* Type definition for a Saved Object attribute value
*
* @public
*/
export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttributeSingle[];
/**
* The data for a Saved Object is stored as an object in the `attributes`
* property.
*
* @public
*/
export interface SavedObjectAttributes {
[key: string]: SavedObjectAttribute;
}

View file

@ -0,0 +1,121 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { SavedObjectAttribute } from './saved_objects';
/**
* UI element type to represent the settings.
* @public
* */
export type UiSettingsType =
| 'undefined' // I don't know why malformed UiSettings objects exist
| 'json'
| 'markdown'
| 'number'
| 'select'
| 'boolean'
| 'string'
| 'array'
| 'image';
/**
* UiSettings deprecation field options.
* @public
* */
export interface DeprecationSettings {
/** Deprecation message */
message: string;
/** Key to documentation links */
docLinksKey: string;
}
/**
* UiSettings parameters defined by the plugins.
* @public
* */
export interface UiSettingsParams {
/** title in the UI */
name?: string;
/** default value to fall back to if a user doesn't provide any */
value?: SavedObjectAttribute;
/** description provided to a user in UI */
description?: string;
/** used to group the configured setting in the UI */
category?: string[];
/** array of permitted values for this setting */
options?: string[];
/** text labels for 'select' type UI element */
optionLabels?: Record<string, string>;
/** a flag indicating whether new value applying requires page reloading */
requiresPageReload?: boolean;
/** a flag indicating that value cannot be changed */
readonly?: boolean;
/** defines a type of UI element {@link UiSettingsType} */
type?: UiSettingsType;
/** optional deprecation information. Used to generate a deprecation warning. */
deprecation?: DeprecationSettings;
/*
* Allows defining a custom validation applicable to value change on the client.
* @deprecated
*/
validation?: ImageValidation | StringValidation;
}
/**
* Allows regex objects or a regex string
* @public
* */
export type StringValidation = StringValidationRegex | StringValidationRegexString;
/**
* StringValidation with regex object
* @public
* */
export interface StringValidationRegex {
regex: RegExp;
message: string;
}
/**
* StringValidation as regex string
* @public
* */
export interface StringValidationRegexString {
regexString: string;
message: string;
}
/**
* @public
* */
export interface ImageValidation {
maxSize: {
length: number;
description: string;
};
}
/**
* Describes the values explicitly set by user.
* @public
* */
export interface UserProvidedValues<T = any> {
userValue?: T;
isOverridden?: boolean;
}

View file

@ -0,0 +1,367 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AdvancedSettings should render read-only when saving is disabled 1`] = `
<div>
<EuiFlexGroup
gutterSize="none"
>
<EuiFlexItem>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem>
<Search
categories={
Array [
"category",
"elasticsearch",
]
}
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"group": Array [],
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
"printClause": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<AdvancedSettingsVoiceAnnouncement
queryText="ariaName:\\"test string setting\\""
settings={
Object {
"category": Array [
Object {
"ariaName": "Test string setting",
"category": Array [
"category",
],
"defVal": null,
"deprecation": undefined,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": false,
"isOverridden": false,
"name": "test:string:setting",
"optionLabels": undefined,
"options": undefined,
"readonly": false,
"requiresPageReload": false,
"type": "string",
"validation": undefined,
"value": undefined,
},
],
}
}
/>
<Form
categories={
Array [
"category",
"elasticsearch",
]
}
categoryCounts={
Object {
"category": 12,
"elasticsearch": 2,
}
}
clear={[Function]}
clearQuery={[Function]}
enableSaving={false}
save={[Function]}
settings={
Object {
"category": Array [
Object {
"ariaName": "Test string setting",
"category": Array [
"category",
],
"defVal": null,
"deprecation": undefined,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": false,
"isOverridden": false,
"name": "test:string:setting",
"optionLabels": undefined,
"options": undefined,
"readonly": false,
"requiresPageReload": false,
"type": "string",
"validation": undefined,
"value": undefined,
},
],
}
}
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
enableSaving={false}
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"group": Array [],
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
"printClause": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</div>
`;
exports[`AdvancedSettings should render specific setting if given setting key 1`] = `
<div>
<EuiFlexGroup
gutterSize="none"
>
<EuiFlexItem>
<advanced_settings_page_title />
</EuiFlexItem>
<EuiFlexItem>
<Search
categories={
Array [
"category",
"elasticsearch",
]
}
onQueryChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"group": Array [],
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
"printClause": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</EuiFlexItem>
</EuiFlexGroup>
<advanced_settings_page_subtitle />
<EuiSpacer
size="m"
/>
<CallOuts />
<EuiSpacer
size="m"
/>
<AdvancedSettingsVoiceAnnouncement
queryText="ariaName:\\"test string setting\\""
settings={
Object {
"category": Array [
Object {
"ariaName": "Test string setting",
"category": Array [
"category",
],
"defVal": null,
"deprecation": undefined,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": false,
"isOverridden": false,
"name": "test:string:setting",
"optionLabels": undefined,
"options": undefined,
"readonly": false,
"requiresPageReload": false,
"type": "string",
"validation": undefined,
"value": undefined,
},
],
}
}
/>
<Form
categories={
Array [
"category",
"elasticsearch",
]
}
categoryCounts={
Object {
"category": 12,
"elasticsearch": 2,
}
}
clear={[Function]}
clearQuery={[Function]}
enableSaving={true}
save={[Function]}
settings={
Object {
"category": Array [
Object {
"ariaName": "Test string setting",
"category": Array [
"category",
],
"defVal": null,
"deprecation": undefined,
"description": "Description for Test string setting",
"displayName": "Test string setting",
"isCustom": false,
"isOverridden": false,
"name": "test:string:setting",
"optionLabels": undefined,
"options": undefined,
"readonly": false,
"requiresPageReload": false,
"type": "string",
"validation": undefined,
"value": undefined,
},
],
}
}
showNoResultsMessage={true}
/>
<advanced_settings_page_footer
enableSaving={true}
onQueryMatchChange={[Function]}
query={
Query {
"ast": _AST {
"_clauses": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
"_indexedClauses": Object {
"field": Object {
"ariaName": Array [
Object {
"field": "ariaName",
"match": "must",
"operator": "eq",
"type": "field",
"value": "test string setting",
},
],
},
"group": Array [],
"is": Object {},
"term": Array [],
},
},
"syntax": Object {
"parse": [Function],
"print": [Function],
"printClause": [Function],
},
"text": "ariaName:\\"test string setting\\"",
}
}
/>
</div>
`;

View file

@ -1,173 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import dedent from 'dedent';
import { AdvancedSettings } from './advanced_settings';
jest.mock('./components/field', () => ({
Field: () => {
return 'field';
},
}));
jest.mock('./components/call_outs', () => ({
CallOuts: () => {
return 'callOuts';
},
}));
jest.mock('./components/search', () => ({
Search: () => {
return 'search';
},
}));
const config = {
set: () => {},
remove: () => {},
isCustom: setting => setting.isCustom,
isOverridden: key => Boolean(config.getAll()[key].isOverridden),
getAll: () => {
return {
'test:array:setting': {
value: ['default_value'],
name: 'Test array setting',
description: 'Description for Test array setting',
category: ['elasticsearch'],
},
'test:boolean:setting': {
value: true,
name: 'Test boolean setting',
description: 'Description for Test boolean setting',
category: ['elasticsearch'],
},
'test:image:setting': {
value: null,
name: 'Test image setting',
description: 'Description for Test image setting',
type: 'image',
},
'test:json:setting': {
value: '{"foo": "bar"}',
name: 'Test json setting',
description: 'Description for Test json setting',
type: 'json',
},
'test:markdown:setting': {
value: '',
name: 'Test markdown setting',
description: 'Description for Test markdown setting',
type: 'markdown',
},
'test:number:setting': {
value: 5,
name: 'Test number setting',
description: 'Description for Test number setting',
},
'test:select:setting': {
value: 'orange',
name: 'Test select setting',
description: 'Description for Test select setting',
type: 'select',
options: ['apple', 'orange', 'banana'],
},
'test:string:setting': {
value: null,
name: 'Test string setting',
description: 'Description for Test string setting',
type: 'string',
isCustom: true,
},
'test:readonlystring:setting': {
value: null,
name: 'Test readonly string setting',
description: 'Description for Test readonly string setting',
type: 'string',
readonly: true,
},
'test:customstring:setting': {
value: null,
name: 'Test custom string setting',
description: 'Description for Test custom string setting',
type: 'string',
isCustom: true,
},
'test:isOverridden:string': {
isOverridden: true,
value: 'foo',
name: 'An overridden string',
description: 'Description for overridden string',
type: 'string',
},
'test:isOverridden:number': {
isOverridden: true,
value: 1234,
name: 'An overridden number',
description: 'Description for overridden number',
type: 'number',
},
'test:isOverridden:json': {
isOverridden: true,
value: dedent`
{
"foo": "bar"
}
`,
name: 'An overridden json',
description: 'Description for overridden json',
type: 'json',
},
'test:isOverridden:select': {
isOverridden: true,
value: 'orange',
name: 'Test overridden select setting',
description: 'Description for overridden select setting',
type: 'select',
options: ['apple', 'orange', 'banana'],
},
};
},
};
describe('AdvancedSettings', () => {
it('should render normally', async () => {
const component = shallow(<AdvancedSettings config={config} enableSaving={true} />);
expect(component).toMatchSnapshot();
});
it('should render specific setting if given setting key', async () => {
const component = shallow(
<AdvancedSettings config={config} query="test:string:setting" enableSaving={true} />
);
expect(component).toMatchSnapshot();
});
it('should render read-only when saving is disabled', async () => {
const component = shallow(
<AdvancedSettings config={config} query="test:string:setting" enableSaving={false} />
);
expect(component).toMatchSnapshot();
});
});

View file

@ -0,0 +1,237 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import React from 'react';
import { Observable } from 'rxjs';
import { shallow } from 'enzyme';
import dedent from 'dedent';
import {
UiSettingsParams,
UserProvidedValues,
UiSettingsType,
} from '../../../../../../../core/public';
import { FieldSetting } from './types';
import { AdvancedSettings } from './advanced_settings';
jest.mock('ui/new_platform', () => ({
npStart: mockConfig(),
}));
jest.mock('./components/field', () => ({
Field: () => {
return 'field';
},
}));
jest.mock('./components/call_outs', () => ({
CallOuts: () => {
return 'callOuts';
},
}));
jest.mock('./components/search', () => ({
Search: () => {
return 'search';
},
}));
function mockConfig() {
const defaultConfig: Partial<FieldSetting> = {
displayName: 'defaultName',
requiresPageReload: false,
isOverridden: false,
ariaName: 'ariaName',
readOnly: false,
isCustom: false,
defVal: 'defVal',
type: 'string' as UiSettingsType,
category: ['category'],
};
const config = {
set: (key: string, value: any) => Promise.resolve(true),
remove: (key: string) => Promise.resolve(true),
isCustom: (key: string) => false,
isOverridden: (key: string) => Boolean(config.getAll()[key].isOverridden),
getRegistered: () => ({} as Readonly<Record<string, UiSettingsParams>>),
overrideLocalDefault: (key: string, value: any) => {},
getUpdate$: () =>
new Observable<{
key: string;
newValue: any;
oldValue: any;
}>(),
isDeclared: (key: string) => true,
isDefault: (key: string) => true,
getSaved$: () =>
new Observable<{
key: string;
newValue: any;
oldValue: any;
}>(),
getUpdateErrors$: () => new Observable<Error>(),
get: (key: string, defaultOverride?: any): any => config.getAll()[key] || defaultOverride,
get$: (key: string) => new Observable<any>(config.get(key)),
getAll: (): Readonly<Record<string, UiSettingsParams & UserProvidedValues>> => {
return {
'test:array:setting': {
...defaultConfig,
value: ['default_value'],
name: 'Test array setting',
description: 'Description for Test array setting',
category: ['elasticsearch'],
},
'test:boolean:setting': {
...defaultConfig,
value: true,
name: 'Test boolean setting',
description: 'Description for Test boolean setting',
category: ['elasticsearch'],
},
'test:image:setting': {
...defaultConfig,
value: null,
name: 'Test image setting',
description: 'Description for Test image setting',
type: 'image',
},
'test:json:setting': {
...defaultConfig,
value: '{"foo": "bar"}',
name: 'Test json setting',
description: 'Description for Test json setting',
type: 'json',
},
'test:markdown:setting': {
...defaultConfig,
value: '',
name: 'Test markdown setting',
description: 'Description for Test markdown setting',
type: 'markdown',
},
'test:number:setting': {
...defaultConfig,
value: 5,
name: 'Test number setting',
description: 'Description for Test number setting',
},
'test:select:setting': {
...defaultConfig,
value: 'orange',
name: 'Test select setting',
description: 'Description for Test select setting',
type: 'select',
options: ['apple', 'orange', 'banana'],
},
'test:string:setting': {
...defaultConfig,
...{
value: null,
name: 'Test string setting',
description: 'Description for Test string setting',
type: 'string',
isCustom: true,
},
},
'test:readonlystring:setting': {
...defaultConfig,
...{
value: null,
name: 'Test readonly string setting',
description: 'Description for Test readonly string setting',
type: 'string',
readOnly: true,
},
},
'test:customstring:setting': {
...defaultConfig,
...{
value: null,
name: 'Test custom string setting',
description: 'Description for Test custom string setting',
type: 'string',
isCustom: true,
},
},
'test:isOverridden:string': {
...defaultConfig,
isOverridden: true,
value: 'foo',
name: 'An overridden string',
description: 'Description for overridden string',
type: 'string',
},
'test:isOverridden:number': {
...defaultConfig,
isOverridden: true,
value: 1234,
name: 'An overridden number',
description: 'Description for overridden number',
type: 'number',
},
'test:isOverridden:json': {
...defaultConfig,
isOverridden: true,
value: dedent`
{
"foo": "bar"
}
`,
name: 'An overridden json',
description: 'Description for overridden json',
type: 'json',
},
'test:isOverridden:select': {
...defaultConfig,
isOverridden: true,
value: 'orange',
name: 'Test overridden select setting',
description: 'Description for overridden select setting',
type: 'select',
options: ['apple', 'orange', 'banana'],
},
};
},
};
return {
core: {
uiSettings: config,
},
};
}
describe('AdvancedSettings', () => {
it('should render specific setting if given setting key', async () => {
const component = shallow(
<AdvancedSettings queryText="test:string:setting" enableSaving={true} />
);
expect(component).toMatchSnapshot();
});
it('should render read-only when saving is disabled', async () => {
const component = shallow(
<AdvancedSettings queryText="test:string:setting" enableSaving={false} />
);
expect(component).toMatchSnapshot();
});
});

View file

@ -18,17 +18,19 @@
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Comparators, EuiFlexGroup, EuiFlexItem, EuiSpacer, Query } from '@elastic/eui';
import { npStart } from 'ui/new_platform';
import { CallOuts } from './components/call_outs';
import { Search } from './components/search';
import { Form } from './components/form';
import { AdvancedSettingsVoiceAnnouncement } from './components/advanced_settings_voice_announcement';
import { IUiSettingsClient } from '../../../../../../../core/public/';
import { getAriaName, toEditableConfig, DEFAULT_CATEGORY } from './lib';
import { FieldSetting, IQuery } from './types';
import {
registerDefaultComponents,
PAGE_TITLE_COMPONENT,
@ -37,18 +39,37 @@ import {
} from './components/default_component_registry';
import { getSettingsComponent } from './components/component_registry';
export class AdvancedSettings extends Component {
static propTypes = {
config: PropTypes.object.isRequired,
query: PropTypes.string,
enableSaving: PropTypes.bool.isRequired,
};
interface AdvancedSettingsProps {
queryText: string;
enableSaving: boolean;
}
constructor(props) {
interface AdvancedSettingsState {
footerQueryMatched: boolean;
query: IQuery;
filteredSettings: Record<string, FieldSetting[]>;
}
type GroupedSettings = Record<string, FieldSetting[]>;
export class AdvancedSettings extends Component<AdvancedSettingsProps, AdvancedSettingsState> {
private config: IUiSettingsClient;
private settings: FieldSetting[];
private groupedSettings: GroupedSettings;
private categoryCounts: Record<string, number>;
private categories: string[] = [];
constructor(props: AdvancedSettingsProps) {
super(props);
const { config, query } = this.props;
const parsedQuery = Query.parse(query ? `ariaName:"${getAriaName(query)}"` : '');
this.init(config);
const { queryText } = this.props;
const parsedQuery = Query.parse(queryText ? `ariaName:"${getAriaName(queryText)}"` : '');
this.config = npStart.core.uiSettings;
this.settings = this.initSettings(this.config);
this.groupedSettings = this.initGroupedSettings(this.settings);
this.categories = this.initCategories(this.groupedSettings);
this.categoryCounts = this.initCategoryCounts(this.groupedSettings);
this.state = {
query: parsedQuery,
footerQueryMatched: false,
@ -58,34 +79,44 @@ export class AdvancedSettings extends Component {
registerDefaultComponents();
}
init(config) {
this.settings = this.mapConfig(config);
this.groupedSettings = this.mapSettings(this.settings);
init(config: IUiSettingsClient) {
this.settings = this.initSettings(config);
this.groupedSettings = this.initGroupedSettings(this.settings);
this.categories = this.initCategories(this.groupedSettings);
this.categoryCounts = this.initCategoryCounts(this.groupedSettings);
}
this.categories = Object.keys(this.groupedSettings).sort((a, b) => {
initSettings = this.mapConfig;
initGroupedSettings = this.mapSettings;
initCategories(groupedSettings: GroupedSettings) {
return Object.keys(groupedSettings).sort((a, b) => {
if (a === DEFAULT_CATEGORY) return -1;
if (b === DEFAULT_CATEGORY) return 1;
if (a > b) return 1;
return a === b ? 0 : -1;
});
this.categoryCounts = Object.keys(this.groupedSettings).reduce((counts, category) => {
counts[category] = this.groupedSettings[category].length;
return counts;
}, {});
}
initCategoryCounts(groupedSettings: GroupedSettings) {
return Object.keys(groupedSettings).reduce(
(counts: Record<string, number>, category: string) => {
counts[category] = groupedSettings[category].length;
return counts;
},
{}
);
}
UNSAFE_componentWillReceiveProps(nextProps) {
const { config } = nextProps;
const { query } = this.state;
this.init(config);
this.setState({
filteredSettings: this.mapSettings(Query.execute(query, this.settings)),
componentDidMount() {
this.config.getUpdate$().subscribe(() => {
const { query } = this.state;
this.init(this.config);
this.setState({
filteredSettings: this.mapSettings(Query.execute(query, this.settings)),
});
});
}
mapConfig(config) {
mapConfig(config: IUiSettingsClient) {
const all = config.getAll();
return Object.entries(all)
.map(setting => {
@ -101,9 +132,9 @@ export class AdvancedSettings extends Component {
.sort(Comparators.property('name', Comparators.default('asc')));
}
mapSettings(settings) {
mapSettings(settings: FieldSetting[]) {
// Group settings by category
return settings.reduce((groupedSettings, setting) => {
return settings.reduce((groupedSettings: GroupedSettings, setting) => {
// We will want to change this logic when we put each category on its
// own page aka allowing a setting to be included in multiple categories.
const category = setting.category[0];
@ -112,15 +143,7 @@ export class AdvancedSettings extends Component {
}, {});
}
saveConfig = (name, value) => {
return this.props.config.set(name, value);
};
clearConfig = name => {
return this.props.config.remove(name);
};
onQueryChange = ({ query }) => {
onQueryChange = ({ query }: { query: IQuery }) => {
this.setState({
query,
filteredSettings: this.mapSettings(Query.execute(query, this.settings)),
@ -135,7 +158,7 @@ export class AdvancedSettings extends Component {
});
};
onFooterQueryMatchChange = matched => {
onFooterQueryMatchChange = (matched: boolean) => {
this.setState({
footerQueryMatched: matched,
});
@ -170,8 +193,8 @@ export class AdvancedSettings extends Component {
categories={this.categories}
categoryCounts={this.categoryCounts}
clearQuery={this.clearQuery}
save={this.saveConfig}
clear={this.clearConfig}
save={this.config.set.bind(this.config)}
clear={this.config.remove.bind(this.config)}
showNoResultsMessage={!footerQueryMatched}
enableSaving={this.props.enableSaving}
/>

View file

@ -15,7 +15,7 @@ exports[`Advanced Settings: Voice Announcement should render announcement 1`] =
values={
Object {
"optionLenght": 1,
"query": undefined,
"query": "dark theme",
"sectionLenght": 1,
}
}
@ -40,7 +40,7 @@ exports[`Advanced Settings: Voice Announcement should render nothing 1`] = `
values={
Object {
"optionLenght": 1,
"query": undefined,
"query": "",
"sectionLenght": 1,
}
}

View file

@ -19,28 +19,44 @@
import React from 'react';
import { shallow } from 'enzyme';
import { UiSettingsType } from '../../../../../../../../../core/public';
import { AdvancedSettingsVoiceAnnouncement } from './advanced_settings_voice_announcement';
const settingPartial = {
name: 'name',
isOverridden: false,
type: 'string' as UiSettingsType,
value: 'value',
defVal: 'defVal',
optionLabels: { label: 'label' },
description: 'description',
displayName: 'displayName',
isCustom: false,
requiresPageReload: false,
options: [],
validation: { regex: /a/, message: 'message' },
category: ['category'],
readOnly: false,
};
const testProps = {
nothing: {
query: '',
filteredSettings: [
[
{
ariaName: 'General',
},
],
{
ariaName: 'General',
...settingPartial,
},
],
},
searchResult: {
query: 'dark theme',
filteredSettings: [
[
{
ariaName: 'General',
},
],
{
ariaName: 'General',
...settingPartial,
},
],
},
};
@ -50,7 +66,7 @@ describe('Advanced Settings: Voice Announcement', () => {
const { query, filteredSettings } = testProps.nothing;
const component = shallow(
<AdvancedSettingsVoiceAnnouncement query={query} settings={filteredSettings} />
<AdvancedSettingsVoiceAnnouncement queryText={query} settings={{ filteredSettings }} />
);
expect(component).toMatchSnapshot();
@ -60,7 +76,7 @@ describe('Advanced Settings: Voice Announcement', () => {
const { query, filteredSettings } = testProps.searchResult;
const component = shallow(
<AdvancedSettingsVoiceAnnouncement query={query} settings={filteredSettings} />
<AdvancedSettingsVoiceAnnouncement queryText={query} settings={{ filteredSettings }} />
);
expect(component).toMatchSnapshot();

View file

@ -40,9 +40,15 @@
import React, { Component } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiScreenReaderOnly, EuiDelayRender } from '@elastic/eui';
import { FieldSetting } from '../../types';
export class AdvancedSettingsVoiceAnnouncement extends Component {
shouldComponentUpdate = nextProps => {
interface Props {
queryText: string;
settings: Record<string, FieldSetting[]>;
}
export class AdvancedSettingsVoiceAnnouncement extends Component<Props> {
shouldComponentUpdate = (nextProps: Props) => {
/*
If a user typed smth new, we should clear the previous timer
and start another one + block component rendering.
@ -57,7 +63,7 @@ export class AdvancedSettingsVoiceAnnouncement extends Component {
const filteredSections = Object.values(this.props.settings).map(setting =>
setting.map(option => option.ariaName)
);
const filteredOptions = [].concat(...filteredSections);
const filteredOptions = [...filteredSections];
return (
<EuiScreenReaderOnly>
<div role="region" aria-live="polite">

View file

@ -17,6 +17,7 @@
* under the License.
*/
import React, { FunctionComponent } from 'react';
import {
tryRegisterSettingsComponent,
registerSettingsComponent,
@ -25,15 +26,15 @@ import {
describe('tryRegisterSettingsComponent', () => {
it('should allow a component to be registered', () => {
const component = {};
const component = () => <div />;
expect(tryRegisterSettingsComponent('tryTest1', component)).toEqual(true);
});
it('should return false if the component is already registered, and not allow an override', () => {
const component = {};
const component = () => <div />;
expect(tryRegisterSettingsComponent('tryTest2', component)).toEqual(true);
const updatedComponent = { updated: 'yay' };
const updatedComponent = () => <div />;
expect(tryRegisterSettingsComponent('tryTest2', updatedComponent)).toEqual(false);
expect(getSettingsComponent('tryTest2')).toBe(component);
});
@ -41,49 +42,36 @@ describe('tryRegisterSettingsComponent', () => {
describe('registerSettingsComponent', () => {
it('should allow a component to be registered', () => {
const component = {};
const component = () => <div />;
registerSettingsComponent('test', component);
});
it('should disallow registering a component with a duplicate id', () => {
const component = {};
const component = () => <div />;
registerSettingsComponent('test2', component);
expect(() =>
registerSettingsComponent('test2', 'some other component')
).toThrowErrorMatchingSnapshot();
expect(() => registerSettingsComponent('test2', () => <span />)).toThrowErrorMatchingSnapshot();
});
it('should allow a component to be overriden', () => {
const component = {};
const component = () => <div />;
registerSettingsComponent('test3', component);
const anotherComponent = { anotherComponent: 'ok' };
const anotherComponent = () => <span />;
registerSettingsComponent('test3', anotherComponent, true);
expect(getSettingsComponent('test3')).toBe(anotherComponent);
});
it('should set a displayName for the component if one does not exist', () => {
const component = {};
it('should set a displayName for the component', () => {
const component = () => <div />;
registerSettingsComponent('display_name_component', component);
expect(component.displayName).toEqual('display_name_component');
});
it('should not set a displayName for the component if one already exists', () => {
const component = {
displayName: '<AwesomeComponent>',
};
registerSettingsComponent('another_display_name_component', component);
expect(component.displayName).toEqual('<AwesomeComponent>');
expect((component as FunctionComponent).displayName).toEqual('display_name_component');
});
});
describe('getSettingsComponent', () => {
it('should allow a component to be retrieved', () => {
const component = {};
const component = () => <div />;
registerSettingsComponent('test4', component);
expect(getSettingsComponent('test4')).toBe(component);
});

View file

@ -17,7 +17,10 @@
* under the License.
*/
const registry = {};
import { ComponentType } from 'react';
type Id = string;
const registry: Record<Id, ComponentType<Record<string, any> | undefined>> = {};
/**
* Attempts to register the provided component.
@ -26,7 +29,10 @@ const registry = {};
* @param {*} id the id of the component to register
* @param {*} component the component
*/
export function tryRegisterSettingsComponent(id, component) {
export function tryRegisterSettingsComponent(
id: Id,
component: ComponentType<Record<string, any> | undefined>
) {
if (id in registry) {
return false;
}
@ -45,7 +51,11 @@ export function tryRegisterSettingsComponent(id, component) {
* @param {*} component the component
* @param {*} allowOverride (default: false) - optional flag to allow this component to override a previously registered component
*/
export function registerSettingsComponent(id, component, allowOverride = false) {
export function registerSettingsComponent(
id: Id,
component: ComponentType<Record<string, any> | undefined>,
allowOverride = false
) {
if (!allowOverride && id in registry) {
throw new Error(`Component with id ${id} is already registered.`);
}
@ -65,7 +75,7 @@ export function registerSettingsComponent(id, component, allowOverride = false)
*
* @param {*} id the ID of the component to retrieve
*/
export function getSettingsComponent(id) {
export function getSettingsComponent(id: Id): ComponentType<Record<string, any> | undefined> {
if (!(id in registry)) {
throw new Error(`Component not found with id ${id}`);
}

View file

@ -17,6 +17,7 @@
* under the License.
*/
import React from 'react';
import { registerDefaultComponents, PAGE_TITLE_COMPONENT } from './default_component_registry';
import { getSettingsComponent, registerSettingsComponent } from './component_registry';
import { PageTitle } from './page_title';
@ -34,7 +35,7 @@ describe('default_component_registry', () => {
});
it('should not override components if they are already registered', () => {
const newComponent = {};
const newComponent = () => <div />;
registerSettingsComponent(PAGE_TITLE_COMPONENT, newComponent, true);
registerDefaultComponents();

View file

@ -1309,7 +1309,6 @@ exports[`Field for json setting should render as read only if saving is disabled
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
@ -1420,7 +1419,6 @@ exports[`Field for json setting should render as read only with help text if ove
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
@ -1637,7 +1635,6 @@ exports[`Field for json setting should render default value if there is no user
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}
@ -1765,7 +1762,6 @@ exports[`Field for json setting should render user value if there is user value
Object {
"value": <EuiCodeBlock
language="json"
overflowHeight={null}
paddingSize="s"
>
{}

View file

@ -21,7 +21,10 @@ import React from 'react';
import { I18nProvider } from '@kbn/i18n/react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
import { mount } from 'enzyme';
import { FieldSetting } from '../../types';
import { UiSettingsType, StringValidation } from '../../../../../../../../../core/public';
// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { Field } from './field';
@ -37,7 +40,13 @@ import { toastNotifications } from 'ui/notify';
jest.mock('brace/theme/textmate', () => 'brace/theme/textmate');
jest.mock('brace/mode/markdown', () => 'brace/mode/markdown');
const settings = {
const defaults = {
requiresPageReload: false,
readOnly: false,
category: ['category'],
};
const settings: Record<string, FieldSetting> = {
array: {
name: 'array:test:setting',
ariaName: 'array test setting',
@ -48,7 +57,7 @@ const settings = {
defVal: ['default_value'],
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
boolean: {
name: 'boolean:test:setting',
@ -60,7 +69,7 @@ const settings = {
defVal: true,
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
image: {
name: 'image:test:setting',
@ -78,6 +87,7 @@ const settings = {
description: 'Description for 1 kB',
},
},
...defaults,
},
json: {
name: 'json:test:setting',
@ -89,7 +99,7 @@ const settings = {
defVal: '{}',
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
markdown: {
name: 'markdown:test:setting',
@ -101,7 +111,7 @@ const settings = {
defVal: '',
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
number: {
name: 'number:test:setting',
@ -113,7 +123,7 @@ const settings = {
defVal: 5,
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
select: {
name: 'select:test:setting',
@ -131,6 +141,7 @@ const settings = {
orange: 'Orange',
// Deliberately left out `banana` to test if it also works with missing labels
},
...defaults,
},
string: {
name: 'string:test:setting',
@ -142,7 +153,7 @@ const settings = {
defVal: null,
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
stringWithValidation: {
name: 'string:test-validation:setting',
@ -158,7 +169,7 @@ const settings = {
defVal: 'foo-default',
isCustom: false,
isOverridden: false,
options: null,
...defaults,
},
};
const userValues = {
@ -175,8 +186,8 @@ const userValues = {
const invalidUserValues = {
stringWithValidation: 'invalidUserValue',
};
const save = jest.fn(() => Promise.resolve());
const clear = jest.fn(() => Promise.resolve());
const save = jest.fn(() => Promise.resolve(true));
const clear = jest.fn(() => Promise.resolve(true));
describe('Field', () => {
Object.keys(settings).forEach(type => {
@ -196,6 +207,7 @@ describe('Field', () => {
<Field
setting={{
...setting,
// @ts-ignore
value: userValues[type],
isOverridden: true,
}}
@ -221,6 +233,7 @@ describe('Field', () => {
<Field
setting={{
...setting,
// @ts-ignore
value: userValues[type],
}}
save={save}
@ -263,6 +276,7 @@ describe('Field', () => {
/>
);
const select = findTestSubject(component, `advancedSetting-editField-${setting.name}`);
// @ts-ignore
const labels = select.find('option').map(option => option.prop('value'));
expect(labels).toEqual(['apple', 'orange', 'banana']);
});
@ -280,13 +294,14 @@ describe('Field', () => {
/>
);
const select = findTestSubject(component, `advancedSetting-editField-${setting.name}`);
// @ts-ignore
const labels = select.find('option').map(option => option.text());
expect(labels).toEqual(['Apple', 'Orange', 'banana']);
});
}
const setup = () => {
const Wrapper = props => (
const Wrapper = (props: Record<string, any>) => (
<I18nProvider>
<Field setting={setting} save={save} clear={clear} enableSaving={true} {...props} />
</I18nProvider>
@ -304,21 +319,22 @@ describe('Field', () => {
describe(`for changing ${type} setting`, () => {
const { wrapper, component } = setup();
const userValue = userValues[type];
component.instance().getImageAsBase64 = file => Promise.resolve(file);
(component.instance() as Field).getImageAsBase64 = ({}: Blob) => Promise.resolve('');
it('should be able to change value from no value and cancel', async () => {
await component.instance().onImageChange([userValue]);
await (component.instance() as Field).onImageChange([userValue]);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-cancelEditField-${setting.name}`).simulate(
'click'
);
expect(
component.instance().state.unsavedValue === component.instance().state.savedValue
(component.instance() as Field).state.unsavedValue ===
(component.instance() as Field).state.savedValue
).toBe(true);
});
it('should be able to change value and save', async () => {
await component.instance().onImageChange([userValue]);
await (component.instance() as Field).onImageChange([userValue]);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-saveEditField-${setting.name}`).simulate(
'click'
@ -327,12 +343,12 @@ describe('Field', () => {
component.setState({ savedValue: userValue });
await wrapper.setProps({
setting: {
...component.instance().props.setting,
...(component.instance() as Field).props.setting,
value: userValue,
},
});
await component.instance().cancelChangeImage();
await (component.instance() as Field).cancelChangeImage();
wrapper.update();
});
@ -341,7 +357,7 @@ describe('Field', () => {
findTestSubject(updated, `advancedSetting-changeImage-${setting.name}`).simulate('click');
const newUserValue = `${userValue}=`;
await component.instance().onImageChange([newUserValue]);
await (component.instance() as Field).onImageChange([newUserValue]);
const updated2 = wrapper.update();
findTestSubject(updated2, `advancedSetting-saveEditField-${setting.name}`).simulate(
'click'
@ -350,7 +366,7 @@ describe('Field', () => {
component.setState({ savedValue: newUserValue });
await wrapper.setProps({
setting: {
...component.instance().props.setting,
...(component.instance() as Field).props.setting,
value: newUserValue,
},
});
@ -370,18 +386,19 @@ describe('Field', () => {
const fieldUserValue = userValue;
it('should be able to change value and cancel', async () => {
component.instance().onCodeEditorChange(fieldUserValue);
(component.instance() as Field).onCodeEditorChange(fieldUserValue as UiSettingsType);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-cancelEditField-${setting.name}`).simulate(
'click'
);
expect(
component.instance().state.unsavedValue === component.instance().state.savedValue
(component.instance() as Field).state.unsavedValue ===
(component.instance() as Field).state.savedValue
).toBe(true);
});
it('should be able to change value and save', async () => {
component.instance().onCodeEditorChange(fieldUserValue);
(component.instance() as Field).onCodeEditorChange(fieldUserValue as UiSettingsType);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-saveEditField-${setting.name}`).simulate(
'click'
@ -390,7 +407,7 @@ describe('Field', () => {
component.setState({ savedValue: fieldUserValue });
await wrapper.setProps({
setting: {
...component.instance().props.setting,
...(component.instance() as Field).props.setting,
value: userValue,
},
});
@ -399,9 +416,9 @@ describe('Field', () => {
if (type === 'json') {
it('should be able to clear value and have empty object populate', async () => {
component.instance().onCodeEditorChange('');
(component.instance() as Field).onCodeEditorChange('' as UiSettingsType);
wrapper.update();
expect(component.instance().state.unsavedValue).toEqual('{}');
expect((component.instance() as Field).state.unsavedValue).toEqual('{}');
});
}
@ -414,32 +431,35 @@ describe('Field', () => {
} else {
describe(`for changing ${type} setting`, () => {
const { wrapper, component } = setup();
// @ts-ignore
const userValue = userValues[type];
const fieldUserValue = type === 'array' ? userValue.join(', ') : userValue;
if (setting.validation) {
// @ts-ignore
const invalidUserValue = invalidUserValues[type];
it('should display an error when validation fails', async () => {
component.instance().onFieldChange({ target: { value: invalidUserValue } });
(component.instance() as Field).onFieldChange(invalidUserValue);
const updated = wrapper.update();
const errorMessage = updated.find('.euiFormErrorText').text();
expect(errorMessage).toEqual(setting.validation.message);
expect(errorMessage).toEqual((setting.validation as StringValidation).message);
});
}
it('should be able to change value and cancel', async () => {
component.instance().onFieldChange({ target: { value: fieldUserValue } });
(component.instance() as Field).onFieldChange(fieldUserValue);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-cancelEditField-${setting.name}`).simulate(
'click'
);
expect(
component.instance().state.unsavedValue === component.instance().state.savedValue
(component.instance() as Field).state.unsavedValue ===
(component.instance() as Field).state.savedValue
).toBe(true);
});
it('should be able to change value and save', async () => {
component.instance().onFieldChange({ target: { value: fieldUserValue } });
(component.instance() as Field).onFieldChange(fieldUserValue);
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-saveEditField-${setting.name}`).simulate(
'click'
@ -448,7 +468,7 @@ describe('Field', () => {
component.setState({ savedValue: fieldUserValue });
await wrapper.setProps({
setting: {
...component.instance().props.setting,
...(component.instance() as Field).props.setting,
value: userValue,
},
});
@ -472,7 +492,7 @@ describe('Field', () => {
const wrapper = mountWithI18nProvider(
<Field setting={setting} save={save} clear={clear} enableSaving={true} />
);
wrapper.instance().onFieldChange({ target: { value: 'a new value' } });
(wrapper.instance() as Field).onFieldChange({ target: { value: 'a new value' } });
const updated = wrapper.update();
findTestSubject(updated, `advancedSetting-saveEditField-${setting.name}`).simulate('click');
expect(save).toHaveBeenCalled();

View file

@ -18,7 +18,7 @@
*/
import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { npStart } from 'ui/new_platform';
import 'brace/theme/textmate';
@ -35,6 +35,7 @@ import {
EuiDescribedFormGroup,
EuiFieldNumber,
EuiFieldText,
// @ts-ignore
EuiFilePicker,
EuiFlexGroup,
EuiFlexItem,
@ -47,22 +48,39 @@ import {
EuiText,
EuiSelect,
EuiSwitch,
EuiSwitchEvent,
keyCodes,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { FieldSetting } from '../../types';
import { isDefaultValue } from '../../lib';
import {
UiSettingsType,
ImageValidation,
StringValidationRegex,
} from '../../../../../../../../../core/public';
export class Field extends PureComponent {
static propTypes = {
setting: PropTypes.object.isRequired,
save: PropTypes.func.isRequired,
clear: PropTypes.func.isRequired,
enableSaving: PropTypes.bool.isRequired,
};
interface FieldProps {
setting: FieldSetting;
save: (name: string, value: string) => Promise<boolean>;
clear: (name: string) => Promise<boolean>;
enableSaving: boolean;
}
constructor(props) {
interface FieldState {
unsavedValue: any;
savedValue: any;
loading: boolean;
isInvalid: boolean;
error: string | null;
changeImage: boolean;
isJsonArray: boolean;
}
export class Field extends PureComponent<FieldProps, FieldState> {
private changeImageForm: EuiFilePicker | undefined;
constructor(props: FieldProps) {
super(props);
const { type, value, defVal } = this.props.setting;
const editableValue = this.getEditableValue(type, value, defVal);
@ -74,12 +92,11 @@ export class Field extends PureComponent {
changeImage: false,
savedValue: editableValue,
unsavedValue: editableValue,
isJsonArray: type === 'json' ? Array.isArray(JSON.parse(defVal || '{}')) : false,
isJsonArray: type === 'json' ? Array.isArray(JSON.parse(String(defVal) || '{}')) : false,
};
this.changeImageForm = null;
}
UNSAFE_componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps: FieldProps) {
const { unsavedValue } = this.state;
const { type, value, defVal } = nextProps.setting;
const editableValue = this.getEditableValue(type, value, defVal);
@ -90,11 +107,15 @@ export class Field extends PureComponent {
});
}
getEditableValue(type, value, defVal) {
getEditableValue(
type: UiSettingsType,
value: FieldSetting['value'],
defVal: FieldSetting['defVal']
) {
const val = value === null || value === undefined ? defVal : value;
switch (type) {
case 'array':
return val.join(', ');
return (val as string[]).join(', ');
case 'boolean':
return !!val;
case 'number':
@ -106,21 +127,27 @@ export class Field extends PureComponent {
}
}
getDisplayedDefaultValue(type, defVal, optionLabels = {}) {
getDisplayedDefaultValue(
type: UiSettingsType,
defVal: FieldSetting['defVal'],
optionLabels: Record<string, any> = {}
) {
if (defVal === undefined || defVal === null || defVal === '') {
return 'null';
}
switch (type) {
case 'array':
return defVal.join(', ');
return (defVal as string[]).join(', ');
case 'select':
return optionLabels.hasOwnProperty(defVal) ? optionLabels[defVal] : String(defVal);
return optionLabels.hasOwnProperty(String(defVal))
? optionLabels[String(defVal)]
: String(defVal);
default:
return String(defVal);
}
}
setLoading(loading) {
setLoading(loading: boolean) {
this.setState({
loading,
});
@ -133,11 +160,11 @@ export class Field extends PureComponent {
});
}
onCodeEditorChange = value => {
onCodeEditorChange = (value: UiSettingsType) => {
const { type } = this.props.setting;
const { isJsonArray } = this.state;
let newUnsavedValue = undefined;
let newUnsavedValue;
let isInvalid = false;
let error = null;
@ -148,12 +175,9 @@ export class Field extends PureComponent {
JSON.parse(newUnsavedValue);
} catch (e) {
isInvalid = true;
error = (
<FormattedMessage
id="kbn.management.settings.field.codeEditorSyntaxErrorMessage"
defaultMessage="Invalid JSON syntax"
/>
);
error = i18n.translate('kbn.management.settings.field.codeEditorSyntaxErrorMessage', {
defaultMessage: 'Invalid JSON syntax',
});
}
break;
default:
@ -167,12 +191,18 @@ export class Field extends PureComponent {
});
};
onFieldChange = e => {
const value = e.target.value;
onFieldChangeSwitch = (e: EuiSwitchEvent) => {
return this.onFieldChange(e.target.checked);
};
onFieldChangeEvent = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) =>
this.onFieldChange(e.target.value);
onFieldChange = (value: any) => {
const { type, validation } = this.props.setting;
const { unsavedValue } = this.state;
let newUnsavedValue = undefined;
let newUnsavedValue;
switch (type) {
case 'boolean':
@ -186,11 +216,11 @@ export class Field extends PureComponent {
}
let isInvalid = false;
let error = undefined;
let error = null;
if (validation && validation.regex) {
if (!validation.regex.test(newUnsavedValue)) {
error = validation.message;
if (validation && (validation as StringValidationRegex).regex) {
if (!(validation as StringValidationRegex).regex!.test(newUnsavedValue.toString())) {
error = (validation as StringValidationRegex).message;
isInvalid = true;
}
}
@ -202,7 +232,7 @@ export class Field extends PureComponent {
});
};
onFieldKeyDown = ({ keyCode }) => {
onFieldKeyDown = ({ keyCode }: { keyCode: number }) => {
if (keyCode === keyCodes.ENTER) {
this.saveEdit();
}
@ -211,13 +241,13 @@ export class Field extends PureComponent {
}
};
onFieldEscape = ({ keyCode }) => {
onFieldEscape = ({ keyCode }: { keyCode: number }) => {
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
};
onImageChange = async files => {
onImageChange = async (files: any[]) => {
if (!files.length) {
this.clearError();
this.setState({
@ -227,9 +257,12 @@ export class Field extends PureComponent {
}
const file = files[0];
const { maxSize } = this.props.setting.validation;
const { maxSize } = this.props.setting.validation as ImageValidation;
try {
const base64Image = await this.getImageAsBase64(file);
let base64Image = '';
if (file instanceof File) {
base64Image = (await this.getImageAsBase64(file)) as string;
}
const isInvalid = !!(maxSize && maxSize.length && base64Image.length > maxSize.length);
this.setState({
isInvalid,
@ -254,17 +287,13 @@ export class Field extends PureComponent {
}
};
getImageAsBase64(file) {
if (!file instanceof File) {
return null;
}
async getImageAsBase64(file: Blob): Promise<string | ArrayBuffer> {
const reader = new FileReader();
reader.readAsDataURL(file);
return new Promise((resolve, reject) => {
reader.onload = () => {
resolve(reader.result);
resolve(reader.result || undefined);
};
reader.onerror = err => {
reject(err);
@ -309,20 +338,24 @@ export class Field extends PureComponent {
settingName: this.props.setting.displayName || this.props.setting.name,
},
}),
text: (
<>
<EuiFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButton size="s" onClick={() => window.location.reload()}>
{i18n.translate(
'kbn.management.settings.field.requiresPageReloadToastButtonLabel',
{ defaultMessage: 'Reload page' }
)}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</>
),
text: element => {
const content = (
<>
<EuiFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButton size="s" onClick={() => window.location.reload()}>
{i18n.translate(
'kbn.management.settings.field.requiresPageReloadToastButtonLabel',
{ defaultMessage: 'Reload page' }
)}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</>
);
ReactDOM.render(content, element);
return () => ReactDOM.unmountComponentAtNode(element);
},
color: 'success',
});
}
@ -341,8 +374,8 @@ export class Field extends PureComponent {
switch (type) {
case 'array':
valueToSave = valueToSave.split(',').map(val => val.trim());
isSameValue = valueToSave.join(',') === defVal.join(',');
valueToSave = valueToSave.split(',').map((val: string) => val.trim());
isSameValue = valueToSave.join(',') === (defVal as string[]).join(',');
break;
case 'json':
valueToSave = valueToSave.trim();
@ -394,7 +427,7 @@ export class Field extends PureComponent {
this.setLoading(false);
};
renderField(setting) {
renderField(setting: FieldSetting) {
const { enableSaving } = this.props;
const { loading, changeImage, unsavedValue } = this.state;
const { name, value, type, options, optionLabels = {}, isOverridden, ariaName } = setting;
@ -414,7 +447,7 @@ export class Field extends PureComponent {
)
}
checked={!!unsavedValue}
onChange={this.onFieldChange}
onChange={this.onFieldChangeSwitch}
disabled={loading || isOverridden || !enableSaving}
onKeyDown={this.onFieldKeyDown}
data-test-subj={`advancedSetting-editField-${name}`}
@ -449,14 +482,16 @@ export class Field extends PureComponent {
);
case 'image':
if (!isDefaultValue(setting) && !changeImage) {
return <EuiImage aria-label={ariaName} allowFullScreen url={value} alt={name} />;
return (
<EuiImage aria-label={ariaName} allowFullScreen url={value as string} alt={name} />
);
} else {
return (
<EuiFilePicker
disabled={loading || isOverridden || !enableSaving}
onChange={this.onImageChange}
accept=".jpg,.jpeg,.png"
ref={input => {
ref={(input: HTMLInputElement) => {
this.changeImageForm = input;
}}
onKeyDown={this.onFieldEscape}
@ -469,13 +504,13 @@ export class Field extends PureComponent {
<EuiSelect
aria-label={ariaName}
value={unsavedValue}
options={options.map(option => {
options={(options as string[]).map(option => {
return {
text: optionLabels.hasOwnProperty(option) ? optionLabels[option] : option,
value: option,
};
})}
onChange={this.onFieldChange}
onChange={this.onFieldChangeEvent}
isLoading={loading}
disabled={loading || isOverridden || !enableSaving}
onKeyDown={this.onFieldKeyDown}
@ -487,7 +522,7 @@ export class Field extends PureComponent {
<EuiFieldNumber
aria-label={ariaName}
value={unsavedValue}
onChange={this.onFieldChange}
onChange={this.onFieldChangeEvent}
isLoading={loading}
disabled={loading || isOverridden || !enableSaving}
onKeyDown={this.onFieldKeyDown}
@ -499,7 +534,7 @@ export class Field extends PureComponent {
<EuiFieldText
aria-label={ariaName}
value={unsavedValue}
onChange={this.onFieldChange}
onChange={this.onFieldChangeEvent}
isLoading={loading}
disabled={loading || isOverridden || !enableSaving}
onKeyDown={this.onFieldKeyDown}
@ -509,11 +544,11 @@ export class Field extends PureComponent {
}
}
renderLabel(setting) {
renderLabel(setting: FieldSetting) {
return setting.name;
}
renderHelpText(setting) {
renderHelpText(setting: FieldSetting) {
if (setting.isOverridden) {
return (
<EuiText size="xs">
@ -541,7 +576,7 @@ export class Field extends PureComponent {
return null;
}
renderTitle(setting) {
renderTitle(setting: FieldSetting) {
return (
<h3>
{setting.displayName || setting.name}
@ -566,7 +601,7 @@ export class Field extends PureComponent {
);
}
renderDescription(setting) {
renderDescription(setting: FieldSetting) {
let description;
let deprecation;
@ -579,7 +614,7 @@ export class Field extends PureComponent {
<EuiBadge
color="warning"
onClick={() => {
window.open(links.management[setting.deprecation.docLinksKey], '_blank');
window.open(links.management[setting.deprecation!.docLinksKey], '_blank');
}}
onClickAriaLabel={i18n.translate(
'kbn.management.settings.field.deprecationClickAreaLabel',
@ -608,7 +643,7 @@ export class Field extends PureComponent {
* Justification for dangerouslySetInnerHTML:
* Setting description may contain formatting and links to documentation.
*/
dangerouslySetInnerHTML={{ __html: setting.description }} //eslint-disable-line react/no-danger
dangerouslySetInnerHTML={{ __html: setting.description || '' }} // eslint-disable-line react/no-danger
/>
);
}
@ -622,7 +657,7 @@ export class Field extends PureComponent {
);
}
renderDefaultValue(setting) {
renderDefaultValue(setting: FieldSetting) {
const { type, defVal, optionLabels } = setting;
if (isDefaultValue(setting)) {
return;
@ -641,7 +676,7 @@ export class Field extends PureComponent {
<EuiCodeBlock
language="json"
paddingSize="s"
overflowHeight={defVal.length >= 500 ? 300 : null}
overflowHeight={(defVal as string).length >= 500 ? 300 : undefined}
>
{this.getDisplayedDefaultValue(type, defVal)}
</EuiCodeBlock>
@ -667,7 +702,7 @@ export class Field extends PureComponent {
);
}
renderResetToDefaultLink(setting) {
renderResetToDefaultLink(setting: FieldSetting) {
const { ariaName, name } = setting;
if (isDefaultValue(setting)) {
return;
@ -694,7 +729,7 @@ export class Field extends PureComponent {
);
}
renderChangeImageLink(setting) {
renderChangeImageLink(setting: FieldSetting) {
const { changeImage } = this.state;
const { type, value, ariaName, name } = setting;
if (type !== 'image' || !value || changeImage) {
@ -721,7 +756,7 @@ export class Field extends PureComponent {
);
}
renderActions(setting) {
renderActions(setting: FieldSetting) {
const { ariaName, name } = setting;
const { loading, isInvalid, changeImage, savedValue, unsavedValue } = this.state;
const isDisabled = loading || setting.isOverridden;
@ -798,6 +833,7 @@ export class Field extends PureComponent {
helpText={this.renderHelpText(setting)}
describedByIds={[`${setting.name}-aria`]}
className="mgtAdvancedSettings__fieldRow"
// @ts-ignore
hasChildLabel={setting.type !== 'boolean'}
>
{this.renderField(setting)}

View file

@ -61,9 +61,16 @@ exports[`Form should render normally 1`] = `
"category": Array [
"general",
],
"description": "bar",
"defVal": "defVal",
"description": "description",
"displayName": "Test date",
"isCustom": false,
"isOverridden": false,
"name": "general:test:date",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -78,9 +85,16 @@ exports[`Form should render normally 1`] = `
"category": Array [
"general",
],
"description": "foo",
"defVal": "defVal",
"description": "description",
"displayName": "Test setting",
"isCustom": false,
"isOverridden": false,
"name": "setting:test",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -120,8 +134,16 @@ exports[`Form should render normally 1`] = `
"category": Array [
"dashboard",
],
"defVal": "defVal",
"description": "description",
"displayName": "Dashboard test setting",
"isCustom": false,
"isOverridden": false,
"name": "dashboard:test:setting",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -187,9 +209,16 @@ exports[`Form should render normally 1`] = `
"category": Array [
"x-pack",
],
"description": "bar",
"defVal": "defVal",
"description": "description",
"displayName": "X-Pack test setting",
"isCustom": false,
"isOverridden": false,
"name": "xpack:test:setting",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -234,9 +263,16 @@ exports[`Form should render read-only when saving is disabled 1`] = `
"category": Array [
"general",
],
"description": "bar",
"defVal": "defVal",
"description": "description",
"displayName": "Test date",
"isCustom": false,
"isOverridden": false,
"name": "general:test:date",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -251,9 +287,16 @@ exports[`Form should render read-only when saving is disabled 1`] = `
"category": Array [
"general",
],
"description": "foo",
"defVal": "defVal",
"description": "description",
"displayName": "Test setting",
"isCustom": false,
"isOverridden": false,
"name": "setting:test",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -293,8 +336,16 @@ exports[`Form should render read-only when saving is disabled 1`] = `
"category": Array [
"dashboard",
],
"defVal": "defVal",
"description": "description",
"displayName": "Dashboard test setting",
"isCustom": false,
"isOverridden": false,
"name": "dashboard:test:setting",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>
@ -360,9 +411,16 @@ exports[`Form should render read-only when saving is disabled 1`] = `
"category": Array [
"x-pack",
],
"description": "bar",
"defVal": "defVal",
"description": "description",
"displayName": "X-Pack test setting",
"isCustom": false,
"isOverridden": false,
"name": "xpack:test:setting",
"readOnly": false,
"requiresPageReload": false,
"type": "string",
"value": "value",
}
}
/>

View file

@ -19,6 +19,7 @@
import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
import { UiSettingsType } from '../../../../../../../../../core/public';
import { Form } from './form';
@ -28,6 +29,17 @@ jest.mock('../field', () => ({
},
}));
const defaults = {
requiresPageReload: false,
readOnly: false,
value: 'value',
description: 'description',
isOverridden: false,
type: 'string' as UiSettingsType,
isCustom: false,
defVal: 'defVal',
};
const settings = {
dashboard: [
{
@ -35,6 +47,7 @@ const settings = {
ariaName: 'dashboard test setting',
displayName: 'Dashboard test setting',
category: ['dashboard'],
...defaults,
},
],
general: [
@ -44,6 +57,7 @@ const settings = {
displayName: 'Test date',
description: 'bar',
category: ['general'],
...defaults,
},
{
name: 'setting:test',
@ -51,6 +65,7 @@ const settings = {
displayName: 'Test setting',
description: 'foo',
category: ['general'],
...defaults,
},
],
'x-pack': [
@ -60,6 +75,7 @@ const settings = {
displayName: 'X-Pack test setting',
category: ['x-pack'],
description: 'bar',
...defaults,
},
],
};
@ -69,8 +85,8 @@ const categoryCounts = {
dashboard: 1,
'x-pack': 10,
};
const save = () => {};
const clear = () => {};
const save = (key: string, value: any) => Promise.resolve(true);
const clear = (key: string) => Promise.resolve(true);
const clearQuery = () => {};
describe('Form', () => {

View file

@ -18,7 +18,6 @@
*/
import React, { PureComponent, Fragment } from 'react';
import PropTypes from 'prop-types';
import {
EuiFlexGroup,
@ -33,20 +32,23 @@ import { FormattedMessage } from '@kbn/i18n/react';
import { getCategoryName } from '../../lib';
import { Field } from '../field';
import { FieldSetting } from '../../types';
export class Form extends PureComponent {
static propTypes = {
settings: PropTypes.object.isRequired,
categories: PropTypes.array.isRequired,
categoryCounts: PropTypes.object.isRequired,
clearQuery: PropTypes.func.isRequired,
save: PropTypes.func.isRequired,
clear: PropTypes.func.isRequired,
showNoResultsMessage: PropTypes.bool.isRequired,
enableSaving: PropTypes.bool.isRequired,
};
type Category = string;
renderClearQueryLink(totalSettings, currentSettings) {
interface FormProps {
settings: Record<string, FieldSetting[]>;
categories: Category[];
categoryCounts: Record<string, number>;
clearQuery: () => void;
save: (key: string, value: any) => Promise<boolean>;
clear: (key: string) => Promise<boolean>;
showNoResultsMessage: boolean;
enableSaving: boolean;
}
export class Form extends PureComponent<FormProps> {
renderClearQueryLink(totalSettings: number, currentSettings: number) {
const { clearQuery } = this.props;
if (totalSettings !== currentSettings) {
@ -78,7 +80,7 @@ export class Form extends PureComponent {
return null;
}
renderCategory(category, settings, totalSettings) {
renderCategory(category: Category, settings: FieldSetting[], totalSettings: number) {
return (
<Fragment key={category}>
<EuiPanel paddingSize="l">
@ -110,7 +112,7 @@ export class Form extends PureComponent {
);
}
maybeRenderNoSettings(clearQuery) {
maybeRenderNoSettings(clearQuery: FormProps['clearQuery']) {
if (this.props.showNoResultsMessage) {
return (
<EuiPanel paddingSize="l">
@ -136,7 +138,7 @@ export class Form extends PureComponent {
render() {
const { settings, categories, categoryCounts, clearQuery } = this.props;
const currentCategories = [];
const currentCategories: Category[] = [];
categories.forEach(category => {
if (settings[category] && settings[category].length) {
@ -148,7 +150,7 @@ export class Form extends PureComponent {
<Fragment>
{currentCategories.length
? currentCategories.map(category => {
return this.renderCategory(category, settings[category], categoryCounts[category]); // fix this
return this.renderCategory(category, settings[category], categoryCounts[category]);
})
: this.maybeRenderNoSettings(clearQuery)}
</Fragment>

View file

@ -19,6 +19,7 @@
import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { Query } from '@elastic/eui';
@ -38,7 +39,7 @@ describe('Search', () => {
});
it('should call parent function when query is changed', async () => {
//This test is brittle as it knows about implementation details
// This test is brittle as it knows about implementation details
// (EuiFieldSearch uses onKeyup instead of onChange to handle input)
const onQueryChange = jest.fn();
const component = mountWithI18nProvider(

View file

@ -18,21 +18,26 @@
*/
import React, { Fragment, PureComponent } from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@kbn/i18n';
import { EuiSearchBar, EuiFormErrorText } from '@elastic/eui';
import {
// @ts-ignore
EuiSearchBar,
EuiFormErrorText,
} from '@elastic/eui';
import { IQuery } from '../../types';
import { getCategoryName } from '../../lib';
export class Search extends PureComponent {
static propTypes = {
categories: PropTypes.array.isRequired,
query: PropTypes.object.isRequired,
onQueryChange: PropTypes.func.isRequired,
};
interface SearchProps {
categories: string[];
query: IQuery;
onQueryChange: ({ query }: { query: IQuery }) => void;
}
constructor(props) {
export class Search extends PureComponent<SearchProps> {
private categories: Array<{ value: string; name: string }> = [];
constructor(props: SearchProps) {
super(props);
const { categories } = props;
this.categories = categories.map(category => {
@ -48,7 +53,7 @@ export class Search extends PureComponent {
parseErrorMessage: null,
};
onChange = ({ query, error }) => {
onChange = ({ query, error }: { query: IQuery; error: { message: string } }) => {
if (error) {
this.setState({
isSearchTextValid: false,

View file

@ -1,5 +1,5 @@
<kbn-management-app section="kibana/settings">
<kbn-management-advanced>
<div id="reactAdvancedSettings"></div>
<kbn-management-advanced-react query="query"></kbn-management-advanced-react>
</kbn-management-advanced>
</kbn-management-app>

View file

@ -29,38 +29,10 @@ import {
} from 'ui/registry/feature_catalogue';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { AdvancedSettings } from './advanced_settings';
import { i18n } from '@kbn/i18n';
import { getBreadcrumbs } from './breadcrumbs';
const REACT_ADVANCED_SETTINGS_DOM_ELEMENT_ID = 'reactAdvancedSettings';
function updateAdvancedSettings($scope, config, query) {
$scope.$$postDigest(() => {
const node = document.getElementById(REACT_ADVANCED_SETTINGS_DOM_ELEMENT_ID);
if (!node) {
return;
}
render(
<I18nContext>
<AdvancedSettings
config={config}
query={query}
enableSaving={capabilities.get().advancedSettings.save}
/>
</I18nContext>,
node
);
});
}
function destroyAdvancedSettings() {
const node = document.getElementById(REACT_ADVANCED_SETTINGS_DOM_ELEMENT_ID);
node && unmountComponentAtNode(node);
}
uiRoutes.when('/management/kibana/settings/:setting?', {
template: indexTemplate,
k7Breadcrumbs: getBreadcrumbs,
@ -82,23 +54,28 @@ uiRoutes.when('/management/kibana/settings/:setting?', {
},
});
uiModules.get('apps/management').directive('kbnManagementAdvanced', function(config, $route) {
uiModules.get('apps/management').directive('kbnManagementAdvanced', function($route) {
return {
restrict: 'E',
link: function($scope) {
config.watchAll(() => {
updateAdvancedSettings($scope, config, $route.current.params.setting || '');
}, $scope);
$scope.$on('$destroy', () => {
destroyAdvancedSettings();
});
$scope.query = $route.current.params.setting || '';
$route.updateParams({ setting: null });
},
};
});
const AdvancedSettingsApp = ({ query = '' }) => {
return (
<I18nContext>
<AdvancedSettings queryText={query} enableSaving={capabilities.get().advancedSettings.save} />
</I18nContext>
);
};
uiModules.get('apps/management').directive('kbnManagementAdvancedReact', function(reactDirective) {
return reactDirective(AdvancedSettingsApp, [['query', { watchDepth: 'reference' }]]);
});
management.getSection('kibana').register('settings', {
display: i18n.translate('kbn.management.settings.sectionLabel', {
defaultMessage: 'Advanced Settings',

View file

@ -1,52 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import expect from '@kbn/expect';
import { getCategoryName } from '../get_category_name';
describe('Settings', function() {
describe('Advanced', function() {
describe('getCategoryName(category)', function() {
it('should be a function', function() {
expect(getCategoryName).to.be.a(Function);
});
it('should return correct name for known categories', function() {
expect(getCategoryName('general')).to.be('General');
expect(getCategoryName('timelion')).to.be('Timelion');
expect(getCategoryName('notifications')).to.be('Notifications');
expect(getCategoryName('visualizations')).to.be('Visualizations');
expect(getCategoryName('discover')).to.be('Discover');
expect(getCategoryName('dashboard')).to.be('Dashboard');
expect(getCategoryName('reporting')).to.be('Reporting');
expect(getCategoryName('search')).to.be('Search');
});
it('should capitalize unknown category', function() {
expect(getCategoryName('elasticsearch')).to.be('Elasticsearch');
});
it('should return empty string for no category', function() {
expect(getCategoryName()).to.be('');
expect(getCategoryName('')).to.be('');
expect(getCategoryName(false)).to.be('');
});
});
});
});

View file

@ -18,15 +18,11 @@
*/
import expect from '@kbn/expect';
import { getAriaName } from '../get_aria_name';
import { getAriaName } from './get_aria_name';
describe('Settings', function() {
describe('Advanced', function() {
describe('getAriaName(name)', function() {
it('should be a function', function() {
expect(getAriaName).to.be.a(Function);
});
it('should return a space delimited lower-case string with no special characters', function() {
expect(getAriaName('xPack:defaultAdminEmail')).to.be('x pack default admin email');
expect(getAriaName('doc_table:highlight')).to.be('doc table highlight');
@ -36,7 +32,6 @@ describe('Settings', function() {
it('should return an empty string if passed undefined or null', function() {
expect(getAriaName()).to.be('');
expect(getAriaName(undefined)).to.be('');
expect(getAriaName(null)).to.be('');
});
});
});

Some files were not shown because too many files have changed in this diff Show more