Skip to content

Commit a1b0f06

Browse files
streamichDosant
andcommitted
"Explore underlying data" in-chart action (#69494)
* refactor: πŸ’‘ rename folder to "explore_data" * style: πŸ’„ check for "share" plugin in more semantic way "explore data" actions use Discover URL generator, which is registered in "share" plugin, which is optional plugin, so we check for its existance, because otherwise URL generator is not available. * refactor: πŸ’‘ move KibanaURL to a separate file * feat: 🎸 add "Explore underlying data" in-chart action * fix: πŸ› fix imports after refactor * feat: 🎸 add start.filtersFromContext to embeddable plugin * feat: 🎸 add type checkers to data plugin * feat: 🎸 better handle empty filters in Discover URL generator * feat: 🎸 implement .getUrl() method of explore data in-chart act * feat: 🎸 add embeddable.filtersAndTimeRangeFromContext() * feat: 🎸 improve getUrl() method of explore data action * test: πŸ’ update test mock * fix possible stale hashHistory.location in discover * style: πŸ’„ ensureHashHistoryLocation -> syncHistoryLocations * docs: ✏️ update autogenerated docs * test: πŸ’ add in-chart "Explore underlying data" unit tests * test: πŸ’ add in-chart "Explore underlying data" functional tests * test: πŸ’ clean-up custom time range after panel action tests * chore: πŸ€– fix embeddable plugin mocks * chore: πŸ€– fix another mock * test: πŸ’ add support for new action to pie chart service Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
1 parent e365aad commit a1b0f06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+997
-197
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [isFilter](./kibana-plugin-plugins-data-public.isfilter.md)
4+
5+
## isFilter variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
isFilter: (x: unknown) => x is Filter
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [isFilters](./kibana-plugin-plugins-data-public.isfilters.md)
4+
5+
## isFilters variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
isFilters: (x: unknown) => x is Filter[]
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [isQuery](./kibana-plugin-plugins-data-public.isquery.md)
4+
5+
## isQuery variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
isQuery: (x: unknown) => x is Query
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md)
4+
5+
## isTimeRange variable
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
isTimeRange: (x: unknown) => x is TimeRange
11+
```

β€Ždocs/development/plugins/data/public/kibana-plugin-plugins-data-public.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@
110110
| [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) | Get the esTypes known by all kbnFieldTypes {<!-- -->Array<string>} |
111111
| [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) | |
112112
| [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | |
113+
| [isFilter](./kibana-plugin-plugins-data-public.isfilter.md) | |
114+
| [isFilters](./kibana-plugin-plugins-data-public.isfilters.md) | |
115+
| [isQuery](./kibana-plugin-plugins-data-public.isquery.md) | |
116+
| [isTimeRange](./kibana-plugin-plugins-data-public.istimerange.md) | |
113117
| [parseSearchSourceJSON](./kibana-plugin-plugins-data-public.parsesearchsourcejson.md) | |
114118
| [QueryStringInput](./kibana-plugin-plugins-data-public.querystringinput.md) | |
115119
| [search](./kibana-plugin-plugins-data-public.search.md) | |

β€Žsrc/plugins/data/common/es_query/filters/meta_filter.tsβ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,13 @@ export const pinFilter = (filter: Filter) =>
107107

108108
export const unpinFilter = (filter: Filter) =>
109109
!isFilterPinned(filter) ? filter : toggleFilterPinned(filter);
110+
111+
export const isFilter = (x: unknown): x is Filter =>
112+
!!x &&
113+
typeof x === 'object' &&
114+
!!(x as Filter).meta &&
115+
typeof (x as Filter).meta === 'object' &&
116+
typeof (x as Filter).meta.disabled === 'boolean';
117+
118+
export const isFilters = (x: unknown): x is Filter[] =>
119+
Array.isArray(x) && !x.find((y) => !isFilter(y));

β€Žsrc/plugins/data/common/index.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
export * from './constants';
2121
export * from './es_query';
2222
export * from './field_formats';
23+
export * from './field_mapping';
2324
export * from './index_patterns';
2425
export * from './kbn_field_types';
2526
export * from './query';
2627
export * from './search';
2728
export * from './search/aggs';
29+
export * from './timefilter';
2830
export * from './types';
2931
export * from './utils';
30-
export * from './field_mapping';

β€Žsrc/plugins/data/common/query/index.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919

2020
export * from './filter_manager';
2121
export * from './types';
22+
export * from './is_query';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Query } from './types';
21+
22+
export const isQuery = (x: unknown): x is Query =>
23+
!!x &&
24+
typeof x === 'object' &&
25+
typeof (x as Query).language === 'string' &&
26+
(typeof (x as Query).query === 'string' ||
27+
(typeof (x as Query).query === 'object' && !!(x as Query).query));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export { isTimeRange } from './is_time_range';

0 commit comments

Comments
Β (0)