mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard save interaction evt (#43304)
This commit is contained in:
parent
4b4afc7b2c
commit
f6b70e0a69
@ -138,10 +138,8 @@ 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) => {
|
onClick={() => reportInteraction(`Dashboard settings navigation to ${page.id}`)}
|
||||||
reportInteraction(`Dashboard settings navigation to ${page.id}`);
|
to={(loc) => locationUtil.updateSearchParams(loc.search, `editview=${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}
|
||||||
>
|
>
|
||||||
|
@ -5,7 +5,7 @@ import { SaveDashboardOptions } from './types';
|
|||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { DashboardModel } from 'app/features/dashboard/state';
|
import { DashboardModel } from 'app/features/dashboard/state';
|
||||||
import { saveDashboard as saveDashboardApiCall } from 'app/features/manage-dashboards/state/actions';
|
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';
|
import { DashboardSavedEvent } from 'app/types/events';
|
||||||
|
|
||||||
const saveDashboard = (saveModel: any, options: SaveDashboardOptions, dashboard: DashboardModel) => {
|
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
|
// important that these happen before location redirect below
|
||||||
appEvents.publish(new DashboardSavedEvent());
|
appEvents.publish(new DashboardSavedEvent());
|
||||||
appEvents.emit(AppEvents.alertSuccess, ['Dashboard saved']);
|
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 currentPath = locationService.getLocation().pathname;
|
||||||
const newUrl = locationUtil.stripBaseFromUrl(state.value.url);
|
const newUrl = locationUtil.stripBaseFromUrl(state.value.url);
|
||||||
|
Loading…
Reference in New Issue
Block a user