Dashboard save interaction evt (#43304)

This commit is contained in:
William Assis 2022-01-17 10:07:36 -03:00 committed by GitHub
parent 4b4afc7b2c
commit f6b70e0a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -138,10 +138,8 @@ export function DashboardSettings({ dashboard, editview }: Props) {
<aside className="dashboard-settings__aside">
{pages.map((page) => (
<Link
to={(loc) => {
reportInteraction(`Dashboard settings navigation to ${page.id}`);
return locationUtil.updateSearchParams(loc.search, `editview=${page.id}`);
}}
onClick={() => reportInteraction(`Dashboard settings navigation to ${page.id}`)}
to={(loc) => locationUtil.updateSearchParams(loc.search, `editview=${page.id}`)}
className={cx('dashboard-settings__nav-item', { active: page.id === editview })}
key={page.id}
>

View File

@ -5,7 +5,7 @@ import { SaveDashboardOptions } from './types';
import appEvents from 'app/core/app_events';
import { DashboardModel } from 'app/features/dashboard/state';
import { saveDashboard as saveDashboardApiCall } from 'app/features/manage-dashboards/state/actions';
import { locationService } from '@grafana/runtime';
import { locationService, reportInteraction } from '@grafana/runtime';
import { DashboardSavedEvent } from 'app/types/events';
const saveDashboard = (saveModel: any, options: SaveDashboardOptions, dashboard: DashboardModel) => {
@ -32,6 +32,10 @@ export const useDashboardSave = (dashboard: DashboardModel) => {
// important that these happen before location redirect below
appEvents.publish(new DashboardSavedEvent());
appEvents.emit(AppEvents.alertSuccess, ['Dashboard saved']);
reportInteraction(`Dashboard ${dashboard.id ? 'saved' : 'created'}`, {
name: dashboard.title,
url: state.value.url,
});
const currentPath = locationService.getLocation().pathname;
const newUrl = locationUtil.stripBaseFromUrl(state.value.url);