@gooddata/sdk-ui-dashboard 10.15.0-alpha.0 → 10.15.0-alpha.10

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 (278) 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/model/commandHandlers/dashboard/common/stateInitializers.d.ts.map +1 -1
  6. package/esm/model/commandHandlers/dashboard/common/stateInitializers.js +9 -2
  7. package/esm/model/commandHandlers/dashboard/common/stateInitializers.js.map +1 -1
  8. package/esm/model/commandHandlers/drill/common/intersectionUtils.d.ts.map +1 -1
  9. package/esm/model/commandHandlers/drill/common/intersectionUtils.js +2 -2
  10. package/esm/model/commandHandlers/drill/common/intersectionUtils.js.map +1 -1
  11. package/esm/model/commandHandlers/drill/crossFilteringHandler.d.ts.map +1 -1
  12. package/esm/model/commandHandlers/drill/crossFilteringHandler.js +4 -2
  13. package/esm/model/commandHandlers/drill/crossFilteringHandler.js.map +1 -1
  14. package/esm/model/commandHandlers/drill/drillToDashboardHandler.d.ts.map +1 -1
  15. package/esm/model/commandHandlers/drill/drillToDashboardHandler.js +4 -3
  16. package/esm/model/commandHandlers/drill/drillToDashboardHandler.js.map +1 -1
  17. package/esm/model/index.d.ts +2 -2
  18. package/esm/model/index.d.ts.map +1 -1
  19. package/esm/model/index.js +1 -1
  20. package/esm/model/index.js.map +1 -1
  21. package/esm/model/queryServices/queryWidgetFilters.d.ts.map +1 -1
  22. package/esm/model/queryServices/queryWidgetFilters.js +2 -2
  23. package/esm/model/queryServices/queryWidgetFilters.js.map +1 -1
  24. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmails.d.ts +1 -1
  25. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmailsData.d.ts +1 -1
  26. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmailsData.js +2 -2
  27. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmailsData.js.map +1 -1
  28. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmailsFilters.d.ts +2 -2
  29. package/esm/model/react/useDasboardScheduledEmails/useDashboardScheduledEmailsFilters.d.ts.map +1 -1
  30. package/esm/model/react/useDasboardScheduledEmails/useFiltersForWidgetScheduledExport.d.ts +2 -2
  31. package/esm/model/react/useDasboardScheduledEmails/useFiltersForWidgetScheduledExport.d.ts.map +1 -1
  32. package/esm/model/react/useWidgetFilters.d.ts +2 -2
  33. package/esm/model/react/useWidgetFilters.d.ts.map +1 -1
  34. package/esm/model/react/useWidgetFilters.js.map +1 -1
  35. package/esm/model/store/_infra/generators.d.ts +3 -0
  36. package/esm/model/store/_infra/generators.d.ts.map +1 -0
  37. package/esm/model/store/_infra/generators.js +6 -0
  38. package/esm/model/store/_infra/generators.js.map +1 -0
  39. package/esm/model/store/filterContext/filterContextReducers.d.ts.map +1 -1
  40. package/esm/model/store/filterContext/filterContextReducers.js +5 -5
  41. package/esm/model/store/filterContext/filterContextReducers.js.map +1 -1
  42. package/esm/model/store/layout/layoutSelectors.d.ts +1 -1
  43. package/esm/model/store/layout/layoutSelectors.d.ts.map +1 -1
  44. package/esm/model/store/layout/layoutSelectors.js +6 -3
  45. package/esm/model/store/layout/layoutSelectors.js.map +1 -1
  46. package/esm/model/store/layout/layoutUtils.d.ts +1 -1
  47. package/esm/model/store/layout/layoutUtils.d.ts.map +1 -1
  48. package/esm/model/types/layoutTypes.d.ts +22 -2
  49. package/esm/model/types/layoutTypes.d.ts.map +1 -1
  50. package/esm/model/types/layoutTypes.js +9 -2
  51. package/esm/model/types/layoutTypes.js.map +1 -1
  52. package/esm/presentation/alerting/DefaultAlertingDialog/DefaultAlertingDialog.d.ts.map +1 -1
  53. package/esm/presentation/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js +2 -2
  54. package/esm/presentation/alerting/DefaultAlertingDialog/DefaultAlertingDialog.js.map +1 -1
  55. package/esm/presentation/alerting/DefaultAlertingManagementDialog/components/Alert.d.ts.map +1 -1
  56. package/esm/presentation/alerting/DefaultAlertingManagementDialog/components/Alert.js +2 -2
  57. package/esm/presentation/alerting/DefaultAlertingManagementDialog/components/Alert.js.map +1 -1
  58. package/esm/presentation/componentDefinition/types.d.ts +28 -5
  59. package/esm/presentation/componentDefinition/types.d.ts.map +1 -1
  60. package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.d.ts +2 -1
  61. package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.d.ts.map +1 -1
  62. package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.js +8 -2
  63. package/esm/presentation/dashboard/DashboardSidebar/CreationPanel.js.map +1 -1
  64. package/esm/presentation/dashboard/DashboardSidebar/DashboardSidebar.d.ts.map +1 -1
  65. package/esm/presentation/dashboard/DashboardSidebar/DashboardSidebar.js +2 -2
  66. package/esm/presentation/dashboard/DashboardSidebar/DashboardSidebar.js.map +1 -1
  67. package/esm/presentation/dashboard/DashboardSidebar/SidebarConfigurationPanel.d.ts.map +1 -1
  68. package/esm/presentation/dashboard/DashboardSidebar/SidebarConfigurationPanel.js +2 -2
  69. package/esm/presentation/dashboard/DashboardSidebar/SidebarConfigurationPanel.js.map +1 -1
  70. package/esm/presentation/dashboard/DashboardSidebar/types.d.ts +8 -1
  71. package/esm/presentation/dashboard/DashboardSidebar/types.d.ts.map +1 -1
  72. package/esm/presentation/dashboard/DefaultDashboardContent/DefaultDashboardMainContent.d.ts.map +1 -1
  73. package/esm/presentation/dashboard/DefaultDashboardContent/DefaultDashboardMainContent.js +2 -0
  74. package/esm/presentation/dashboard/DefaultDashboardContent/DefaultDashboardMainContent.js.map +1 -1
  75. package/esm/presentation/dashboard/components/DashboardMainContent.d.ts.map +1 -1
  76. package/esm/presentation/dashboard/components/DashboardMainContent.js +2 -0
  77. package/esm/presentation/dashboard/components/DashboardMainContent.js.map +1 -1
  78. package/esm/presentation/dashboard/components/DashboardRenderer.d.ts.map +1 -1
  79. package/esm/presentation/dashboard/components/DashboardRenderer.js +2 -2
  80. package/esm/presentation/dashboard/components/DashboardRenderer.js.map +1 -1
  81. package/esm/presentation/dashboard/hooks/useDashboard.d.ts +4 -2
  82. package/esm/presentation/dashboard/hooks/useDashboard.d.ts.map +1 -1
  83. package/esm/presentation/dashboard/hooks/useDashboard.js +11 -2
  84. package/esm/presentation/dashboard/hooks/useDashboard.js.map +1 -1
  85. package/esm/presentation/dashboard/types.d.ts +13 -1
  86. package/esm/presentation/dashboard/types.d.ts.map +1 -1
  87. package/esm/presentation/dashboardContexts/DashboardComponentsContext.d.ts +2 -1
  88. package/esm/presentation/dashboardContexts/DashboardComponentsContext.d.ts.map +1 -1
  89. package/esm/presentation/dashboardContexts/DashboardComponentsContext.js +1 -0
  90. package/esm/presentation/dashboardContexts/DashboardComponentsContext.js.map +1 -1
  91. package/esm/presentation/dashboardContexts/types.d.ts +11 -3
  92. package/esm/presentation/dashboardContexts/types.d.ts.map +1 -1
  93. package/esm/presentation/dragAndDrop/DragLayerPreview/ContentDragPreview.d.ts.map +1 -1
  94. package/esm/presentation/dragAndDrop/DragLayerPreview/ContentDragPreview.js +3 -1
  95. package/esm/presentation/dragAndDrop/DragLayerPreview/ContentDragPreview.js.map +1 -1
  96. package/esm/presentation/dragAndDrop/draggableWidget/AddDashboardLayoutWidgetButton.d.ts +3 -0
  97. package/esm/presentation/dragAndDrop/draggableWidget/AddDashboardLayoutWidgetButton.d.ts.map +1 -0
  98. package/esm/presentation/dragAndDrop/draggableWidget/AddDashboardLayoutWidgetButton.js +25 -0
  99. package/esm/presentation/dragAndDrop/draggableWidget/AddDashboardLayoutWidgetButton.js.map +1 -0
  100. package/esm/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.js +1 -1
  101. package/esm/presentation/dragAndDrop/draggableWidget/AddRichTextWidgetButton.js.map +1 -1
  102. package/esm/presentation/dragAndDrop/draggableWidget/AddVisualizationSwitcherWidgetButton.js +3 -3
  103. package/esm/presentation/dragAndDrop/draggableWidget/AddVisualizationSwitcherWidgetButton.js.map +1 -1
  104. package/esm/presentation/dragAndDrop/draggableWidget/DashboardLayoutDraggingComponent.d.ts +4 -0
  105. package/esm/presentation/dragAndDrop/draggableWidget/DashboardLayoutDraggingComponent.d.ts.map +1 -0
  106. package/esm/presentation/dragAndDrop/draggableWidget/DashboardLayoutDraggingComponent.js +10 -0
  107. package/esm/presentation/dragAndDrop/draggableWidget/DashboardLayoutDraggingComponent.js.map +1 -0
  108. package/esm/presentation/dragAndDrop/draggableWidget/DraggableDashboardLayoutCreatePanelItem.d.ts +16 -0
  109. package/esm/presentation/dragAndDrop/draggableWidget/DraggableDashboardLayoutCreatePanelItem.d.ts.map +1 -0
  110. package/esm/presentation/dragAndDrop/draggableWidget/DraggableDashboardLayoutCreatePanelItem.js +21 -0
  111. package/esm/presentation/dragAndDrop/draggableWidget/DraggableDashboardLayoutCreatePanelItem.js.map +1 -0
  112. package/esm/presentation/dragAndDrop/draggableWidget/DraggableVisualizationSwitcherCreatePanelItem.d.ts +2 -2
  113. package/esm/presentation/dragAndDrop/draggableWidget/DraggableVisualizationSwitcherCreatePanelItem.d.ts.map +1 -1
  114. package/esm/presentation/dragAndDrop/draggableWidget/EmptyDashboardDropZone.d.ts.map +1 -1
  115. package/esm/presentation/dragAndDrop/draggableWidget/EmptyDashboardDropZone.js +11 -1
  116. package/esm/presentation/dragAndDrop/draggableWidget/EmptyDashboardDropZone.js.map +1 -1
  117. package/esm/presentation/dragAndDrop/draggableWidget/Hotspot.d.ts.map +1 -1
  118. package/esm/presentation/dragAndDrop/draggableWidget/Hotspot.js +10 -1
  119. package/esm/presentation/dragAndDrop/draggableWidget/Hotspot.js.map +1 -1
  120. package/esm/presentation/dragAndDrop/draggableWidget/SectionHotspot.d.ts.map +1 -1
  121. package/esm/presentation/dragAndDrop/draggableWidget/SectionHotspot.js +9 -1
  122. package/esm/presentation/dragAndDrop/draggableWidget/SectionHotspot.js.map +1 -1
  123. package/esm/presentation/dragAndDrop/draggableWidget/WidgetDropZoneColumn.d.ts.map +1 -1
  124. package/esm/presentation/dragAndDrop/draggableWidget/WidgetDropZoneColumn.js +11 -1
  125. package/esm/presentation/dragAndDrop/draggableWidget/WidgetDropZoneColumn.js.map +1 -1
  126. package/esm/presentation/dragAndDrop/draggableWidget/index.d.ts +3 -0
  127. package/esm/presentation/dragAndDrop/draggableWidget/index.d.ts.map +1 -1
  128. package/esm/presentation/dragAndDrop/draggableWidget/index.js +3 -0
  129. package/esm/presentation/dragAndDrop/draggableWidget/index.js.map +1 -1
  130. package/esm/presentation/dragAndDrop/draggableWidget/useDashboardLayoutPlaceholderDropHandler.d.ts +2 -0
  131. package/esm/presentation/dragAndDrop/draggableWidget/useDashboardLayoutPlaceholderDropHandler.d.ts.map +1 -0
  132. package/esm/presentation/dragAndDrop/draggableWidget/useDashboardLayoutPlaceholderDropHandler.js +39 -0
  133. package/esm/presentation/dragAndDrop/draggableWidget/useDashboardLayoutPlaceholderDropHandler.js.map +1 -0
  134. package/esm/presentation/dragAndDrop/draggableWidget/useIsDraggingWidget.d.ts.map +1 -1
  135. package/esm/presentation/dragAndDrop/draggableWidget/useIsDraggingWidget.js +2 -0
  136. package/esm/presentation/dragAndDrop/draggableWidget/useIsDraggingWidget.js.map +1 -1
  137. package/esm/presentation/dragAndDrop/draggableWidget/useNewSectionDashboardLayoutPlaceholderDropHandler.d.ts +2 -0
  138. package/esm/presentation/dragAndDrop/draggableWidget/useNewSectionDashboardLayoutPlaceholderDropHandler.d.ts.map +1 -0
  139. package/esm/presentation/dragAndDrop/draggableWidget/useNewSectionDashboardLayoutPlaceholderDropHandler.js +46 -0
  140. package/esm/presentation/dragAndDrop/draggableWidget/useNewSectionDashboardLayoutPlaceholderDropHandler.js.map +1 -0
  141. package/esm/presentation/dragAndDrop/types.d.ts +25 -3
  142. package/esm/presentation/dragAndDrop/types.d.ts.map +1 -1
  143. package/esm/presentation/dragAndDrop/types.js +12 -0
  144. package/esm/presentation/dragAndDrop/types.js.map +1 -1
  145. package/esm/presentation/dragAndDrop/useDashboardDragScroll.d.ts.map +1 -1
  146. package/esm/presentation/dragAndDrop/useDashboardDragScroll.js +2 -0
  147. package/esm/presentation/dragAndDrop/useDashboardDragScroll.js.map +1 -1
  148. package/esm/presentation/drill/DrillConfigPanel/DrillToUrl/CustomUrlEditor.js +2 -2
  149. package/esm/presentation/drill/DrillConfigPanel/DrillToUrl/CustomUrlEditor.js.map +1 -1
  150. package/esm/presentation/filterBar/attributeFilter/DefaultDashboardAttributeFilterComponentSetFactory.js +1 -1
  151. package/esm/presentation/filterBar/attributeFilter/DefaultDashboardAttributeFilterComponentSetFactory.js.map +1 -1
  152. package/esm/presentation/flexibleLayout/DashboardLayoutWidget.d.ts.map +1 -1
  153. package/esm/presentation/flexibleLayout/DashboardLayoutWidget.js +13 -2
  154. package/esm/presentation/flexibleLayout/DashboardLayoutWidget.js.map +1 -1
  155. package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.d.ts.map +1 -1
  156. package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.js +2 -1
  157. package/esm/presentation/flexibleLayout/DefaultFlexibleDashboardLayout.js.map +1 -1
  158. package/esm/presentation/flexibleLayout/index.d.ts +1 -1
  159. package/esm/presentation/flexibleLayout/index.d.ts.map +1 -1
  160. package/esm/presentation/flexibleLayout/index.js +1 -1
  161. package/esm/presentation/flexibleLayout/index.js.map +1 -1
  162. package/esm/presentation/flexibleLayout/types.d.ts +1 -20
  163. package/esm/presentation/flexibleLayout/types.d.ts.map +1 -1
  164. package/esm/presentation/layout/DashboardLayoutWidget.d.ts.map +1 -1
  165. package/esm/presentation/layout/DashboardLayoutWidget.js +13 -2
  166. package/esm/presentation/layout/DashboardLayoutWidget.js.map +1 -1
  167. package/esm/presentation/localization/bundles/en-AU.json +27 -27
  168. package/esm/presentation/localization/bundles/en-GB.json +15 -15
  169. package/esm/presentation/localization/bundles/en-US.json +10 -0
  170. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts.map +1 -1
  171. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js +3 -3
  172. package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js.map +1 -1
  173. package/esm/presentation/widget/dashboardLayout/CreatableDashboardLayout.d.ts +7 -0
  174. package/esm/presentation/widget/dashboardLayout/CreatableDashboardLayout.d.ts.map +1 -0
  175. package/esm/presentation/widget/dashboardLayout/CreatableDashboardLayout.js +13 -0
  176. package/esm/presentation/widget/dashboardLayout/CreatableDashboardLayout.js.map +1 -0
  177. package/esm/presentation/{flexibleLayout → widget/dashboardLayout}/DashboardLayout.d.ts +1 -1
  178. package/esm/presentation/widget/dashboardLayout/DashboardLayout.d.ts.map +1 -0
  179. package/esm/presentation/{flexibleLayout → widget/dashboardLayout}/DashboardLayout.js +1 -1
  180. package/esm/presentation/widget/dashboardLayout/DashboardLayout.js.map +1 -0
  181. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayout.d.ts +8 -0
  182. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayout.d.ts.map +1 -0
  183. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayout.js +13 -0
  184. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayout.js.map +1 -0
  185. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayoutComponentSetFactory.d.ts +7 -0
  186. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayoutComponentSetFactory.d.ts.map +1 -0
  187. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayoutComponentSetFactory.js +24 -0
  188. package/esm/presentation/widget/dashboardLayout/DefaultDashboardLayoutComponentSetFactory.js.map +1 -0
  189. package/esm/presentation/widget/dashboardLayout/index.d.ts +4 -0
  190. package/esm/presentation/widget/dashboardLayout/index.d.ts.map +1 -0
  191. package/esm/presentation/widget/dashboardLayout/index.js +4 -0
  192. package/esm/presentation/widget/dashboardLayout/index.js.map +1 -0
  193. package/esm/presentation/widget/dashboardLayout/types.d.ts +55 -0
  194. package/esm/presentation/widget/dashboardLayout/types.d.ts.map +1 -0
  195. package/esm/presentation/widget/dashboardLayout/types.js +3 -0
  196. package/esm/presentation/widget/dashboardLayout/types.js.map +1 -0
  197. package/esm/presentation/widget/index.d.ts +1 -0
  198. package/esm/presentation/widget/index.d.ts.map +1 -1
  199. package/esm/presentation/widget/index.js +1 -0
  200. package/esm/presentation/widget/index.js.map +1 -1
  201. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelect.d.ts +16 -0
  202. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelect.d.ts.map +1 -0
  203. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelect.js +133 -0
  204. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelect.js.map +1 -0
  205. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.d.ts.map +1 -1
  206. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js +1 -1
  207. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertMeasureSelect.js.map +1 -1
  208. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.d.ts.map +1 -1
  209. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js +3 -3
  210. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertsListItem.js.map +1 -1
  211. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts +3 -2
  212. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.d.ts.map +1 -1
  213. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js +2 -2
  214. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/CreateAlert.js.map +1 -1
  215. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts +3 -2
  216. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.d.ts.map +1 -1
  217. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js +10 -10
  218. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/EditAlert.js.map +1 -1
  219. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useAlertValidation.d.ts.map +1 -1
  220. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useAlertValidation.js +2 -1
  221. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useAlertValidation.js.map +1 -1
  222. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts +8 -3
  223. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
  224. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +2 -1
  225. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js.map +1 -1
  226. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useInsightAlerting.d.ts +3 -2
  227. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useInsightAlerting.d.ts.map +1 -1
  228. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useInsightAlerting.js +16 -18
  229. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useInsightAlerting.js.map +1 -1
  230. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/convertors.d.ts +7 -0
  231. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/convertors.d.ts.map +1 -0
  232. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/convertors.js +43 -0
  233. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/convertors.js.map +1 -0
  234. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/getters.d.ts +90 -0
  235. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/getters.d.ts.map +1 -0
  236. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/getters.js +220 -0
  237. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/getters.js.map +1 -0
  238. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/guards.d.ts +22 -0
  239. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/guards.d.ts.map +1 -0
  240. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/guards.js +41 -0
  241. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/guards.js.map +1 -0
  242. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/items.d.ts +14 -0
  243. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/items.d.ts.map +1 -0
  244. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/items.js +202 -0
  245. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/items.js.map +1 -0
  246. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/transformation.d.ts +64 -0
  247. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/transformation.d.ts.map +1 -0
  248. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/transformation.js +303 -0
  249. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils/transformation.js.map +1 -0
  250. package/esm/presentation/widget/insight/configuration/InsightAlerts.d.ts.map +1 -1
  251. package/esm/presentation/widget/insight/configuration/InsightAlerts.js +3 -3
  252. package/esm/presentation/widget/insight/configuration/InsightAlerts.js.map +1 -1
  253. package/esm/presentation/widget/insight/types.d.ts +1 -0
  254. package/esm/presentation/widget/insight/types.d.ts.map +1 -1
  255. package/esm/presentation/widget/types.d.ts +1 -0
  256. package/esm/presentation/widget/types.d.ts.map +1 -1
  257. package/esm/presentation/widget/widget/DefaultDashboardWidget.js +1 -1
  258. package/esm/presentation/widget/widget/DefaultDashboardWidget.js.map +1 -1
  259. package/esm/sdk-ui-dashboard.d.ts +179 -12
  260. package/package.json +15 -15
  261. package/styles/css/alerting.css +2 -0
  262. package/styles/css/alerting.css.map +1 -1
  263. package/styles/css/main.css +11 -14
  264. package/styles/css/main.css.map +1 -1
  265. package/styles/css/sidebar.css +9 -14
  266. package/styles/css/sidebar.css.map +1 -1
  267. package/styles/scss/alerting.scss +2 -0
  268. package/styles/scss/sidebar.scss +10 -18
  269. package/esm/presentation/flexibleLayout/DashboardLayout.d.ts.map +0 -1
  270. package/esm/presentation/flexibleLayout/DashboardLayout.js.map +0 -1
  271. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelecxt.d.ts +0 -14
  272. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelecxt.d.ts.map +0 -1
  273. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelecxt.js +0 -139
  274. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/AlertAttributeSelecxt.js.map +0 -1
  275. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts +0 -46
  276. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.d.ts.map +0 -1
  277. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js +0 -712
  278. package/esm/presentation/widget/insight/configuration/InsightAlertConfig/utils.js.map +0 -1
@@ -1,712 +0,0 @@
1
- // (C) 2024 GoodData Corporation
2
- import { attributeAlias, bucketAttributes, bucketMeasures, insightBucket, insightVisualizationType, isArithmeticMeasure, isAttributeElementsByValue, isLocalIdRef, isNegativeAttributeFilter, isPoPMeasure, isPositiveAttributeFilter, isPreviousPeriodMeasure, isSimpleMeasure, measureAlias, measureIdentifier, measureTitle, } from "@gooddata/sdk-model";
3
- import { BucketNames } from "@gooddata/sdk-ui";
4
- import { AlertMetricComparatorType, } from "../../types.js";
5
- import { COMPARISON_OPERATORS, RELATIVE_OPERATORS, ARITHMETIC_OPERATORS, DEFAULT_MEASURE_FORMAT, } from "./constants.js";
6
- import { messages } from "./messages.js";
7
- /**
8
- * @internal
9
- */
10
- export const getMeasureTitle = (measure) => {
11
- return measure ? measureAlias(measure) ?? measureTitle(measure) : undefined;
12
- };
13
- /**
14
- * @internal
15
- */
16
- export const getAttributeTitle = (attribute) => {
17
- return attribute ? attributeAlias(attribute) : undefined;
18
- };
19
- export const getOperatorTitle = (intl, alert) => {
20
- if (alert?.condition.type === "relative") {
21
- return getRelativeOperatorTitle(alert.condition.operator, alert.condition.measure.operator, intl);
22
- }
23
- if (alert?.condition.type === "comparison") {
24
- return getComparisonOperatorTitle(alert.condition.operator, intl);
25
- }
26
- return "";
27
- };
28
- /**
29
- * @internal
30
- */
31
- const getComparisonOperatorTitle = (operator, intl) => {
32
- const titleByOperator = {
33
- [COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN]: messages.comparisonOperatorLessThan.id,
34
- [COMPARISON_OPERATORS.COMPARISON_OPERATOR_LESS_THAN_OR_EQUAL_TO]: messages.comparisonOperatorLessThanOrEquals.id,
35
- [COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN]: messages.comparisonOperatorGreaterThan.id,
36
- [COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN_OR_EQUAL_TO]: messages.comparisonOperatorGreaterThanOrEquals.id,
37
- };
38
- return intl.formatMessage({ id: titleByOperator[operator] });
39
- };
40
- /**
41
- * @internal
42
- */
43
- const getRelativeOperatorTitle = (operator, art, intl) => {
44
- const titleByOperator = {
45
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_INCREASE_BY}`]: messages.comparisonOperatorChangeIncreasesBy.id,
46
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_DECREASE_BY}`]: messages.comparisonOperatorChangeDecreasesBy.id,
47
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_CHANGES_BY}`]: messages.comparisonOperatorChangeChangesBy.id,
48
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_DIFFERENCE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_INCREASE_BY}`]: messages.comparisonOperatorDifferenceIncreasesBy.id,
49
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_DIFFERENCE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_DECREASE_BY}`]: messages.comparisonOperatorDifferenceDecreasesBy.id,
50
- [`${ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_DIFFERENCE}.${RELATIVE_OPERATORS.RELATIVE_OPERATOR_CHANGES_BY}`]: messages.comparisonOperatorDifferenceChangesBy.id,
51
- };
52
- return intl.formatMessage({ id: titleByOperator[`${art}.${operator}`] });
53
- };
54
- /**
55
- * @internal
56
- */
57
- export const createDefaultAlert = (filters, metrics, measure, notificationChannelId, currentUser, catalogMeasures = [], comparisonOperator = "GREATER_THAN") => {
58
- const condition = {
59
- type: "comparison",
60
- left: {
61
- id: measure.measure.measure.localIdentifier,
62
- format: getMeasureFormat(measure.measure, catalogMeasures),
63
- title: getMeasureTitle(measure.measure),
64
- },
65
- operator: comparisonOperator,
66
- right: undefined,
67
- };
68
- const execution = {
69
- attributes: [],
70
- measures: [measure.measure],
71
- filters,
72
- };
73
- return {
74
- type: "automation",
75
- title: getMeasureTitle(measure.measure),
76
- notificationChannel: notificationChannelId,
77
- alert: {
78
- condition,
79
- execution: {
80
- ...execution,
81
- ...transformAlertExecutionByMetric(metrics, condition, {
82
- attributes: [],
83
- measures: [measure.measure],
84
- filters,
85
- }, measure),
86
- },
87
- trigger: {
88
- state: "ACTIVE",
89
- },
90
- },
91
- recipients: [currentUser],
92
- };
93
- };
94
- export const getSupportedInsightMeasuresByInsight = (insight) => {
95
- const insightType = insight ? insightVisualizationType(insight) : null;
96
- const { primaries, others } = collectAllMetric(insight);
97
- const simpleMetrics = [
98
- ...primaries.map(transformMeasure(true)).filter(Boolean),
99
- ...others.map(transformMeasure(false)).filter(Boolean),
100
- ];
101
- //NOTE: For now only headline insight support previous period and same period previous year,
102
- // if we want to support other insight types, just add the logic here or remove the condition at
103
- // all to support all insight types
104
- if (insightType === "headline") {
105
- transformPreviousPeriodMeasure(primaries, simpleMetrics, true);
106
- transformPreviousPeriodMeasure(others, simpleMetrics, false);
107
- transformPoPMeasure(primaries, simpleMetrics, true);
108
- transformPoPMeasure(others, simpleMetrics, false);
109
- }
110
- return simpleMetrics;
111
- };
112
- export const getSupportedInsightAttributesByInsight = (insight) => {
113
- const attributes = collectAllAttributes(insight);
114
- return attributes
115
- .map(transformAttribute())
116
- .filter(Boolean);
117
- };
118
- function transformMeasure(isPrimary) {
119
- return (measure) => {
120
- if (isSimpleMeasure(measure) || isArithmeticMeasure(measure)) {
121
- return {
122
- measure,
123
- isPrimary,
124
- comparators: [],
125
- };
126
- }
127
- return undefined;
128
- };
129
- }
130
- function transformAttribute() {
131
- return (attribute) => {
132
- return {
133
- attribute,
134
- };
135
- };
136
- }
137
- function transformPreviousPeriodMeasure(metrics, simpleMetrics, isPrimary) {
138
- const previousPeriodMetrics = metrics.filter((measure) => isPreviousPeriodMeasure(measure));
139
- previousPeriodMetrics.forEach((measure) => {
140
- const found = simpleMetrics.find((simpleMetric) => simpleMetric.measure.measure.localIdentifier ===
141
- measure.measure.definition.previousPeriodMeasure.measureIdentifier);
142
- if (found) {
143
- found.comparators.push({
144
- measure,
145
- isPrimary,
146
- comparator: AlertMetricComparatorType.PreviousPeriod,
147
- });
148
- }
149
- });
150
- }
151
- function transformPoPMeasure(metrics, simpleMetrics, isPrimary) {
152
- const popMetrics = metrics.filter((measure) => isPoPMeasure(measure));
153
- popMetrics.forEach((measure) => {
154
- const found = simpleMetrics.find((simpleMetric) => simpleMetric.measure.measure.localIdentifier ===
155
- measure.measure.definition.popMeasureDefinition.measureIdentifier);
156
- if (found) {
157
- found.comparators.push({
158
- measure,
159
- isPrimary,
160
- comparator: AlertMetricComparatorType.SamePeriodPreviousYear,
161
- });
162
- }
163
- });
164
- }
165
- function collectAllMetric(insight) {
166
- const insightType = insight ? insightVisualizationType(insight) : null;
167
- if (!insight) {
168
- return {
169
- primaries: [],
170
- others: [],
171
- };
172
- }
173
- switch (insightType) {
174
- case "headline":
175
- case "bar":
176
- case "column":
177
- case "line":
178
- case "area":
179
- case "combo2":
180
- case "scatter":
181
- case "bubble":
182
- case "bullet":
183
- case "pie":
184
- case "donut":
185
- case "treemap":
186
- case "funnel":
187
- case "pyramid":
188
- case "heatmap":
189
- case "waterfall":
190
- case "dependencywheel":
191
- case "sankey":
192
- case "table": {
193
- return collectAllMetricsDefault(insight);
194
- }
195
- case "pushpin": {
196
- return collectAllMetricsPushpin(insight);
197
- }
198
- case "repeater": {
199
- return collectAllMetricsRepeater(insight);
200
- }
201
- default: {
202
- return {
203
- primaries: [],
204
- others: [],
205
- };
206
- }
207
- }
208
- }
209
- function collectAllMetricsDefault(insight) {
210
- const insightMeasuresBucket = insight
211
- ? insightBucket(insight, BucketNames.MEASURES)
212
- : undefined;
213
- const insightSecondaryMeasuresBucket = insight
214
- ? insightBucket(insight, BucketNames.SECONDARY_MEASURES)
215
- : undefined;
216
- const insightTertiaryMeasuresBucket = insight
217
- ? insightBucket(insight, BucketNames.TERTIARY_MEASURES)
218
- : undefined;
219
- return {
220
- primaries: insightMeasuresBucket ? bucketMeasures(insightMeasuresBucket) : [],
221
- others: [
222
- ...(insightSecondaryMeasuresBucket ? bucketMeasures(insightSecondaryMeasuresBucket) : []),
223
- ...(insightTertiaryMeasuresBucket ? bucketMeasures(insightTertiaryMeasuresBucket) : []),
224
- ],
225
- };
226
- }
227
- function collectAllMetricsPushpin(insight) {
228
- const insightSizeBucket = insight
229
- ? insightBucket(insight, BucketNames.SIZE)
230
- : undefined;
231
- const insightColorBucket = insight
232
- ? insightBucket(insight, BucketNames.COLOR)
233
- : undefined;
234
- return {
235
- primaries: [
236
- ...(insightSizeBucket ? bucketMeasures(insightSizeBucket) : []),
237
- ...(insightColorBucket ? bucketMeasures(insightColorBucket) : []),
238
- ],
239
- others: [],
240
- };
241
- }
242
- function collectAllMetricsRepeater(insight) {
243
- const insightColumnsBucket = insight
244
- ? insightBucket(insight, BucketNames.COLUMNS)
245
- : undefined;
246
- return {
247
- primaries: insightColumnsBucket ? bucketMeasures(insightColumnsBucket) : [],
248
- others: [],
249
- };
250
- }
251
- function collectAllAttributes(insight) {
252
- const insightType = insight ? insightVisualizationType(insight) : null;
253
- if (!insight) {
254
- return [];
255
- }
256
- switch (insightType) {
257
- case "headline":
258
- case "bar":
259
- case "column":
260
- case "line":
261
- case "area":
262
- case "combo2":
263
- case "scatter":
264
- case "bubble":
265
- case "bullet":
266
- case "pie":
267
- case "donut":
268
- case "treemap":
269
- case "funnel":
270
- case "pyramid":
271
- case "heatmap":
272
- case "waterfall":
273
- case "dependencywheel":
274
- case "sankey":
275
- case "pushpin":
276
- case "repeater":
277
- case "table": {
278
- return collectAllAttributesDefault(insight);
279
- }
280
- default: {
281
- return [];
282
- }
283
- }
284
- }
285
- function collectAllAttributesDefault(insight) {
286
- const insightAttributeBucket = insight
287
- ? insightBucket(insight, BucketNames.ATTRIBUTE)
288
- : undefined;
289
- const insightAttributesBucket = insight
290
- ? insightBucket(insight, BucketNames.ATTRIBUTES)
291
- : undefined;
292
- const insightTrendBucket = insight
293
- ? insightBucket(insight, BucketNames.TREND)
294
- : undefined;
295
- const insightSegmentBucket = insight
296
- ? insightBucket(insight, BucketNames.SEGMENT)
297
- : undefined;
298
- const insightColumnsBucket = insight
299
- ? insightBucket(insight, BucketNames.COLUMNS)
300
- : undefined;
301
- const insightViewBucket = insight
302
- ? insightBucket(insight, BucketNames.VIEW)
303
- : undefined;
304
- const insightStackBucket = insight
305
- ? insightBucket(insight, BucketNames.STACK)
306
- : undefined;
307
- const insightAttributeFromBucket = insight
308
- ? insightBucket(insight, BucketNames.ATTRIBUTE_FROM)
309
- : undefined;
310
- const insightAttributeToBucket = insight
311
- ? insightBucket(insight, BucketNames.ATTRIBUTE_TO)
312
- : undefined;
313
- return [
314
- ...(insightAttributeBucket ? bucketAttributes(insightAttributeBucket) : []),
315
- ...(insightAttributesBucket ? bucketAttributes(insightAttributesBucket) : []),
316
- ...(insightTrendBucket ? bucketAttributes(insightTrendBucket) : []),
317
- ...(insightSegmentBucket ? bucketAttributes(insightSegmentBucket) : []),
318
- ...(insightColumnsBucket ? bucketAttributes(insightColumnsBucket) : []),
319
- ...(insightViewBucket ? bucketAttributes(insightViewBucket) : []),
320
- ...(insightStackBucket ? bucketAttributes(insightStackBucket) : []),
321
- ...(insightAttributeFromBucket ? bucketAttributes(insightAttributeFromBucket) : []),
322
- ...(insightAttributeToBucket ? bucketAttributes(insightAttributeToBucket) : []),
323
- ];
324
- }
325
- export function getValueSuffix(alert) {
326
- if (isChangeOperator(alert)) {
327
- return "%";
328
- }
329
- if (isDifferenceOperator(alert)) {
330
- return undefined;
331
- }
332
- return undefined;
333
- }
334
- export function isChangeOperator(alert) {
335
- if (alert?.condition?.type === "relative") {
336
- return alert.condition.measure.operator === ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE;
337
- }
338
- return false;
339
- }
340
- export function isDifferenceOperator(alert) {
341
- if (alert?.condition?.type === "relative") {
342
- return alert.condition.measure.operator === ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_DIFFERENCE;
343
- }
344
- return false;
345
- }
346
- export function isChangeOrDifferenceOperator(alert) {
347
- return isChangeOperator(alert) || isDifferenceOperator(alert);
348
- }
349
- export function isAlertValueDefined(alert) {
350
- if (alert?.condition?.type === "relative") {
351
- return typeof alert.condition.threshold !== "undefined";
352
- }
353
- return typeof alert?.condition?.right !== "undefined";
354
- }
355
- export function isAlertRecipientsValid(alert) {
356
- return !!alert?.recipients?.length;
357
- }
358
- export function getAlertThreshold(alert) {
359
- if (alert?.condition?.type === "relative") {
360
- return alert.condition.threshold;
361
- }
362
- return alert?.condition?.right;
363
- }
364
- export function getAlertMeasure(measures, alert) {
365
- const condition = alert?.condition;
366
- if (condition?.type === "relative") {
367
- return (measures.find((m) => m.measure.measure.localIdentifier === condition.measure.left.id) ??
368
- measures.find((m) => m.measure.measure.localIdentifier === condition.measure.right.id));
369
- }
370
- return measures.find((m) => m.measure.measure.localIdentifier === condition?.left.id);
371
- }
372
- export function getAlertAttribute(attributes, alert) {
373
- const attr = alert?.alert?.execution.attributes[0];
374
- if (attr?.attribute) {
375
- const { attribute, filterValue } = getAttributeRelatedFilterInfo(attributes, alert, attr);
376
- return [attribute, filterValue];
377
- }
378
- return [undefined, undefined];
379
- }
380
- export function getAlertFilters(alert) {
381
- const filters = alert?.alert?.execution?.filters ?? [];
382
- const attrs = (alert?.alert?.execution.attributes ?? []).map((a) => a.attribute.localIdentifier);
383
- return filters.filter((f) => {
384
- if (isPositiveAttributeFilter(f) && isLocalIdRef(f.positiveAttributeFilter.displayForm)) {
385
- return !attrs.includes(f.positiveAttributeFilter.displayForm.localIdentifier);
386
- }
387
- if (isNegativeAttributeFilter(f) && isLocalIdRef(f.negativeAttributeFilter.displayForm)) {
388
- return !attrs.includes(f.negativeAttributeFilter.displayForm.localIdentifier);
389
- }
390
- return true;
391
- });
392
- }
393
- export function getAlertCompareOperator(alert) {
394
- if (alert?.condition.type === "comparison") {
395
- return alert.condition.operator;
396
- }
397
- return undefined;
398
- }
399
- export function getAlertRelativeOperator(alert) {
400
- if (alert?.condition.type === "relative") {
401
- return [alert.condition.operator, alert.condition.measure.operator];
402
- }
403
- return undefined;
404
- }
405
- //alerts transformations
406
- export function transformAlertByMetric(metrics, alert, measure, catalogMeasures) {
407
- const periodMeasure = measure.comparators.find((c) => c.comparator === AlertMetricComparatorType.PreviousPeriod ||
408
- c.comparator === AlertMetricComparatorType.SamePeriodPreviousYear);
409
- if (alert.alert?.condition.type === "relative" && periodMeasure) {
410
- const cond = transformToRelativeCondition(alert.alert.condition);
411
- const condition = {
412
- ...cond,
413
- measure: {
414
- ...cond.measure,
415
- ...transformRelativeCondition(measure, periodMeasure, catalogMeasures),
416
- },
417
- };
418
- return {
419
- ...alert,
420
- title: getMeasureTitle(measure.measure) ?? "",
421
- alert: {
422
- ...alert.alert,
423
- condition,
424
- execution: transformAlertExecutionByMetric(metrics, condition, alert.alert.execution, measure),
425
- },
426
- };
427
- }
428
- const cond = transformToComparisonCondition(alert.alert.condition);
429
- const condition = {
430
- ...cond,
431
- left: {
432
- id: measure.measure.measure.localIdentifier,
433
- format: getMeasureFormat(measure.measure, catalogMeasures),
434
- title: getMeasureTitle(measure.measure),
435
- },
436
- };
437
- return {
438
- ...alert,
439
- title: getMeasureTitle(measure.measure) ?? "",
440
- alert: {
441
- ...alert.alert,
442
- condition,
443
- execution: transformAlertExecutionByMetric(metrics, condition, alert.alert.execution, measure),
444
- },
445
- };
446
- }
447
- /**
448
- * This function get selected attributed and optionally value amd added this attribute to execution.
449
- * If value is provided, it creates positive attribute filter with this value, otherwise it creates negative attribute filter
450
- * that is empty for now.
451
- * @param attributes - all available attributes
452
- * @param alert - alert to transform
453
- * @param attr - optionally selected attribute
454
- * @param value - optionally selected value
455
- */
456
- export function transformAlertByAttribute(attributes, alert, attr, value) {
457
- const { filterDefinition } = getAttributeRelatedFilterInfo(attributes, alert, alert.alert?.execution.attributes[0]);
458
- const originalFilters = alert.alert?.execution.filters.filter((f) => f !== filterDefinition) ?? [];
459
- const customFilters = [];
460
- if (attr) {
461
- if (value !== undefined) {
462
- customFilters.push({
463
- positiveAttributeFilter: {
464
- displayForm: {
465
- localIdentifier: attr.attribute.attribute.localIdentifier,
466
- },
467
- in: {
468
- values: [value],
469
- },
470
- },
471
- });
472
- }
473
- else {
474
- customFilters.push({
475
- negativeAttributeFilter: {
476
- displayForm: {
477
- localIdentifier: attr.attribute.attribute.localIdentifier,
478
- },
479
- notIn: {
480
- values: [],
481
- },
482
- },
483
- });
484
- }
485
- }
486
- return {
487
- ...alert,
488
- alert: {
489
- ...alert.alert,
490
- execution: {
491
- ...alert.alert.execution,
492
- attributes: attr ? [attr.attribute] : [],
493
- filters: [...originalFilters, ...customFilters],
494
- },
495
- },
496
- };
497
- }
498
- export function transformAlertByComparisonOperator(metrics, alert, measure, comparisonOperator) {
499
- const cond = transformToComparisonCondition(alert.alert.condition);
500
- const condition = {
501
- ...cond,
502
- operator: comparisonOperator,
503
- };
504
- return {
505
- ...alert,
506
- alert: {
507
- ...alert.alert,
508
- condition,
509
- execution: transformAlertExecutionByMetric(metrics, condition, alert.alert.execution, measure),
510
- },
511
- };
512
- }
513
- export function transformAlertByRelativeOperator(metrics, alert, measure, relativeOperator, arithmeticOperator, catalogMeasures) {
514
- const periodMeasure = measure.comparators.find((c) => c.comparator === AlertMetricComparatorType.PreviousPeriod ||
515
- c.comparator === AlertMetricComparatorType.SamePeriodPreviousYear);
516
- const cond = transformToRelativeCondition(alert.alert.condition);
517
- const condition = {
518
- ...cond,
519
- measure: {
520
- ...cond.measure,
521
- operator: arithmeticOperator,
522
- ...transformRelativeCondition(measure, periodMeasure, catalogMeasures),
523
- },
524
- operator: relativeOperator,
525
- };
526
- return {
527
- ...alert,
528
- alert: {
529
- ...alert.alert,
530
- condition,
531
- execution: transformAlertExecutionByMetric(metrics, condition, alert.alert.execution, measure),
532
- },
533
- };
534
- }
535
- export function transformAlertByValue(alert, value) {
536
- if (alert.alert?.condition.type === "relative") {
537
- return {
538
- ...alert,
539
- alert: {
540
- ...alert.alert,
541
- condition: {
542
- ...alert.alert.condition,
543
- threshold: value,
544
- },
545
- },
546
- };
547
- }
548
- return {
549
- ...alert,
550
- alert: {
551
- ...alert.alert,
552
- condition: {
553
- ...alert.alert.condition,
554
- right: value,
555
- },
556
- },
557
- };
558
- }
559
- export function transformAlertByDestination(alert, notificationChannel, recipients) {
560
- return {
561
- ...alert,
562
- ...(recipients ? { recipients } : {}),
563
- notificationChannel,
564
- };
565
- }
566
- //alerts transformations utils
567
- function transformToComparisonCondition(condition) {
568
- if (condition.type === "relative") {
569
- return {
570
- type: "comparison",
571
- operator: COMPARISON_OPERATORS.COMPARISON_OPERATOR_GREATER_THAN,
572
- left: condition.measure.left,
573
- right: condition.threshold,
574
- };
575
- }
576
- return {
577
- type: "comparison",
578
- operator: condition.operator,
579
- right: condition.right,
580
- left: condition.left,
581
- };
582
- }
583
- function transformToRelativeCondition(condition) {
584
- if (condition.type === "comparison") {
585
- return {
586
- type: "relative",
587
- operator: RELATIVE_OPERATORS.RELATIVE_OPERATOR_INCREASE_BY,
588
- measure: {
589
- operator: ARITHMETIC_OPERATORS.ARITHMETIC_OPERATOR_CHANGE,
590
- left: condition.left,
591
- right: undefined,
592
- },
593
- threshold: condition.right,
594
- };
595
- }
596
- return {
597
- type: "relative",
598
- operator: condition.operator,
599
- measure: condition.measure,
600
- threshold: condition.threshold,
601
- };
602
- }
603
- function transformAlertExecutionByMetric(metrics, condition, execution, measure) {
604
- const periodMeasure = measure.comparators.find((c) => c.comparator === AlertMetricComparatorType.PreviousPeriod ||
605
- c.comparator === AlertMetricComparatorType.SamePeriodPreviousYear);
606
- if (condition.type === "relative" && periodMeasure) {
607
- return {
608
- ...execution,
609
- measures: [measure.measure, periodMeasure.measure],
610
- auxMeasures: [
611
- ...collectAllRelatedMeasures(metrics, measure.measure),
612
- ...collectAllRelatedMeasures(metrics, periodMeasure.measure),
613
- ],
614
- };
615
- }
616
- return {
617
- ...execution,
618
- measures: [measure.measure],
619
- auxMeasures: collectAllRelatedMeasures(metrics, measure.measure),
620
- };
621
- }
622
- function collectAllRelatedMeasures(metrics, measure) {
623
- if (isArithmeticMeasure(measure)) {
624
- const included = measure.measure.definition.arithmeticMeasure.measureIdentifiers;
625
- const related = metrics.filter((m) => {
626
- return included.includes(m.measure.measure.localIdentifier);
627
- });
628
- return related.map((m) => m.measure);
629
- }
630
- return [];
631
- }
632
- function transformRelativeCondition(measure, periodMeasure, catalogMeasures) {
633
- return {
634
- ...(periodMeasure?.isPrimary && {
635
- left: {
636
- id: periodMeasure.measure.measure.localIdentifier,
637
- format: getMeasureFormat(periodMeasure.measure, catalogMeasures),
638
- title: getMeasureTitle(periodMeasure.measure),
639
- },
640
- right: {
641
- id: measure.measure.measure.localIdentifier,
642
- format: getMeasureFormat(measure.measure, catalogMeasures),
643
- title: getMeasureTitle(measure.measure),
644
- },
645
- }),
646
- ...(!periodMeasure?.isPrimary && {
647
- left: {
648
- id: measure.measure.measure.localIdentifier,
649
- format: getMeasureFormat(measure.measure, catalogMeasures),
650
- title: getMeasureTitle(measure.measure),
651
- },
652
- right: {
653
- id: periodMeasure?.measure.measure.localIdentifier,
654
- format: getMeasureFormat(periodMeasure?.measure, catalogMeasures),
655
- title: periodMeasure?.measure ? getMeasureTitle(periodMeasure?.measure) : undefined,
656
- },
657
- }),
658
- };
659
- }
660
- const getMeasureFormat = (measure, catalogMeasures) => {
661
- if (!measure) {
662
- return DEFAULT_MEASURE_FORMAT;
663
- }
664
- // custom format set in the bucket
665
- if (measure?.measure.format) {
666
- return measure.measure.format;
667
- }
668
- // measure format from the catalog
669
- const catalogMeasure = findMeasureInCatalog(measure, catalogMeasures);
670
- return catalogMeasure?.measure.format ?? DEFAULT_MEASURE_FORMAT;
671
- };
672
- const findMeasureInCatalog = (measure, catalogMeasures) => {
673
- return catalogMeasures?.find((m) => m.measure.id === measureIdentifier(measure));
674
- };
675
- function getAttributeRelatedFilterInfo(attributes, alert, attr) {
676
- const attribute = attributes.find((a) => a.attribute.attribute.localIdentifier === attr?.attribute.localIdentifier);
677
- return {
678
- attribute,
679
- ...getAttributeRelatedFilter(attribute, alert),
680
- };
681
- }
682
- function getAttributeRelatedFilter(attr, alert) {
683
- const filter = alert?.alert?.execution.filters.filter((f) => {
684
- if (isPositiveAttributeFilter(f) && isLocalIdRef(f.positiveAttributeFilter.displayForm)) {
685
- return (f.positiveAttributeFilter.displayForm.localIdentifier ===
686
- attr?.attribute.attribute.localIdentifier);
687
- }
688
- if (isNegativeAttributeFilter(f) && isLocalIdRef(f.negativeAttributeFilter.displayForm)) {
689
- return (f.negativeAttributeFilter.displayForm.localIdentifier ===
690
- attr?.attribute.attribute.localIdentifier);
691
- }
692
- return false;
693
- })[0];
694
- if (isPositiveAttributeFilter(filter) && isAttributeElementsByValue(filter.positiveAttributeFilter.in)) {
695
- return {
696
- filterDefinition: filter,
697
- filterValue: filter.positiveAttributeFilter.in.values[0],
698
- };
699
- }
700
- if (isNegativeAttributeFilter(filter) &&
701
- isAttributeElementsByValue(filter.negativeAttributeFilter.notIn)) {
702
- return {
703
- filterDefinition: filter,
704
- filterValue: undefined,
705
- };
706
- }
707
- return {
708
- filterDefinition: undefined,
709
- filterValue: undefined,
710
- };
711
- }
712
- //# sourceMappingURL=utils.js.map