@gooddata/sdk-ui-dashboard 10.9.0-alpha.2 → 10.9.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/esm/__version.d.ts +1 -1
  2. package/esm/__version.d.ts.map +1 -1
  3. package/esm/__version.js +1 -1
  4. package/esm/__version.js.map +1 -1
  5. package/esm/_staging/drills/drillingUtils.d.ts +2 -14
  6. package/esm/_staging/drills/drillingUtils.d.ts.map +1 -1
  7. package/esm/_staging/drills/drillingUtils.js +2 -62
  8. package/esm/_staging/drills/drillingUtils.js.map +1 -1
  9. package/esm/assets/filter.svg +1 -0
  10. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.d.ts.map +1 -1
  11. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js +1 -0
  12. package/esm/model/commandHandlers/dashboard/initializeDashboardHandler/index.js.map +1 -1
  13. package/esm/model/commandHandlers/drill/drillDownHandler.d.ts.map +1 -1
  14. package/esm/model/commandHandlers/drill/drillDownHandler.js +24 -2
  15. package/esm/model/commandHandlers/drill/drillDownHandler.js.map +1 -1
  16. package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.d.ts.map +1 -1
  17. package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.js +24 -0
  18. package/esm/model/commandHandlers/filterContext/attributeFilter/changeAttributeDisplayFormHandler.js.map +1 -1
  19. package/esm/model/commandHandlers/widgets/addDrillDownForInsightWidgetHandler.d.ts.map +1 -1
  20. package/esm/model/commandHandlers/widgets/addDrillDownForInsightWidgetHandler.js +23 -2
  21. package/esm/model/commandHandlers/widgets/addDrillDownForInsightWidgetHandler.js.map +1 -1
  22. package/esm/model/commandHandlers/widgets/common/drillDown.d.ts +6 -0
  23. package/esm/model/commandHandlers/widgets/common/drillDown.d.ts.map +1 -0
  24. package/esm/model/commandHandlers/widgets/common/drillDown.js +22 -0
  25. package/esm/model/commandHandlers/widgets/common/drillDown.js.map +1 -0
  26. package/esm/model/commandHandlers/widgets/modifyDrillDownForInsightWidgetHandler.d.ts.map +1 -1
  27. package/esm/model/commandHandlers/widgets/modifyDrillDownForInsightWidgetHandler.js +23 -2
  28. package/esm/model/commandHandlers/widgets/modifyDrillDownForInsightWidgetHandler.js.map +1 -1
  29. package/esm/model/commandHandlers/widgets/removeDrillDownForInsightWidgetHandler.d.ts.map +1 -1
  30. package/esm/model/commandHandlers/widgets/removeDrillDownForInsightWidgetHandler.js +15 -2
  31. package/esm/model/commandHandlers/widgets/removeDrillDownForInsightWidgetHandler.js.map +1 -1
  32. package/esm/model/commands/insight.d.ts +17 -3
  33. package/esm/model/commands/insight.d.ts.map +1 -1
  34. package/esm/model/commands/insight.js +7 -3
  35. package/esm/model/commands/insight.js.map +1 -1
  36. package/esm/model/store/catalog/catalogSelectors.d.ts +23 -1
  37. package/esm/model/store/catalog/catalogSelectors.d.ts.map +1 -1
  38. package/esm/model/store/catalog/catalogSelectors.js +9 -3
  39. package/esm/model/store/catalog/catalogSelectors.js.map +1 -1
  40. package/esm/model/store/config/configSelectors.d.ts +6 -0
  41. package/esm/model/store/config/configSelectors.d.ts.map +1 -1
  42. package/esm/model/store/config/configSelectors.js +8 -0
  43. package/esm/model/store/config/configSelectors.js.map +1 -1
  44. package/esm/model/store/index.d.ts +3 -3
  45. package/esm/model/store/index.d.ts.map +1 -1
  46. package/esm/model/store/index.js +2 -2
  47. package/esm/model/store/index.js.map +1 -1
  48. package/esm/model/store/layout/index.d.ts +4 -0
  49. package/esm/model/store/layout/index.d.ts.map +1 -1
  50. package/esm/model/store/layout/layoutReducers.d.ts +6 -1
  51. package/esm/model/store/layout/layoutReducers.d.ts.map +1 -1
  52. package/esm/model/store/layout/layoutReducers.js +10 -0
  53. package/esm/model/store/layout/layoutReducers.js.map +1 -1
  54. package/esm/model/store/ui/index.d.ts +7 -0
  55. package/esm/model/store/ui/index.d.ts.map +1 -1
  56. package/esm/model/store/ui/uiReducers.d.ts +8 -1
  57. package/esm/model/store/ui/uiReducers.d.ts.map +1 -1
  58. package/esm/model/store/ui/uiReducers.js +7 -0
  59. package/esm/model/store/ui/uiReducers.js.map +1 -1
  60. package/esm/model/store/ui/uiSelectors.d.ts +9 -0
  61. package/esm/model/store/ui/uiSelectors.d.ts.map +1 -1
  62. package/esm/model/store/ui/uiSelectors.js +8 -0
  63. package/esm/model/store/ui/uiSelectors.js.map +1 -1
  64. package/esm/model/store/ui/uiState.d.ts +8 -0
  65. package/esm/model/store/ui/uiState.d.ts.map +1 -1
  66. package/esm/model/store/ui/uiState.js +4 -0
  67. package/esm/model/store/ui/uiState.js.map +1 -1
  68. package/esm/model/store/widgetDrills/widgetDrillSelectors.d.ts.map +1 -1
  69. package/esm/model/store/widgetDrills/widgetDrillSelectors.js +14 -11
  70. package/esm/model/store/widgetDrills/widgetDrillSelectors.js.map +1 -1
  71. package/esm/model/types/commonTypes.d.ts +2 -2
  72. package/esm/model/types/commonTypes.d.ts.map +1 -1
  73. package/esm/presentation/constants/index.d.ts +1 -0
  74. package/esm/presentation/constants/index.d.ts.map +1 -1
  75. package/esm/presentation/constants/index.js +2 -1
  76. package/esm/presentation/constants/index.js.map +1 -1
  77. package/esm/presentation/drill/types.d.ts +1 -0
  78. package/esm/presentation/drill/types.d.ts.map +1 -1
  79. package/esm/presentation/drill/types.js.map +1 -1
  80. package/esm/presentation/filterBar/filterBar/DefaultFilterBarContainer.d.ts.map +1 -1
  81. package/esm/presentation/filterBar/filterBar/DefaultFilterBarContainer.js +5 -8
  82. package/esm/presentation/filterBar/filterBar/DefaultFilterBarContainer.js.map +1 -1
  83. package/esm/presentation/filterBar/filterBar/filterViews/FilterViews.d.ts.map +1 -1
  84. package/esm/presentation/filterBar/filterBar/filterViews/FilterViews.js +43 -12
  85. package/esm/presentation/filterBar/filterBar/filterViews/FilterViews.js.map +1 -1
  86. package/esm/presentation/localization/bundles/de-DE.json +1 -0
  87. package/esm/presentation/localization/bundles/en-AU.json +475 -0
  88. package/esm/presentation/localization/bundles/en-GB.json +1 -0
  89. package/esm/presentation/localization/bundles/en-US.json +162 -2
  90. package/esm/presentation/localization/bundles/es-419.json +1 -0
  91. package/esm/presentation/localization/bundles/es-ES.json +1 -0
  92. package/esm/presentation/localization/bundles/fi-FI.json +475 -0
  93. package/esm/presentation/localization/bundles/fr-CA.json +1 -0
  94. package/esm/presentation/localization/bundles/fr-FR.json +1 -0
  95. package/esm/presentation/localization/bundles/it-IT.json +1 -0
  96. package/esm/presentation/localization/bundles/ja-JP.json +1 -0
  97. package/esm/presentation/localization/bundles/nl-NL.json +1 -0
  98. package/esm/presentation/localization/bundles/pt-BR.json +1 -0
  99. package/esm/presentation/localization/bundles/pt-PT.json +1 -0
  100. package/esm/presentation/localization/bundles/zh-HK.json +475 -0
  101. package/esm/presentation/localization/bundles/zh-Hans.json +1 -0
  102. package/esm/presentation/localization/bundles/zh-Hant.json +475 -0
  103. package/esm/presentation/localization/translations.d.ts.map +1 -1
  104. package/esm/presentation/localization/translations.js +8 -0
  105. package/esm/presentation/localization/translations.js.map +1 -1
  106. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js +1 -1
  107. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/DefaultScheduledEmailDialog.js.map +1 -1
  108. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/DestinationSelect/DestinationSelect.d.ts +2 -2
  109. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/DestinationSelect/DestinationSelect.d.ts.map +1 -1
  110. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/DestinationSelect/DestinationSelect.js +1 -1
  111. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/DestinationSelect/DestinationSelect.js.map +1 -1
  112. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts +1 -1
  113. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts.map +1 -1
  114. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js +1 -1
  115. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js.map +1 -1
  116. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/DefaultScheduledEmailManagementDialog.d.ts.map +1 -1
  117. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/DefaultScheduledEmailManagementDialog.js +1 -1
  118. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/DefaultScheduledEmailManagementDialog.js.map +1 -1
  119. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmail.d.ts +2 -2
  120. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmail.d.ts.map +1 -1
  121. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmail.js +1 -1
  122. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmail.js.map +1 -1
  123. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmailsList.d.ts +2 -2
  124. package/esm/presentation/scheduledEmail/DefaultScheduledEmailManagementDialog/components/ScheduledEmailsList.d.ts.map +1 -1
  125. package/esm/presentation/scheduledEmail/types.d.ts +3 -3
  126. package/esm/presentation/scheduledEmail/types.d.ts.map +1 -1
  127. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.d.ts.map +1 -1
  128. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js +157 -120
  129. package/esm/presentation/topBar/menuButton/useDefaultMenuItems.js.map +1 -1
  130. package/esm/presentation/widget/insight/configuration/DrillTargets/DrillTargets.d.ts.map +1 -1
  131. package/esm/presentation/widget/insight/configuration/DrillTargets/DrillTargets.js +1 -0
  132. package/esm/presentation/widget/insight/configuration/DrillTargets/DrillTargets.js.map +1 -1
  133. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.d.ts +12 -0
  134. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.d.ts.map +1 -0
  135. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.js +74 -0
  136. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertActionsDropdown.js.map +1 -0
  137. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.d.ts +8 -0
  138. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.d.ts.map +1 -0
  139. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.js +25 -0
  140. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertComparisonOperatorSelect.js.map +1 -0
  141. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDeleteDialog.d.ts +7 -0
  142. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDeleteDialog.d.ts.map +1 -0
  143. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDeleteDialog.js +13 -0
  144. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDeleteDialog.js.map +1 -0
  145. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.d.ts +9 -0
  146. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.d.ts.map +1 -0
  147. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.js +23 -0
  148. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertDestinationSelect.js.map +1 -0
  149. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.d.ts +9 -0
  150. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.d.ts.map +1 -0
  151. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js +22 -0
  152. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js.map +1 -0
  153. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.d.ts +8 -0
  154. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.d.ts.map +1 -0
  155. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.js +35 -0
  156. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertTriggerModeSelect.js.map +1 -0
  157. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.d.ts +16 -0
  158. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.d.ts.map +1 -0
  159. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.js +18 -0
  160. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsList.js.map +1 -0
  161. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.d.ts +12 -0
  162. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.d.ts.map +1 -0
  163. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js +16 -0
  164. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js.map +1 -0
  165. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts +17 -0
  166. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts.map +1 -0
  167. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js +12 -0
  168. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js.map +1 -0
  169. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts +18 -0
  170. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts.map +1 -0
  171. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js +53 -0
  172. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js.map +1 -0
  173. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.d.ts +10 -0
  174. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.d.ts.map +1 -0
  175. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.js +47 -0
  176. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.js.map +1 -0
  177. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.d.ts +23 -0
  178. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.d.ts.map +1 -0
  179. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.js +36 -0
  180. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/constants.js.map +1 -0
  181. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/messages.d.ts +51 -0
  182. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/messages.d.ts.map +1 -0
  183. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/messages.js +53 -0
  184. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/messages.js.map +1 -0
  185. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.d.ts +21 -0
  186. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.d.ts.map +1 -0
  187. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.js +97 -0
  188. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.js.map +1 -0
  189. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts +29 -0
  190. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.d.ts.map +1 -0
  191. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js +151 -0
  192. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.js.map +1 -0
  193. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts +16 -0
  194. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts.map +1 -0
  195. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js +86 -0
  196. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js.map +1 -0
  197. package/esm/presentation/widget/insight/configuration/InsightAlerts.d.ts +4 -0
  198. package/esm/presentation/widget/insight/configuration/InsightAlerts.d.ts.map +1 -0
  199. package/esm/presentation/widget/insight/configuration/InsightAlerts.js +38 -0
  200. package/esm/presentation/widget/insight/configuration/InsightAlerts.js.map +1 -0
  201. package/esm/presentation/widget/insight/configuration/InsightDrillConfigItem.d.ts +1 -1
  202. package/esm/presentation/widget/insight/configuration/InsightDrillConfigItem.d.ts.map +1 -1
  203. package/esm/presentation/widget/insight/configuration/InsightDrillConfigItem.js +23 -5
  204. package/esm/presentation/widget/insight/configuration/InsightDrillConfigItem.js.map +1 -1
  205. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/drillConfigMapper.d.ts +2 -2
  206. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/drillConfigMapper.d.ts.map +1 -1
  207. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/drillConfigMapper.js +25 -3
  208. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/drillConfigMapper.js.map +1 -1
  209. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/useInsightDrillConfigPanel.d.ts +1 -1
  210. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/useInsightDrillConfigPanel.d.ts.map +1 -1
  211. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/useInsightDrillConfigPanel.js +5 -4
  212. package/esm/presentation/widget/insight/configuration/InsightDrillConfigPanel/useInsightDrillConfigPanel.js.map +1 -1
  213. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightMenuItemButton.d.ts.map +1 -1
  214. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightMenuItemButton.js +1 -1
  215. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightMenuItemButton.js.map +1 -1
  216. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.d.ts +1 -1
  217. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.d.ts.map +1 -1
  218. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.js +1 -1
  219. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.d.ts +1 -1
  220. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.d.ts.map +1 -1
  221. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.js +4 -3
  222. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuHeader.js.map +1 -1
  223. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.d.ts.map +1 -1
  224. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.js +3 -3
  225. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/index.js.map +1 -1
  226. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.d.ts +2 -0
  227. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.d.ts.map +1 -1
  228. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.js +28 -7
  229. package/esm/presentation/widget/insightMenu/DefaultDashboardInsightMenu/getDefaultInsightMenuItems.js.map +1 -1
  230. package/esm/presentation/widget/insightMenu/index.d.ts +1 -1
  231. package/esm/presentation/widget/insightMenu/index.d.ts.map +1 -1
  232. package/esm/presentation/widget/insightMenu/types.d.ts +28 -6
  233. package/esm/presentation/widget/insightMenu/types.d.ts.map +1 -1
  234. package/esm/presentation/widget/widget/InsightWidget/DefaultDashboardInsightWidget.js +7 -2
  235. package/esm/presentation/widget/widget/InsightWidget/DefaultDashboardInsightWidget.js.map +1 -1
  236. package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.d.ts +2 -0
  237. package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.d.ts.map +1 -1
  238. package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.js +13 -8
  239. package/esm/presentation/widget/widget/InsightWidget/useInsightMenu.js.map +1 -1
  240. package/esm/sdk-ui-dashboard.d.ts +90 -12
  241. package/esm/types.d.ts +5 -0
  242. package/esm/types.d.ts.map +1 -1
  243. package/esm/types.js.map +1 -1
  244. package/package.json +15 -15
  245. package/styles/css/alerting.css +214 -0
  246. package/styles/css/alerting.css.map +1 -0
  247. package/styles/css/configurationPanel.css +3 -0
  248. package/styles/css/configurationPanel.css.map +1 -1
  249. package/styles/css/dashboard.css +6 -1
  250. package/styles/css/dashboard.css.map +1 -1
  251. package/styles/css/icons.css +7 -0
  252. package/styles/css/icons.css.map +1 -1
  253. package/styles/css/main.css +229 -1
  254. package/styles/css/main.css.map +1 -1
  255. package/styles/css/scheduled_mail.css +6 -1
  256. package/styles/css/scheduled_mail.css.map +1 -1
  257. package/styles/scss/alerting.scss +257 -0
  258. package/styles/scss/configurationPanel.scss +5 -0
  259. package/styles/scss/icons.scss +9 -0
  260. package/styles/scss/main.scss +1 -0
  261. package/styles/scss/scheduled_mail.scss +7 -1
@@ -0,0 +1,53 @@
1
+ // (C) 2022-2024 GoodData Corporation
2
+ import React from "react";
3
+ import { Bubble, BubbleHoverTrigger, Button, Input } from "@gooddata/sdk-ui-kit";
4
+ import { DashboardInsightSubmenuContainer } from "../../../insightMenu/DefaultDashboardInsightMenu/DashboardInsightMenu/DashboardInsightSubmenuContainer.js";
5
+ import { AlertMeasureSelect } from "./AlertMeasureSelect.js";
6
+ import { AlertComparisonOperatorSelect } from "./AlertComparisonOperatorSelect.js";
7
+ import { AlertDestinationSelect } from "./AlertDestinationSelect.js";
8
+ import { EditAlertConfiguration } from "./EditAlertConfiguration.js";
9
+ import { useEditAlert } from "./useEditAlert.js";
10
+ import { FormattedMessage, useIntl } from "react-intl";
11
+ const TOOLTIP_ALIGN_POINTS = [{ align: "cl cr" }, { align: "cr cl" }];
12
+ export const EditAlert = ({ alert, isNewAlert, hasAlerts, destinations, measures, onClose, onCancel, onCreate, onUpdate, maxAutomationsReached = false, }) => {
13
+ const { viewMode, updatedAlert, canSubmit,
14
+ //
15
+ changeComparisonOperator, changeMeasure, changeValue, changeDestination,
16
+ //
17
+ configureAlert, saveAlertConfiguration, cancelAlertConfiguration,
18
+ //
19
+ createAlert, updateAlert, } = useEditAlert({
20
+ alert,
21
+ onCreate,
22
+ onUpdate,
23
+ });
24
+ const intl = useIntl();
25
+ const disableCreateButtonDueToLimits = isNewAlert && maxAutomationsReached;
26
+ return viewMode === "edit" ? (React.createElement(DashboardInsightSubmenuContainer, { title: isNewAlert
27
+ ? intl.formatMessage({ id: "insightAlert.config.createAlert" })
28
+ : intl.formatMessage({ id: "insightAlert.config.editAlert" }), onClose: onClose, onBack: hasAlerts ? onCancel : undefined },
29
+ React.createElement("div", { className: "gd-edit-alert" },
30
+ React.createElement("div", { className: "gd-edit-alert__form" },
31
+ React.createElement("div", { className: "gd-edit-alert__form-content" },
32
+ React.createElement("div", { className: "gd-edit-alert__measure-label" },
33
+ React.createElement(FormattedMessage, { id: "insightAlert.config.when" })),
34
+ React.createElement(AlertMeasureSelect, { selectedMeasure: updatedAlert.alert.condition.left, onMeasureChange: changeMeasure, measures: measures }),
35
+ React.createElement(AlertComparisonOperatorSelect, { selectedComparisonOperator: updatedAlert.alert.condition.operator, onComparisonOperatorChange: changeComparisonOperator }),
36
+ React.createElement(Input, { className: "gd-edit-alert__value-input s-alert-value-input", isSmall: true, autofocus: true, value: updatedAlert.alert.condition.right, onChange: (e) => changeValue(e !== "" ? parseInt(e, 10) : undefined), type: "number" }),
37
+ destinations.length > 1 && (React.createElement(AlertDestinationSelect, { selectedDestination: updatedAlert.webhook, onDestinationChange: changeDestination, destinations: destinations })))),
38
+ React.createElement("div", { className: "gd-edit-alert__buttons" },
39
+ React.createElement(Button, { className: "gd-edit-alert__configuration-button gd-button-link gd-button-icon-only gd-icon-settings gd-button-small s-alert-configuration", onClick: configureAlert }),
40
+ React.createElement("div", null,
41
+ React.createElement(Button, { variant: "secondary", size: "small", onClick: () => {
42
+ onCancel();
43
+ } },
44
+ React.createElement(FormattedMessage, { id: "cancel" })),
45
+ React.createElement(BubbleHoverTrigger, { hideDelay: 0, showDelay: 0 },
46
+ React.createElement(Button, { intent: "action", size: "small", disabled: !canSubmit || disableCreateButtonDueToLimits, onClick: isNewAlert ? createAlert : updateAlert, className: "gd-button-left-margin" }, isNewAlert
47
+ ? intl.formatMessage({ id: "create" })
48
+ : intl.formatMessage({ id: "save" })),
49
+ disableCreateButtonDueToLimits ? (React.createElement(Bubble, { alignPoints: TOOLTIP_ALIGN_POINTS },
50
+ React.createElement(FormattedMessage, { id: "insightAlert.maxAlertsReached" }))) : null)))))) : (React.createElement(DashboardInsightSubmenuContainer, { title: intl.formatMessage({ id: "insightAlert.config.title" }), onClose: onClose, onBack: cancelAlertConfiguration },
51
+ React.createElement(EditAlertConfiguration, { alert: updatedAlert, onUpdate: saveAlertConfiguration, onCancel: cancelAlertConfiguration })));
52
+ };
53
+ //# sourceMappingURL=EditAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditAlert.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,MAAM,OAAO,CAA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AAwB,GACpC,CAC6B,CACtC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { IAutomationMetadataObject } from "@gooddata/sdk-model";
3
+ interface IEditAlertConfigurationProps {
4
+ alert: IAutomationMetadataObject;
5
+ onCancel: () => void;
6
+ onUpdate: (alert: IAutomationMetadataObject) => void;
7
+ }
8
+ export declare const EditAlertConfiguration: React.FC<IEditAlertConfigurationProps>;
9
+ export {};
10
+ //# sourceMappingURL=EditAlertConfiguration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditAlertConfiguration.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/EditAlertConfiguration.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAYhE,UAAU,4BAA4B;IAClC,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACxD;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAmEzE,CAAC"}
@@ -0,0 +1,47 @@
1
+ // (C) 2022-2024 GoodData Corporation
2
+ import React, { useState } from "react";
3
+ import { Bubble, BubbleHoverTrigger, Button, Icon } from "@gooddata/sdk-ui-kit";
4
+ import { AlertTriggerModeSelect } from "./AlertTriggerModeSelect.js";
5
+ import { useTheme } from "@gooddata/sdk-ui-theme-provider";
6
+ import { FormattedMessage } from "react-intl";
7
+ import { gdColorStateBlank } from "../../../../constants/index.js";
8
+ const TOOLTIP_ALIGN_POINTS = [
9
+ { align: "cr cl", offset: { x: 0, y: -1 } },
10
+ { align: "cl cr", offset: { x: 0, y: -1 } },
11
+ ];
12
+ export const EditAlertConfiguration = ({ alert, onCancel, onUpdate, }) => {
13
+ const [updatedAlert, setUpdatedAlert] = useState(alert);
14
+ const canSubmit = updatedAlert.alert?.trigger.mode !== alert.alert?.trigger.mode;
15
+ const theme = useTheme();
16
+ return (React.createElement("div", { className: "gd-edit-alert-configuration" },
17
+ React.createElement("div", { className: "gd-edit-alert-configuration__form" },
18
+ React.createElement("div", { className: "gd-edit-alert-configuration__trigger-label" },
19
+ React.createElement(FormattedMessage, { id: "insightAlert.config.trigger" }),
20
+ " ",
21
+ React.createElement(BubbleHoverTrigger, null,
22
+ React.createElement(Icon.QuestionMark, { className: "gd-edit-alert-configuration__trigger-label-icon", color: theme?.palette?.complementary?.c6 ?? gdColorStateBlank, width: 14, height: 14 }),
23
+ React.createElement(Bubble, { alignPoints: TOOLTIP_ALIGN_POINTS },
24
+ React.createElement(FormattedMessage, { id: "insightAlert.config.trigger.tooltip" })))),
25
+ React.createElement("div", { className: "gd-edit-alert-configuration__trigger-select" },
26
+ React.createElement(AlertTriggerModeSelect, { selectedTriggerMode: updatedAlert.alert?.trigger.mode ?? "ALWAYS", onTriggerModeChange: (triggerMode) => {
27
+ setUpdatedAlert({
28
+ ...updatedAlert,
29
+ alert: {
30
+ ...updatedAlert.alert,
31
+ trigger: {
32
+ ...updatedAlert.alert.trigger,
33
+ mode: triggerMode,
34
+ },
35
+ },
36
+ });
37
+ } }))),
38
+ React.createElement("div", { className: "gd-edit-alert-configuration__buttons" },
39
+ React.createElement("div", null,
40
+ React.createElement(Button, { variant: "secondary", size: "small", onClick: () => {
41
+ onCancel();
42
+ } },
43
+ React.createElement(FormattedMessage, { id: "cancel" })),
44
+ React.createElement(Button, { intent: "action", size: "small", disabled: !canSubmit, onClick: () => onUpdate(updatedAlert) },
45
+ React.createElement(FormattedMessage, { id: "save" }))))));
46
+ };
47
+ //# sourceMappingURL=EditAlertConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditAlertConfiguration.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig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+ import { IAlertComparisonOperator } from "@gooddata/sdk-model";
2
+ export declare const COMPARISON_OPERATOR_LESS_THAN = "LESS_THAN";
3
+ export declare const COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS = "LESS_THAN_OR_EQUALS";
4
+ export declare const COMPARISON_OPERATOR_GREATER_THAN = "GREATER_THAN";
5
+ export declare const COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS = "GREATER_THAN_OR_EQUALS";
6
+ export declare const COMPARISON_OPERATORS: {
7
+ readonly COMPARISON_OPERATOR_LESS_THAN: "LESS_THAN";
8
+ readonly COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS: "LESS_THAN_OR_EQUALS";
9
+ readonly COMPARISON_OPERATOR_GREATER_THAN: "GREATER_THAN";
10
+ readonly COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS: "GREATER_THAN_OR_EQUALS";
11
+ };
12
+ export declare const COMPARISON_OPERATOR_OPTIONS: {
13
+ title: string;
14
+ icon: string;
15
+ id: IAlertComparisonOperator;
16
+ }[];
17
+ export declare const DROPDOWN_ITEM_HEIGHT = 28;
18
+ export declare const DROPDOWN_SEPARATOR_ITEM_HEIGHT = 10;
19
+ export interface INotificationChannel {
20
+ id: string;
21
+ title: string;
22
+ }
23
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,eAAO,MAAM,6BAA6B,cAAc,CAAC;AACzD,eAAO,MAAM,uCAAuC,wBAAwB,CAAC;AAC7E,eAAO,MAAM,gCAAgC,iBAAiB,CAAC;AAC/D,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AAEnF,eAAO,MAAM,oBAAoB;;;;;CAKvB,CAAC;AAEX,eAAO,MAAM,2BAA2B,EAAE;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,wBAAwB,CAAC;CAChC,EAqBA,CAAC;AAEF,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAGjD,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,36 @@
1
+ import { messages } from "./messages.js";
2
+ export const COMPARISON_OPERATOR_LESS_THAN = "LESS_THAN";
3
+ export const COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS = "LESS_THAN_OR_EQUALS";
4
+ export const COMPARISON_OPERATOR_GREATER_THAN = "GREATER_THAN";
5
+ export const COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS = "GREATER_THAN_OR_EQUALS";
6
+ export const COMPARISON_OPERATORS = {
7
+ COMPARISON_OPERATOR_LESS_THAN,
8
+ COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS,
9
+ COMPARISON_OPERATOR_GREATER_THAN,
10
+ COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS,
11
+ };
12
+ export const COMPARISON_OPERATOR_OPTIONS = [
13
+ {
14
+ title: messages.comparisonOperatorGreaterThan.id,
15
+ icon: "gd-icon-greater-than",
16
+ id: COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN,
17
+ },
18
+ {
19
+ title: messages.comparisonOperatorGreaterThanOrEquals.id,
20
+ icon: "gd-icon-greater-than-equal-to",
21
+ id: COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN_OR_EQUALS,
22
+ },
23
+ {
24
+ title: messages.comparisonOperatorLessThan.id,
25
+ icon: "gd-icon-less-than",
26
+ id: COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN,
27
+ },
28
+ {
29
+ title: messages.comparisonOperatorLessThanOrEquals.id,
30
+ icon: "gd-icon-less-than-equal-to",
31
+ id: COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN_OR_EQUALS,
32
+ },
33
+ ];
34
+ export const DROPDOWN_ITEM_HEIGHT = 28;
35
+ export const DROPDOWN_SEPARATOR_ITEM_HEIGHT = 10;
36
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,6BAA6B,GAAG,WAAW,CAAC;AACzD,MAAM,CAAC,MAAM,uCAAuC,GAAG,qBAAqB,CAAC;AAC7E,MAAM,CAAC,MAAM,gCAAgC,GAAG,cAAc,CAAC;AAC/D,MAAM,CAAC,MAAM,0CAA0C,GAAG,wBAAwB,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,6BAA6B;IAC7B,uCAAuC;IACvC,gCAAgC;IAChC,0CAA0C;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,2BAA2B,GAIlC;IACF;QACI,KAAK,EAAE,QAAQ,CAAC,6BAA6B,CAAC,EAAE;QAChD,IAAI,EAAE,sBAAsB;QAC5B,EAAE,EAAE,oBAAoB,CAAC,gCAAgC;KAC5D;IACD;QACI,KAAK,EAAE,QAAQ,CAAC,qCAAqC,CAAC,EAAE;QACxD,IAAI,EAAE,+BAA+B;QACrC,EAAE,EAAE,oBAAoB,CAAC,0CAA0C;KACtE;IACD;QACI,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,EAAE;QAC7C,IAAI,EAAE,mBAAmB;QACzB,EAAE,EAAE,oBAAoB,CAAC,6BAA6B;KACzD;IACD;QACI,KAAK,EAAE,QAAQ,CAAC,kCAAkC,CAAC,EAAE;QACrD,IAAI,EAAE,4BAA4B;QAClC,EAAE,EAAE,oBAAoB,CAAC,uCAAuC;KACnE;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC"}
@@ -0,0 +1,51 @@
1
+ export declare const messages: {
2
+ alertActionEdit: {
3
+ id: string;
4
+ };
5
+ alertActionPause: {
6
+ id: string;
7
+ };
8
+ alertActionResume: {
9
+ id: string;
10
+ };
11
+ alertActionDelete: {
12
+ id: string;
13
+ };
14
+ comparisonOperatorLessThan: {
15
+ id: string;
16
+ };
17
+ comparisonOperatorLessThanOrEquals: {
18
+ id: string;
19
+ };
20
+ comparisonOperatorGreaterThan: {
21
+ id: string;
22
+ };
23
+ comparisonOperatorGreaterThanOrEquals: {
24
+ id: string;
25
+ };
26
+ alertTriggerModeAlways: {
27
+ id: string;
28
+ };
29
+ alertTriggerModeOnce: {
30
+ id: string;
31
+ };
32
+ alertDeleteSuccess: {
33
+ id: string;
34
+ };
35
+ alertAddSuccess: {
36
+ id: string;
37
+ };
38
+ alertUpdateSuccess: {
39
+ id: string;
40
+ };
41
+ alertPauseSuccess: {
42
+ id: string;
43
+ };
44
+ alertResumeSuccess: {
45
+ id: string;
46
+ };
47
+ alertLoadingError: {
48
+ id: string;
49
+ };
50
+ };
51
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/messages.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDnB,CAAC"}
@@ -0,0 +1,53 @@
1
+ // (C) 2024 GoodData Corporation
2
+ import { defineMessages } from "react-intl";
3
+ export const messages = defineMessages({
4
+ alertActionEdit: {
5
+ id: "insightAlert.config.action.edit",
6
+ },
7
+ alertActionPause: {
8
+ id: "insightAlert.config.action.pause",
9
+ },
10
+ alertActionResume: {
11
+ id: "insightAlert.config.action.resume",
12
+ },
13
+ alertActionDelete: {
14
+ id: "insightAlert.config.action.delete",
15
+ },
16
+ comparisonOperatorLessThan: {
17
+ id: "insightAlert.config.comparisonOperator.lessThan",
18
+ },
19
+ comparisonOperatorLessThanOrEquals: {
20
+ id: "insightAlert.config.comparisonOperator.lessThanOrEquals",
21
+ },
22
+ comparisonOperatorGreaterThan: {
23
+ id: "insightAlert.config.comparisonOperator.greaterThan",
24
+ },
25
+ comparisonOperatorGreaterThanOrEquals: {
26
+ id: "insightAlert.config.comparisonOperator.greaterThanOrEquals",
27
+ },
28
+ alertTriggerModeAlways: {
29
+ id: "insightAlert.config.triggerMode.always",
30
+ },
31
+ alertTriggerModeOnce: {
32
+ id: "insightAlert.config.triggerMode.once",
33
+ },
34
+ alertDeleteSuccess: {
35
+ id: "insightAlert.config.delete.success",
36
+ },
37
+ alertAddSuccess: {
38
+ id: "insightAlert.config.add.success",
39
+ },
40
+ alertUpdateSuccess: {
41
+ id: "insightAlert.config.update.success",
42
+ },
43
+ alertPauseSuccess: {
44
+ id: "insightAlert.config.pause.success",
45
+ },
46
+ alertResumeSuccess: {
47
+ id: "insightAlert.config.resume.success",
48
+ },
49
+ alertLoadingError: {
50
+ id: "insightAlert.config.loading.error",
51
+ },
52
+ });
53
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/messages.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC;IACnC,eAAe,EAAE;QACb,EAAE,EAAE,iCAAiC;KACxC;IACD,gBAAgB,EAAE;QACd,EAAE,EAAE,kCAAkC;KACzC;IACD,iBAAiB,EAAE;QACf,EAAE,EAAE,mCAAmC;KAC1C;IACD,iBAAiB,EAAE;QACf,EAAE,EAAE,mCAAmC;KAC1C;IACD,0BAA0B,EAAE;QACxB,EAAE,EAAE,iDAAiD;KACxD;IACD,kCAAkC,EAAE;QAChC,EAAE,EAAE,yDAAyD;KAChE;IACD,6BAA6B,EAAE;QAC3B,EAAE,EAAE,oDAAoD;KAC3D;IACD,qCAAqC,EAAE;QACnC,EAAE,EAAE,4DAA4D;KACnE;IACD,sBAAsB,EAAE;QACpB,EAAE,EAAE,wCAAwC;KAC/C;IACD,oBAAoB,EAAE;QAClB,EAAE,EAAE,sCAAsC;KAC7C;IACD,kBAAkB,EAAE;QAChB,EAAE,EAAE,oCAAoC;KAC3C;IACD,eAAe,EAAE;QACb,EAAE,EAAE,iCAAiC;KACxC;IACD,kBAAkB,EAAE;QAChB,EAAE,EAAE,oCAAoC;KAC3C;IACD,iBAAiB,EAAE;QACf,EAAE,EAAE,mCAAmC;KAC1C;IACD,kBAAkB,EAAE;QAChB,EAAE,EAAE,oCAAoC;KAC3C;IACD,iBAAiB,EAAE;QACf,EAAE,EAAE,mCAAmC;KAC1C;CACJ,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { IAlertComparisonOperator, IAutomationMetadataObject, IAutomationMetadataObjectDefinition, IMeasure } from "@gooddata/sdk-model";
2
+ export interface IUseEditAlertProps {
3
+ alert: IAutomationMetadataObject;
4
+ onCreate?: (alert: IAutomationMetadataObjectDefinition) => void;
5
+ onUpdate?: (alert: IAutomationMetadataObject) => void;
6
+ }
7
+ export declare const useEditAlert: ({ alert, onCreate, onUpdate }: IUseEditAlertProps) => {
8
+ viewMode: "configuration" | "edit";
9
+ updatedAlert: IAutomationMetadataObject;
10
+ canSubmit: boolean;
11
+ changeComparisonOperator: (comparisonOperator: IAlertComparisonOperator) => void;
12
+ changeMeasure: (measure: IMeasure) => void;
13
+ changeValue: (value: number) => void;
14
+ changeDestination: (destinationId: string) => void;
15
+ configureAlert: () => void;
16
+ saveAlertConfiguration: (alert: IAutomationMetadataObject) => void;
17
+ cancelAlertConfiguration: () => void;
18
+ createAlert: () => void;
19
+ updateAlert: () => void;
20
+ };
21
+ //# sourceMappingURL=useEditAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditAlert.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,QAAQ,EACX,MAAM,qBAAqB,CAAC;AAK7B,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,yBAAyB,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mCAAmC,KAAK,IAAI,CAAC;IAChE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,YAAY,kCAAmC,kBAAkB;;;;mDA0BpB,wBAAwB;6BArB9C,QAAQ;yBAqCZ,MAAM;uCAgBQ,MAAM;;oCAWT,yBAAyB;;;;CAsCnE,CAAC"}
@@ -0,0 +1,97 @@
1
+ // (C) 2022-2024 GoodData Corporation
2
+ import { useState } from "react";
3
+ import isEqual from "lodash/isEqual.js";
4
+ import { getComparisonOperatorTitle, getMeasureTitle } from "./utils.js";
5
+ import { useIntl } from "react-intl";
6
+ export const useEditAlert = ({ alert, onCreate, onUpdate }) => {
7
+ const [viewMode, setViewMode] = useState("edit");
8
+ const [updatedAlert, setUpdatedAlert] = useState(alert);
9
+ const intl = useIntl();
10
+ const changeMeasure = (measure) => {
11
+ setUpdatedAlert((alert) => ({
12
+ ...alert,
13
+ title: getMeasureTitle(measure) ?? "",
14
+ description: `${getComparisonOperatorTitle(updatedAlert.alert.condition.operator, intl)} ${alert.alert.condition.right}`,
15
+ alert: {
16
+ ...alert.alert,
17
+ condition: {
18
+ ...alert.alert.condition,
19
+ left: measure,
20
+ },
21
+ execution: {
22
+ ...alert.alert.execution,
23
+ measures: [measure],
24
+ },
25
+ },
26
+ }));
27
+ };
28
+ const changeComparisonOperator = (comparisonOperator) => {
29
+ setUpdatedAlert((alert) => ({
30
+ ...alert,
31
+ description: `${getComparisonOperatorTitle(comparisonOperator, intl)} ${updatedAlert.alert.condition.right}`,
32
+ alert: {
33
+ ...alert.alert,
34
+ condition: {
35
+ ...alert.alert.condition,
36
+ operator: comparisonOperator,
37
+ },
38
+ },
39
+ }));
40
+ };
41
+ const changeValue = (value) => {
42
+ setUpdatedAlert((alert) => ({
43
+ ...alert,
44
+ description: `${getComparisonOperatorTitle(updatedAlert.alert.condition.operator, intl)} ${alert.alert.condition.right}`,
45
+ alert: {
46
+ ...alert.alert,
47
+ condition: {
48
+ ...alert.alert.condition,
49
+ right: value,
50
+ },
51
+ },
52
+ }));
53
+ };
54
+ const changeDestination = (destinationId) => {
55
+ setUpdatedAlert((alert) => ({
56
+ ...alert,
57
+ webhook: destinationId,
58
+ }));
59
+ };
60
+ const configureAlert = () => {
61
+ setViewMode("configuration");
62
+ };
63
+ const saveAlertConfiguration = (alert) => {
64
+ setUpdatedAlert(alert);
65
+ cancelAlertConfiguration();
66
+ };
67
+ const cancelAlertConfiguration = () => {
68
+ setViewMode("edit");
69
+ };
70
+ const createAlert = () => {
71
+ onCreate?.(updatedAlert);
72
+ };
73
+ const updateAlert = () => {
74
+ onUpdate?.(updatedAlert);
75
+ };
76
+ const isValueDefined = typeof updatedAlert.alert?.condition.right !== "undefined";
77
+ const isAlertChanged = !isEqual(updatedAlert, alert);
78
+ const canSubmit = isValueDefined && isAlertChanged;
79
+ return {
80
+ viewMode,
81
+ updatedAlert,
82
+ canSubmit,
83
+ //
84
+ changeComparisonOperator,
85
+ changeMeasure,
86
+ changeValue,
87
+ changeDestination,
88
+ //
89
+ configureAlert,
90
+ saveAlertConfiguration,
91
+ cancelAlertConfiguration,
92
+ //
93
+ createAlert,
94
+ updateAlert,
95
+ };
96
+ };
97
+ //# sourceMappingURL=useEditAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditAlert.js","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useEditAlert.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOjC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAAE,EAAE;IAC9E,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA2B,MAAM,CAAC,CAAC;IAC3E,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAA4B,KAAK,CAAC,CAAC;IACnF,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,aAAa,GAAG,CAAC,OAAiB,EAAE,EAAE;QACxC,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACxB,GAAG,KAAK;YACR,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE;YACrC,WAAW,EAAE,GAAG,0BAA0B,CAAC,YAAY,CAAC,KAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,IACpF,KAAK,CAAC,KAAM,CAAC,SAAS,CAAC,KAC3B,EAAE;YACF,KAAK,EAAE;gBACH,GAAG,KAAK,CAAC,KAAM;gBACf,SAAS,EAAE;oBACP,GAAG,KAAK,CAAC,KAAM,CAAC,SAAS;oBACzB,IAAI,EAAE,OAAO;iBAChB;gBACD,SAAS,EAAE;oBACP,GAAG,KAAK,CAAC,KAAM,CAAC,SAAS;oBACzB,QAAQ,EAAE,CAAC,OAAO,CAAC;iBACtB;aACJ;SACJ,CAAC,CAAC,CAAC;IACR,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AAE;QAChE,eAAe,CAAC,KAAK,CAAC,CAAC;QACvB,wBAAwB,EAAE,CAAC;IAC/B,CAAC,CAAC;IAEF,MAAM,wBAAwB,GAAG,GAAG,EAAE;QAClC,WAAW,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,QAAQ,EAAE,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACrB,QAAQ,EAAE,CAAC,YAAyC,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,KAAK,WAAW,CAAC;IAClF,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACrD,MAAM,SAAS,GAAG,cAAc,IAAI,cAAc,CAAC;IAEnD,OAAO;QACH,QAAQ;QACR,YAAY;QACZ,SAAS;QACT,EAAE;QACF,wBAAwB;QACxB,aAAa;QACb,WAAW;QACX,iBAAiB;QACjB,EAAE;QACF,cAAc;QACd,sBAAsB;QACtB,wBAAwB;QACxB,EAAE;QACF,WAAW;QACX,WAAW;KACd,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { IAutomationMetadataObject, IAutomationMetadataObjectDefinition, IInsightWidget } from "@gooddata/sdk-model";
2
+ import { INotificationChannel } from "./constants.js";
3
+ type InsightWidgetAlertingViewMode = "list" | "edit" | "create";
4
+ export interface IInsightWidgetAlertingProps {
5
+ widget: IInsightWidget;
6
+ closeInsightWidgetMenu: () => void;
7
+ }
8
+ export declare const useInsightWidgetAlerting: ({ widget, closeInsightWidgetMenu }: IInsightWidgetAlertingProps) => {
9
+ isLoading: boolean;
10
+ destinations: INotificationChannel[];
11
+ alerts: IAutomationMetadataObject[];
12
+ viewMode: InsightWidgetAlertingViewMode;
13
+ editingAlert: IAutomationMetadataObject | null;
14
+ creatingAlert: IAutomationMetadataObject | IAutomationMetadataObjectDefinition | null;
15
+ initiateAlertCreation: () => void;
16
+ initiateAlertEditing: (alert: IAutomationMetadataObject) => void;
17
+ updateExistingAlert: (alert: IAutomationMetadataObject) => void;
18
+ saveNewAlert: (alert: IAutomationMetadataObjectDefinition) => void;
19
+ pauseExistingAlert: (alert: IAutomationMetadataObject) => void;
20
+ resumeExistingAlert: (alert: IAutomationMetadataObject) => void;
21
+ deleteExistingAlert: (alert: IAutomationMetadataObject) => void;
22
+ cancelAlertEditing: () => void;
23
+ cancelAlertCreation: () => void;
24
+ hasAlerts: boolean;
25
+ supportedMeasures: import("@gooddata/sdk-model").IMeasure<import("@gooddata/sdk-model").IMeasureDefinitionType>[];
26
+ maxAutomationsReached: boolean;
27
+ };
28
+ export {};
29
+ //# sourceMappingURL=useInsightAlerting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInsightAlerting.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/widget/insight/configuration/InsightAlertConfig/useInsightAlerting.ts"],"names":[],"mappings":"AACA,OAAO,EACH,yBAAyB,EACzB,mCAAmC,EACnC,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAItD,KAAK,6BAA6B,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,cAAc,CAAC;IACvB,sBAAsB,EAAE,MAAM,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,wBAAwB,uCAAwC,2BAA2B;;;;;;;;kCAqF/D,yBAAyB;iCAK1B,yBAAyB;0BA/BhC,mCAAmC;gCA6C7B,yBAAyB;iCAexB,yBAAyB;iCAezB,yBAAyB;;;;;;CA+BhE,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { useToastMessage } from "@gooddata/sdk-ui-kit";
2
+ import { useEffect, useState } from "react";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ import { useDashboardSelector, selectInsightByWidgetRef, selectEntitlementMaxAutomations, selectEntitlementUnlimitedAutomations, DEFAULT_MAX_AUTOMATIONS, selectAutomationsCount, } from "../../../../../model/index.js";
5
+ import { createDefaultAlert, getSupportedInsightMeasuresByInsight } from "./utils.js";
6
+ import { messages } from "./messages.js";
7
+ import { useWidgetFilters } from "../../../common/useWidgetFilters.js";
8
+ export const useInsightWidgetAlerting = ({ widget, closeInsightWidgetMenu }) => {
9
+ const { addSuccess, addError } = useToastMessage();
10
+ const [isLoading, setIsLoading] = useState(true);
11
+ // TODO: load from backend
12
+ const [alerts, setAlerts] = useState([]);
13
+ const hasAlerts = alerts.length > 0;
14
+ // TODO: load from backend
15
+ const destinations = [
16
+ { id: "email", title: "Email" },
17
+ { id: "webhook", title: "Webhook" },
18
+ ];
19
+ const insight = useDashboardSelector(selectInsightByWidgetRef(widget.ref));
20
+ const { result: widgetFilters, status: widgetFiltersStatus } = useWidgetFilters(widget, insight);
21
+ const supportedMeasures = getSupportedInsightMeasuresByInsight(insight);
22
+ const defaultMeasure = supportedMeasures[0];
23
+ const defaultNotificationChannelId = destinations[0].id;
24
+ // Handle async widget filters state
25
+ useEffect(() => {
26
+ if (widgetFiltersStatus === "success") {
27
+ setIsLoading(false);
28
+ setDefaultAlert(createDefaultAlert(widgetFilters, defaultMeasure, defaultNotificationChannelId));
29
+ }
30
+ else if (widgetFiltersStatus === "error") {
31
+ setIsLoading(false);
32
+ closeInsightWidgetMenu();
33
+ addError(messages.alertLoadingError);
34
+ }
35
+ // Avoid infinite loop by ignoring addError
36
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37
+ }, [
38
+ closeInsightWidgetMenu,
39
+ defaultMeasure,
40
+ defaultNotificationChannelId,
41
+ widgetFilters,
42
+ widgetFiltersStatus,
43
+ ]);
44
+ const automationsCount = useDashboardSelector(selectAutomationsCount);
45
+ const maxAutomationsEntitlement = useDashboardSelector(selectEntitlementMaxAutomations);
46
+ const unlimitedAutomationsEntitlement = useDashboardSelector(selectEntitlementUnlimitedAutomations);
47
+ const maxAutomations = parseInt(maxAutomationsEntitlement?.value ?? DEFAULT_MAX_AUTOMATIONS, 10);
48
+ const maxAutomationsReached = automationsCount >= maxAutomations && !unlimitedAutomationsEntitlement;
49
+ const [viewMode, setViewMode] = useState(alerts.length > 0 ? "list" : "create");
50
+ const [defaultAlert, setDefaultAlert] = useState(null);
51
+ const [editingAlert, setEditingAlert] = useState(null);
52
+ const initiateAlertCreation = () => {
53
+ setViewMode("create");
54
+ };
55
+ const saveNewAlert = (alert) => {
56
+ const id = uuidv4();
57
+ setAlerts((alertsToUpdate) => {
58
+ const updatedAlerts = [
59
+ ...alertsToUpdate,
60
+ {
61
+ ...alert,
62
+ id,
63
+ ref: { identifier: id, type: "automation" },
64
+ uri: id,
65
+ },
66
+ ];
67
+ addSuccess(messages.alertAddSuccess);
68
+ return updatedAlerts;
69
+ });
70
+ setViewMode("list");
71
+ };
72
+ const cancelAlertCreation = () => {
73
+ if (hasAlerts) {
74
+ setViewMode("list");
75
+ }
76
+ else {
77
+ closeInsightWidgetMenu();
78
+ }
79
+ };
80
+ const initiateAlertEditing = (alert) => {
81
+ setEditingAlert(alert);
82
+ setViewMode("edit");
83
+ };
84
+ const updateExistingAlert = (alert) => {
85
+ setAlerts((alertsToUpdate) => {
86
+ const updatedAlerts = alertsToUpdate.map((a) => (a.id === alert.id ? alert : a));
87
+ addSuccess(messages.alertUpdateSuccess);
88
+ return updatedAlerts;
89
+ });
90
+ cancelAlertEditing();
91
+ };
92
+ const cancelAlertEditing = () => {
93
+ setEditingAlert(null);
94
+ setViewMode("list");
95
+ };
96
+ const pauseExistingAlert = (alert) => {
97
+ setAlerts((alertsToUpdate) => {
98
+ const updatedAlerts = alertsToUpdate.map((a) => a.id === alert.id
99
+ ? {
100
+ ...a,
101
+ alert: { ...a.alert, trigger: { ...a.alert?.trigger, state: "PAUSED" } },
102
+ }
103
+ : a);
104
+ addSuccess(messages.alertPauseSuccess);
105
+ return updatedAlerts;
106
+ });
107
+ };
108
+ const resumeExistingAlert = (alert) => {
109
+ setAlerts((alertsToUpdate) => {
110
+ const updatedAlerts = alertsToUpdate.map((a) => a.id === alert.id
111
+ ? {
112
+ ...a,
113
+ alert: { ...a.alert, trigger: { ...a.alert?.trigger, state: "ACTIVE" } },
114
+ }
115
+ : a);
116
+ addSuccess(messages.alertResumeSuccess);
117
+ return updatedAlerts;
118
+ });
119
+ };
120
+ const deleteExistingAlert = (alert) => {
121
+ setAlerts((alertsToUpdate) => {
122
+ const updatedAlerts = alertsToUpdate.filter((a) => a.id !== alert.id);
123
+ if (updatedAlerts.length === 0) {
124
+ closeInsightWidgetMenu();
125
+ }
126
+ addSuccess(messages.alertDeleteSuccess);
127
+ return updatedAlerts;
128
+ });
129
+ };
130
+ return {
131
+ isLoading,
132
+ destinations,
133
+ alerts,
134
+ viewMode,
135
+ editingAlert,
136
+ creatingAlert: defaultAlert,
137
+ initiateAlertCreation,
138
+ initiateAlertEditing,
139
+ updateExistingAlert,
140
+ saveNewAlert,
141
+ pauseExistingAlert,
142
+ resumeExistingAlert,
143
+ deleteExistingAlert,
144
+ cancelAlertEditing,
145
+ cancelAlertCreation,
146
+ hasAlerts,
147
+ supportedMeasures,
148
+ maxAutomationsReached,
149
+ };
150
+ };
151
+ //# sourceMappingURL=useInsightAlerting.js.map