remove ui settings client-side validation (#100311) (#100379)

* remove ui settings client-side validation

* fix linter

* fix tests

* update generated doc
This commit is contained in:
Pierre Gayvallet 2021-05-20 13:33:58 +02:00 committed by GitHub
parent 7d0deec6cb
commit e1e68fe949
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 22 additions and 551 deletions

View file

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

View file

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

View file

@ -84,7 +84,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IHttpFetchError](./kibana-plugin-core-public.ihttpfetcherror.md) | |
| [IHttpInterceptController](./kibana-plugin-core-public.ihttpinterceptcontroller.md) | Used to halt a request Promise chain in a [HttpInterceptor](./kibana-plugin-core-public.httpinterceptor.md)<!-- -->. |
| [IHttpResponseInterceptorOverrides](./kibana-plugin-core-public.ihttpresponseinterceptoroverrides.md) | Properties that can be returned by HttpInterceptor.request to override the response. |
| [ImageValidation](./kibana-plugin-core-public.imagevalidation.md) | |
| [IUiSettingsClient](./kibana-plugin-core-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-core-public.iuisettingsclient.md) |
| [NavigateToAppOptions](./kibana-plugin-core-public.navigatetoappoptions.md) | Options for the [navigateToApp API](./kibana-plugin-core-public.applicationstart.navigatetoapp.md) |
| [NotificationsSetup](./kibana-plugin-core-public.notificationssetup.md) | |
@ -129,8 +128,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsMigrationVersion](./kibana-plugin-core-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-core-public.savedobjectsstart.md) | |
| [SavedObjectsUpdateOptions](./kibana-plugin-core-public.savedobjectsupdateoptions.md) | |
| [StringValidationRegex](./kibana-plugin-core-public.stringvalidationregex.md) | StringValidation with regex object |
| [StringValidationRegexString](./kibana-plugin-core-public.stringvalidationregexstring.md) | StringValidation as regex string |
| [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |
| [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsState](./kibana-plugin-core-public.uisettingsstate.md) | |
@ -176,7 +173,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsImportWarning](./kibana-plugin-core-public.savedobjectsimportwarning.md) | Composite type of all the possible types of import warnings.<!-- -->See [SavedObjectsImportSimpleWarning](./kibana-plugin-core-public.savedobjectsimportsimplewarning.md) and [SavedObjectsImportActionRequiredWarning](./kibana-plugin-core-public.savedobjectsimportactionrequiredwarning.md) for more details. |
| [SavedObjectsNamespaceType](./kibana-plugin-core-public.savedobjectsnamespacetype.md) | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: \* single (default): This type of saved object is namespace-isolated, e.g., it exists in only one namespace. \* multiple: This type of saved object is shareable, e.g., it can exist in one or more namespaces. \* multiple-isolated: This type of saved object is namespace-isolated, e.g., it exists in only one namespace, but object IDs must be unique across all namespaces. This is intended to be an intermediate step when objects with a "single" namespace type are being converted to a "multiple" namespace type. In other words, objects with a "multiple-isolated" namespace type will be \*share-capable\*, but will not actually be shareable until the namespace type is changed to "multiple". \* agnostic: This type of saved object is global. |
| [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) | Allows plugins to get access to APIs available in start inside async handlers, such as [App.mount](./kibana-plugin-core-public.app.mount.md)<!-- -->. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. |
| [StringValidation](./kibana-plugin-core-public.stringvalidation.md) | Allows regex objects or a regex string |
| [Toast](./kibana-plugin-core-public.toast.md) | |
| [ToastInput](./kibana-plugin-core-public.toastinput.md) | Inputs for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |
| [ToastInputFields](./kibana-plugin-core-public.toastinputfields.md) | Allowed fields for [ToastInput](./kibana-plugin-core-public.toastinput.md)<!-- -->. |

View file

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

View file

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

View file

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

View file

@ -29,6 +29,5 @@ export interface UiSettingsParams<T = unknown>
| [schema](./kibana-plugin-core-public.uisettingsparams.schema.md) | <code>Type&lt;T&gt;</code> | |
| [sensitive](./kibana-plugin-core-public.uisettingsparams.sensitive.md) | <code>boolean</code> | a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. |
| [type](./kibana-plugin-core-public.uisettingsparams.type.md) | <code>UiSettingsType</code> | defines a type of UI element [UiSettingsType](./kibana-plugin-core-public.uisettingstype.md) |
| [validation](./kibana-plugin-core-public.uisettingsparams.validation.md) | <code>ImageValidation &#124; StringValidation</code> | |
| [value](./kibana-plugin-core-public.uisettingsparams.value.md) | <code>T</code> | default value to fall back to if a user doesn't provide any |

View file

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

View file

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

View file

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

View file

@ -97,7 +97,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [IExternalUrlPolicy](./kibana-plugin-core-server.iexternalurlpolicy.md) | A policy describing whether access to an external destination is allowed. |
| [IKibanaResponse](./kibana-plugin-core-server.ikibanaresponse.md) | A response data object, expected to returned as a result of [RequestHandler](./kibana-plugin-core-server.requesthandler.md) execution |
| [IKibanaSocket](./kibana-plugin-core-server.ikibanasocket.md) | A tiny abstraction for TCP socket. |
| [ImageValidation](./kibana-plugin-core-server.imagevalidation.md) | |
| [IndexSettingsDeprecationInfo](./kibana-plugin-core-server.indexsettingsdeprecationinfo.md) | |
| [IRenderOptions](./kibana-plugin-core-server.irenderoptions.md) | |
| [IRouter](./kibana-plugin-core-server.irouter.md) | Registers route handlers for specified resource path and method. See [RouteConfig](./kibana-plugin-core-server.routeconfig.md) and [RequestHandler](./kibana-plugin-core-server.requesthandler.md) for more information about arguments to route registrations. |
@ -157,7 +156,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsClientProviderOptions](./kibana-plugin-core-server.savedobjectsclientprovideroptions.md) | Options to control the creation of the Saved Objects Client. |
| [SavedObjectsClientWrapperOptions](./kibana-plugin-core-server.savedobjectsclientwrapperoptions.md) | Options passed to each SavedObjectsClientWrapperFactory to aid in creating the wrapper instance. |
| [SavedObjectsClosePointInTimeResponse](./kibana-plugin-core-server.savedobjectsclosepointintimeresponse.md) | |
| [SavedObjectsCollectMultiNamespaceReferencesObject](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md) | An object to collect references for. It must be a multi-namespace type (in other words, the object type must be registered with the <code>namespaceType: 'multi'</code> or <code>namespaceType: 'multi-isolated'</code> option).<!-- -->Note: if options.purpose is 'updateObjectsSpaces', it must be a shareable type (in other words, the object type must be registered with the <code>namespaceType: 'multi'</code>). |
| [SavedObjectsCollectMultiNamespaceReferencesObject](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesobject.md) | An object to collect references for. It must be a multi-namespace type (in other words, the object type must be registered with the <code>namespaceType: 'multiple'</code> or <code>namespaceType: 'multiple-isolated'</code> option).<!-- -->Note: if options.purpose is 'updateObjectsSpaces', it must be a shareable type (in other words, the object type must be registered with the <code>namespaceType: 'multiple'</code>). |
| [SavedObjectsCollectMultiNamespaceReferencesOptions](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesoptions.md) | Options for collecting references. |
| [SavedObjectsCollectMultiNamespaceReferencesResponse](./kibana-plugin-core-server.savedobjectscollectmultinamespacereferencesresponse.md) | The response when object references are collected. |
| [SavedObjectsComplexFieldMapping](./kibana-plugin-core-server.savedobjectscomplexfieldmapping.md) | See [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) for documentation. |
@ -223,8 +222,6 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ShardsInfo](./kibana-plugin-core-server.shardsinfo.md) | |
| [ShardsResponse](./kibana-plugin-core-server.shardsresponse.md) | |
| [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) | API for accessing status of Core and this plugin's dependencies as well as for customizing this plugin's status. |
| [StringValidationRegex](./kibana-plugin-core-server.stringvalidationregex.md) | StringValidation with regex object |
| [StringValidationRegexString](./kibana-plugin-core-server.stringvalidationregexstring.md) | StringValidation as regex string |
| [UiSettingsParams](./kibana-plugin-core-server.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsServiceSetup](./kibana-plugin-core-server.uisettingsservicesetup.md) | |
| [UiSettingsServiceStart](./kibana-plugin-core-server.uisettingsservicestart.md) | |
@ -326,6 +323,5 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [ServiceStatusLevel](./kibana-plugin-core-server.servicestatuslevel.md) | A convenience type that represents the union of each value in [ServiceStatusLevels](./kibana-plugin-core-server.servicestatuslevels.md)<!-- -->. |
| [SharedGlobalConfig](./kibana-plugin-core-server.sharedglobalconfig.md) | |
| [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) | Allows plugins to get access to APIs available in start inside async handlers. Promise will not resolve until Core and plugin dependencies have completed <code>start</code>. This should only be used inside handlers registered during <code>setup</code> that will only be executed after <code>start</code> lifecycle. |
| [StringValidation](./kibana-plugin-core-server.stringvalidation.md) | Allows regex objects or a regex string |
| [UiSettingsType](./kibana-plugin-core-server.uisettingstype.md) | UI element type to represent the settings. |

View file

@ -4,9 +4,9 @@
## SavedObjectsCollectMultiNamespaceReferencesObject interface
An object to collect references for. It must be a multi-namespace type (in other words, the object type must be registered with the `namespaceType: 'multi'` or `namespaceType: 'multi-isolated'` option).
An object to collect references for. It must be a multi-namespace type (in other words, the object type must be registered with the `namespaceType: 'multiple'` or `namespaceType: 'multiple-isolated'` option).
Note: if options.purpose is 'updateObjectsSpaces', it must be a shareable type (in other words, the object type must be registered with the `namespaceType: 'multi'`<!-- -->).
Note: if options.purpose is 'updateObjectsSpaces', it must be a shareable type (in other words, the object type must be registered with the `namespaceType: 'multiple'`<!-- -->).
<b>Signature:</b>

View file

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

View file

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

View file

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

View file

@ -29,6 +29,5 @@ export interface UiSettingsParams<T = unknown>
| [schema](./kibana-plugin-core-server.uisettingsparams.schema.md) | <code>Type&lt;T&gt;</code> | |
| [sensitive](./kibana-plugin-core-server.uisettingsparams.sensitive.md) | <code>boolean</code> | a flag indicating that value might contain user sensitive data. used by telemetry to mask the value of the setting when sent. |
| [type](./kibana-plugin-core-server.uisettingsparams.type.md) | <code>UiSettingsType</code> | defines a type of UI element [UiSettingsType](./kibana-plugin-core-server.uisettingstype.md) |
| [validation](./kibana-plugin-core-server.uisettingsparams.validation.md) | <code>ImageValidation &#124; StringValidation</code> | |
| [value](./kibana-plugin-core-server.uisettingsparams.value.md) | <code>T</code> | default value to fall back to if a user doesn't provide any |

View file

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

View file

@ -75,16 +75,7 @@ export type {
} from '../server/types';
export type { CoreContext, CoreSystem } from './core_system';
export { DEFAULT_APP_CATEGORIES, APP_WRAPPER_CLASS } from '../utils';
export type {
AppCategory,
UiSettingsParams,
UserProvidedValues,
UiSettingsType,
ImageValidation,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from '../types';
export type { AppCategory, UiSettingsParams, UserProvidedValues, UiSettingsType } from '../types';
export { AppNavLinkStatus, AppStatus, ScopedHistory } from './application';
export type {

View file

@ -902,15 +902,6 @@ 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' | 'addInfo'>;
@ -1537,25 +1528,6 @@ export class SimpleSavedObject<T = unknown> {
// @public
export type StartServicesAccessor<TPluginsStart extends object = object, TStart = unknown> = () => Promise<[CoreStart, TPluginsStart, TStart]>;
// @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)
@ -1624,8 +1596,6 @@ export interface UiSettingsParams<T = unknown> {
schema: Type<T>;
sensitive?: boolean;
type?: UiSettingsType;
// (undocumented)
validation?: ImageValidation | StringValidation;
value?: T;
}

View file

@ -11,8 +11,6 @@ export type {
PublicUiSettingsParams,
UserProvidedValues,
UiSettingsType,
ImageValidation,
StringValidationRegex,
} from '../../core/types';
/**

View file

@ -376,11 +376,7 @@ export type {
UiSettingsServiceSetup,
UiSettingsServiceStart,
UserProvidedValues,
ImageValidation,
DeprecationSettings,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from './ui_settings';
export type {

View file

@ -1208,15 +1208,6 @@ export type ILegacyCustomClusterClient = Pick<LegacyClusterClient, 'callAsIntern
// @public @deprecated
export type ILegacyScopedClusterClient = Pick<LegacyScopedClusterClient, 'callAsCurrentUser' | 'callAsInternalUser'>;
// @public (undocumented)
export interface ImageValidation {
// (undocumented)
maxSize: {
length: number;
description: string;
};
}
// @public @deprecated (undocumented)
export interface IndexSettingsDeprecationInfo {
// (undocumented)
@ -3241,25 +3232,6 @@ export interface StatusServiceSetup {
set(status$: Observable<ServiceStatus>): void;
}
// @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;
}
// @public
export interface UiSettingsParams<T = unknown> {
category?: string[];
@ -3280,8 +3252,6 @@ export interface UiSettingsParams<T = unknown> {
schema: Type<T>;
sensitive?: boolean;
type?: UiSettingsType;
// (undocumented)
validation?: ImageValidation | StringValidation;
value?: T;
}

View file

@ -21,9 +21,5 @@ export type {
InternalUiSettingsServiceStart,
UiSettingsType,
UserProvidedValues,
ImageValidation,
DeprecationSettings,
StringValidation,
StringValidationRegex,
StringValidationRegexString,
} from './types';

View file

@ -7,14 +7,11 @@
*/
import { SavedObjectsClientContract } from '../saved_objects/types';
import { UiSettingsParams, UserProvidedValues, PublicUiSettingsParams } from '../../types';
export type {
UiSettingsParams,
PublicUiSettingsParams,
StringValidationRegexString,
StringValidationRegex,
StringValidation,
DeprecationSettings,
ImageValidation,
UiSettingsType,
UserProvidedValues,
} from '../../types';

View file

@ -73,12 +73,6 @@ export interface UiSettingsParams<T = unknown> {
* @remark settings without order defined will be displayed last and ordered by name
*/
order?: number;
/*
* Allows defining a custom validation applicable to value change on the client.
* @deprecated
* Use schema instead.
*/
validation?: ImageValidation | StringValidation;
/*
* Value validation schema
* Used to validate value on write and read.
@ -101,40 +95,6 @@ export interface UiSettingsParams<T = unknown> {
* */
export type PublicUiSettingsParams = Omit<UiSettingsParams, 'schema'>;
/**
* 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

View file

@ -11,7 +11,7 @@ import { I18nProvider } from '@kbn/i18n/react';
import { shallowWithI18nProvider, mountWithI18nProvider } from '@kbn/test/jest';
import { mount, ReactWrapper } from 'enzyme';
import { FieldSetting } from '../../types';
import { UiSettingsType, StringValidation } from '../../../../../../core/public';
import { UiSettingsType } from '../../../../../../core/public';
import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks';
import { findTestSubject } from '@elastic/eui/lib/test';
@ -74,12 +74,6 @@ const settings: Record<string, FieldSetting> = {
defVal: null,
isCustom: false,
isOverridden: false,
validation: {
maxSize: {
length: 1000,
description: 'Description for 1 kB',
},
},
...defaults,
},
json: {
@ -154,10 +148,6 @@ const settings: Record<string, FieldSetting> = {
displayName: 'String test validation setting',
description: 'Description for String test validation setting',
type: 'string',
validation: {
regex: new RegExp('^foo'),
message: 'must start with "foo"',
},
value: undefined,
defVal: 'foo-default',
isCustom: false,
@ -190,10 +180,6 @@ const userValues = {
color: '#FACF0C',
};
const invalidUserValues = {
stringWithValidation: 'invalidUserValue',
};
const handleChange = jest.fn();
const clearChange = jest.fn();
@ -476,24 +462,6 @@ describe('Field', () => {
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 () => {
await (component.instance() as Field).onFieldChange(invalidUserValue);
const expectedUnsavedChanges = {
value: invalidUserValue,
error: (setting.validation as StringValidation).message,
isInvalid: true,
};
expect(handleChange).toBeCalledWith(setting.name, expectedUnsavedChanges);
wrapper.setProps({ unsavedChanges: expectedUnsavedChanges });
const updated = wrapper.update();
const errorMessage = updated.find('.euiFormErrorText').text();
expect(errorMessage).toEqual(expectedUnsavedChanges.error);
});
}
it('should be able to change value', async () => {
await (component.instance() as Field).onFieldChange(fieldUserValue);
const updated = wrapper.update();

View file

@ -39,13 +39,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { FieldSetting, FieldState } from '../../types';
import { isDefaultValue } from '../../lib';
import {
UiSettingsType,
ImageValidation,
StringValidationRegex,
DocLinksStart,
ToastsStart,
} from '../../../../../../core/public';
import { UiSettingsType, DocLinksStart, ToastsStart } from '../../../../../../core/public';
interface FieldProps {
setting: FieldSetting;
@ -166,7 +160,7 @@ export class Field extends PureComponent<FieldProps> {
this.onFieldChange(e.target.value);
onFieldChange = (targetValue: any) => {
const { type, validation, value, defVal } = this.props.setting;
const { type, value, defVal } = this.props.setting;
let newUnsavedValue;
switch (type) {
@ -184,20 +178,8 @@ export class Field extends PureComponent<FieldProps> {
newUnsavedValue = targetValue;
}
let errorParams = {};
if ((validation as StringValidationRegex)?.regex) {
if (!(validation as StringValidationRegex).regex!.test(newUnsavedValue.toString())) {
errorParams = {
error: (validation as StringValidationRegex).message,
isInvalid: true,
};
}
}
this.handleChange({
value: newUnsavedValue,
...errorParams,
});
};
@ -212,30 +194,15 @@ export class Field extends PureComponent<FieldProps> {
}
const file = files[0];
const { maxSize } = this.props.setting.validation as ImageValidation;
try {
let base64Image = '';
if (file instanceof File) {
base64Image = (await this.getImageAsBase64(file)) as string;
}
let errorParams = {};
const isInvalid = !!(maxSize?.length && base64Image.length > maxSize.length);
if (isInvalid) {
errorParams = {
isInvalid,
error: i18n.translate('advancedSettings.field.imageTooLargeErrorMessage', {
defaultMessage: 'Image is too large, maximum size is {maxSizeDescription}',
values: {
maxSizeDescription: maxSize.description,
},
}),
};
}
this.handleChange({
changeImage: true,
value: base64Image,
...errorParams,
});
} catch (err) {
this.props.toasts.addDanger(

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { PublicUiSettingsParams, StringValidationRegex } from 'src/core/public';
import { PublicUiSettingsParams } from 'src/core/public';
import expect from '@kbn/expect';
import { toEditableConfig } from './to_editable_config';
@ -82,19 +82,6 @@ describe('Settings', function () {
expect(invoke({ def }).type).to.equal('array');
});
});
describe('that contains a validation object', function () {
it('constructs a validation regex with message', function () {
def.validation = {
regexString: '^foo',
message: 'must start with "foo"',
};
const result = invoke({ def });
const validationTyped = result.validation as StringValidationRegex;
expect(validationTyped.regex).to.be.a(RegExp);
expect(validationTyped.message).to.equal('must start with "foo"');
});
});
});
describe('when not given a setting definition object', function () {
@ -113,10 +100,6 @@ describe('Settings', function () {
it('sets options to undefined', function () {
expect(invoke({}).options).to.be(undefined);
});
it('sets validation to undefined', function () {
expect(invoke({}).validation).to.be(undefined);
});
});
});
});

View file

@ -6,12 +6,7 @@
* Side Public License, v 1.
*/
import {
PublicUiSettingsParams,
UserProvidedValues,
StringValidationRegexString,
SavedObjectAttribute,
} from 'src/core/public';
import { PublicUiSettingsParams, UserProvidedValues, SavedObjectAttribute } from 'src/core/public';
import { FieldSetting } from '../types';
import { getValType } from './get_val_type';
import { getAriaName } from './get_aria_name';
@ -40,8 +35,6 @@ export function toEditableConfig({
def = {};
}
const validationTyped = def.validation as StringValidationRegexString;
const conf: FieldSetting = {
name,
displayName: def.name || name,
@ -55,13 +48,6 @@ export function toEditableConfig({
type: getValType(def, value),
description: def.description,
deprecation: def.deprecation,
validation:
validationTyped && validationTyped.regexString
? {
regex: new RegExp(validationTyped.regexString),
message: validationTyped.message,
}
: def.validation,
options: def.options,
optionLabels: def.optionLabels,
order: def.order,

View file

@ -8,7 +8,7 @@
import type { ReactElement } from 'react';
import { UiCounterMetricType } from '@kbn/analytics';
import { UiSettingsType, StringValidation, ImageValidation } from '../../../../core/public';
import { UiSettingsType } from '../../../../core/public';
export interface FieldSetting {
displayName: string;
@ -24,7 +24,6 @@ export interface FieldSetting {
isOverridden: boolean;
defVal: unknown;
isCustom: boolean;
validation?: StringValidation | ImageValidation;
readOnly?: boolean;
order?: number;
deprecation?: {

View file

@ -41,13 +41,15 @@ export class FileUploadPlugin implements Plugin {
defaultMessage:
'Sets the file size limit when importing files. The highest supported value for this setting is 1GB.',
}),
schema: schema.string(),
validation: {
regexString: '\\d+[mMgG][bB]',
message: i18n.translate('xpack.fileUpload.maxFileSizeUiSetting.error', {
defaultMessage: 'Should be a valid data size. e.g. 200MB, 1GB',
}),
},
schema: schema.string({
validate: (value) => {
if (!/^\d+[mg][b]$/i.test(value)) {
return i18n.translate('xpack.fileUpload.maxFileSizeUiSetting.error', {
defaultMessage: 'Should be a valid data size. e.g. 200MB, 1GB',
});
}
},
}),
},
});

View file

@ -11,7 +11,7 @@ import { CoreSetup, UiSettingsParams } from 'kibana/server';
import { PLUGIN_ID, UI_SETTINGS_CUSTOM_PDF_LOGO } from '../../common/constants';
const kbToBase64Length = (kb: number) => Math.floor((kb * 1024 * 8) / 6);
const maxLogoSizeInKilobytes = kbToBase64Length(200);
const maxLogoSizeInBase64 = kbToBase64Length(200);
// inspired by x-pack/plugins/canvas/common/lib/dataurl.ts
const dataurlRegex = /^data:([a-z]+\/[a-z0-9-+.]+)(;[a-z-]+=[a-z0-9-]+)?(;([a-z0-9]+))?,/;
@ -33,21 +33,13 @@ const isImageData = (str: any): boolean => {
return true;
};
const isLessThanMaxSize = (str: any) => {
if (str.length > maxLogoSizeInKilobytes) {
return false;
}
return true;
};
const validatePdfLogoBase64String = (str: any) => {
if (typeof str !== 'string' || !isImageData(str)) {
return i18n.translate('xpack.reporting.uiSettings.validate.customLogo.badFile', {
defaultMessage: `Sorry, that file will not work. Please try a different image file.`,
});
}
if (!isLessThanMaxSize(str)) {
if (str.length > maxLogoSizeInBase64) {
return i18n.translate('xpack.reporting.uiSettings.validate.customLogo.tooLarge', {
defaultMessage: `Sorry, that file is too large. The image file must be less than 200 kilobytes.`,
});
@ -70,12 +62,6 @@ export function registerUiSettings(core: CoreSetup<object, unknown>) {
type: 'image',
schema: PdfLogoSchema,
category: [PLUGIN_ID],
validation: {
maxSize: {
length: maxLogoSizeInKilobytes,
description: '200 kB',
},
},
},
} as Record<string, UiSettingsParams<null>>);
}

View file

@ -104,7 +104,6 @@
"advancedSettings.field.deprecationClickAreaLabel": "クリックすると {settingName} のサポート終了に関するドキュメントが表示されます。",
"advancedSettings.field.helpText": "この設定は Kibana サーバーにより上書きされ、変更することはできません。",
"advancedSettings.field.imageChangeErrorMessage": "画像を保存できませんでした",
"advancedSettings.field.imageTooLargeErrorMessage": "画像が大きすぎます。最大サイズは {maxSizeDescription} です",
"advancedSettings.field.invalidIconLabel": "無効",
"advancedSettings.field.offLabel": "オフ",
"advancedSettings.field.onLabel": "オン",

View file

@ -104,7 +104,6 @@
"advancedSettings.field.deprecationClickAreaLabel": "单击以查看 {settingName} 的过时文档。",
"advancedSettings.field.helpText": "此设置已由 Kibana 服务器覆盖,无法更改。",
"advancedSettings.field.imageChangeErrorMessage": "图片无法保存",
"advancedSettings.field.imageTooLargeErrorMessage": "图片过大,最大大小为 {maxSizeDescription}",
"advancedSettings.field.invalidIconLabel": "无效",
"advancedSettings.field.offLabel": "关闭",
"advancedSettings.field.onLabel": "开启",