Plugins: Add rudderstack events to plugins update (#92989)
This commit is contained in:
+5
-1
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
||||
import { useLocation } from 'react-router-dom-v5-compat';
|
||||
|
||||
import { AppEvents } from '@grafana/data';
|
||||
import { config, locationService } from '@grafana/runtime';
|
||||
import { config, locationService, reportInteraction } from '@grafana/runtime';
|
||||
import { Button, ConfirmModal, Stack } from '@grafana/ui';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import configCore from 'app/core/config';
|
||||
@@ -21,6 +21,8 @@ import {
|
||||
import { trackPluginInstalled, trackPluginUninstalled } from '../../tracking';
|
||||
import { CatalogPlugin, PluginStatus, PluginTabIds, Version } from '../../types';
|
||||
|
||||
const PLUGIN_UPDATE_INTERACTION_EVENT_NAME = 'plugin_update_clicked';
|
||||
|
||||
type InstallControlsButtonProps = {
|
||||
plugin: CatalogPlugin;
|
||||
pluginStatus: PluginStatus;
|
||||
@@ -107,6 +109,8 @@ export function InstallControlsButton({
|
||||
};
|
||||
|
||||
const onUpdate = async () => {
|
||||
reportInteraction(PLUGIN_UPDATE_INTERACTION_EVENT_NAME);
|
||||
|
||||
await install(plugin.id, latestCompatibleVersion?.version, true);
|
||||
if (!errorInstalling) {
|
||||
appEvents.emit(AppEvents.alertSuccess, [`Updated ${plugin.name}`]);
|
||||
|
||||
@@ -2,13 +2,15 @@ import { css } from '@emotion/css';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { config, reportInteraction } from '@grafana/runtime';
|
||||
import { Checkbox, ConfirmModal, EmptyState, Icon, Spinner, Tooltip, useStyles2 } from '@grafana/ui';
|
||||
import { t, Trans } from 'app/core/internationalization';
|
||||
|
||||
import { useInstall, useInstallStatus } from '../state/hooks';
|
||||
import { CatalogPlugin } from '../types';
|
||||
|
||||
const PLUGINS_UPDATE_ALL_INTERACTION_EVENT_NAME = 'plugins_update_all_clicked';
|
||||
|
||||
type UpdateError = {
|
||||
id: string;
|
||||
message: string;
|
||||
@@ -221,6 +223,8 @@ export const UpdateAllModal = ({ isOpen, onDismiss, isLoading, plugins }: Props)
|
||||
|
||||
const onConfirm = async () => {
|
||||
if (!inProgress) {
|
||||
reportInteraction(PLUGINS_UPDATE_ALL_INTERACTION_EVENT_NAME);
|
||||
|
||||
setInProgress(true);
|
||||
|
||||
// in cloud the requests need to be sync
|
||||
|
||||
Reference in New Issue
Block a user