mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Typescript index pattern field editor (#63495)
* Typescript index pattern field editor
This commit is contained in:
parent
1252b832f4
commit
231de27026
159 changed files with 1990 additions and 984 deletions
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [$$spec](./kibana-plugin-plugins-data-public.field.__spec.md)
|
||||
|
||||
## Field.$$spec property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
$$spec: FieldSpec;
|
||||
```
|
|
@ -1,8 +1,8 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [(constructor)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md)
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [(constructor)](./kibana-plugin-plugins-data-public.field._constructor_.md)
|
||||
|
||||
## IndexPatternField.(constructor)
|
||||
## Field.(constructor)
|
||||
|
||||
Constructs a new instance of the `Field` class
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [aggregatable](./kibana-plugin-plugins-data-public.field.aggregatable.md)
|
||||
|
||||
## Field.aggregatable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
aggregatable?: boolean;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [conflictDescriptions](./kibana-plugin-plugins-data-public.field.conflictdescriptions.md)
|
||||
|
||||
## Field.conflictDescriptions property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
conflictDescriptions?: Record<string, string[]>;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [count](./kibana-plugin-plugins-data-public.field.count.md)
|
||||
|
||||
## Field.count property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
count?: number;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [displayName](./kibana-plugin-plugins-data-public.field.displayname.md)
|
||||
|
||||
## Field.displayName property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
displayName?: string;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [esTypes](./kibana-plugin-plugins-data-public.field.estypes.md)
|
||||
|
||||
## Field.esTypes property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
esTypes?: string[];
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [filterable](./kibana-plugin-plugins-data-public.field.filterable.md)
|
||||
|
||||
## Field.filterable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
filterable?: boolean;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [format](./kibana-plugin-plugins-data-public.field.format.md)
|
||||
|
||||
## Field.format property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
format: any;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [indexPattern](./kibana-plugin-plugins-data-public.field.indexpattern.md)
|
||||
|
||||
## Field.indexPattern property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
indexPattern?: IndexPattern;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [lang](./kibana-plugin-plugins-data-public.field.lang.md)
|
||||
|
||||
## Field.lang property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
lang?: string;
|
||||
```
|
|
@ -0,0 +1,41 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md)
|
||||
|
||||
## Field class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class Field implements IFieldType
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(indexPattern, spec, shortDotsEnable)](./kibana-plugin-plugins-data-public.field._constructor_.md) | | Constructs a new instance of the <code>Field</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [$$spec](./kibana-plugin-plugins-data-public.field.__spec.md) | | <code>FieldSpec</code> | |
|
||||
| [aggregatable](./kibana-plugin-plugins-data-public.field.aggregatable.md) | | <code>boolean</code> | |
|
||||
| [conflictDescriptions](./kibana-plugin-plugins-data-public.field.conflictdescriptions.md) | | <code>Record<string, string[]></code> | |
|
||||
| [count](./kibana-plugin-plugins-data-public.field.count.md) | | <code>number</code> | |
|
||||
| [displayName](./kibana-plugin-plugins-data-public.field.displayname.md) | | <code>string</code> | |
|
||||
| [esTypes](./kibana-plugin-plugins-data-public.field.estypes.md) | | <code>string[]</code> | |
|
||||
| [filterable](./kibana-plugin-plugins-data-public.field.filterable.md) | | <code>boolean</code> | |
|
||||
| [format](./kibana-plugin-plugins-data-public.field.format.md) | | <code>any</code> | |
|
||||
| [indexPattern](./kibana-plugin-plugins-data-public.field.indexpattern.md) | | <code>IndexPattern</code> | |
|
||||
| [lang](./kibana-plugin-plugins-data-public.field.lang.md) | | <code>string</code> | |
|
||||
| [name](./kibana-plugin-plugins-data-public.field.name.md) | | <code>string</code> | |
|
||||
| [script](./kibana-plugin-plugins-data-public.field.script.md) | | <code>string</code> | |
|
||||
| [scripted](./kibana-plugin-plugins-data-public.field.scripted.md) | | <code>boolean</code> | |
|
||||
| [searchable](./kibana-plugin-plugins-data-public.field.searchable.md) | | <code>boolean</code> | |
|
||||
| [sortable](./kibana-plugin-plugins-data-public.field.sortable.md) | | <code>boolean</code> | |
|
||||
| [subType](./kibana-plugin-plugins-data-public.field.subtype.md) | | <code>IFieldSubType</code> | |
|
||||
| [type](./kibana-plugin-plugins-data-public.field.type.md) | | <code>string</code> | |
|
||||
| [visualizable](./kibana-plugin-plugins-data-public.field.visualizable.md) | | <code>boolean</code> | |
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [name](./kibana-plugin-plugins-data-public.field.name.md)
|
||||
|
||||
## Field.name property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
name: string;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [script](./kibana-plugin-plugins-data-public.field.script.md)
|
||||
|
||||
## Field.script property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
script?: string;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [scripted](./kibana-plugin-plugins-data-public.field.scripted.md)
|
||||
|
||||
## Field.scripted property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
scripted?: boolean;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [searchable](./kibana-plugin-plugins-data-public.field.searchable.md)
|
||||
|
||||
## Field.searchable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
searchable?: boolean;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [sortable](./kibana-plugin-plugins-data-public.field.sortable.md)
|
||||
|
||||
## Field.sortable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
sortable?: boolean;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [subType](./kibana-plugin-plugins-data-public.field.subtype.md)
|
||||
|
||||
## Field.subType property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
subType?: IFieldSubType;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [type](./kibana-plugin-plugins-data-public.field.type.md)
|
||||
|
||||
## Field.type property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
type: string;
|
||||
```
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [Field](./kibana-plugin-plugins-data-public.field.md) > [visualizable](./kibana-plugin-plugins-data-public.field.visualizable.md)
|
||||
|
||||
## Field.visualizable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
visualizable?: boolean;
|
||||
```
|
|
@ -0,0 +1,21 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [(constructor)](./kibana-plugin-plugins-data-public.fieldformat._constructor_.md)
|
||||
|
||||
## FieldFormat.(constructor)
|
||||
|
||||
Constructs a new instance of the `FieldFormat` class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
constructor(_params?: IFieldFormatMetaParams, getConfig?: FieldFormatsGetConfigFn);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| \_params | <code>IFieldFormatMetaParams</code> | |
|
||||
| getConfig | <code>FieldFormatsGetConfigFn</code> | |
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [\_params](./kibana-plugin-plugins-data-public.fieldformat._params.md)
|
||||
|
||||
## FieldFormat.\_params property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
protected readonly _params: any;
|
||||
```
|
|
@ -0,0 +1,26 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [convert](./kibana-plugin-plugins-data-public.fieldformat.convert.md)
|
||||
|
||||
## FieldFormat.convert() method
|
||||
|
||||
Convert a raw value to a formatted string
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
convert(value: any, contentType?: FieldFormatsContentType, options?: HtmlContextTypeOptions | TextContextTypeOptions): string;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| value | <code>any</code> | |
|
||||
| contentType | <code>FieldFormatsContentType</code> | |
|
||||
| options | <code>HtmlContextTypeOptions | TextContextTypeOptions</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [convertObject](./kibana-plugin-plugins-data-public.fieldformat.convertobject.md)
|
||||
|
||||
## FieldFormat.convertObject property
|
||||
|
||||
{<!-- -->FieldFormatConvert<!-- -->} have to remove the private because of https://github.com/Microsoft/TypeScript/issues/17293
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
convertObject: FieldFormatConvert | undefined;
|
||||
```
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [fieldType](./kibana-plugin-plugins-data-public.fieldformat.fieldtype.md)
|
||||
|
||||
## FieldFormat.fieldType property
|
||||
|
||||
{<!-- -->string<!-- -->} - Field Format Type
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static fieldType: string | string[];
|
||||
```
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [from](./kibana-plugin-plugins-data-public.fieldformat.from.md)
|
||||
|
||||
## FieldFormat.from() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static from(convertFn: FieldFormatConvertFunction): FieldFormatInstanceType;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| convertFn | <code>FieldFormatConvertFunction</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`FieldFormatInstanceType`
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getConfig](./kibana-plugin-plugins-data-public.fieldformat.getconfig.md)
|
||||
|
||||
## FieldFormat.getConfig property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
protected getConfig: FieldFormatsGetConfigFn | undefined;
|
||||
```
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getConverterFor](./kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md)
|
||||
|
||||
## FieldFormat.getConverterFor() method
|
||||
|
||||
Get a convert function that is bound to a specific contentType
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
getConverterFor(contentType?: FieldFormatsContentType): FieldFormatConvertFunction;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| contentType | <code>FieldFormatsContentType</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`FieldFormatConvertFunction`
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [getParamDefaults](./kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md)
|
||||
|
||||
## FieldFormat.getParamDefaults() method
|
||||
|
||||
Get parameter defaults {<!-- -->object<!-- -->} - parameter defaults
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
getParamDefaults(): Record<string, any>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`Record<string, any>`
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [htmlConvert](./kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md)
|
||||
|
||||
## FieldFormat.htmlConvert property
|
||||
|
||||
{<!-- -->htmlConvert<!-- -->} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
htmlConvert: HtmlContextTypeConvert | undefined;
|
||||
```
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [id](./kibana-plugin-plugins-data-public.fieldformat.id.md)
|
||||
|
||||
## FieldFormat.id property
|
||||
|
||||
{<!-- -->string<!-- -->} - Field Format Id
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static id: string;
|
||||
```
|
|
@ -0,0 +1,22 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [isInstanceOfFieldFormat](./kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md)
|
||||
|
||||
## FieldFormat.isInstanceOfFieldFormat() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static isInstanceOfFieldFormat(fieldFormat: any): fieldFormat is FieldFormat;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| fieldFormat | <code>any</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`fieldFormat is FieldFormat`
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md)
|
||||
|
||||
## FieldFormat class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare abstract class FieldFormat
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(\_params, getConfig)](./kibana-plugin-plugins-data-public.fieldformat._constructor_.md) | | Constructs a new instance of the <code>FieldFormat</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [\_params](./kibana-plugin-plugins-data-public.fieldformat._params.md) | | <code>any</code> | |
|
||||
| [convertObject](./kibana-plugin-plugins-data-public.fieldformat.convertobject.md) | | <code>FieldFormatConvert | undefined</code> | {<!-- -->FieldFormatConvert<!-- -->} have to remove the private because of https://github.com/Microsoft/TypeScript/issues/17293 |
|
||||
| [fieldType](./kibana-plugin-plugins-data-public.fieldformat.fieldtype.md) | <code>static</code> | <code>string | string[]</code> | {<!-- -->string<!-- -->} - Field Format Type |
|
||||
| [getConfig](./kibana-plugin-plugins-data-public.fieldformat.getconfig.md) | | <code>FieldFormatsGetConfigFn | undefined</code> | |
|
||||
| [htmlConvert](./kibana-plugin-plugins-data-public.fieldformat.htmlconvert.md) | | <code>HtmlContextTypeConvert | undefined</code> | {<!-- -->htmlConvert<!-- -->} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 |
|
||||
| [id](./kibana-plugin-plugins-data-public.fieldformat.id.md) | <code>static</code> | <code>string</code> | {<!-- -->string<!-- -->} - Field Format Id |
|
||||
| [textConvert](./kibana-plugin-plugins-data-public.fieldformat.textconvert.md) | | <code>TextContextTypeConvert | undefined</code> | {<!-- -->textConvert<!-- -->} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293 |
|
||||
| [title](./kibana-plugin-plugins-data-public.fieldformat.title.md) | <code>static</code> | <code>string</code> | {<!-- -->string<!-- -->} - Field Format Title |
|
||||
| [type](./kibana-plugin-plugins-data-public.fieldformat.type.md) | | <code>any</code> | {<!-- -->Function<!-- -->} - ref to child class |
|
||||
|
||||
## Methods
|
||||
|
||||
| Method | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [convert(value, contentType, options)](./kibana-plugin-plugins-data-public.fieldformat.convert.md) | | Convert a raw value to a formatted string |
|
||||
| [from(convertFn)](./kibana-plugin-plugins-data-public.fieldformat.from.md) | <code>static</code> | |
|
||||
| [getConverterFor(contentType)](./kibana-plugin-plugins-data-public.fieldformat.getconverterfor.md) | | Get a convert function that is bound to a specific contentType |
|
||||
| [getParamDefaults()](./kibana-plugin-plugins-data-public.fieldformat.getparamdefaults.md) | | Get parameter defaults {<!-- -->object<!-- -->} - parameter defaults |
|
||||
| [isInstanceOfFieldFormat(fieldFormat)](./kibana-plugin-plugins-data-public.fieldformat.isinstanceoffieldformat.md) | <code>static</code> | |
|
||||
| [param(name)](./kibana-plugin-plugins-data-public.fieldformat.param.md) | | Get the value of a param. This value may be a default value. |
|
||||
| [params()](./kibana-plugin-plugins-data-public.fieldformat.params.md) | | Get all of the params in a single object {<!-- -->object<!-- -->} |
|
||||
| [setupContentType()](./kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md) | | |
|
||||
| [toJSON()](./kibana-plugin-plugins-data-public.fieldformat.tojson.md) | | Serialize this format to a simple POJO, with only the params that are not default {<!-- -->object<!-- -->} |
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [param](./kibana-plugin-plugins-data-public.fieldformat.param.md)
|
||||
|
||||
## FieldFormat.param() method
|
||||
|
||||
Get the value of a param. This value may be a default value.
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
param(name: string): any;
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| name | <code>string</code> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`any`
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [params](./kibana-plugin-plugins-data-public.fieldformat.params.md)
|
||||
|
||||
## FieldFormat.params() method
|
||||
|
||||
Get all of the params in a single object {<!-- -->object<!-- -->}
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
params(): Record<string, any>;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`Record<string, any>`
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [setupContentType](./kibana-plugin-plugins-data-public.fieldformat.setupcontenttype.md)
|
||||
|
||||
## FieldFormat.setupContentType() method
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
setupContentType(): FieldFormatConvert;
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`FieldFormatConvert`
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [textConvert](./kibana-plugin-plugins-data-public.fieldformat.textconvert.md)
|
||||
|
||||
## FieldFormat.textConvert property
|
||||
|
||||
{<!-- -->textConvert<!-- -->} have to remove the protected because of https://github.com/Microsoft/TypeScript/issues/17293
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
textConvert: TextContextTypeConvert | undefined;
|
||||
```
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [title](./kibana-plugin-plugins-data-public.fieldformat.title.md)
|
||||
|
||||
## FieldFormat.title property
|
||||
|
||||
{<!-- -->string<!-- -->} - Field Format Title
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
static title: string;
|
||||
```
|
|
@ -0,0 +1,25 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [toJSON](./kibana-plugin-plugins-data-public.fieldformat.tojson.md)
|
||||
|
||||
## FieldFormat.toJSON() method
|
||||
|
||||
Serialize this format to a simple POJO, with only the params that are not default
|
||||
|
||||
{<!-- -->object<!-- -->}
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
toJSON(): {
|
||||
id: unknown;
|
||||
params: _.Dictionary<unknown> | undefined;
|
||||
};
|
||||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`{
|
||||
id: unknown;
|
||||
params: _.Dictionary<unknown> | undefined;
|
||||
}`
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) > [type](./kibana-plugin-plugins-data-public.fieldformat.type.md)
|
||||
|
||||
## FieldFormat.type property
|
||||
|
||||
{<!-- -->Function<!-- -->} - ref to child class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
type: any;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [$$spec](./kibana-plugin-plugins-data-public.indexpatternfield.__spec.md)
|
||||
|
||||
## IndexPatternField.$$spec property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
$$spec: FieldSpec;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [aggregatable](./kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md)
|
||||
|
||||
## IndexPatternField.aggregatable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
aggregatable?: boolean;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [count](./kibana-plugin-plugins-data-public.indexpatternfield.count.md)
|
||||
|
||||
## IndexPatternField.count property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
count?: number;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [displayName](./kibana-plugin-plugins-data-public.indexpatternfield.displayname.md)
|
||||
|
||||
## IndexPatternField.displayName property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
displayName?: string;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md)
|
||||
|
||||
## IndexPatternField.esTypes property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
esTypes?: string[];
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md)
|
||||
|
||||
## IndexPatternField.filterable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
filterable?: boolean;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [format](./kibana-plugin-plugins-data-public.indexpatternfield.format.md)
|
||||
|
||||
## IndexPatternField.format property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
format: any;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [indexPattern](./kibana-plugin-plugins-data-public.indexpatternfield.indexpattern.md)
|
||||
|
||||
## IndexPatternField.indexPattern property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
indexPattern?: IndexPattern;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md)
|
||||
|
||||
## IndexPatternField.lang property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
lang?: string;
|
||||
```
|
|
@ -1,40 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md)
|
||||
|
||||
## IndexPatternField class
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare class Field implements IFieldType
|
||||
```
|
||||
|
||||
## Constructors
|
||||
|
||||
| Constructor | Modifiers | Description |
|
||||
| --- | --- | --- |
|
||||
| [(constructor)(indexPattern, spec, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md) | | Constructs a new instance of the <code>Field</code> class |
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [$$spec](./kibana-plugin-plugins-data-public.indexpatternfield.__spec.md) | | <code>FieldSpec</code> | |
|
||||
| [aggregatable](./kibana-plugin-plugins-data-public.indexpatternfield.aggregatable.md) | | <code>boolean</code> | |
|
||||
| [count](./kibana-plugin-plugins-data-public.indexpatternfield.count.md) | | <code>number</code> | |
|
||||
| [displayName](./kibana-plugin-plugins-data-public.indexpatternfield.displayname.md) | | <code>string</code> | |
|
||||
| [esTypes](./kibana-plugin-plugins-data-public.indexpatternfield.estypes.md) | | <code>string[]</code> | |
|
||||
| [filterable](./kibana-plugin-plugins-data-public.indexpatternfield.filterable.md) | | <code>boolean</code> | |
|
||||
| [format](./kibana-plugin-plugins-data-public.indexpatternfield.format.md) | | <code>any</code> | |
|
||||
| [indexPattern](./kibana-plugin-plugins-data-public.indexpatternfield.indexpattern.md) | | <code>IndexPattern</code> | |
|
||||
| [lang](./kibana-plugin-plugins-data-public.indexpatternfield.lang.md) | | <code>string</code> | |
|
||||
| [name](./kibana-plugin-plugins-data-public.indexpatternfield.name.md) | | <code>string</code> | |
|
||||
| [script](./kibana-plugin-plugins-data-public.indexpatternfield.script.md) | | <code>string</code> | |
|
||||
| [scripted](./kibana-plugin-plugins-data-public.indexpatternfield.scripted.md) | | <code>boolean</code> | |
|
||||
| [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md) | | <code>boolean</code> | |
|
||||
| [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md) | | <code>boolean</code> | |
|
||||
| [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md) | | <code>IFieldSubType</code> | |
|
||||
| [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md) | | <code>string</code> | |
|
||||
| [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md) | | <code>boolean</code> | |
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [name](./kibana-plugin-plugins-data-public.indexpatternfield.name.md)
|
||||
|
||||
## IndexPatternField.name property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
name: string;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [script](./kibana-plugin-plugins-data-public.indexpatternfield.script.md)
|
||||
|
||||
## IndexPatternField.script property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
script?: string;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [scripted](./kibana-plugin-plugins-data-public.indexpatternfield.scripted.md)
|
||||
|
||||
## IndexPatternField.scripted property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
scripted?: boolean;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [searchable](./kibana-plugin-plugins-data-public.indexpatternfield.searchable.md)
|
||||
|
||||
## IndexPatternField.searchable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
searchable?: boolean;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [sortable](./kibana-plugin-plugins-data-public.indexpatternfield.sortable.md)
|
||||
|
||||
## IndexPatternField.sortable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
sortable?: boolean;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [subType](./kibana-plugin-plugins-data-public.indexpatternfield.subtype.md)
|
||||
|
||||
## IndexPatternField.subType property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
subType?: IFieldSubType;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [type](./kibana-plugin-plugins-data-public.indexpatternfield.type.md)
|
||||
|
||||
## IndexPatternField.type property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
type: string;
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) > [visualizable](./kibana-plugin-plugins-data-public.indexpatternfield.visualizable.md)
|
||||
|
||||
## IndexPatternField.visualizable property
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
visualizable?: boolean;
|
||||
```
|
|
@ -11,9 +11,10 @@
|
|||
| [AggParamType](./kibana-plugin-plugins-data-public.aggparamtype.md) | |
|
||||
| [AggTypeFieldFilters](./kibana-plugin-plugins-data-public.aggtypefieldfilters.md) | A registry to store which are used to filter down available fields for a specific visualization and . |
|
||||
| [AggTypeFilters](./kibana-plugin-plugins-data-public.aggtypefilters.md) | A registry to store which are used to filter down available aggregations for a specific visualization and . |
|
||||
| [Field](./kibana-plugin-plugins-data-public.field.md) | |
|
||||
| [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) | |
|
||||
| [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | |
|
||||
| [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) | |
|
||||
| [IndexPatternField](./kibana-plugin-plugins-data-public.indexpatternfield.md) | |
|
||||
| [IndexPatternFieldList](./kibana-plugin-plugins-data-public.indexpatternfieldlist.md) | |
|
||||
| [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) | |
|
||||
| [OptionedParamType](./kibana-plugin-plugins-data-public.optionedparamtype.md) | |
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
```typescript
|
||||
setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): {
|
||||
fieldFormats: {
|
||||
register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
|
||||
register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
|
||||
};
|
||||
search: ISearchSetup;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): {
|
|||
|
||||
`{
|
||||
fieldFormats: {
|
||||
register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
|
||||
register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
|
||||
};
|
||||
search: ISearchSetup;
|
||||
}`
|
||||
|
|
|
@ -23,6 +23,7 @@ import { FieldEditor } from 'ui/field_editor';
|
|||
|
||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { HttpStart, DocLinksStart } from 'src/core/public';
|
||||
import { IndexHeader } from '../index_header';
|
||||
import { IndexPattern, IndexPatternField } from '../../../../../../../../../plugins/data/public';
|
||||
import { ChromeDocTitle, NotificationsStart } from '../../../../../../../../../core/public';
|
||||
|
@ -37,7 +38,8 @@ interface CreateEditFieldProps extends RouteComponentProps {
|
|||
services: {
|
||||
notifications: NotificationsStart;
|
||||
docTitle: ChromeDocTitle;
|
||||
http: Function;
|
||||
getHttpStart: () => HttpStart;
|
||||
docLinksScriptedFields: DocLinksStart['links']['scriptedFields'];
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -68,16 +70,14 @@ export const CreateEditField = withRouter(
|
|||
|
||||
const url = `/management/kibana/index_patterns/${indexPattern.id}`;
|
||||
|
||||
if (mode === 'edit') {
|
||||
if (!field) {
|
||||
const message = i18n.translate('kbn.management.editIndexPattern.scripted.noFieldLabel', {
|
||||
defaultMessage:
|
||||
"'{indexPatternTitle}' index pattern doesn't have a scripted field called '{fieldName}'",
|
||||
values: { indexPatternTitle: indexPattern.title, fieldName },
|
||||
});
|
||||
services.notifications.toasts.addWarning(message);
|
||||
history.push(url);
|
||||
}
|
||||
if (mode === 'edit' && !field) {
|
||||
const message = i18n.translate('kbn.management.editIndexPattern.scripted.noFieldLabel', {
|
||||
defaultMessage:
|
||||
"'{indexPatternTitle}' index pattern doesn't have a scripted field called '{fieldName}'",
|
||||
values: { indexPatternTitle: indexPattern.title, fieldName },
|
||||
});
|
||||
services.notifications.toasts.addWarning(message);
|
||||
history.push(url);
|
||||
}
|
||||
|
||||
const docFieldName = field?.name || newFieldPlaceholder;
|
||||
|
@ -88,24 +88,29 @@ export const CreateEditField = withRouter(
|
|||
history.push(`${url}?_a=(tab:${field?.scripted ? TAB_SCRIPTED_FIELDS : TAB_INDEXED_FIELDS})`);
|
||||
};
|
||||
|
||||
return (
|
||||
<EuiFlexGroup direction="column">
|
||||
<EuiFlexItem>
|
||||
<IndexHeader indexPattern={indexPattern} defaultIndex={getConfig('defaultIndex')} />
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem>
|
||||
<FieldEditor
|
||||
indexPattern={indexPattern}
|
||||
field={field}
|
||||
helpers={{
|
||||
getConfig,
|
||||
$http: services.http,
|
||||
fieldFormatEditors,
|
||||
redirectAway,
|
||||
}}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
);
|
||||
if (field) {
|
||||
return (
|
||||
<EuiFlexGroup direction="column">
|
||||
<EuiFlexItem>
|
||||
<IndexHeader indexPattern={indexPattern} defaultIndex={getConfig('defaultIndex')} />
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem>
|
||||
<FieldEditor
|
||||
indexPattern={indexPattern}
|
||||
field={field}
|
||||
helpers={{
|
||||
getConfig,
|
||||
getHttpStart: services.getHttpStart,
|
||||
fieldFormatEditors,
|
||||
redirectAway,
|
||||
docLinksScriptedFields: services.docLinksScriptedFields,
|
||||
}}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
);
|
||||
} else {
|
||||
return <></>;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -95,7 +95,7 @@ uiModules
|
|||
|
||||
// routes for create edit field. Will be removed after migartion all component to react.
|
||||
const REACT_FIELD_EDITOR_ID = 'reactFieldEditor';
|
||||
const renderCreateEditField = ($scope, $route, getConfig, $http, fieldFormatEditors) => {
|
||||
const renderCreateEditField = ($scope, $route, getConfig, fieldFormatEditors) => {
|
||||
$scope.$$postDigest(() => {
|
||||
const node = document.getElementById(REACT_FIELD_EDITOR_ID);
|
||||
if (!node) {
|
||||
|
@ -112,9 +112,10 @@ const renderCreateEditField = ($scope, $route, getConfig, $http, fieldFormatEdit
|
|||
fieldFormatEditors={fieldFormatEditors}
|
||||
getConfig={getConfig}
|
||||
services={{
|
||||
http: $http,
|
||||
getHttpStart: () => npStart.core.http,
|
||||
notifications: npStart.core.notifications,
|
||||
docTitle: npStart.core.chrome.docTitle,
|
||||
docLinksScriptedFields: npStart.core.docLinks.links.scriptedFields,
|
||||
}}
|
||||
/>
|
||||
</I18nContext>
|
||||
|
@ -162,11 +163,11 @@ uiRoutes
|
|||
},
|
||||
},
|
||||
controllerAs: 'fieldSettings',
|
||||
controller: function FieldEditorPageController($scope, $route, $http, Private, config) {
|
||||
controller: function FieldEditorPageController($scope, $route, Private, config) {
|
||||
const getConfig = (...args) => config.get(...args);
|
||||
const fieldFormatEditors = Private(RegistryFieldFormatEditorsProvider);
|
||||
|
||||
renderCreateEditField($scope, $route, getConfig, $http, fieldFormatEditors);
|
||||
renderCreateEditField($scope, $route, getConfig, fieldFormatEditors);
|
||||
|
||||
$scope.$on('$destroy', () => {
|
||||
destroyCreateEditField();
|
||||
|
|
|
@ -19,10 +19,31 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = `
|
|||
isVisible={false}
|
||||
/>
|
||||
<scripting-warning-callOut
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
isVisible={true}
|
||||
/>
|
||||
<ScriptingHelpFlyout
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
executeScript={[Function]}
|
||||
getHttpStart={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"fields": Array [
|
||||
|
@ -112,15 +133,9 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = `
|
|||
}
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Format (Default: {defaultFormat})"
|
||||
id="common.ui.fieldEditor.defaultFormatHeader"
|
||||
values={
|
||||
Object {
|
||||
"defaultFormat": <eui-code>
|
||||
Test format
|
||||
</eui-code>,
|
||||
}
|
||||
}
|
||||
defaultMessage="Format"
|
||||
id="common.ui.fieldEditor.formatHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
@ -134,8 +149,8 @@ exports[`FieldEditor should render create new scripted field correctly 1`] = `
|
|||
"value": "",
|
||||
},
|
||||
Object {
|
||||
"text": "Test format",
|
||||
"value": "test_format",
|
||||
"text": undefined,
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -260,10 +275,31 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = `
|
|||
isVisible={false}
|
||||
/>
|
||||
<scripting-warning-callOut
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
isVisible={true}
|
||||
/>
|
||||
<ScriptingHelpFlyout
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
executeScript={[Function]}
|
||||
getHttpStart={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"fields": Array [
|
||||
|
@ -349,15 +385,9 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = `
|
|||
}
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Format (Default: {defaultFormat})"
|
||||
id="common.ui.fieldEditor.defaultFormatHeader"
|
||||
values={
|
||||
Object {
|
||||
"defaultFormat": <eui-code>
|
||||
Test format
|
||||
</eui-code>,
|
||||
}
|
||||
}
|
||||
defaultMessage="Format"
|
||||
id="common.ui.fieldEditor.formatHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
@ -371,8 +401,8 @@ exports[`FieldEditor should render edit scripted field correctly 1`] = `
|
|||
"value": "",
|
||||
},
|
||||
Object {
|
||||
"text": "Test format",
|
||||
"value": "test_format",
|
||||
"text": undefined,
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -508,10 +538,31 @@ exports[`FieldEditor should show conflict field warning 1`] = `
|
|||
isVisible={false}
|
||||
/>
|
||||
<scripting-warning-callOut
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
isVisible={true}
|
||||
/>
|
||||
<ScriptingHelpFlyout
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
executeScript={[Function]}
|
||||
getHttpStart={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"fields": Array [
|
||||
|
@ -645,15 +696,9 @@ exports[`FieldEditor should show conflict field warning 1`] = `
|
|||
}
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Format (Default: {defaultFormat})"
|
||||
id="common.ui.fieldEditor.defaultFormatHeader"
|
||||
values={
|
||||
Object {
|
||||
"defaultFormat": <eui-code>
|
||||
Test format
|
||||
</eui-code>,
|
||||
}
|
||||
}
|
||||
defaultMessage="Format"
|
||||
id="common.ui.fieldEditor.formatHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
@ -667,8 +712,8 @@ exports[`FieldEditor should show conflict field warning 1`] = `
|
|||
"value": "",
|
||||
},
|
||||
Object {
|
||||
"text": "Test format",
|
||||
"value": "test_format",
|
||||
"text": undefined,
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -793,10 +838,31 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
|
|||
isVisible={false}
|
||||
/>
|
||||
<scripting-warning-callOut
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
isVisible={true}
|
||||
/>
|
||||
<ScriptingHelpFlyout
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
executeScript={[Function]}
|
||||
getHttpStart={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"fields": Array [
|
||||
|
@ -854,7 +920,7 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
|
|||
testlang
|
||||
</eui-code>,
|
||||
"painlessLink": <eui-link
|
||||
href="(docLink for scriptedFields.painless)"
|
||||
href="https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html"
|
||||
target="_blank"
|
||||
>
|
||||
<FormattedMessage
|
||||
|
@ -972,15 +1038,9 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
|
|||
}
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Format (Default: {defaultFormat})"
|
||||
id="common.ui.fieldEditor.defaultFormatHeader"
|
||||
values={
|
||||
Object {
|
||||
"defaultFormat": <eui-code>
|
||||
Test format
|
||||
</eui-code>,
|
||||
}
|
||||
}
|
||||
defaultMessage="Format"
|
||||
id="common.ui.fieldEditor.formatHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
@ -994,8 +1054,8 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
|
|||
"value": "",
|
||||
},
|
||||
Object {
|
||||
"text": "Test format",
|
||||
"value": "test_format",
|
||||
"text": undefined,
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -1131,10 +1191,31 @@ exports[`FieldEditor should show multiple type field warning with a table contai
|
|||
isVisible={false}
|
||||
/>
|
||||
<scripting-warning-callOut
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
isVisible={true}
|
||||
/>
|
||||
<ScriptingHelpFlyout
|
||||
docLinksScriptedFields={
|
||||
Object {
|
||||
"luceneExpressions": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-expression.html",
|
||||
"painless": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless.html",
|
||||
"painlessApi": "https://www.elastic.co/guide/en/elasticsearch/painless/mocked-test-branch/painless-api-reference.html",
|
||||
"painlessSyntax": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/modules-scripting-painless-syntax.html",
|
||||
"scriptAggs": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-aggregations.html#_values_source",
|
||||
"scriptFields": "https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/search-request-script-fields.html",
|
||||
}
|
||||
}
|
||||
executeScript={[Function]}
|
||||
getHttpStart={[Function]}
|
||||
indexPattern={
|
||||
Object {
|
||||
"fields": Array [
|
||||
|
@ -1324,15 +1405,9 @@ exports[`FieldEditor should show multiple type field warning with a table contai
|
|||
}
|
||||
label={
|
||||
<FormattedMessage
|
||||
defaultMessage="Format (Default: {defaultFormat})"
|
||||
id="common.ui.fieldEditor.defaultFormatHeader"
|
||||
values={
|
||||
Object {
|
||||
"defaultFormat": <eui-code>
|
||||
Test format
|
||||
</eui-code>,
|
||||
}
|
||||
}
|
||||
defaultMessage="Format"
|
||||
id="common.ui.fieldEditor.formatHeader"
|
||||
values={Object {}}
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
@ -1346,8 +1421,8 @@ exports[`FieldEditor should show multiple type field warning with a table contai
|
|||
"value": "",
|
||||
},
|
||||
Object {
|
||||
"text": "Test format",
|
||||
"value": "test_format",
|
||||
"text": undefined,
|
||||
"value": "",
|
||||
},
|
||||
]
|
||||
}
|
|
@ -12,4 +12,14 @@ exports[`FieldFormatEditor should render normally 1`] = `
|
|||
</Fragment>
|
||||
`;
|
||||
|
||||
exports[`FieldFormatEditor should render nothing if there is no editor for the format 1`] = `<Fragment />`;
|
||||
exports[`FieldFormatEditor should render nothing if there is no editor for the format 1`] = `
|
||||
<Fragment>
|
||||
<TestEditor
|
||||
fieldType="number"
|
||||
format={Object {}}
|
||||
formatParams={Object {}}
|
||||
onChange={[Function]}
|
||||
onError={[Function]}
|
||||
/>
|
||||
</Fragment>
|
||||
`;
|
|
@ -5,7 +5,6 @@ exports[`BytesFormatEditor should render normally 1`] = `
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -47,6 +46,7 @@ exports[`BytesFormatEditor should render normally 1`] = `
|
|||
isInvalid={false}
|
||||
onChange={[Function]}
|
||||
placeholder="0,0.[000]b"
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -21,15 +21,18 @@ import React from 'react';
|
|||
import { shallow } from 'enzyme';
|
||||
|
||||
import { BytesFormatEditor } from './bytes';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
const fieldType = 'number';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => input * 2),
|
||||
getConverterFor: jest.fn().mockImplementation(() => (input: number) => input * 2),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return { pattern: '0,0.[000]b' };
|
||||
}),
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = {
|
||||
pattern: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -41,8 +44,9 @@ describe('BytesFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallow(
|
||||
<BytesFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -18,16 +18,12 @@
|
|||
*/
|
||||
|
||||
import { NumberFormatEditor } from '../number';
|
||||
import { defaultState } from '../default';
|
||||
|
||||
export class BytesFormatEditor extends NumberFormatEditor {
|
||||
static formatId = 'bytes';
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
...this.state,
|
||||
sampleInputs: [256, 1024, 5150000, 1990000000],
|
||||
};
|
||||
}
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [256, 1024, 5150000, 1990000000],
|
||||
};
|
||||
}
|
|
@ -52,6 +52,8 @@ exports[`ColorFormatEditor should render multiple colors 1`] = `
|
|||
"type": "icon",
|
||||
},
|
||||
],
|
||||
"field": "actions",
|
||||
"name": "Actions",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -149,6 +151,8 @@ exports[`ColorFormatEditor should render other type normally (range field) 1`] =
|
|||
"type": "icon",
|
||||
},
|
||||
],
|
||||
"field": "actions",
|
||||
"name": "Actions",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -239,6 +243,8 @@ exports[`ColorFormatEditor should render string type normally (regex field) 1`]
|
|||
"type": "icon",
|
||||
},
|
||||
],
|
||||
"field": "actions",
|
||||
"name": "Actions",
|
||||
},
|
||||
]
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
import { ColorFormatEditor } from './color';
|
||||
import { fieldFormats } from '../../../../../../../../plugins/data/public';
|
||||
|
@ -41,8 +42,9 @@ describe('ColorFormatEditor', () => {
|
|||
it('should render string type normally (regex field)', async () => {
|
||||
const component = shallowWithI18nProvider(
|
||||
<ColorFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
|
@ -55,8 +57,9 @@ describe('ColorFormatEditor', () => {
|
|||
it('should render other type normally (range field)', async () => {
|
||||
const component = shallowWithI18nProvider(
|
||||
<ColorFormatEditor
|
||||
basePath={''}
|
||||
fieldType={'number'}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
|
@ -69,8 +72,9 @@ describe('ColorFormatEditor', () => {
|
|||
it('should render multiple colors', async () => {
|
||||
const component = shallowWithI18nProvider(
|
||||
<ColorFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={{ colors: [...formatParams.colors, ...formatParams.colors] }}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -21,22 +21,37 @@ import React, { Fragment } from 'react';
|
|||
|
||||
import { EuiBasicTable, EuiButton, EuiColorPicker, EuiFieldText, EuiSpacer } from '@elastic/eui';
|
||||
|
||||
import { DefaultFormatEditor } from '../default';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { DefaultFormatEditor, FormatEditorProps } from '../default';
|
||||
|
||||
import { fieldFormats } from '../../../../../../../../plugins/data/public';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
interface Color {
|
||||
range?: string;
|
||||
regex?: string;
|
||||
text: string;
|
||||
background: string;
|
||||
}
|
||||
|
||||
export class ColorFormatEditor extends DefaultFormatEditor {
|
||||
constructor(props) {
|
||||
interface IndexedColor extends Color {
|
||||
index: number;
|
||||
}
|
||||
|
||||
interface ColorFormatEditorFormatParams {
|
||||
colors: Color[];
|
||||
}
|
||||
|
||||
export class ColorFormatEditor extends DefaultFormatEditor<ColorFormatEditorFormatParams> {
|
||||
static formatId = 'color';
|
||||
constructor(props: FormatEditorProps<ColorFormatEditorFormatParams>) {
|
||||
super(props);
|
||||
this.onChange({
|
||||
fieldType: props.fieldType,
|
||||
});
|
||||
}
|
||||
|
||||
onColorChange = (newColorParams, index) => {
|
||||
onColorChange = (newColorParams: Partial<Color>, index: number) => {
|
||||
const colors = [...this.props.formatParams.colors];
|
||||
colors[index] = {
|
||||
...colors[index],
|
||||
|
@ -54,7 +69,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
});
|
||||
};
|
||||
|
||||
removeColor = index => {
|
||||
removeColor = (index: number) => {
|
||||
const colors = [...this.props.formatParams.colors];
|
||||
colors.splice(index, 1);
|
||||
this.onChange({
|
||||
|
@ -86,7 +101,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
defaultMessage="Pattern (regular expression)"
|
||||
/>
|
||||
),
|
||||
render: (value, item) => {
|
||||
render: (value: string, item: IndexedColor) => {
|
||||
return (
|
||||
<EuiFieldText
|
||||
value={value}
|
||||
|
@ -110,7 +125,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
defaultMessage="Range (min:max)"
|
||||
/>
|
||||
),
|
||||
render: (value, item) => {
|
||||
render: (value: string, item: IndexedColor) => {
|
||||
return (
|
||||
<EuiFieldText
|
||||
value={value}
|
||||
|
@ -134,7 +149,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
defaultMessage="Text color"
|
||||
/>
|
||||
),
|
||||
render: (color, item) => {
|
||||
render: (color: string, item: IndexedColor) => {
|
||||
return (
|
||||
<EuiColorPicker
|
||||
color={color}
|
||||
|
@ -158,7 +173,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
defaultMessage="Background color"
|
||||
/>
|
||||
),
|
||||
render: (color, item) => {
|
||||
render: (color: string, item: IndexedColor) => {
|
||||
return (
|
||||
<EuiColorPicker
|
||||
color={color}
|
||||
|
@ -181,7 +196,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
defaultMessage="Example"
|
||||
/>
|
||||
),
|
||||
render: item => {
|
||||
render: (item: IndexedColor) => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
|
@ -195,6 +210,10 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
},
|
||||
},
|
||||
{
|
||||
field: 'actions',
|
||||
name: i18n.translate('common.ui.fieldEditor.color.actions', {
|
||||
defaultMessage: 'Actions',
|
||||
}),
|
||||
actions: [
|
||||
{
|
||||
name: i18n.translate('common.ui.fieldEditor.color.deleteAria', {
|
||||
|
@ -203,7 +222,7 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
description: i18n.translate('common.ui.fieldEditor.color.deleteTitle', {
|
||||
defaultMessage: 'Delete color format',
|
||||
}),
|
||||
onClick: item => {
|
||||
onClick: (item: IndexedColor) => {
|
||||
this.removeColor(item.index);
|
||||
},
|
||||
type: 'icon',
|
||||
|
@ -230,5 +249,3 @@ export class ColorFormatEditor extends DefaultFormatEditor {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
ColorFormatEditor.formatId = 'color';
|
|
@ -5,7 +5,6 @@ exports[`DateFormatEditor should render normally 1`] = `
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -48,6 +47,7 @@ exports[`DateFormatEditor should render normally 1`] = `
|
|||
isInvalid={false}
|
||||
onChange={[Function]}
|
||||
placeholder="MMMM Do YYYY, HH:mm:ss.SSS"
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -19,17 +19,20 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
import { DateFormatEditor } from './date';
|
||||
|
||||
const fieldType = 'date';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => `converted date for ${input}`),
|
||||
getConverterFor: jest
|
||||
.fn()
|
||||
.mockImplementation(() => (input: string) => `converted date for ${input}`),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return { pattern: 'MMMM Do YYYY, HH:mm:ss.SSS' };
|
||||
}),
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = { pattern: '' };
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -41,8 +44,9 @@ describe('DateFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallow(
|
||||
<DateFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -22,18 +22,20 @@ import moment from 'moment';
|
|||
|
||||
import { EuiCode, EuiFieldText, EuiFormRow, EuiIcon, EuiLink } from '@elastic/eui';
|
||||
|
||||
import { DefaultFormatEditor } from '../default';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { DefaultFormatEditor, defaultState } from '../default';
|
||||
|
||||
import { FormatEditorSamples } from '../../samples';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
interface DateFormatEditorFormatParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
export class DateFormatEditor extends DefaultFormatEditor {
|
||||
export class DateFormatEditor extends DefaultFormatEditor<DateFormatEditorFormatParams> {
|
||||
static formatId = 'date';
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state.sampleInputs = [
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [
|
||||
Date.now(),
|
||||
moment()
|
||||
.startOf('year')
|
||||
|
@ -41,8 +43,8 @@ export class DateFormatEditor extends DefaultFormatEditor {
|
|||
moment()
|
||||
.endOf('year')
|
||||
.valueOf(),
|
||||
];
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
render() {
|
||||
const { format, formatParams } = this.props;
|
|
@ -5,7 +5,6 @@ exports[`DateFormatEditor should render normally 1`] = `
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -48,6 +47,7 @@ exports[`DateFormatEditor should render normally 1`] = `
|
|||
isInvalid={false}
|
||||
onChange={[Function]}
|
||||
placeholder="MMM D, YYYY @ HH:mm:ss.SSSSSSSSS"
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -19,17 +19,22 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FieldFormat } from '../../../../../../../../plugins/data/public';
|
||||
|
||||
import { DateNanosFormatEditor } from './date_nanos';
|
||||
|
||||
const fieldType = 'date_nanos';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => `converted date for ${input}`),
|
||||
getConverterFor: jest
|
||||
.fn()
|
||||
.mockImplementation(() => (input: string) => `converted date for ${input}`),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return { pattern: 'MMM D, YYYY @ HH:mm:ss.SSSSSSSSS' };
|
||||
}),
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = {
|
||||
pattern: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -41,8 +46,9 @@ describe('DateFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallow(
|
||||
<DateNanosFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -21,23 +21,25 @@ import React, { Fragment } from 'react';
|
|||
|
||||
import { EuiCode, EuiFieldText, EuiFormRow, EuiIcon, EuiLink } from '@elastic/eui';
|
||||
|
||||
import { DefaultFormatEditor } from '../default';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { DefaultFormatEditor, defaultState } from '../default';
|
||||
|
||||
import { FormatEditorSamples } from '../../samples';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
interface DateNanosFormatEditorFormatParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
export class DateNanosFormatEditor extends DefaultFormatEditor {
|
||||
export class DateNanosFormatEditor extends DefaultFormatEditor<DateNanosFormatEditorFormatParams> {
|
||||
static formatId = 'date_nanos';
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state.sampleInputs = [
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [
|
||||
'2015-01-01T12:10:30.123456789Z',
|
||||
'2019-05-08T06:55:21.567891234Z',
|
||||
'2019-08-06T17:22:30.987654321Z',
|
||||
];
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
render() {
|
||||
const { format, formatParams } = this.props;
|
|
@ -1,3 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`DefaultFormatEditor should render nothing 1`] = `""`;
|
|
@ -0,0 +1,3 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`DefaultFormatEditor should render nothing 1`] = `<Fragment />`;
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
import { DefaultFormatEditor, convertSampleInput } from './default';
|
||||
import { DefaultFormatEditor, convertSampleInput, ConverterParams } from './default';
|
||||
|
||||
const fieldType = 'number';
|
||||
const format = {
|
||||
|
@ -32,13 +33,11 @@ const onError = jest.fn();
|
|||
|
||||
describe('DefaultFormatEditor', () => {
|
||||
describe('convertSampleInput', () => {
|
||||
const converter = input => {
|
||||
if (isNaN(input)) {
|
||||
throw {
|
||||
message: 'Input is not a number',
|
||||
};
|
||||
const converter = (input: ConverterParams) => {
|
||||
if (typeof input !== 'number') {
|
||||
throw new Error('Input is not a number');
|
||||
} else {
|
||||
return input * 2;
|
||||
return (input * 2).toString();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -46,12 +45,12 @@ describe('DefaultFormatEditor', () => {
|
|||
const inputs = [1, 10, 15];
|
||||
const output = convertSampleInput(converter, inputs);
|
||||
|
||||
expect(output.error).toEqual(null);
|
||||
expect(output.error).toBeUndefined();
|
||||
expect(JSON.stringify(output.samples)).toEqual(
|
||||
JSON.stringify([
|
||||
{ input: 1, output: 2 },
|
||||
{ input: 10, output: 20 },
|
||||
{ input: 15, output: 30 },
|
||||
{ input: 1, output: '2' },
|
||||
{ input: 10, output: '20' },
|
||||
{ input: 15, output: '30' },
|
||||
])
|
||||
);
|
||||
});
|
||||
|
@ -70,8 +69,9 @@ describe('DefaultFormatEditor', () => {
|
|||
it('should render nothing', async () => {
|
||||
const component = shallow(
|
||||
<DefaultFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
|
@ -86,29 +86,31 @@ describe('DefaultFormatEditor', () => {
|
|||
it('should call prop onChange()', async () => {
|
||||
const component = shallow(
|
||||
<DefaultFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
/>
|
||||
);
|
||||
|
||||
component.instance().onChange();
|
||||
(component.instance() as DefaultFormatEditor).onChange();
|
||||
expect(onChange).toBeCalled();
|
||||
});
|
||||
|
||||
it('should call prop onError() if converter throws an error', async () => {
|
||||
const newFormat = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => () => {
|
||||
throw { message: 'Test error message' };
|
||||
throw new Error('Test error message');
|
||||
}),
|
||||
};
|
||||
|
||||
shallow(
|
||||
<DefaultFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={newFormat}
|
||||
format={(newFormat as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -17,13 +17,21 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { PureComponent } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { PureComponent, ReactText } from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const convertSampleInput = (converter, inputs) => {
|
||||
let error = null;
|
||||
let samples = [];
|
||||
import { FieldFormat, FieldFormatsContentType } from 'src/plugins/data/public';
|
||||
import { Sample } from '../../../../types';
|
||||
import { FieldFormatEditorProps } from '../../field_format_editor';
|
||||
|
||||
export type ConverterParams = string | number | Array<string | number>;
|
||||
|
||||
export const convertSampleInput = (
|
||||
converter: (input: ConverterParams) => string,
|
||||
inputs: ConverterParams[]
|
||||
) => {
|
||||
let error;
|
||||
let samples: Sample[] = [];
|
||||
|
||||
try {
|
||||
samples = inputs.map(input => {
|
||||
|
@ -45,32 +53,48 @@ export const convertSampleInput = (converter, inputs) => {
|
|||
};
|
||||
};
|
||||
|
||||
export class DefaultFormatEditor extends PureComponent {
|
||||
static propTypes = {
|
||||
fieldType: PropTypes.string.isRequired,
|
||||
format: PropTypes.object.isRequired,
|
||||
formatParams: PropTypes.object.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
onError: PropTypes.func.isRequired,
|
||||
};
|
||||
interface SampleInputs {
|
||||
[key: string]: Array<ReactText[] | ReactText>;
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
sampleInputs: [],
|
||||
sampleConverterType: 'text',
|
||||
error: null,
|
||||
samples: [],
|
||||
};
|
||||
}
|
||||
export interface FormatEditorProps<P> {
|
||||
fieldType: string;
|
||||
format: FieldFormat;
|
||||
formatParams: { type?: string } & P;
|
||||
onChange: (newParams: Record<string, any>) => void;
|
||||
onError: FieldFormatEditorProps['onError'];
|
||||
basePath: string;
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, state) {
|
||||
export interface FormatEditorState {
|
||||
sampleInputs: ReactText[];
|
||||
sampleConverterType: FieldFormatsContentType;
|
||||
error?: string;
|
||||
samples: Sample[];
|
||||
sampleInputsByType: SampleInputs;
|
||||
}
|
||||
|
||||
export const defaultState = {
|
||||
sampleInputs: [] as ReactText[],
|
||||
sampleConverterType: 'text' as FieldFormatsContentType,
|
||||
error: undefined,
|
||||
samples: [] as Sample[],
|
||||
sampleInputsByType: {},
|
||||
};
|
||||
|
||||
export class DefaultFormatEditor<P = {}, S = {}> extends PureComponent<
|
||||
FormatEditorProps<P>,
|
||||
FormatEditorState & S
|
||||
> {
|
||||
state = defaultState as FormatEditorState & S;
|
||||
|
||||
static getDerivedStateFromProps(nextProps: FormatEditorProps<{}>, state: FormatEditorState) {
|
||||
const { format, formatParams, onError } = nextProps;
|
||||
const { sampleInputsByType, sampleInputs, sampleConverterType } = state;
|
||||
|
||||
const converter = format.getConverterFor(sampleConverterType);
|
||||
const type = typeof sampleInputsByType === 'object' && formatParams.type;
|
||||
const inputs = type ? sampleInputsByType[formatParams.type] || [] : sampleInputs;
|
||||
const inputs = type ? sampleInputsByType[formatParams.type as string] || [] : sampleInputs;
|
||||
const output = convertSampleInput(converter, inputs);
|
||||
onError(output.error);
|
||||
return output;
|
||||
|
@ -78,6 +102,7 @@ export class DefaultFormatEditor extends PureComponent {
|
|||
|
||||
onChange = (newParams = {}) => {
|
||||
const { onChange, formatParams } = this.props;
|
||||
|
||||
onChange({
|
||||
...formatParams,
|
||||
...newParams,
|
||||
|
@ -85,6 +110,6 @@ export class DefaultFormatEditor extends PureComponent {
|
|||
};
|
||||
|
||||
render() {
|
||||
return null;
|
||||
return <></>;
|
||||
}
|
||||
}
|
|
@ -17,4 +17,4 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export { DefaultFormatEditor } from './default';
|
||||
export { DefaultFormatEditor, defaultState, FormatEditorProps, FormatEditorState } from './default';
|
|
@ -5,7 +5,6 @@ exports[`DurationFormatEditor should render human readable output normally 1`] =
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -30,6 +29,7 @@ exports[`DurationFormatEditor should render human readable output normally 1`] =
|
|||
},
|
||||
]
|
||||
}
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<EuiFormRow
|
||||
|
@ -63,6 +63,7 @@ exports[`DurationFormatEditor should render human readable output normally 1`] =
|
|||
},
|
||||
]
|
||||
}
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
||||
|
@ -116,7 +117,6 @@ exports[`DurationFormatEditor should render non-human readable output normally 1
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -141,6 +141,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1
|
|||
},
|
||||
]
|
||||
}
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<EuiFormRow
|
||||
|
@ -174,6 +175,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1
|
|||
},
|
||||
]
|
||||
}
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<EuiFormRow
|
||||
|
@ -198,6 +200,7 @@ exports[`DurationFormatEditor should render non-human readable output normally 1
|
|||
max={20}
|
||||
min={0}
|
||||
onChange={[Function]}
|
||||
value={2}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -21,10 +21,13 @@ import React from 'react';
|
|||
import { shallow } from 'enzyme';
|
||||
|
||||
import { DurationFormatEditor } from './duration';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
const fieldType = 'number';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => `converted duration for ${input}`),
|
||||
getConverterFor: jest
|
||||
.fn()
|
||||
.mockImplementation(() => (input: string) => `converted duration for ${input}`),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return {
|
||||
inputFormat: 'seconds',
|
||||
|
@ -52,7 +55,11 @@ const format = {
|
|||
],
|
||||
},
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = {
|
||||
outputPrecision: 2,
|
||||
inputFormat: '',
|
||||
outputFormat: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -64,8 +71,9 @@ describe('DurationFormatEditor', () => {
|
|||
it('should render human readable output normally', async () => {
|
||||
const component = shallow(
|
||||
<DurationFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
|
@ -88,8 +96,9 @@ describe('DurationFormatEditor', () => {
|
|||
};
|
||||
const component = shallow(
|
||||
<DurationFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={newFormat}
|
||||
format={(newFormat as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -18,30 +18,63 @@
|
|||
*/
|
||||
|
||||
import React, { Fragment } from 'react';
|
||||
import { DurationFormat } from 'src/plugins/data/common';
|
||||
|
||||
import { EuiFieldNumber, EuiFormRow, EuiSelect } from '@elastic/eui';
|
||||
|
||||
import { DefaultFormatEditor } from '../default';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
DefaultFormatEditor,
|
||||
defaultState,
|
||||
FormatEditorProps,
|
||||
FormatEditorState,
|
||||
} from '../default';
|
||||
|
||||
import { FormatEditorSamples } from '../../samples';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
interface DurationFormatEditorState {
|
||||
hasDecimalError: boolean;
|
||||
}
|
||||
|
||||
export class DurationFormatEditor extends DefaultFormatEditor {
|
||||
interface InputFormat {
|
||||
kind: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface OutputFormat {
|
||||
method: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface DurationFormatEditorFormatParams {
|
||||
outputPrecision: number;
|
||||
inputFormat: string;
|
||||
outputFormat: string;
|
||||
}
|
||||
|
||||
export class DurationFormatEditor extends DefaultFormatEditor<
|
||||
DurationFormatEditorFormatParams,
|
||||
DurationFormatEditorState
|
||||
> {
|
||||
static formatId = 'duration';
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [-123, 1, 12, 123, 658, 1988, 3857, 123292, 923528271],
|
||||
hasDecimalError: false,
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state.sampleInputs = [-123, 1, 12, 123, 658, 1988, 3857, 123292, 923528271];
|
||||
this.state.hasDecimalError = false;
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, state) {
|
||||
static getDerivedStateFromProps(
|
||||
nextProps: FormatEditorProps<DurationFormatEditorFormatParams>,
|
||||
state: FormatEditorState & DurationFormatEditorState
|
||||
) {
|
||||
const output = super.getDerivedStateFromProps(nextProps, state);
|
||||
let error = null;
|
||||
|
||||
if (!nextProps.format.isHuman() && nextProps.formatParams.outputPrecision > 20) {
|
||||
if (
|
||||
!(nextProps.format as DurationFormat).isHuman() &&
|
||||
nextProps.formatParams.outputPrecision > 20
|
||||
) {
|
||||
error = i18n.translate('common.ui.fieldEditor.durationErrorMessage', {
|
||||
defaultMessage: 'Decimal places must be between 0 and 20',
|
||||
});
|
||||
|
@ -77,10 +110,10 @@ export class DurationFormatEditor extends DefaultFormatEditor {
|
|||
>
|
||||
<EuiSelect
|
||||
value={formatParams.inputFormat}
|
||||
options={format.type.inputFormats.map(format => {
|
||||
options={format.type.inputFormats.map((fmt: InputFormat) => {
|
||||
return {
|
||||
value: format.kind,
|
||||
text: format.text,
|
||||
value: fmt.kind,
|
||||
text: fmt.text,
|
||||
};
|
||||
})}
|
||||
onChange={e => {
|
||||
|
@ -100,10 +133,10 @@ export class DurationFormatEditor extends DefaultFormatEditor {
|
|||
>
|
||||
<EuiSelect
|
||||
value={formatParams.outputFormat}
|
||||
options={format.type.outputFormats.map(format => {
|
||||
options={format.type.outputFormats.map((fmt: OutputFormat) => {
|
||||
return {
|
||||
value: format.method,
|
||||
text: format.text,
|
||||
value: fmt.method,
|
||||
text: fmt.text,
|
||||
};
|
||||
})}
|
||||
onChange={e => {
|
||||
|
@ -112,7 +145,7 @@ export class DurationFormatEditor extends DefaultFormatEditor {
|
|||
isInvalid={!!error}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
{!format.isHuman() ? (
|
||||
{!(format as DurationFormat).isHuman() ? (
|
||||
<EuiFormRow
|
||||
label={
|
||||
<FormattedMessage
|
|
@ -5,7 +5,6 @@ exports[`NumberFormatEditor should render normally 1`] = `
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -47,6 +46,7 @@ exports[`NumberFormatEditor should render normally 1`] = `
|
|||
isInvalid={false}
|
||||
onChange={[Function]}
|
||||
placeholder="0,0.[000]"
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -19,17 +19,20 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FieldFormat } from 'src/plugins/data/public';
|
||||
|
||||
import { NumberFormatEditor } from './number';
|
||||
|
||||
const fieldType = 'number';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => input * 2),
|
||||
getConverterFor: jest.fn().mockImplementation(() => (input: number) => input * 2),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return { pattern: '0,0.[000]' };
|
||||
}),
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = {
|
||||
pattern: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -41,8 +44,9 @@ describe('NumberFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallow(
|
||||
<NumberFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -21,19 +21,21 @@ import React, { Fragment } from 'react';
|
|||
|
||||
import { EuiCode, EuiFieldText, EuiFormRow, EuiIcon, EuiLink } from '@elastic/eui';
|
||||
|
||||
import { DefaultFormatEditor } from '../default';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import { DefaultFormatEditor, defaultState } from '../default';
|
||||
|
||||
import { FormatEditorSamples } from '../../samples';
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
export interface NumberFormatEditorParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
export class NumberFormatEditor extends DefaultFormatEditor {
|
||||
export class NumberFormatEditor extends DefaultFormatEditor<NumberFormatEditorParams> {
|
||||
static formatId = 'number';
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state.sampleInputs = [10000, 12.345678, -1, -999, 0.52];
|
||||
}
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [10000, 12.345678, -1, -999, 0.52],
|
||||
};
|
||||
|
||||
render() {
|
||||
const { format, formatParams } = this.props;
|
|
@ -5,7 +5,6 @@ exports[`PercentFormatEditor should render normally 1`] = `
|
|||
<EuiFormRow
|
||||
describedByIds={Array []}
|
||||
display="row"
|
||||
error={null}
|
||||
fullWidth={false}
|
||||
hasChildLabel={true}
|
||||
hasEmptyLabelSpace={false}
|
||||
|
@ -47,6 +46,7 @@ exports[`PercentFormatEditor should render normally 1`] = `
|
|||
isInvalid={false}
|
||||
onChange={[Function]}
|
||||
placeholder="0,0.[000]%"
|
||||
value=""
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<FormatEditorSamples
|
|
@ -19,17 +19,20 @@
|
|||
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FieldFormat } from '../../../../../../../../plugins/data/public';
|
||||
|
||||
import { PercentFormatEditor } from './percent';
|
||||
|
||||
const fieldType = 'number';
|
||||
const format = {
|
||||
getConverterFor: jest.fn().mockImplementation(() => input => input * 2),
|
||||
getConverterFor: jest.fn().mockImplementation(() => (input: number) => input * 2),
|
||||
getParamDefaults: jest.fn().mockImplementation(() => {
|
||||
return { pattern: '0,0.[000]%' };
|
||||
}),
|
||||
};
|
||||
const formatParams = {};
|
||||
const formatParams = {
|
||||
pattern: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
|
@ -41,8 +44,9 @@ describe('PercentFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallow(
|
||||
<PercentFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
|
@ -18,16 +18,12 @@
|
|||
*/
|
||||
|
||||
import { NumberFormatEditor } from '../number';
|
||||
import { defaultState } from '../default';
|
||||
|
||||
export class PercentFormatEditor extends NumberFormatEditor {
|
||||
static formatId = 'percent';
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
...this.state,
|
||||
sampleInputs: [0.1, 0.99999, 1, 100, 1000],
|
||||
};
|
||||
}
|
||||
state = {
|
||||
...defaultState,
|
||||
sampleInputs: [0.1, 0.99999, 1, 100, 1000],
|
||||
};
|
||||
}
|
|
@ -35,6 +35,8 @@ exports[`StaticLookupFormatEditor should render multiple lookup entries and unkn
|
|||
"type": "icon",
|
||||
},
|
||||
],
|
||||
"field": "actions",
|
||||
"name": "actions",
|
||||
"width": "30px",
|
||||
},
|
||||
]
|
||||
|
@ -140,6 +142,8 @@ exports[`StaticLookupFormatEditor should render normally 1`] = `
|
|||
"type": "icon",
|
||||
},
|
||||
],
|
||||
"field": "actions",
|
||||
"name": "actions",
|
||||
"width": "30px",
|
||||
},
|
||||
]
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
|
||||
import { shallowWithI18nProvider } from '../../../../../../../../test_utils/public/enzyme_helpers';
|
||||
import { StaticLookupFormatEditorFormatParams } from './static_lookup';
|
||||
import { FieldFormat } from '../../../../../../../../plugins/data/public';
|
||||
|
||||
import { StaticLookupFormatEditor } from './static_lookup';
|
||||
|
||||
|
@ -27,8 +29,8 @@ const format = {
|
|||
getConverterFor: jest.fn(),
|
||||
};
|
||||
const formatParams = {
|
||||
lookupEntries: [{}],
|
||||
unknownKeyValue: null,
|
||||
lookupEntries: [{}] as StaticLookupFormatEditorFormatParams['lookupEntries'],
|
||||
unknownKeyValue: '',
|
||||
};
|
||||
const onChange = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
@ -41,8 +43,9 @@ describe('StaticLookupFormatEditor', () => {
|
|||
it('should render normally', async () => {
|
||||
const component = shallowWithI18nProvider(
|
||||
<StaticLookupFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={formatParams}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
|
@ -55,9 +58,13 @@ describe('StaticLookupFormatEditor', () => {
|
|||
it('should render multiple lookup entries and unknown key value', async () => {
|
||||
const component = shallowWithI18nProvider(
|
||||
<StaticLookupFormatEditor
|
||||
basePath={''}
|
||||
fieldType={fieldType}
|
||||
format={format}
|
||||
formatParams={{ lookupEntries: [{}, {}, {}], unknownKeyValue: 'test value' }}
|
||||
format={(format as unknown) as FieldFormat}
|
||||
formatParams={{
|
||||
lookupEntries: [{}, {}, {}] as StaticLookupFormatEditorFormatParams['lookupEntries'],
|
||||
unknownKeyValue: 'test value',
|
||||
}}
|
||||
onChange={onChange}
|
||||
onError={onError}
|
||||
/>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue