@perses-dev/alert-manager-plugin 0.1.0

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 (380) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/7790.85c2cbf6.css +1 -0
  4. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  5. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  6. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  8. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  10. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  11. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  12. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  13. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  14. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  17. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  18. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  26. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  27. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  28. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  29. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  30. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  31. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  32. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  33. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  34. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  35. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  36. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  37. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  38. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  39. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  40. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  42. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  43. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  44. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  45. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  47. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  49. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  50. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  51. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  52. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  53. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  54. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  55. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  56. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  57. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  58. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  59. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  60. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  61. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  62. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  63. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  64. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  66. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  67. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  68. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  69. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  70. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  71. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  72. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  73. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  74. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  75. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  77. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  79. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  80. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  82. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  83. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  84. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  85. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  86. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  87. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  88. package/__mf/js/AlertManager.f762e62c.js +7 -0
  89. package/__mf/js/async/1616.24f00c9d.js +1 -0
  90. package/__mf/js/async/1728.83bb9a7c.js +1 -0
  91. package/__mf/js/async/1871.23ff54b3.js +1 -0
  92. package/__mf/js/async/1969.a83b1b48.js +1 -0
  93. package/__mf/js/async/2218.7829c9d9.js +2 -0
  94. package/__mf/js/async/2218.7829c9d9.js.LICENSE.txt +9 -0
  95. package/__mf/js/async/2377.f8875a4e.js +1 -0
  96. package/__mf/js/async/2657.fe8dd44f.js +1 -0
  97. package/__mf/js/async/2954.3ac1f636.js +2 -0
  98. package/__mf/js/async/392.7e11dd69.js +2 -0
  99. package/__mf/js/async/392.7e11dd69.js.LICENSE.txt +8 -0
  100. package/__mf/js/async/3963.fb6246d2.js +1 -0
  101. package/__mf/js/async/4121.ec666be2.js +2 -0
  102. package/__mf/js/async/4121.ec666be2.js.LICENSE.txt +9 -0
  103. package/__mf/js/async/4133.e94df4f8.js +28 -0
  104. package/__mf/js/async/4213.a0c4f2eb.js +1 -0
  105. package/__mf/js/async/4397.d399eecb.js +2 -0
  106. package/__mf/js/async/4397.d399eecb.js.LICENSE.txt +37 -0
  107. package/__mf/js/async/4466.a8145edd.js +74 -0
  108. package/__mf/js/async/4732.e866a740.js +1 -0
  109. package/__mf/js/async/4788.49ffeac3.js +1 -0
  110. package/__mf/js/async/5038.269393e3.js +2 -0
  111. package/__mf/js/async/5038.269393e3.js.LICENSE.txt +9 -0
  112. package/__mf/js/async/573.214f2003.js +2 -0
  113. package/__mf/js/async/573.214f2003.js.LICENSE.txt +9 -0
  114. package/__mf/js/async/6274.8c77cb1a.js +2 -0
  115. package/__mf/js/async/6274.8c77cb1a.js.LICENSE.txt +8 -0
  116. package/__mf/js/async/6390.3f6f279d.js +2 -0
  117. package/__mf/js/async/6390.3f6f279d.js.LICENSE.txt +9 -0
  118. package/__mf/js/async/6401.1a59dbad.js +1 -0
  119. package/__mf/js/async/6593.acc8b704.js +4 -0
  120. package/__mf/js/async/6593.acc8b704.js.LICENSE.txt +24 -0
  121. package/__mf/js/async/6594.b02adfd9.js +2 -0
  122. package/__mf/js/async/6594.b02adfd9.js.LICENSE.txt +9 -0
  123. package/__mf/js/async/663.5445c7e0.js +1 -0
  124. package/__mf/js/async/6854.1d628838.js +1 -0
  125. package/__mf/js/async/7177.27c86137.js +1 -0
  126. package/__mf/js/async/7192.ede9860b.js +1 -0
  127. package/__mf/js/async/733.22ab2a8a.js +1 -0
  128. package/__mf/js/async/7422.33d76364.js +2 -0
  129. package/__mf/js/async/7422.33d76364.js.LICENSE.txt +9 -0
  130. package/__mf/js/async/7790.a75199e6.js +7 -0
  131. package/__mf/js/async/7790.a75199e6.js.LICENSE.txt +64 -0
  132. package/__mf/js/async/7862.556c038f.js +2 -0
  133. package/__mf/js/async/7862.556c038f.js.LICENSE.txt +9 -0
  134. package/__mf/js/async/7984.49fa1156.js +22 -0
  135. package/__mf/js/async/7984.49fa1156.js.LICENSE.txt +19 -0
  136. package/__mf/js/async/804.23da0d30.js +37 -0
  137. package/__mf/js/async/8470.2df0db71.js +2 -0
  138. package/__mf/js/async/8470.2df0db71.js.LICENSE.txt +19 -0
  139. package/__mf/js/async/8697.c13c6603.js +1 -0
  140. package/__mf/js/async/8907.9e3edf43.js +1 -0
  141. package/__mf/js/async/9040.94717f28.js +10 -0
  142. package/__mf/js/async/9040.94717f28.js.LICENSE.txt +17 -0
  143. package/__mf/js/async/9184.27a439a4.js +1 -0
  144. package/__mf/js/async/9235.00f9412f.js +1 -0
  145. package/__mf/js/async/941.d3bc6208.js +2 -0
  146. package/__mf/js/async/941.d3bc6208.js.LICENSE.txt +9 -0
  147. package/__mf/js/async/9634.3a366799.js +1 -0
  148. package/__mf/js/async/9836.cc839227.js +1 -0
  149. package/__mf/js/async/__federation_expose_AlertManagerAlertsExplorer.d4fb76c0.js +2 -0
  150. package/__mf/js/async/__federation_expose_AlertManagerAlertsExplorer.d4fb76c0.js.LICENSE.txt +9 -0
  151. package/__mf/js/async/__federation_expose_AlertManagerAlertsQuery.9ea3093c.js +1 -0
  152. package/__mf/js/async/__federation_expose_AlertManagerDatasource.2fbf067c.js +2 -0
  153. package/__mf/js/async/__federation_expose_AlertManagerDatasource.2fbf067c.js.LICENSE.txt +9 -0
  154. package/__mf/js/async/__federation_expose_AlertManagerSilencesExplorer.d2527c12.js +2 -0
  155. package/__mf/js/async/__federation_expose_AlertManagerSilencesExplorer.d2527c12.js.LICENSE.txt +9 -0
  156. package/__mf/js/async/__federation_expose_AlertManagerSilencesQuery.7aca31d3.js +2 -0
  157. package/__mf/js/async/__federation_expose_AlertManagerSilencesQuery.7aca31d3.js.LICENSE.txt +9 -0
  158. package/__mf/js/async/__federation_expose_AlertTable.4a636b80.js +1 -0
  159. package/__mf/js/async/__federation_expose_SilenceTable.11259028.js +1 -0
  160. package/__mf/js/async/lib-router.19f64904.js +2 -0
  161. package/__mf/js/async/lib-router.19f64904.js.LICENSE.txt +32 -0
  162. package/__mf/js/main.a1362788.js +7 -0
  163. package/lib/bootstrap.d.ts +2 -0
  164. package/lib/bootstrap.d.ts.map +1 -0
  165. package/lib/bootstrap.js +19 -0
  166. package/lib/bootstrap.js.map +1 -0
  167. package/lib/cjs/bootstrap.js +26 -0
  168. package/lib/cjs/components/ColumnsEditor.js +271 -0
  169. package/lib/cjs/components/LazyTextField.js +50 -0
  170. package/lib/cjs/components/MatcherEditor.js +153 -0
  171. package/lib/cjs/components/MatchersList.js +46 -0
  172. package/lib/cjs/components/SilenceForm.js +205 -0
  173. package/lib/cjs/components/StatusBadge.js +71 -0
  174. package/lib/cjs/components/index.js +44 -0
  175. package/lib/cjs/explore/AlertManagerAlertsExplorer.js +79 -0
  176. package/lib/cjs/explore/AlertManagerSilencesExplorer.js +153 -0
  177. package/lib/cjs/getPluginModule.js +39 -0
  178. package/lib/cjs/index-federation.js +55 -0
  179. package/lib/cjs/index.js +39 -0
  180. package/lib/cjs/model/alertmanager-client.js +128 -0
  181. package/lib/cjs/model/alertmanager-selectors.js +66 -0
  182. package/lib/cjs/model/api-types.js +22 -0
  183. package/lib/cjs/model/index.js +32 -0
  184. package/lib/cjs/plugins/AlertManagerDatasourceEditor.js +71 -0
  185. package/lib/cjs/plugins/alert-table/AlertTable.js +56 -0
  186. package/lib/cjs/plugins/alert-table/AlertTableColumnsEditor.js +110 -0
  187. package/lib/cjs/plugins/alert-table/AlertTableDeduplicationEditor.js +138 -0
  188. package/lib/cjs/plugins/alert-table/AlertTableLabelsEditor.js +277 -0
  189. package/lib/cjs/plugins/alert-table/AlertTableOptionsEditor.js +128 -0
  190. package/lib/cjs/plugins/alert-table/AlertTablePanel.js +773 -0
  191. package/lib/cjs/plugins/alert-table/alert-table-model.js +142 -0
  192. package/lib/cjs/plugins/alert-table/alert-table-sorting.js +205 -0
  193. package/lib/cjs/plugins/alert-table/label-colors.js +170 -0
  194. package/lib/cjs/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js +51 -0
  195. package/lib/cjs/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js +138 -0
  196. package/lib/cjs/plugins/alertmanager-alerts-query/get-alerts-data.js +124 -0
  197. package/lib/cjs/plugins/alertmanager-datasource.js +69 -0
  198. package/lib/cjs/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js +45 -0
  199. package/lib/cjs/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js +78 -0
  200. package/lib/cjs/plugins/alertmanager-silences-query/get-silences-data.js +64 -0
  201. package/lib/cjs/plugins/index.js +74 -0
  202. package/lib/cjs/plugins/silence-table/SilenceTable.js +42 -0
  203. package/lib/cjs/plugins/silence-table/SilenceTableColumnsEditor.js +137 -0
  204. package/lib/cjs/plugins/silence-table/SilenceTableOptionsEditor.js +63 -0
  205. package/lib/cjs/plugins/silence-table/SilenceTablePanel.js +345 -0
  206. package/lib/cjs/plugins/silence-table/silence-table-model.js +116 -0
  207. package/lib/cjs/plugins/silence-table/silence-table-sorting.js +68 -0
  208. package/lib/cjs/plugins/types.js +16 -0
  209. package/lib/cjs/setup-tests.js +18 -0
  210. package/lib/components/ColumnsEditor.d.ts +25 -0
  211. package/lib/components/ColumnsEditor.d.ts.map +1 -0
  212. package/lib/components/ColumnsEditor.js +258 -0
  213. package/lib/components/ColumnsEditor.js.map +1 -0
  214. package/lib/components/LazyTextField.d.ts +12 -0
  215. package/lib/components/LazyTextField.d.ts.map +1 -0
  216. package/lib/components/LazyTextField.js +42 -0
  217. package/lib/components/LazyTextField.js.map +1 -0
  218. package/lib/components/MatcherEditor.d.ts +17 -0
  219. package/lib/components/MatcherEditor.d.ts.map +1 -0
  220. package/lib/components/MatcherEditor.js +142 -0
  221. package/lib/components/MatcherEditor.js.map +1 -0
  222. package/lib/components/MatchersList.d.ts +10 -0
  223. package/lib/components/MatchersList.d.ts.map +1 -0
  224. package/lib/components/MatchersList.js +40 -0
  225. package/lib/components/MatchersList.js.map +1 -0
  226. package/lib/components/SilenceForm.d.ts +13 -0
  227. package/lib/components/SilenceForm.d.ts.map +1 -0
  228. package/lib/components/SilenceForm.js +194 -0
  229. package/lib/components/SilenceForm.js.map +1 -0
  230. package/lib/components/StatusBadge.d.ts +10 -0
  231. package/lib/components/StatusBadge.d.ts.map +1 -0
  232. package/lib/components/StatusBadge.js +65 -0
  233. package/lib/components/StatusBadge.js.map +1 -0
  234. package/lib/components/index.d.ts +11 -0
  235. package/lib/components/index.d.ts.map +1 -0
  236. package/lib/components/index.js +19 -0
  237. package/lib/components/index.js.map +1 -0
  238. package/lib/explore/AlertManagerAlertsExplorer.d.ts +3 -0
  239. package/lib/explore/AlertManagerAlertsExplorer.d.ts.map +1 -0
  240. package/lib/explore/AlertManagerAlertsExplorer.js +71 -0
  241. package/lib/explore/AlertManagerAlertsExplorer.js.map +1 -0
  242. package/lib/explore/AlertManagerSilencesExplorer.d.ts +3 -0
  243. package/lib/explore/AlertManagerSilencesExplorer.d.ts.map +1 -0
  244. package/lib/explore/AlertManagerSilencesExplorer.js +140 -0
  245. package/lib/explore/AlertManagerSilencesExplorer.js.map +1 -0
  246. package/lib/getPluginModule.d.ts +3 -0
  247. package/lib/getPluginModule.d.ts.map +1 -0
  248. package/lib/getPluginModule.js +26 -0
  249. package/lib/getPluginModule.js.map +1 -0
  250. package/lib/index-federation.d.ts +1 -0
  251. package/lib/index-federation.d.ts.map +1 -0
  252. package/lib/index-federation.js +15 -0
  253. package/lib/index-federation.js.map +1 -0
  254. package/lib/index.d.ts +5 -0
  255. package/lib/index.d.ts.map +1 -0
  256. package/lib/index.js +18 -0
  257. package/lib/index.js.map +1 -0
  258. package/lib/model/alertmanager-client.d.ts +27 -0
  259. package/lib/model/alertmanager-client.d.ts.map +1 -0
  260. package/lib/model/alertmanager-client.js +100 -0
  261. package/lib/model/alertmanager-client.js.map +1 -0
  262. package/lib/model/alertmanager-selectors.d.ts +13 -0
  263. package/lib/model/alertmanager-selectors.d.ts.map +1 -0
  264. package/lib/model/alertmanager-selectors.js +41 -0
  265. package/lib/model/alertmanager-selectors.js.map +1 -0
  266. package/lib/model/api-types.d.ts +120 -0
  267. package/lib/model/api-types.d.ts.map +1 -0
  268. package/lib/model/api-types.js +23 -0
  269. package/lib/model/api-types.js.map +1 -0
  270. package/lib/model/index.d.ts +4 -0
  271. package/lib/model/index.d.ts.map +1 -0
  272. package/lib/model/index.js +17 -0
  273. package/lib/model/index.js.map +1 -0
  274. package/lib/plugins/AlertManagerDatasourceEditor.d.ts +9 -0
  275. package/lib/plugins/AlertManagerDatasourceEditor.d.ts.map +1 -0
  276. package/lib/plugins/AlertManagerDatasourceEditor.js +63 -0
  277. package/lib/plugins/AlertManagerDatasourceEditor.js.map +1 -0
  278. package/lib/plugins/alert-table/AlertTable.d.ts +8 -0
  279. package/lib/plugins/alert-table/AlertTable.d.ts.map +1 -0
  280. package/lib/plugins/alert-table/AlertTable.js +50 -0
  281. package/lib/plugins/alert-table/AlertTable.js.map +1 -0
  282. package/lib/plugins/alert-table/AlertTableColumnsEditor.d.ts +5 -0
  283. package/lib/plugins/alert-table/AlertTableColumnsEditor.d.ts.map +1 -0
  284. package/lib/plugins/alert-table/AlertTableColumnsEditor.js +102 -0
  285. package/lib/plugins/alert-table/AlertTableColumnsEditor.js.map +1 -0
  286. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.d.ts +5 -0
  287. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.d.ts.map +1 -0
  288. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.js +130 -0
  289. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.js.map +1 -0
  290. package/lib/plugins/alert-table/AlertTableLabelsEditor.d.ts +5 -0
  291. package/lib/plugins/alert-table/AlertTableLabelsEditor.d.ts.map +1 -0
  292. package/lib/plugins/alert-table/AlertTableLabelsEditor.js +264 -0
  293. package/lib/plugins/alert-table/AlertTableLabelsEditor.js.map +1 -0
  294. package/lib/plugins/alert-table/AlertTableOptionsEditor.d.ts +5 -0
  295. package/lib/plugins/alert-table/AlertTableOptionsEditor.d.ts.map +1 -0
  296. package/lib/plugins/alert-table/AlertTableOptionsEditor.js +120 -0
  297. package/lib/plugins/alert-table/AlertTableOptionsEditor.js.map +1 -0
  298. package/lib/plugins/alert-table/AlertTablePanel.d.ts +11 -0
  299. package/lib/plugins/alert-table/AlertTablePanel.d.ts.map +1 -0
  300. package/lib/plugins/alert-table/AlertTablePanel.js +763 -0
  301. package/lib/plugins/alert-table/AlertTablePanel.js.map +1 -0
  302. package/lib/plugins/alert-table/alert-table-model.d.ts +73 -0
  303. package/lib/plugins/alert-table/alert-table-model.d.ts.map +1 -0
  304. package/lib/plugins/alert-table/alert-table-model.js +127 -0
  305. package/lib/plugins/alert-table/alert-table-model.js.map +1 -0
  306. package/lib/plugins/alert-table/alert-table-sorting.d.ts +13 -0
  307. package/lib/plugins/alert-table/alert-table-sorting.d.ts.map +1 -0
  308. package/lib/plugins/alert-table/alert-table-sorting.js +180 -0
  309. package/lib/plugins/alert-table/alert-table-sorting.js.map +1 -0
  310. package/lib/plugins/alert-table/label-colors.d.ts +6 -0
  311. package/lib/plugins/alert-table/label-colors.d.ts.map +1 -0
  312. package/lib/plugins/alert-table/label-colors.js +148 -0
  313. package/lib/plugins/alert-table/label-colors.js.map +1 -0
  314. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.d.ts +4 -0
  315. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.d.ts.map +1 -0
  316. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js +43 -0
  317. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js.map +1 -0
  318. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.d.ts +9 -0
  319. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.d.ts.map +1 -0
  320. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js +130 -0
  321. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js.map +1 -0
  322. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.d.ts +8 -0
  323. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.d.ts.map +1 -0
  324. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.js +118 -0
  325. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.js.map +1 -0
  326. package/lib/plugins/alertmanager-datasource.d.ts +5 -0
  327. package/lib/plugins/alertmanager-datasource.d.ts.map +1 -0
  328. package/lib/plugins/alertmanager-datasource.js +61 -0
  329. package/lib/plugins/alertmanager-datasource.js.map +1 -0
  330. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.d.ts +4 -0
  331. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.d.ts.map +1 -0
  332. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js +37 -0
  333. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js.map +1 -0
  334. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.d.ts +9 -0
  335. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.d.ts.map +1 -0
  336. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js +70 -0
  337. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js.map +1 -0
  338. package/lib/plugins/alertmanager-silences-query/get-silences-data.d.ts +8 -0
  339. package/lib/plugins/alertmanager-silences-query/get-silences-data.d.ts.map +1 -0
  340. package/lib/plugins/alertmanager-silences-query/get-silences-data.js +58 -0
  341. package/lib/plugins/alertmanager-silences-query/get-silences-data.js.map +1 -0
  342. package/lib/plugins/index.d.ts +19 -0
  343. package/lib/plugins/index.d.ts.map +1 -0
  344. package/lib/plugins/index.js +30 -0
  345. package/lib/plugins/index.js.map +1 -0
  346. package/lib/plugins/silence-table/SilenceTable.d.ts +7 -0
  347. package/lib/plugins/silence-table/SilenceTable.d.ts.map +1 -0
  348. package/lib/plugins/silence-table/SilenceTable.js +36 -0
  349. package/lib/plugins/silence-table/SilenceTable.js.map +1 -0
  350. package/lib/plugins/silence-table/SilenceTableColumnsEditor.d.ts +5 -0
  351. package/lib/plugins/silence-table/SilenceTableColumnsEditor.d.ts.map +1 -0
  352. package/lib/plugins/silence-table/SilenceTableColumnsEditor.js +129 -0
  353. package/lib/plugins/silence-table/SilenceTableColumnsEditor.js.map +1 -0
  354. package/lib/plugins/silence-table/SilenceTableOptionsEditor.d.ts +5 -0
  355. package/lib/plugins/silence-table/SilenceTableOptionsEditor.d.ts.map +1 -0
  356. package/lib/plugins/silence-table/SilenceTableOptionsEditor.js +55 -0
  357. package/lib/plugins/silence-table/SilenceTableOptionsEditor.js.map +1 -0
  358. package/lib/plugins/silence-table/SilenceTablePanel.d.ts +11 -0
  359. package/lib/plugins/silence-table/SilenceTablePanel.d.ts.map +1 -0
  360. package/lib/plugins/silence-table/SilenceTablePanel.js +335 -0
  361. package/lib/plugins/silence-table/SilenceTablePanel.js.map +1 -0
  362. package/lib/plugins/silence-table/silence-table-model.d.ts +29 -0
  363. package/lib/plugins/silence-table/silence-table-model.d.ts.map +1 -0
  364. package/lib/plugins/silence-table/silence-table-model.js +90 -0
  365. package/lib/plugins/silence-table/silence-table-model.js.map +1 -0
  366. package/lib/plugins/silence-table/silence-table-sorting.d.ts +9 -0
  367. package/lib/plugins/silence-table/silence-table-sorting.d.ts.map +1 -0
  368. package/lib/plugins/silence-table/silence-table-sorting.js +60 -0
  369. package/lib/plugins/silence-table/silence-table-sorting.js.map +1 -0
  370. package/lib/plugins/types.d.ts +30 -0
  371. package/lib/plugins/types.d.ts.map +1 -0
  372. package/lib/plugins/types.js +17 -0
  373. package/lib/plugins/types.js.map +1 -0
  374. package/lib/setup-tests.d.ts +2 -0
  375. package/lib/setup-tests.d.ts.map +1 -0
  376. package/lib/setup-tests.js +16 -0
  377. package/lib/setup-tests.js.map +1 -0
  378. package/mf-manifest.json +631 -0
  379. package/mf-stats.json +752 -0
  380. package/package.json +115 -0
@@ -0,0 +1,763 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { Box, Chip, FormControl, IconButton, InputAdornment, InputLabel, MenuItem, Select, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TableSortLabel, TextField, Tooltip, Typography } from '@mui/material';
15
+ import { useSnackbar } from '@perses-dev/components';
16
+ import { parseVariables, replaceVariablesInString, useAllVariableValues, useDatasourceClient } from '@perses-dev/plugin-system';
17
+ import { useQueryClient } from '@tanstack/react-query';
18
+ import BellOffIcon from 'mdi-material-ui/BellOff';
19
+ import BookOpenIcon from 'mdi-material-ui/BookOpen';
20
+ import ChevronDownIcon from 'mdi-material-ui/ChevronDown';
21
+ import ChevronRightIcon from 'mdi-material-ui/ChevronRight';
22
+ import MagnifyIcon from 'mdi-material-ui/Magnify';
23
+ import UnfoldLessHorizontalIcon from 'mdi-material-ui/UnfoldLessHorizontal';
24
+ import UnfoldMoreHorizontalIcon from 'mdi-material-ui/UnfoldMoreHorizontal';
25
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
26
+ import { SilenceForm } from '../../components/SilenceForm';
27
+ import { StatusBadge } from '../../components/StatusBadge';
28
+ import { extractDatasourceSelector } from '../../model';
29
+ import { ALL_ALERT_ACTIONS, deduplicateAlerts, extractLabelKeys, getGroupKey, getGroupSummary } from './alert-table-model';
30
+ import { compareAlertsByColumn, compareGroupsByColumn, SORT_COL_ALERTNAME, SORT_COL_STATUS } from './alert-table-sorting';
31
+ import { getLabelColor } from './label-colors';
32
+ function GroupSummaryChips({ summary }) {
33
+ return /*#__PURE__*/ _jsxs(Stack, {
34
+ direction: "row",
35
+ spacing: 0.5,
36
+ children: [
37
+ summary.firing > 0 && /*#__PURE__*/ _jsx(Chip, {
38
+ label: `${summary.firing} firing`,
39
+ color: "error",
40
+ size: "small"
41
+ }),
42
+ summary.suppressed > 0 && /*#__PURE__*/ _jsx(Chip, {
43
+ label: `${summary.suppressed} silenced`,
44
+ color: "warning",
45
+ size: "small"
46
+ }),
47
+ summary.pending > 0 && /*#__PURE__*/ _jsx(Chip, {
48
+ label: `${summary.pending} pending`,
49
+ color: "default",
50
+ size: "small"
51
+ })
52
+ ]
53
+ });
54
+ }
55
+ function LabelValueSummaryChips({ summary, mapping }) {
56
+ const counts = summary.labelCounts?.[mapping.labelKey];
57
+ if (!counts || Object.keys(counts).length === 0) {
58
+ return null;
59
+ }
60
+ return /*#__PURE__*/ _jsx(Stack, {
61
+ direction: "row",
62
+ spacing: 0.5,
63
+ children: Object.entries(counts).sort(([, a], [, b])=>b - a).map(([value, count])=>{
64
+ const bgColor = getLabelColor(value, mapping);
65
+ return /*#__PURE__*/ _jsx(Chip, {
66
+ label: `${count} ${value}`,
67
+ size: "small",
68
+ sx: {
69
+ backgroundColor: bgColor,
70
+ color: '#fff',
71
+ fontWeight: 500
72
+ }
73
+ }, value);
74
+ })
75
+ });
76
+ }
77
+ function AlertRow({ alert, allowedActions, columnDefs, columnKeySet, mappingsByKey, runbookAnnotationKey, onSilence, duplicateCount, showDuplicates }) {
78
+ const runbookUrl = alert.annotations?.[runbookAnnotationKey];
79
+ const showActions = allowedActions.length > 0;
80
+ return /*#__PURE__*/ _jsxs(TableRow, {
81
+ hover: true,
82
+ children: [
83
+ /*#__PURE__*/ _jsx(TableCell, {
84
+ children: /*#__PURE__*/ _jsx(StatusBadge, {
85
+ status: alert.suppressed ? 'suppressed' : alert.state,
86
+ variant: "alert"
87
+ })
88
+ }),
89
+ /*#__PURE__*/ _jsx(TableCell, {
90
+ children: alert.name
91
+ }),
92
+ columnDefs.map((col, colIdx)=>{
93
+ const value = alert.labels[col.name];
94
+ const mapping = mappingsByKey.get(col.name);
95
+ if (value !== undefined && mapping) {
96
+ const bgColor = getLabelColor(value, mapping);
97
+ return /*#__PURE__*/ _jsx(TableCell, {
98
+ children: /*#__PURE__*/ _jsx(Chip, {
99
+ label: value,
100
+ size: "small",
101
+ sx: {
102
+ backgroundColor: bgColor,
103
+ color: '#fff',
104
+ fontWeight: 500
105
+ }
106
+ })
107
+ }, colIdx);
108
+ }
109
+ return /*#__PURE__*/ _jsx(TableCell, {
110
+ children: value ?? ''
111
+ }, colIdx);
112
+ }),
113
+ showDuplicates && /*#__PURE__*/ _jsx(TableCell, {
114
+ children: duplicateCount !== undefined && /*#__PURE__*/ _jsx(Chip, {
115
+ label: `${duplicateCount}`,
116
+ size: "small",
117
+ variant: "outlined",
118
+ color: "info"
119
+ })
120
+ }),
121
+ /*#__PURE__*/ _jsx(TableCell, {
122
+ children: /*#__PURE__*/ _jsx(Stack, {
123
+ direction: "row",
124
+ spacing: 0.5,
125
+ flexWrap: "wrap",
126
+ useFlexGap: true,
127
+ children: Object.entries(alert.labels).filter(([key])=>key !== 'alertname' && !columnKeySet.has(key)).map(([key, value])=>{
128
+ const mapping = mappingsByKey.get(key);
129
+ if (mapping) {
130
+ const bgColor = getLabelColor(value, mapping);
131
+ return /*#__PURE__*/ _jsx(Chip, {
132
+ label: `${key}=${value}`,
133
+ size: "small",
134
+ sx: {
135
+ backgroundColor: bgColor,
136
+ color: '#fff',
137
+ fontWeight: 500
138
+ }
139
+ }, key);
140
+ }
141
+ return /*#__PURE__*/ _jsx(Chip, {
142
+ label: `${key}=${value}`,
143
+ size: "small",
144
+ variant: "outlined"
145
+ }, key);
146
+ })
147
+ })
148
+ }),
149
+ showActions && /*#__PURE__*/ _jsx(TableCell, {
150
+ children: /*#__PURE__*/ _jsxs(Stack, {
151
+ direction: "row",
152
+ spacing: 0.5,
153
+ children: [
154
+ allowedActions.includes('silence') && !alert.suppressed && /*#__PURE__*/ _jsx(Tooltip, {
155
+ title: "Silence this alert",
156
+ children: /*#__PURE__*/ _jsx(IconButton, {
157
+ size: "small",
158
+ "aria-label": "Silence alert",
159
+ onClick: ()=>onSilence(alert),
160
+ children: /*#__PURE__*/ _jsx(BellOffIcon, {
161
+ fontSize: "small"
162
+ })
163
+ })
164
+ }),
165
+ allowedActions.includes('runbook') && runbookUrl && /*#__PURE__*/ _jsx(Tooltip, {
166
+ title: "View runbook",
167
+ children: /*#__PURE__*/ _jsx(IconButton, {
168
+ size: "small",
169
+ "aria-label": "View runbook",
170
+ component: "a",
171
+ href: runbookUrl,
172
+ target: "_blank",
173
+ rel: "noopener noreferrer",
174
+ children: /*#__PURE__*/ _jsx(BookOpenIcon, {
175
+ fontSize: "small"
176
+ })
177
+ })
178
+ })
179
+ ]
180
+ })
181
+ })
182
+ ]
183
+ });
184
+ }
185
+ function AlertGroupRow({ group, expanded, allowedActions, columnDefs, columnKeySet, labelColorMappings, mappingsByKey, runbookAnnotationKey, onToggle, onSilence, duplicateCounts, showDuplicates }) {
186
+ const showActions = allowedActions.length > 0;
187
+ return /*#__PURE__*/ _jsxs(_Fragment, {
188
+ children: [
189
+ /*#__PURE__*/ _jsxs(TableRow, {
190
+ sx: {
191
+ cursor: 'pointer',
192
+ '& > td': {
193
+ fontWeight: 'bold'
194
+ }
195
+ },
196
+ onClick: onToggle,
197
+ children: [
198
+ /*#__PURE__*/ _jsx(TableCell, {
199
+ colSpan: 2,
200
+ children: /*#__PURE__*/ _jsxs(Stack, {
201
+ direction: "row",
202
+ spacing: 1,
203
+ alignItems: "center",
204
+ children: [
205
+ expanded ? /*#__PURE__*/ _jsx(ChevronDownIcon, {}) : /*#__PURE__*/ _jsx(ChevronRightIcon, {}),
206
+ /*#__PURE__*/ _jsx(Typography, {
207
+ variant: "body2",
208
+ fontWeight: "bold",
209
+ children: group.key || 'Ungrouped'
210
+ }),
211
+ /*#__PURE__*/ _jsx(Chip, {
212
+ label: `${group.summary.total}`,
213
+ size: "small",
214
+ variant: "outlined"
215
+ })
216
+ ]
217
+ })
218
+ }),
219
+ columnDefs.map((col, colIdx)=>{
220
+ const counts = group.summary.labelCounts?.[col.name];
221
+ const mapping = mappingsByKey.get(col.name);
222
+ if (counts && mapping) {
223
+ return /*#__PURE__*/ _jsx(TableCell, {
224
+ children: /*#__PURE__*/ _jsx(LabelValueSummaryChips, {
225
+ summary: group.summary,
226
+ mapping: mapping
227
+ })
228
+ }, colIdx);
229
+ }
230
+ if (counts) {
231
+ return /*#__PURE__*/ _jsx(TableCell, {
232
+ children: /*#__PURE__*/ _jsx(Stack, {
233
+ direction: "row",
234
+ spacing: 0.5,
235
+ children: Object.entries(counts).sort(([, a], [, b])=>b - a).map(([value, count])=>/*#__PURE__*/ _jsx(Chip, {
236
+ label: `${count} ${value}`,
237
+ size: "small",
238
+ variant: "outlined"
239
+ }, value))
240
+ })
241
+ }, colIdx);
242
+ }
243
+ return /*#__PURE__*/ _jsx(TableCell, {}, colIdx);
244
+ }),
245
+ showDuplicates && /*#__PURE__*/ _jsx(TableCell, {}),
246
+ /*#__PURE__*/ _jsx(TableCell, {
247
+ children: /*#__PURE__*/ _jsxs(Stack, {
248
+ direction: "row",
249
+ spacing: 1,
250
+ alignItems: "center",
251
+ flexWrap: "wrap",
252
+ useFlexGap: true,
253
+ children: [
254
+ /*#__PURE__*/ _jsx(GroupSummaryChips, {
255
+ summary: group.summary
256
+ }),
257
+ labelColorMappings.filter((mapping)=>!columnKeySet.has(mapping.labelKey)).map((mapping)=>/*#__PURE__*/ _jsx(LabelValueSummaryChips, {
258
+ summary: group.summary,
259
+ mapping: mapping
260
+ }, mapping.labelKey))
261
+ ]
262
+ })
263
+ }),
264
+ showActions && /*#__PURE__*/ _jsx(TableCell, {})
265
+ ]
266
+ }),
267
+ expanded && group.alerts.map((alert, idx)=>/*#__PURE__*/ _jsx(AlertRow, {
268
+ alert: alert,
269
+ allowedActions: allowedActions,
270
+ columnDefs: columnDefs,
271
+ columnKeySet: columnKeySet,
272
+ mappingsByKey: mappingsByKey,
273
+ runbookAnnotationKey: runbookAnnotationKey,
274
+ onSilence: onSilence,
275
+ duplicateCount: duplicateCounts.get(alert),
276
+ showDuplicates: showDuplicates
277
+ }, alert.id ?? String(idx)))
278
+ ]
279
+ });
280
+ }
281
+ /**
282
+ * Alert hierarchical table panel component.
283
+ * Displays alerts grouped by configurable labels with deduplication.
284
+ */ export function AlertTablePanel({ spec, queryResults, contentDimensions }) {
285
+ const datasourceSelector = useMemo(()=>extractDatasourceSelector(queryResults), [
286
+ queryResults
287
+ ]);
288
+ const { data: amClient } = useDatasourceClient(datasourceSelector);
289
+ const queryClient = useQueryClient();
290
+ const [silenceTarget, setSilenceTarget] = useState(null);
291
+ const silenceKeyRef = useRef(0);
292
+ const handleSetSilenceTarget = useCallback((alert)=>{
293
+ silenceKeyRef.current++;
294
+ setSilenceTarget(alert);
295
+ }, []);
296
+ const [search, setSearch] = useState('');
297
+ const [expandedGroups, setExpandedGroups] = useState(new Set());
298
+ const { successSnackbar, exceptionSnackbar } = useSnackbar();
299
+ const handleSilenceSubmit = useCallback(async (silence)=>{
300
+ if (!amClient) return;
301
+ try {
302
+ await amClient.createSilence(silence);
303
+ setSilenceTarget(null);
304
+ successSnackbar('Silence created successfully');
305
+ queryClient.invalidateQueries({
306
+ queryKey: [
307
+ 'query',
308
+ 'AlertsQuery'
309
+ ]
310
+ });
311
+ queryClient.invalidateQueries({
312
+ queryKey: [
313
+ 'query',
314
+ 'SilencesQuery'
315
+ ]
316
+ });
317
+ } catch (err) {
318
+ exceptionSnackbar(err);
319
+ }
320
+ }, [
321
+ amClient,
322
+ queryClient,
323
+ successSnackbar,
324
+ exceptionSnackbar
325
+ ]);
326
+ const silenceInitial = useMemo(()=>{
327
+ if (!silenceTarget) return undefined;
328
+ return {
329
+ matchers: Object.entries(silenceTarget.labels).map(([name, value])=>({
330
+ name,
331
+ value,
332
+ isEqual: true,
333
+ isRegex: false
334
+ }))
335
+ };
336
+ }, [
337
+ silenceTarget
338
+ ]);
339
+ const defaultGroupBy = useMemo(()=>spec.defaultGroupBy ?? [
340
+ 'alertname'
341
+ ], [
342
+ spec.defaultGroupBy
343
+ ]);
344
+ const variableNames = useMemo(()=>[
345
+ ...new Set(defaultGroupBy.flatMap((entry)=>parseVariables(entry)))
346
+ ], [
347
+ defaultGroupBy
348
+ ]);
349
+ const variableState = useAllVariableValues(variableNames);
350
+ const resolvedDefaultGroupBy = useMemo(()=>{
351
+ const result = [];
352
+ for (const entry of defaultGroupBy){
353
+ const vars = parseVariables(entry);
354
+ if (vars.length === 0) {
355
+ result.push(entry);
356
+ } else if (vars.length === 1 && (entry === `$${vars[0]}` || entry === `\${${vars[0]}}`)) {
357
+ const varState = variableState[vars[0] ?? ''];
358
+ if (varState?.value) {
359
+ if (Array.isArray(varState.value)) {
360
+ result.push(...varState.value);
361
+ } else {
362
+ result.push(varState.value);
363
+ }
364
+ }
365
+ } else {
366
+ const resolved = replaceVariablesInString(entry, variableState);
367
+ if (resolved) result.push(resolved);
368
+ }
369
+ }
370
+ return result;
371
+ }, [
372
+ defaultGroupBy,
373
+ variableState
374
+ ]);
375
+ const [groupBy, setGroupBy] = useState(resolvedDefaultGroupBy);
376
+ useEffect(()=>{
377
+ setGroupBy(resolvedDefaultGroupBy);
378
+ }, [
379
+ resolvedDefaultGroupBy
380
+ ]);
381
+ const effectiveActions = useMemo(()=>spec.allowedActions ?? ALL_ALERT_ACTIONS, [
382
+ spec.allowedActions
383
+ ]);
384
+ const showActionsColumn = effectiveActions.length > 0;
385
+ const runbookAnnotationKey = spec.runbookAnnotationKey || 'runbook_url';
386
+ const columnDefs = useMemo(()=>spec.columns ?? [], [
387
+ spec.columns
388
+ ]);
389
+ const columnKeySet = useMemo(()=>new Set(columnDefs.map((c)=>c.name)), [
390
+ columnDefs
391
+ ]);
392
+ const labelColorMappings = useMemo(()=>spec.labelColorMappings ?? [], [
393
+ spec.labelColorMappings
394
+ ]);
395
+ const labelKeys = useMemo(()=>labelColorMappings.map((m)=>m.labelKey), [
396
+ labelColorMappings
397
+ ]);
398
+ const mappingsByKey = useMemo(()=>new Map(labelColorMappings.map((m)=>[
399
+ m.labelKey,
400
+ m
401
+ ])), [
402
+ labelColorMappings
403
+ ]);
404
+ const allTrackedKeys = useMemo(()=>[
405
+ ...new Set([
406
+ ...labelKeys,
407
+ ...columnDefs.map((c)=>c.name)
408
+ ])
409
+ ], [
410
+ labelKeys,
411
+ columnDefs
412
+ ]);
413
+ const initialSort = useMemo(()=>{
414
+ const col = columnDefs.find((c)=>c.sort && c.enableSorting !== false);
415
+ if (!col?.sort) return null;
416
+ return {
417
+ columnName: col.name,
418
+ direction: col.sort,
419
+ mode: col.sortMode ?? 'alphabetical'
420
+ };
421
+ }, [
422
+ columnDefs
423
+ ]);
424
+ const [sortState, setSortState] = useState(initialSort);
425
+ const handleSortClick = useCallback((columnName, sortMode = 'alphabetical')=>{
426
+ setSortState((prev)=>{
427
+ if (prev?.columnName === columnName) {
428
+ return prev.direction === 'asc' ? {
429
+ ...prev,
430
+ direction: 'desc'
431
+ } : null;
432
+ }
433
+ return {
434
+ columnName,
435
+ direction: 'asc',
436
+ mode: sortMode
437
+ };
438
+ });
439
+ }, []);
440
+ // Flatten all alerts from all query results
441
+ const allAlerts = useMemo(()=>{
442
+ return queryResults.flatMap((result)=>result.data?.alerts ?? []);
443
+ }, [
444
+ queryResults
445
+ ]);
446
+ // Deduplicate
447
+ const dedupConfig = useMemo(()=>spec.deduplication ?? {
448
+ mode: 'fingerprint'
449
+ }, [
450
+ spec.deduplication
451
+ ]);
452
+ const dedupResult = useMemo(()=>deduplicateAlerts(allAlerts, dedupConfig), [
453
+ allAlerts,
454
+ dedupConfig
455
+ ]);
456
+ const dedupAlerts = dedupResult.alerts;
457
+ const duplicateCounts = dedupResult.duplicateCounts;
458
+ const hasDuplicates = duplicateCounts.size > 0;
459
+ // Filter by search term
460
+ const alerts = useMemo(()=>{
461
+ const term = search.trim().toLowerCase();
462
+ if (!term) return dedupAlerts;
463
+ return dedupAlerts.filter((a)=>{
464
+ if (a.state.toLowerCase().includes(term)) return true;
465
+ if (a.suppressed && ('suppressed'.includes(term) || 'silenced'.includes(term))) return true;
466
+ if (Object.values(a.labels).some((v)=>v.toLowerCase().includes(term))) return true;
467
+ if (a.annotations && Object.values(a.annotations).some((v)=>v.toLowerCase().includes(term))) return true;
468
+ return false;
469
+ });
470
+ }, [
471
+ dedupAlerts,
472
+ search
473
+ ]);
474
+ // Extract available label keys for group-by selector
475
+ const availableLabelKeys = useMemo(()=>extractLabelKeys(alerts), [
476
+ alerts
477
+ ]);
478
+ // Group alerts
479
+ const groups = useMemo(()=>{
480
+ let result;
481
+ if (groupBy.length === 0) {
482
+ result = [
483
+ {
484
+ key: '',
485
+ alerts: [
486
+ ...alerts
487
+ ],
488
+ summary: getGroupSummary(alerts, allTrackedKeys)
489
+ }
490
+ ];
491
+ } else {
492
+ const groupMap = new Map();
493
+ for (const alert of alerts){
494
+ const key = getGroupKey(alert, groupBy);
495
+ const existing = groupMap.get(key) ?? [];
496
+ existing.push(alert);
497
+ groupMap.set(key, existing);
498
+ }
499
+ result = Array.from(groupMap.entries()).map(([key, groupAlerts])=>({
500
+ key,
501
+ alerts: groupAlerts,
502
+ summary: getGroupSummary(groupAlerts, allTrackedKeys)
503
+ }));
504
+ }
505
+ if (sortState) {
506
+ for (const group of result){
507
+ group.alerts.sort((a, b)=>compareAlertsByColumn(a, b, sortState));
508
+ }
509
+ result.sort((a, b)=>compareGroupsByColumn(a.summary.labelCounts?.[sortState.columnName], b.summary.labelCounts?.[sortState.columnName], sortState));
510
+ }
511
+ return result;
512
+ }, [
513
+ alerts,
514
+ groupBy,
515
+ allTrackedKeys,
516
+ sortState
517
+ ]);
518
+ const prevGroupKeysRef = useRef('');
519
+ useEffect(()=>{
520
+ const currentKeys = groups.map((g)=>g.key).join('\0');
521
+ if (currentKeys === prevGroupKeysRef.current) return;
522
+ prevGroupKeysRef.current = currentKeys;
523
+ if (groups.length === 1) {
524
+ setExpandedGroups(new Set(groups.map((g)=>g.key)));
525
+ } else {
526
+ setExpandedGroups(new Set());
527
+ }
528
+ }, [
529
+ groups
530
+ ]);
531
+ const handleToggleGroup = useCallback((key)=>{
532
+ setExpandedGroups((prev)=>{
533
+ const next = new Set(prev);
534
+ if (next.has(key)) {
535
+ next.delete(key);
536
+ } else {
537
+ next.add(key);
538
+ }
539
+ return next;
540
+ });
541
+ }, []);
542
+ const handleExpandAll = useCallback(()=>{
543
+ setExpandedGroups(new Set(groups.map((g)=>g.key)));
544
+ }, [
545
+ groups
546
+ ]);
547
+ const handleCollapseAll = useCallback(()=>{
548
+ setExpandedGroups(new Set());
549
+ }, []);
550
+ const handleGroupByChange = (event)=>{
551
+ const value = event.target.value;
552
+ setGroupBy(typeof value === 'string' ? value.split(',') : value);
553
+ };
554
+ if (allAlerts.length === 0) {
555
+ return /*#__PURE__*/ _jsx(Box, {
556
+ sx: {
557
+ display: 'flex',
558
+ justifyContent: 'center',
559
+ alignItems: 'center',
560
+ height: contentDimensions?.height ?? '100%'
561
+ },
562
+ children: /*#__PURE__*/ _jsx(Typography, {
563
+ children: "No alerts to display"
564
+ })
565
+ });
566
+ }
567
+ return /*#__PURE__*/ _jsxs(Stack, {
568
+ spacing: 1,
569
+ sx: {
570
+ height: contentDimensions?.height,
571
+ overflow: 'auto'
572
+ },
573
+ children: [
574
+ /*#__PURE__*/ _jsxs(Stack, {
575
+ direction: "row",
576
+ spacing: 2,
577
+ alignItems: "center",
578
+ sx: {
579
+ px: 1,
580
+ pt: 1
581
+ },
582
+ children: [
583
+ /*#__PURE__*/ _jsx(TextField, {
584
+ size: "small",
585
+ placeholder: "Search alerts...",
586
+ value: search,
587
+ onChange: (e)=>setSearch(e.target.value),
588
+ sx: {
589
+ minWidth: 200
590
+ },
591
+ slotProps: {
592
+ htmlInput: {
593
+ 'aria-label': 'Search alerts'
594
+ },
595
+ input: {
596
+ startAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
597
+ position: "start",
598
+ children: /*#__PURE__*/ _jsx(MagnifyIcon, {
599
+ fontSize: "small"
600
+ })
601
+ })
602
+ }
603
+ }
604
+ }),
605
+ /*#__PURE__*/ _jsxs(FormControl, {
606
+ size: "small",
607
+ sx: {
608
+ minWidth: 200
609
+ },
610
+ children: [
611
+ /*#__PURE__*/ _jsx(InputLabel, {
612
+ id: "group-by-label",
613
+ children: "Group by"
614
+ }),
615
+ /*#__PURE__*/ _jsx(Select, {
616
+ labelId: "group-by-label",
617
+ multiple: true,
618
+ value: groupBy,
619
+ onChange: handleGroupByChange,
620
+ label: "Group by",
621
+ renderValue: (selected)=>selected.join(', '),
622
+ children: availableLabelKeys.map((key)=>/*#__PURE__*/ _jsx(MenuItem, {
623
+ value: key,
624
+ children: key
625
+ }, key))
626
+ })
627
+ ]
628
+ }),
629
+ /*#__PURE__*/ _jsxs(Typography, {
630
+ variant: "body2",
631
+ color: "text.secondary",
632
+ sx: {
633
+ flexGrow: 1
634
+ },
635
+ children: [
636
+ alerts.length,
637
+ " alert",
638
+ alerts.length !== 1 ? 's' : '',
639
+ " in ",
640
+ groups.length,
641
+ " group",
642
+ groups.length !== 1 ? 's' : ''
643
+ ]
644
+ }),
645
+ /*#__PURE__*/ _jsxs(Stack, {
646
+ direction: "row",
647
+ spacing: 0.5,
648
+ children: [
649
+ /*#__PURE__*/ _jsx(Tooltip, {
650
+ title: "Expand all groups",
651
+ children: /*#__PURE__*/ _jsx(IconButton, {
652
+ size: "small",
653
+ "aria-label": "Expand all groups",
654
+ onClick: handleExpandAll,
655
+ children: /*#__PURE__*/ _jsx(UnfoldMoreHorizontalIcon, {
656
+ fontSize: "small"
657
+ })
658
+ })
659
+ }),
660
+ /*#__PURE__*/ _jsx(Tooltip, {
661
+ title: "Collapse all groups",
662
+ children: /*#__PURE__*/ _jsx(IconButton, {
663
+ size: "small",
664
+ "aria-label": "Collapse all groups",
665
+ onClick: handleCollapseAll,
666
+ children: /*#__PURE__*/ _jsx(UnfoldLessHorizontalIcon, {
667
+ fontSize: "small"
668
+ })
669
+ })
670
+ })
671
+ ]
672
+ })
673
+ ]
674
+ }),
675
+ /*#__PURE__*/ _jsx(TableContainer, {
676
+ children: /*#__PURE__*/ _jsxs(Table, {
677
+ size: "small",
678
+ stickyHeader: true,
679
+ children: [
680
+ /*#__PURE__*/ _jsx(TableHead, {
681
+ children: /*#__PURE__*/ _jsxs(TableRow, {
682
+ children: [
683
+ /*#__PURE__*/ _jsx(TableCell, {
684
+ sortDirection: sortState?.columnName === SORT_COL_STATUS ? sortState.direction : false,
685
+ children: /*#__PURE__*/ _jsx(TableSortLabel, {
686
+ active: sortState?.columnName === SORT_COL_STATUS,
687
+ direction: sortState?.columnName === SORT_COL_STATUS ? sortState.direction : 'asc',
688
+ onClick: ()=>handleSortClick(SORT_COL_STATUS, 'status'),
689
+ children: "Status"
690
+ })
691
+ }),
692
+ /*#__PURE__*/ _jsx(TableCell, {
693
+ sortDirection: sortState?.columnName === SORT_COL_ALERTNAME ? sortState.direction : false,
694
+ children: /*#__PURE__*/ _jsx(TableSortLabel, {
695
+ active: sortState?.columnName === SORT_COL_ALERTNAME,
696
+ direction: sortState?.columnName === SORT_COL_ALERTNAME ? sortState.direction : 'asc',
697
+ onClick: ()=>handleSortClick(SORT_COL_ALERTNAME, 'alphabetical'),
698
+ children: "Alert Name"
699
+ })
700
+ }),
701
+ columnDefs.map((col, colIdx)=>/*#__PURE__*/ _jsx(TableCell, {
702
+ sortDirection: sortState?.columnName === col.name ? sortState.direction : false,
703
+ children: col.enableSorting !== false ? /*#__PURE__*/ _jsx(TableSortLabel, {
704
+ active: sortState?.columnName === col.name,
705
+ direction: sortState?.columnName === col.name ? sortState.direction : 'asc',
706
+ onClick: ()=>handleSortClick(col.name, col.sortMode),
707
+ children: col.header ?? col.name
708
+ }) : col.header ?? col.name
709
+ }, colIdx)),
710
+ hasDuplicates && /*#__PURE__*/ _jsx(TableCell, {
711
+ children: "Duplicates"
712
+ }),
713
+ /*#__PURE__*/ _jsx(TableCell, {
714
+ children: "Labels"
715
+ }),
716
+ showActionsColumn && /*#__PURE__*/ _jsx(TableCell, {
717
+ children: "Actions"
718
+ })
719
+ ]
720
+ })
721
+ }),
722
+ /*#__PURE__*/ _jsx(TableBody, {
723
+ children: alerts.length === 0 ? /*#__PURE__*/ _jsx(TableRow, {
724
+ children: /*#__PURE__*/ _jsx(TableCell, {
725
+ colSpan: 99,
726
+ align: "center",
727
+ sx: {
728
+ py: 4
729
+ },
730
+ children: /*#__PURE__*/ _jsx(Typography, {
731
+ color: "text.secondary",
732
+ children: "No matching alerts"
733
+ })
734
+ })
735
+ }) : groups.map((group)=>/*#__PURE__*/ _jsx(AlertGroupRow, {
736
+ group: group,
737
+ expanded: expandedGroups.has(group.key),
738
+ allowedActions: effectiveActions,
739
+ columnDefs: columnDefs,
740
+ columnKeySet: columnKeySet,
741
+ labelColorMappings: labelColorMappings,
742
+ mappingsByKey: mappingsByKey,
743
+ runbookAnnotationKey: runbookAnnotationKey,
744
+ onToggle: ()=>handleToggleGroup(group.key),
745
+ onSilence: handleSetSilenceTarget,
746
+ duplicateCounts: duplicateCounts,
747
+ showDuplicates: hasDuplicates
748
+ }, group.key))
749
+ })
750
+ ]
751
+ })
752
+ }),
753
+ /*#__PURE__*/ _jsx(SilenceForm, {
754
+ open: !!silenceTarget,
755
+ onClose: ()=>setSilenceTarget(null),
756
+ onSubmit: handleSilenceSubmit,
757
+ initialSilence: silenceInitial
758
+ }, silenceKeyRef.current)
759
+ ]
760
+ });
761
+ }
762
+
763
+ //# sourceMappingURL=AlertTablePanel.js.map