Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
50ff9cad57
commit
35ba9653df
|
@ -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 |
|
||||
| --- | --- |
|
||||
| [AggParamType](./kibana-plugin-plugins-data-public.aggparamtype.md) | |
|
||||
| [AggTypeFieldFilters](./kibana-plugin-plugins-data-public.aggtypefieldfilters.md) | A registry to store which are used to filter down available fields for a specific visualization and . |
|
||||
| [AggTypeFilters](./kibana-plugin-plugins-data-public.aggtypefilters.md) | A registry to store which are used to filter down available aggregations for a specific visualization and . |
|
||||
| [Field](./kibana-plugin-plugins-data-public.field.md) | |
|
||||
| [FieldFormat](./kibana-plugin-plugins-data-public.fieldformat.md) | |
|
||||
| [FilterManager](./kibana-plugin-plugins-data-public.filtermanager.md) | |
|
||||
|
@ -53,7 +51,6 @@
|
|||
| [AggParamOption](./kibana-plugin-plugins-data-public.aggparamoption.md) | |
|
||||
| [DataPublicPluginSetup](./kibana-plugin-plugins-data-public.datapublicpluginsetup.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) | |
|
||||
| [FetchOptions](./kibana-plugin-plugins-data-public.fetchoptions.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. |
|
||||
| [ISyncSearchRequest](./kibana-plugin-plugins-data-public.isyncsearchrequest.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) | |
|
||||
| [Query](./kibana-plugin-plugins-data-public.query.md) | |
|
||||
| [QueryState](./kibana-plugin-plugins-data-public.querystate.md) | All query state service state |
|
||||
|
@ -95,6 +91,7 @@
|
|||
|
||||
| Variable | Description |
|
||||
| --- | --- |
|
||||
| [AggGroupLabels](./kibana-plugin-plugins-data-public.agggrouplabels.md) | |
|
||||
| [AggGroupNames](./kibana-plugin-plugins-data-public.agggroupnames.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 |
|
||||
|
@ -119,6 +116,7 @@
|
|||
| Type Alias | Description |
|
||||
| --- | --- |
|
||||
| [AggConfigOptions](./kibana-plugin-plugins-data-public.aggconfigoptions.md) | |
|
||||
| [AggGroupName](./kibana-plugin-plugins-data-public.agggroupname.md) | |
|
||||
| [AggParam](./kibana-plugin-plugins-data-public.aggparam.md) | |
|
||||
| [CustomFilter](./kibana-plugin-plugins-data-public.customfilter.md) | |
|
||||
| [EsQuerySortValue](./kibana-plugin-plugins-data-public.esquerysortvalue.md) | |
|
||||
|
@ -127,7 +125,6 @@
|
|||
| [FieldFormatsContentType](./kibana-plugin-plugins-data-public.fieldformatscontenttype.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. |
|
||||
| [IAggGroupNames](./kibana-plugin-plugins-data-public.iagggroupnames.md) | |
|
||||
| [IAggType](./kibana-plugin-plugins-data-public.iaggtype.md) | |
|
||||
| [IFieldFormat](./kibana-plugin-plugins-data-public.ifieldformat.md) | |
|
||||
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-public.ifieldformatsregistry.md) | |
|
||||
|
@ -136,7 +133,6 @@
|
|||
| [IndexPatternAggRestrictions](./kibana-plugin-plugins-data-public.indexpatternaggrestrictions.md) | |
|
||||
| [IndexPatternsContract](./kibana-plugin-plugins-data-public.indexpatternscontract.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) | |
|
||||
| [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.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
|
||||
search: {
|
||||
aggs: {
|
||||
AggConfigs: typeof AggConfigs;
|
||||
aggGroupNamesMap: () => Record<"metrics" | "buckets", string>;
|
||||
aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters;
|
||||
CidrMask: typeof CidrMask;
|
||||
convertDateRangeToString: typeof convertDateRangeToString;
|
||||
convertIPRangeToString: (range: import("./search").IpRangeKey, format: (val: any) => string) => string;
|
||||
dateHistogramInterval: typeof dateHistogramInterval;
|
||||
intervalOptions: ({
|
||||
display: string;
|
||||
|
|
|
@ -462,16 +462,6 @@ export const npStart = {
|
|||
types: aggTypesRegistry.start(),
|
||||
},
|
||||
__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: {
|
||||
search: sinon.fake(),
|
||||
msearch: sinon.fake(),
|
||||
|
|
|
@ -288,13 +288,8 @@ export {
|
|||
|
||||
import {
|
||||
// aggs
|
||||
AggConfigs,
|
||||
aggTypeFilters,
|
||||
aggGroupNamesMap,
|
||||
CidrMask,
|
||||
convertDateRangeToString,
|
||||
convertIPRangeToString,
|
||||
intervalOptions, // only used in Discover
|
||||
intervalOptions,
|
||||
isDateHistogramBucketAggConfig,
|
||||
isNumberType,
|
||||
isStringType,
|
||||
|
@ -326,26 +321,22 @@ export { ParsedInterval } from '../common';
|
|||
|
||||
export {
|
||||
// aggs
|
||||
AggGroupLabels,
|
||||
AggGroupName,
|
||||
AggGroupNames,
|
||||
AggParam, // only the type is used externally, only in vis editor
|
||||
AggParamOption, // only the type is used externally
|
||||
AggParam,
|
||||
AggParamOption,
|
||||
AggParamType,
|
||||
AggTypeFieldFilters, // TODO convert to interface
|
||||
AggTypeFilters, // TODO convert to interface
|
||||
AggConfigOptions,
|
||||
BUCKET_TYPES,
|
||||
DateRangeKey, // only used in field formatter deserialization, which will live in data
|
||||
IAggConfig,
|
||||
IAggConfigs,
|
||||
IAggGroupNames,
|
||||
IAggType,
|
||||
IFieldParamType,
|
||||
IMetricAggType,
|
||||
IpRangeKey, // only used in field formatter deserialization, which will live in data
|
||||
METRIC_TYPES,
|
||||
OptionedParamEditorProps, // only type is used externally
|
||||
OptionedParamType,
|
||||
OptionedValueProp, // only type is used externally
|
||||
OptionedValueProp,
|
||||
// search
|
||||
ES_SEARCH_STRATEGY,
|
||||
SYNC_SEARCH_STRATEGY,
|
||||
|
@ -383,17 +374,12 @@ export {
|
|||
// Search namespace
|
||||
export const search = {
|
||||
aggs: {
|
||||
AggConfigs,
|
||||
aggGroupNamesMap,
|
||||
aggTypeFilters,
|
||||
CidrMask,
|
||||
convertDateRangeToString,
|
||||
convertIPRangeToString,
|
||||
dateHistogramInterval,
|
||||
intervalOptions, // only used in Discover
|
||||
intervalOptions,
|
||||
InvalidEsCalendarIntervalError,
|
||||
InvalidEsIntervalFormatError,
|
||||
isDateHistogramBucketAggConfig,
|
||||
isDateHistogramBucketAggConfig, // TODO: remove in build_pipeline refactor
|
||||
isNumberType,
|
||||
isStringType,
|
||||
isType,
|
||||
|
|
|
@ -26,7 +26,6 @@ import { History } from 'history';
|
|||
import { HttpSetup } from 'src/core/public';
|
||||
import { HttpStart } from 'src/core/public';
|
||||
import { IconType } from '@elastic/eui';
|
||||
import { IndexPatternField as IndexPatternField_2 } from 'src/plugins/data/public';
|
||||
import { InjectedIntl } from '@kbn/i18n/react';
|
||||
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
|
||||
import { IUiSettingsClient } from 'src/core/public';
|
||||
|
@ -68,6 +67,20 @@ export type AggConfigOptions = Assign<AggConfigSerialized, {
|
|||
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)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -108,32 +121,6 @@ export class AggParamType<TAggConfig extends IAggConfig = IAggConfig> extends Ba
|
|||
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-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)
|
||||
export enum ES_FIELD_TYPES {
|
||||
// (undocumented)
|
||||
|
@ -714,11 +691,6 @@ export type IAggConfig = AggConfig;
|
|||
// @internal
|
||||
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-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;
|
||||
};
|
||||
|
||||
// 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)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -1300,16 +1260,6 @@ export enum METRIC_TYPES {
|
|||
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)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -1588,12 +1538,7 @@ export type SavedQueryTimeFilter = TimeRange & {
|
|||
// @public (undocumented)
|
||||
export const search: {
|
||||
aggs: {
|
||||
AggConfigs: typeof AggConfigs;
|
||||
aggGroupNamesMap: () => Record<"metrics" | "buckets", string>;
|
||||
aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters;
|
||||
CidrMask: typeof CidrMask;
|
||||
convertDateRangeToString: typeof convertDateRangeToString;
|
||||
convertIPRangeToString: (range: import("./search").IpRangeKey, format: (val: any) => string) => string;
|
||||
dateHistogramInterval: typeof dateHistogramInterval;
|
||||
intervalOptions: ({
|
||||
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 "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: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: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: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: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: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: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: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: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: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: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: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: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: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: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:415:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" 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: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: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: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: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: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: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: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: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: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: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: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: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:401: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: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
|
||||
|
|
|
@ -25,15 +25,17 @@ export const AggGroupNames = Object.freeze({
|
|||
Metrics: 'metrics' as 'metrics',
|
||||
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 = () => ({
|
||||
[AggGroupNames.Metrics]: i18n.translate('data.search.aggs.aggGroups.metricsText', {
|
||||
defaultMessage: 'Metrics',
|
||||
}),
|
||||
export const AggGroupLabels = {
|
||||
[AggGroupNames.Buckets]: i18n.translate('data.search.aggs.aggGroups.bucketsText', {
|
||||
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_registry';
|
||||
export * from './buckets';
|
||||
export * from './filter';
|
||||
export * from './metrics';
|
||||
export * from './param_types';
|
||||
export * from './types';
|
||||
|
|
|
@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import { IAggConfig } from '../agg_config';
|
||||
import { SavedObjectNotFound } from '../../../../../../plugins/kibana_utils/public';
|
||||
import { BaseParamType } from './base';
|
||||
import { propFilter } from '../filter';
|
||||
import { propFilter } from '../utils';
|
||||
import { isNestedField, KBN_FIELD_TYPES } from '../../../../common';
|
||||
import { Field as IndexPatternField } from '../../../index_patterns';
|
||||
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 './base';
|
||||
export * from './field';
|
||||
export * from './filter';
|
||||
export * from './json';
|
||||
export * from './optioned';
|
||||
export * from './string';
|
||||
|
|
|
@ -27,12 +27,6 @@ export interface OptionedValueProp {
|
|||
isCompatible: (agg: IAggConfig) => boolean;
|
||||
}
|
||||
|
||||
export interface OptionedParamEditorProps<T = OptionedValueProp> {
|
||||
aggParam: {
|
||||
options: T[];
|
||||
};
|
||||
}
|
||||
|
||||
export class OptionedParamType extends BaseParamType {
|
||||
options: OptionedValueProp[];
|
||||
|
||||
|
|
|
@ -19,20 +19,13 @@
|
|||
|
||||
import { IndexPattern } from '../../index_patterns';
|
||||
import {
|
||||
AggConfig,
|
||||
AggConfigSerialized,
|
||||
AggConfigs,
|
||||
AggParamsTerms,
|
||||
AggType,
|
||||
aggTypeFieldFilters,
|
||||
AggTypesRegistrySetup,
|
||||
AggTypesRegistryStart,
|
||||
CreateAggConfigParams,
|
||||
FieldParamType,
|
||||
getCalculateAutoTimeExpression,
|
||||
MetricAggType,
|
||||
parentPipelineAggHelper,
|
||||
siblingPipelineAggHelper,
|
||||
} from './';
|
||||
|
||||
export { IAggConfig, AggConfigSerialized } from './agg_config';
|
||||
|
@ -43,7 +36,7 @@ export { IFieldParamType } from './param_types';
|
|||
export { IMetricAggType } from './metrics/metric_agg_type';
|
||||
export { DateRangeKey } from './buckets/lib/date_range';
|
||||
export { IpRangeKey } from './buckets/lib/ip_range';
|
||||
export { OptionedValueProp, OptionedParamEditorProps } from './param_types/optioned';
|
||||
export { OptionedValueProp } from './param_types/optioned';
|
||||
|
||||
/** @internal */
|
||||
export interface SearchAggsSetup {
|
||||
|
@ -51,17 +44,6 @@ export interface SearchAggsSetup {
|
|||
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 */
|
||||
export interface SearchAggsStart {
|
||||
calculateAutoTimeExpression: ReturnType<typeof getCalculateAutoTimeExpression>;
|
||||
|
|
|
@ -18,4 +18,5 @@
|
|||
*/
|
||||
|
||||
export * from './calculate_auto_time_expression';
|
||||
export * from './prop_filter';
|
||||
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
|
||||
*/
|
||||
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
|
||||
* 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 { AggTypeFieldFilters } from './aggs/param_types/filter';
|
||||
import { ISearchStart } from './types';
|
||||
import { searchSourceMock, createSearchSourceMock } from './search_source/mocks';
|
||||
|
||||
|
@ -34,13 +33,6 @@ const searchStartMock: jest.Mocked<ISearchStart> = {
|
|||
search: jest.fn(),
|
||||
searchSource: searchSourceMock,
|
||||
__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: {
|
||||
search: jest.fn(),
|
||||
msearch: jest.fn(),
|
||||
|
|
|
@ -39,16 +39,9 @@ import { SearchInterceptor } from './search_interceptor';
|
|||
import {
|
||||
getAggTypes,
|
||||
getAggTypesFunctions,
|
||||
AggType,
|
||||
AggTypesRegistry,
|
||||
AggConfig,
|
||||
AggConfigs,
|
||||
FieldParamType,
|
||||
getCalculateAutoTimeExpression,
|
||||
MetricAggType,
|
||||
aggTypeFieldFilters,
|
||||
parentPipelineAggHelper,
|
||||
siblingPipelineAggHelper,
|
||||
} from './aggs';
|
||||
import { FieldFormatsStart } from '../field_formats';
|
||||
import { ISearchGeneric } from './i_search';
|
||||
|
@ -156,13 +149,6 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
|
|||
|
||||
const legacySearch = {
|
||||
esClient: this.esClient!,
|
||||
AggConfig,
|
||||
AggType,
|
||||
aggTypeFieldFilters,
|
||||
FieldParamType,
|
||||
MetricAggType,
|
||||
parentPipelineAggHelper,
|
||||
siblingPipelineAggHelper,
|
||||
};
|
||||
|
||||
const searchSourceDependencies: SearchSourceDependencies = {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { CoreStart, SavedObjectReference } from 'kibana/public';
|
||||
import { SearchAggsSetup, SearchAggsStart, SearchAggsStartLegacy } from './aggs';
|
||||
import { SearchAggsSetup, SearchAggsStart } from './aggs';
|
||||
import { ISearch, ISearchGeneric } from './i_search';
|
||||
import { TStrategyTypes } from './strategy_types';
|
||||
import { LegacyApiCaller } from './legacy/es_client';
|
||||
|
@ -88,5 +88,5 @@ export interface ISearchStart {
|
|||
references: SavedObjectReference[]
|
||||
) => Promise<ISearchSource>;
|
||||
};
|
||||
__LEGACY: ISearchStartLegacy & SearchAggsStartLegacy;
|
||||
__LEGACY: ISearchStartLegacy;
|
||||
}
|
||||
|
|
|
@ -260,19 +260,10 @@ exports[`SavedObjectsTable import should show the flyout 1`] = `
|
|||
search={
|
||||
Object {
|
||||
"__LEGACY": Object {
|
||||
"AggConfig": [MockFunction],
|
||||
"AggType": [MockFunction],
|
||||
"FieldParamType": [MockFunction],
|
||||
"MetricAggType": [MockFunction],
|
||||
"aggTypeFieldFilters": AggTypeFieldFilters {
|
||||
"filters": Set {},
|
||||
},
|
||||
"esClient": Object {
|
||||
"msearch": [MockFunction],
|
||||
"search": [MockFunction],
|
||||
},
|
||||
"parentPipelineAggHelper": [MockFunction],
|
||||
"siblingPipelineAggHelper": [MockFunction],
|
||||
},
|
||||
"aggs": Object {
|
||||
"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.
|
||||
*/
|
||||
|
||||
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 { IAggType, IAggConfig, IAggGroupNames } from 'src/plugins/data/public';
|
||||
import { IAggType, IAggConfig, AggGroupName } from 'src/plugins/data/public';
|
||||
import { Schema } from '../schemas';
|
||||
import { EditorVisState } from './sidebar/state/reducers';
|
||||
|
||||
|
@ -30,7 +30,7 @@ export type ReorderAggs = (sourceAgg: IAggConfig, destinationAgg: IAggConfig) =>
|
|||
|
||||
export interface DefaultEditorCommonProps {
|
||||
formIsTouched: boolean;
|
||||
groupName: IAggGroupNames;
|
||||
groupName: AggGroupName;
|
||||
metricAggs: IAggConfig[];
|
||||
state: EditorVisState;
|
||||
setAggParamValue: <T extends keyof AggParams>(
|
||||
|
|
|
@ -30,7 +30,7 @@ import {
|
|||
} from '@elastic/eui';
|
||||
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 { DefaultEditorAggAdd } from './agg_add';
|
||||
import { AddSchema, ReorderAggs, DefaultEditorAggCommonProps } from './agg_common_props';
|
||||
|
@ -70,7 +70,7 @@ function DefaultEditorAggGroup({
|
|||
setValidity,
|
||||
timeRange,
|
||||
}: DefaultEditorAggGroupProps) {
|
||||
const groupNameLabel = (search.aggs.aggGroupNamesMap() as any)[groupName];
|
||||
const groupNameLabel = AggGroupLabels[groupName];
|
||||
// e.g. buckets can have no aggs
|
||||
const schemaNames = schemas.map(s => s.name);
|
||||
const group: IAggConfig[] = useMemo(
|
||||
|
|
|
@ -17,7 +17,12 @@
|
|||
* 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 { EditorConfig } from './utils';
|
||||
import { Schema } from '../schemas';
|
||||
|
@ -46,3 +51,9 @@ export interface AggParamEditorProps<T, P = AggParam> extends AggParamCommonProp
|
|||
setValidity(isValid: boolean): void;
|
||||
setTouched(): void;
|
||||
}
|
||||
|
||||
export interface OptionedParamEditorProps<T = OptionedValueProp> {
|
||||
aggParam: {
|
||||
options: T[];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -112,20 +112,8 @@ function DefaultEditorAggParams({
|
|||
fieldName,
|
||||
]);
|
||||
const params = useMemo(
|
||||
() =>
|
||||
getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel },
|
||||
services.data.search.__LEGACY.aggTypeFieldFilters
|
||||
),
|
||||
[
|
||||
agg,
|
||||
editorConfig,
|
||||
metricAggs,
|
||||
state,
|
||||
schemas,
|
||||
hideCustomLabel,
|
||||
services.data.search.__LEGACY.aggTypeFieldFilters,
|
||||
]
|
||||
() => getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel }),
|
||||
[agg, editorConfig, metricAggs, state, schemas, hideCustomLabel]
|
||||
);
|
||||
const allParams = [...params.basic, ...params.advanced];
|
||||
const [paramsState, onChangeParamsState] = useReducer(
|
||||
|
|
|
@ -23,7 +23,6 @@ import {
|
|||
IAggConfig,
|
||||
IAggType,
|
||||
IndexPattern,
|
||||
IndexPatternField,
|
||||
} from 'src/plugins/data/public';
|
||||
import {
|
||||
getAggParamsToRender,
|
||||
|
@ -39,12 +38,6 @@ jest.mock('../utils', () => ({
|
|||
groupAndSortBy: jest.fn(() => ['indexedFields']),
|
||||
}));
|
||||
|
||||
const mockFilter: any = {
|
||||
filter(fields: IndexPatternField[]): IndexPatternField[] {
|
||||
return fields;
|
||||
},
|
||||
};
|
||||
|
||||
describe('DefaultEditorAggParams helpers', () => {
|
||||
describe('getAggParamsToRender', () => {
|
||||
let agg: IAggConfig;
|
||||
|
@ -72,20 +65,14 @@ describe('DefaultEditorAggParams helpers', () => {
|
|||
},
|
||||
schema: 'metric',
|
||||
} as IAggConfig;
|
||||
const params = getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas },
|
||||
mockFilter
|
||||
);
|
||||
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||
|
||||
expect(params).toEqual(emptyParams);
|
||||
});
|
||||
|
||||
it('should not create any param if there is no agg type', () => {
|
||||
agg = { schema: 'metric' } as IAggConfig;
|
||||
const params = getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas },
|
||||
mockFilter
|
||||
);
|
||||
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||
|
||||
expect(params).toEqual(emptyParams);
|
||||
});
|
||||
|
@ -101,10 +88,7 @@ describe('DefaultEditorAggParams helpers', () => {
|
|||
hidden: true,
|
||||
},
|
||||
};
|
||||
const params = getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas },
|
||||
mockFilter
|
||||
);
|
||||
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||
|
||||
expect(params).toEqual(emptyParams);
|
||||
});
|
||||
|
@ -116,10 +100,7 @@ describe('DefaultEditorAggParams helpers', () => {
|
|||
},
|
||||
schema: 'metric2',
|
||||
} as any) as IAggConfig;
|
||||
const params = getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas },
|
||||
mockFilter
|
||||
);
|
||||
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||
|
||||
expect(params).toEqual(emptyParams);
|
||||
});
|
||||
|
@ -152,16 +133,14 @@ describe('DefaultEditorAggParams helpers', () => {
|
|||
{ name: '@timestamp', type: 'date' },
|
||||
{ name: 'geo_desc', type: 'string' },
|
||||
],
|
||||
getAggregationRestrictions: jest.fn(),
|
||||
})),
|
||||
params: {
|
||||
orderBy: 'orderBy',
|
||||
field: 'field',
|
||||
},
|
||||
} as any) as IAggConfig;
|
||||
const params = getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas },
|
||||
mockFilter
|
||||
);
|
||||
const params = getAggParamsToRender({ agg, editorConfig, metricAggs, state, schemas });
|
||||
|
||||
expect(params).toEqual({
|
||||
basic: [
|
||||
|
@ -190,7 +169,6 @@ describe('DefaultEditorAggParams helpers', () => {
|
|||
],
|
||||
advanced: [],
|
||||
});
|
||||
expect(agg.getIndexPattern).toBeCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
import { get, isEmpty } from 'lodash';
|
||||
|
||||
import {
|
||||
AggTypeFieldFilters,
|
||||
IAggConfig,
|
||||
AggParam,
|
||||
IFieldParamType,
|
||||
|
@ -28,13 +27,13 @@ import {
|
|||
IndexPattern,
|
||||
IndexPatternField,
|
||||
} from 'src/plugins/data/public';
|
||||
import { filterAggTypes, filterAggTypeFields } from '../agg_filters';
|
||||
import { groupAndSortBy, ComboBoxGroupedOptions } from '../utils';
|
||||
import { AggTypeState, AggParamsState } from './agg_params_state';
|
||||
import { AggParamEditorProps } from './agg_param_props';
|
||||
import { aggParamsMap } from './agg_params_map';
|
||||
import { EditorConfig } from './utils';
|
||||
import { Schema, getSchemaByName } from '../schemas';
|
||||
import { search } from '../../../data/public';
|
||||
import { EditorVisState } from './sidebar/state/reducers';
|
||||
|
||||
interface ParamInstanceBase {
|
||||
|
@ -53,10 +52,14 @@ export interface ParamInstance extends ParamInstanceBase {
|
|||
value: unknown;
|
||||
}
|
||||
|
||||
function getAggParamsToRender(
|
||||
{ agg, editorConfig, metricAggs, state, schemas, hideCustomLabel }: ParamInstanceBase,
|
||||
aggTypeFieldFilters: AggTypeFieldFilters
|
||||
) {
|
||||
function getAggParamsToRender({
|
||||
agg,
|
||||
editorConfig,
|
||||
metricAggs,
|
||||
state,
|
||||
schemas,
|
||||
hideCustomLabel,
|
||||
}: ParamInstanceBase) {
|
||||
const params = {
|
||||
basic: [] as ParamInstance[],
|
||||
advanced: [] as ParamInstance[],
|
||||
|
@ -89,7 +92,7 @@ function getAggParamsToRender(
|
|||
availableFields = availableFields.filter(field => field.type === 'number');
|
||||
}
|
||||
}
|
||||
fields = aggTypeFieldFilters.filter(availableFields, agg);
|
||||
fields = filterAggTypeFields(availableFields, agg);
|
||||
indexedFields = groupAndSortBy(fields, 'type', 'name');
|
||||
|
||||
if (fields && !indexedFields.length && index > 0) {
|
||||
|
@ -138,12 +141,7 @@ function getAggTypeOptions(
|
|||
groupName: string,
|
||||
allowedAggs: string[]
|
||||
): ComboBoxGroupedOptions<IAggType> {
|
||||
const aggTypeOptions = search.aggs.aggTypeFilters.filter(
|
||||
aggTypes[groupName],
|
||||
indexPattern,
|
||||
agg,
|
||||
allowedAggs
|
||||
);
|
||||
const aggTypeOptions = filterAggTypes(aggTypes[groupName], indexPattern, agg, allowedAggs);
|
||||
return groupAndSortBy(aggTypeOptions as any[], 'subtype', 'title');
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ import React, { useEffect } from 'react';
|
|||
import { EuiFormRow, EuiSelect } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
import { OptionedValueProp, OptionedParamEditorProps } from 'src/plugins/data/public';
|
||||
import { AggParamEditorProps } from '../agg_param_props';
|
||||
import { OptionedValueProp } from 'src/plugins/data/public';
|
||||
import { AggParamEditorProps, OptionedParamEditorProps } from '../agg_param_props';
|
||||
|
||||
function OrderParamEditor({
|
||||
aggParam,
|
||||
|
|
|
@ -26,10 +26,9 @@ import {
|
|||
IAggConfig,
|
||||
AggParam,
|
||||
OptionedValueProp,
|
||||
OptionedParamEditorProps,
|
||||
OptionedParamType,
|
||||
} from 'src/plugins/data/public';
|
||||
import { AggParamEditorProps } from '../agg_param_props';
|
||||
import { AggParamEditorProps, OptionedParamEditorProps } from '../agg_param_props';
|
||||
|
||||
export interface AggregateValueProp extends OptionedValueProp {
|
||||
isCompatible(aggConfig: IAggConfig): boolean;
|
||||
|
|
|
@ -22,7 +22,6 @@ import React, { useEffect, useRef, useState, useCallback } from 'react';
|
|||
import { EditorRenderProps } from 'src/plugins/visualize/public';
|
||||
import { PanelsContainer, Panel } from '../../kibana_react/public';
|
||||
|
||||
import './vis_type_agg_filter';
|
||||
import { DefaultEditorSideBar } from './components/sidebar';
|
||||
import { DefaultEditorControllerState } from './default_editor_controller';
|
||||
import { getInitialWidth } from './editor_size';
|
||||
|
|
|
@ -21,7 +21,7 @@ import _, { defaults } from 'lodash';
|
|||
|
||||
import { Optional } from '@kbn/utility-types';
|
||||
|
||||
import { AggGroupNames, AggParam, IAggGroupNames } from '../../data/public';
|
||||
import { AggGroupNames, AggParam, AggGroupName } from '../../data/public';
|
||||
|
||||
export interface ISchemas {
|
||||
[AggGroupNames.Buckets]: Schema[];
|
||||
|
@ -32,7 +32,7 @@ export interface ISchemas {
|
|||
export interface Schema {
|
||||
aggFilter: string[];
|
||||
editor: boolean | string;
|
||||
group: IAggGroupNames;
|
||||
group: AggGroupName;
|
||||
max: number;
|
||||
min: number;
|
||||
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": [
|
||||
"indexPatternManagement",
|
||||
"management",
|
||||
"licensing",
|
||||
"data"
|
||||
"licensing"
|
||||
],
|
||||
"optionalPlugins": [
|
||||
"home",
|
||||
|
|
|
@ -11,10 +11,6 @@ import { rollupBadgeExtension, rollupToggleExtension } from './extend_index_mana
|
|||
import { RollupIndexPatternCreationConfig } from './index_pattern_creation/rollup_index_pattern_creation_config';
|
||||
// @ts-ignore
|
||||
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 {
|
||||
FeatureCatalogueCategory,
|
||||
|
@ -25,7 +21,6 @@ import { CRUD_APP_BASE_PATH } from './crud_app/constants';
|
|||
import { ManagementSetup } from '../../../../src/plugins/management/public';
|
||||
import { IndexManagementPluginSetup } from '../../index_management/public';
|
||||
import { IndexPatternManagementSetup } from '../../../../src/plugins/index_pattern_management/public';
|
||||
import { DataPublicPluginStart, search } from '../../../../src/plugins/data/public';
|
||||
// @ts-ignore
|
||||
import { setEsBaseAndXPackBase, setHttp } from './crud_app/services/index';
|
||||
import { setNotifications, setFatalErrors, setUiStatsReporter } from './kibana_services';
|
||||
|
@ -39,10 +34,6 @@ export interface RollupPluginSetupDependencies {
|
|||
usageCollection?: UsageCollectionSetup;
|
||||
}
|
||||
|
||||
export interface RollupPluginStartDependencies {
|
||||
data: DataPublicPluginStart;
|
||||
}
|
||||
|
||||
export class RollupPlugin implements Plugin {
|
||||
setup(
|
||||
core: CoreSetup,
|
||||
|
@ -108,16 +99,9 @@ export class RollupPlugin implements Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
start(core: CoreStart, plugins: RollupPluginStartDependencies) {
|
||||
start(core: CoreStart) {
|
||||
setHttp(core.http);
|
||||
setNotifications(core.notifications);
|
||||
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…
Reference in a new issue