dashboardsAnalyticsEvents.tsx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. // The add/edit widget modal is currently being ported to the widget builder full-page and
  2. // this will be removed once that is done.
  3. type DashboardsEventParametersAddWidgetModal = {
  4. 'dashboards_views.add_widget_modal.change': {
  5. field: string;
  6. from: string;
  7. value: string;
  8. widget_type: string;
  9. };
  10. 'dashboards_views.add_widget_modal.confirm': {
  11. data_set: string;
  12. };
  13. 'dashboards_views.add_widget_modal.opened': {};
  14. 'dashboards_views.add_widget_modal.save': {
  15. data_set: string;
  16. };
  17. 'dashboards_views.edit_widget_modal.confirm': {};
  18. 'dashboards_views.edit_widget_modal.opened': {};
  19. };
  20. const dashboardsEventMapAddWidgetModal: Record<
  21. keyof DashboardsEventParametersAddWidgetModal,
  22. string | null
  23. > = {
  24. 'dashboards_views.edit_widget_modal.confirm':
  25. 'Dashboards2: Edit Dashboard Widget modal form submitted',
  26. 'dashboards_views.edit_widget_modal.opened': 'Dashboards2: Edit Widget Modal Opened',
  27. 'dashboards_views.add_widget_modal.opened': 'Dashboards2: Add Widget Modal opened',
  28. 'dashboards_views.add_widget_modal.change':
  29. 'Dashboards2: Field changed in Add Widget Modal',
  30. 'dashboards_views.add_widget_modal.confirm':
  31. 'Dashboards2: Add Widget to Dashboard modal form submitted',
  32. 'dashboards_views.add_widget_modal.save':
  33. 'Dashboards2: Widget saved directly to Dashboard from Add Widget to Dashboard modal',
  34. };
  35. // Used in the full-page widget builder
  36. type DashboardsEventParametersWidgetBuilder = {
  37. 'dashboards_views.widget_builder.change': {
  38. field: string;
  39. from: string;
  40. new_widget: boolean;
  41. value: string;
  42. widget_type: string;
  43. };
  44. 'dashboards_views.widget_builder.opened': {
  45. new_widget: boolean;
  46. };
  47. 'dashboards_views.widget_builder.save': {
  48. data_set: string;
  49. new_widget: boolean;
  50. };
  51. };
  52. const dashboardsEventMapWidgetBuilder: Record<
  53. keyof DashboardsEventParametersWidgetBuilder,
  54. string | null
  55. > = {
  56. 'dashboards_views.widget_builder.change': 'Widget Builder: Field changed',
  57. 'dashboards_views.widget_builder.save': 'Widget Builder: Form submitted',
  58. 'dashboards_views.widget_builder.opened': 'Widget Builder: Page opened',
  59. };
  60. export type DashboardsEventParameters = {
  61. 'dashboards_manage.change_sort': {
  62. sort: string;
  63. };
  64. 'dashboards_manage.create.start': {};
  65. 'dashboards_manage.search': {};
  66. 'dashboards_manage.templates.add': {
  67. dashboard_id: string;
  68. dashboard_title: string;
  69. was_previewed: boolean;
  70. };
  71. 'dashboards_manage.templates.preview': {
  72. dashboard_id: string;
  73. };
  74. 'dashboards_manage.templates.toggle': {
  75. show_templates: boolean;
  76. };
  77. 'dashboards_views.open_in_discover.opened': {
  78. widget_type: string;
  79. };
  80. 'dashboards_views.query_selector.opened': {
  81. widget_type: string;
  82. };
  83. 'dashboards_views.query_selector.selected': {
  84. widget_type: string;
  85. };
  86. 'dashboards_views.widget_library.add': {
  87. num_widgets: number;
  88. };
  89. 'dashboards_views.widget_library.add_widget': {
  90. title: string;
  91. };
  92. 'dashboards_views.widget_library.opened': {};
  93. 'dashboards_views.widget_library.switch_tab': {
  94. to: string;
  95. };
  96. 'dashboards_views.widget_viewer.edit': {
  97. display_type: string;
  98. widget_type: string;
  99. };
  100. 'dashboards_views.widget_viewer.open': {
  101. display_type: string;
  102. widget_type: string;
  103. };
  104. 'dashboards_views.widget_viewer.open_source': {
  105. display_type: string;
  106. widget_type: string;
  107. };
  108. 'dashboards_views.widget_viewer.paginate': {
  109. display_type: string;
  110. widget_type: string;
  111. };
  112. 'dashboards_views.widget_viewer.select_query': {
  113. display_type: string;
  114. widget_type: string;
  115. };
  116. 'dashboards_views.widget_viewer.sort': {
  117. column: string;
  118. display_type: string;
  119. order: string;
  120. widget_type: string;
  121. };
  122. 'dashboards_views.widget_viewer.toggle_legend': {
  123. display_type: string;
  124. widget_type: string;
  125. };
  126. 'dashboards_views.widget_viewer.zoom': {
  127. display_type: string;
  128. widget_type: string;
  129. };
  130. } & DashboardsEventParametersAddWidgetModal &
  131. DashboardsEventParametersWidgetBuilder;
  132. export type DashboardsEventKey = keyof DashboardsEventParameters;
  133. export const dashboardsEventMap: Record<DashboardsEventKey, string | null> = {
  134. 'dashboards_views.query_selector.opened':
  135. 'Dashboards2: Query Selector opened for Widget',
  136. 'dashboards_views.query_selector.selected':
  137. 'Dashboards2: Query selected in Query Selector',
  138. 'dashboards_views.open_in_discover.opened': 'Dashboards2: Widget Opened In Discover',
  139. 'dashboards_views.widget_library.add': 'Dashboards2: Number of prebuilt widgets added',
  140. 'dashboards_views.widget_library.add_widget':
  141. 'Dashboards2: Title of prebuilt widget added',
  142. 'dashboards_views.widget_library.switch_tab':
  143. 'Dashboards2: Widget Library tab switched',
  144. 'dashboards_views.widget_library.opened': 'Dashboards2: Add Widget Library opened',
  145. 'dashboards_manage.search': 'Dashboards Manager: Search',
  146. 'dashboards_manage.change_sort': 'Dashboards Manager: Sort By Changed',
  147. 'dashboards_manage.create.start': 'Dashboards Manager: Dashboard Create Started',
  148. 'dashboards_manage.templates.toggle': 'Dashboards Manager: Template Toggle Changed',
  149. 'dashboards_manage.templates.add': 'Dashboards Manager: Template Added',
  150. 'dashboards_manage.templates.preview': 'Dashboards Manager: Template Previewed',
  151. 'dashboards_views.widget_viewer.edit': 'Widget Viewer: Edit Widget Modal Opened',
  152. 'dashboards_views.widget_viewer.open': 'Widget Viewer: Opened',
  153. 'dashboards_views.widget_viewer.open_source':
  154. 'Widget Viewer: Opened in Discover/Issues',
  155. 'dashboards_views.widget_viewer.paginate': 'Widget Viewer: Paginate',
  156. 'dashboards_views.widget_viewer.select_query': 'Widget Viewer: Query Selected',
  157. 'dashboards_views.widget_viewer.sort': 'Widget Viewer: Table Sorted',
  158. 'dashboards_views.widget_viewer.toggle_legend': 'Widget Viewer: Legend Toggled',
  159. 'dashboards_views.widget_viewer.zoom': 'Widget Viewer: Chart zoomed',
  160. ...dashboardsEventMapAddWidgetModal,
  161. ...dashboardsEventMapWidgetBuilder,
  162. };