mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
50ff9cad57
commit
35ba9653df
56 changed files with 247 additions and 884 deletions
|
@ -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) > [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md)
|
||||||
|
|
||||||
|
## AggGroupLabels variable
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
AggGroupLabels: {
|
||||||
|
[AggGroupNames.Buckets]: string;
|
||||||
|
[AggGroupNames.Metrics]: string;
|
||||||
|
[AggGroupNames.None]: 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) > [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md)
|
||||||
|
|
||||||
|
## AggGroupName type
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export declare type AggGroupName = $Values<typeof AggGroupNames>;
|
||||||
|
```
|
|
@ -1,24 +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) > [AggTypeFieldFilters](./kibana-plugin-plugins-data-public.aggtypefieldfilters.md) > [addFilter](./kibana-plugin-plugins-data-public.aggtypefieldfilters.addfilter.md)
|
|
||||||
|
|
||||||
## AggTypeFieldFilters.addFilter() method
|
|
||||||
|
|
||||||
Register a new with this registry. This will be used by the .
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
addFilter(filter: AggTypeFieldFilter): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| filter | <code>AggTypeFieldFilter</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,25 +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) > [AggTypeFieldFilters](./kibana-plugin-plugins-data-public.aggtypefieldfilters.md) > [filter](./kibana-plugin-plugins-data-public.aggtypefieldfilters.filter.md)
|
|
||||||
|
|
||||||
## AggTypeFieldFilters.filter() method
|
|
||||||
|
|
||||||
Returns the filtered by all registered filters.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
filter(fields: IndexPatternField[], aggConfig: IAggConfig): IndexPatternField[];
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| fields | <code>IndexPatternField[]</code> | |
|
|
||||||
| aggConfig | <code>IAggConfig</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`IndexPatternField[]`
|
|
||||||
|
|
|
@ -1,21 +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) > [AggTypeFieldFilters](./kibana-plugin-plugins-data-public.aggtypefieldfilters.md)
|
|
||||||
|
|
||||||
## AggTypeFieldFilters class
|
|
||||||
|
|
||||||
A registry to store which are used to filter down available fields for a specific visualization and .
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
declare class AggTypeFieldFilters
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Modifiers | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [addFilter(filter)](./kibana-plugin-plugins-data-public.aggtypefieldfilters.addfilter.md) | | Register a new with this registry. This will be used by the . |
|
|
||||||
| [filter(fields, aggConfig)](./kibana-plugin-plugins-data-public.aggtypefieldfilters.filter.md) | | Returns the filtered by all registered filters. |
|
|
||||||
|
|
|
@ -1,24 +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) > [AggTypeFilters](./kibana-plugin-plugins-data-public.aggtypefilters.md) > [addFilter](./kibana-plugin-plugins-data-public.aggtypefilters.addfilter.md)
|
|
||||||
|
|
||||||
## AggTypeFilters.addFilter() method
|
|
||||||
|
|
||||||
Register a new with this registry.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
addFilter(filter: AggTypeFilter): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| filter | <code>AggTypeFilter</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`void`
|
|
||||||
|
|
|
@ -1,27 +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) > [AggTypeFilters](./kibana-plugin-plugins-data-public.aggtypefilters.md) > [filter](./kibana-plugin-plugins-data-public.aggtypefilters.filter.md)
|
|
||||||
|
|
||||||
## AggTypeFilters.filter() method
|
|
||||||
|
|
||||||
Returns the filtered by all registered filters.
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
filter(aggTypes: IAggType[], indexPattern: IndexPattern, aggConfig: IAggConfig, aggFilter: string[]): IAggType[];
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| aggTypes | <code>IAggType[]</code> | |
|
|
||||||
| indexPattern | <code>IndexPattern</code> | |
|
|
||||||
| aggConfig | <code>IAggConfig</code> | |
|
|
||||||
| aggFilter | <code>string[]</code> | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
`IAggType[]`
|
|
||||||
|
|
|
@ -1,21 +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) > [AggTypeFilters](./kibana-plugin-plugins-data-public.aggtypefilters.md)
|
|
||||||
|
|
||||||
## AggTypeFilters class
|
|
||||||
|
|
||||||
A registry to store which are used to filter down available aggregations for a specific visualization and .
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
declare class AggTypeFilters
|
|
||||||
```
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
| Method | Modifiers | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [addFilter(filter)](./kibana-plugin-plugins-data-public.aggtypefilters.addfilter.md) | | Register a new with this registry. |
|
|
||||||
| [filter(aggTypes, indexPattern, aggConfig, aggFilter)](./kibana-plugin-plugins-data-public.aggtypefilters.filter.md) | | Returns the filtered by all registered filters. |
|
|
||||||
|
|
|
@ -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) > [DateRangeKey](./kibana-plugin-plugins-data-public.daterangekey.md) > [from](./kibana-plugin-plugins-data-public.daterangekey.from.md)
|
|
||||||
|
|
||||||
## DateRangeKey.from property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
from: number;
|
|
||||||
```
|
|
|
@ -1,19 +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) > [DateRangeKey](./kibana-plugin-plugins-data-public.daterangekey.md)
|
|
||||||
|
|
||||||
## DateRangeKey interface
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface DateRangeKey
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [from](./kibana-plugin-plugins-data-public.daterangekey.from.md) | <code>number</code> | |
|
|
||||||
| [to](./kibana-plugin-plugins-data-public.daterangekey.to.md) | <code>number</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) > [DateRangeKey](./kibana-plugin-plugins-data-public.daterangekey.md) > [to](./kibana-plugin-plugins-data-public.daterangekey.to.md)
|
|
||||||
|
|
||||||
## DateRangeKey.to property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
to: 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) > [IAggGroupNames](./kibana-plugin-plugins-data-public.iagggroupnames.md)
|
|
||||||
|
|
||||||
## IAggGroupNames type
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type IAggGroupNames = $Values<typeof AggGroupNames>;
|
|
||||||
```
|
|
|
@ -1,18 +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) > [IpRangeKey](./kibana-plugin-plugins-data-public.iprangekey.md)
|
|
||||||
|
|
||||||
## IpRangeKey type
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export declare type IpRangeKey = {
|
|
||||||
type: 'mask';
|
|
||||||
mask: string;
|
|
||||||
} | {
|
|
||||||
type: 'range';
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
};
|
|
||||||
```
|
|
|
@ -9,8 +9,6 @@
|
||||||
| Class | Description |
|
| Class | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [AggParamType](./kibana-plugin-plugins-data-public.aggparamtype.md) | |
|
| [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) | |
|
| [Field](./kibana-plugin-plugins-data-public.field.md) | |
|
||||||
| [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) | |
|
| [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) | |
|
||||||
| [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | |
|
| [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | |
|
||||||
|
@ -53,7 +51,6 @@
|
||||||
| [AggParamOption](./kibana-plugin-plugins-data-public.aggparamoption.md) | |
|
| [AggParamOption](./kibana-plugin-plugins-data-public.aggparamoption.md) | |
|
||||||
| [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) | |
|
| [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.md) | |
|
||||||
| [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | |
|
| [DataPublicPluginStart](./kibana-plugin-plugins-data-public.datapublicpluginstart.md) | |
|
||||||
| [DateRangeKey](./kibana-plugin-plugins-data-public.daterangekey.md) | |
|
|
||||||
| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | |
|
| [EsQueryConfig](./kibana-plugin-plugins-data-public.esqueryconfig.md) | |
|
||||||
| [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) | |
|
| [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.md) | |
|
||||||
| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | |
|
| [FieldFormatConfig](./kibana-plugin-plugins-data-public.fieldformatconfig.md) | |
|
||||||
|
@ -75,7 +72,6 @@
|
||||||
| [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. |
|
| [ISearchStrategy](./kibana-plugin-plugins-data-public.isearchstrategy.md) | Search strategy interface contains a search method that takes in a request and returns a promise that resolves to a response. |
|
||||||
| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) | |
|
| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.md) | |
|
||||||
| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | |
|
| [KueryNode](./kibana-plugin-plugins-data-public.kuerynode.md) | |
|
||||||
| [OptionedParamEditorProps](./kibana-plugin-plugins-data-public.optionedparameditorprops.md) | |
|
|
||||||
| [OptionedValueProp](./kibana-plugin-plugins-data-public.optionedvalueprop.md) | |
|
| [OptionedValueProp](./kibana-plugin-plugins-data-public.optionedvalueprop.md) | |
|
||||||
| [Query](./kibana-plugin-plugins-data-public.query.md) | |
|
| [Query](./kibana-plugin-plugins-data-public.query.md) | |
|
||||||
| [QueryState](./kibana-plugin-plugins-data-public.querystate.md) | All query state service state |
|
| [QueryState](./kibana-plugin-plugins-data-public.querystate.md) | All query state service state |
|
||||||
|
@ -95,6 +91,7 @@
|
||||||
|
|
||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
| [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md) | |
|
||||||
| [AggGroupNames](./kibana-plugin-plugins-data-public.agggroupnames.md) | |
|
| [AggGroupNames](./kibana-plugin-plugins-data-public.agggroupnames.md) | |
|
||||||
| [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) | |
|
| [baseFormattersPublic](./kibana-plugin-plugins-data-public.baseformatterspublic.md) | |
|
||||||
| [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-public.castestokbnfieldtypename.md) | Get the KbnFieldType name for an esType string |
|
| [castEsToKbnFieldTypeName](./kibana-plugin-plugins-data-public.castestokbnfieldtypename.md) | Get the KbnFieldType name for an esType string |
|
||||||
|
@ -119,6 +116,7 @@
|
||||||
| Type Alias | Description |
|
| Type Alias | Description |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) | |
|
| [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) | |
|
||||||
|
| [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md) | |
|
||||||
| [AggParam](./kibana-plugin-plugins-data-public.aggparam.md) | |
|
| [AggParam](./kibana-plugin-plugins-data-public.aggparam.md) | |
|
||||||
| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | |
|
| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | |
|
||||||
| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | |
|
| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | |
|
||||||
|
@ -127,7 +125,6 @@
|
||||||
| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* |
|
| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.md) | \* |
|
||||||
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | |
|
| [FieldFormatsGetConfigFn](./kibana-plugin-plugins-data-public.fieldformatsgetconfigfn.md) | |
|
||||||
| [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. |
|
| [IAggConfig](./kibana-plugin-plugins-data-public.iaggconfig.md) | AggConfig This class represents an aggregation, which is displayed in the left-hand nav of the Visualize app. |
|
||||||
| [IAggGroupNames](./kibana-plugin-plugins-data-public.iagggroupnames.md) | |
|
|
||||||
| [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | |
|
| [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | |
|
||||||
| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | |
|
| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | |
|
||||||
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | |
|
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | |
|
||||||
|
@ -136,7 +133,6 @@
|
||||||
| [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | |
|
| [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | |
|
||||||
| [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) | |
|
| [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.md) | |
|
||||||
| [InputTimeRange](./kibana-plugin-plugins-data-public.inputtimerange.md) | |
|
| [InputTimeRange](./kibana-plugin-plugins-data-public.inputtimerange.md) | |
|
||||||
| [IpRangeKey](./kibana-plugin-plugins-data-public.iprangekey.md) | |
|
|
||||||
| [ISearch](./kibana-plugin-plugins-data-public.isearch.md) | |
|
| [ISearch](./kibana-plugin-plugins-data-public.isearch.md) | |
|
||||||
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | |
|
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) | |
|
||||||
| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | \* |
|
| [ISearchSource](./kibana-plugin-plugins-data-public.isearchsource.md) | \* |
|
||||||
|
|
|
@ -1,13 +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) > [OptionedParamEditorProps](./kibana-plugin-plugins-data-public.optionedparameditorprops.md) > [aggParam](./kibana-plugin-plugins-data-public.optionedparameditorprops.aggparam.md)
|
|
||||||
|
|
||||||
## OptionedParamEditorProps.aggParam property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
aggParam: {
|
|
||||||
options: T[];
|
|
||||||
};
|
|
||||||
```
|
|
|
@ -1,18 +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) > [OptionedParamEditorProps](./kibana-plugin-plugins-data-public.optionedparameditorprops.md)
|
|
||||||
|
|
||||||
## OptionedParamEditorProps interface
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
export interface OptionedParamEditorProps<T = OptionedValueProp>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Property | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [aggParam](./kibana-plugin-plugins-data-public.optionedparameditorprops.aggparam.md) | <code>{</code><br/><code> options: T[];</code><br/><code> }</code> | |
|
|
||||||
|
|
|
@ -9,12 +9,7 @@
|
||||||
```typescript
|
```typescript
|
||||||
search: {
|
search: {
|
||||||
aggs: {
|
aggs: {
|
||||||
AggConfigs: typeof AggConfigs;
|
|
||||||
aggGroupNamesMap: () => Record<"metrics" | "buckets", string>;
|
|
||||||
aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters;
|
|
||||||
CidrMask: typeof CidrMask;
|
CidrMask: typeof CidrMask;
|
||||||
convertDateRangeToString: typeof convertDateRangeToString;
|
|
||||||
convertIPRangeToString: (range: import("./search").IpRangeKey, format: (val: any) => string) => string;
|
|
||||||
dateHistogramInterval: typeof dateHistogramInterval;
|
dateHistogramInterval: typeof dateHistogramInterval;
|
||||||
intervalOptions: ({
|
intervalOptions: ({
|
||||||
display: string;
|
display: string;
|
||||||
|
|
|
@ -462,16 +462,6 @@ export const npStart = {
|
||||||
types: aggTypesRegistry.start(),
|
types: aggTypesRegistry.start(),
|
||||||
},
|
},
|
||||||
__LEGACY: {
|
__LEGACY: {
|
||||||
AggConfig: sinon.fake(),
|
|
||||||
AggType: sinon.fake(),
|
|
||||||
aggTypeFieldFilters: {
|
|
||||||
addFilter: sinon.fake(),
|
|
||||||
filter: sinon.fake(),
|
|
||||||
},
|
|
||||||
FieldParamType: sinon.fake(),
|
|
||||||
MetricAggType: sinon.fake(),
|
|
||||||
parentPipelineAggHelper: sinon.fake(),
|
|
||||||
siblingPipelineAggHelper: sinon.fake(),
|
|
||||||
esClient: {
|
esClient: {
|
||||||
search: sinon.fake(),
|
search: sinon.fake(),
|
||||||
msearch: sinon.fake(),
|
msearch: sinon.fake(),
|
||||||
|
|
|
@ -288,13 +288,8 @@ export {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
// aggs
|
// aggs
|
||||||
AggConfigs,
|
|
||||||
aggTypeFilters,
|
|
||||||
aggGroupNamesMap,
|
|
||||||
CidrMask,
|
CidrMask,
|
||||||
convertDateRangeToString,
|
intervalOptions,
|
||||||
convertIPRangeToString,
|
|
||||||
intervalOptions, // only used in Discover
|
|
||||||
isDateHistogramBucketAggConfig,
|
isDateHistogramBucketAggConfig,
|
||||||
isNumberType,
|
isNumberType,
|
||||||
isStringType,
|
isStringType,
|
||||||
|
@ -326,26 +321,22 @@ export { ParsedInterval } from '../common';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// aggs
|
// aggs
|
||||||
|
AggGroupLabels,
|
||||||
|
AggGroupName,
|
||||||
AggGroupNames,
|
AggGroupNames,
|
||||||
AggParam, // only the type is used externally, only in vis editor
|
AggParam,
|
||||||
AggParamOption, // only the type is used externally
|
AggParamOption,
|
||||||
AggParamType,
|
AggParamType,
|
||||||
AggTypeFieldFilters, // TODO convert to interface
|
|
||||||
AggTypeFilters, // TODO convert to interface
|
|
||||||
AggConfigOptions,
|
AggConfigOptions,
|
||||||
BUCKET_TYPES,
|
BUCKET_TYPES,
|
||||||
DateRangeKey, // only used in field formatter deserialization, which will live in data
|
|
||||||
IAggConfig,
|
IAggConfig,
|
||||||
IAggConfigs,
|
IAggConfigs,
|
||||||
IAggGroupNames,
|
|
||||||
IAggType,
|
IAggType,
|
||||||
IFieldParamType,
|
IFieldParamType,
|
||||||
IMetricAggType,
|
IMetricAggType,
|
||||||
IpRangeKey, // only used in field formatter deserialization, which will live in data
|
|
||||||
METRIC_TYPES,
|
METRIC_TYPES,
|
||||||
OptionedParamEditorProps, // only type is used externally
|
|
||||||
OptionedParamType,
|
OptionedParamType,
|
||||||
OptionedValueProp, // only type is used externally
|
OptionedValueProp,
|
||||||
// search
|
// search
|
||||||
ES_SEARCH_STRATEGY,
|
ES_SEARCH_STRATEGY,
|
||||||
SYNC_SEARCH_STRATEGY,
|
SYNC_SEARCH_STRATEGY,
|
||||||
|
@ -383,17 +374,12 @@ export {
|
||||||
// Search namespace
|
// Search namespace
|
||||||
export const search = {
|
export const search = {
|
||||||
aggs: {
|
aggs: {
|
||||||
AggConfigs,
|
|
||||||
aggGroupNamesMap,
|
|
||||||
aggTypeFilters,
|
|
||||||
CidrMask,
|
CidrMask,
|
||||||
convertDateRangeToString,
|
|
||||||
convertIPRangeToString,
|
|
||||||
dateHistogramInterval,
|
dateHistogramInterval,
|
||||||
intervalOptions, // only used in Discover
|
intervalOptions,
|
||||||
InvalidEsCalendarIntervalError,
|
InvalidEsCalendarIntervalError,
|
||||||
InvalidEsIntervalFormatError,
|
InvalidEsIntervalFormatError,
|
||||||
isDateHistogramBucketAggConfig,
|
isDateHistogramBucketAggConfig, // TODO: remove in build_pipeline refactor
|
||||||
isNumberType,
|
isNumberType,
|
||||||
isStringType,
|
isStringType,
|
||||||
isType,
|
isType,
|
||||||
|
|
|
@ -26,7 +26,6 @@ import { History } from 'history';
|
||||||
import { HttpSetup } from 'src/core/public';
|
import { HttpSetup } from 'src/core/public';
|
||||||
import { HttpStart } from 'src/core/public';
|
import { HttpStart } from 'src/core/public';
|
||||||
import { IconType } from '@elastic/eui';
|
import { IconType } from '@elastic/eui';
|
||||||
import { IndexPatternField as IndexPatternField_2 } from 'src/plugins/data/public';
|
|
||||||
import { InjectedIntl } from '@kbn/i18n/react';
|
import { InjectedIntl } from '@kbn/i18n/react';
|
||||||
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
|
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
|
||||||
import { IUiSettingsClient } from 'src/core/public';
|
import { IUiSettingsClient } from 'src/core/public';
|
||||||
|
@ -68,6 +67,20 @@ export type AggConfigOptions = Assign<AggConfigSerialized, {
|
||||||
type: IAggType;
|
type: IAggType;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
// Warning: (ae-missing-release-tag) "AggGroupLabels" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
|
//
|
||||||
|
// @public (undocumented)
|
||||||
|
export const AggGroupLabels: {
|
||||||
|
[AggGroupNames.Buckets]: string;
|
||||||
|
[AggGroupNames.Metrics]: string;
|
||||||
|
[AggGroupNames.None]: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Warning: (ae-missing-release-tag) "AggGroupName" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
|
//
|
||||||
|
// @public (undocumented)
|
||||||
|
export type AggGroupName = $Values<typeof AggGroupNames>;
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "AggGroupNames" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
// Warning: (ae-missing-release-tag) "AggGroupNames" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
@ -108,32 +121,6 @@ export class AggParamType<TAggConfig extends IAggConfig = IAggConfig> extends Ba
|
||||||
makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig;
|
makeAgg: (agg: TAggConfig, state?: AggConfigSerialized) => TAggConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "AggTypeFieldFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggTypeFieldFilter"
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggType"
|
|
||||||
//
|
|
||||||
// @public
|
|
||||||
export class AggTypeFieldFilters {
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "AggTypeFieldFilter" needs to be exported by the entry point index.d.ts
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggTypeFieldFilter"
|
|
||||||
addFilter(filter: AggTypeFieldFilter): void;
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "any"
|
|
||||||
filter(fields: IndexPatternField_2[], aggConfig: IAggConfig): IndexPatternField_2[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "AggTypeFilters" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggTypeFilter"
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggConfig"
|
|
||||||
//
|
|
||||||
// @public
|
|
||||||
export class AggTypeFilters {
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "AggTypeFilter" needs to be exported by the entry point index.d.ts
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggTypeFilter"
|
|
||||||
addFilter(filter: AggTypeFilter): void;
|
|
||||||
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "kibana" does not have an export "AggType"
|
|
||||||
filter(aggTypes: IAggType[], indexPattern: IndexPattern, aggConfig: IAggConfig, aggFilter: string[]): IAggType[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "DateFormat" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "DateFormat" needs to be exported by the entry point index.d.ts
|
||||||
// Warning: (ae-missing-release-tag) "baseFormattersPublic" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
// Warning: (ae-missing-release-tag) "baseFormattersPublic" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
//
|
//
|
||||||
|
@ -266,16 +253,6 @@ export interface DataPublicPluginStart {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "DateRangeKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
//
|
|
||||||
// @public (undocumented)
|
|
||||||
export interface DateRangeKey {
|
|
||||||
// (undocumented)
|
|
||||||
from: number;
|
|
||||||
// (undocumented)
|
|
||||||
to: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export enum ES_FIELD_TYPES {
|
export enum ES_FIELD_TYPES {
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -714,11 +691,6 @@ export type IAggConfig = AggConfig;
|
||||||
// @internal
|
// @internal
|
||||||
export type IAggConfigs = AggConfigs;
|
export type IAggConfigs = AggConfigs;
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "IAggGroupNames" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
//
|
|
||||||
// @public (undocumented)
|
|
||||||
export type IAggGroupNames = $Values<typeof AggGroupNames>;
|
|
||||||
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "AggType" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "AggType" needs to be exported by the entry point index.d.ts
|
||||||
// Warning: (ae-missing-release-tag) "IAggType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
// Warning: (ae-missing-release-tag) "IAggType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
//
|
//
|
||||||
|
@ -1111,18 +1083,6 @@ export type InputTimeRange = TimeRange | {
|
||||||
to: Moment;
|
to: Moment;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "IpRangeKey" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
//
|
|
||||||
// @public (undocumented)
|
|
||||||
export type IpRangeKey = {
|
|
||||||
type: 'mask';
|
|
||||||
mask: string;
|
|
||||||
} | {
|
|
||||||
type: 'range';
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "IRequestTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
// Warning: (ae-missing-release-tag) "IRequestTypesMap" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
@ -1300,16 +1260,6 @@ export enum METRIC_TYPES {
|
||||||
TOP_HITS = "top_hits"
|
TOP_HITS = "top_hits"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "OptionedParamEditorProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
|
||||||
//
|
|
||||||
// @public (undocumented)
|
|
||||||
export interface OptionedParamEditorProps<T = OptionedValueProp> {
|
|
||||||
// (undocumented)
|
|
||||||
aggParam: {
|
|
||||||
options: T[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Warning: (ae-missing-release-tag) "OptionedParamType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
// Warning: (ae-missing-release-tag) "OptionedParamType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
@ -1588,12 +1538,7 @@ export type SavedQueryTimeFilter = TimeRange & {
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const search: {
|
export const search: {
|
||||||
aggs: {
|
aggs: {
|
||||||
AggConfigs: typeof AggConfigs;
|
|
||||||
aggGroupNamesMap: () => Record<"metrics" | "buckets", string>;
|
|
||||||
aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters;
|
|
||||||
CidrMask: typeof CidrMask;
|
CidrMask: typeof CidrMask;
|
||||||
convertDateRangeToString: typeof convertDateRangeToString;
|
|
||||||
convertIPRangeToString: (range: import("./search").IpRangeKey, format: (val: any) => string) => string;
|
|
||||||
dateHistogramInterval: typeof dateHistogramInterval;
|
dateHistogramInterval: typeof dateHistogramInterval;
|
||||||
intervalOptions: ({
|
intervalOptions: ({
|
||||||
display: string;
|
display: string;
|
||||||
|
@ -1880,21 +1825,20 @@ export type TSearchStrategyProvider<T extends TStrategyTypes> = (context: ISearc
|
||||||
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:384:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:384:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:384:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:384:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:375:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:377:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "convertDateRangeToString" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:378:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:387:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:393:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:407:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:408:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:411:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/index.ts:415:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
|
||||||
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts
|
||||||
|
|
|
@ -25,15 +25,17 @@ export const AggGroupNames = Object.freeze({
|
||||||
Metrics: 'metrics' as 'metrics',
|
Metrics: 'metrics' as 'metrics',
|
||||||
None: 'none' as 'none',
|
None: 'none' as 'none',
|
||||||
});
|
});
|
||||||
export type IAggGroupNames = $Values<typeof AggGroupNames>;
|
|
||||||
|
|
||||||
type IAggGroupNamesMap = () => Record<'buckets' | 'metrics', string>;
|
export type AggGroupName = $Values<typeof AggGroupNames>;
|
||||||
|
|
||||||
export const aggGroupNamesMap: IAggGroupNamesMap = () => ({
|
export const AggGroupLabels = {
|
||||||
[AggGroupNames.Metrics]: i18n.translate('data.search.aggs.aggGroups.metricsText', {
|
|
||||||
defaultMessage: 'Metrics',
|
|
||||||
}),
|
|
||||||
[AggGroupNames.Buckets]: i18n.translate('data.search.aggs.aggGroups.bucketsText', {
|
[AggGroupNames.Buckets]: i18n.translate('data.search.aggs.aggGroups.bucketsText', {
|
||||||
defaultMessage: 'Buckets',
|
defaultMessage: 'Buckets',
|
||||||
}),
|
}),
|
||||||
});
|
[AggGroupNames.Metrics]: i18n.translate('data.search.aggs.aggGroups.metricsText', {
|
||||||
|
defaultMessage: 'Metrics',
|
||||||
|
}),
|
||||||
|
[AggGroupNames.None]: i18n.translate('data.search.aggs.aggGroups.noneText', {
|
||||||
|
defaultMessage: 'None',
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { IndexPattern } from '../../../index_patterns';
|
|
||||||
import { AggTypeFilters } from './agg_type_filters';
|
|
||||||
import { IAggConfig, IAggType } from '../types';
|
|
||||||
|
|
||||||
describe('AggTypeFilters', () => {
|
|
||||||
let registry: AggTypeFilters;
|
|
||||||
const indexPattern = ({ id: '1234', fields: [], title: 'foo' } as unknown) as IndexPattern;
|
|
||||||
const aggConfig = {} as IAggConfig;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
registry = new AggTypeFilters();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should filter nothing without registered filters', async () => {
|
|
||||||
const aggTypes = [{ name: 'count' }, { name: 'sum' }] as IAggType[];
|
|
||||||
const filtered = registry.filter(aggTypes, indexPattern, aggConfig, []);
|
|
||||||
expect(filtered).toEqual(aggTypes);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should pass all aggTypes to the registered filter', async () => {
|
|
||||||
const aggTypes = [{ name: 'count' }, { name: 'sum' }] as IAggType[];
|
|
||||||
const filter = jest.fn();
|
|
||||||
registry.addFilter(filter);
|
|
||||||
registry.filter(aggTypes, indexPattern, aggConfig, []);
|
|
||||||
expect(filter).toHaveBeenCalledWith(aggTypes[0], indexPattern, aggConfig, []);
|
|
||||||
expect(filter).toHaveBeenCalledWith(aggTypes[1], indexPattern, aggConfig, []);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow registered filters to filter out aggTypes', async () => {
|
|
||||||
const aggTypes = [{ name: 'count' }, { name: 'sum' }, { name: 'avg' }] as IAggType[];
|
|
||||||
let filtered = registry.filter(aggTypes, indexPattern, aggConfig, []);
|
|
||||||
expect(filtered).toEqual(aggTypes);
|
|
||||||
|
|
||||||
registry.addFilter(() => true);
|
|
||||||
registry.addFilter(aggType => aggType.name !== 'count');
|
|
||||||
filtered = registry.filter(aggTypes, indexPattern, aggConfig, []);
|
|
||||||
expect(filtered).toEqual([aggTypes[1], aggTypes[2]]);
|
|
||||||
|
|
||||||
registry.addFilter(aggType => aggType.name !== 'avg');
|
|
||||||
filtered = registry.filter(aggTypes, indexPattern, aggConfig, []);
|
|
||||||
expect(filtered).toEqual([aggTypes[1]]);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,74 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { IndexPattern } from '../../../index_patterns';
|
|
||||||
import { IAggConfig, IAggType } from '../types';
|
|
||||||
|
|
||||||
type AggTypeFilter = (
|
|
||||||
aggType: IAggType,
|
|
||||||
indexPattern: IndexPattern,
|
|
||||||
aggConfig: IAggConfig,
|
|
||||||
aggFilter: string[]
|
|
||||||
) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A registry to store {@link AggTypeFilter} which are used to filter down
|
|
||||||
* available aggregations for a specific visualization and {@link AggConfig}.
|
|
||||||
*/
|
|
||||||
class AggTypeFilters {
|
|
||||||
private filters = new Set<AggTypeFilter>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new {@link AggTypeFilter} with this registry.
|
|
||||||
*
|
|
||||||
* @param filter The filter to register.
|
|
||||||
*/
|
|
||||||
public addFilter(filter: AggTypeFilter): void {
|
|
||||||
this.filters.add(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the {@link AggType|aggTypes} filtered by all registered filters.
|
|
||||||
*
|
|
||||||
* @param aggTypes A list of aggTypes that will be filtered down by this registry.
|
|
||||||
* @param indexPattern The indexPattern for which this list should be filtered down.
|
|
||||||
* @param aggConfig The aggConfig for which the returning list will be used.
|
|
||||||
* @param schema
|
|
||||||
* @return A filtered list of the passed aggTypes.
|
|
||||||
*/
|
|
||||||
public filter(
|
|
||||||
aggTypes: IAggType[],
|
|
||||||
indexPattern: IndexPattern,
|
|
||||||
aggConfig: IAggConfig,
|
|
||||||
aggFilter: string[]
|
|
||||||
) {
|
|
||||||
const allFilters = Array.from(this.filters);
|
|
||||||
const allowedAggTypes = aggTypes.filter(aggType => {
|
|
||||||
const isAggTypeAllowed = allFilters.every(filter =>
|
|
||||||
filter(aggType, indexPattern, aggConfig, aggFilter)
|
|
||||||
);
|
|
||||||
return isAggTypeAllowed;
|
|
||||||
});
|
|
||||||
return allowedAggTypes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const aggTypeFilters = new AggTypeFilters();
|
|
||||||
|
|
||||||
export { aggTypeFilters, AggTypeFilters };
|
|
|
@ -1,21 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export { aggTypeFilters, AggTypeFilters } from './agg_type_filters';
|
|
||||||
export { propFilter } from './prop_filter';
|
|
|
@ -24,7 +24,6 @@ export * from './agg_type';
|
||||||
export * from './agg_types';
|
export * from './agg_types';
|
||||||
export * from './agg_types_registry';
|
export * from './agg_types_registry';
|
||||||
export * from './buckets';
|
export * from './buckets';
|
||||||
export * from './filter';
|
|
||||||
export * from './metrics';
|
export * from './metrics';
|
||||||
export * from './param_types';
|
export * from './param_types';
|
||||||
export * from './types';
|
export * from './types';
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { IAggConfig } from '../agg_config';
|
import { IAggConfig } from '../agg_config';
|
||||||
import { SavedObjectNotFound } from '../../../../../../plugins/kibana_utils/public';
|
import { SavedObjectNotFound } from '../../../../../../plugins/kibana_utils/public';
|
||||||
import { BaseParamType } from './base';
|
import { BaseParamType } from './base';
|
||||||
import { propFilter } from '../filter';
|
import { propFilter } from '../utils';
|
||||||
import { isNestedField, KBN_FIELD_TYPES } from '../../../../common';
|
import { isNestedField, KBN_FIELD_TYPES } from '../../../../common';
|
||||||
import { Field as IndexPatternField } from '../../../index_patterns';
|
import { Field as IndexPatternField } from '../../../index_patterns';
|
||||||
import { GetInternalStartServicesFn } from '../../../types';
|
import { GetInternalStartServicesFn } from '../../../types';
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { AggTypeFieldFilters } from './field_filters';
|
|
||||||
import { IAggConfig } from '../../agg_config';
|
|
||||||
import { Field as IndexPatternField } from '../../../../index_patterns';
|
|
||||||
|
|
||||||
describe('AggTypeFieldFilters', () => {
|
|
||||||
let registry: AggTypeFieldFilters;
|
|
||||||
const aggConfig = {} as IAggConfig;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
registry = new AggTypeFieldFilters();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should filter nothing without registered filters', async () => {
|
|
||||||
const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[];
|
|
||||||
const filtered = registry.filter(fields, aggConfig);
|
|
||||||
expect(filtered).toEqual(fields);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should pass all fields to the registered filter', async () => {
|
|
||||||
const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[];
|
|
||||||
const filter = jest.fn();
|
|
||||||
registry.addFilter(filter);
|
|
||||||
registry.filter(fields, aggConfig);
|
|
||||||
expect(filter).toHaveBeenCalledWith(fields[0], aggConfig);
|
|
||||||
expect(filter).toHaveBeenCalledWith(fields[1], aggConfig);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allow registered filters to filter out fields', async () => {
|
|
||||||
const fields = [{ name: 'foo' }, { name: 'bar' }] as IndexPatternField[];
|
|
||||||
let filtered = registry.filter(fields, aggConfig);
|
|
||||||
expect(filtered).toEqual(fields);
|
|
||||||
|
|
||||||
registry.addFilter(() => true);
|
|
||||||
registry.addFilter(field => field.name !== 'foo');
|
|
||||||
filtered = registry.filter(fields, aggConfig);
|
|
||||||
expect(filtered).toEqual([fields[1]]);
|
|
||||||
|
|
||||||
registry.addFilter(field => field.name !== 'bar');
|
|
||||||
filtered = registry.filter(fields, aggConfig);
|
|
||||||
expect(filtered).toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { IndexPatternField } from 'src/plugins/data/public';
|
|
||||||
import { IAggConfig } from '../../agg_config';
|
|
||||||
|
|
||||||
type AggTypeFieldFilter = (field: IndexPatternField, aggConfig: IAggConfig) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A registry to store {@link AggTypeFieldFilter} which are used to filter down
|
|
||||||
* available fields for a specific visualization and {@link AggType}.
|
|
||||||
*/
|
|
||||||
class AggTypeFieldFilters {
|
|
||||||
private filters = new Set<AggTypeFieldFilter>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new {@link AggTypeFieldFilter} with this registry.
|
|
||||||
* This will be used by the {@link #filter|filter method}.
|
|
||||||
*
|
|
||||||
* @param filter The filter to register.
|
|
||||||
*/
|
|
||||||
public addFilter(filter: AggTypeFieldFilter): void {
|
|
||||||
this.filters.add(filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the {@link any|fields} filtered by all registered filters.
|
|
||||||
*
|
|
||||||
* @param fields An array of fields that will be filtered down by this registry.
|
|
||||||
* @param aggConfig The aggConfig for which the returning list will be used.
|
|
||||||
* @return A filtered list of the passed fields.
|
|
||||||
*/
|
|
||||||
public filter(fields: IndexPatternField[], aggConfig: IAggConfig) {
|
|
||||||
const allFilters = Array.from(this.filters);
|
|
||||||
const allowedAggTypeFields = fields.filter(field => {
|
|
||||||
const isAggTypeFieldAllowed = allFilters.every(filter => filter(field, aggConfig));
|
|
||||||
return isAggTypeFieldAllowed;
|
|
||||||
});
|
|
||||||
return allowedAggTypeFields;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const aggTypeFieldFilters = new AggTypeFieldFilters();
|
|
||||||
|
|
||||||
export { aggTypeFieldFilters, AggTypeFieldFilters };
|
|
|
@ -20,7 +20,6 @@
|
||||||
export * from './agg';
|
export * from './agg';
|
||||||
export * from './base';
|
export * from './base';
|
||||||
export * from './field';
|
export * from './field';
|
||||||
export * from './filter';
|
|
||||||
export * from './json';
|
export * from './json';
|
||||||
export * from './optioned';
|
export * from './optioned';
|
||||||
export * from './string';
|
export * from './string';
|
||||||
|
|
|
@ -27,12 +27,6 @@ export interface OptionedValueProp {
|
||||||
isCompatible: (agg: IAggConfig) => boolean;
|
isCompatible: (agg: IAggConfig) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OptionedParamEditorProps<T = OptionedValueProp> {
|
|
||||||
aggParam: {
|
|
||||||
options: T[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OptionedParamType extends BaseParamType {
|
export class OptionedParamType extends BaseParamType {
|
||||||
options: OptionedValueProp[];
|
options: OptionedValueProp[];
|
||||||
|
|
||||||
|
|
|
@ -19,20 +19,13 @@
|
||||||
|
|
||||||
import { IndexPattern } from '../../index_patterns';
|
import { IndexPattern } from '../../index_patterns';
|
||||||
import {
|
import {
|
||||||
AggConfig,
|
|
||||||
AggConfigSerialized,
|
AggConfigSerialized,
|
||||||
AggConfigs,
|
AggConfigs,
|
||||||
AggParamsTerms,
|
AggParamsTerms,
|
||||||
AggType,
|
|
||||||
aggTypeFieldFilters,
|
|
||||||
AggTypesRegistrySetup,
|
AggTypesRegistrySetup,
|
||||||
AggTypesRegistryStart,
|
AggTypesRegistryStart,
|
||||||
CreateAggConfigParams,
|
CreateAggConfigParams,
|
||||||
FieldParamType,
|
|
||||||
getCalculateAutoTimeExpression,
|
getCalculateAutoTimeExpression,
|
||||||
MetricAggType,
|
|
||||||
parentPipelineAggHelper,
|
|
||||||
siblingPipelineAggHelper,
|
|
||||||
} from './';
|
} from './';
|
||||||
|
|
||||||
export { IAggConfig, AggConfigSerialized } from './agg_config';
|
export { IAggConfig, AggConfigSerialized } from './agg_config';
|
||||||
|
@ -43,7 +36,7 @@ export { IFieldParamType } from './param_types';
|
||||||
export { IMetricAggType } from './metrics/metric_agg_type';
|
export { IMetricAggType } from './metrics/metric_agg_type';
|
||||||
export { DateRangeKey } from './buckets/lib/date_range';
|
export { DateRangeKey } from './buckets/lib/date_range';
|
||||||
export { IpRangeKey } from './buckets/lib/ip_range';
|
export { IpRangeKey } from './buckets/lib/ip_range';
|
||||||
export { OptionedValueProp, OptionedParamEditorProps } from './param_types/optioned';
|
export { OptionedValueProp } from './param_types/optioned';
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export interface SearchAggsSetup {
|
export interface SearchAggsSetup {
|
||||||
|
@ -51,17 +44,6 @@ export interface SearchAggsSetup {
|
||||||
types: AggTypesRegistrySetup;
|
types: AggTypesRegistrySetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
|
||||||
export interface SearchAggsStartLegacy {
|
|
||||||
AggConfig: typeof AggConfig;
|
|
||||||
AggType: typeof AggType;
|
|
||||||
aggTypeFieldFilters: typeof aggTypeFieldFilters;
|
|
||||||
FieldParamType: typeof FieldParamType;
|
|
||||||
MetricAggType: typeof MetricAggType;
|
|
||||||
parentPipelineAggHelper: typeof parentPipelineAggHelper;
|
|
||||||
siblingPipelineAggHelper: typeof siblingPipelineAggHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export interface SearchAggsStart {
|
export interface SearchAggsStart {
|
||||||
calculateAutoTimeExpression: ReturnType<typeof getCalculateAutoTimeExpression>;
|
calculateAutoTimeExpression: ReturnType<typeof getCalculateAutoTimeExpression>;
|
||||||
|
|
|
@ -18,4 +18,5 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './calculate_auto_time_expression';
|
export * from './calculate_auto_time_expression';
|
||||||
|
export * from './prop_filter';
|
||||||
export * from './to_angular_json';
|
export * from './to_angular_json';
|
||||||
|
|
|
@ -28,7 +28,7 @@ type FilterFunc<P extends keyof T, T> = (item: T[P]) => boolean;
|
||||||
*
|
*
|
||||||
* @returns the filter function which can be registered with angular
|
* @returns the filter function which can be registered with angular
|
||||||
*/
|
*/
|
||||||
function propFilter<P extends string>(prop: P) {
|
export function propFilter<P extends string>(prop: P) {
|
||||||
/**
|
/**
|
||||||
* List filtering function which accepts an array or list of values that a property
|
* List filtering function which accepts an array or list of values that a property
|
||||||
* must contain
|
* must contain
|
||||||
|
@ -92,5 +92,3 @@ function propFilter<P extends string>(prop: P) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export { propFilter };
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { searchAggsSetupMock, searchAggsStartMock } from './aggs/mocks';
|
import { searchAggsSetupMock, searchAggsStartMock } from './aggs/mocks';
|
||||||
import { AggTypeFieldFilters } from './aggs/param_types/filter';
|
|
||||||
import { ISearchStart } from './types';
|
import { ISearchStart } from './types';
|
||||||
import { searchSourceMock, createSearchSourceMock } from './search_source/mocks';
|
import { searchSourceMock, createSearchSourceMock } from './search_source/mocks';
|
||||||
|
|
||||||
|
@ -34,13 +33,6 @@ const searchStartMock: jest.Mocked<ISearchStart> = {
|
||||||
search: jest.fn(),
|
search: jest.fn(),
|
||||||
searchSource: searchSourceMock,
|
searchSource: searchSourceMock,
|
||||||
__LEGACY: {
|
__LEGACY: {
|
||||||
AggConfig: jest.fn() as any,
|
|
||||||
AggType: jest.fn(),
|
|
||||||
aggTypeFieldFilters: new AggTypeFieldFilters(),
|
|
||||||
FieldParamType: jest.fn(),
|
|
||||||
MetricAggType: jest.fn(),
|
|
||||||
parentPipelineAggHelper: jest.fn() as any,
|
|
||||||
siblingPipelineAggHelper: jest.fn() as any,
|
|
||||||
esClient: {
|
esClient: {
|
||||||
search: jest.fn(),
|
search: jest.fn(),
|
||||||
msearch: jest.fn(),
|
msearch: jest.fn(),
|
||||||
|
|
|
@ -39,16 +39,9 @@ import { SearchInterceptor } from './search_interceptor';
|
||||||
import {
|
import {
|
||||||
getAggTypes,
|
getAggTypes,
|
||||||
getAggTypesFunctions,
|
getAggTypesFunctions,
|
||||||
AggType,
|
|
||||||
AggTypesRegistry,
|
AggTypesRegistry,
|
||||||
AggConfig,
|
|
||||||
AggConfigs,
|
AggConfigs,
|
||||||
FieldParamType,
|
|
||||||
getCalculateAutoTimeExpression,
|
getCalculateAutoTimeExpression,
|
||||||
MetricAggType,
|
|
||||||
aggTypeFieldFilters,
|
|
||||||
parentPipelineAggHelper,
|
|
||||||
siblingPipelineAggHelper,
|
|
||||||
} from './aggs';
|
} from './aggs';
|
||||||
import { FieldFormatsStart } from '../field_formats';
|
import { FieldFormatsStart } from '../field_formats';
|
||||||
import { ISearchGeneric } from './i_search';
|
import { ISearchGeneric } from './i_search';
|
||||||
|
@ -156,13 +149,6 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
|
||||||
|
|
||||||
const legacySearch = {
|
const legacySearch = {
|
||||||
esClient: this.esClient!,
|
esClient: this.esClient!,
|
||||||
AggConfig,
|
|
||||||
AggType,
|
|
||||||
aggTypeFieldFilters,
|
|
||||||
FieldParamType,
|
|
||||||
MetricAggType,
|
|
||||||
parentPipelineAggHelper,
|
|
||||||
siblingPipelineAggHelper,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchSourceDependencies: SearchSourceDependencies = {
|
const searchSourceDependencies: SearchSourceDependencies = {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CoreStart, SavedObjectReference } from 'kibana/public';
|
import { CoreStart, SavedObjectReference } from 'kibana/public';
|
||||||
import { SearchAggsSetup, SearchAggsStart, SearchAggsStartLegacy } from './aggs';
|
import { SearchAggsSetup, SearchAggsStart } from './aggs';
|
||||||
import { ISearch, ISearchGeneric } from './i_search';
|
import { ISearch, ISearchGeneric } from './i_search';
|
||||||
import { TStrategyTypes } from './strategy_types';
|
import { TStrategyTypes } from './strategy_types';
|
||||||
import { LegacyApiCaller } from './legacy/es_client';
|
import { LegacyApiCaller } from './legacy/es_client';
|
||||||
|
@ -88,5 +88,5 @@ export interface ISearchStart {
|
||||||
references: SavedObjectReference[]
|
references: SavedObjectReference[]
|
||||||
) => Promise<ISearchSource>;
|
) => Promise<ISearchSource>;
|
||||||
};
|
};
|
||||||
__LEGACY: ISearchStartLegacy & SearchAggsStartLegacy;
|
__LEGACY: ISearchStartLegacy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,19 +260,10 @@ exports[`SavedObjectsTable import should show the flyout 1`] = `
|
||||||
search={
|
search={
|
||||||
Object {
|
Object {
|
||||||
"__LEGACY": Object {
|
"__LEGACY": Object {
|
||||||
"AggConfig": [MockFunction],
|
|
||||||
"AggType": [MockFunction],
|
|
||||||
"FieldParamType": [MockFunction],
|
|
||||||
"MetricAggType": [MockFunction],
|
|
||||||
"aggTypeFieldFilters": AggTypeFieldFilters {
|
|
||||||
"filters": Set {},
|
|
||||||
},
|
|
||||||
"esClient": Object {
|
"esClient": Object {
|
||||||
"msearch": [MockFunction],
|
"msearch": [MockFunction],
|
||||||
"search": [MockFunction],
|
"search": [MockFunction],
|
||||||
},
|
},
|
||||||
"parentPipelineAggHelper": [MockFunction],
|
|
||||||
"siblingPipelineAggHelper": [MockFunction],
|
|
||||||
},
|
},
|
||||||
"aggs": Object {
|
"aggs": Object {
|
||||||
"calculateAutoTimeExpression": [Function],
|
"calculateAutoTimeExpression": [Function],
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { IAggConfig, IndexPatternField } from '../../../data/public';
|
||||||
|
|
||||||
|
type AggTypeFieldFilter = (field: IndexPatternField, aggConfig: IAggConfig) => boolean;
|
||||||
|
|
||||||
|
const filters: AggTypeFieldFilter[] = [
|
||||||
|
/**
|
||||||
|
* Check index pattern aggregation restrictions
|
||||||
|
* and limit available fields for a given aggType based on that.
|
||||||
|
*/
|
||||||
|
(field, aggConfig) => {
|
||||||
|
const indexPattern = aggConfig.getIndexPattern();
|
||||||
|
const aggRestrictions = indexPattern.getAggregationRestrictions();
|
||||||
|
|
||||||
|
if (!aggRestrictions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aggName = aggConfig.type && aggConfig.type.name;
|
||||||
|
const aggFields = aggRestrictions[aggName];
|
||||||
|
return !!aggFields && !!aggFields[field.name];
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function filterAggTypeFields(fields: IndexPatternField[], aggConfig: IAggConfig) {
|
||||||
|
const allowedAggTypeFields = fields.filter(field => {
|
||||||
|
const isAggTypeFieldAllowed = filters.every(filter => filter(field, aggConfig));
|
||||||
|
return isAggTypeFieldAllowed;
|
||||||
|
});
|
||||||
|
return allowedAggTypeFields;
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { IAggType, IAggConfig, IndexPattern, search } from '../../../data/public';
|
||||||
|
|
||||||
|
const { propFilter } = search.aggs;
|
||||||
|
const filterByName = propFilter('name');
|
||||||
|
|
||||||
|
type AggTypeFilter = (
|
||||||
|
aggType: IAggType,
|
||||||
|
indexPattern: IndexPattern,
|
||||||
|
aggConfig: IAggConfig,
|
||||||
|
aggFilter: string[]
|
||||||
|
) => boolean;
|
||||||
|
|
||||||
|
const filters: AggTypeFilter[] = [
|
||||||
|
/**
|
||||||
|
* This filter checks the defined aggFilter in the schemas of that visualization
|
||||||
|
* and limits available aggregations based on that.
|
||||||
|
*/
|
||||||
|
(aggType, indexPattern, aggConfig, aggFilter) => {
|
||||||
|
const doesSchemaAllowAggType = filterByName([aggType], aggFilter).length !== 0;
|
||||||
|
return doesSchemaAllowAggType;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Check index pattern aggregation restrictions and limit available aggTypes.
|
||||||
|
*/
|
||||||
|
(aggType, indexPattern, aggConfig, aggFilter) => {
|
||||||
|
const aggRestrictions = indexPattern.getAggregationRestrictions();
|
||||||
|
|
||||||
|
if (!aggRestrictions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aggName = aggType.name;
|
||||||
|
// Only return agg types which are specified in the agg restrictions,
|
||||||
|
// except for `count` which should always be returned.
|
||||||
|
return (
|
||||||
|
aggName === 'count' ||
|
||||||
|
(!!aggRestrictions && Object.keys(aggRestrictions).includes(aggName)) ||
|
||||||
|
false
|
||||||
|
);
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export function filterAggTypes(
|
||||||
|
aggTypes: IAggType[],
|
||||||
|
indexPattern: IndexPattern,
|
||||||
|
aggConfig: IAggConfig,
|
||||||
|
aggFilter: string[]
|
||||||
|
) {
|
||||||
|
const allowedAggTypes = aggTypes.filter(aggType => {
|
||||||
|
const isAggTypeAllowed = filters.every(filter =>
|
||||||
|
filter(aggType, indexPattern, aggConfig, aggFilter)
|
||||||
|
);
|
||||||
|
return isAggTypeAllowed;
|
||||||
|
});
|
||||||
|
return allowedAggTypes;
|
||||||
|
}
|
|
@ -17,4 +17,5 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export { aggTypeFieldFilters, AggTypeFieldFilters } from './field_filters';
|
export * from './agg_type_filters';
|
||||||
|
export * from './agg_type_field_filters';
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { VisParams } from 'src/plugins/visualizations/public';
|
import { VisParams } from 'src/plugins/visualizations/public';
|
||||||
import { IAggType, IAggConfig, IAggGroupNames } from 'src/plugins/data/public';
|
import { IAggType, IAggConfig, AggGroupName } from 'src/plugins/data/public';
|
||||||
import { Schema } from '../schemas';
|
import { Schema } from '../schemas';
|
||||||
import { EditorVisState } from './sidebar/state/reducers';
|
import { EditorVisState } from './sidebar/state/reducers';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export type ReorderAggs = (sourceAgg: IAggConfig, destinationAgg: IAggConfig) =>
|
||||||
|
|
||||||
export interface DefaultEditorCommonProps {
|
export interface DefaultEditorCommonProps {
|
||||||
formIsTouched: boolean;
|
formIsTouched: boolean;
|
||||||
groupName: IAggGroupNames;
|
groupName: AggGroupName;
|
||||||
metricAggs: IAggConfig[];
|
metricAggs: IAggConfig[];
|
||||||
state: EditorVisState;
|
state: EditorVisState;
|
||||||
setAggParamValue: <T extends keyof AggParams>(
|
setAggParamValue: <T extends keyof AggParams>(
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { AggGroupNames, search, IAggConfig, TimeRange } from '../../../data/public';
|
import { AggGroupNames, AggGroupLabels, IAggConfig, TimeRange } from '../../../data/public';
|
||||||
import { DefaultEditorAgg } from './agg';
|
import { DefaultEditorAgg } from './agg';
|
||||||
import { DefaultEditorAggAdd } from './agg_add';
|
import { DefaultEditorAggAdd } from './agg_add';
|
||||||
import { AddSchema, ReorderAggs, DefaultEditorAggCommonProps } from './agg_common_props';
|
import { AddSchema, ReorderAggs, DefaultEditorAggCommonProps } from './agg_common_props';
|
||||||
|
@ -70,7 +70,7 @@ function DefaultEditorAggGroup({
|
||||||
setValidity,
|
setValidity,
|
||||||
timeRange,
|
timeRange,
|
||||||
}: DefaultEditorAggGroupProps) {
|
}: DefaultEditorAggGroupProps) {
|
||||||
const groupNameLabel = (search.aggs.aggGroupNamesMap() as any)[groupName];
|
const groupNameLabel = AggGroupLabels[groupName];
|
||||||
// e.g. buckets can have no aggs
|
// e.g. buckets can have no aggs
|
||||||
const schemaNames = schemas.map(s => s.name);
|
const schemaNames = schemas.map(s => s.name);
|
||||||
const group: IAggConfig[] = useMemo(
|
const group: IAggConfig[] = useMemo(
|
||||||
|
|
|
@ -17,7 +17,12 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IAggConfig, AggParam, IndexPatternField } from 'src/plugins/data/public';
|
import {
|
||||||
|
IAggConfig,
|
||||||
|
AggParam,
|
||||||
|
IndexPatternField,
|
||||||
|
OptionedValueProp,
|
||||||
|
} from 'src/plugins/data/public';
|
||||||
import { ComboBoxGroupedOptions } from '../utils';
|
import { ComboBoxGroupedOptions } from '../utils';
|
||||||
import { EditorConfig } from './utils';
|
import { EditorConfig } from './utils';
|
||||||
import { Schema } from '../schemas';
|
import { Schema } from '../schemas';
|
||||||
|
@ -46,3 +51,9 @@ export interface AggParamEditorProps<T, P = AggParam> extends AggParamCommonProp
|
||||||
setValidity(isValid: boolean): void;
|
setValidity(isValid: boolean): void;
|
||||||
setTouched(): void;
|
setTouched(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface OptionedParamEditorProps<T = OptionedValueProp> {
|
||||||
|
aggParam: {
|
||||||
|
options: T[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -112,20 +112,8 @@ function DefaultEditorAggParams({
|
||||||
fieldName,
|
fieldName,
|
||||||
]);
|
]);
|
||||||
const params = useMemo(
|
const params = useMemo(
|
||||||
() =>
|
() => getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel }),
|
||||||
getAggParamsToRender(
|
[agg, editorConfig, metricAggs, state, schemas, hideCustomLabel]
|
||||||
{ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel },
|
|
||||||
services.data.search.__LEGACY.aggTypeFieldFilters
|
|
||||||
),
|
|
||||||
[
|
|
||||||
agg,
|
|
||||||
editorConfig,
|
|
||||||
metricAggs,
|
|
||||||
state,
|
|
||||||
schemas,
|
|
||||||
hideCustomLabel,
|
|
||||||
services.data.search.__LEGACY.aggTypeFieldFilters,
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
const allParams = [...params.basic, ...params.advanced];
|
const allParams = [...params.basic, ...params.advanced];
|
||||||
const [paramsState, onChangeParamsState] = useReducer(
|
const [paramsState, onChangeParamsState] = useReducer(
|
||||||
|
|
|
@ -23,7 +23,6 @@ import {
|
||||||
IAggConfig,
|
IAggConfig,
|
||||||
IAggType,
|
IAggType,
|
||||||
IndexPattern,
|
IndexPattern,
|
||||||
IndexPatternField,
|
|
||||||
} from 'src/plugins/data/public';
|
} from 'src/plugins/data/public';
|
||||||
import {
|
import {
|
||||||
getAggParamsToRender,
|
getAggParamsToRender,
|
||||||
|
@ -39,12 +38,6 @@ jest.mock('../utils', () => ({
|
||||||
groupAndSortBy: jest.fn(() => ['indexedFields']),
|
groupAndSortBy: jest.fn(() => ['indexedFields']),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockFilter: any = {
|
|
||||||
filter(fields: IndexPatternField[]): IndexPatternField[] {
|
|
||||||
return fields;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('DefaultEditorAggParams helpers', () => {
|
describe('DefaultEditorAggParams helpers', () => {
|
||||||
describe('getAggParamsToRender', () => {
|
describe('getAggParamsToRender', () => {
|
||||||
let agg: IAggConfig;
|
let agg: IAggConfig;
|
||||||
|
@ -72,20 +65,14 @@ describe('DefaultEditorAggParams helpers', () => {
|
||||||
},
|
},
|
||||||
schema: 'metric',
|
schema: 'metric',
|
||||||
} as IAggConfig;
|
} as IAggConfig;
|
||||||
const params = getAggParamsToRender(
|
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||||
{ agg, editorConfig, metricAggs, state, schemas },
|
|
||||||
mockFilter
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(params).toEqual(emptyParams);
|
expect(params).toEqual(emptyParams);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not create any param if there is no agg type', () => {
|
it('should not create any param if there is no agg type', () => {
|
||||||
agg = { schema: 'metric' } as IAggConfig;
|
agg = { schema: 'metric' } as IAggConfig;
|
||||||
const params = getAggParamsToRender(
|
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||||
{ agg, editorConfig, metricAggs, state, schemas },
|
|
||||||
mockFilter
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(params).toEqual(emptyParams);
|
expect(params).toEqual(emptyParams);
|
||||||
});
|
});
|
||||||
|
@ -101,10 +88,7 @@ describe('DefaultEditorAggParams helpers', () => {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const params = getAggParamsToRender(
|
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||||
{ agg, editorConfig, metricAggs, state, schemas },
|
|
||||||
mockFilter
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(params).toEqual(emptyParams);
|
expect(params).toEqual(emptyParams);
|
||||||
});
|
});
|
||||||
|
@ -116,10 +100,7 @@ describe('DefaultEditorAggParams helpers', () => {
|
||||||
},
|
},
|
||||||
schema: 'metric2',
|
schema: 'metric2',
|
||||||
} as any) as IAggConfig;
|
} as any) as IAggConfig;
|
||||||
const params = getAggParamsToRender(
|
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||||
{ agg, editorConfig, metricAggs, state, schemas },
|
|
||||||
mockFilter
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(params).toEqual(emptyParams);
|
expect(params).toEqual(emptyParams);
|
||||||
});
|
});
|
||||||
|
@ -152,16 +133,14 @@ describe('DefaultEditorAggParams helpers', () => {
|
||||||
{ name: '@timestamp', type: 'date' },
|
{ name: '@timestamp', type: 'date' },
|
||||||
{ name: 'geo_desc', type: 'string' },
|
{ name: 'geo_desc', type: 'string' },
|
||||||
],
|
],
|
||||||
|
getAggregationRestrictions: jest.fn(),
|
||||||
})),
|
})),
|
||||||
params: {
|
params: {
|
||||||
orderBy: 'orderBy',
|
orderBy: 'orderBy',
|
||||||
field: 'field',
|
field: 'field',
|
||||||
},
|
},
|
||||||
} as any) as IAggConfig;
|
} as any) as IAggConfig;
|
||||||
const params = getAggParamsToRender(
|
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||||
{ agg, editorConfig, metricAggs, state, schemas },
|
|
||||||
mockFilter
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(params).toEqual({
|
expect(params).toEqual({
|
||||||
basic: [
|
basic: [
|
||||||
|
@ -190,7 +169,6 @@ describe('DefaultEditorAggParams helpers', () => {
|
||||||
],
|
],
|
||||||
advanced: [],
|
advanced: [],
|
||||||
});
|
});
|
||||||
expect(agg.getIndexPattern).toBeCalledTimes(1);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
import { get, isEmpty } from 'lodash';
|
import { get, isEmpty } from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AggTypeFieldFilters,
|
|
||||||
IAggConfig,
|
IAggConfig,
|
||||||
AggParam,
|
AggParam,
|
||||||
IFieldParamType,
|
IFieldParamType,
|
||||||
|
@ -28,13 +27,13 @@ import {
|
||||||
IndexPattern,
|
IndexPattern,
|
||||||
IndexPatternField,
|
IndexPatternField,
|
||||||
} from 'src/plugins/data/public';
|
} from 'src/plugins/data/public';
|
||||||
|
import { filterAggTypes, filterAggTypeFields } from '../agg_filters';
|
||||||
import { groupAndSortBy, ComboBoxGroupedOptions } from '../utils';
|
import { groupAndSortBy, ComboBoxGroupedOptions } from '../utils';
|
||||||
import { AggTypeState, AggParamsState } from './agg_params_state';
|
import { AggTypeState, AggParamsState } from './agg_params_state';
|
||||||
import { AggParamEditorProps } from './agg_param_props';
|
import { AggParamEditorProps } from './agg_param_props';
|
||||||
import { aggParamsMap } from './agg_params_map';
|
import { aggParamsMap } from './agg_params_map';
|
||||||
import { EditorConfig } from './utils';
|
import { EditorConfig } from './utils';
|
||||||
import { Schema, getSchemaByName } from '../schemas';
|
import { Schema, getSchemaByName } from '../schemas';
|
||||||
import { search } from '../../../data/public';
|
|
||||||
import { EditorVisState } from './sidebar/state/reducers';
|
import { EditorVisState } from './sidebar/state/reducers';
|
||||||
|
|
||||||
interface ParamInstanceBase {
|
interface ParamInstanceBase {
|
||||||
|
@ -53,10 +52,14 @@ export interface ParamInstance extends ParamInstanceBase {
|
||||||
value: unknown;
|
value: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAggParamsToRender(
|
function getAggParamsToRender({
|
||||||
{ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel }: ParamInstanceBase,
|
agg,
|
||||||
aggTypeFieldFilters: AggTypeFieldFilters
|
editorConfig,
|
||||||
) {
|
metricAggs,
|
||||||
|
state,
|
||||||
|
schemas,
|
||||||
|
hideCustomLabel,
|
||||||
|
}: ParamInstanceBase) {
|
||||||
const params = {
|
const params = {
|
||||||
basic: [] as ParamInstance[],
|
basic: [] as ParamInstance[],
|
||||||
advanced: [] as ParamInstance[],
|
advanced: [] as ParamInstance[],
|
||||||
|
@ -89,7 +92,7 @@ function getAggParamsToRender(
|
||||||
availableFields = availableFields.filter(field => field.type === 'number');
|
availableFields = availableFields.filter(field => field.type === 'number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fields = aggTypeFieldFilters.filter(availableFields, agg);
|
fields = filterAggTypeFields(availableFields, agg);
|
||||||
indexedFields = groupAndSortBy(fields, 'type', 'name');
|
indexedFields = groupAndSortBy(fields, 'type', 'name');
|
||||||
|
|
||||||
if (fields && !indexedFields.length && index > 0) {
|
if (fields && !indexedFields.length && index > 0) {
|
||||||
|
@ -138,12 +141,7 @@ function getAggTypeOptions(
|
||||||
groupName: string,
|
groupName: string,
|
||||||
allowedAggs: string[]
|
allowedAggs: string[]
|
||||||
): ComboBoxGroupedOptions<IAggType> {
|
): ComboBoxGroupedOptions<IAggType> {
|
||||||
const aggTypeOptions = search.aggs.aggTypeFilters.filter(
|
const aggTypeOptions = filterAggTypes(aggTypes[groupName], indexPattern, agg, allowedAggs);
|
||||||
aggTypes[groupName],
|
|
||||||
indexPattern,
|
|
||||||
agg,
|
|
||||||
allowedAggs
|
|
||||||
);
|
|
||||||
return groupAndSortBy(aggTypeOptions as any[], 'subtype', 'title');
|
return groupAndSortBy(aggTypeOptions as any[], 'subtype', 'title');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ import React, { useEffect } from 'react';
|
||||||
import { EuiFormRow, EuiSelect } from '@elastic/eui';
|
import { EuiFormRow, EuiSelect } from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { OptionedValueProp, OptionedParamEditorProps } from 'src/plugins/data/public';
|
import { OptionedValueProp } from 'src/plugins/data/public';
|
||||||
import { AggParamEditorProps } from '../agg_param_props';
|
import { AggParamEditorProps, OptionedParamEditorProps } from '../agg_param_props';
|
||||||
|
|
||||||
function OrderParamEditor({
|
function OrderParamEditor({
|
||||||
aggParam,
|
aggParam,
|
||||||
|
|
|
@ -26,10 +26,9 @@ import {
|
||||||
IAggConfig,
|
IAggConfig,
|
||||||
AggParam,
|
AggParam,
|
||||||
OptionedValueProp,
|
OptionedValueProp,
|
||||||
OptionedParamEditorProps,
|
|
||||||
OptionedParamType,
|
OptionedParamType,
|
||||||
} from 'src/plugins/data/public';
|
} from 'src/plugins/data/public';
|
||||||
import { AggParamEditorProps } from '../agg_param_props';
|
import { AggParamEditorProps, OptionedParamEditorProps } from '../agg_param_props';
|
||||||
|
|
||||||
export interface AggregateValueProp extends OptionedValueProp {
|
export interface AggregateValueProp extends OptionedValueProp {
|
||||||
isCompatible(aggConfig: IAggConfig): boolean;
|
isCompatible(aggConfig: IAggConfig): boolean;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import React, { useEffect, useRef, useState, useCallback } from 'react';
|
||||||
import { EditorRenderProps } from 'src/plugins/visualize/public';
|
import { EditorRenderProps } from 'src/plugins/visualize/public';
|
||||||
import { PanelsContainer, Panel } from '../../kibana_react/public';
|
import { PanelsContainer, Panel } from '../../kibana_react/public';
|
||||||
|
|
||||||
import './vis_type_agg_filter';
|
|
||||||
import { DefaultEditorSideBar } from './components/sidebar';
|
import { DefaultEditorSideBar } from './components/sidebar';
|
||||||
import { DefaultEditorControllerState } from './default_editor_controller';
|
import { DefaultEditorControllerState } from './default_editor_controller';
|
||||||
import { getInitialWidth } from './editor_size';
|
import { getInitialWidth } from './editor_size';
|
||||||
|
|
|
@ -21,7 +21,7 @@ import _, { defaults } from 'lodash';
|
||||||
|
|
||||||
import { Optional } from '@kbn/utility-types';
|
import { Optional } from '@kbn/utility-types';
|
||||||
|
|
||||||
import { AggGroupNames, AggParam, IAggGroupNames } from '../../data/public';
|
import { AggGroupNames, AggParam, AggGroupName } from '../../data/public';
|
||||||
|
|
||||||
export interface ISchemas {
|
export interface ISchemas {
|
||||||
[AggGroupNames.Buckets]: Schema[];
|
[AggGroupNames.Buckets]: Schema[];
|
||||||
|
@ -32,7 +32,7 @@ export interface ISchemas {
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
aggFilter: string[];
|
aggFilter: string[];
|
||||||
editor: boolean | string;
|
editor: boolean | string;
|
||||||
group: IAggGroupNames;
|
group: AggGroupName;
|
||||||
max: number;
|
max: number;
|
||||||
min: number;
|
min: number;
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
import { IAggType, IAggConfig, IndexPattern, search } from '../../data/public';
|
|
||||||
|
|
||||||
const { aggTypeFilters, propFilter } = search.aggs;
|
|
||||||
const filterByName = propFilter('name');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This filter checks the defined aggFilter in the schemas of that visualization
|
|
||||||
* and limits available aggregations based on that.
|
|
||||||
*/
|
|
||||||
aggTypeFilters.addFilter(
|
|
||||||
(aggType: IAggType, indexPatterns: IndexPattern, aggConfig: IAggConfig, aggFilter: string[]) => {
|
|
||||||
const doesSchemaAllowAggType = filterByName([aggType], aggFilter).length !== 0;
|
|
||||||
return doesSchemaAllowAggType;
|
|
||||||
}
|
|
||||||
);
|
|
|
@ -7,8 +7,7 @@
|
||||||
"requiredPlugins": [
|
"requiredPlugins": [
|
||||||
"indexPatternManagement",
|
"indexPatternManagement",
|
||||||
"management",
|
"management",
|
||||||
"licensing",
|
"licensing"
|
||||||
"data"
|
|
||||||
],
|
],
|
||||||
"optionalPlugins": [
|
"optionalPlugins": [
|
||||||
"home",
|
"home",
|
||||||
|
|
|
@ -11,10 +11,6 @@ import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_mana
|
||||||
import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
|
import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { RollupIndexPatternListConfig } from './index_pattern_list/rollup_index_pattern_list_config';
|
import { RollupIndexPatternListConfig } from './index_pattern_list/rollup_index_pattern_list_config';
|
||||||
// @ts-ignore
|
|
||||||
import { initAggTypeFilter } from './visualize/agg_type_filter';
|
|
||||||
// @ts-ignore
|
|
||||||
import { initAggTypeFieldFilter } from './visualize/agg_type_field_filter';
|
|
||||||
import { CONFIG_ROLLUPS, UIM_APP_NAME } from '../common';
|
import { CONFIG_ROLLUPS, UIM_APP_NAME } from '../common';
|
||||||
import {
|
import {
|
||||||
FeatureCatalogueCategory,
|
FeatureCatalogueCategory,
|
||||||
|
@ -25,7 +21,6 @@ import { CRUD_APP_BASE_PATH } from './crud_app/constants';
|
||||||
import { ManagementSetup } from '../../../../src/plugins/management/public';
|
import { ManagementSetup } from '../../../../src/plugins/management/public';
|
||||||
import { IndexManagementPluginSetup } from '../../index_management/public';
|
import { IndexManagementPluginSetup } from '../../index_management/public';
|
||||||
import { IndexPatternManagementSetup } from '../../../../src/plugins/index_pattern_management/public';
|
import { IndexPatternManagementSetup } from '../../../../src/plugins/index_pattern_management/public';
|
||||||
import { DataPublicPluginStart, search } from '../../../../src/plugins/data/public';
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { setEsBaseAndXPackBase, setHttp } from './crud_app/services/index';
|
import { setEsBaseAndXPackBase, setHttp } from './crud_app/services/index';
|
||||||
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
|
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
|
||||||
|
@ -39,10 +34,6 @@ export interface RollupPluginSetupDependencies {
|
||||||
usageCollection?: UsageCollectionSetup;
|
usageCollection?: UsageCollectionSetup;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RollupPluginStartDependencies {
|
|
||||||
data: DataPublicPluginStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RollupPlugin implements Plugin {
|
export class RollupPlugin implements Plugin {
|
||||||
setup(
|
setup(
|
||||||
core: CoreSetup,
|
core: CoreSetup,
|
||||||
|
@ -108,16 +99,9 @@ export class RollupPlugin implements Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start(core: CoreStart, plugins: RollupPluginStartDependencies) {
|
start(core: CoreStart) {
|
||||||
setHttp(core.http);
|
setHttp(core.http);
|
||||||
setNotifications(core.notifications);
|
setNotifications(core.notifications);
|
||||||
setEsBaseAndXPackBase(core.docLinks.ELASTIC_WEBSITE_URL, core.docLinks.DOC_LINK_VERSION);
|
setEsBaseAndXPackBase(core.docLinks.ELASTIC_WEBSITE_URL, core.docLinks.DOC_LINK_VERSION);
|
||||||
|
|
||||||
const isRollupIndexPatternsEnabled = core.uiSettings.get(CONFIG_ROLLUPS);
|
|
||||||
|
|
||||||
if (isRollupIndexPatternsEnabled) {
|
|
||||||
initAggTypeFilter(search.aggs.aggTypeFilters);
|
|
||||||
initAggTypeFieldFilter(plugins.data.search.__LEGACY.aggTypeFieldFilters);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
||||||
* or more contributor license agreements. Licensed under the Elastic License;
|
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function initAggTypeFieldFilter(aggTypeFieldFilters) {
|
|
||||||
/**
|
|
||||||
* If rollup index pattern, check its capabilities
|
|
||||||
* and limit available fields for a given aggType based on that.
|
|
||||||
*/
|
|
||||||
aggTypeFieldFilters.addFilter((field, aggConfig) => {
|
|
||||||
const indexPattern = aggConfig.getIndexPattern();
|
|
||||||
if (!indexPattern || indexPattern.type !== 'rollup') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const aggName = aggConfig.type && aggConfig.type.name;
|
|
||||||
const aggFields =
|
|
||||||
indexPattern.typeMeta && indexPattern.typeMeta.aggs && indexPattern.typeMeta.aggs[aggName];
|
|
||||||
return aggFields && aggFields[field.name];
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
||||||
* or more contributor license agreements. Licensed under the Elastic License;
|
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
export function initAggTypeFilter(aggTypeFilters) {
|
|
||||||
/**
|
|
||||||
* If rollup index pattern, check its capabilities
|
|
||||||
* and limit available aggregations based on that.
|
|
||||||
*/
|
|
||||||
aggTypeFilters.addFilter((aggType, indexPattern) => {
|
|
||||||
if (indexPattern.type !== 'rollup') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const aggName = aggType.name;
|
|
||||||
const aggs = indexPattern.typeMeta && indexPattern.typeMeta.aggs;
|
|
||||||
|
|
||||||
// Return doc_count (which is collected by default for rollup date histogram, histogram, and terms)
|
|
||||||
// and the rest of the defined metrics from capabilities.
|
|
||||||
return aggName === 'count' || Object.keys(aggs).includes(aggName);
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue