diff --git a/docs/development/core/server/kibana-plugin-server.basepath.get.md b/docs/development/core/server/kibana-plugin-server.basepath.get.md
index 6ef7022f10e6..a20bc1a4e317 100644
--- a/docs/development/core/server/kibana-plugin-server.basepath.get.md
+++ b/docs/development/core/server/kibana-plugin-server.basepath.get.md
@@ -9,5 +9,5 @@ returns `basePath` value, specific for an incoming request.
Signature:
```typescript
-get: (request: KibanaRequest | LegacyRequest) => string;
+get: (request: LegacyRequest | KibanaRequest) => string;
```
diff --git a/docs/development/core/server/kibana-plugin-server.basepath.md b/docs/development/core/server/kibana-plugin-server.basepath.md
index 50a30f7c43fe..63aeb7f711d9 100644
--- a/docs/development/core/server/kibana-plugin-server.basepath.md
+++ b/docs/development/core/server/kibana-plugin-server.basepath.md
@@ -20,9 +20,9 @@ The constructor for this class is marked as internal. Third-party code should no
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
-| [get](./kibana-plugin-server.basepath.get.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest) => string
| returns basePath
value, specific for an incoming request. |
+| [get](./kibana-plugin-server.basepath.get.md) | | (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>) => string
| returns basePath
value, specific for an incoming request. |
| [prepend](./kibana-plugin-server.basepath.prepend.md) | | (path: string) => string
| Prepends path
with the basePath. |
| [remove](./kibana-plugin-server.basepath.remove.md) | | (path: string) => string
| Removes the prepended basePath from the path
. |
| [serverBasePath](./kibana-plugin-server.basepath.serverbasepath.md) | | string
| returns the server's basePathSee [BasePath.get](./kibana-plugin-server.basepath.get.md) for getting the basePath value for a specific request |
-| [set](./kibana-plugin-server.basepath.set.md) | | (request: KibanaRequest<unknown, unknown, unknown, any> | LegacyRequest, requestSpecificBasePath: string) => void
| sets basePath
value, specific for an incoming request. |
+| [set](./kibana-plugin-server.basepath.set.md) | | (request: LegacyRequest | KibanaRequest<unknown, unknown, unknown, any>, requestSpecificBasePath: string) => void
| sets basePath
value, specific for an incoming request. |
diff --git a/docs/development/core/server/kibana-plugin-server.basepath.set.md b/docs/development/core/server/kibana-plugin-server.basepath.set.md
index 56a7f644d34c..ac08baa0bb99 100644
--- a/docs/development/core/server/kibana-plugin-server.basepath.set.md
+++ b/docs/development/core/server/kibana-plugin-server.basepath.set.md
@@ -9,5 +9,5 @@ sets `basePath` value, specific for an incoming request.
Signature:
```typescript
-set: (request: KibanaRequest | LegacyRequest, requestSpecificBasePath: string) => void;
+set: (request: LegacyRequest | KibanaRequest, requestSpecificBasePath: string) => void;
```
diff --git a/docs/development/core/server/kibana-plugin-server.uisettingsparams.md b/docs/development/core/server/kibana-plugin-server.uisettingsparams.md
index a38499e8f37d..89eb5b10b9de 100644
--- a/docs/development/core/server/kibana-plugin-server.uisettingsparams.md
+++ b/docs/development/core/server/kibana-plugin-server.uisettingsparams.md
@@ -24,5 +24,6 @@ export interface UiSettingsParams
| [readonly](./kibana-plugin-server.uisettingsparams.readonly.md) | boolean
| a flag indicating that value cannot be changed |
| [requiresPageReload](./kibana-plugin-server.uisettingsparams.requirespagereload.md) | boolean
| a flag indicating whether new value applying requires page reloading |
| [type](./kibana-plugin-server.uisettingsparams.type.md) | UiSettingsType
| defines a type of UI element [UiSettingsType](./kibana-plugin-server.uisettingstype.md) |
+| [validation](./kibana-plugin-server.uisettingsparams.validation.md) | ImageValidation | StringValidation
| |
| [value](./kibana-plugin-server.uisettingsparams.value.md) | SavedObjectAttribute
| default value to fall back to if a user doesn't provide any |
diff --git a/docs/development/core/server/kibana-plugin-server.uisettingsparams.validation.md b/docs/development/core/server/kibana-plugin-server.uisettingsparams.validation.md
new file mode 100644
index 000000000000..f097f36e999b
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-server.uisettingsparams.validation.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [UiSettingsParams](./kibana-plugin-server.uisettingsparams.md) > [validation](./kibana-plugin-server.uisettingsparams.validation.md)
+
+## UiSettingsParams.validation property
+
+Signature:
+
+```typescript
+validation?: ImageValidation | StringValidation;
+```
diff --git a/src/core/server/server.api.md b/src/core/server/server.api.md
index bf7dc14c7326..65477e93e225 100644
--- a/src/core/server/server.api.md
+++ b/src/core/server/server.api.md
@@ -1935,6 +1935,11 @@ export interface UiSettingsParams {
readonly?: boolean;
requiresPageReload?: boolean;
type?: UiSettingsType;
+ // Warning: (ae-forgotten-export) The symbol "ImageValidation" needs to be exported by the entry point index.d.ts
+ // Warning: (ae-forgotten-export) The symbol "StringValidation" needs to be exported by the entry point index.d.ts
+ //
+ // (undocumented)
+ validation?: ImageValidation | StringValidation;
value?: SavedObjectAttribute;
}
diff --git a/src/core/server/ui_settings/types.ts b/src/core/server/ui_settings/types.ts
index 5e3f0a4fbb6b..2ab6114e7df8 100644
--- a/src/core/server/ui_settings/types.ts
+++ b/src/core/server/ui_settings/types.ts
@@ -102,6 +102,23 @@ export interface UiSettingsParams {
readonly?: boolean;
/** defines a type of UI element {@link UiSettingsType} */
type?: UiSettingsType;
+ /*
+ * 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 */
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
index 939dc8c20e46..65d212c23a28 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js
@@ -224,7 +224,7 @@ export class Field extends PureComponent {
}
const file = files[0];
- const { maxSize } = this.props.setting.options;
+ const { maxSize } = this.props.setting.validation;
try {
const base64Image = await this.getImageAsBase64(file);
const isInvalid = !!(maxSize && maxSize.length && base64Image.length > maxSize.length);
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.test.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.test.js
index 74bb0e25ff52..07ce6f84d2bb 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.test.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.test.js
@@ -72,10 +72,9 @@ const settings = {
defVal: null,
isCustom: false,
isOverridden: false,
- options: {
+ validation: {
maxSize: {
length: 1000,
- displayName: '1 kB',
description: 'Description for 1 kB',
},
},
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js
index 791f9e400b40..bb561cbe0421 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js
@@ -43,12 +43,13 @@ export function toEditableConfig({ def, name, value, isCustom, isOverridden }) {
defVal: def.value,
type: getValType(def, value),
description: def.description,
- validation: def.validation
- ? {
- regex: new RegExp(def.validation.regexString),
- message: def.validation.message,
- }
- : undefined,
+ validation:
+ def.validation && def.validation.regexString
+ ? {
+ regex: new RegExp(def.validation.regexString),
+ message: def.validation.message,
+ }
+ : def.validation,
options: def.options,
optionLabels: def.optionLabels,
requiresPageReload: !!def.requiresPageReload,
diff --git a/x-pack/legacy/plugins/reporting/index.ts b/x-pack/legacy/plugins/reporting/index.ts
index faa27bfb2d6e..ef0ab3773836 100644
--- a/x-pack/legacy/plugins/reporting/index.ts
+++ b/x-pack/legacy/plugins/reporting/index.ts
@@ -59,7 +59,7 @@ export const reporting = (kibana: any) => {
defaultMessage: `Custom image to use in the PDF's footer`,
}),
type: 'image',
- options: {
+ validation: {
maxSize: {
length: kbToBase64Length(200),
description: '200 kB',