dashboardsAnalyticsEvents.tsx 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. 'dashboards2.create.cancel': {};
  62. 'dashboards2.create.complete': {};
  63. 'dashboards2.delete': {};
  64. 'dashboards2.edit.cancel': {};
  65. 'dashboards2.edit.complete': {};
  66. 'dashboards2.edit.start': {};
  67. 'dashboards_manage.change_sort': {
  68. sort: string;
  69. };
  70. 'dashboards_manage.create.start': {};
  71. 'dashboards_manage.search': {};
  72. 'dashboards_manage.templates.add': {
  73. dashboard_id: string;
  74. dashboard_title: string;
  75. was_previewed: boolean;
  76. };
  77. 'dashboards_manage.templates.preview': {
  78. dashboard_id: string;
  79. };
  80. 'dashboards_manage.templates.toggle': {
  81. show_templates: boolean;
  82. };
  83. 'dashboards_views.open_in_discover.opened': {
  84. widget_type: string;
  85. };
  86. 'dashboards_views.query_selector.opened': {
  87. widget_type: string;
  88. };
  89. 'dashboards_views.query_selector.selected': {
  90. widget_type: string;
  91. };
  92. 'dashboards_views.widget_library.add': {
  93. num_widgets: number;
  94. };
  95. 'dashboards_views.widget_library.add_widget': {
  96. title: string;
  97. };
  98. 'dashboards_views.widget_library.opened': {};
  99. 'dashboards_views.widget_library.switch_tab': {
  100. to: string;
  101. };
  102. 'dashboards_views.widget_viewer.edit': {
  103. display_type: string;
  104. widget_type: string;
  105. };
  106. 'dashboards_views.widget_viewer.open': {
  107. display_type: string;
  108. widget_type: string;
  109. };
  110. 'dashboards_views.widget_viewer.open_source': {
  111. display_type: string;
  112. widget_type: string;
  113. };
  114. 'dashboards_views.widget_viewer.paginate': {
  115. display_type: string;
  116. widget_type: string;
  117. };
  118. 'dashboards_views.widget_viewer.select_query': {
  119. display_type: string;
  120. widget_type: string;
  121. };
  122. 'dashboards_views.widget_viewer.sort': {
  123. column: string;
  124. display_type: string;
  125. order: string;
  126. widget_type: string;
  127. };
  128. 'dashboards_views.widget_viewer.toggle_legend': {
  129. display_type: string;
  130. widget_type: string;
  131. };
  132. 'dashboards_views.widget_viewer.zoom': {
  133. display_type: string;
  134. widget_type: string;
  135. };
  136. } & DashboardsEventParametersAddWidgetModal &
  137. DashboardsEventParametersWidgetBuilder;
  138. export type DashboardsEventKey = keyof DashboardsEventParameters;
  139. export const dashboardsEventMap: Record<DashboardsEventKey, string | null> = {
  140. 'dashboards2.create.cancel': 'Dashboards2: Create cancel',
  141. 'dashboards2.create.complete': 'Dashboards2: Create complete',
  142. 'dashboards2.delete': 'Dashboards2: Delete',
  143. 'dashboards2.edit.cancel': 'Dashboards2: Edit cancel',
  144. 'dashboards2.edit.complete': 'Dashboards2: Edit complete',
  145. 'dashboards2.edit.start': 'Dashboards2: Edit start',
  146. 'dashboards_views.query_selector.opened':
  147. 'Dashboards2: Query Selector opened for Widget',
  148. 'dashboards_views.query_selector.selected':
  149. 'Dashboards2: Query selected in Query Selector',
  150. 'dashboards_views.open_in_discover.opened': 'Dashboards2: Widget Opened In Discover',
  151. 'dashboards_views.widget_library.add': 'Dashboards2: Number of prebuilt widgets added',
  152. 'dashboards_views.widget_library.add_widget':
  153. 'Dashboards2: Title of prebuilt widget added',
  154. 'dashboards_views.widget_library.switch_tab':
  155. 'Dashboards2: Widget Library tab switched',
  156. 'dashboards_views.widget_library.opened': 'Dashboards2: Add Widget Library opened',
  157. 'dashboards_manage.search': 'Dashboards Manager: Search',
  158. 'dashboards_manage.change_sort': 'Dashboards Manager: Sort By Changed',
  159. 'dashboards_manage.create.start': 'Dashboards Manager: Dashboard Create Started',
  160. 'dashboards_manage.templates.toggle': 'Dashboards Manager: Template Toggle Changed',
  161. 'dashboards_manage.templates.add': 'Dashboards Manager: Template Added',
  162. 'dashboards_manage.templates.preview': 'Dashboards Manager: Template Previewed',
  163. 'dashboards_views.widget_viewer.edit': 'Widget Viewer: Edit Widget Modal Opened',
  164. 'dashboards_views.widget_viewer.open': 'Widget Viewer: Opened',
  165. 'dashboards_views.widget_viewer.open_source':
  166. 'Widget Viewer: Opened in Discover/Issues',
  167. 'dashboards_views.widget_viewer.paginate': 'Widget Viewer: Paginate',
  168. 'dashboards_views.widget_viewer.select_query': 'Widget Viewer: Query Selected',
  169. 'dashboards_views.widget_viewer.sort': 'Widget Viewer: Table Sorted',
  170. 'dashboards_views.widget_viewer.toggle_legend': 'Widget Viewer: Legend Toggled',
  171. 'dashboards_views.widget_viewer.zoom': 'Widget Viewer: Chart zoomed',
  172. ...dashboardsEventMapAddWidgetModal,
  173. ...dashboardsEventMapWidgetBuilder,
  174. };