@northern.tech/store 0.29.0 → 0.30.1

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 (446) hide show
  1. package/dist/actions.cjs +21 -1131
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +212 -221
  4. package/dist/actions.d.ts +212 -220
  5. package/dist/actions.js +21 -18
  6. package/dist/actions.js.map +1 -1
  7. package/dist/api/general-api.cjs +61 -459
  8. package/dist/api/general-api.cjs.map +1 -1
  9. package/dist/api/general-api.d.cts +15 -17
  10. package/dist/api/general-api.d.ts +15 -17
  11. package/dist/api/general-api.js +56 -15
  12. package/dist/api/general-api.js.map +1 -1
  13. package/dist/api/users-api.cjs +32 -469
  14. package/dist/api/users-api.cjs.map +1 -1
  15. package/dist/api/users-api.d.cts +19 -14
  16. package/dist/api/users-api.d.ts +19 -13
  17. package/dist/api/users-api.js +30 -12
  18. package/dist/api/users-api.js.map +1 -1
  19. package/dist/appSlice/constants.cjs +190 -144
  20. package/dist/appSlice/constants.cjs.map +1 -1
  21. package/dist/appSlice/constants.d.cts +2 -159
  22. package/dist/appSlice/constants.d.ts +2 -159
  23. package/dist/appSlice/constants.js +181 -29
  24. package/dist/appSlice/constants.js.map +1 -1
  25. package/dist/appSlice/index.cjs +147 -179
  26. package/dist/appSlice/index.cjs.map +1 -1
  27. package/dist/appSlice/index.d.cts +2 -148
  28. package/dist/appSlice/index.d.ts +2 -148
  29. package/dist/appSlice/index.js +142 -18
  30. package/dist/appSlice/index.js.map +1 -1
  31. package/dist/appSlice/mocks.cjs +17 -192
  32. package/dist/appSlice/mocks.cjs.map +1 -1
  33. package/dist/appSlice/mocks.d.cts +33 -36
  34. package/dist/appSlice/mocks.d.ts +33 -36
  35. package/dist/appSlice/mocks.js +17 -25
  36. package/dist/appSlice/mocks.js.map +1 -1
  37. package/dist/appSlice/selectors.cjs +49 -91
  38. package/dist/appSlice/selectors.cjs.map +1 -1
  39. package/dist/appSlice/selectors.d.cts +216 -230
  40. package/dist/appSlice/selectors.d.ts +216 -230
  41. package/dist/appSlice/selectors.js +29 -44
  42. package/dist/appSlice/selectors.js.map +1 -1
  43. package/dist/appSlice/thunks.cjs +6 -4642
  44. package/dist/appSlice/thunks.d.cts +59 -62
  45. package/dist/appSlice/thunks.d.ts +59 -62
  46. package/dist/appSlice/thunks.js +2 -45
  47. package/dist/auth.cjs +68 -433
  48. package/dist/auth.cjs.map +1 -1
  49. package/dist/auth.d.cts +14 -14
  50. package/dist/auth.d.ts +14 -14
  51. package/dist/auth.js +65 -18
  52. package/dist/auth.js.map +1 -1
  53. package/dist/chunk-CKQMccvm.cjs +28 -0
  54. package/dist/commonConstants.cjs +14 -393
  55. package/dist/commonConstants.d.cts +2 -83
  56. package/dist/commonConstants.d.ts +2 -83
  57. package/dist/commonConstants.js +2 -33
  58. package/dist/commonSelectors.cjs +284 -1281
  59. package/dist/commonSelectors.cjs.map +1 -1
  60. package/dist/commonSelectors.d.cts +1607 -1460
  61. package/dist/commonSelectors.d.ts +1607 -1460
  62. package/dist/commonSelectors.js +277 -55
  63. package/dist/commonSelectors.js.map +1 -1
  64. package/dist/constants-5cdwz1iH.d.ts +160 -0
  65. package/dist/constants-BWEsNG5c.d.ts +28 -0
  66. package/dist/constants-BciiayPt.d.ts +17 -0
  67. package/dist/constants-C5AU0mCY.d.ts +157 -0
  68. package/dist/constants-CIx3fnBv.d.cts +17 -0
  69. package/dist/constants-CNhpIMME.d.cts +93 -0
  70. package/dist/constants-Cpgyuy_r.d.ts +57 -0
  71. package/dist/constants-D41U_jbR.d.cts +160 -0
  72. package/dist/constants-DK7fI3Rh.d.cts +28 -0
  73. package/dist/constants-DPLHhjVN.d.cts +157 -0
  74. package/dist/constants-DrwXHsJ1.d.ts +120 -0
  75. package/dist/constants-G3wymKIl.d.cts +57 -0
  76. package/dist/constants-MPLfugsi.d.cts +120 -0
  77. package/dist/constants-y2XVLQWf.d.ts +93 -0
  78. package/dist/constants.cjs +784 -974
  79. package/dist/constants.cjs.map +1 -1
  80. package/dist/constants.d.cts +8 -14
  81. package/dist/constants.d.ts +8 -14
  82. package/dist/constants.js +674 -234
  83. package/dist/constants.js.map +1 -1
  84. package/dist/deploymentsSlice/constants.cjs +15 -214
  85. package/dist/deploymentsSlice/constants.d.cts +2 -163
  86. package/dist/deploymentsSlice/constants.d.ts +2 -163
  87. package/dist/deploymentsSlice/constants.js +2 -35
  88. package/dist/deploymentsSlice/index.cjs +168 -302
  89. package/dist/deploymentsSlice/index.cjs.map +1 -1
  90. package/dist/deploymentsSlice/index.d.cts +2 -157
  91. package/dist/deploymentsSlice/index.d.ts +2 -157
  92. package/dist/deploymentsSlice/index.js +161 -18
  93. package/dist/deploymentsSlice/index.js.map +1 -1
  94. package/dist/deploymentsSlice/mocks.cjs +178 -433
  95. package/dist/deploymentsSlice/mocks.cjs.map +1 -1
  96. package/dist/deploymentsSlice/mocks.d.cts +176 -178
  97. package/dist/deploymentsSlice/mocks.d.ts +176 -178
  98. package/dist/deploymentsSlice/mocks.js +178 -144
  99. package/dist/deploymentsSlice/mocks.js.map +1 -1
  100. package/dist/deploymentsSlice/selectors.cjs +44 -223
  101. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  102. package/dist/deploymentsSlice/selectors.d.cts +73 -87
  103. package/dist/deploymentsSlice/selectors.d.ts +73 -87
  104. package/dist/deploymentsSlice/selectors.js +37 -25
  105. package/dist/deploymentsSlice/selectors.js.map +1 -1
  106. package/dist/deploymentsSlice/thunks.cjs +16 -4660
  107. package/dist/deploymentsSlice/thunks.d.cts +222 -235
  108. package/dist/deploymentsSlice/thunks.d.ts +222 -235
  109. package/dist/deploymentsSlice/thunks.js +2 -65
  110. package/dist/devicesSlice/constants.cjs +9 -68
  111. package/dist/devicesSlice/constants.d.cts +2 -37
  112. package/dist/devicesSlice/constants.d.ts +2 -37
  113. package/dist/devicesSlice/constants.js +2 -23
  114. package/dist/devicesSlice/index.cjs +215 -225
  115. package/dist/devicesSlice/index.cjs.map +1 -1
  116. package/dist/devicesSlice/index.d.cts +2 -202
  117. package/dist/devicesSlice/index.d.ts +2 -202
  118. package/dist/devicesSlice/index.js +209 -18
  119. package/dist/devicesSlice/index.js.map +1 -1
  120. package/dist/devicesSlice/mocks.cjs +146 -339
  121. package/dist/devicesSlice/mocks.cjs.map +1 -1
  122. package/dist/devicesSlice/mocks.d.cts +150 -148
  123. package/dist/devicesSlice/mocks.d.ts +150 -148
  124. package/dist/devicesSlice/mocks.js +145 -132
  125. package/dist/devicesSlice/mocks.js.map +1 -1
  126. package/dist/devicesSlice/selectors.cjs +145 -539
  127. package/dist/devicesSlice/selectors.cjs.map +1 -1
  128. package/dist/devicesSlice/selectors.d.cts +685 -699
  129. package/dist/devicesSlice/selectors.d.ts +685 -699
  130. package/dist/devicesSlice/selectors.js +123 -59
  131. package/dist/devicesSlice/selectors.js.map +1 -1
  132. package/dist/devicesSlice/thunks.cjs +48 -4724
  133. package/dist/devicesSlice/thunks.d.cts +800 -752
  134. package/dist/devicesSlice/thunks.d.ts +800 -752
  135. package/dist/devicesSlice/thunks.js +2 -129
  136. package/dist/index-4eaLEXy_.d.cts +152 -0
  137. package/dist/index-BEVkIiNa.d.cts +95 -0
  138. package/dist/index-BP0uAq36.d.cts +159 -0
  139. package/dist/index-Bwx9jEiL.d.cts +71 -0
  140. package/dist/index-CJkrL0oA.d.ts +64 -0
  141. package/dist/index-CO-py5d4.d.ts +95 -0
  142. package/dist/index-CTt-eIY8.d.cts +154 -0
  143. package/dist/index-CkwVnIqd.d.ts +159 -0
  144. package/dist/index-Cvkvcz4r.d.ts +115 -0
  145. package/dist/index-DJSlDPRX.d.ts +71 -0
  146. package/dist/index-DqyY6oZ3.d.ts +205 -0
  147. package/dist/index-DtePEQPT.d.ts +152 -0
  148. package/dist/index-Dv3Hfxk_.d.ts +154 -0
  149. package/dist/index-FyYBBeN-.d.cts +115 -0
  150. package/dist/index-Lz5JsJ6O.d.cts +205 -0
  151. package/dist/index-UPc3wvVd.d.cts +64 -0
  152. package/dist/liststatehook.cjs +83 -948
  153. package/dist/liststatehook.cjs.map +1 -1
  154. package/dist/liststatehook.d.cts +29 -239
  155. package/dist/liststatehook.d.ts +29 -239
  156. package/dist/liststatehook.js +77 -85
  157. package/dist/liststatehook.js.map +1 -1
  158. package/dist/locationutils.cjs +459 -916
  159. package/dist/locationutils.cjs.map +1 -1
  160. package/dist/locationutils.d.cts +244 -110
  161. package/dist/locationutils.d.ts +244 -110
  162. package/dist/locationutils.js +440 -44
  163. package/dist/locationutils.js.map +1 -1
  164. package/dist/monitorSlice/constants.cjs +0 -19
  165. package/dist/monitorSlice/constants.d.cts +2 -5
  166. package/dist/monitorSlice/constants.d.ts +2 -5
  167. package/dist/monitorSlice/constants.js +1 -2
  168. package/dist/monitorSlice/index.cjs +65 -82
  169. package/dist/monitorSlice/index.cjs.map +1 -1
  170. package/dist/monitorSlice/index.d.cts +2 -94
  171. package/dist/monitorSlice/index.d.ts +2 -94
  172. package/dist/monitorSlice/index.js +59 -18
  173. package/dist/monitorSlice/index.js.map +1 -1
  174. package/dist/monitorSlice/mocks.cjs +50 -127
  175. package/dist/monitorSlice/mocks.cjs.map +1 -1
  176. package/dist/monitorSlice/mocks.d.cts +49 -49
  177. package/dist/monitorSlice/mocks.d.ts +49 -49
  178. package/dist/monitorSlice/mocks.js +49 -63
  179. package/dist/monitorSlice/mocks.js.map +1 -1
  180. package/dist/monitorSlice/selectors.cjs +5 -29
  181. package/dist/monitorSlice/selectors.cjs.map +1 -1
  182. package/dist/monitorSlice/selectors.d.cts +10 -1
  183. package/dist/monitorSlice/selectors.d.ts +10 -1
  184. package/dist/monitorSlice/selectors.js +5 -6
  185. package/dist/monitorSlice/selectors.js.map +1 -1
  186. package/dist/monitorSlice/thunks.cjs +83 -2513
  187. package/dist/monitorSlice/thunks.cjs.map +1 -1
  188. package/dist/monitorSlice/thunks.d.cts +112 -120
  189. package/dist/monitorSlice/thunks.d.ts +112 -120
  190. package/dist/monitorSlice/thunks.js +78 -42
  191. package/dist/monitorSlice/thunks.js.map +1 -1
  192. package/dist/onboardingSlice/constants.cjs +44 -69
  193. package/dist/onboardingSlice/constants.cjs.map +1 -1
  194. package/dist/onboardingSlice/constants.d.cts +2 -26
  195. package/dist/onboardingSlice/constants.d.ts +2 -26
  196. package/dist/onboardingSlice/constants.js +43 -7
  197. package/dist/onboardingSlice/constants.js.map +1 -1
  198. package/dist/onboardingSlice/index.cjs +53 -73
  199. package/dist/onboardingSlice/index.cjs.map +1 -1
  200. package/dist/onboardingSlice/index.d.cts +2 -62
  201. package/dist/onboardingSlice/index.d.ts +2 -62
  202. package/dist/onboardingSlice/index.js +47 -13
  203. package/dist/onboardingSlice/index.js.map +1 -1
  204. package/dist/onboardingSlice/mocks.cjs +12 -81
  205. package/dist/onboardingSlice/mocks.cjs.map +1 -1
  206. package/dist/onboardingSlice/mocks.d.cts +14 -15
  207. package/dist/onboardingSlice/mocks.d.ts +14 -15
  208. package/dist/onboardingSlice/mocks.js +12 -15
  209. package/dist/onboardingSlice/mocks.js.map +1 -1
  210. package/dist/onboardingSlice/selectors.cjs +5 -29
  211. package/dist/onboardingSlice/selectors.cjs.map +1 -1
  212. package/dist/onboardingSlice/selectors.d.cts +6 -1
  213. package/dist/onboardingSlice/selectors.d.ts +6 -1
  214. package/dist/onboardingSlice/selectors.js +5 -6
  215. package/dist/onboardingSlice/selectors.js.map +1 -1
  216. package/dist/onboardingSlice/thunks.cjs +8 -4752
  217. package/dist/onboardingSlice/thunks.d.cts +124 -143
  218. package/dist/onboardingSlice/thunks.d.ts +124 -143
  219. package/dist/onboardingSlice/thunks.js +2 -49
  220. package/dist/organizationSlice/constants.cjs +11 -95
  221. package/dist/organizationSlice/constants.d.cts +2 -91
  222. package/dist/organizationSlice/constants.d.ts +2 -91
  223. package/dist/organizationSlice/constants.js +2 -27
  224. package/dist/organizationSlice/index.cjs +113 -152
  225. package/dist/organizationSlice/index.cjs.map +1 -1
  226. package/dist/organizationSlice/index.d.cts +2 -74
  227. package/dist/organizationSlice/index.d.ts +2 -74
  228. package/dist/organizationSlice/index.js +106 -18
  229. package/dist/organizationSlice/index.js.map +1 -1
  230. package/dist/organizationSlice/mocks.cjs +215 -406
  231. package/dist/organizationSlice/mocks.cjs.map +1 -1
  232. package/dist/organizationSlice/mocks.d.cts +209 -212
  233. package/dist/organizationSlice/mocks.d.ts +209 -212
  234. package/dist/organizationSlice/mocks.js +214 -184
  235. package/dist/organizationSlice/mocks.js.map +1 -1
  236. package/dist/organizationSlice/selectors.cjs +97 -474
  237. package/dist/organizationSlice/selectors.cjs.map +1 -1
  238. package/dist/organizationSlice/selectors.d.cts +381 -389
  239. package/dist/organizationSlice/selectors.d.ts +381 -389
  240. package/dist/organizationSlice/selectors.js +78 -50
  241. package/dist/organizationSlice/selectors.js.map +1 -1
  242. package/dist/organizationSlice/thunks.cjs +43 -5156
  243. package/dist/organizationSlice/thunks.d.cts +638 -649
  244. package/dist/organizationSlice/thunks.d.ts +638 -649
  245. package/dist/organizationSlice/thunks.js +2 -119
  246. package/dist/organizationSlice/types.cjs +0 -19
  247. package/dist/organizationSlice/types.d.cts +2 -88
  248. package/dist/organizationSlice/types.d.ts +2 -88
  249. package/dist/organizationSlice/types.js +1 -1
  250. package/dist/releasesSlice/constants.cjs +17 -41
  251. package/dist/releasesSlice/constants.cjs.map +1 -1
  252. package/dist/releasesSlice/constants.d.cts +2 -15
  253. package/dist/releasesSlice/constants.d.ts +2 -15
  254. package/dist/releasesSlice/constants.js +13 -14
  255. package/dist/releasesSlice/constants.js.map +1 -1
  256. package/dist/releasesSlice/index.cjs +106 -179
  257. package/dist/releasesSlice/index.cjs.map +1 -1
  258. package/dist/releasesSlice/index.d.cts +2 -113
  259. package/dist/releasesSlice/index.d.ts +2 -113
  260. package/dist/releasesSlice/index.js +100 -18
  261. package/dist/releasesSlice/index.js.map +1 -1
  262. package/dist/releasesSlice/mocks.cjs +44 -220
  263. package/dist/releasesSlice/mocks.cjs.map +1 -1
  264. package/dist/releasesSlice/mocks.d.cts +63 -61
  265. package/dist/releasesSlice/mocks.d.ts +63 -61
  266. package/dist/releasesSlice/mocks.js +43 -59
  267. package/dist/releasesSlice/mocks.js.map +1 -1
  268. package/dist/releasesSlice/selectors.cjs +44 -439
  269. package/dist/releasesSlice/selectors.cjs.map +1 -1
  270. package/dist/releasesSlice/selectors.d.cts +268 -280
  271. package/dist/releasesSlice/selectors.d.ts +268 -280
  272. package/dist/releasesSlice/selectors.js +31 -36
  273. package/dist/releasesSlice/selectors.js.map +1 -1
  274. package/dist/releasesSlice/thunks.cjs +436 -2885
  275. package/dist/releasesSlice/thunks.cjs.map +1 -1
  276. package/dist/releasesSlice/thunks.d.cts +305 -307
  277. package/dist/releasesSlice/thunks.d.ts +305 -307
  278. package/dist/releasesSlice/thunks.js +413 -74
  279. package/dist/releasesSlice/thunks.js.map +1 -1
  280. package/dist/selectors.cjs +136 -1542
  281. package/dist/selectors.d.cts +10 -36
  282. package/dist/selectors.d.ts +10 -36
  283. package/dist/selectors.js +10 -284
  284. package/dist/sockethook.cjs +140 -515
  285. package/dist/sockethook.cjs.map +1 -1
  286. package/dist/sockethook.d.cts +25 -9
  287. package/dist/sockethook.d.ts +25 -9
  288. package/dist/sockethook.js +134 -135
  289. package/dist/sockethook.js.map +1 -1
  290. package/dist/store-BQxOSRC1.d.ts +234 -0
  291. package/dist/store-BiIA0r0A.d.cts +234 -0
  292. package/dist/store.cjs +117 -1291
  293. package/dist/store.cjs.map +1 -1
  294. package/dist/store.d.cts +3 -206
  295. package/dist/store.d.ts +3 -206
  296. package/dist/store.js +110 -32
  297. package/dist/store.js.map +1 -1
  298. package/dist/storehooks.cjs +240 -5790
  299. package/dist/storehooks.cjs.map +1 -1
  300. package/dist/storehooks.d.cts +76 -4
  301. package/dist/storehooks.d.ts +76 -4
  302. package/dist/storehooks.js +229 -266
  303. package/dist/storehooks.js.map +1 -1
  304. package/dist/thunks.cjs +2614 -5924
  305. package/dist/thunks.cjs.map +1 -1
  306. package/dist/thunks.d.cts +9 -36
  307. package/dist/thunks.d.ts +9 -36
  308. package/dist/thunks.js +2439 -385
  309. package/dist/thunks.js.map +1 -1
  310. package/dist/types-B2NRQLFw.d.ts +88 -0
  311. package/dist/types-ClEfo0dK.d.cts +88 -0
  312. package/dist/useDeploymentDevice.cjs +26 -4656
  313. package/dist/useDeploymentDevice.cjs.map +1 -1
  314. package/dist/useDeploymentDevice.d.cts +4 -2
  315. package/dist/useDeploymentDevice.d.ts +4 -2
  316. package/dist/useDeploymentDevice.js +21 -60
  317. package/dist/useDeploymentDevice.js.map +1 -1
  318. package/dist/usersSlice/constants.cjs +8 -55
  319. package/dist/usersSlice/constants.d.cts +2 -52
  320. package/dist/usersSlice/constants.d.ts +2 -52
  321. package/dist/usersSlice/constants.js +2 -21
  322. package/dist/usersSlice/index.cjs +132 -172
  323. package/dist/usersSlice/index.cjs.map +1 -1
  324. package/dist/usersSlice/index.d.cts +2 -152
  325. package/dist/usersSlice/index.d.ts +2 -152
  326. package/dist/usersSlice/index.js +125 -18
  327. package/dist/usersSlice/index.js.map +1 -1
  328. package/dist/usersSlice/mocks.cjs +55 -196
  329. package/dist/usersSlice/mocks.cjs.map +1 -1
  330. package/dist/usersSlice/mocks.d.cts +68 -72
  331. package/dist/usersSlice/mocks.d.ts +68 -72
  332. package/dist/usersSlice/mocks.js +54 -46
  333. package/dist/usersSlice/mocks.js.map +1 -1
  334. package/dist/usersSlice/selectors.cjs +65 -567
  335. package/dist/usersSlice/selectors.cjs.map +1 -1
  336. package/dist/usersSlice/selectors.d.cts +364 -376
  337. package/dist/usersSlice/selectors.d.ts +364 -376
  338. package/dist/usersSlice/selectors.js +44 -50
  339. package/dist/usersSlice/selectors.js.map +1 -1
  340. package/dist/usersSlice/thunks.cjs +39 -4704
  341. package/dist/usersSlice/thunks.d.cts +807 -843
  342. package/dist/usersSlice/thunks.d.ts +807 -843
  343. package/dist/usersSlice/thunks.js +2 -111
  344. package/dist/utils-B4I595rf.d.cts +104 -0
  345. package/dist/utils-DNnSR4S_.d.ts +104 -0
  346. package/dist/utils.cjs +229 -850
  347. package/dist/utils.cjs.map +1 -1
  348. package/dist/utils.d.cts +2 -80
  349. package/dist/utils.d.ts +2 -80
  350. package/dist/utils.js +210 -50
  351. package/dist/utils.js.map +1 -1
  352. package/package.json +11 -13
  353. package/dist/appSlice/thunks.cjs.map +0 -1
  354. package/dist/appSlice/thunks.js.map +0 -1
  355. package/dist/chunk-2DYA3X77.js +0 -15
  356. package/dist/chunk-2DYA3X77.js.map +0 -1
  357. package/dist/chunk-2QIGK5IU.js +0 -143
  358. package/dist/chunk-2QIGK5IU.js.map +0 -1
  359. package/dist/chunk-4573DUCR.js +0 -396
  360. package/dist/chunk-4573DUCR.js.map +0 -1
  361. package/dist/chunk-4BHM6WVX.js +0 -50
  362. package/dist/chunk-4BHM6WVX.js.map +0 -1
  363. package/dist/chunk-4BUO44SS.js +0 -316
  364. package/dist/chunk-4BUO44SS.js.map +0 -1
  365. package/dist/chunk-4YLOOOZH.js +0 -144
  366. package/dist/chunk-4YLOOOZH.js.map +0 -1
  367. package/dist/chunk-525LX7VL.js +0 -157
  368. package/dist/chunk-525LX7VL.js.map +0 -1
  369. package/dist/chunk-5OLM3HEG.js +0 -41
  370. package/dist/chunk-5OLM3HEG.js.map +0 -1
  371. package/dist/chunk-66LI4BJO.js +0 -162
  372. package/dist/chunk-66LI4BJO.js.map +0 -1
  373. package/dist/chunk-CMXRPUOF.js +0 -723
  374. package/dist/chunk-CMXRPUOF.js.map +0 -1
  375. package/dist/chunk-CQXDAXQF.js +0 -51
  376. package/dist/chunk-CQXDAXQF.js.map +0 -1
  377. package/dist/chunk-DBBE6D36.js +0 -115
  378. package/dist/chunk-DBBE6D36.js.map +0 -1
  379. package/dist/chunk-FAJ3I2UQ.js +0 -47
  380. package/dist/chunk-FAJ3I2UQ.js.map +0 -1
  381. package/dist/chunk-FAKWYYOB.js +0 -59
  382. package/dist/chunk-FAKWYYOB.js.map +0 -1
  383. package/dist/chunk-FXPRG4WH.js +0 -2875
  384. package/dist/chunk-FXPRG4WH.js.map +0 -1
  385. package/dist/chunk-GX3X2E57.js +0 -157
  386. package/dist/chunk-GX3X2E57.js.map +0 -1
  387. package/dist/chunk-HVZ5BOM6.js +0 -61
  388. package/dist/chunk-HVZ5BOM6.js.map +0 -1
  389. package/dist/chunk-JIS4PA3R.js +0 -7
  390. package/dist/chunk-JIS4PA3R.js.map +0 -1
  391. package/dist/chunk-KEQAPMP6.js +0 -110
  392. package/dist/chunk-KEQAPMP6.js.map +0 -1
  393. package/dist/chunk-LSAJE3IU.js +0 -115
  394. package/dist/chunk-LSAJE3IU.js.map +0 -1
  395. package/dist/chunk-NMAXZ3ZY.js +0 -1
  396. package/dist/chunk-NMAXZ3ZY.js.map +0 -1
  397. package/dist/chunk-QX67O5A2.js +0 -82
  398. package/dist/chunk-QX67O5A2.js.map +0 -1
  399. package/dist/chunk-SDHCQ62K.js +0 -246
  400. package/dist/chunk-SDHCQ62K.js.map +0 -1
  401. package/dist/chunk-SDWPOLHM.js +0 -25
  402. package/dist/chunk-SDWPOLHM.js.map +0 -1
  403. package/dist/chunk-UBFFGYQ4.js +0 -204
  404. package/dist/chunk-UBFFGYQ4.js.map +0 -1
  405. package/dist/chunk-UE2EPKRU.js +0 -142
  406. package/dist/chunk-UE2EPKRU.js.map +0 -1
  407. package/dist/chunk-VK6FVQ5K.js +0 -58
  408. package/dist/chunk-VK6FVQ5K.js.map +0 -1
  409. package/dist/chunk-VLII64V6.js +0 -44
  410. package/dist/chunk-VLII64V6.js.map +0 -1
  411. package/dist/chunk-WXRYJOL3.js +0 -68
  412. package/dist/chunk-WXRYJOL3.js.map +0 -1
  413. package/dist/chunk-XHLNGIAP.js +0 -100
  414. package/dist/chunk-XHLNGIAP.js.map +0 -1
  415. package/dist/chunk-YO22XLHI.js +0 -7
  416. package/dist/chunk-YO22XLHI.js.map +0 -1
  417. package/dist/chunk-Z4QLZNAN.js +0 -448
  418. package/dist/chunk-Z4QLZNAN.js.map +0 -1
  419. package/dist/chunk-ZKAH3APE.js +0 -1
  420. package/dist/chunk-ZKAH3APE.js.map +0 -1
  421. package/dist/commonConstants.cjs.map +0 -1
  422. package/dist/commonConstants.js.map +0 -1
  423. package/dist/deploymentsSlice/constants.cjs.map +0 -1
  424. package/dist/deploymentsSlice/constants.js.map +0 -1
  425. package/dist/deploymentsSlice/thunks.cjs.map +0 -1
  426. package/dist/deploymentsSlice/thunks.js.map +0 -1
  427. package/dist/devicesSlice/constants.cjs.map +0 -1
  428. package/dist/devicesSlice/constants.js.map +0 -1
  429. package/dist/devicesSlice/thunks.cjs.map +0 -1
  430. package/dist/devicesSlice/thunks.js.map +0 -1
  431. package/dist/monitorSlice/constants.cjs.map +0 -1
  432. package/dist/monitorSlice/constants.js.map +0 -1
  433. package/dist/onboardingSlice/thunks.cjs.map +0 -1
  434. package/dist/onboardingSlice/thunks.js.map +0 -1
  435. package/dist/organizationSlice/constants.cjs.map +0 -1
  436. package/dist/organizationSlice/constants.js.map +0 -1
  437. package/dist/organizationSlice/thunks.cjs.map +0 -1
  438. package/dist/organizationSlice/thunks.js.map +0 -1
  439. package/dist/organizationSlice/types.cjs.map +0 -1
  440. package/dist/organizationSlice/types.js.map +0 -1
  441. package/dist/selectors.cjs.map +0 -1
  442. package/dist/selectors.js.map +0 -1
  443. package/dist/usersSlice/constants.cjs.map +0 -1
  444. package/dist/usersSlice/constants.js.map +0 -1
  445. package/dist/usersSlice/thunks.cjs.map +0 -1
  446. package/dist/usersSlice/thunks.js.map +0 -1
@@ -1,2516 +1,86 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/monitorSlice/thunks.ts
31
- var thunks_exports = {};
32
- __export(thunks_exports, {
33
- changeNotificationSetting: () => changeNotificationSetting,
34
- getDeviceAlerts: () => getDeviceAlerts,
35
- getDeviceMonitorConfig: () => getDeviceMonitorConfig,
36
- getIssueCountsByType: () => getIssueCountsByType2,
37
- getLatestDeviceAlerts: () => getLatestDeviceAlerts
38
- });
39
- module.exports = __toCommonJS(thunks_exports);
40
-
41
- // src/monitorSlice/index.ts
42
- var import_toolkit = require("@reduxjs/toolkit");
43
-
44
- // src/constants.ts
45
- var import_constants3 = require("@northern.tech/utils/constants");
46
-
47
- // src/appSlice/constants.ts
48
- var import_icons_material = require("@mui/icons-material");
49
- var import_utils = require("@northern.tech/utils");
50
- var chartTypes = {
51
- bar: { key: "bar", Icon: import_icons_material.BarChart },
52
- pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
53
- };
54
- var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
55
- var defaultReportType = "distribution";
56
- var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
57
- var PLANS = {
58
- os: {
59
- id: "os",
60
- name: "Basic",
61
- description: "The core features of Mender. To continue using Enterprise Trial features\u2014like Delta updates, scheduled deployments, phased rollouts, device filtering, dynamic groups, RBAC, audit logs, and more\u2014please upgrade to a higher plan."
62
- },
63
- professional: {
64
- id: "professional",
65
- name: "Professional",
66
- description: "Everything in Basic, plus enhanced update management and automation features."
67
- },
68
- enterprise: {
69
- id: "enterprise",
70
- name: "Enterprise",
71
- description: "Every advanced feature of Mender, tailored for complex and large-scale deployments. Not available as a monthly subscription \u2014 ask us for a quote."
72
- }
73
- };
74
- var ADDONS = {
75
- configure: {
76
- id: "configure",
77
- title: "Configure",
78
- description: "Seamlessly configure applications and devices remotely \u2013 configure each device to its environment.",
79
- needs: ["hasDeviceConfig"],
80
- eligible: ["os", "professional", "enterprise"]
81
- },
82
- monitor: {
83
- id: "monitor",
84
- title: "Monitor",
85
- description: "Detect and analyze health issues of devices, services and applications. Set up alerts so you can act quickly.",
86
- needs: ["hasMonitor"],
87
- eligible: ["professional", "enterprise"]
88
- },
89
- troubleshoot: {
90
- id: "troubleshoot",
91
- title: "Troubleshoot",
92
- description: "Secure, remote access to your devices \u2013 quickly diagnose and fix issues in real time.",
93
- needs: ["hasDeviceConnect"],
94
- eligible: ["os", "professional", "enterprise"]
95
- }
96
- };
97
- var BENEFITS = {
98
- auditlog: {
99
- id: "auditlog",
100
- benefit: "gain access to logs for important events such as changes to devices, deployments and user management, as well as remote terminal session replays",
101
- requiredPlan: PLANS.enterprise.id
102
- },
103
- dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
104
- deltaGeneration: {
105
- id: "deltaGeneration",
106
- benefit: "automatic delta artifacts generation to minimize data transfer and improve the update delivery",
107
- requiredPlan: PLANS.enterprise.id
108
- },
109
- deviceConfiguration: { id: "deviceConfiguration", benefit: "device configuration features", requiredAddon: ADDONS.configure.id },
110
- deviceMonitor: { id: "deviceMonitor", benefit: "device monitoring features", requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },
111
- deviceTroubleshoot: { id: "deviceTroubleshoot", benefit: "device troubleshooting features", requiredAddon: ADDONS.troubleshoot.id },
112
- dynamicGroups: { id: "dynamicGroups", benefit: "create dynamic groups to ease device management", requiredPlan: PLANS.enterprise.id },
113
- fullFiltering: { id: "fullFiltering", benefit: "filtering by multiple attributes to improve the device overview", requiredPlan: PLANS.professional.id },
114
- gateway: { id: "gateway", benefit: "see devices connected to your gateway device for easy access", requiredPlans: PLANS.professional.id },
115
- pausedDeployments: {
116
- id: "pausedDeployments",
117
- benefit: "granular control about update rollout to allow synchronization across your fleet",
118
- requiredPlan: PLANS.enterprise.id
119
- },
120
- phasedDeployments: { id: "phasedDeployments", benefit: "choose to roll out deployments in multiple phases", requiredPlan: PLANS.enterprise.id },
121
- rbac: { id: "rbac", benefit: "granular role based access control", requiredPlan: PLANS.enterprise.id },
122
- retryDeployments: { id: "retryDeployments", benefit: "optional retries for failed rollout attempts", requiredPlan: PLANS.professional.id },
123
- scheduledDeployments: {
124
- id: "scheduledDeployments",
125
- benefit: "scheduled deployments to steer the distribution of your updates.",
126
- requiredPlan: PLANS.professional.id
127
- },
128
- webhookEvents: {
129
- id: "webhookEvents",
130
- benefit: "receive inventory events and select which type(s) of events the webhook will receive",
131
- requiredPlan: PLANS.professional.id
132
- },
133
- default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
134
- };
135
- var DARK_MODE = "dark";
136
-
137
- // src/commonConstants.tsx
138
- var import_js = require("@mdi/js");
139
- var import_jsx_runtime = require("react/jsx-runtime");
140
- var timeUnits = {
141
- days: "days",
142
- minutes: "minutes",
143
- hours: "hours"
144
- };
145
- var UNGROUPED_GROUP = { id: "*|=ungrouped=|*", name: "Unassigned" };
146
- var DEVICE_LIST_MAXIMUM_LENGTH = 50;
147
- var oneSecond = 1e3;
148
- var TIMEOUTS = {
149
- debounceDefault: 700,
150
- debounceShort: 300,
151
- halfASecond: 0.5 * oneSecond,
152
- oneSecond,
153
- twoSeconds: 2 * oneSecond,
154
- threeSeconds: 3 * oneSecond,
155
- fiveSeconds: 5 * oneSecond,
156
- refreshDefault: 10 * oneSecond,
157
- refreshLong: 60 * oneSecond
158
- };
159
- var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
160
- var defaultIdAttribute = Object.freeze({ attribute: "id", scope: import_constants3.ATTRIBUTE_SCOPES.identity });
161
- var productOrder = ["micro", "standard", "system"];
162
- var credentialTypes = {
163
- aws: "aws",
164
- http: "http",
165
- sas: "sas",
166
- x509: "x509"
167
- };
168
- var EXTERNAL_PROVIDER = {
169
- "iot-core": {
170
- credentialsType: credentialTypes.aws,
171
- icon: import_js.mdiAws,
172
- title: "AWS IoT Core",
173
- twinTitle: "Device Shadow",
174
- provider: "iot-core",
175
- enabled: true,
176
- deviceTwin: true,
177
- configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "For help finding your AWS IoT Core connection string, check the AWS IoT documentation." })
178
- },
179
- "iot-hub": {
180
- credentialsType: credentialTypes.sas,
181
- icon: import_js.mdiMicrosoftAzure,
182
- title: "Azure IoT Hub",
183
- twinTitle: "Device Twin",
184
- provider: "iot-hub",
185
- enabled: true,
186
- deviceTwin: true,
187
- configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
188
- "For help finding your Azure IoT Hub connection string, look under 'Shared access policies' in the Microsoft Azure UI as described",
189
- " ",
190
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
191
- "a",
192
- {
193
- href: "https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn",
194
- target: "_blank",
195
- rel: "noopener noreferrer",
196
- children: "here"
197
- }
198
- ),
199
- "."
200
- ] })
201
- },
202
- webhook: {
203
- credentialsType: credentialTypes.http,
204
- deviceTwin: false,
205
- twinTitle: "",
206
- // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
207
- enabled: false,
208
- provider: "webhook"
209
- }
210
- };
211
- var emptyWebhook = {
212
- description: "",
213
- provider: "webhook",
214
- credentials: {
215
- type: EXTERNAL_PROVIDER.webhook.credentialsType,
216
- [EXTERNAL_PROVIDER.webhook.credentialsType]: {
217
- secret: "",
218
- url: ""
219
- }
220
- }
221
- };
222
- var regionNames = new Intl.DisplayNames(["en"], { type: "region" });
223
- var countries = [
224
- "AD",
225
- "AE",
226
- "AF",
227
- "AG",
228
- "AI",
229
- "AL",
230
- "AM",
231
- "AO",
232
- "AQ",
233
- "AR",
234
- "AS",
235
- "AT",
236
- "AU",
237
- "AW",
238
- "AX",
239
- "AZ",
240
- "BA",
241
- "BB",
242
- "BD",
243
- "BE",
244
- "BF",
245
- "BG",
246
- "BH",
247
- "BI",
248
- "BJ",
249
- "BL",
250
- "BM",
251
- "BN",
252
- "BO",
253
- "BR",
254
- "BS",
255
- "BT",
256
- "BV",
257
- "BW",
258
- "BY",
259
- "BZ",
260
- "CA",
261
- "CC",
262
- "CD",
263
- "CF",
264
- "CG",
265
- "CH",
266
- "CI",
267
- "CK",
268
- "CL",
269
- "CM",
270
- "CN",
271
- "CO",
272
- "CR",
273
- "CU",
274
- "CV",
275
- "CW",
276
- "CX",
277
- "CY",
278
- "CZ",
279
- "DE",
280
- "DJ",
281
- "DK",
282
- "DM",
283
- "DO",
284
- "DZ",
285
- "EC",
286
- "EE",
287
- "EG",
288
- "EH",
289
- "ER",
290
- "ES",
291
- "ET",
292
- "FI",
293
- "FJ",
294
- "FK",
295
- "FM",
296
- "FO",
297
- "FR",
298
- "GA",
299
- "GB",
300
- "GD",
301
- "GE",
302
- "GF",
303
- "GG",
304
- "GH",
305
- "GI",
306
- "GL",
307
- "GM",
308
- "GN",
309
- "GP",
310
- "GQ",
311
- "GR",
312
- "GS",
313
- "GT",
314
- "GU",
315
- "GW",
316
- "GY",
317
- "HK",
318
- "HM",
319
- "HN",
320
- "HR",
321
- "HT",
322
- "HU",
323
- "ID",
324
- "IE",
325
- "IL",
326
- "IM",
327
- "IN",
328
- "IO",
329
- "IQ",
330
- "IR",
331
- "IS",
332
- "IT",
333
- "JE",
334
- "JM",
335
- "JO",
336
- "JP",
337
- "KE",
338
- "KG",
339
- "KH",
340
- "KI",
341
- "KM",
342
- "KN",
343
- "KP",
344
- "KR",
345
- "KW",
346
- "KY",
347
- "KZ",
348
- "LA",
349
- "LB",
350
- "LC",
351
- "LI",
352
- "LK",
353
- "LR",
354
- "LS",
355
- "LT",
356
- "LU",
357
- "LV",
358
- "LY",
359
- "MA",
360
- "MC",
361
- "MD",
362
- "ME",
363
- "MF",
364
- "MG",
365
- "MH",
366
- "MK",
367
- "ML",
368
- "MM",
369
- "MN",
370
- "MO",
371
- "MP",
372
- "MQ",
373
- "MR",
374
- "MS",
375
- "MT",
376
- "MU",
377
- "MV",
378
- "MW",
379
- "MX",
380
- "MY",
381
- "MZ",
382
- "NA",
383
- "NC",
384
- "NE",
385
- "NF",
386
- "NG",
387
- "NI",
388
- "NL",
389
- "NO",
390
- "NP",
391
- "NR",
392
- "NU",
393
- "NZ",
394
- "OM",
395
- "PA",
396
- "PE",
397
- "PF",
398
- "PG",
399
- "PH",
400
- "PK",
401
- "PL",
402
- "PM",
403
- "PN",
404
- "PR",
405
- "PS",
406
- "PT",
407
- "PW",
408
- "PY",
409
- "QA",
410
- "RE",
411
- "RO",
412
- "RS",
413
- "RU",
414
- "RW",
415
- "SA",
416
- "SB",
417
- "SC",
418
- "SD",
419
- "SE",
420
- "SG",
421
- "SH",
422
- "SI",
423
- "SJ",
424
- "SK",
425
- "SL",
426
- "SM",
427
- "SN",
428
- "SO",
429
- "SR",
430
- "SS",
431
- "ST",
432
- "SV",
433
- "SX",
434
- "SY",
435
- "SZ",
436
- "TC",
437
- "TD",
438
- "TF",
439
- "TG",
440
- "TH",
441
- "TJ",
442
- "TK",
443
- "TL",
444
- "TM",
445
- "TN",
446
- "TO",
447
- "TR",
448
- "TT",
449
- "TV",
450
- "TW",
451
- "TZ",
452
- "UA",
453
- "UG",
454
- "US",
455
- "UY",
456
- "UZ",
457
- "VA",
458
- "VC",
459
- "VE",
460
- "VG",
461
- "VI",
462
- "VN",
463
- "VU",
464
- "WF",
465
- "WS",
466
- "XK",
467
- "YE",
468
- "YT",
469
- "ZA",
470
- "ZM",
471
- "ZW"
472
- ].map((code) => ({ code, label: regionNames.of(code) })).sort((a, b) => a.label.localeCompare(b.label));
473
-
474
- // src/deploymentsSlice/constants.ts
475
- var alreadyInstalled = "already-installed";
476
- var deploymentSubstates = {
477
- aborted: "aborted",
478
- alreadyInstalled,
479
- decommissioned: "decommissioned",
480
- downloading: "downloading",
481
- failure: "failure",
482
- installing: "installing",
483
- noartifact: "noartifact",
484
- artifact_too_big: "artifact_too_big",
485
- pause_before_committing: "pause_before_committing",
486
- pause_before_installing: "pause_before_installing",
487
- pause_before_rebooting: "pause_before_rebooting",
488
- pending: "pending",
489
- rebooting: "rebooting",
490
- success: "success"
491
- };
492
- var deploymentStatesToSubstates = {
493
- failures: [deploymentSubstates.failure, deploymentSubstates.aborted, deploymentSubstates.decommissioned],
494
- inprogress: [deploymentSubstates.downloading, deploymentSubstates.installing, deploymentSubstates.rebooting],
495
- paused: [deploymentSubstates.pause_before_installing, deploymentSubstates.pause_before_rebooting, deploymentSubstates.pause_before_committing],
496
- pending: [deploymentSubstates.pending],
497
- successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact, deploymentSubstates.artifact_too_big]
498
- };
499
- var deploymentStatesToSubstatesWithSkipped = {
500
- ...deploymentStatesToSubstates,
501
- failures: [deploymentSubstates.failure],
502
- skipped: [
503
- deploymentSubstates.aborted,
504
- deploymentSubstates.noartifact,
505
- deploymentSubstates.artifact_too_big,
506
- deploymentSubstates.alreadyInstalled,
507
- deploymentSubstates.decommissioned
508
- ],
509
- successes: [deploymentSubstates.success]
510
- };
511
- var installationSubstatesMap = {
512
- download: {
513
- title: "download",
514
- done: "downloaded",
515
- successIndicators: [deploymentSubstates.installing, deploymentSubstates.rebooting, ...deploymentStatesToSubstates.paused, deploymentSubstates.success],
516
- failureIndicators: deploymentStatesToSubstates.failures,
517
- pauseConfigurationIndicator: "ArtifactInstall_Enter"
518
- },
519
- install: {
520
- title: "install",
521
- done: "installed",
522
- successIndicators: [
523
- deploymentSubstates.rebooting,
524
- deploymentSubstates.pause_before_rebooting,
525
- deploymentSubstates.pause_before_committing,
526
- deploymentSubstates.success
527
- ],
528
- failureIndicators: deploymentStatesToSubstates.failures,
529
- pauseConfigurationIndicator: "ArtifactReboot_Enter"
530
- },
531
- reboot: {
532
- title: "reboot",
533
- done: "rebooted",
534
- successIndicators: [deploymentSubstates.pause_before_committing, deploymentSubstates.success],
535
- failureIndicators: deploymentStatesToSubstates.failures,
536
- pauseConfigurationIndicator: "ArtifactCommit_Enter"
537
- },
538
- commit: {
539
- title: "commit",
540
- done: "committed",
541
- successIndicators: deploymentStatesToSubstates.successes,
542
- failureIndicators: deploymentStatesToSubstates.failures,
543
- pauseConfigurationIndicator: void 0
544
- }
545
- };
546
- var DEPLOYMENT_STATES = {
547
- finished: "finished",
548
- inprogress: "inprogress",
549
- pending: "pending",
550
- scheduled: "scheduled"
551
- };
552
- var listDefaultsByState = {
553
- [DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
554
- [DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
555
- [DEPLOYMENT_STATES.scheduled]: { ...import_constants3.DEVICE_LIST_DEFAULTS },
556
- [DEPLOYMENT_STATES.finished]: { ...import_constants3.DEVICE_LIST_DEFAULTS },
557
- sort: { direction: import_constants3.SORTING_OPTIONS.desc }
558
- };
559
- var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
560
- var DEPLOYMENT_ROUTES = {
561
- active: {
562
- key: "active",
563
- route: "/deployments/active",
564
- states: [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress],
565
- title: "Active"
566
- },
567
- finished: {
568
- key: "finished",
569
- route: "/deployments/finished",
570
- states: [DEPLOYMENT_STATES.finished],
571
- title: "Finished"
572
- },
573
- scheduled: {
574
- key: "scheduled",
575
- route: "/deployments/scheduled",
576
- states: [DEPLOYMENT_STATES.scheduled],
577
- title: "Scheduled"
578
- }
579
- };
580
- var defaultStats = {
581
- [deploymentSubstates.aborted]: 0,
582
- [deploymentSubstates.alreadyInstalled]: 0,
583
- [deploymentSubstates.decommissioned]: 0,
584
- [deploymentSubstates.downloading]: 0,
585
- [deploymentSubstates.failure]: 0,
586
- [deploymentSubstates.installing]: 0,
587
- [deploymentSubstates.noartifact]: 0,
588
- [deploymentSubstates.pause_before_committing]: 0,
589
- [deploymentSubstates.pause_before_installing]: 0,
590
- [deploymentSubstates.pause_before_rebooting]: 0,
591
- [deploymentSubstates.pending]: 0,
592
- [deploymentSubstates.rebooting]: 0,
593
- [deploymentSubstates.success]: 0
594
- };
595
- var deploymentPrototype = {
596
- devices: {},
597
- name: void 0,
598
- statistics: { status: {} }
599
- };
600
- var pauseMap = {
601
- [deploymentSubstates.pause_before_installing]: {
602
- title: installationSubstatesMap.download.done,
603
- followUp: installationSubstatesMap.download.pauseConfigurationIndicator
604
- },
605
- [deploymentSubstates.pause_before_rebooting]: {
606
- title: installationSubstatesMap.install.done,
607
- followUp: installationSubstatesMap.install.pauseConfigurationIndicator
608
- },
609
- [deploymentSubstates.pause_before_committing]: {
610
- title: installationSubstatesMap.reboot.done,
611
- followUp: installationSubstatesMap.reboot.pauseConfigurationIndicator
612
- }
613
- };
614
-
615
- // src/onboardingSlice/constants.ts
616
- var onboardingSteps = {
617
- ONBOARDING_START: "onboarding-start",
618
- DEVICES_PENDING_ONBOARDING_START: "devices-pending-onboarding-start",
619
- DASHBOARD_ONBOARDING_START: "dashboard-onboarding-start",
620
- DASHBOARD_ONBOARDING_PENDINGS: "dashboard-onboarding-pendings",
621
- DEVICES_DELAYED_ONBOARDING: "devices-delayed-onboarding",
622
- DEVICES_PENDING_ONBOARDING: "devices-pending-onboarding",
623
- DEVICES_ACCEPTED_ONBOARDING: "devices-accepted-onboarding",
624
- DEVICES_PENDING_ACCEPTING_ONBOARDING: "devices-pending-accepting-onboarding",
625
- DEVICES_DEPLOY_RELEASE_ONBOARDING: "devices-deploy-release-onboarding",
626
- SCHEDULING_ARTIFACT_SELECTION: "scheduling-artifact-selection",
627
- SCHEDULING_ALL_DEVICES_SELECTION: "scheduling-all-devices-selection",
628
- SCHEDULING_GROUP_SELECTION: "scheduling-group-selection",
629
- SCHEDULING_RELEASE_TO_DEVICES: "scheduling-release-to-devices",
630
- DEPLOYMENTS_INPROGRESS: "deployments-inprogress",
631
- DEPLOYMENTS_COMPLETED: "deployments-completed",
632
- DEPLOYMENTS_PAST: "deployments-past",
633
- DEPLOYMENTS_PAST_COMPLETED: "deployments-past-completed",
634
- DEPLOYMENTS_PAST_COMPLETED_FAILURE: "deployments-past-completed-failure",
635
- ONBOARDING_CANCELED: "onboarding-canceled"
636
- };
637
- var orderedOnboardingSteps = [
638
- onboardingSteps.DASHBOARD_ONBOARDING_START,
639
- onboardingSteps.DEVICES_PENDING_ONBOARDING_START,
640
- onboardingSteps.DEVICES_DELAYED_ONBOARDING,
641
- onboardingSteps.DEVICES_PENDING_ONBOARDING,
642
- onboardingSteps.DEVICES_PENDING_ACCEPTING_ONBOARDING,
643
- onboardingSteps.DASHBOARD_ONBOARDING_PENDINGS,
644
- onboardingSteps.DEVICES_ACCEPTED_ONBOARDING,
645
- onboardingSteps.DEVICES_DEPLOY_RELEASE_ONBOARDING,
646
- onboardingSteps.SCHEDULING_ALL_DEVICES_SELECTION,
647
- onboardingSteps.SCHEDULING_GROUP_SELECTION,
648
- onboardingSteps.SCHEDULING_ARTIFACT_SELECTION,
649
- onboardingSteps.SCHEDULING_RELEASE_TO_DEVICES,
650
- onboardingSteps.DEPLOYMENTS_INPROGRESS,
651
- onboardingSteps.DEPLOYMENTS_PAST,
652
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED,
653
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE,
654
- onboardingSteps.ONBOARDING_CANCELED
655
- ];
656
-
657
- // src/organizationSlice/constants.ts
658
- var auditlogTypes = {
659
- artifact: { title: "Artifact", queryParameter: "object_type", value: "artifact" },
660
- deployment: { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
661
- device: { title: "Device", queryParameter: "object_id", value: "device" },
662
- user_access_token: { title: "Personal Access Token", queryParameter: "user_access_token", value: "user_access_token" },
663
- user: { title: "User", queryParameter: "object_id", value: "user" },
664
- tenant: { title: "Tenant", queryParameter: "object_id", value: "tenant" }
665
- };
666
- var AUDIT_LOGS_TYPES = [auditlogTypes.artifact, auditlogTypes.deployment, auditlogTypes.device, auditlogTypes.user_access_token, auditlogTypes.user];
667
- var SP_AUDIT_LOGS_TYPES = [auditlogTypes.user, auditlogTypes.tenant];
668
- var TENANT_LIST_DEFAULT = {
669
- page: 1,
670
- perPage: 20
671
- };
672
-
673
- // src/usersSlice/constants.ts
674
- var USER_LOGOUT = "USER_LOGOUT";
675
- var settingsKeys = { initialized: "settings-initialized" };
676
- var READ_STATES = {
677
- read: "read",
678
- seen: "seen",
679
- unread: "unread"
680
- };
681
-
682
- // src/monitorSlice/index.ts
683
- var sliceName = "monitor";
684
- var initialState = {
685
- alerts: {
686
- alertList: { ...import_constants3.DEVICE_LIST_DEFAULTS, total: 0 },
687
- byDeviceId: {}
688
- },
689
- issueCounts: {
690
- byType: Object.keys(import_constants3.DEVICE_ISSUE_OPTIONS).reduce((accu, key) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
691
- },
692
- settings: {
693
- global: {
694
- channels: {
695
- ...Object.keys(import_constants3.alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
696
- }
697
- }
698
- }
699
- };
700
- var monitorSlice = (0, import_toolkit.createSlice)({
701
- name: sliceName,
702
- initialState,
703
- reducers: {
704
- changeAlertChannel: (state, action) => {
705
- const { channel, enabled } = action.payload;
706
- state.settings.global.channels[channel] = { enabled };
707
- },
708
- receiveDeviceAlerts: (state, action) => {
709
- const { deviceId, alerts } = action.payload;
710
- state.alerts.byDeviceId[deviceId] = { alerts };
711
- },
712
- receiveLatestDeviceAlerts: (state, action) => {
713
- const { deviceId, alerts } = action.payload;
714
- state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
715
- },
716
- receiveDeviceIssueCounts: (state, action) => {
717
- const { issueType, counts } = action.payload;
718
- state.issueCounts.byType[issueType] = counts;
719
- },
720
- setAlertListState: (state, action) => {
721
- state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
722
- }
723
- }
724
- });
725
- var actions = monitorSlice.actions;
726
- var monitorSlice_default = monitorSlice.reducer;
727
-
728
- // src/appSlice/index.ts
729
- var import_toolkit2 = require("@reduxjs/toolkit");
730
- var sliceName2 = "app";
731
- var getYesterday = () => {
732
- const today = /* @__PURE__ */ new Date();
733
- today.setDate(today.getDate() - 1);
734
- return today.toISOString();
735
- };
736
- var initialState2 = {
737
- appInitDone: false,
738
- cancelSource: void 0,
739
- commit: "",
740
- demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
741
- hostAddress: null,
742
- snackbar: {
743
- action: void 0,
744
- autoHideDuration: void 0,
745
- message: "",
746
- open: false,
747
- preventClickToCopy: false
748
- },
749
- // return boolean rather than organization details
750
- features: {
751
- hasAiEnabled: false,
752
- hasAuditlogs: false,
753
- hasDeltaProgress: false,
754
- hasMultitenancy: false,
755
- hasDeviceConfig: false,
756
- hasDeviceConnect: false,
757
- hasFeedbackEnabled: false,
758
- hasManifestsEnabled: false,
759
- hasMonitor: false,
760
- hasMCUEnabled: false,
761
- hasReporting: false,
762
- isHosted: true,
763
- isEnterprise: false
764
- },
765
- feedbackProbability: 0.3,
766
- firstLoginAfterSignup: false,
767
- hostedAnnouncement: "",
768
- docsVersion: "",
769
- recaptchaSiteKey: "",
770
- searchState: {
771
- deviceIds: [],
772
- searchTerm: "",
773
- searchTotal: 0,
774
- isSearching: false,
775
- sort: {
776
- direction: import_constants3.SORTING_OPTIONS.desc
777
- // key: null,
778
- // scope: null
779
- }
780
- },
781
- sentry: {
782
- location: "",
783
- replaysSessionSampleRate: 0.1,
784
- tracesSampleRate: 1
785
- },
786
- stripeAPIKey: "",
787
- trackerCode: "",
788
- uploadsById: {
789
- // id: { progress: 0, cancelSource: undefined }
790
- },
791
- newThreshold: getYesterday(),
792
- offlineThreshold: getYesterday(),
793
- versionInformation: {
794
- Integration: "",
795
- "Mender-Artifact": "",
796
- "Meta-Mender": ""
797
- },
798
- yesterday: void 0
799
- };
800
- var appSlice = (0, import_toolkit2.createSlice)({
801
- name: sliceName2,
802
- initialState: initialState2,
803
- reducers: {
804
- setFeatures: (state, action) => {
805
- state.features = {
806
- ...state.features,
807
- ...action.payload
808
- };
809
- },
810
- setSnackbar: (state, { payload }) => {
811
- if (typeof payload === "string" || payload instanceof String) {
812
- state.snackbar = {
813
- ...initialState2.snackbar,
814
- message: payload,
815
- open: !!payload
816
- };
817
- return;
818
- }
819
- const { message, autoHideDuration, action, preventClickToCopy = false } = payload;
820
- state.snackbar = {
821
- message,
822
- autoHideDuration,
823
- action,
824
- preventClickToCopy,
825
- open: !!message
826
- };
827
- },
828
- setFirstLoginAfterSignup: (state, action) => {
829
- state.firstLoginAfterSignup = action.payload;
830
- },
831
- setAnnouncement: (state, action) => {
832
- state.hostedAnnouncement = action.payload;
833
- },
834
- setSearchState: (state, action) => {
835
- state.searchState = {
836
- ...state.searchState,
837
- ...action.payload
838
- };
839
- },
840
- setOfflineThreshold: (state, action) => {
841
- state.offlineThreshold = action.payload;
842
- },
843
- initUpload: (state, action) => {
844
- const { id, upload } = action.payload;
845
- state.uploadsById[id] = upload;
846
- },
847
- uploadProgress: (state, action) => {
848
- const { id, progress } = action.payload;
849
- state.uploadsById[id] = {
850
- ...state.uploadsById[id],
851
- progress
852
- };
853
- },
854
- cleanUpUpload: (state, action) => {
855
- const { [action.payload]: current, ...remainder } = state.uploadsById;
856
- state.uploadsById = remainder;
857
- },
858
- setVersionInformation: (state, action) => {
859
- state.versionInformation = {
860
- ...state.versionInformation,
861
- ...action.payload
862
- };
863
- },
864
- setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),
865
- setAppInitDone: (state) => {
866
- state.appInitDone = true;
867
- }
868
- }
869
- });
870
- var actions2 = appSlice.actions;
871
- var appSlice_default = appSlice.reducer;
872
-
873
- // src/deploymentsSlice/index.ts
874
- var import_toolkit3 = require("@reduxjs/toolkit");
875
- var sliceName3 = "deployments";
876
- var initialState3 = {
877
- byId: {
878
- // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
879
- },
880
- byStatus: {
881
- finished: { deploymentIds: [], total: 0 },
882
- inprogress: { deploymentIds: [], total: 0 },
883
- pending: { deploymentIds: [], total: 0 },
884
- scheduled: { deploymentIds: [], total: 0 }
885
- },
886
- config: {
887
- binaryDelta: {
888
- timeout: -1,
889
- duplicatesWindow: -1,
890
- compressionLevel: -1,
891
- disableChecksum: false,
892
- disableDecompression: false,
893
- inputWindow: -1,
894
- instructionBuffer: -1,
895
- sourceWindow: -1
896
- },
897
- binaryDeltaLimits: {
898
- timeout: { ...import_constants3.limitDefault, default: 60, max: 3600, min: 60 },
899
- sourceWindow: import_constants3.limitDefault,
900
- inputWindow: import_constants3.limitDefault,
901
- duplicatesWindow: import_constants3.limitDefault,
902
- instructionBuffer: import_constants3.limitDefault
903
- }
904
- },
905
- deploymentDeviceLimit: 5e3,
906
- selectedDeviceIds: [],
907
- selectionState: {
908
- finished: { ...import_constants3.DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
909
- inprogress: { ...import_constants3.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
910
- pending: { ...import_constants3.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
911
- scheduled: { ...import_constants3.DEVICE_LIST_DEFAULTS, selection: [] },
912
- general: {
913
- state: DEPLOYMENT_ROUTES.active.key,
914
- showCreationDialog: false,
915
- showReportDialog: false,
916
- reportType: null
917
- // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
918
- },
919
- selectedId: void 0
920
- }
921
- };
922
- var deploymentsSlice = (0, import_toolkit3.createSlice)({
923
- name: sliceName3,
924
- initialState: initialState3,
925
- reducers: {
926
- createdDeployment: (state, action) => {
927
- state.byId[action.payload.id] = {
928
- ...deploymentPrototype,
929
- ...action.payload
930
- };
931
- state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
932
- state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
933
- state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection];
934
- state.selectionState[DEPLOYMENT_STATES.pending].total = (state.selectionState[DEPLOYMENT_STATES.pending].total || 0) + 1;
935
- },
936
- removedDeployment: (state, action) => {
937
- const { [action.payload]: removedDeployment, ...remainder } = state.byId;
938
- state.byId = remainder;
939
- },
940
- receivedDeployment: (state, action) => {
941
- state.byId[action.payload.id] = {
942
- ...state.byId[action.payload.id] || {},
943
- ...action.payload
944
- };
945
- },
946
- receivedDeploymentDeviceLog: (state, action) => {
947
- const { id, deviceId, log } = action.payload;
948
- const deployment = {
949
- ...deploymentPrototype,
950
- ...state.byId[id]
951
- };
952
- state.byId[id] = {
953
- ...deployment,
954
- devices: {
955
- ...deployment.devices,
956
- [deviceId]: {
957
- ...deployment.devices[deviceId],
958
- log
959
- }
960
- }
961
- };
962
- },
963
- receivedDeploymentDevices: (state, action) => {
964
- const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
965
- state.byId[id] = {
966
- ...state.byId[id],
967
- devices,
968
- totalDeviceCount
969
- };
970
- state.selectedDeviceIds = selectedDeviceIds;
971
- },
972
- receivedDeployments: (state, action) => {
973
- state.byId = {
974
- ...state.byId,
975
- ...action.payload
976
- };
977
- },
978
- receivedDeploymentsForStatus: (state, action) => {
979
- const { status, deploymentIds, total } = action.payload;
980
- state.byStatus[status].deploymentIds = deploymentIds;
981
- state.byStatus[status].total = total;
982
- },
983
- selectDeploymentsForStatus: (state, action) => {
984
- const { status, deploymentIds, total } = action.payload;
985
- state.selectionState[status].selection = deploymentIds;
986
- state.selectionState[status].total = total;
987
- },
988
- setDeploymentsState: (state, action) => {
989
- state.selectionState = action.payload;
990
- },
991
- setDeploymentsConfig: (state, action) => {
992
- state.config = action.payload;
993
- }
994
- }
995
- });
996
- var actions3 = deploymentsSlice.actions;
997
- var deploymentsSlice_default = deploymentsSlice.reducer;
998
-
999
- // src/devicesSlice/index.ts
1000
- var import_helpers = require("@northern.tech/utils/helpers");
1001
- var import_toolkit4 = require("@reduxjs/toolkit");
1002
- var sliceName4 = "devices";
1003
- var initialState4 = {
1004
- byId: {
1005
- // [deviceId]: {
1006
- // ...,
1007
- // twinsByIntegration: { [external.provider.id]: twinData }
1008
- // }
1009
- },
1010
- byStatus: {
1011
- [import_constants3.DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1012
- [import_constants3.DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1013
- [import_constants3.DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
1014
- [import_constants3.DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }
1015
- },
1016
- deviceList: {
1017
- deviceIds: [],
1018
- ...import_constants3.DEVICE_LIST_DEFAULTS,
1019
- selectedAttributes: [],
1020
- selectedIssues: [],
1021
- selection: [],
1022
- sort: {
1023
- direction: import_constants3.SORTING_OPTIONS.desc
1024
- // key: null,
1025
- // scope: null
1026
- },
1027
- state: import_constants3.DEVICE_STATES.accepted,
1028
- total: 0,
1029
- refreshTrigger: false,
1030
- isLoading: false,
1031
- detailsTab: "",
1032
- open: false
1033
- },
1034
- filters: [
1035
- // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
1036
- ],
1037
- filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },
1038
- filteringAttributesLimit: 10,
1039
- filteringAttributesConfig: {
1040
- attributes: {
1041
- // inventory: ['some_attribute']
1042
- },
1043
- count: 0,
1044
- limit: 100
1045
- },
1046
- reports: [
1047
- // { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
1048
- ],
1049
- total: 0,
1050
- limits: {
1051
- standard: 0,
1052
- micro: 0,
1053
- system: 0
1054
- },
1055
- groups: {
1056
- byId: {
1057
- // groupName: { deviceIds: [], total: 0, filters: [] },
1058
- // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }
1059
- },
1060
- selectedGroup: void 0
1061
- }
1062
- };
1063
- var devicesSlice = (0, import_toolkit4.createSlice)({
1064
- name: sliceName4,
1065
- initialState: initialState4,
1066
- reducers: {
1067
- receivedGroups: (state, action) => {
1068
- state.groups.byId = action.payload;
1069
- },
1070
- addToGroup: (state, action) => {
1071
- const { group, deviceIds } = action.payload;
1072
- const maybeExistingGroup = {
1073
- filters: [],
1074
- deviceIds: [],
1075
- ...state.groups.byId[group]
1076
- };
1077
- state.groups.byId[group] = {
1078
- ...maybeExistingGroup,
1079
- deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
1080
- total: (maybeExistingGroup.total || 0) + 1
1081
- };
1082
- },
1083
- removeFromGroup: (state, action) => {
1084
- const { group, deviceIds: removedIds } = action.payload;
1085
- const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
1086
- const changedGroup = {
1087
- ...maybeExistingGroup,
1088
- deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
1089
- total: Math.max(total - removedIds.length, 0)
1090
- };
1091
- if (changedGroup.total || changedGroup.deviceIds.length) {
1092
- state.groups.byId[group] = changedGroup;
1093
- return;
1094
- } else if (state.groups.selectedGroup === group) {
1095
- state.groups.selectedGroup = void 0;
1096
- }
1097
- const { [group]: removal, ...remainingById } = state.groups.byId;
1098
- state.groups.byId = remainingById;
1099
- },
1100
- addGroup: (state, action) => {
1101
- const { groupName, group } = action.payload;
1102
- state.groups.byId[groupName] = {
1103
- ...state.groups.byId[groupName],
1104
- ...group
1105
- };
1106
- },
1107
- selectGroup: (state, { payload: group }) => {
1108
- state.deviceList.deviceIds = group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1109
- state.groups.selectedGroup = group;
1110
- },
1111
- removeGroup: (state, action) => {
1112
- const { [action.payload]: removal, ...remainingById } = state.groups.byId;
1113
- state.groups.byId = remainingById;
1114
- state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
1115
- },
1116
- setDeviceListState: (state, action) => {
1117
- state.deviceList = {
1118
- ...state.deviceList,
1119
- ...action.payload,
1120
- sort: {
1121
- ...state.deviceList.sort,
1122
- ...action.payload.sort
1123
- }
1124
- };
1125
- },
1126
- setFilterAttributes: (state, action) => {
1127
- state.filteringAttributes = action.payload;
1128
- },
1129
- setFilterablesConfig: (state, action) => {
1130
- state.filteringAttributesConfig = action.payload;
1131
- },
1132
- receivedDevices: (state, action) => {
1133
- state.byId = {
1134
- ...state.byId,
1135
- ...action.payload
1136
- };
1137
- },
1138
- setDeviceFilters: (state, action) => {
1139
- if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
1140
- return;
1141
- }
1142
- state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
1143
- },
1144
- setDeviceReports: (state, action) => {
1145
- state.reports = action.payload;
1146
- },
1147
- setDevicesByStatus: (state, action) => {
1148
- const { status, total, deviceIds } = action.payload;
1149
- if (total) {
1150
- state.byStatus[status].deviceIds = deviceIds;
1151
- state.byStatus[status].counts.total = total;
1152
- }
1153
- },
1154
- setDevicesCountByStatus: (state, action) => {
1155
- const { countsPerTier, status } = action.payload;
1156
- state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu += tieredCount, 0) };
1157
- },
1158
- setDeviceLimits: (state, action) => {
1159
- state.limits = action.payload;
1160
- },
1161
- receivedDevice: (state, action) => {
1162
- state.byId[action.payload.id] = {
1163
- ...state.byId[action.payload.id],
1164
- ...action.payload
1165
- };
1166
- },
1167
- maybeUpdateDevicesByStatus: (state, action) => {
1168
- const { deviceId, authId } = action.payload;
1169
- const device = state.byId[deviceId];
1170
- const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1171
- if (!hasMultipleAuthSets && Object.values(import_constants3.DEVICE_STATES).includes(device.status)) {
1172
- const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1173
- const deviceTier = device.attributes.tier || "standard";
1174
- state.byStatus[device.status] = {
1175
- deviceIds,
1176
- counts: {
1177
- ...state.byStatus[device.status].counts,
1178
- [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),
1179
- total: Math.max(0, state.byStatus[device.status].counts.total - 1)
1180
- }
1181
- };
1182
- }
1183
- }
1184
- }
1185
- });
1186
- var actions4 = devicesSlice.actions;
1187
- var devicesSlice_default = devicesSlice.reducer;
1188
-
1189
- // src/onboardingSlice/index.ts
1190
- var import_toolkit5 = require("@reduxjs/toolkit");
1191
- var sliceName5 = "onboarding";
1192
- var initialState5 = {
1193
- approach: null,
1194
- complete: false,
1195
- deviceType: null,
1196
- demoArtifactPort: 85,
1197
- progress: null,
1198
- showTips: null,
1199
- showTipsDialog: false
1200
- };
1201
- var onboardingSlice = (0, import_toolkit5.createSlice)({
1202
- name: sliceName5,
1203
- initialState: initialState5,
1204
- reducers: {
1205
- setOnboardingState: (state, action) => ({ ...state, ...action.payload }),
1206
- setDemoArtifactPort: (state, action) => {
1207
- state.demoArtifactPort = action.payload;
1208
- },
1209
- setShowOnboardingHelp: (state, action) => {
1210
- state.showTips = action.payload;
1211
- },
1212
- setShowDismissOnboardingTipsDialog: (state, action) => {
1213
- state.showTipsDialog = action.payload;
1214
- },
1215
- setOnboardingComplete: (state, action) => {
1216
- state.complete = action.payload;
1217
- },
1218
- setOnboardingProgress: (state, action) => {
1219
- state.progress = action.payload;
1220
- },
1221
- setOnboardingDeviceType: (state, action) => {
1222
- state.deviceType = action.payload;
1223
- },
1224
- setOnboardingApproach: (state, action) => {
1225
- state.approach = action.payload;
1226
- }
1227
- }
1228
- });
1229
- var actions5 = onboardingSlice.actions;
1230
- var onboardingSlice_default = onboardingSlice.reducer;
1231
-
1232
- // src/organizationSlice/index.ts
1233
- var import_toolkit6 = require("@reduxjs/toolkit");
1234
- var sliceName6 = "organization";
1235
- var initialState6 = {
1236
- card: {
1237
- last4: "",
1238
- expiration: { month: 1, year: 2020 },
1239
- brand: ""
1240
- },
1241
- intentId: null,
1242
- tenantList: {
1243
- ...TENANT_LIST_DEFAULT,
1244
- total: 0,
1245
- tenants: [],
1246
- selectedTenant: null,
1247
- sort: {
1248
- direction: import_constants3.SORTING_OPTIONS.desc,
1249
- key: "name"
1250
- }
1251
- },
1252
- organization: {
1253
- // id, name, status, tenant_token, plan
1254
- },
1255
- auditlog: {
1256
- events: [],
1257
- selectionState: {
1258
- ...import_constants3.DEVICE_LIST_DEFAULTS,
1259
- detail: void 0,
1260
- endDate: void 0,
1261
- selectedIssue: void 0,
1262
- sort: { direction: import_constants3.SORTING_OPTIONS.desc },
1263
- startDate: void 0,
1264
- total: 0,
1265
- type: void 0,
1266
- user: void 0,
1267
- isLoading: false
1268
- }
1269
- },
1270
- externalDeviceIntegrations: [
1271
- // { <connection_string|x509|...>, id, provider }
1272
- ],
1273
- ssoConfigs: [],
1274
- webhooks: {
1275
- // [id]: { events: [] }
1276
- // for now:
1277
- events: [],
1278
- eventsTotal: 0
1279
- }
1280
- };
1281
- var organizationSlice = (0, import_toolkit6.createSlice)({
1282
- name: sliceName6,
1283
- initialState: initialState6,
1284
- reducers: {
1285
- receiveAuditLogs: (state, action) => {
1286
- const { events, total } = action.payload;
1287
- state.auditlog.events = events;
1288
- state.auditlog.selectionState.total = total;
1289
- },
1290
- setAuditLogState: (state, action) => {
1291
- state.auditlog.selectionState = {
1292
- ...state.auditlog.selectionState,
1293
- ...action.payload
1294
- };
1295
- },
1296
- receiveCurrentCard: (state, action) => {
1297
- state.card = action.payload;
1298
- },
1299
- receiveSetupIntent: (state, action) => {
1300
- state.intentId = action.payload;
1301
- },
1302
- setOrganization: (state, action) => {
1303
- state.organization = { ...state.organization, ...action.payload };
1304
- },
1305
- setSubscription: (state, action) => {
1306
- state.organization.subscription = { ...state.organization.subscription, ...action.payload };
1307
- },
1308
- setProducts: (state, action) => {
1309
- state.products = action.payload;
1310
- },
1311
- setBillingProfile: (state, action) => {
1312
- state.organization.billing_profile = action.payload;
1313
- },
1314
- setTenantListState: (state, action) => {
1315
- state.tenantList = action.payload;
1316
- },
1317
- receiveExternalDeviceIntegrations: (state, action) => {
1318
- state.externalDeviceIntegrations = action.payload;
1319
- },
1320
- receiveSsoConfigs: (state, action) => {
1321
- state.ssoConfigs = action.payload;
1322
- },
1323
- receiveWebhookEvents: (state, action) => {
1324
- const { value, total } = action.payload;
1325
- state.webhooks.events = value;
1326
- state.webhooks.eventsTotal = total;
1327
- }
1328
- }
1329
- });
1330
- var actions6 = organizationSlice.actions;
1331
- var organizationSlice_default = organizationSlice.reducer;
1332
-
1333
- // src/releasesSlice/index.ts
1334
- var import_toolkit7 = require("@reduxjs/toolkit");
1335
- var sliceName7 = "releases";
1336
- var initialState7 = {
1337
- /*
1338
- * Return list of saved artifacts objects
1339
- */
1340
- /*
1341
- * return list of artifacts where duplicate names are collated with device compatibility lists combined
1342
- */
1343
- // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),
1344
- artifacts: [],
1345
- /*
1346
- * Return list of saved release objects
1347
- */
1348
- byId: {
1349
- /*
1350
- [releaseName]: {
1351
- artifacts: [
1352
- {
1353
- id: '',
1354
- name: '',
1355
- description: '',
1356
- device_types_compatible: [],
1357
- ...
1358
- updates: [{
1359
- files: [
1360
- { size: 123, name: '' }
1361
- ],
1362
- type_info: { type: '' }
1363
- }],
1364
- url: '' // optional
1365
- }
1366
- ],
1367
- modified: ''
1368
- device_types_compatible,
1369
- name: '',
1370
- tags: ['something'],
1371
- notes: ''
1372
- }
1373
- */
1374
- },
1375
- deltaJobs: {
1376
- /*
1377
- [jobId]: {
1378
- id: '',
1379
- ...
1380
- }
1381
- */
1382
- },
1383
- deltaJobsList: {
1384
- ...import_constants3.DEVICE_LIST_DEFAULTS,
1385
- jobIds: [],
1386
- total: 0,
1387
- sort: {
1388
- direction: import_constants3.SORTING_OPTIONS.desc,
1389
- key: "started"
1390
- }
1391
- },
1392
- releasesList: {
1393
- ...import_constants3.DEVICE_LIST_DEFAULTS,
1394
- searchedIds: [],
1395
- releaseIds: [],
1396
- selection: [],
1397
- sort: {
1398
- direction: import_constants3.SORTING_OPTIONS.desc,
1399
- key: "modified"
1400
- },
1401
- isLoading: void 0,
1402
- searchTerm: "",
1403
- searchTotal: 0,
1404
- selectedTags: [],
1405
- total: 0,
1406
- type: ""
1407
- },
1408
- tags: [],
1409
- updateTypes: [],
1410
- selectedJob: null,
1411
- /*
1412
- * Return single release with corresponding Artifacts
1413
- */
1414
- selectedRelease: null
1415
- };
1416
- var releaseSlice = (0, import_toolkit7.createSlice)({
1417
- name: sliceName7,
1418
- initialState: initialState7,
1419
- reducers: {
1420
- receiveRelease: (state, action) => {
1421
- const { name } = action.payload;
1422
- state.byId[name] = action.payload;
1423
- },
1424
- receiveReleases: (state, action) => {
1425
- state.byId = action.payload;
1426
- },
1427
- receiveReleaseTags: (state, action) => {
1428
- state.tags = action.payload;
1429
- },
1430
- receiveReleaseTypes: (state, action) => {
1431
- state.updateTypes = action.payload;
1432
- },
1433
- removeRelease: (state, action) => {
1434
- const { [action.payload]: toBeRemoved, ...byId } = state.byId;
1435
- state.byId = byId;
1436
- state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
1437
- },
1438
- selectedRelease: (state, action) => {
1439
- state.selectedRelease = action.payload;
1440
- },
1441
- setReleaseListState: (state, action) => {
1442
- state.releasesList = action.payload;
1443
- },
1444
- receivedDeltaJobs: (state, action) => {
1445
- const { jobs, total } = action.payload;
1446
- state.deltaJobs = jobs.reduce(
1447
- (accu, job) => {
1448
- accu[job.id] = {
1449
- ...accu[job.id],
1450
- ...job
1451
- };
1452
- return accu;
1453
- },
1454
- { ...state.deltaJobs }
1455
- );
1456
- state.deltaJobsList.jobIds = jobs.map((job) => job.id);
1457
- state.deltaJobsList.total = total;
1458
- },
1459
- receivedDeltaJobDetails: (state, action) => {
1460
- const job = action.payload;
1461
- state.deltaJobs[job.id] = {
1462
- ...state.deltaJobs[job.id],
1463
- ...job
1464
- };
1465
- },
1466
- setDeltaJobsListState: (state, action) => {
1467
- state.deltaJobsList = { ...state.deltaJobsList, ...action.payload };
1468
- },
1469
- setSelectedJob: (state, action) => {
1470
- state.selectedJob = action.payload;
1471
- }
1472
- }
1473
- });
1474
- var actions7 = releaseSlice.actions;
1475
- var releasesSlice_default = releaseSlice.reducer;
1476
-
1477
- // src/usersSlice/index.ts
1478
- var import_toolkit8 = require("@reduxjs/toolkit");
1479
- var sliceName8 = "users";
1480
- var initialState8 = {
1481
- byId: {},
1482
- currentUser: null,
1483
- currentSession: {
1484
- // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting
1485
- },
1486
- customColumns: [],
1487
- qrCode: null,
1488
- globalSettings: {
1489
- id_attribute: void 0,
1490
- previousFilters: [],
1491
- previousPhases: [],
1492
- retries: 0
1493
- },
1494
- permissionSetsById: {
1495
- ...import_constants3.defaultPermissionSets
1496
- },
1497
- rolesById: {
1498
- ...import_constants3.rolesById
1499
- },
1500
- rolesInitialized: false,
1501
- settingsInitialized: false,
1502
- showConnectDeviceDialog: false,
1503
- showFeedbackDialog: false,
1504
- showStartupNotification: false,
1505
- tooltips: {
1506
- byId: {
1507
- // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants
1508
- }
1509
- },
1510
- userSettings: {
1511
- columnSelection: [],
1512
- onboarding: {},
1513
- firstLoginTimestamp: null,
1514
- securityAlertDismissedTimestamp: null
1515
- },
1516
- userSettingsInitialized: false
1517
- };
1518
- var usersSlice = (0, import_toolkit8.createSlice)({
1519
- name: sliceName8,
1520
- initialState: initialState8,
1521
- reducers: {
1522
- receivedQrCode: (state, action) => {
1523
- state.qrCode = action.payload;
1524
- },
1525
- successfullyLoggedIn: (state, action) => {
1526
- state.currentSession = action.payload;
1527
- },
1528
- receivedUserList: (state, action) => {
1529
- state.byId = action.payload;
1530
- },
1531
- receivedUser: (state, action) => {
1532
- state.byId[action.payload.id] = action.payload;
1533
- state.currentUser = action.payload.id;
1534
- },
1535
- removedUser: (state, action) => {
1536
- const { [action.payload]: removedUser, ...byId } = state.byId;
1537
- state.byId = byId;
1538
- state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
1539
- },
1540
- updatedUser: (state, action) => {
1541
- state.byId[action.payload.id] = {
1542
- ...state.byId[action.payload.id],
1543
- ...action.payload
1544
- };
1545
- },
1546
- receivedPermissionSets: (state, action) => {
1547
- state.permissionSetsById = action.payload;
1548
- },
1549
- receivedRoles: (state, action) => {
1550
- state.rolesById = action.payload;
1551
- state.rolesInitialized = true;
1552
- },
1553
- finishedRoleInitialization: (state, action) => {
1554
- state.rolesInitialized = action.payload;
1555
- },
1556
- createdRole: (state, action) => {
1557
- state.rolesById[action.payload.name] = {
1558
- ...state.rolesById[action.payload.name],
1559
- ...action.payload
1560
- };
1561
- },
1562
- removedRole: (state, action) => {
1563
- const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
1564
- state.rolesById = rolesById2;
1565
- },
1566
- setCustomColumns: (state, action) => {
1567
- state.customColumns = action.payload;
1568
- },
1569
- setGlobalSettings: (state, action) => {
1570
- state.settingsInitialized = true;
1571
- state.globalSettings = {
1572
- ...state.globalSettings,
1573
- ...action.payload
1574
- };
1575
- },
1576
- setUserSettings: (state, action) => {
1577
- state.userSettingsInitialized = true;
1578
- state.userSettings = {
1579
- ...state.userSettings,
1580
- ...action.payload
1581
- };
1582
- },
1583
- setTooltipState: (state, action) => {
1584
- const { id, readState = READ_STATES.read } = action.payload;
1585
- state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };
1586
- },
1587
- setTooltipsState: (state, action) => {
1588
- state.tooltips.byId = {
1589
- ...state.tooltips.byId,
1590
- ...action.payload
1591
- };
1592
- },
1593
- setShowFeedbackDialog: (state, action) => {
1594
- state.showFeedbackDialog = action.payload;
1595
- },
1596
- setShowConnectingDialog: (state, action) => {
1597
- state.showConnectDeviceDialog = action.payload;
1598
- },
1599
- setShowStartupNotification: (state, action) => {
1600
- state.showStartupNotification = action.payload;
1601
- }
1602
- }
1603
- });
1604
- var actions8 = usersSlice.actions;
1605
- var usersSlice_default = usersSlice.reducer;
1606
-
1607
- // src/actions.ts
1608
- var actions_default = {
1609
- ...actions2,
1610
- ...actions3,
1611
- ...actions4,
1612
- ...actions,
1613
- ...actions5,
1614
- ...actions6,
1615
- ...actions7,
1616
- ...actions8
1617
- };
1618
-
1619
- // src/api/general-api.ts
1620
- var import_axios = __toESM(require("axios"), 1);
1621
- var import_universal_cookie2 = __toESM(require("universal-cookie"), 1);
1622
-
1623
- // src/auth.ts
1624
- var import_universal_cookie = __toESM(require("universal-cookie"), 1);
1625
- var cookies = new import_universal_cookie.default();
1626
- var emptySession = Object.freeze({ token: "", expiresAt: void 0 });
1627
- var tokenCache = "";
1628
- var getSessionInfo = () => {
1629
- let sessionInfo = { ...emptySession };
1630
- try {
1631
- sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
1632
- } catch {
1633
- }
1634
- const jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1635
- if (jwtTokenFromCookie) {
1636
- setSessionInfo({ token: jwtTokenFromCookie });
1637
- cookies.remove("JWT");
1638
- cookies.remove("JWT", { path: "/" });
1639
- return { token: jwtTokenFromCookie, expiresAt: void 0 };
1640
- }
1641
- if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
1642
- cleanUp();
1643
- return { ...emptySession };
1644
- }
1645
- sessionInfo.token = sessionInfo.token || "";
1646
- tokenCache = sessionInfo.token;
1647
- return sessionInfo;
1648
- };
1649
- var getToken = () => tokenCache ? tokenCache : getSessionInfo().token;
1650
- var setSessionInfo = ({ token, expiresAt }) => {
1651
- tokenCache = token;
1652
- window.localStorage.setItem("JWT", JSON.stringify({ token, expiresAt }));
1653
- };
1654
- var cleanUp = () => {
1655
- tokenCache = "";
1656
- cookies.remove("JWT");
1657
- cookies.remove("JWT", { path: "/" });
1658
- window.localStorage.removeItem("JWT");
1659
- window.localStorage.removeItem("oauth");
1660
- };
1661
-
1662
- // src/api/general-api.ts
1663
- var cookies2 = new import_universal_cookie2.default();
1664
- var unauthorizedRedirect = (error) => {
1665
- if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken() && !window.location.pathname.endsWith("/subscription")) {
1666
- if (cookies2.get("JWT", { doNotParse: true })) {
1667
- window.location.reload();
1668
- return Promise.reject(error);
1669
- }
1670
- cleanUp();
1671
- window.location.replace("/ui/");
1672
- }
1673
- return Promise.reject(error);
1674
- };
1675
- var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Content-Type": "application/json" } };
1676
- var authenticatedRequest = import_axios.default.create(commonRequestConfig);
1677
- authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
1678
- authenticatedRequest.interceptors.request.use(
1679
- (config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
1680
- (error) => Promise.reject(error)
1681
- );
1682
- var Api = {
1683
- get: authenticatedRequest.get,
1684
- delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
1685
- patch: authenticatedRequest.patch,
1686
- post: authenticatedRequest.post,
1687
- postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
1688
- put: authenticatedRequest.put,
1689
- upload: (url, formData, progress, cancelSignal) => authenticatedRequest.post(url, formData, {
1690
- headers: { "Content-Type": "multipart/form-data" },
1691
- onUploadProgress: progress,
1692
- timeout: 0,
1693
- signal: cancelSignal
1694
- }),
1695
- uploadPut: (url, formData, progress, cancelSignal) => authenticatedRequest.put(url, formData, {
1696
- headers: { "Content-Type": "multipart/form-data" },
1697
- onUploadProgress: progress,
1698
- timeout: 0,
1699
- signal: cancelSignal
1700
- })
1701
- };
1702
- var general_api_default = Api;
1703
-
1704
- // src/appSlice/selectors.ts
1705
- var import_helpers2 = require("@northern.tech/utils/helpers");
1706
- var import_toolkit9 = require("@reduxjs/toolkit");
1707
- var getFeatures = (state) => state.app.features;
1708
- var getFullVersionInformation = (state) => state.app.versionInformation;
1709
- var getSearchState = (state) => state.app.searchState;
1710
- var getUploads = (state) => state.app.uploadsById;
1711
- var getIsUploading = (0, import_toolkit9.createSelector)([getUploads], (uploadsById) => !!Object.keys(uploadsById).length);
1712
- var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
1713
- var getVersionInformation = (0, import_toolkit9.createSelector)(
1714
- [getFullVersionInformation, getFeatures],
1715
- ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1716
- );
1717
- var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
1718
-
1719
- // src/commonSelectors.ts
1720
- var import_helpers5 = require("@northern.tech/utils/helpers");
1721
- var import_toolkit15 = require("@reduxjs/toolkit");
1722
- var import_dayjs = __toESM(require("dayjs"), 1);
1723
-
1724
- // src/deploymentsSlice/selectors.ts
1725
- var import_toolkit10 = require("@reduxjs/toolkit");
1726
- var getDeploymentsById = (state) => state.deployments.byId;
1727
- var getDeploymentsByStatus = (state) => state.deployments.byStatus;
1728
- var getSelectedDeploymentDeviceIds = (state) => state.deployments.selectedDeviceIds;
1729
- var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
1730
- var getDeploymentById = (0, import_toolkit10.createSelector)(
1731
- [getDeploymentsById, (_, deploymentId) => deploymentId],
1732
- (deploymentsById, deploymentId = "") => deploymentsById[deploymentId]
1733
- );
1734
- var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
1735
- [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
1736
- (selectionState, deploymentsState, deploymentsById) => {
1737
- const { selection = [] } = selectionState[deploymentsState] ?? {};
1738
- return selection.reduce((accu, id) => {
1739
- if (deploymentsById[id]) {
1740
- accu.push(deploymentsById[id]);
1741
- }
1742
- return accu;
1743
- }, []);
1744
- }
1745
- );
1746
- var relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];
1747
- var DEPLOYMENT_CUTOFF = 3;
1748
- var getRecentDeployments = (0, import_toolkit10.createSelector)(
1749
- [getDeploymentsById, getDeploymentsByStatus],
1750
- (deploymentsById, deploymentsByStatus) => Object.entries(deploymentsByStatus).reduce(
1751
- (accu, [state, byStatus]) => {
1752
- if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {
1753
- return accu;
1754
- }
1755
- accu[state] = byStatus.deploymentIds.reduce((accu2, id) => {
1756
- if (deploymentsById[id]) {
1757
- accu2.push(deploymentsById[id]);
1758
- }
1759
- return accu2;
1760
- }, []).slice(0, DEPLOYMENT_CUTOFF);
1761
- accu.total += byStatus.total;
1762
- return accu;
1763
- },
1764
- { total: 0 }
1765
- )
1766
- );
1767
-
1768
- // src/devicesSlice/selectors.ts
1769
- var import_helpers3 = require("@northern.tech/utils/helpers");
1770
- var import_toolkit11 = require("@reduxjs/toolkit");
1771
- var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
1772
- var getDevicesByStatus = (state) => state.devices.byStatus;
1773
- var getDevicesById = (state) => state.devices.byId;
1774
- var getGroupsById = (state) => state.devices.groups.byId;
1775
- var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
1776
- var getListedDevices = (state) => state.devices.deviceList.deviceIds;
1777
- var getFilteringAttributes = (state) => state.devices.filteringAttributes;
1778
- var getDeviceFilters = (state) => state.devices.filters || [];
1779
- var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
1780
- var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
1781
- ...filteringAttributes,
1782
- identityAttributes: [...filteringAttributes.identityAttributes, "id"]
1783
- }));
1784
- var getDeviceLimits = (state) => state.devices.limits;
1785
- var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
1786
- var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
1787
- [getFilteringAttributes, getFilteringAttributesLimit],
1788
- ({ identityAttributes }, filteringAttributesLimit) => {
1789
- const attributes = identityAttributes.slice(0, filteringAttributesLimit);
1790
- return attributes.reduce(
1791
- (accu, value) => {
1792
- accu.push({ value, label: value, scope: "identity" });
1793
- return accu;
1794
- },
1795
- [
1796
- { value: "name", label: "Name", scope: "tags" },
1797
- { value: "id", label: "Device ID", scope: "identity" }
1798
- ]
1799
- );
1800
- }
1801
- );
1802
- var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
1803
- [getDevicesByStatus],
1804
- (byStatus) => Object.values(import_constants3.DEVICE_STATES).reduce(
1805
- (accu, deviceState) => {
1806
- const { counts } = byStatus[deviceState];
1807
- const { total, ...tieredCounts } = counts;
1808
- const count = Object.values(tieredCounts).reduce((accu2, countPerTier) => accu2 + countPerTier, 0);
1809
- accu[deviceState] = count;
1810
- accu.total = accu.total + count;
1811
- return accu;
1812
- },
1813
- { total: 0 }
1814
- )
1815
- );
1816
- var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
1817
- var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
1818
- [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],
1819
- ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {
1820
- let groupCount = acceptedDeviceTotal;
1821
- let groupFilters = [];
1822
- if (selectedGroup && groupsById[selectedGroup]) {
1823
- groupCount = groupsById[selectedGroup].total || 0;
1824
- groupFilters = groupsById[selectedGroup].filters || [];
1825
- }
1826
- return { groupCount, selectedGroup, groupFilters };
1827
- }
1828
- );
1829
- var getCombinedLimit = (0, import_toolkit11.createSelector)(
1830
- [getDeviceLimits],
1831
- (deviceLimits) => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0)
1832
- // limit might be -1 for unlimited devices
1833
- );
1834
- var getLimitMaxed = (0, import_toolkit11.createSelector)(
1835
- [getDeviceCountsByStatus, getCombinedLimit],
1836
- ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices
1837
- );
1838
- var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
1839
- var getGroupData = (0, import_toolkit11.createSelector)([getGroupsByIdWithoutUngrouped], (groups) => {
1840
- const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : void 0;
1841
- const hasDynamicGroups = Object.values(groups).some((group) => !!group.id);
1842
- return { createdGroup, hasDynamicGroups, groups };
1843
- });
1844
- var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
1845
- const groupNames = Object.keys(groupsById).sort();
1846
- const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
1847
- (accu, [groupname, group]) => {
1848
- const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
1849
- const groupItem = { ...group, groupId: name, name: groupname };
1850
- if ((group.filters ?? []).length > 0) {
1851
- if (groupname !== UNGROUPED_GROUP.id) {
1852
- accu.dynamic.push(groupItem);
1853
- } else {
1854
- accu.ungrouped.push(groupItem);
1855
- }
1856
- } else {
1857
- accu.static.push(groupItem);
1858
- }
1859
- return accu;
1860
- },
1861
- { dynamic: [], static: [], ungrouped: [] }
1862
- );
1863
- return { groupNames, ...groupedGroups };
1864
- });
1865
- var getAttributesList = (0, import_toolkit11.createSelector)(
1866
- [getFilteringAttributes, getFilteringAttributesFromConfig],
1867
- ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
1868
- );
1869
- var getEnabledTierLimits = (0, import_toolkit11.createSelector)([getDeviceLimits], (limits) => Object.entries(limits).filter(([, limit]) => limit !== 0));
1870
- var getEnabledTiers = (0, import_toolkit11.createSelector)([getEnabledTierLimits], (enabledTierLimits) => enabledTierLimits.map(([type]) => type));
1871
- var getDeviceLimitStats = (0, import_toolkit11.createSelector)([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {
1872
- const { counts } = accepted;
1873
- return enabledTierLimits.map(([type, limit]) => ({
1874
- type,
1875
- limit,
1876
- total: counts[type] || 0
1877
- }));
1878
- });
1879
- var getDeviceTypes = (0, import_toolkit11.createSelector)(
1880
- [getAcceptedDevices, getDevicesById],
1881
- ({ deviceIds = [] }, devicesById) => Object.keys(
1882
- deviceIds.slice(0, 200).reduce((accu, item) => {
1883
- const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};
1884
- accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {
1885
- if (deviceType.length > 1) {
1886
- deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;
1887
- }
1888
- return deviceTypeAccu;
1889
- }, accu);
1890
- return accu;
1891
- }, {})
1892
- )
1893
- );
1894
-
1895
- // src/monitorSlice/selectors.ts
1896
- var getIssueCountsByType = (state) => state.monitor.issueCounts.byType;
1897
-
1898
- // src/onboardingSlice/selectors.ts
1899
- var getOnboarding = (state) => state.onboarding;
1900
-
1901
- // src/organizationSlice/selectors.ts
1902
- var import_toolkit12 = require("@reduxjs/toolkit");
1903
- var getOrganization = (state) => state.organization.organization;
1904
- var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
1905
- var getAuditLog = (state) => state.organization.auditlog.events;
1906
- var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
1907
- var getTenantsList = (state) => state.organization.tenantList;
1908
- var getWebhookEvents = (state) => state.organization.webhooks.events;
1909
- var getWebhookEventTotal = (state) => state.organization.webhooks.eventsTotal;
1910
- var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
1911
- [getExternalIntegrations],
1912
- (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
1913
- );
1914
- var getIsServiceProvider = (state) => state.organization.organization.service_provider;
1915
- var getWebhooks = (0, import_toolkit12.createSelector)(
1916
- [getExternalIntegrations],
1917
- (integrations) => integrations.filter((integration) => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)
1918
- );
1919
- var getWebhookEventInfo = (0, import_toolkit12.createSelector)(
1920
- [getWebhooks, getWebhookEvents, getWebhookEventTotal],
1921
- (webhooks, events, eventTotal) => webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }
1922
- );
1923
- var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {
1924
- if (!selectedId) {
1925
- return;
1926
- }
1927
- const [eventAction, eventTime] = atob(selectedId).split("|");
1928
- return events.find((item) => item.action === eventAction && item.time === eventTime);
1929
- });
1930
- var toTierName = (key) => key.replace(/max_|_?devices/g, "") || "standard";
1931
- var processDeviceLimits = (deviceLimits, skipFilter = false) => {
1932
- const result = { limits: {}, disabled: [] };
1933
- if (!deviceLimits) return result;
1934
- const tiersByName = Object.fromEntries(Object.entries(deviceLimits).map(([key, limit]) => [toTierName(key), { key, limit }]));
1935
- return productOrder.reduce((accu, tierName) => {
1936
- const entry = tiersByName[tierName];
1937
- if (!entry) return accu;
1938
- const { key, limit } = entry;
1939
- if (limit.value === 0) {
1940
- accu.disabled.push(tierName);
1941
- if (!skipFilter) return accu;
1942
- }
1943
- accu.limits[tierName] = {
1944
- id: tierName,
1945
- backendId: key,
1946
- limit: limit.value,
1947
- current: limit.current_value,
1948
- name: tierName,
1949
- quotaLeft: Math.max(limit.value - limit.current_value, 0),
1950
- limitReached: limit.value !== -1 && limit.value <= limit.current_value
1951
- };
1952
- return accu;
1953
- }, result);
1954
- };
1955
- var getDeviceLimitsInfo = (0, import_toolkit12.createSelector)([getOrganization], ({ device_limits }) => processDeviceLimits(device_limits));
1956
- var getDisabledTiers = (0, import_toolkit12.createSelector)([getDeviceLimitsInfo], ({ disabled }) => disabled);
1957
- var getSpLimits = (0, import_toolkit12.createSelector)([getDeviceLimitsInfo], ({ limits }) => limits);
1958
- var getTenantListWithLimits = (0, import_toolkit12.createSelector)([getTenantsList], (tenantList) => ({
1959
- ...tenantList,
1960
- tenants: tenantList.tenants.map((tenant) => ({
1961
- ...tenant,
1962
- device_limits: processDeviceLimits(tenant.device_limits, true).limits
1963
- }))
1964
- }));
1965
-
1966
- // src/releasesSlice/selectors.ts
1967
- var import_toolkit13 = require("@reduxjs/toolkit");
1968
-
1969
- // src/utils.ts
1970
- var import_helpers4 = require("@northern.tech/utils/helpers");
1971
- var filterProcessors = {
1972
- [import_constants3.DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
1973
- [import_constants3.DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
1974
- [import_constants3.DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
1975
- [import_constants3.DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
1976
- [import_constants3.DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
1977
- [import_constants3.DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
1978
- [import_constants3.DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
1979
- [import_constants3.DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers4.yes,
1980
- [import_constants3.DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
1981
- };
1982
- var filterAliases = {
1983
- $nexists: { alias: import_constants3.DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
1984
- };
1985
- var mapFiltersToTerms = (filters) => filters.map((filter) => ({
1986
- scope: filter.scope,
1987
- attribute: filter.key,
1988
- type: filterAliases[filter.operator]?.alias || filter.operator,
1989
- value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
1990
- }));
1991
- var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
1992
- if (typeof import_constants3.DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
1993
- return { ...import_constants3.DEVICE_ISSUE_OPTIONS[item].filterRule, value: import_constants3.DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
1994
- }
1995
- return import_constants3.DEVICE_ISSUE_OPTIONS[item].filterRule;
1996
- });
1997
- var convertDeviceListStateToFilters = ({
1998
- filters = [],
1999
- group,
2000
- groups = { byId: {} },
2001
- offlineThreshold,
2002
- selectedIssues = [],
2003
- status
2004
- }) => {
2005
- let applicableFilters = [...filters];
2006
- if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2007
- applicableFilters.push({ key: "group", value: group, operator: import_constants3.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
2008
- }
2009
- const nonMonitorFilters = applicableFilters.filter(
2010
- (filter) => !Object.values(import_constants3.DEVICE_ISSUE_OPTIONS).some(
2011
- ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2012
- )
2013
- );
2014
- const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2015
- applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2016
- const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: import_constants3.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
2017
- return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2018
- };
2019
- var listItemMapper = (byId, ids, { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
2020
- if (id && byId[id]) {
2021
- accu.push({ ...defaultObject, ...byId[id] });
2022
- }
2023
- return accu;
2024
- }, []);
2025
- var mergePermissions = (existingPermissions = { ...import_constants3.emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2026
- (accu, [key, value]) => {
2027
- let values;
2028
- if (!accu[key]) {
2029
- accu[key] = value;
2030
- return accu;
2031
- }
2032
- if (Array.isArray(value)) {
2033
- values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
2034
- } else {
2035
- values = mergePermissions(accu[key], { ...value });
2036
- }
2037
- accu[key] = values;
2038
- return accu;
2039
- },
2040
- { ...addedPermissions }
2041
- );
2042
- var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2043
- (accu, roleId) => {
2044
- if (!(roleId && roles[roleId])) {
2045
- return accu;
2046
- }
2047
- return mergePermissions(accu, roles[roleId].uiPermissions);
2048
- },
2049
- { ...import_constants3.emptyUiPermissions }
2050
- );
2051
- var isDarkMode = (mode) => mode === DARK_MODE;
2052
-
2053
- // src/releasesSlice/selectors.ts
2054
- var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2055
- var getReleasesById = (state) => state.releases.byId;
2056
- var getReleaseTags = (state) => state.releases.tags;
2057
- var getReleaseListState = (state) => state.releases.releasesList;
2058
- var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2059
- var releaseDefaults = {};
2060
- var getReleaseMappingDefaults = () => releaseDefaults;
2061
- var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2062
- var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2063
- var getHasReleases = (0, import_toolkit13.createSelector)(
2064
- [getReleaseListState, getReleasesById],
2065
- ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2066
- );
2067
- var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id || ""] ?? {});
2068
- var getSelectedReleases = (0, import_toolkit13.createSelector)([getReleaseListState, getReleasesList], ({ selection }, releases) => selection.map((index) => releases[index]));
2069
- var getDeltaJobsById = (state) => state.releases.deltaJobs;
2070
- var getDeltaJobById = (0, import_toolkit13.createSelector)([getDeltaJobsById, (_, jobId) => jobId], (byId, jobId) => byId[jobId]);
2071
- var getSelectedJobId = (state) => state.releases.selectedJob;
2072
- var getSelectedJob = (0, import_toolkit13.createSelector)([getDeltaJobsById, getSelectedJobId], (byId, jobId) => byId[jobId || ""]);
2073
-
2074
- // src/usersSlice/selectors.ts
2075
- var import_toolkit14 = require("@reduxjs/toolkit");
2076
- var emptyObject = {};
2077
- var getRolesById = (state) => state.users.rolesById;
2078
- var getTooltipsById = (state) => state.users.tooltips.byId;
2079
- var getGlobalSettings = (state) => state.users.globalSettings;
2080
- var getUserSettingsInitialized = (state) => state.users.userSettingsInitialized;
2081
- var getCurrentUserId = (state) => state.users.currentUser;
2082
- var getUsersById = (state) => state.users.byId;
2083
- var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
2084
- var getCurrentUser = (0, import_toolkit14.createSelector)(
2085
- [getUsersById, getCurrentUserId],
2086
- (usersById, userId) => userId ? usersById[userId] ?? emptyObject : emptyObject
2087
- );
2088
- var getUserSettings = (state) => state.users.userSettings;
2089
- var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
2090
- [getUserSettings],
2091
- ({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
2092
- );
2093
- var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2094
- var getReadAllHelptips = (0, import_toolkit14.createSelector)(
2095
- [getTooltipsById],
2096
- (tooltips) => Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)
2097
- );
2098
- var getTooltipsState = (0, import_toolkit14.createSelector)(
2099
- [getTooltipsById, getUserSettings],
2100
- (byId, { tooltips = {} }) => Object.entries(byId).reduce(
2101
- (accu, [id, value]) => {
2102
- accu[id] = { ...accu[id], ...value };
2103
- return accu;
2104
- },
2105
- { ...tooltips }
2106
- )
2107
- );
2108
- var getHas2FA = (0, import_toolkit14.createSelector)(
2109
- [getCurrentUser],
2110
- (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === import_constants3.twoFAStates.enabled
2111
- );
2112
- var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2113
- var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
2114
- interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
2115
- intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
2116
- }));
2117
- var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([value, role]) => ({ value, ...role })));
2118
- var getSecurityAlertDismissedTimestamp = (state) => state.users.userSettings.securityAlertDismissedTimestamp;
2119
-
2120
- // src/commonSelectors.ts
2121
- var getIsEnterprise = (0, import_toolkit15.createSelector)(
2122
- [getOrganization, getFeatures],
2123
- ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || isHosted && plan === PLANS.enterprise.id
2124
- );
2125
- var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2126
- [getFeatures],
2127
- ({ hasReporting }) => hasReporting ? `${import_constants3.reportingApiUrl}/devices/search/attributes` : `${import_constants3.inventoryApiUrlV2}/filters/attributes`
2128
- );
2129
- var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2130
- [getFeatures],
2131
- ({ hasReporting }) => hasReporting ? `${import_constants3.reportingApiUrl}/devices/search` : `${import_constants3.inventoryApiUrlV2}/filters/search`
2132
- );
2133
- var getUserRoles = (0, import_toolkit15.createSelector)([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById2, isEnterprise) => {
2134
- const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === import_constants3.rolesByName.admin) : !isEnterprise;
2135
- const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([import_constants3.rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2136
- return { isAdmin, uiPermissions };
2137
- });
2138
- var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2139
- var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2140
- const canManageReleases = hasPermission(uiPermissions.releases, import_constants3.uiPermissionsById.manage.value);
2141
- const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants3.uiPermissionsById.read.value);
2142
- const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants3.uiPermissionsById.upload.value);
2143
- const canAuditlog = uiPermissions.auditlog.includes(import_constants3.uiPermissionsById.read.value);
2144
- const canReadUsers = uiPermissions.userManagement.includes(import_constants3.uiPermissionsById.read.value);
2145
- const canManageUsers = uiPermissions.userManagement.includes(import_constants3.uiPermissionsById.manage.value);
2146
- const canReadDevices = hasPermission(uiPermissions.groups, import_constants3.uiPermissionsById.read.value);
2147
- const canWriteDevices = Object.values(uiPermissions.groups).some(
2148
- (groupPermissions) => groupPermissions.includes(import_constants3.uiPermissionsById.read.value) && groupPermissions.length > 1
2149
- );
2150
- const canTroubleshoot = hasPermission(uiPermissions.groups, import_constants3.uiPermissionsById.connect.value);
2151
- const canManageDevices = hasPermission(uiPermissions.groups, import_constants3.uiPermissionsById.manage.value);
2152
- const canConfigure = hasPermission(uiPermissions.groups, import_constants3.uiPermissionsById.configure.value);
2153
- const canDeploy = uiPermissions.deployments.includes(import_constants3.uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, import_constants3.uiPermissionsById.deploy.value);
2154
- const canReadDeployments = uiPermissions.deployments.includes(import_constants3.uiPermissionsById.read.value);
2155
- return {
2156
- canAuditlog,
2157
- canConfigure,
2158
- canDeploy,
2159
- canManageDevices,
2160
- canManageReleases,
2161
- canManageUsers,
2162
- canReadDeployments,
2163
- canReadDevices,
2164
- canReadReleases,
2165
- canReadUsers,
2166
- canTroubleshoot,
2167
- canUploadReleases,
2168
- canWriteDevices,
2169
- groupsPermissions: uiPermissions.groups,
2170
- releasesPermissions: uiPermissions.releases,
2171
- SPTenant: isServiceProvider
2172
- };
2173
- });
2174
- var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2175
- [getFeatures, getOrganization, getIsEnterprise],
2176
- ({
2177
- hasAuditlogs: isAuditlogEnabled,
2178
- hasDeviceConfig: isDeviceConfigEnabled,
2179
- hasDeviceConnect: isDeviceConnectEnabled,
2180
- hasMonitor: isMonitorEnabled,
2181
- isHosted
2182
- }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2183
- const canDelta = isEnterprise || plan === PLANS.professional.id;
2184
- const hasAuditlogs = isAuditlogEnabled && isEnterprise;
2185
- const hasDeviceConfig = addons.some((addon) => addon.name === ADDONS.configure.id && addon.enabled) || isDeviceConfigEnabled && !isHosted;
2186
- const hasDeviceConnect = addons.some((addon) => addon.name === ADDONS.troubleshoot.id && addon.enabled) || isDeviceConnectEnabled && !isHosted;
2187
- const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === ADDONS.monitor.id && addon.enabled);
2188
- return {
2189
- canDelta,
2190
- canRetry: canDelta,
2191
- canSchedule: canDelta,
2192
- hasAuditlogs,
2193
- hasDeviceConfig,
2194
- hasDeviceConnect,
2195
- hasFullFiltering: canDelta,
2196
- hasMonitor,
2197
- isEnterprise,
2198
- plan
2199
- };
2200
- }
2201
- );
2202
- var getFilterAttributes = (0, import_toolkit15.createSelector)(
2203
- [getGlobalSettings, getFilteringAttributes],
2204
- ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2205
- const deviceNameAttribute = { key: "name", value: "Name", scope: import_constants3.ATTRIBUTE_SCOPES.tags, category: import_constants3.ATTRIBUTE_SCOPES.tags, priority: 1 };
2206
- const deviceIdAttribute = { key: "id", value: "Device ID", scope: import_constants3.ATTRIBUTE_SCOPES.identity, category: import_constants3.ATTRIBUTE_SCOPES.identity, priority: 1 };
2207
- const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: import_constants3.ATTRIBUTE_SCOPES.system, category: import_constants3.ATTRIBUTE_SCOPES.system, priority: 4 };
2208
- const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2209
- const firstRequestAttribute = { key: "created_ts", value: "First request", scope: import_constants3.ATTRIBUTE_SCOPES.system, category: import_constants3.ATTRIBUTE_SCOPES.system, priority: 4 };
2210
- const attributes = [
2211
- ...previousFilters.map((item) => ({
2212
- ...item,
2213
- value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
2214
- category: "recently used",
2215
- priority: 0
2216
- })),
2217
- deviceNameAttribute,
2218
- deviceIdAttribute,
2219
- ...identityAttributes.map((item) => ({ key: item, value: item, scope: import_constants3.ATTRIBUTE_SCOPES.identity, category: import_constants3.ATTRIBUTE_SCOPES.identity, priority: 1 })),
2220
- ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: import_constants3.ATTRIBUTE_SCOPES.inventory, category: import_constants3.ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2221
- ...tagAttributes.map((item) => ({ key: item, value: item, scope: import_constants3.ATTRIBUTE_SCOPES.tags, category: import_constants3.ATTRIBUTE_SCOPES.tags, priority: 3 })),
2222
- checkInAttribute,
2223
- updateAttribute,
2224
- firstRequestAttribute,
2225
- ...systemAttributes.map((item) => ({ key: item, value: item, scope: import_constants3.ATTRIBUTE_SCOPES.system, category: import_constants3.ATTRIBUTE_SCOPES.system, priority: 4 }))
2226
- ];
2227
- return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
2228
- }
2229
- );
2230
- var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({
2231
- ...remainder,
2232
- ...onboarding,
2233
- complete: onboarding.complete || complete,
2234
- progress: Object.keys(onboardingSteps).findIndex((step) => step === progress) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress : onboarding.progress,
2235
- showTips: !onboarding.showTips ? onboarding.showTips : showTips
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../chunk-CKQMccvm.cjs");
3
+ const require_constants = require("../constants.cjs");
4
+ const require_monitorSlice_index = require("./index.cjs");
5
+ const require_actions = require("../actions.cjs");
6
+ const require_devicesSlice_selectors = require("../devicesSlice/selectors.cjs");
7
+ const require_utils = require("../utils.cjs");
8
+ const require_store = require("../store.cjs");
9
+ const require_api_general_api = require("../api/general-api.cjs");
10
+ let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
11
+ //#region src/monitorSlice/thunks.ts
12
+ const { page: defaultPage, perPage: defaultPerPage } = _northern_tech_utils_constants.DEVICE_LIST_DEFAULTS;
13
+ const cutoffLength = 75;
14
+ const ellipsis = "...";
15
+ const longTextTrimmer = (text) => text.length >= cutoffLength + 3 ? `${text.substring(0, cutoffLength + 3)}${ellipsis}` : text;
16
+ const sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({
17
+ ...alert,
18
+ fullName: alert.name,
19
+ name: longTextTrimmer(alert.name || "")
2236
20
  }));
2237
- var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
2238
- const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
2239
- return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
2240
- });
2241
- var getDeviceConfigDeployment = (0, import_toolkit15.createSelector)([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
2242
- const { config = {} } = device;
2243
- const { deployment_id: configDeploymentId } = config;
2244
- const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};
2245
- return { device, deviceConfigDeployment };
2246
- });
2247
- var getDeploymentRelease = (0, import_toolkit15.createSelector)(
2248
- [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],
2249
- (deploymentsById, { selectedId }, releasesById) => {
2250
- const deployment = deploymentsById[selectedId] || {};
2251
- return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };
2252
- }
2253
- );
2254
- var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2255
- [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
2256
- (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
2257
- const deployment = deploymentsById[selectedId] ?? {};
2258
- const { devices = {} } = deployment;
2259
- return {
2260
- deployment,
2261
- selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
2262
- };
2263
- }
2264
- );
2265
- var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2266
- [getFeatures, getTenantCapabilities, getIssueCountsByType],
2267
- ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(import_constants3.DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2268
- if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2269
- return accu;
2270
- }
2271
- accu[key] = { count: issueCounts[key].filtered, key, title };
2272
- return accu;
2273
- }, {})
2274
- );
2275
- var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {
2276
- const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2277
- return Object.keys(
2278
- Object.entries(groups).reduce((accu, [groupName, group]) => {
2279
- if (group.filterId || uiPermissions.groups[import_constants3.ALL_DEVICES]) {
2280
- accu[groupName] = group;
2281
- }
2282
- return accu;
2283
- }, uiPermissions.groups)
2284
- ).sort();
2285
- });
2286
- var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
2287
- [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
2288
- ({ reports }, { id: currentUserId }, globalSettings, devicesById) => reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])
2289
- );
2290
- var listTypeDeviceIdMap = {
2291
- deviceList: getListedDevices,
2292
- search: getSearchedDevices
2293
- };
2294
- var deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };
2295
- var getDeviceMappingDefaults = () => deviceMapDefault;
2296
- var getMappedDevicesList = (0, import_toolkit15.createSelector)(
2297
- [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],
2298
- listItemMapper
2299
- );
2300
- var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {
2301
- let auditlogDevice = {};
2302
- if (auditlogEvent) {
2303
- const { object = {} } = auditlogEvent;
2304
- const { device = {}, id, type } = object;
2305
- auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
2306
- }
2307
- return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
2308
- });
2309
- var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2310
- if (service_provider) {
2311
- return roles.reduce((accu, role) => {
2312
- if (import_constants3.rolesById[role.value]) {
2313
- return accu;
2314
- }
2315
- accu.push(role);
2316
- return accu;
2317
- }, Object.values(import_constants3.serviceProviderRolesById));
2318
- }
2319
- return Object.keys(import_constants3.rolesById).reverse().reduce((accu, key) => {
2320
- const index = accu.findIndex(({ value }) => value === key);
2321
- accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2322
- return accu;
2323
- }, roles);
2324
- });
2325
- var getShowSecurityAlert = (0, import_toolkit15.createSelector)(
2326
- [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],
2327
- (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {
2328
- const isOAuth2 = !!currentUser?.sso?.length;
2329
- const userVerified = !!currentUser.verified;
2330
- const isHosted = features?.isHosted;
2331
- const canHave2FA = isEnterprise || isHosted;
2332
- const secureOAuthUser = isOAuth2 && userVerified;
2333
- if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {
2334
- return false;
2335
- }
2336
- if (dismissedTimestamp === null) {
2337
- return true;
2338
- }
2339
- const today = (0, import_dayjs.default)();
2340
- const dismissedMonthAgo = today.diff(dismissedTimestamp, "months");
2341
- return dismissedMonthAgo > 0;
2342
- }
2343
- );
2344
-
2345
- // src/store.ts
2346
- var import_react_redux = require("react-redux");
2347
- var import_helpers6 = require("@northern.tech/utils/helpers");
2348
- var import_toolkit16 = require("@reduxjs/toolkit");
2349
- var import_react = require("@sentry/react");
2350
- var { setSnackbar, uploadProgress } = actions_default;
2351
- var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2352
- var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
2353
- resetEnvironment();
2354
- var commonErrorFallback = "Please check your connection.";
2355
- var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
2356
- const errMsg = (0, import_helpers6.extractErrorMessage)(err, fallback);
2357
- if (mightBeAuthRelated || getToken()) {
2358
- dispatch(setSnackbar({ message: (0, import_helpers6.preformatWithRequestID)(err.response, `${errorContext} ${errMsg}`), action: "Copy to clipboard" }));
2359
- }
2360
- return Promise.reject(err);
2361
- };
2362
- var rootReducer = (0, import_toolkit16.combineReducers)({
2363
- app: appSlice_default,
2364
- devices: devicesSlice_default,
2365
- deployments: deploymentsSlice_default,
2366
- monitor: monitorSlice_default,
2367
- onboarding: onboardingSlice_default,
2368
- organization: organizationSlice_default,
2369
- releases: releasesSlice_default,
2370
- users: usersSlice_default
2371
- });
2372
- var sessionReducer = (state, action) => {
2373
- if (action.type === USER_LOGOUT) {
2374
- state = void 0;
2375
- }
2376
- return rootReducer(state, action);
2377
- };
2378
- var rejectionLoggerMiddleware = () => (next) => (action) => {
2379
- if (action.type.endsWith("/rejected")) {
2380
- const { error } = action;
2381
- console.error("Rejection in action:", action);
2382
- console.error(error.stack);
2383
- }
2384
- return next(action);
2385
- };
2386
- var tracingActionIgnoreList = [actions8.successfullyLoggedIn.type, "users/loginUser/pending", "users/loginUser/fulfilled", "users/loginUser/rejected"];
2387
- var sentryReduxEnhancer = (0, import_react.createReduxEnhancer)({
2388
- actionTransformer: (action) => {
2389
- if (tracingActionIgnoreList.includes(action.type)) {
2390
- return null;
2391
- }
2392
- return action;
2393
- },
2394
- // Transform the state to remove sensitive information
2395
- stateTransformer: (state) => {
2396
- const transformedState = {
2397
- ...state,
2398
- users: { ...state.users, currentSession: null },
2399
- organization: {
2400
- ...state.organization,
2401
- organization: {
2402
- ...state.organization.organization,
2403
- tenant_token: null
2404
- }
2405
- }
2406
- };
2407
- return transformedState;
2408
- }
2409
- });
2410
- var getConfiguredStore = (options = {}) => {
2411
- const { preloadedState = {}, ...config } = options;
2412
- return (0, import_toolkit16.configureStore)({
2413
- ...config,
2414
- preloadedState,
2415
- enhancers: (getDefaultEnhancers) => {
2416
- if (window.mender_environment?.sentry?.isReduxEnabled) {
2417
- return getDefaultEnhancers().concat(sentryReduxEnhancer);
2418
- }
2419
- return getDefaultEnhancers();
2420
- },
2421
- reducer: sessionReducer,
2422
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2423
- immutableCheck: {
2424
- ignoredPaths: ["app.uploadsById"]
2425
- },
2426
- serializableCheck: {
2427
- ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, uploadProgress.name],
2428
- ignoredActionPaths: ["uploads", /payload\..*$/, "meta.arg.file", "meta.arg.integration.configHint"],
2429
- ignoredPaths: ["app.uploadsById", "organization.externalDeviceIntegrations"]
2430
- }
2431
- }).concat(rejectionLoggerMiddleware)
2432
- });
2433
- };
2434
- var store = getConfiguredStore({
2435
- preloadedState: {}
2436
- });
2437
- var createAppAsyncThunk = import_toolkit16.createAsyncThunk.withTypes();
21
+ const getDeviceAlerts = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
22
+ const { page = defaultPage, perPage = defaultPerPage, issuedBefore, issuedAfter, sortAscending = false } = config;
23
+ const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
24
+ const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : "";
25
+ return require_api_general_api.default.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`).catch((err) => require_store.commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then((res) => Promise.all([dispatch(require_monitorSlice_index.actions.receiveDeviceAlerts({
26
+ deviceId: id,
27
+ alerts: sanitizeDeviceAlerts(res.data)
28
+ })), dispatch(require_monitorSlice_index.actions.setAlertListState({ total: Number(res.headers[_northern_tech_utils_constants.headerNames.total]) }))]));
29
+ });
30
+ const getLatestDeviceAlerts = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/getLatestDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
31
+ const { page = defaultPage, perPage = 10 } = config;
32
+ return require_api_general_api.default.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`).catch((err) => require_store.commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then((res) => Promise.resolve(dispatch(require_monitorSlice_index.actions.receiveLatestDeviceAlerts({
33
+ deviceId: id,
34
+ alerts: sanitizeDeviceAlerts(res.data)
35
+ }))));
36
+ });
37
+ const getIssueCountsByType = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/getIssueCountsByType`, async ({ type, options = {} }, { dispatch, getState }) => {
38
+ const state = getState();
39
+ const { filters = require_devicesSlice_selectors.getDeviceFilters(state), group, status, ...remainder } = options;
40
+ const { applicableFilters: nonMonitorFilters, filterTerms } = require_utils.convertDeviceListStateToFilters({
41
+ ...remainder,
42
+ filters,
43
+ group,
44
+ offlineThreshold: state.app.offlineThreshold,
45
+ selectedIssues: [type],
46
+ status
47
+ });
48
+ const res = await require_api_general_api.default.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/search`, {
49
+ page: 1,
50
+ per_page: 1,
51
+ filters: filterTerms,
52
+ attributes: [{
53
+ scope: "identity",
54
+ attribute: "status"
55
+ }]
56
+ }).catch((err) => require_store.commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, require_store.commonErrorFallback));
57
+ const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[_northern_tech_utils_constants.headerNames.total]);
58
+ const filtered = nonMonitorFilters.length ? Number(res.headers[_northern_tech_utils_constants.headerNames.total]) : total;
59
+ if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) return;
60
+ return dispatch(require_monitorSlice_index.actions.receiveDeviceIssueCounts({
61
+ counts: {
62
+ filtered,
63
+ total
64
+ },
65
+ issueType: type
66
+ }));
67
+ });
68
+ const getDeviceMonitorConfig = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/getDeviceMonitorConfig`, (id, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.monitorApiUrlv1}/devices/${id}/config`).catch((err) => require_store.commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch)).then(({ data }) => Promise.all([dispatch(require_actions.receivedDevice({
69
+ id,
70
+ monitors: data
71
+ }), Promise.resolve(data))])));
72
+ const changeNotificationSetting = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/changeNotificationSetting`, ({ enabled, channel = _northern_tech_utils_constants.alertChannels.email }, { dispatch }) => require_api_general_api.default.put(`${_northern_tech_utils_constants.monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled }).catch((err) => require_store.commonErrorHandler(err, `${enabled ? "En" : "Dis"}abling ${channel} alerts failed:`, dispatch)).then(() => Promise.all([dispatch(require_monitorSlice_index.actions.changeAlertChannel({
73
+ channel,
74
+ enabled
75
+ })), dispatch(require_actions.setSnackbar({
76
+ message: `Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`,
77
+ autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
78
+ }))])));
79
+ //#endregion
80
+ exports.changeNotificationSetting = changeNotificationSetting;
81
+ exports.getDeviceAlerts = getDeviceAlerts;
82
+ exports.getDeviceMonitorConfig = getDeviceMonitorConfig;
83
+ exports.getIssueCountsByType = getIssueCountsByType;
84
+ exports.getLatestDeviceAlerts = getLatestDeviceAlerts;
2438
85
 
2439
- // src/monitorSlice/thunks.ts
2440
- var { page: defaultPage, perPage: defaultPerPage } = import_constants3.DEVICE_LIST_DEFAULTS;
2441
- var cutoffLength = 75;
2442
- var ellipsis = "...";
2443
- var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
2444
- var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name || "") }));
2445
- var getDeviceAlerts = createAppAsyncThunk(`${sliceName}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
2446
- const { page = defaultPage, perPage = defaultPerPage, issuedBefore, issuedAfter, sortAscending = false } = config;
2447
- const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
2448
- const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : "";
2449
- return general_api_default.get(
2450
- `${import_constants3.monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`
2451
- ).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then(
2452
- (res) => Promise.all([
2453
- dispatch(actions.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),
2454
- dispatch(actions.setAlertListState({ total: Number(res.headers[import_constants3.headerNames.total]) }))
2455
- ])
2456
- );
2457
- });
2458
- var getLatestDeviceAlerts = createAppAsyncThunk(
2459
- `${sliceName}/getLatestDeviceAlerts`,
2460
- ({ id, config = {} }, { dispatch }) => {
2461
- const { page = defaultPage, perPage = 10 } = config;
2462
- return general_api_default.get(`${import_constants3.monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then((res) => Promise.resolve(dispatch(actions.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));
2463
- }
2464
- );
2465
- var getIssueCountsByType2 = createAppAsyncThunk(
2466
- `${sliceName}/getIssueCountsByType`,
2467
- ({ type, options = {} }, { dispatch, getState }) => {
2468
- const state = getState();
2469
- const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
2470
- const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
2471
- ...remainder,
2472
- filters,
2473
- group,
2474
- offlineThreshold: state.app.offlineThreshold,
2475
- selectedIssues: [type],
2476
- status
2477
- });
2478
- return general_api_default.post(getSearchEndpoint(getState()), {
2479
- page: 1,
2480
- per_page: 1,
2481
- filters: filterTerms,
2482
- attributes: [{ scope: "identity", attribute: "status" }]
2483
- }).catch((err) => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback)).then((res) => {
2484
- const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[import_constants3.headerNames.total]);
2485
- const filtered = nonMonitorFilters.length ? Number(res.headers[import_constants3.headerNames.total]) : total;
2486
- if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {
2487
- return Promise.resolve();
2488
- }
2489
- return Promise.resolve(dispatch(actions.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type })));
2490
- });
2491
- }
2492
- );
2493
- var getDeviceMonitorConfig = createAppAsyncThunk(
2494
- `${sliceName}/getDeviceMonitorConfig`,
2495
- (id, { dispatch }) => general_api_default.get(`${import_constants3.monitorApiUrlv1}/devices/${id}/config`).catch((err) => commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch)).then(({ data }) => Promise.all([dispatch(actions_default.receivedDevice({ id, monitors: data }), Promise.resolve(data))]))
2496
- );
2497
- var changeNotificationSetting = createAppAsyncThunk(
2498
- `${sliceName}/changeNotificationSetting`,
2499
- ({ enabled, channel = import_constants3.alertChannels.email }, { dispatch }) => general_api_default.put(`${import_constants3.monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled }).catch((err) => commonErrorHandler(err, `${enabled ? "En" : "Dis"}abling ${channel} alerts failed:`, dispatch)).then(
2500
- () => Promise.all([
2501
- dispatch(actions.changeAlertChannel({ channel, enabled })),
2502
- dispatch(
2503
- actions_default.setSnackbar({ message: `Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, autoHideDuration: TIMEOUTS.fiveSeconds })
2504
- )
2505
- ])
2506
- )
2507
- );
2508
- // Annotate the CommonJS export names for ESM import in node:
2509
- 0 && (module.exports = {
2510
- changeNotificationSetting,
2511
- getDeviceAlerts,
2512
- getDeviceMonitorConfig,
2513
- getIssueCountsByType,
2514
- getLatestDeviceAlerts
2515
- });
2516
86
  //# sourceMappingURL=thunks.cjs.map