mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[8.14] [data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps (#181903) (#182037)
# Backport This will backport the following commits from `main` to `8.14`: - [[data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps (#181903)](https://github.com/elastic/kibana/pull/181903) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nathan Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2024-04-29T20:52:24Z","message":"[data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps (#181903)\n\nFixes https://github.com/elastic/kibana/issues/181900\r\n\r\nPR resolves issue by\r\n1. strongly typing `triggerOptions` to `VisualizeFieldContext` so future\r\ntype changes to `VisualizeFieldContext` will be picked up by this file\r\n2. Add more protection to `visualizeGeoFieldAction.isCompatible` method\r\nto prevent executing invalid context.\r\n\r\nOut of scope for PR - updating \"field statistics\" to not show \"Explore\r\nin maps\" when action compatibility check fails.\r\n`visualizeGeoFieldAction.isCompatible` is async while `getActions` is\r\nsync.\r\n\r\n### test\r\n1. install sample web logs\r\n4. Open discover\r\n5. Change data table view to field statistics by clicking \"Field\r\nstatistics\" toggle.\r\n6. Click \"Explore in maps\" action button for field `geo.coordinates`.\r\n7. Verify map is opened showing geo.coordinates\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"957ff083c4e0c738d8d0b2ae81ae468c3a1abb7b","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","Feature:Maps","v8.14.0","v8.15.0"],"title":"[data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps","number":181903,"url":"https://github.com/elastic/kibana/pull/181903","mergeCommit":{"message":"[data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps (#181903)\n\nFixes https://github.com/elastic/kibana/issues/181900\r\n\r\nPR resolves issue by\r\n1. strongly typing `triggerOptions` to `VisualizeFieldContext` so future\r\ntype changes to `VisualizeFieldContext` will be picked up by this file\r\n2. Add more protection to `visualizeGeoFieldAction.isCompatible` method\r\nto prevent executing invalid context.\r\n\r\nOut of scope for PR - updating \"field statistics\" to not show \"Explore\r\nin maps\" when action compatibility check fails.\r\n`visualizeGeoFieldAction.isCompatible` is async while `getActions` is\r\nsync.\r\n\r\n### test\r\n1. install sample web logs\r\n4. Open discover\r\n5. Change data table view to field statistics by clicking \"Field\r\nstatistics\" toggle.\r\n6. Click \"Explore in maps\" action button for field `geo.coordinates`.\r\n7. Verify map is opened showing geo.coordinates\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"957ff083c4e0c738d8d0b2ae81ae468c3a1abb7b"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/181903","number":181903,"mergeCommit":{"message":"[data visualizer] fix clicking field statistics 'Explore in maps' button does not take users to maps (#181903)\n\nFixes https://github.com/elastic/kibana/issues/181900\r\n\r\nPR resolves issue by\r\n1. strongly typing `triggerOptions` to `VisualizeFieldContext` so future\r\ntype changes to `VisualizeFieldContext` will be picked up by this file\r\n2. Add more protection to `visualizeGeoFieldAction.isCompatible` method\r\nto prevent executing invalid context.\r\n\r\nOut of scope for PR - updating \"field statistics\" to not show \"Explore\r\nin maps\" when action compatibility check fails.\r\n`visualizeGeoFieldAction.isCompatible` is async while `getActions` is\r\nsync.\r\n\r\n### test\r\n1. install sample web logs\r\n4. Open discover\r\n5. Change data table view to field statistics by clicking \"Field\r\nstatistics\" toggle.\r\n6. Click \"Explore in maps\" action button for field `geo.coordinates`.\r\n7. Verify map is opened showing geo.coordinates\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>","sha":"957ff083c4e0c738d8d0b2ae81ae468c3a1abb7b"}}]}] BACKPORT--> Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
This commit is contained in:
parent
b12a0cbfc0
commit
1406d96fb5
2 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n';
|
|||
import type { Action } from '@elastic/eui/src/components/basic_table/action_types';
|
||||
import type { MutableRefObject } from 'react';
|
||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public';
|
||||
import { VISUALIZE_GEO_FIELD_TRIGGER } from '@kbn/ui-actions-plugin/public';
|
||||
import type { Refresh } from '@kbn/ml-date-picker';
|
||||
import { mlTimefilterRefresh$ } from '@kbn/ml-date-picker';
|
||||
|
@ -85,8 +86,8 @@ export function getActions(
|
|||
},
|
||||
onClick: async (item: FieldVisConfig) => {
|
||||
if (services?.uiActions && dataView) {
|
||||
const triggerOptions = {
|
||||
indexPatternId: dataView.id,
|
||||
const triggerOptions: VisualizeFieldContext = {
|
||||
dataViewSpec: dataView.toSpec(),
|
||||
fieldName: item.fieldName,
|
||||
contextualFields: [],
|
||||
originatingApp: APP_ID,
|
||||
|
|
|
@ -24,7 +24,9 @@ export const visualizeGeoFieldAction = createAction<VisualizeFieldContext>({
|
|||
i18n.translate('xpack.maps.discover.visualizeFieldLabel', {
|
||||
defaultMessage: 'Visualize in Maps',
|
||||
}),
|
||||
isCompatible: async () => !!getVisualizeCapabilities().show,
|
||||
isCompatible: async (context) => {
|
||||
return Boolean(!!getVisualizeCapabilities().show && context.dataViewSpec && context.fieldName);
|
||||
},
|
||||
getHref: async (context) => {
|
||||
const { getMapsLink } = await import('./get_maps_link');
|
||||
const { app, path } = await getMapsLink(context);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue