mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Variables: Adds user interaction reports (#42802)
* Variables: Adds user interaction reports * Chore: updates after PR feedback
This commit is contained in:
parent
7a99b067ef
commit
bb17193ce5
@ -6,7 +6,7 @@ import config from 'app/core/config';
|
|||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher';
|
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher';
|
||||||
import { DashboardModel } from '../../state/DashboardModel';
|
import { DashboardModel } from '../../state/DashboardModel';
|
||||||
import { SaveDashboardButton, SaveDashboardAsButton } from '../SaveDashboard/SaveDashboardButton';
|
import { SaveDashboardAsButton, SaveDashboardButton } from '../SaveDashboard/SaveDashboardButton';
|
||||||
import { VariableEditorContainer } from '../../../variables/editor/VariableEditorContainer';
|
import { VariableEditorContainer } from '../../../variables/editor/VariableEditorContainer';
|
||||||
import { DashboardPermissions } from '../DashboardPermissions/DashboardPermissions';
|
import { DashboardPermissions } from '../DashboardPermissions/DashboardPermissions';
|
||||||
import { GeneralSettings } from './GeneralSettings';
|
import { GeneralSettings } from './GeneralSettings';
|
||||||
@ -15,7 +15,7 @@ import { LinksSettings } from './LinksSettings';
|
|||||||
import { VersionsSettings } from './VersionsSettings';
|
import { VersionsSettings } from './VersionsSettings';
|
||||||
import { JsonEditorSettings } from './JsonEditorSettings';
|
import { JsonEditorSettings } from './JsonEditorSettings';
|
||||||
import { GrafanaTheme2, locationUtil } from '@grafana/data';
|
import { GrafanaTheme2, locationUtil } from '@grafana/data';
|
||||||
import { locationService } from '@grafana/runtime';
|
import { locationService, reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
dashboard: DashboardModel;
|
dashboard: DashboardModel;
|
||||||
@ -138,7 +138,10 @@ export function DashboardSettings({ dashboard, editview }: Props) {
|
|||||||
<aside className="dashboard-settings__aside">
|
<aside className="dashboard-settings__aside">
|
||||||
{pages.map((page) => (
|
{pages.map((page) => (
|
||||||
<Link
|
<Link
|
||||||
to={(loc) => locationUtil.updateSearchParams(loc.search, `editview=${page.id}`)}
|
to={(loc) => {
|
||||||
|
reportInteraction(`Dashboard settings navigation to ${page.id}`);
|
||||||
|
return locationUtil.updateSearchParams(loc.search, `editview=${page.id}`);
|
||||||
|
}}
|
||||||
className={cx('dashboard-settings__nav-item', { active: page.id === editview })}
|
className={cx('dashboard-settings__nav-item', { active: page.id === editview })}
|
||||||
key={page.id}
|
key={page.id}
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { ReactElement } from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';
|
import { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
import { VariableModel } from '../types';
|
import { VariableModel } from '../types';
|
||||||
import { VariableIdentifier } from '../state/types';
|
import { VariableIdentifier } from '../state/types';
|
||||||
@ -33,6 +34,7 @@ export function VariableEditorList({
|
|||||||
if (!result.destination || !result.source) {
|
if (!result.destination || !result.source) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
reportInteraction('Variable drag and drop');
|
||||||
const identifier = JSON.parse(result.draggableId);
|
const identifier = JSON.parse(result.draggableId);
|
||||||
onChangeOrder(identifier, result.source.index, result.destination.index);
|
onChangeOrder(identifier, result.source.index, result.destination.index);
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@ import { Draggable } from 'react-beautiful-dnd';
|
|||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Icon, IconButton, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Icon, IconButton, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
import { getVariableUsages, UsagesToNetwork, VariableUsageTree } from '../inspect/utils';
|
import { getVariableUsages, UsagesToNetwork, VariableUsageTree } from '../inspect/utils';
|
||||||
import { hasOptions, isAdHoc, isQuery } from '../guard';
|
import { hasOptions, isAdHoc, isQuery } from '../guard';
|
||||||
@ -84,6 +85,7 @@ export function VariableEditorListRow({
|
|||||||
<IconButton
|
<IconButton
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
reportInteraction('Duplicate variable');
|
||||||
propsOnDuplicate(identifier);
|
propsOnDuplicate(identifier);
|
||||||
}}
|
}}
|
||||||
name="copy"
|
name="copy"
|
||||||
@ -96,6 +98,7 @@ export function VariableEditorListRow({
|
|||||||
<IconButton
|
<IconButton
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
reportInteraction('Delete variable');
|
||||||
propsOnDelete(identifier);
|
propsOnDelete(identifier);
|
||||||
}}
|
}}
|
||||||
name="trash-alt"
|
name="trash-alt"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { FC, useMemo } from 'react';
|
import React, { FC, useMemo } from 'react';
|
||||||
import { IconButton } from '@grafana/ui';
|
import { IconButton } from '@grafana/ui';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
import { UsagesToNetwork } from './utils';
|
import { UsagesToNetwork } from './utils';
|
||||||
import { NetworkGraphModal } from './NetworkGraphModal';
|
import { NetworkGraphModal } from './NetworkGraphModal';
|
||||||
@ -26,7 +27,16 @@ export const VariableUsagesButton: FC<Props> = ({ id, usages, isAdhoc }) => {
|
|||||||
return (
|
return (
|
||||||
<NetworkGraphModal show={false} title={`Showing usages for: $${id}`} nodes={nodes} edges={network.edges}>
|
<NetworkGraphModal show={false} title={`Showing usages for: $${id}`} nodes={nodes} edges={network.edges}>
|
||||||
{({ showModal }) => {
|
{({ showModal }) => {
|
||||||
return <IconButton onClick={() => showModal()} name="code-branch" title="Show usages" />;
|
return (
|
||||||
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
reportInteraction('Show variable usages');
|
||||||
|
showModal();
|
||||||
|
}}
|
||||||
|
name="code-branch"
|
||||||
|
title="Show usages"
|
||||||
|
/>
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
</NetworkGraphModal>
|
</NetworkGraphModal>
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import React, { FC, useMemo } from 'react';
|
import React, { FC, useMemo } from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
// @ts-ignore
|
|
||||||
import { Button } from '@grafana/ui';
|
import { Button } from '@grafana/ui';
|
||||||
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
import { createDependencyEdges, createDependencyNodes, filterNodesWithDependencies } from './utils';
|
import { createDependencyEdges, createDependencyNodes, filterNodesWithDependencies } from './utils';
|
||||||
import { store } from '../../../store/store';
|
import { store } from '../../../store/store';
|
||||||
import { VariableModel } from '../types';
|
import { VariableModel } from '../types';
|
||||||
@ -34,7 +35,14 @@ export const UnProvidedVariablesDependenciesButton: FC<Props> = ({ variables })
|
|||||||
>
|
>
|
||||||
{({ showModal }) => {
|
{({ showModal }) => {
|
||||||
return (
|
return (
|
||||||
<Button onClick={() => showModal()} icon="channel-add" variant="secondary">
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
reportInteraction('Show variable dependencies');
|
||||||
|
showModal();
|
||||||
|
}}
|
||||||
|
icon="channel-add"
|
||||||
|
variant="secondary"
|
||||||
|
>
|
||||||
Show dependencies
|
Show dependencies
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user