@perses-dev/alert-manager-plugin 0.1.0-rc.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 (384) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/430.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.3d597fc0.js +7 -0
  89. package/__mf/js/async/1616.24f00c9d.js +1 -0
  90. package/__mf/js/async/1728.a509c63a.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/2842.7f15ae1d.js +1 -0
  98. package/__mf/js/async/3468.1679f87f.js +1 -0
  99. package/__mf/js/async/3540.96681482.js +2 -0
  100. package/__mf/js/async/3540.96681482.js.LICENSE.txt +37 -0
  101. package/__mf/js/async/392.7e11dd69.js +2 -0
  102. package/__mf/js/async/392.7e11dd69.js.LICENSE.txt +8 -0
  103. package/__mf/js/async/3963.fb6246d2.js +1 -0
  104. package/__mf/js/async/4121.ec666be2.js +2 -0
  105. package/__mf/js/async/4121.ec666be2.js.LICENSE.txt +9 -0
  106. package/__mf/js/async/4133.e94df4f8.js +28 -0
  107. package/__mf/js/async/4213.a0c4f2eb.js +1 -0
  108. package/__mf/js/async/430.74d85c4b.js +7 -0
  109. package/__mf/js/async/430.74d85c4b.js.LICENSE.txt +64 -0
  110. package/__mf/js/async/4466.a8145edd.js +74 -0
  111. package/__mf/js/async/4788.49ffeac3.js +1 -0
  112. package/__mf/js/async/5038.269393e3.js +2 -0
  113. package/__mf/js/async/5038.269393e3.js.LICENSE.txt +9 -0
  114. package/__mf/js/async/5481.cf6703fd.js +2 -0
  115. package/__mf/js/async/5481.cf6703fd.js.LICENSE.txt +9 -0
  116. package/__mf/js/async/5570.d4dd47e0.js +1 -0
  117. package/__mf/js/async/573.ce8ce2ef.js +2 -0
  118. package/__mf/js/async/6274.8c77cb1a.js +2 -0
  119. package/__mf/js/async/6274.8c77cb1a.js.LICENSE.txt +8 -0
  120. package/__mf/js/async/6390.3f6f279d.js +2 -0
  121. package/__mf/js/async/6390.3f6f279d.js.LICENSE.txt +9 -0
  122. package/__mf/js/async/6401.1a59dbad.js +1 -0
  123. package/__mf/js/async/6594.b02adfd9.js +2 -0
  124. package/__mf/js/async/6594.b02adfd9.js.LICENSE.txt +9 -0
  125. package/__mf/js/async/663.5445c7e0.js +1 -0
  126. package/__mf/js/async/6854.1d628838.js +1 -0
  127. package/__mf/js/async/7177.27c86137.js +1 -0
  128. package/__mf/js/async/7192.ede9860b.js +1 -0
  129. package/__mf/js/async/7283.8c1cb6ee.js +2 -0
  130. package/__mf/js/async/7283.8c1cb6ee.js.LICENSE.txt +9 -0
  131. package/__mf/js/async/7984.1f786d95.js +22 -0
  132. package/__mf/js/async/7984.1f786d95.js.LICENSE.txt +19 -0
  133. package/__mf/js/async/804.23da0d30.js +37 -0
  134. package/__mf/js/async/8470.2df0db71.js +2 -0
  135. package/__mf/js/async/8470.2df0db71.js.LICENSE.txt +19 -0
  136. package/__mf/js/async/8697.c13c6603.js +1 -0
  137. package/__mf/js/async/8711.c7dc09b8.js +2 -0
  138. package/__mf/js/async/8711.c7dc09b8.js.LICENSE.txt +9 -0
  139. package/__mf/js/async/8907.9e3edf43.js +1 -0
  140. package/__mf/js/async/9040.94717f28.js +10 -0
  141. package/__mf/js/async/9040.94717f28.js.LICENSE.txt +17 -0
  142. package/__mf/js/async/9184.27a439a4.js +1 -0
  143. package/__mf/js/async/9235.00f9412f.js +1 -0
  144. package/__mf/js/async/941.d3bc6208.js +2 -0
  145. package/__mf/js/async/941.d3bc6208.js.LICENSE.txt +9 -0
  146. package/__mf/js/async/9537.36ff6f15.js +1 -0
  147. package/__mf/js/async/9634.3a366799.js +1 -0
  148. package/__mf/js/async/9741.199e8033.js +4 -0
  149. package/__mf/js/async/9741.199e8033.js.LICENSE.txt +24 -0
  150. package/__mf/js/async/983.77219d7b.js +1 -0
  151. package/__mf/js/async/9836.cc839227.js +1 -0
  152. package/__mf/js/async/__federation_expose_AlertManagerAlertsExplorer.a0623742.js +2 -0
  153. package/__mf/js/async/__federation_expose_AlertManagerAlertsExplorer.a0623742.js.LICENSE.txt +9 -0
  154. package/__mf/js/async/__federation_expose_AlertManagerAlertsQuery.aa08447d.js +1 -0
  155. package/__mf/js/async/__federation_expose_AlertManagerDatasource.fe5b34fb.js +2 -0
  156. package/__mf/js/async/__federation_expose_AlertManagerDatasource.fe5b34fb.js.LICENSE.txt +9 -0
  157. package/__mf/js/async/__federation_expose_AlertManagerSilencesExplorer.ff9617f8.js +2 -0
  158. package/__mf/js/async/__federation_expose_AlertManagerSilencesExplorer.ff9617f8.js.LICENSE.txt +9 -0
  159. package/__mf/js/async/__federation_expose_AlertManagerSilencesQuery.c9a49171.js +2 -0
  160. package/__mf/js/async/__federation_expose_AlertManagerSilencesQuery.c9a49171.js.LICENSE.txt +9 -0
  161. package/__mf/js/async/__federation_expose_AlertTable.cac7598a.js +1 -0
  162. package/__mf/js/async/__federation_expose_SilenceTable.50ee1f33.js +2 -0
  163. package/__mf/js/async/__federation_expose_SilenceTable.50ee1f33.js.LICENSE.txt +9 -0
  164. package/__mf/js/async/lib-router.19f64904.js +2 -0
  165. package/__mf/js/async/lib-router.19f64904.js.LICENSE.txt +32 -0
  166. package/__mf/js/main.1ce74432.js +7 -0
  167. package/lib/bootstrap.d.ts +2 -0
  168. package/lib/bootstrap.d.ts.map +1 -0
  169. package/lib/bootstrap.js +19 -0
  170. package/lib/bootstrap.js.map +1 -0
  171. package/lib/cjs/bootstrap.js +26 -0
  172. package/lib/cjs/components/ColumnsEditor.js +271 -0
  173. package/lib/cjs/components/LazyTextField.js +50 -0
  174. package/lib/cjs/components/MatcherEditor.js +153 -0
  175. package/lib/cjs/components/MatchersList.js +46 -0
  176. package/lib/cjs/components/SilenceForm.js +205 -0
  177. package/lib/cjs/components/StatusBadge.js +71 -0
  178. package/lib/cjs/components/index.js +44 -0
  179. package/lib/cjs/explore/AlertManagerAlertsExplorer.js +79 -0
  180. package/lib/cjs/explore/AlertManagerSilencesExplorer.js +153 -0
  181. package/lib/cjs/getPluginModule.js +39 -0
  182. package/lib/cjs/index-federation.js +55 -0
  183. package/lib/cjs/index.js +39 -0
  184. package/lib/cjs/model/alertmanager-client.js +128 -0
  185. package/lib/cjs/model/alertmanager-selectors.js +66 -0
  186. package/lib/cjs/model/api-types.js +22 -0
  187. package/lib/cjs/model/index.js +32 -0
  188. package/lib/cjs/plugins/AlertManagerDatasourceEditor.js +71 -0
  189. package/lib/cjs/plugins/alert-table/AlertTable.js +56 -0
  190. package/lib/cjs/plugins/alert-table/AlertTableColumnsEditor.js +110 -0
  191. package/lib/cjs/plugins/alert-table/AlertTableDeduplicationEditor.js +138 -0
  192. package/lib/cjs/plugins/alert-table/AlertTableLabelsEditor.js +277 -0
  193. package/lib/cjs/plugins/alert-table/AlertTableOptionsEditor.js +128 -0
  194. package/lib/cjs/plugins/alert-table/AlertTablePanel.js +773 -0
  195. package/lib/cjs/plugins/alert-table/alert-table-model.js +142 -0
  196. package/lib/cjs/plugins/alert-table/alert-table-sorting.js +205 -0
  197. package/lib/cjs/plugins/alert-table/label-colors.js +170 -0
  198. package/lib/cjs/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js +51 -0
  199. package/lib/cjs/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js +138 -0
  200. package/lib/cjs/plugins/alertmanager-alerts-query/get-alerts-data.js +124 -0
  201. package/lib/cjs/plugins/alertmanager-datasource.js +69 -0
  202. package/lib/cjs/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js +45 -0
  203. package/lib/cjs/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js +78 -0
  204. package/lib/cjs/plugins/alertmanager-silences-query/get-silences-data.js +64 -0
  205. package/lib/cjs/plugins/index.js +74 -0
  206. package/lib/cjs/plugins/silence-table/SilenceTable.js +42 -0
  207. package/lib/cjs/plugins/silence-table/SilenceTableColumnsEditor.js +137 -0
  208. package/lib/cjs/plugins/silence-table/SilenceTableOptionsEditor.js +63 -0
  209. package/lib/cjs/plugins/silence-table/SilenceTablePanel.js +345 -0
  210. package/lib/cjs/plugins/silence-table/silence-table-model.js +116 -0
  211. package/lib/cjs/plugins/silence-table/silence-table-sorting.js +68 -0
  212. package/lib/cjs/plugins/types.js +16 -0
  213. package/lib/cjs/setup-tests.js +18 -0
  214. package/lib/components/ColumnsEditor.d.ts +25 -0
  215. package/lib/components/ColumnsEditor.d.ts.map +1 -0
  216. package/lib/components/ColumnsEditor.js +258 -0
  217. package/lib/components/ColumnsEditor.js.map +1 -0
  218. package/lib/components/LazyTextField.d.ts +12 -0
  219. package/lib/components/LazyTextField.d.ts.map +1 -0
  220. package/lib/components/LazyTextField.js +42 -0
  221. package/lib/components/LazyTextField.js.map +1 -0
  222. package/lib/components/MatcherEditor.d.ts +17 -0
  223. package/lib/components/MatcherEditor.d.ts.map +1 -0
  224. package/lib/components/MatcherEditor.js +142 -0
  225. package/lib/components/MatcherEditor.js.map +1 -0
  226. package/lib/components/MatchersList.d.ts +10 -0
  227. package/lib/components/MatchersList.d.ts.map +1 -0
  228. package/lib/components/MatchersList.js +40 -0
  229. package/lib/components/MatchersList.js.map +1 -0
  230. package/lib/components/SilenceForm.d.ts +13 -0
  231. package/lib/components/SilenceForm.d.ts.map +1 -0
  232. package/lib/components/SilenceForm.js +194 -0
  233. package/lib/components/SilenceForm.js.map +1 -0
  234. package/lib/components/StatusBadge.d.ts +10 -0
  235. package/lib/components/StatusBadge.d.ts.map +1 -0
  236. package/lib/components/StatusBadge.js +65 -0
  237. package/lib/components/StatusBadge.js.map +1 -0
  238. package/lib/components/index.d.ts +11 -0
  239. package/lib/components/index.d.ts.map +1 -0
  240. package/lib/components/index.js +19 -0
  241. package/lib/components/index.js.map +1 -0
  242. package/lib/explore/AlertManagerAlertsExplorer.d.ts +3 -0
  243. package/lib/explore/AlertManagerAlertsExplorer.d.ts.map +1 -0
  244. package/lib/explore/AlertManagerAlertsExplorer.js +71 -0
  245. package/lib/explore/AlertManagerAlertsExplorer.js.map +1 -0
  246. package/lib/explore/AlertManagerSilencesExplorer.d.ts +3 -0
  247. package/lib/explore/AlertManagerSilencesExplorer.d.ts.map +1 -0
  248. package/lib/explore/AlertManagerSilencesExplorer.js +140 -0
  249. package/lib/explore/AlertManagerSilencesExplorer.js.map +1 -0
  250. package/lib/getPluginModule.d.ts +3 -0
  251. package/lib/getPluginModule.d.ts.map +1 -0
  252. package/lib/getPluginModule.js +26 -0
  253. package/lib/getPluginModule.js.map +1 -0
  254. package/lib/index-federation.d.ts +1 -0
  255. package/lib/index-federation.d.ts.map +1 -0
  256. package/lib/index-federation.js +15 -0
  257. package/lib/index-federation.js.map +1 -0
  258. package/lib/index.d.ts +5 -0
  259. package/lib/index.d.ts.map +1 -0
  260. package/lib/index.js +18 -0
  261. package/lib/index.js.map +1 -0
  262. package/lib/model/alertmanager-client.d.ts +27 -0
  263. package/lib/model/alertmanager-client.d.ts.map +1 -0
  264. package/lib/model/alertmanager-client.js +100 -0
  265. package/lib/model/alertmanager-client.js.map +1 -0
  266. package/lib/model/alertmanager-selectors.d.ts +13 -0
  267. package/lib/model/alertmanager-selectors.d.ts.map +1 -0
  268. package/lib/model/alertmanager-selectors.js +41 -0
  269. package/lib/model/alertmanager-selectors.js.map +1 -0
  270. package/lib/model/api-types.d.ts +120 -0
  271. package/lib/model/api-types.d.ts.map +1 -0
  272. package/lib/model/api-types.js +23 -0
  273. package/lib/model/api-types.js.map +1 -0
  274. package/lib/model/index.d.ts +4 -0
  275. package/lib/model/index.d.ts.map +1 -0
  276. package/lib/model/index.js +17 -0
  277. package/lib/model/index.js.map +1 -0
  278. package/lib/plugins/AlertManagerDatasourceEditor.d.ts +9 -0
  279. package/lib/plugins/AlertManagerDatasourceEditor.d.ts.map +1 -0
  280. package/lib/plugins/AlertManagerDatasourceEditor.js +63 -0
  281. package/lib/plugins/AlertManagerDatasourceEditor.js.map +1 -0
  282. package/lib/plugins/alert-table/AlertTable.d.ts +8 -0
  283. package/lib/plugins/alert-table/AlertTable.d.ts.map +1 -0
  284. package/lib/plugins/alert-table/AlertTable.js +50 -0
  285. package/lib/plugins/alert-table/AlertTable.js.map +1 -0
  286. package/lib/plugins/alert-table/AlertTableColumnsEditor.d.ts +5 -0
  287. package/lib/plugins/alert-table/AlertTableColumnsEditor.d.ts.map +1 -0
  288. package/lib/plugins/alert-table/AlertTableColumnsEditor.js +102 -0
  289. package/lib/plugins/alert-table/AlertTableColumnsEditor.js.map +1 -0
  290. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.d.ts +5 -0
  291. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.d.ts.map +1 -0
  292. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.js +130 -0
  293. package/lib/plugins/alert-table/AlertTableDeduplicationEditor.js.map +1 -0
  294. package/lib/plugins/alert-table/AlertTableLabelsEditor.d.ts +5 -0
  295. package/lib/plugins/alert-table/AlertTableLabelsEditor.d.ts.map +1 -0
  296. package/lib/plugins/alert-table/AlertTableLabelsEditor.js +264 -0
  297. package/lib/plugins/alert-table/AlertTableLabelsEditor.js.map +1 -0
  298. package/lib/plugins/alert-table/AlertTableOptionsEditor.d.ts +5 -0
  299. package/lib/plugins/alert-table/AlertTableOptionsEditor.d.ts.map +1 -0
  300. package/lib/plugins/alert-table/AlertTableOptionsEditor.js +120 -0
  301. package/lib/plugins/alert-table/AlertTableOptionsEditor.js.map +1 -0
  302. package/lib/plugins/alert-table/AlertTablePanel.d.ts +11 -0
  303. package/lib/plugins/alert-table/AlertTablePanel.d.ts.map +1 -0
  304. package/lib/plugins/alert-table/AlertTablePanel.js +763 -0
  305. package/lib/plugins/alert-table/AlertTablePanel.js.map +1 -0
  306. package/lib/plugins/alert-table/alert-table-model.d.ts +73 -0
  307. package/lib/plugins/alert-table/alert-table-model.d.ts.map +1 -0
  308. package/lib/plugins/alert-table/alert-table-model.js +127 -0
  309. package/lib/plugins/alert-table/alert-table-model.js.map +1 -0
  310. package/lib/plugins/alert-table/alert-table-sorting.d.ts +13 -0
  311. package/lib/plugins/alert-table/alert-table-sorting.d.ts.map +1 -0
  312. package/lib/plugins/alert-table/alert-table-sorting.js +180 -0
  313. package/lib/plugins/alert-table/alert-table-sorting.js.map +1 -0
  314. package/lib/plugins/alert-table/label-colors.d.ts +6 -0
  315. package/lib/plugins/alert-table/label-colors.d.ts.map +1 -0
  316. package/lib/plugins/alert-table/label-colors.js +148 -0
  317. package/lib/plugins/alert-table/label-colors.js.map +1 -0
  318. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.d.ts +4 -0
  319. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.d.ts.map +1 -0
  320. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js +43 -0
  321. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQuery.js.map +1 -0
  322. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.d.ts +9 -0
  323. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.d.ts.map +1 -0
  324. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js +130 -0
  325. package/lib/plugins/alertmanager-alerts-query/AlertManagerAlertsQueryEditor.js.map +1 -0
  326. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.d.ts +8 -0
  327. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.d.ts.map +1 -0
  328. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.js +118 -0
  329. package/lib/plugins/alertmanager-alerts-query/get-alerts-data.js.map +1 -0
  330. package/lib/plugins/alertmanager-datasource.d.ts +5 -0
  331. package/lib/plugins/alertmanager-datasource.d.ts.map +1 -0
  332. package/lib/plugins/alertmanager-datasource.js +61 -0
  333. package/lib/plugins/alertmanager-datasource.js.map +1 -0
  334. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.d.ts +4 -0
  335. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.d.ts.map +1 -0
  336. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js +37 -0
  337. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQuery.js.map +1 -0
  338. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.d.ts +9 -0
  339. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.d.ts.map +1 -0
  340. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js +70 -0
  341. package/lib/plugins/alertmanager-silences-query/AlertManagerSilencesQueryEditor.js.map +1 -0
  342. package/lib/plugins/alertmanager-silences-query/get-silences-data.d.ts +8 -0
  343. package/lib/plugins/alertmanager-silences-query/get-silences-data.d.ts.map +1 -0
  344. package/lib/plugins/alertmanager-silences-query/get-silences-data.js +58 -0
  345. package/lib/plugins/alertmanager-silences-query/get-silences-data.js.map +1 -0
  346. package/lib/plugins/index.d.ts +19 -0
  347. package/lib/plugins/index.d.ts.map +1 -0
  348. package/lib/plugins/index.js +30 -0
  349. package/lib/plugins/index.js.map +1 -0
  350. package/lib/plugins/silence-table/SilenceTable.d.ts +7 -0
  351. package/lib/plugins/silence-table/SilenceTable.d.ts.map +1 -0
  352. package/lib/plugins/silence-table/SilenceTable.js +36 -0
  353. package/lib/plugins/silence-table/SilenceTable.js.map +1 -0
  354. package/lib/plugins/silence-table/SilenceTableColumnsEditor.d.ts +5 -0
  355. package/lib/plugins/silence-table/SilenceTableColumnsEditor.d.ts.map +1 -0
  356. package/lib/plugins/silence-table/SilenceTableColumnsEditor.js +129 -0
  357. package/lib/plugins/silence-table/SilenceTableColumnsEditor.js.map +1 -0
  358. package/lib/plugins/silence-table/SilenceTableOptionsEditor.d.ts +5 -0
  359. package/lib/plugins/silence-table/SilenceTableOptionsEditor.d.ts.map +1 -0
  360. package/lib/plugins/silence-table/SilenceTableOptionsEditor.js +55 -0
  361. package/lib/plugins/silence-table/SilenceTableOptionsEditor.js.map +1 -0
  362. package/lib/plugins/silence-table/SilenceTablePanel.d.ts +11 -0
  363. package/lib/plugins/silence-table/SilenceTablePanel.d.ts.map +1 -0
  364. package/lib/plugins/silence-table/SilenceTablePanel.js +335 -0
  365. package/lib/plugins/silence-table/SilenceTablePanel.js.map +1 -0
  366. package/lib/plugins/silence-table/silence-table-model.d.ts +29 -0
  367. package/lib/plugins/silence-table/silence-table-model.d.ts.map +1 -0
  368. package/lib/plugins/silence-table/silence-table-model.js +90 -0
  369. package/lib/plugins/silence-table/silence-table-model.js.map +1 -0
  370. package/lib/plugins/silence-table/silence-table-sorting.d.ts +9 -0
  371. package/lib/plugins/silence-table/silence-table-sorting.d.ts.map +1 -0
  372. package/lib/plugins/silence-table/silence-table-sorting.js +60 -0
  373. package/lib/plugins/silence-table/silence-table-sorting.js.map +1 -0
  374. package/lib/plugins/types.d.ts +30 -0
  375. package/lib/plugins/types.d.ts.map +1 -0
  376. package/lib/plugins/types.js +17 -0
  377. package/lib/plugins/types.js.map +1 -0
  378. package/lib/setup-tests.d.ts +2 -0
  379. package/lib/setup-tests.d.ts.map +1 -0
  380. package/lib/setup-tests.js +16 -0
  381. package/lib/setup-tests.js.map +1 -0
  382. package/mf-manifest.json +663 -0
  383. package/mf-stats.json +784 -0
  384. package/package.json +116 -0
@@ -0,0 +1,142 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get ALL_ALERT_ACTIONS () {
25
+ return ALL_ALERT_ACTIONS;
26
+ },
27
+ get deduplicateAlerts () {
28
+ return deduplicateAlerts;
29
+ },
30
+ get extractLabelKeys () {
31
+ return extractLabelKeys;
32
+ },
33
+ get getGroupKey () {
34
+ return getGroupKey;
35
+ },
36
+ get getGroupSummary () {
37
+ return getGroupSummary;
38
+ }
39
+ });
40
+ const _alerttablesorting = require("./alert-table-sorting");
41
+ const ALL_ALERT_ACTIONS = [
42
+ 'silence',
43
+ 'runbook'
44
+ ];
45
+ function deduplicateAlerts(alerts, config) {
46
+ if (alerts.length === 0 || config.mode === 'none') return {
47
+ alerts,
48
+ duplicateCounts: new Map()
49
+ };
50
+ const seen = new Map();
51
+ const counts = new Map();
52
+ const result = [];
53
+ for (const alert of alerts){
54
+ let key;
55
+ if (config.mode === 'labels' && config.labels) {
56
+ key = config.labels.map((l)=>`${l}=${alert.labels[l] ?? ''}`).join(',');
57
+ } else if (alert.id) {
58
+ key = alert.id;
59
+ } else {
60
+ key = JSON.stringify(alert.labels);
61
+ }
62
+ if (!seen.has(key)) {
63
+ seen.set(key, alert);
64
+ counts.set(key, 1);
65
+ result.push(alert);
66
+ } else {
67
+ counts.set(key, (counts.get(key) ?? 1) + 1);
68
+ }
69
+ }
70
+ const duplicateCounts = new Map();
71
+ for (const [key, alert] of seen){
72
+ const count = counts.get(key) ?? 1;
73
+ if (count > 1) {
74
+ duplicateCounts.set(alert, count);
75
+ }
76
+ }
77
+ return {
78
+ alerts: result,
79
+ duplicateCounts
80
+ };
81
+ }
82
+ function extractLabelKeys(alerts) {
83
+ const keys = new Set();
84
+ for (const alert of alerts){
85
+ for (const key of Object.keys(alert.labels)){
86
+ keys.add(key);
87
+ }
88
+ }
89
+ return Array.from(keys).sort();
90
+ }
91
+ function getGroupKey(alert, groupBy) {
92
+ return groupBy.map((label)=>`${label}=${alert.labels[label] ?? ''}`).join(',');
93
+ }
94
+ function getGroupSummary(alerts, labelKeys) {
95
+ const summary = {
96
+ total: 0,
97
+ firing: 0,
98
+ suppressed: 0,
99
+ pending: 0
100
+ };
101
+ const labelCounts = {};
102
+ labelCounts[_alerttablesorting.SORT_COL_STATUS] = {};
103
+ labelCounts[_alerttablesorting.SORT_COL_ALERTNAME] = {};
104
+ if (labelKeys) {
105
+ for (const key of labelKeys){
106
+ labelCounts[key] = {};
107
+ }
108
+ }
109
+ for (const alert of alerts){
110
+ summary.total++;
111
+ if (alert.suppressed) {
112
+ summary.suppressed++;
113
+ } else {
114
+ switch(alert.state){
115
+ case 'firing':
116
+ summary.firing++;
117
+ break;
118
+ case 'pending':
119
+ summary.pending++;
120
+ break;
121
+ }
122
+ }
123
+ const status = (0, _alerttablesorting.getEffectiveStatus)(alert);
124
+ labelCounts[_alerttablesorting.SORT_COL_STATUS][status] = (labelCounts[_alerttablesorting.SORT_COL_STATUS][status] ?? 0) + 1;
125
+ if (alert.name) {
126
+ labelCounts[_alerttablesorting.SORT_COL_ALERTNAME][alert.name] = (labelCounts[_alerttablesorting.SORT_COL_ALERTNAME][alert.name] ?? 0) + 1;
127
+ }
128
+ if (labelKeys) {
129
+ for (const key of labelKeys){
130
+ const labelValue = alert.labels[key];
131
+ if (labelValue !== undefined) {
132
+ const counts = labelCounts[key];
133
+ if (counts) {
134
+ counts[labelValue] = (counts[labelValue] ?? 0) + 1;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ summary.labelCounts = labelCounts;
141
+ return summary;
142
+ }
@@ -0,0 +1,205 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get SORT_COL_ALERTNAME () {
25
+ return SORT_COL_ALERTNAME;
26
+ },
27
+ get SORT_COL_STATUS () {
28
+ return SORT_COL_STATUS;
29
+ },
30
+ get compareAlertsByColumn () {
31
+ return compareAlertsByColumn;
32
+ },
33
+ get compareGroupsByColumn () {
34
+ return compareGroupsByColumn;
35
+ },
36
+ get getEffectiveStatus () {
37
+ return getEffectiveStatus;
38
+ }
39
+ });
40
+ const _labelcolors = require("./label-colors");
41
+ const SORT_COL_STATUS = '__status__';
42
+ const SORT_COL_ALERTNAME = '__alertname__';
43
+ const STATUS_WEIGHT = {
44
+ firing: 0,
45
+ pending: 1,
46
+ suppressed: 2,
47
+ inactive: 3,
48
+ resolved: 4
49
+ };
50
+ function getEffectiveStatus(alert) {
51
+ return alert.suppressed ? 'suppressed' : alert.state;
52
+ }
53
+ function compareStatus(a, b) {
54
+ const wa = a !== undefined ? STATUS_WEIGHT[a] ?? 5 : 5;
55
+ const wb = b !== undefined ? STATUS_WEIGHT[b] ?? 5 : 5;
56
+ return wa - wb;
57
+ }
58
+ function directionMultiplier(direction) {
59
+ return direction === 'asc' ? 1 : -1;
60
+ }
61
+ function compareAlphabetical(a, b) {
62
+ if (a === undefined && b === undefined) return 0;
63
+ if (a === undefined) return 1;
64
+ if (b === undefined) return -1;
65
+ return a.localeCompare(b);
66
+ }
67
+ function compareNumeric(a, b) {
68
+ const na = a !== undefined ? parseFloat(a) : NaN;
69
+ const nb = b !== undefined ? parseFloat(b) : NaN;
70
+ if (isNaN(na) && isNaN(nb)) return 0;
71
+ if (isNaN(na)) return 1;
72
+ if (isNaN(nb)) return -1;
73
+ return na - nb;
74
+ }
75
+ function compareSeverity(a, b) {
76
+ const wa = a !== undefined ? (0, _labelcolors.getSeverityWeight)(a) : _labelcolors.SEVERITY_ORDER.length;
77
+ const wb = b !== undefined ? (0, _labelcolors.getSeverityWeight)(b) : _labelcolors.SEVERITY_ORDER.length;
78
+ return wa - wb;
79
+ }
80
+ function compareAlertsByColumn(a, b, sort) {
81
+ if (sort.columnName === SORT_COL_STATUS) {
82
+ return compareStatus(getEffectiveStatus(a), getEffectiveStatus(b)) * directionMultiplier(sort.direction);
83
+ }
84
+ if (sort.columnName === SORT_COL_ALERTNAME) {
85
+ return compareAlphabetical(a.name, b.name) * directionMultiplier(sort.direction);
86
+ }
87
+ const va = a.labels[sort.columnName];
88
+ const vb = b.labels[sort.columnName];
89
+ let result;
90
+ switch(sort.mode){
91
+ case 'numeric':
92
+ result = compareNumeric(va, vb);
93
+ break;
94
+ case 'severity':
95
+ result = compareSeverity(va, vb);
96
+ break;
97
+ case 'alphabetical':
98
+ default:
99
+ result = compareAlphabetical(va, vb);
100
+ break;
101
+ }
102
+ return result * directionMultiplier(sort.direction);
103
+ }
104
+ function getMostFrequentValue(counts) {
105
+ let maxCount = 0;
106
+ let maxValue;
107
+ for (const [value, count] of Object.entries(counts)){
108
+ if (count > maxCount) {
109
+ maxCount = count;
110
+ maxValue = value;
111
+ }
112
+ }
113
+ return {
114
+ value: maxValue,
115
+ count: maxCount
116
+ };
117
+ }
118
+ function getMostCriticalStatus(counts) {
119
+ let minWeight = 5;
120
+ let countAtMin = 0;
121
+ for (const [value, count] of Object.entries(counts)){
122
+ const weight = STATUS_WEIGHT[value] ?? 5;
123
+ if (weight < minWeight) {
124
+ minWeight = weight;
125
+ countAtMin = count;
126
+ } else if (weight === minWeight) {
127
+ countAtMin += count;
128
+ }
129
+ }
130
+ return {
131
+ weight: minWeight,
132
+ count: countAtMin
133
+ };
134
+ }
135
+ function getMostCriticalSeverity(counts) {
136
+ let minWeight = _labelcolors.SEVERITY_ORDER.length;
137
+ let countAtMin = 0;
138
+ for (const [value, count] of Object.entries(counts)){
139
+ const weight = (0, _labelcolors.getSeverityWeight)(value);
140
+ if (weight < minWeight) {
141
+ minWeight = weight;
142
+ countAtMin = count;
143
+ } else if (weight === minWeight) {
144
+ countAtMin += count;
145
+ }
146
+ }
147
+ return {
148
+ weight: minWeight,
149
+ count: countAtMin
150
+ };
151
+ }
152
+ function compareGroupsByColumn(aCounts, bCounts, sort) {
153
+ const emptyA = !aCounts || Object.keys(aCounts).length === 0;
154
+ const emptyB = !bCounts || Object.keys(bCounts).length === 0;
155
+ if (emptyA && emptyB) return 0;
156
+ if (emptyA) return 1;
157
+ if (emptyB) return -1;
158
+ let result;
159
+ switch(sort.mode){
160
+ case 'status':
161
+ {
162
+ const statusA = getMostCriticalStatus(aCounts);
163
+ const statusB = getMostCriticalStatus(bCounts);
164
+ result = statusA.weight - statusB.weight;
165
+ if (result === 0) {
166
+ result = statusB.count - statusA.count;
167
+ }
168
+ break;
169
+ }
170
+ case 'severity':
171
+ {
172
+ const sevA = getMostCriticalSeverity(aCounts);
173
+ const sevB = getMostCriticalSeverity(bCounts);
174
+ result = sevA.weight - sevB.weight;
175
+ if (result === 0) {
176
+ result = sevB.count - sevA.count;
177
+ }
178
+ break;
179
+ }
180
+ case 'numeric':
181
+ {
182
+ const freqA = getMostFrequentValue(aCounts);
183
+ const freqB = getMostFrequentValue(bCounts);
184
+ const numResult = compareNumeric(freqA.value, freqB.value);
185
+ if (numResult !== 0) {
186
+ return numResult * directionMultiplier(sort.direction);
187
+ }
188
+ // Tie-break by count is always descending (larger groups first) regardless of sort direction
189
+ return freqB.count - freqA.count;
190
+ }
191
+ case 'alphabetical':
192
+ default:
193
+ {
194
+ const freqA = getMostFrequentValue(aCounts);
195
+ const freqB = getMostFrequentValue(bCounts);
196
+ const alphaResult = compareAlphabetical(freqA.value, freqB.value);
197
+ if (alphaResult !== 0) {
198
+ return alphaResult * directionMultiplier(sort.direction);
199
+ }
200
+ // Tie-break by count is always descending (larger groups first) regardless of sort direction
201
+ return freqB.count - freqA.count;
202
+ }
203
+ }
204
+ return result * directionMultiplier(sort.direction);
205
+ }
@@ -0,0 +1,170 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get SEVERITY_ORDER () {
25
+ return SEVERITY_ORDER;
26
+ },
27
+ get getLabelColor () {
28
+ return getLabelColor;
29
+ },
30
+ get getSeverityWeight () {
31
+ return getSeverityWeight;
32
+ },
33
+ get hashStringToColor () {
34
+ return hashStringToColor;
35
+ }
36
+ });
37
+ const SEVERITY_LEVEL_COLORS = {
38
+ critical: '#d32f2f',
39
+ error: '#ef6c00',
40
+ warning: '#f9a825',
41
+ info: '#0288d1',
42
+ debug: '#7b1fa2',
43
+ trace: '#6a1b9a',
44
+ unknown: '#757575',
45
+ other: '#9e9e9e'
46
+ };
47
+ const SEVERITY_ABBREVIATIONS = {
48
+ critical: [
49
+ 'critical',
50
+ 'crit',
51
+ 'fatal',
52
+ 'emerg',
53
+ 'alert',
54
+ 'page'
55
+ ],
56
+ error: [
57
+ 'error',
58
+ 'err',
59
+ 'eror',
60
+ 'high',
61
+ 'severe'
62
+ ],
63
+ warning: [
64
+ 'warning',
65
+ 'warn',
66
+ 'medium'
67
+ ],
68
+ info: [
69
+ 'info',
70
+ 'inf',
71
+ 'information',
72
+ 'informational',
73
+ 'notice',
74
+ 'low'
75
+ ],
76
+ debug: [
77
+ 'debug',
78
+ 'dbug'
79
+ ],
80
+ trace: [
81
+ 'trace'
82
+ ],
83
+ unknown: [
84
+ 'unknown'
85
+ ],
86
+ other: [
87
+ 'other',
88
+ 'none',
89
+ 'minor',
90
+ ''
91
+ ]
92
+ };
93
+ const SEVERITY_COLORS = {};
94
+ for (const [level, abbrevs] of Object.entries(SEVERITY_ABBREVIATIONS)){
95
+ const color = SEVERITY_LEVEL_COLORS[level];
96
+ for (const abbrev of abbrevs){
97
+ SEVERITY_COLORS[abbrev] = color;
98
+ }
99
+ }
100
+ const SEVERITY_ORDER = [
101
+ 'critical',
102
+ 'error',
103
+ 'warning',
104
+ 'info',
105
+ 'debug',
106
+ 'trace',
107
+ 'unknown',
108
+ 'other'
109
+ ];
110
+ function getSeverityWeight(value) {
111
+ const normalized = value.toLowerCase();
112
+ for (const [level, abbrevs] of Object.entries(SEVERITY_ABBREVIATIONS)){
113
+ if (abbrevs.includes(normalized)) {
114
+ const idx = SEVERITY_ORDER.indexOf(level);
115
+ return idx === -1 ? SEVERITY_ORDER.length : idx;
116
+ }
117
+ }
118
+ return SEVERITY_ORDER.length;
119
+ }
120
+ const MANUAL_FALLBACK = '#9e9e9e';
121
+ const ERROR_HUE_CUTOFF = 20;
122
+ function hashStringToColor(value) {
123
+ let hash = 5381;
124
+ for(let i = 0; i < value.length; i++){
125
+ hash = hash * 33 ^ value.charCodeAt(i);
126
+ }
127
+ hash = Math.abs(hash);
128
+ const hue = ERROR_HUE_CUTOFF + hash % (360 - ERROR_HUE_CUTOFF);
129
+ const saturation = 55 + hash % 25;
130
+ const lightness = 45 + hash % 15;
131
+ return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
132
+ }
133
+ const MAX_REGEX_CACHE_SIZE = 1000;
134
+ const regexCache = new Map();
135
+ function getCompiledRegex(pattern) {
136
+ if (regexCache.has(pattern)) return regexCache.get(pattern);
137
+ if (regexCache.size >= MAX_REGEX_CACHE_SIZE) regexCache.clear();
138
+ try {
139
+ const re = new RegExp(pattern);
140
+ regexCache.set(pattern, re);
141
+ return re;
142
+ } catch {
143
+ regexCache.set(pattern, null);
144
+ return null;
145
+ }
146
+ }
147
+ function matchesOverride(labelValue, pattern, isRegex) {
148
+ if (isRegex) {
149
+ const re = getCompiledRegex(pattern);
150
+ return re !== null && re.test(labelValue);
151
+ }
152
+ return labelValue === pattern;
153
+ }
154
+ function getLabelColor(value, mapping) {
155
+ if (mapping.overrides) {
156
+ for (const override of mapping.overrides){
157
+ if (matchesOverride(value, override.value, override.isRegex)) {
158
+ return override.color;
159
+ }
160
+ }
161
+ }
162
+ switch(mapping.mode){
163
+ case 'severity':
164
+ return SEVERITY_COLORS[value.toLowerCase()] ?? hashStringToColor(value);
165
+ case 'auto':
166
+ return hashStringToColor(value);
167
+ case 'manual':
168
+ return MANUAL_FALLBACK;
169
+ }
170
+ }
@@ -0,0 +1,51 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "AlertManagerAlertsQuery", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return AlertManagerAlertsQuery;
21
+ }
22
+ });
23
+ const _pluginsystem = require("@perses-dev/plugin-system");
24
+ const _getalertsdata = require("./get-alerts-data");
25
+ const _AlertManagerAlertsQueryEditor = require("./AlertManagerAlertsQueryEditor");
26
+ const AlertManagerAlertsQuery = {
27
+ getAlertsData: _getalertsdata.getAlertsData,
28
+ OptionsEditorComponent: _AlertManagerAlertsQueryEditor.AlertManagerAlertsQueryEditor,
29
+ createInitialOptions: ()=>({
30
+ datasource: undefined,
31
+ filters: [],
32
+ active: true,
33
+ silenced: false,
34
+ inhibited: false,
35
+ receiver: undefined
36
+ }),
37
+ dependsOn: (spec)=>{
38
+ const datasourceVariables = (0, _pluginsystem.isVariableDatasource)(spec.datasource) ? (0, _pluginsystem.parseVariables)(spec.datasource ?? '') : [];
39
+ const filterVariables = spec.filters?.flatMap((f)=>(0, _pluginsystem.parseVariables)(f)) ?? [];
40
+ const receiverVariables = spec.receiver ? (0, _pluginsystem.parseVariables)(spec.receiver) : [];
41
+ return {
42
+ variables: [
43
+ ...new Set([
44
+ ...datasourceVariables,
45
+ ...filterVariables,
46
+ ...receiverVariables
47
+ ])
48
+ ]
49
+ };
50
+ }
51
+ };