mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Maps] Add UI counters for triggers that open a new map (#136991)
* Add UI counters for triggers that open a new map
This commit is contained in:
parent
c4ed8ae919
commit
33ff3538b8
4 changed files with 15 additions and 2 deletions
|
@ -15,6 +15,7 @@ import {
|
|||
import type { DataViewField, DataView } from '@kbn/data-views-plugin/public';
|
||||
import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public';
|
||||
import { getUiActions } from '../../../../../kibana_services';
|
||||
import { PLUGIN_ID } from '../../../../../../common';
|
||||
|
||||
export function getTriggerConstant(type: string) {
|
||||
return type === KBN_FIELD_TYPES.GEO_POINT || type === KBN_FIELD_TYPES.GEO_SHAPE
|
||||
|
@ -53,6 +54,7 @@ export function triggerVisualizeActions(
|
|||
dataViewSpec: dataView.toSpec(false),
|
||||
fieldName: field.name,
|
||||
contextualFields,
|
||||
originatingApp: PLUGIN_ID,
|
||||
};
|
||||
getUiActions().getTrigger(trigger).exec(triggerOptions);
|
||||
}
|
||||
|
|
|
@ -211,6 +211,13 @@ export async function mountApp(
|
|||
? historyLocationState.payload
|
||||
: undefined;
|
||||
|
||||
if (historyLocationState && historyLocationState.type === ACTION_VISUALIZE_LENS_FIELD) {
|
||||
// remove originatingApp from context when visualizing a field in Lens
|
||||
// so Lens does not try to return to the original app on Save
|
||||
// see https://github.com/elastic/kibana/issues/128695
|
||||
delete initialContext?.originatingApp;
|
||||
}
|
||||
|
||||
if (embeddableEditorIncomingState?.searchSessionId) {
|
||||
data.search.session.continue(embeddableEditorIncomingState.searchSessionId);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import React, { MouseEvent } from 'react';
|
||||
import { SavedObjectReference } from '@kbn/core/types';
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiLink } from '@elastic/eui';
|
||||
import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/basic_table';
|
||||
|
@ -24,6 +25,7 @@ import {
|
|||
getUiSettings,
|
||||
getTheme,
|
||||
getApplication,
|
||||
getUsageCollection,
|
||||
} from '../../kibana_services';
|
||||
import { getAppTitle } from '../../../common/i18n_getters';
|
||||
import { MapSavedObjectAttributes } from '../../../common/map_saved_object_type';
|
||||
|
@ -77,6 +79,7 @@ if (savedObjectsTagging) {
|
|||
|
||||
function navigateToNewMap() {
|
||||
const navigateToApp = getNavigateToApp();
|
||||
getUsageCollection()?.reportUiCounter(APP_ID, METRIC_TYPE.CLICK, 'create_maps_vis_editor');
|
||||
navigateToApp(APP_ID, {
|
||||
path: MAP_PATH,
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ import uuid from 'uuid/v4';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type { Query } from '@kbn/es-query';
|
||||
import type { SerializableRecord } from '@kbn/utility-types';
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import {
|
||||
createAction,
|
||||
ACTION_VISUALIZE_GEO_FIELD,
|
||||
|
@ -50,8 +51,8 @@ export const visualizeGeoFieldAction = createAction<VisualizeFieldContext>({
|
|||
const usageCollection = getUsageCollection();
|
||||
usageCollection?.reportUiCounter(
|
||||
APP_ID,
|
||||
'visualize_geo_field',
|
||||
context.originatingApp ? context.originatingApp : 'unknownOriginatingApp'
|
||||
METRIC_TYPE.CLICK,
|
||||
`create_maps_vis_${context.originatingApp ? context.originatingApp : 'unknownOriginatingApp'}`
|
||||
);
|
||||
|
||||
getCore().application.navigateToApp(app, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue