@northern.tech/store 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/dist/actions.cjs +1812 -0
  2. package/dist/actions.cjs.map +1 -0
  3. package/dist/actions.js +18 -1860
  4. package/dist/actions.js.map +1 -1
  5. package/dist/api/general-api.cjs +336 -0
  6. package/dist/api/general-api.cjs.map +1 -0
  7. package/dist/api/general-api.js +15 -1051
  8. package/dist/api/general-api.js.map +1 -1
  9. package/dist/api/users-api.cjs +342 -0
  10. package/dist/api/users-api.cjs.map +1 -0
  11. package/dist/api/users-api.js +12 -1062
  12. package/dist/api/users-api.js.map +1 -1
  13. package/dist/appSlice/constants.cjs +207 -0
  14. package/dist/appSlice/constants.cjs.map +1 -0
  15. package/dist/appSlice/{constants.d.mts → constants.d.cts} +12 -1
  16. package/dist/appSlice/constants.d.ts +12 -1
  17. package/dist/appSlice/constants.js +39 -181
  18. package/dist/appSlice/constants.js.map +1 -1
  19. package/dist/appSlice/index.cjs +393 -0
  20. package/dist/appSlice/index.cjs.map +1 -0
  21. package/dist/appSlice/index.js +18 -1112
  22. package/dist/appSlice/index.js.map +1 -1
  23. package/dist/appSlice/selectors.cjs +58 -0
  24. package/dist/appSlice/selectors.cjs.map +1 -0
  25. package/dist/appSlice/selectors.js +17 -46
  26. package/dist/appSlice/selectors.js.map +1 -1
  27. package/dist/appSlice/thunks.cjs +4670 -0
  28. package/dist/appSlice/thunks.cjs.map +1 -0
  29. package/dist/appSlice/thunks.js +42 -5750
  30. package/dist/appSlice/thunks.js.map +1 -1
  31. package/dist/auth.cjs +320 -0
  32. package/dist/auth.cjs.map +1 -0
  33. package/dist/auth.js +20 -1031
  34. package/dist/auth.js.map +1 -1
  35. package/dist/{chunk-5VNQCCAQ.mjs → chunk-25AKG5HH.js} +5 -2
  36. package/dist/chunk-25AKG5HH.js.map +1 -0
  37. package/dist/{chunk-QQBUNZHA.mjs → chunk-4B3IMP4I.js} +17 -12
  38. package/dist/{chunk-QQBUNZHA.mjs.map → chunk-4B3IMP4I.js.map} +1 -1
  39. package/dist/{chunk-3ORTTLIB.mjs → chunk-7PVGDMNM.js} +2 -2
  40. package/dist/{chunk-IFWKT27G.mjs → chunk-A6CT6GTI.js} +3 -3
  41. package/dist/{chunk-ZK4W5T53.mjs → chunk-AMGWP7A4.js} +2 -2
  42. package/dist/{chunk-G4FGNSV3.mjs → chunk-CK6YE6AN.js} +1 -1
  43. package/dist/{chunk-4SDUITD4.mjs → chunk-CYV6632F.js} +2 -2
  44. package/dist/{chunk-KJAZNKV2.mjs → chunk-DGD6FVWF.js} +29 -29
  45. package/dist/{chunk-DIZJVB6M.mjs → chunk-DQ4ZLUIU.js} +75 -431
  46. package/dist/chunk-DQ4ZLUIU.js.map +1 -0
  47. package/dist/{chunk-JA27QXVB.mjs → chunk-E5LEU5PF.js} +3 -3
  48. package/dist/{chunk-B42NUKMZ.mjs → chunk-FGKMJS3B.js} +1 -1
  49. package/dist/{chunk-NJNSCJEY.mjs → chunk-GZ5VQMDM.js} +18 -21
  50. package/dist/chunk-GZ5VQMDM.js.map +1 -0
  51. package/dist/{chunk-O6TYYKSD.mjs → chunk-H6DUEJFF.js} +20 -70
  52. package/dist/chunk-H6DUEJFF.js.map +1 -0
  53. package/dist/{chunk-WYHJFSMQ.mjs → chunk-JAROCU6M.js} +3 -3
  54. package/dist/{chunk-QBKCUIWO.mjs → chunk-JIS4PA3R.js} +1 -1
  55. package/dist/{chunk-XD7INCM4.mjs → chunk-KAQJH2YL.js} +4 -4
  56. package/dist/{chunk-2Z3RFYW4.mjs → chunk-LIJIIRON.js} +1 -1
  57. package/dist/{chunk-IU4OXOPA.mjs → chunk-MRCFLG45.js} +1 -1
  58. package/dist/chunk-NMAXZ3ZY.js +1 -0
  59. package/dist/{chunk-K2NZL5V4.mjs → chunk-Q6M5TTDQ.js} +2 -2
  60. package/dist/{chunk-CHUCIHMY.mjs → chunk-RX55KAKX.js} +2 -2
  61. package/dist/{chunk-ZE7R2XXE.mjs → chunk-UEP36GCI.js} +3 -3
  62. package/dist/{chunk-WCUGLHYM.mjs → chunk-UVQX743T.js} +13 -13
  63. package/dist/{chunk-H5UCKQWK.mjs → chunk-V4DKKRWS.js} +14 -14
  64. package/dist/{chunk-XC5UXEIB.mjs → chunk-VOCOFE4I.js} +2 -2
  65. package/dist/{chunk-R7LXL3KJ.mjs → chunk-XTRPX7JZ.js} +3 -3
  66. package/dist/{chunk-6CSGHZ3E.mjs → chunk-XXHONFSQ.js} +3 -3
  67. package/dist/{chunk-KPPU6OWF.mjs → chunk-YETZPQFR.js} +4 -19
  68. package/dist/chunk-YETZPQFR.js.map +1 -0
  69. package/dist/{chunk-KZSTW27Q.mjs → chunk-YGBFDXXA.js} +2 -2
  70. package/dist/{chunk-H2PQQMRY.mjs → chunk-YO22XLHI.js} +1 -1
  71. package/dist/{chunk-65YIOCCD.mjs → chunk-YT73QWCN.js} +3 -3
  72. package/dist/{chunk-AZRVRNXT.mjs → chunk-YTQUNAZP.js} +3 -3
  73. package/dist/commonConstants.cjs +285 -0
  74. package/dist/commonConstants.cjs.map +1 -0
  75. package/dist/{commonConstants.d.mts → commonConstants.d.cts} +3 -3
  76. package/dist/commonConstants.d.ts +3 -3
  77. package/dist/commonConstants.js +37 -268
  78. package/dist/commonConstants.js.map +1 -1
  79. package/dist/commonSelectors.cjs +1487 -0
  80. package/dist/commonSelectors.cjs.map +1 -0
  81. package/dist/commonSelectors.js +53 -1500
  82. package/dist/commonSelectors.js.map +1 -1
  83. package/dist/constants.cjs +1297 -0
  84. package/dist/constants.cjs.map +1 -0
  85. package/dist/{constants.d.mts → constants.d.cts} +10 -10
  86. package/dist/constants.d.ts +1 -1
  87. package/dist/constants.js +220 -1189
  88. package/dist/constants.js.map +1 -1
  89. package/dist/deploymentdevicehook.cjs +4686 -0
  90. package/dist/deploymentdevicehook.cjs.map +1 -0
  91. package/dist/deploymentdevicehook.d.cts +3 -0
  92. package/dist/deploymentdevicehook.d.ts +3 -0
  93. package/dist/deploymentdevicehook.js +60 -0
  94. package/dist/deploymentdevicehook.js.map +1 -0
  95. package/dist/deploymentsSlice/constants.cjs +562 -0
  96. package/dist/deploymentsSlice/constants.cjs.map +1 -0
  97. package/dist/deploymentsSlice/constants.js +39 -1006
  98. package/dist/deploymentsSlice/constants.js.map +1 -1
  99. package/dist/deploymentsSlice/index.cjs +648 -0
  100. package/dist/deploymentsSlice/index.cjs.map +1 -0
  101. package/dist/deploymentsSlice/index.js +18 -1104
  102. package/dist/deploymentsSlice/index.js.map +1 -1
  103. package/dist/deploymentsSlice/selectors.cjs +561 -0
  104. package/dist/deploymentsSlice/selectors.cjs.map +1 -0
  105. package/dist/deploymentsSlice/selectors.js +22 -1014
  106. package/dist/deploymentsSlice/selectors.js.map +1 -1
  107. package/dist/deploymentsSlice/thunks.cjs +4686 -0
  108. package/dist/deploymentsSlice/thunks.cjs.map +1 -0
  109. package/dist/deploymentsSlice/thunks.js +60 -5757
  110. package/dist/deploymentsSlice/thunks.js.map +1 -1
  111. package/dist/devicesSlice/constants.cjs +435 -0
  112. package/dist/devicesSlice/constants.cjs.map +1 -0
  113. package/dist/devicesSlice/constants.js +37 -1007
  114. package/dist/devicesSlice/constants.js.map +1 -1
  115. package/dist/devicesSlice/index.cjs +586 -0
  116. package/dist/devicesSlice/index.cjs.map +1 -0
  117. package/dist/devicesSlice/index.js +18 -1161
  118. package/dist/devicesSlice/index.js.map +1 -1
  119. package/dist/devicesSlice/selectors.cjs +531 -0
  120. package/dist/devicesSlice/selectors.cjs.map +1 -0
  121. package/dist/devicesSlice/selectors.js +50 -1097
  122. package/dist/devicesSlice/selectors.js.map +1 -1
  123. package/dist/devicesSlice/thunks.cjs +4758 -0
  124. package/dist/devicesSlice/thunks.cjs.map +1 -0
  125. package/dist/devicesSlice/thunks.js +132 -5793
  126. package/dist/devicesSlice/thunks.js.map +1 -1
  127. package/dist/monitorSlice/constants.cjs +165 -0
  128. package/dist/monitorSlice/constants.cjs.map +1 -0
  129. package/dist/monitorSlice/constants.js +11 -970
  130. package/dist/monitorSlice/constants.js.map +1 -1
  131. package/dist/monitorSlice/index.cjs +435 -0
  132. package/dist/monitorSlice/index.cjs.map +1 -0
  133. package/dist/monitorSlice/index.js +18 -1022
  134. package/dist/monitorSlice/index.js.map +1 -1
  135. package/dist/monitorSlice/selectors.cjs +31 -0
  136. package/dist/monitorSlice/selectors.cjs.map +1 -0
  137. package/dist/monitorSlice/selectors.js +5 -25
  138. package/dist/monitorSlice/selectors.js.map +1 -1
  139. package/dist/monitorSlice/thunks.cjs +2623 -0
  140. package/dist/monitorSlice/thunks.cjs.map +1 -0
  141. package/dist/monitorSlice/thunks.js +41 -2624
  142. package/dist/monitorSlice/thunks.js.map +1 -1
  143. package/dist/onboardingSlice/constants.cjs +71 -0
  144. package/dist/onboardingSlice/constants.cjs.map +1 -0
  145. package/dist/onboardingSlice/constants.js +7 -64
  146. package/dist/onboardingSlice/constants.js.map +1 -1
  147. package/dist/onboardingSlice/index.cjs +80 -0
  148. package/dist/onboardingSlice/index.cjs.map +1 -0
  149. package/dist/onboardingSlice/index.js +13 -71
  150. package/dist/onboardingSlice/index.js.map +1 -1
  151. package/dist/onboardingSlice/selectors.cjs +31 -0
  152. package/dist/onboardingSlice/selectors.cjs.map +1 -0
  153. package/dist/onboardingSlice/selectors.js +5 -25
  154. package/dist/onboardingSlice/selectors.js.map +1 -1
  155. package/dist/onboardingSlice/thunks.cjs +4774 -0
  156. package/dist/onboardingSlice/thunks.cjs.map +1 -0
  157. package/dist/onboardingSlice/thunks.js +48 -5753
  158. package/dist/onboardingSlice/thunks.js.map +1 -1
  159. package/dist/organizationSlice/constants.cjs +830 -0
  160. package/dist/organizationSlice/constants.cjs.map +1 -0
  161. package/dist/organizationSlice/constants.js +33 -1014
  162. package/dist/organizationSlice/constants.js.map +1 -1
  163. package/dist/organizationSlice/index.cjs +505 -0
  164. package/dist/organizationSlice/index.cjs.map +1 -0
  165. package/dist/organizationSlice/index.js +18 -1067
  166. package/dist/organizationSlice/index.js.map +1 -1
  167. package/dist/organizationSlice/selectors.cjs +300 -0
  168. package/dist/organizationSlice/selectors.cjs.map +1 -0
  169. package/dist/organizationSlice/selectors.js +36 -1013
  170. package/dist/organizationSlice/selectors.js.map +1 -1
  171. package/dist/organizationSlice/thunks.cjs +5006 -0
  172. package/dist/organizationSlice/thunks.cjs.map +1 -0
  173. package/dist/organizationSlice/thunks.js +98 -5776
  174. package/dist/organizationSlice/thunks.js.map +1 -1
  175. package/dist/releasesSlice/constants.cjs +40 -0
  176. package/dist/releasesSlice/constants.cjs.map +1 -0
  177. package/dist/releasesSlice/constants.js +11 -31
  178. package/dist/releasesSlice/constants.js.map +1 -1
  179. package/dist/releasesSlice/index.cjs +355 -0
  180. package/dist/releasesSlice/index.cjs.map +1 -0
  181. package/dist/releasesSlice/index.js +18 -1070
  182. package/dist/releasesSlice/index.js.map +1 -1
  183. package/dist/releasesSlice/selectors.cjs +290 -0
  184. package/dist/releasesSlice/selectors.cjs.map +1 -0
  185. package/dist/releasesSlice/selectors.js +25 -1009
  186. package/dist/releasesSlice/selectors.js.map +1 -1
  187. package/dist/releasesSlice/thunks.cjs +2896 -0
  188. package/dist/releasesSlice/thunks.cjs.map +1 -0
  189. package/dist/releasesSlice/thunks.js +63 -2931
  190. package/dist/releasesSlice/thunks.js.map +1 -1
  191. package/dist/selectors.cjs +1641 -0
  192. package/dist/selectors.cjs.map +1 -0
  193. package/dist/{selectors.d.mts → selectors.d.cts} +9 -9
  194. package/dist/selectors.js +206 -1582
  195. package/dist/selectors.js.map +1 -1
  196. package/dist/store.cjs +1932 -0
  197. package/dist/store.cjs.map +1 -0
  198. package/dist/store.js +28 -1980
  199. package/dist/store.js.map +1 -1
  200. package/dist/storehooks.cjs +5565 -0
  201. package/dist/storehooks.cjs.map +1 -0
  202. package/dist/storehooks.js +122 -5802
  203. package/dist/storehooks.js.map +1 -1
  204. package/dist/thunks.cjs +5675 -0
  205. package/dist/thunks.cjs.map +1 -0
  206. package/dist/{thunks.d.mts → thunks.d.cts} +8 -8
  207. package/dist/thunks.js +360 -5910
  208. package/dist/thunks.js.map +1 -1
  209. package/dist/usersSlice/constants.cjs +798 -0
  210. package/dist/usersSlice/constants.cjs.map +1 -0
  211. package/dist/usersSlice/constants.js +42 -1001
  212. package/dist/usersSlice/constants.js.map +1 -1
  213. package/dist/usersSlice/index.cjs +890 -0
  214. package/dist/usersSlice/index.cjs.map +1 -0
  215. package/dist/usersSlice/index.js +18 -1107
  216. package/dist/usersSlice/index.js.map +1 -1
  217. package/dist/usersSlice/selectors.cjs +826 -0
  218. package/dist/usersSlice/selectors.cjs.map +1 -0
  219. package/dist/usersSlice/selectors.js +35 -1034
  220. package/dist/usersSlice/selectors.js.map +1 -1
  221. package/dist/usersSlice/thunks.cjs +4732 -0
  222. package/dist/usersSlice/thunks.cjs.map +1 -0
  223. package/dist/usersSlice/thunks.js +106 -5780
  224. package/dist/usersSlice/thunks.js.map +1 -1
  225. package/dist/utils.cjs +739 -0
  226. package/dist/utils.cjs.map +1 -0
  227. package/dist/{utils.d.mts → utils.d.cts} +1 -3
  228. package/dist/utils.d.ts +1 -3
  229. package/dist/utils.js +42 -1186
  230. package/dist/utils.js.map +1 -1
  231. package/package.json +71 -47
  232. package/dist/actions.mjs +0 -21
  233. package/dist/api/general-api.mjs +0 -18
  234. package/dist/api/general-api.mjs.map +0 -1
  235. package/dist/api/users-api.mjs +0 -15
  236. package/dist/api/users-api.mjs.map +0 -1
  237. package/dist/appSlice/constants.mjs +0 -42
  238. package/dist/appSlice/constants.mjs.map +0 -1
  239. package/dist/appSlice/index.mjs +0 -21
  240. package/dist/appSlice/index.mjs.map +0 -1
  241. package/dist/appSlice/selectors.mjs +0 -20
  242. package/dist/appSlice/selectors.mjs.map +0 -1
  243. package/dist/appSlice/thunks.mjs +0 -45
  244. package/dist/appSlice/thunks.mjs.map +0 -1
  245. package/dist/auth.mjs +0 -23
  246. package/dist/auth.mjs.map +0 -1
  247. package/dist/chunk-5VNQCCAQ.mjs.map +0 -1
  248. package/dist/chunk-DIZJVB6M.mjs.map +0 -1
  249. package/dist/chunk-KPPU6OWF.mjs.map +0 -1
  250. package/dist/chunk-LZOMFHX3.mjs +0 -38
  251. package/dist/chunk-LZOMFHX3.mjs.map +0 -1
  252. package/dist/chunk-NJNSCJEY.mjs.map +0 -1
  253. package/dist/chunk-O6TYYKSD.mjs.map +0 -1
  254. package/dist/chunk-V32GTKOS.mjs +0 -1
  255. package/dist/chunk-V32GTKOS.mjs.map +0 -1
  256. package/dist/commonConstants.mjs +0 -40
  257. package/dist/commonConstants.mjs.map +0 -1
  258. package/dist/commonSelectors.mjs +0 -56
  259. package/dist/commonSelectors.mjs.map +0 -1
  260. package/dist/constants.mjs +0 -223
  261. package/dist/constants.mjs.map +0 -1
  262. package/dist/deploymentsSlice/constants.mjs +0 -42
  263. package/dist/deploymentsSlice/constants.mjs.map +0 -1
  264. package/dist/deploymentsSlice/index.mjs +0 -21
  265. package/dist/deploymentsSlice/index.mjs.map +0 -1
  266. package/dist/deploymentsSlice/selectors.mjs +0 -25
  267. package/dist/deploymentsSlice/selectors.mjs.map +0 -1
  268. package/dist/deploymentsSlice/thunks.mjs +0 -63
  269. package/dist/deploymentsSlice/thunks.mjs.map +0 -1
  270. package/dist/devicesSlice/constants.mjs +0 -40
  271. package/dist/devicesSlice/constants.mjs.map +0 -1
  272. package/dist/devicesSlice/index.mjs +0 -21
  273. package/dist/devicesSlice/index.mjs.map +0 -1
  274. package/dist/devicesSlice/selectors.mjs +0 -53
  275. package/dist/devicesSlice/selectors.mjs.map +0 -1
  276. package/dist/devicesSlice/thunks.mjs +0 -135
  277. package/dist/devicesSlice/thunks.mjs.map +0 -1
  278. package/dist/monitorSlice/constants.mjs +0 -14
  279. package/dist/monitorSlice/constants.mjs.map +0 -1
  280. package/dist/monitorSlice/index.mjs +0 -21
  281. package/dist/monitorSlice/index.mjs.map +0 -1
  282. package/dist/monitorSlice/selectors.mjs +0 -8
  283. package/dist/monitorSlice/selectors.mjs.map +0 -1
  284. package/dist/monitorSlice/thunks.mjs +0 -44
  285. package/dist/monitorSlice/thunks.mjs.map +0 -1
  286. package/dist/onboardingSlice/constants.mjs +0 -10
  287. package/dist/onboardingSlice/constants.mjs.map +0 -1
  288. package/dist/onboardingSlice/index.mjs +0 -16
  289. package/dist/onboardingSlice/index.mjs.map +0 -1
  290. package/dist/onboardingSlice/selectors.mjs +0 -8
  291. package/dist/onboardingSlice/selectors.mjs.map +0 -1
  292. package/dist/onboardingSlice/thunks.mjs +0 -51
  293. package/dist/onboardingSlice/thunks.mjs.map +0 -1
  294. package/dist/organizationSlice/constants.mjs +0 -36
  295. package/dist/organizationSlice/constants.mjs.map +0 -1
  296. package/dist/organizationSlice/index.mjs +0 -21
  297. package/dist/organizationSlice/index.mjs.map +0 -1
  298. package/dist/organizationSlice/selectors.mjs +0 -39
  299. package/dist/organizationSlice/selectors.mjs.map +0 -1
  300. package/dist/organizationSlice/thunks.mjs +0 -101
  301. package/dist/organizationSlice/thunks.mjs.map +0 -1
  302. package/dist/releasesSlice/constants.mjs +0 -14
  303. package/dist/releasesSlice/constants.mjs.map +0 -1
  304. package/dist/releasesSlice/index.mjs +0 -21
  305. package/dist/releasesSlice/index.mjs.map +0 -1
  306. package/dist/releasesSlice/selectors.mjs +0 -28
  307. package/dist/releasesSlice/selectors.mjs.map +0 -1
  308. package/dist/releasesSlice/thunks.mjs +0 -66
  309. package/dist/releasesSlice/thunks.mjs.map +0 -1
  310. package/dist/selectors.mjs +0 -209
  311. package/dist/selectors.mjs.map +0 -1
  312. package/dist/store.mjs +0 -32
  313. package/dist/store.mjs.map +0 -1
  314. package/dist/storehooks.mjs +0 -282
  315. package/dist/storehooks.mjs.map +0 -1
  316. package/dist/thunks.mjs +0 -363
  317. package/dist/thunks.mjs.map +0 -1
  318. package/dist/usersSlice/constants.mjs +0 -45
  319. package/dist/usersSlice/constants.mjs.map +0 -1
  320. package/dist/usersSlice/index.mjs +0 -21
  321. package/dist/usersSlice/index.mjs.map +0 -1
  322. package/dist/usersSlice/selectors.mjs +0 -38
  323. package/dist/usersSlice/selectors.mjs.map +0 -1
  324. package/dist/usersSlice/thunks.mjs +0 -109
  325. package/dist/usersSlice/thunks.mjs.map +0 -1
  326. package/dist/utils.mjs +0 -49
  327. package/dist/utils.mjs.map +0 -1
  328. /package/dist/{actions.d.mts → actions.d.cts} +0 -0
  329. /package/dist/api/{general-api.d.mts → general-api.d.cts} +0 -0
  330. /package/dist/api/{users-api.d.mts → users-api.d.cts} +0 -0
  331. /package/dist/appSlice/{index.d.mts → index.d.cts} +0 -0
  332. /package/dist/appSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  333. /package/dist/appSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  334. /package/dist/{auth.d.mts → auth.d.cts} +0 -0
  335. /package/dist/{chunk-3ORTTLIB.mjs.map → chunk-7PVGDMNM.js.map} +0 -0
  336. /package/dist/{chunk-IFWKT27G.mjs.map → chunk-A6CT6GTI.js.map} +0 -0
  337. /package/dist/{chunk-ZK4W5T53.mjs.map → chunk-AMGWP7A4.js.map} +0 -0
  338. /package/dist/{chunk-G4FGNSV3.mjs.map → chunk-CK6YE6AN.js.map} +0 -0
  339. /package/dist/{chunk-4SDUITD4.mjs.map → chunk-CYV6632F.js.map} +0 -0
  340. /package/dist/{chunk-KJAZNKV2.mjs.map → chunk-DGD6FVWF.js.map} +0 -0
  341. /package/dist/{chunk-JA27QXVB.mjs.map → chunk-E5LEU5PF.js.map} +0 -0
  342. /package/dist/{chunk-B42NUKMZ.mjs.map → chunk-FGKMJS3B.js.map} +0 -0
  343. /package/dist/{chunk-WYHJFSMQ.mjs.map → chunk-JAROCU6M.js.map} +0 -0
  344. /package/dist/{chunk-QBKCUIWO.mjs.map → chunk-JIS4PA3R.js.map} +0 -0
  345. /package/dist/{chunk-XD7INCM4.mjs.map → chunk-KAQJH2YL.js.map} +0 -0
  346. /package/dist/{chunk-2Z3RFYW4.mjs.map → chunk-LIJIIRON.js.map} +0 -0
  347. /package/dist/{chunk-IU4OXOPA.mjs.map → chunk-MRCFLG45.js.map} +0 -0
  348. /package/dist/{actions.mjs.map → chunk-NMAXZ3ZY.js.map} +0 -0
  349. /package/dist/{chunk-K2NZL5V4.mjs.map → chunk-Q6M5TTDQ.js.map} +0 -0
  350. /package/dist/{chunk-CHUCIHMY.mjs.map → chunk-RX55KAKX.js.map} +0 -0
  351. /package/dist/{chunk-ZE7R2XXE.mjs.map → chunk-UEP36GCI.js.map} +0 -0
  352. /package/dist/{chunk-WCUGLHYM.mjs.map → chunk-UVQX743T.js.map} +0 -0
  353. /package/dist/{chunk-H5UCKQWK.mjs.map → chunk-V4DKKRWS.js.map} +0 -0
  354. /package/dist/{chunk-XC5UXEIB.mjs.map → chunk-VOCOFE4I.js.map} +0 -0
  355. /package/dist/{chunk-R7LXL3KJ.mjs.map → chunk-XTRPX7JZ.js.map} +0 -0
  356. /package/dist/{chunk-6CSGHZ3E.mjs.map → chunk-XXHONFSQ.js.map} +0 -0
  357. /package/dist/{chunk-KZSTW27Q.mjs.map → chunk-YGBFDXXA.js.map} +0 -0
  358. /package/dist/{chunk-H2PQQMRY.mjs.map → chunk-YO22XLHI.js.map} +0 -0
  359. /package/dist/{chunk-65YIOCCD.mjs.map → chunk-YT73QWCN.js.map} +0 -0
  360. /package/dist/{chunk-AZRVRNXT.mjs.map → chunk-YTQUNAZP.js.map} +0 -0
  361. /package/dist/{commonSelectors.d.mts → commonSelectors.d.cts} +0 -0
  362. /package/dist/deploymentsSlice/{constants.d.mts → constants.d.cts} +0 -0
  363. /package/dist/deploymentsSlice/{index.d.mts → index.d.cts} +0 -0
  364. /package/dist/deploymentsSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  365. /package/dist/deploymentsSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  366. /package/dist/devicesSlice/{constants.d.mts → constants.d.cts} +0 -0
  367. /package/dist/devicesSlice/{index.d.mts → index.d.cts} +0 -0
  368. /package/dist/devicesSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  369. /package/dist/devicesSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  370. /package/dist/monitorSlice/{constants.d.mts → constants.d.cts} +0 -0
  371. /package/dist/monitorSlice/{index.d.mts → index.d.cts} +0 -0
  372. /package/dist/monitorSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  373. /package/dist/monitorSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  374. /package/dist/onboardingSlice/{constants.d.mts → constants.d.cts} +0 -0
  375. /package/dist/onboardingSlice/{index.d.mts → index.d.cts} +0 -0
  376. /package/dist/onboardingSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  377. /package/dist/onboardingSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  378. /package/dist/organizationSlice/{constants.d.mts → constants.d.cts} +0 -0
  379. /package/dist/organizationSlice/{index.d.mts → index.d.cts} +0 -0
  380. /package/dist/organizationSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  381. /package/dist/organizationSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  382. /package/dist/releasesSlice/{constants.d.mts → constants.d.cts} +0 -0
  383. /package/dist/releasesSlice/{index.d.mts → index.d.cts} +0 -0
  384. /package/dist/releasesSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  385. /package/dist/releasesSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  386. /package/dist/{store.d.mts → store.d.cts} +0 -0
  387. /package/dist/{storehooks.d.mts → storehooks.d.cts} +0 -0
  388. /package/dist/usersSlice/{constants.d.mts → constants.d.cts} +0 -0
  389. /package/dist/usersSlice/{index.d.mts → index.d.cts} +0 -0
  390. /package/dist/usersSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  391. /package/dist/usersSlice/{thunks.d.mts → thunks.d.cts} +0 -0
@@ -1,2626 +1,43 @@
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 });
1
+ import {
2
+ changeNotificationSetting,
3
+ getDeviceAlerts,
4
+ getDeviceMonitorConfig,
5
+ getIssueCountsByType,
6
+ getLatestDeviceAlerts
7
+ } from "../chunk-UVQX743T.js";
8
+ import "../chunk-YT73QWCN.js";
9
+ import "../chunk-NMAXZ3ZY.js";
10
+ import "../chunk-DGD6FVWF.js";
11
+ import "../chunk-KAQJH2YL.js";
12
+ import "../chunk-Q6M5TTDQ.js";
13
+ import "../chunk-VOCOFE4I.js";
14
+ import "../chunk-YO22XLHI.js";
15
+ import "../chunk-JIS4PA3R.js";
16
+ import "../chunk-RX55KAKX.js";
17
+ import "../chunk-XXHONFSQ.js";
18
+ import "../chunk-YETZPQFR.js";
19
+ import "../chunk-LIJIIRON.js";
20
+ import "../chunk-GZ5VQMDM.js";
21
+ import "../chunk-V4DKKRWS.js";
22
+ import "../chunk-YGBFDXXA.js";
23
+ import "../chunk-XTRPX7JZ.js";
24
+ import "../chunk-CYV6632F.js";
25
+ import "../chunk-UEP36GCI.js";
26
+ import "../chunk-FGKMJS3B.js";
27
+ import "../chunk-E5LEU5PF.js";
28
+ import "../chunk-YTQUNAZP.js";
29
+ import "../chunk-7PVGDMNM.js";
30
+ import "../chunk-AMGWP7A4.js";
31
+ import "../chunk-A6CT6GTI.js";
32
+ import "../chunk-CK6YE6AN.js";
33
+ import "../chunk-MRCFLG45.js";
34
+ import "../chunk-25AKG5HH.js";
35
+ import "../chunk-4B3IMP4I.js";
36
+ export {
37
+ changeNotificationSetting,
38
+ getDeviceAlerts,
39
+ getDeviceMonitorConfig,
40
+ getIssueCountsByType,
41
+ getLatestDeviceAlerts
11
42
  };
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/appSlice/constants.ts
42
- var import_icons_material = require("@mui/icons-material");
43
- var startingDeviceCount = {
44
- os: "for first 50 devices",
45
- professional: "for first 250 devices"
46
- };
47
- var apiRoot = "/api/management";
48
- var apiUrl = {
49
- v1: `${apiRoot}/v1`,
50
- v2: `${apiRoot}/v2`
51
- };
52
- var headerNames = {
53
- link: "link",
54
- location: "location",
55
- total: "x-total-count"
56
- };
57
- var chartTypes = {
58
- bar: { key: "bar", Icon: import_icons_material.BarChart },
59
- pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
60
- };
61
- var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
62
- var defaultReportType = "distribution";
63
- var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
64
- var PLANS = {
65
- os: {
66
- id: "os",
67
- name: "Basic",
68
- offer: true,
69
- price: "$32/month",
70
- deviceCount: startingDeviceCount.os,
71
- offerprice: "$23/month for first 50 devices",
72
- price2: "for first 6 months;\n$29/month thereafter",
73
- features: ["Basic OTA features"]
74
- },
75
- professional: {
76
- id: "professional",
77
- name: "Professional",
78
- offer: true,
79
- price: "$269/month",
80
- deviceCount: startingDeviceCount.professional,
81
- offerprice: "$200/month for first 50 devices",
82
- price2: "for first 6 months;\n$249/month thereafter",
83
- features: ["+ Advanced OTA features", "+ Standard support"]
84
- },
85
- enterprise: {
86
- id: "enterprise",
87
- name: "Enterprise",
88
- price: "Custom pricing",
89
- deviceCount: "unlimited devices",
90
- features: ["+ Enterprise-grade OTA features", "+ Premium support"]
91
- }
92
- };
93
- var ADDONS = {
94
- configure: {
95
- id: "configure",
96
- title: "Configure",
97
- description: "Expand your plan with device configuration features",
98
- needs: ["hasDeviceConfig"],
99
- os: {
100
- price: "$11/month",
101
- deviceCount: startingDeviceCount.os
102
- },
103
- professional: {
104
- price: "$65/month",
105
- deviceCount: startingDeviceCount.professional
106
- },
107
- eligible: ["os", "professional", "enterprise"]
108
- },
109
- troubleshoot: {
110
- id: "troubleshoot",
111
- title: "Troubleshoot",
112
- description: "Expand your plan with device troubleshooting features",
113
- needs: ["hasDeviceConnect"],
114
- os: {
115
- price: "$27/month",
116
- deviceCount: startingDeviceCount.os
117
- },
118
- professional: {
119
- price: "$72/month",
120
- deviceCount: startingDeviceCount.professional
121
- },
122
- eligible: ["os", "professional", "enterprise"]
123
- },
124
- monitor: {
125
- id: "monitor",
126
- title: "Monitor",
127
- description: "Expand your plan with device monitoring features",
128
- needs: ["hasMonitor"],
129
- os: {
130
- price: "-",
131
- deviceCount: "-"
132
- },
133
- professional: {
134
- price: "$86/month",
135
- deviceCount: startingDeviceCount.professional
136
- },
137
- eligible: ["professional", "enterprise"]
138
- }
139
- };
140
- var BENEFITS = {
141
- auditlog: { id: "auditlog", benefit: "trace change across your devices and access troubleshooting session replay", requiredPlan: PLANS.professional.id },
142
- dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
143
- deltaGeneration: {
144
- id: "deltaGeneration",
145
- benefit: "automatic delta artifacts generation to minimize data transfer and improve the update delivery",
146
- requiredPlan: PLANS.enterprise.id
147
- },
148
- deviceConfiguration: { id: "deviceConfiguration", benefit: "device configuration features", requiredAddon: ADDONS.configure.id },
149
- deviceMonitor: { id: "deviceMonitor", benefit: "device monitoring features", requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },
150
- deviceTroubleshoot: { id: "deviceTroubleshoot", benefit: "device troubleshooting features", requiredAddon: ADDONS.troubleshoot.id },
151
- dynamicGroups: { id: "dynamicGroups", benefit: "create dynamic groups to ease device management", requiredPlan: PLANS.enterprise.id },
152
- fullFiltering: { id: "fullFiltering", benefit: "filtering by multiple attributes to improve the device overview", requiredPlan: PLANS.professional.id },
153
- gateway: { id: "gateway", benefit: "see devices connected to your gateway device for easy access", requiredPlans: PLANS.professional.id },
154
- pausedDeployments: {
155
- id: "pausedDeployments",
156
- benefit: "granular control about update rollout to allow synchronization across your fleet",
157
- requiredPlan: PLANS.enterprise.id
158
- },
159
- phasedDeployments: { id: "phasedDeployments", benefit: "choose to roll out deployments in multiple phases", requiredPlan: PLANS.enterprise.id },
160
- rbac: { id: "rbac", benefit: "granular role based access control", requiredPlan: PLANS.enterprise.id },
161
- retryDeployments: { id: "retryDeployments", benefit: "optional retries for failed rollout attempts", requiredPlan: PLANS.professional.id },
162
- scheduledDeployments: {
163
- id: "scheduledDeployments",
164
- benefit: "scheduled deployments to steer the distribution of your updates.",
165
- requiredPlan: PLANS.professional.id
166
- },
167
- webhookEvents: {
168
- id: "webhookEvents",
169
- benefit: "receive inventory events and select which type(s) of events the webhook will receive",
170
- requiredPlan: PLANS.professional.id
171
- },
172
- default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
173
- };
174
- var DARK_MODE = "dark";
175
-
176
- // src/commonConstants.tsx
177
- var import_react = __toESM(require("react"));
178
- var import_js = require("@mdi/js");
179
- var DEVICE_LIST_DEFAULTS = {
180
- page: 1,
181
- perPage: 20
182
- };
183
- var timeUnits = {
184
- days: "days",
185
- minutes: "minutes",
186
- hours: "hours"
187
- };
188
- var ALL_DEVICES = "All devices";
189
- var UNGROUPED_GROUP = { id: "*|=ungrouped=|*", name: "Unassigned" };
190
- var DEVICE_LIST_MAXIMUM_LENGTH = 50;
191
- var DEVICE_FILTERING_OPTIONS = {
192
- $eq: { key: "$eq", title: "equals", shortform: "=" },
193
- $ne: { key: "$ne", title: "not equal", shortform: "!=" },
194
- $gt: {
195
- key: "$gt",
196
- title: ">",
197
- shortform: ">",
198
- help: 'The "greater than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
199
- },
200
- $gte: {
201
- title: ">=",
202
- shortform: ">=",
203
- help: 'The "greater than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
204
- },
205
- $lt: {
206
- key: "$lt",
207
- title: "<",
208
- shortform: "<",
209
- help: 'The "lesser than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
210
- },
211
- $lte: {
212
- title: "<=",
213
- shortform: "<=",
214
- help: 'The "lesser than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
215
- },
216
- $ltne: {
217
- key: "$ltne",
218
- title: "$ltne",
219
- shortform: "ltne",
220
- help: 'The "lesser than or does not exist" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
221
- },
222
- $in: {
223
- key: "$in",
224
- title: "in",
225
- shortform: "in",
226
- help: 'The "in" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'
227
- },
228
- $nin: {
229
- key: "$nin",
230
- title: "not in",
231
- shortform: "not in",
232
- help: `The "not in" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`
233
- },
234
- $exists: {
235
- key: "$exists",
236
- title: "exists",
237
- shortform: "exists",
238
- value: true,
239
- help: `The "exists" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`
240
- },
241
- $nexists: {
242
- key: "$nexists",
243
- title: `doesn't exist`,
244
- shortform: `doesn't exist`,
245
- value: true,
246
- help: `The "doesn't exist" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`
247
- },
248
- $regex: {
249
- key: "$regex",
250
- title: `matches regular expression`,
251
- shortform: `matches`,
252
- help: `The "regular expression" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`
253
- }
254
- };
255
- var DEVICE_ISSUE_OPTIONS = {
256
- issues: {
257
- isCategory: true,
258
- key: "issues",
259
- title: "Devices with issues",
260
- filterRule: {}
261
- },
262
- offline: {
263
- issueCategory: "issues",
264
- key: "offline",
265
- needsFullFiltering: true,
266
- needsMonitor: false,
267
- needsReporting: false,
268
- filterRule: {
269
- scope: "system",
270
- key: "check_in_time",
271
- operator: DEVICE_FILTERING_OPTIONS.$ltne.key,
272
- value: ({ offlineThreshold }) => offlineThreshold
273
- },
274
- title: "Offline devices"
275
- },
276
- failedLastUpdate: {
277
- issueCategory: "issues",
278
- key: "failedLastUpdate",
279
- needsFullFiltering: false,
280
- needsMonitor: false,
281
- needsReporting: true,
282
- filterRule: { scope: "monitor", key: "failed_last_update", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
283
- title: "Deployment failed"
284
- },
285
- monitoring: {
286
- issueCategory: "issues",
287
- key: "monitoring",
288
- needsFullFiltering: false,
289
- needsMonitor: true,
290
- needsReporting: false,
291
- filterRule: { scope: "monitor", key: "alerts", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
292
- title: "Monitoring alert"
293
- },
294
- authRequests: {
295
- key: "authRequests",
296
- needsFullFiltering: false,
297
- needsMonitor: false,
298
- needsReporting: true,
299
- filterRule: { scope: "monitor", key: "auth_requests", operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },
300
- title: "Devices with new authentication requests"
301
- },
302
- gatewayDevices: {
303
- key: "gatewayDevices",
304
- needsFullFiltering: false,
305
- needsMonitor: false,
306
- needsReporting: true,
307
- filterRule: { scope: "inventory", key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "true" },
308
- title: "Gateway devices"
309
- }
310
- };
311
- var oneSecond = 1e3;
312
- var TIMEOUTS = {
313
- debounceDefault: 700,
314
- debounceShort: 300,
315
- halfASecond: 0.5 * oneSecond,
316
- oneSecond,
317
- twoSeconds: 2 * oneSecond,
318
- threeSeconds: 3 * oneSecond,
319
- fiveSeconds: 5 * oneSecond,
320
- refreshDefault: 10 * oneSecond,
321
- refreshLong: 60 * oneSecond
322
- };
323
- var SORTING_OPTIONS = {
324
- asc: "asc",
325
- desc: "desc"
326
- };
327
- var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
328
- var ATTRIBUTE_SCOPES = {
329
- inventory: "inventory",
330
- identity: "identity",
331
- monitor: "monitor",
332
- system: "system",
333
- tags: "tags"
334
- };
335
- var defaultIdAttribute = Object.freeze({ attribute: "id", scope: ATTRIBUTE_SCOPES.identity });
336
- var credentialTypes = {
337
- aws: "aws",
338
- http: "http",
339
- sas: "sas",
340
- x509: "x509"
341
- };
342
- var EXTERNAL_PROVIDER = {
343
- "iot-core": {
344
- credentialsType: credentialTypes.aws,
345
- icon: import_js.mdiAws,
346
- title: "AWS IoT Core",
347
- twinTitle: "Device Shadow",
348
- provider: "iot-core",
349
- enabled: true,
350
- deviceTwin: true,
351
- configHint: /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, "For help finding your AWS IoT Core connection string, check the AWS IoT documentation.")
352
- },
353
- "iot-hub": {
354
- credentialsType: credentialTypes.sas,
355
- icon: import_js.mdiMicrosoftAzure,
356
- title: "Azure IoT Hub",
357
- twinTitle: "Device Twin",
358
- provider: "iot-hub",
359
- enabled: true,
360
- deviceTwin: true,
361
- configHint: /* @__PURE__ */ import_react.default.createElement("span", null, "For help finding your Azure IoT Hub connection string, look under 'Shared access policies' in the Microsoft Azure UI as described", " ", /* @__PURE__ */ import_react.default.createElement(
362
- "a",
363
- {
364
- href: "https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn",
365
- target: "_blank",
366
- rel: "noopener noreferrer"
367
- },
368
- "here"
369
- ), ".")
370
- },
371
- webhook: {
372
- credentialsType: credentialTypes.http,
373
- deviceTwin: false,
374
- // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
375
- enabled: false,
376
- provider: "webhook"
377
- }
378
- };
379
- var ALL_RELEASES = "All releases";
380
- var emptyUiPermissions = Object.freeze({
381
- auditlog: [],
382
- deployments: [],
383
- groups: Object.freeze({}),
384
- releases: Object.freeze({}),
385
- tenantManagement: [],
386
- userManagement: []
387
- });
388
- var emptyRole = Object.freeze({
389
- name: void 0,
390
- description: "",
391
- permissions: [],
392
- uiPermissions: Object.freeze({ ...emptyUiPermissions })
393
- });
394
-
395
- // src/deploymentsSlice/constants.ts
396
- var alreadyInstalled = "already-installed";
397
- var deploymentsApiUrl = `${apiUrl.v1}/deployments`;
398
- var deploymentsApiUrlV2 = `${apiUrl.v2}/deployments`;
399
- var deploymentSubstates = {
400
- aborted: "aborted",
401
- alreadyInstalled,
402
- decommissioned: "decommissioned",
403
- downloading: "downloading",
404
- failure: "failure",
405
- installing: "installing",
406
- noartifact: "noartifact",
407
- pause_before_committing: "pause_before_committing",
408
- pause_before_installing: "pause_before_installing",
409
- pause_before_rebooting: "pause_before_rebooting",
410
- pending: "pending",
411
- rebooting: "rebooting",
412
- success: "success"
413
- };
414
- var deploymentStatesToSubstates = {
415
- failures: [deploymentSubstates.failure, deploymentSubstates.aborted, deploymentSubstates.decommissioned],
416
- inprogress: [deploymentSubstates.downloading, deploymentSubstates.installing, deploymentSubstates.rebooting],
417
- paused: [deploymentSubstates.pause_before_installing, deploymentSubstates.pause_before_rebooting, deploymentSubstates.pause_before_committing],
418
- pending: [deploymentSubstates.pending],
419
- successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
420
- };
421
- var deploymentStatesToSubstatesWithSkipped = {
422
- ...deploymentStatesToSubstates,
423
- failures: [deploymentSubstates.failure],
424
- skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
425
- successes: [deploymentSubstates.success]
426
- };
427
- var installationSubstatesMap = {
428
- download: {
429
- title: "download",
430
- done: "downloaded",
431
- successIndicators: [deploymentSubstates.installing, deploymentSubstates.rebooting, ...deploymentStatesToSubstates.paused, deploymentSubstates.success],
432
- failureIndicators: deploymentStatesToSubstates.failures,
433
- pauseConfigurationIndicator: "ArtifactInstall_Enter"
434
- },
435
- install: {
436
- title: "install",
437
- done: "installed",
438
- successIndicators: [
439
- deploymentSubstates.rebooting,
440
- deploymentSubstates.pause_before_rebooting,
441
- deploymentSubstates.pause_before_committing,
442
- deploymentSubstates.success
443
- ],
444
- failureIndicators: deploymentStatesToSubstates.failures,
445
- pauseConfigurationIndicator: "ArtifactReboot_Enter"
446
- },
447
- reboot: {
448
- title: "reboot",
449
- done: "rebooted",
450
- successIndicators: [deploymentSubstates.pause_before_committing, deploymentSubstates.success],
451
- failureIndicators: deploymentStatesToSubstates.failures,
452
- pauseConfigurationIndicator: "ArtifactCommit_Enter"
453
- },
454
- commit: {
455
- title: "commit",
456
- done: "committed",
457
- successIndicators: deploymentStatesToSubstates.successes,
458
- failureIndicators: deploymentStatesToSubstates.failures,
459
- pauseConfigurationIndicator: void 0
460
- }
461
- };
462
- var DEPLOYMENT_STATES = {
463
- finished: "finished",
464
- inprogress: "inprogress",
465
- pending: "pending",
466
- scheduled: "scheduled"
467
- };
468
- var listDefaultsByState = {
469
- [DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
470
- [DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
471
- [DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
472
- [DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
473
- sort: { direction: SORTING_OPTIONS.desc }
474
- };
475
- var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
476
- var DEPLOYMENT_ROUTES = {
477
- active: {
478
- key: "active",
479
- route: "/deployments/active",
480
- states: [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress],
481
- title: "Active"
482
- },
483
- finished: {
484
- key: "finished",
485
- route: "/deployments/finished",
486
- states: [DEPLOYMENT_STATES.finished],
487
- title: "Finished"
488
- },
489
- scheduled: {
490
- key: "scheduled",
491
- route: "/deployments/scheduled",
492
- states: [DEPLOYMENT_STATES.scheduled],
493
- title: "Scheduled"
494
- }
495
- };
496
- var defaultStats = {
497
- [deploymentSubstates.aborted]: 0,
498
- [deploymentSubstates.alreadyInstalled]: 0,
499
- [deploymentSubstates.decommissioned]: 0,
500
- [deploymentSubstates.downloading]: 0,
501
- [deploymentSubstates.failure]: 0,
502
- [deploymentSubstates.installing]: 0,
503
- [deploymentSubstates.noartifact]: 0,
504
- [deploymentSubstates.pause_before_committing]: 0,
505
- [deploymentSubstates.pause_before_installing]: 0,
506
- [deploymentSubstates.pause_before_rebooting]: 0,
507
- [deploymentSubstates.pending]: 0,
508
- [deploymentSubstates.rebooting]: 0,
509
- [deploymentSubstates.success]: 0
510
- };
511
- var deploymentPrototype = {
512
- devices: {},
513
- name: void 0,
514
- statistics: { status: {} }
515
- };
516
- var pauseMap = {
517
- [deploymentSubstates.pause_before_installing]: {
518
- title: installationSubstatesMap.download.done,
519
- followUp: installationSubstatesMap.download.pauseConfigurationIndicator
520
- },
521
- [deploymentSubstates.pause_before_rebooting]: {
522
- title: installationSubstatesMap.install.done,
523
- followUp: installationSubstatesMap.install.pauseConfigurationIndicator
524
- },
525
- [deploymentSubstates.pause_before_committing]: {
526
- title: installationSubstatesMap.reboot.done,
527
- followUp: installationSubstatesMap.reboot.pauseConfigurationIndicator
528
- }
529
- };
530
- var limitDefault = { min: 5, max: 100, default: 10 };
531
-
532
- // src/devicesSlice/constants.ts
533
- var emptyFilter = { key: null, value: "", operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
534
- var deviceAuthV2 = `${apiUrl.v2}/devauth`;
535
- var deviceConnect = `${apiUrl.v1}/deviceconnect`;
536
- var inventoryApiUrl = `${apiUrl.v1}/inventory`;
537
- var inventoryApiUrlV2 = `${apiUrl.v2}/inventory`;
538
- var deviceConfig = `${apiUrl.v1}/deviceconfig/configurations/device`;
539
- var reportingApiUrl = `${apiUrl.v1}/reporting`;
540
- var iotManagerBaseURL = `${apiUrl.v1}/iot-manager`;
541
- var DEVICE_STATES = {
542
- accepted: "accepted",
543
- pending: "pending",
544
- preauth: "preauthorized",
545
- rejected: "rejected"
546
- };
547
- var geoAttributes = ["geo-lat", "geo-lon"].map((attribute) => ({ attribute, scope: "inventory" }));
548
-
549
- // src/monitorSlice/constants.ts
550
- var alertChannels = { email: "email" };
551
- var monitorApiUrlv1 = `${apiUrl.v1}/devicemonitor`;
552
-
553
- // src/onboardingSlice/constants.ts
554
- var onboardingSteps = {
555
- ONBOARDING_START: "onboarding-start",
556
- DEVICES_PENDING_ONBOARDING_START: "devices-pending-onboarding-start",
557
- DASHBOARD_ONBOARDING_START: "dashboard-onboarding-start",
558
- DASHBOARD_ONBOARDING_PENDINGS: "dashboard-onboarding-pendings",
559
- DEVICES_DELAYED_ONBOARDING: "devices-delayed-onboarding",
560
- DEVICES_PENDING_ONBOARDING: "devices-pending-onboarding",
561
- DEVICES_ACCEPTED_ONBOARDING: "devices-accepted-onboarding",
562
- DEVICES_PENDING_ACCEPTING_ONBOARDING: "devices-pending-accepting-onboarding",
563
- DEVICES_DEPLOY_RELEASE_ONBOARDING: "devices-deploy-release-onboarding",
564
- SCHEDULING_ARTIFACT_SELECTION: "scheduling-artifact-selection",
565
- SCHEDULING_ALL_DEVICES_SELECTION: "scheduling-all-devices-selection",
566
- SCHEDULING_GROUP_SELECTION: "scheduling-group-selection",
567
- SCHEDULING_RELEASE_TO_DEVICES: "scheduling-release-to-devices",
568
- DEPLOYMENTS_INPROGRESS: "deployments-inprogress",
569
- DEPLOYMENTS_PAST: "deployments-past",
570
- DEPLOYMENTS_PAST_COMPLETED: "deployments-past-completed",
571
- DEPLOYMENTS_PAST_COMPLETED_FAILURE: "deployments-past-completed-failure",
572
- ONBOARDING_CANCELED: "onboarding-canceled"
573
- };
574
- var orderedOnboardingSteps = [
575
- onboardingSteps.DASHBOARD_ONBOARDING_START,
576
- onboardingSteps.DEVICES_PENDING_ONBOARDING_START,
577
- onboardingSteps.DEVICES_DELAYED_ONBOARDING,
578
- onboardingSteps.DEVICES_PENDING_ONBOARDING,
579
- onboardingSteps.DEVICES_PENDING_ACCEPTING_ONBOARDING,
580
- onboardingSteps.DASHBOARD_ONBOARDING_PENDINGS,
581
- onboardingSteps.DEVICES_ACCEPTED_ONBOARDING,
582
- onboardingSteps.DEVICES_DEPLOY_RELEASE_ONBOARDING,
583
- onboardingSteps.SCHEDULING_ALL_DEVICES_SELECTION,
584
- onboardingSteps.SCHEDULING_GROUP_SELECTION,
585
- onboardingSteps.SCHEDULING_ARTIFACT_SELECTION,
586
- onboardingSteps.SCHEDULING_RELEASE_TO_DEVICES,
587
- onboardingSteps.DEPLOYMENTS_INPROGRESS,
588
- onboardingSteps.DEPLOYMENTS_PAST,
589
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED,
590
- onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE,
591
- onboardingSteps.ONBOARDING_CANCELED
592
- ];
593
-
594
- // src/organizationSlice/constants.ts
595
- var auditLogsApiUrl = `${apiUrl.v1}/auditlogs`;
596
- var tenantadmApiUrlv1 = `${apiUrl.v1}/tenantadm`;
597
- var tenantadmApiUrlv2 = `${apiUrl.v2}/tenantadm`;
598
- var ssoIdpApiUrlv1 = `${apiUrl.v1}/useradm/sso/idp/metadata`;
599
- var AUDIT_LOGS_TYPES = [
600
- { title: "Artifact", queryParameter: "object_type", value: "artifact" },
601
- { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
602
- { title: "Device", queryParameter: "object_id", value: "device" },
603
- { title: "User", queryParameter: "object_id", value: "user" }
604
- ];
605
- var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
606
- var emptyWebhook = {
607
- description: "",
608
- enabled: true,
609
- credentials: {
610
- type: EXTERNAL_PROVIDER.webhook.credentialsType,
611
- [EXTERNAL_PROVIDER.webhook.credentialsType]: {
612
- secret: "",
613
- url: ""
614
- }
615
- }
616
- };
617
- var TENANT_LIST_DEFAULT = {
618
- page: 1,
619
- perPage: 20
620
- };
621
-
622
- // src/releasesSlice/constants.ts
623
- var rootfsImageVersion = "rootfs-image.version";
624
- var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
625
-
626
- // src/usersSlice/constants.ts
627
- var useradmApiUrlv1 = `${apiUrl.v1}/useradm`;
628
- var useradmApiUrlv2 = `${apiUrl.v2}/useradm`;
629
- var staticRolesByName = {
630
- admin: "RBAC_ROLE_PERMIT_ALL",
631
- readOnly: "RBAC_ROLE_OBSERVER",
632
- ci: "RBAC_ROLE_CI",
633
- deploymentsManager: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
634
- terminalAccess: "RBAC_ROLE_REMOTE_TERMINAL"
635
- };
636
- var PermissionTypes = {
637
- Any: "any",
638
- Get: "GET",
639
- Post: "POST",
640
- Put: "PUT",
641
- Delete: "DELETE",
642
- Patch: "PATCH",
643
- DeviceGroup: "DEVICE_GROUP",
644
- DeviceId: "DEVICE_ID"
645
- };
646
- var permissionSetIds = {
647
- Basic: "Basic",
648
- ConfigureDevices: "ConfigureDevices",
649
- ConnectToDevices: "ConnectToDevices",
650
- DeployToDevices: "DeployToDevices",
651
- ManageDevices: "ManageDevices",
652
- ManageReleases: "ManageReleases",
653
- ManageTenants: "ManageTenants",
654
- ManageUsers: "ManageUsers",
655
- ReadAuditLogs: "ReadAuditLogs",
656
- ReadDevices: "ReadDevices",
657
- ReadReleases: "ReadReleases",
658
- ReadTenants: "ReadTenants",
659
- ReadUsers: "ReadUsers",
660
- SuperUser: "SuperUser",
661
- UploadArtifacts: "UploadArtifacts"
662
- };
663
- var uiPermissionsById = {
664
- configure: {
665
- explanations: { groups: `'Configure' allows the user to use mender-configure features and apply configurations.` },
666
- permissionLevel: 2,
667
- permissionSets: { groups: permissionSetIds.ConfigureDevices },
668
- title: "Configure",
669
- value: "configure",
670
- verbs: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post]
671
- },
672
- connect: {
673
- explanations: { groups: `'Connect' allows the user to use mender-connect features and Troubleshoot add-ons.` },
674
- permissionLevel: 2,
675
- permissionSets: { groups: permissionSetIds.ConnectToDevices },
676
- title: "Connect",
677
- value: "connect",
678
- verbs: [PermissionTypes.Get, PermissionTypes.Put]
679
- },
680
- deploy: {
681
- explanations: { groups: `'Deploy' allows the user to deploy software or configuration updates to devices.` },
682
- permissionLevel: 2,
683
- permissionSets: { deployments: permissionSetIds.DeployToDevices, groups: permissionSetIds.DeployToDevices },
684
- title: "Deploy",
685
- value: "deploy",
686
- verbs: [PermissionTypes.Post]
687
- },
688
- manage: {
689
- explanations: {
690
- groups: `'Manage' allows the user to edit device name, notes, and manage authentication status. For 'All devices' it also allows the user to edit and create device groups.`,
691
- releases: `'Manage' allows the user to upload new artifacts, edit release descriptions and remove artifacts.`
692
- },
693
- permissionLevel: 2,
694
- permissionSets: {
695
- groups: permissionSetIds.ManageDevices,
696
- releases: permissionSetIds.ManageReleases,
697
- tenantManagement: permissionSetIds.ManageTenants,
698
- userManagement: permissionSetIds.ManageUsers
699
- },
700
- title: "Manage",
701
- value: "manage",
702
- verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
703
- },
704
- read: {
705
- explanations: { groups: `'Read' allows the user to view devices.` },
706
- permissionLevel: 1,
707
- permissionSets: {
708
- auditlog: permissionSetIds.ReadAuditLogs,
709
- groups: permissionSetIds.ReadDevices,
710
- releases: permissionSetIds.ReadReleases,
711
- tenantManagement: permissionSetIds.ReadTenants,
712
- userManagement: permissionSetIds.ReadUsers
713
- },
714
- title: "Read",
715
- value: "read",
716
- verbs: [PermissionTypes.Get, PermissionTypes.Post]
717
- },
718
- upload: {
719
- explanations: { groups: `'Upload' allows the user to upload new Artifacts.` },
720
- unscopedOnly: { releases: true },
721
- permissionLevel: 1,
722
- permissionSets: { releases: permissionSetIds.UploadArtifacts },
723
- title: "Upload",
724
- value: "upload",
725
- verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
726
- }
727
- };
728
- var scopedPermissionAreas = {
729
- groups: { key: "groups", excessiveAccessSelector: ALL_DEVICES, scopeType: "DeviceGroups" },
730
- releases: { key: "releases", excessiveAccessSelector: ALL_RELEASES, scopeType: "Releases" }
731
- };
732
- var uiPermissionsByArea = {
733
- auditlog: {
734
- endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
735
- explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
736
- key: "auditlog",
737
- uiPermissions: [uiPermissionsById.read],
738
- title: "System audit log"
739
- },
740
- deployments: {
741
- endpoints: [
742
- { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.deploy] },
743
- { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
744
- { path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
745
- ],
746
- explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
747
- key: "deployments",
748
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
749
- title: "Deployments"
750
- },
751
- groups: {
752
- endpoints: [
753
- {
754
- path: /\/(devauth|inventory|deviceconfig|devicemonitor|deviceconnect\/devices)/i,
755
- types: [PermissionTypes.Get],
756
- uiPermissions: [uiPermissionsById.read]
757
- },
758
- { path: /\/(devauth|inventory)/i, types: [PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] },
759
- { path: /\/(deviceconfig)/i, types: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.configure] },
760
- { path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
761
- ],
762
- explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
763
- key: "groups",
764
- scope: scopedPermissionAreas.groups.scopeType,
765
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
766
- title: "Group Management"
767
- },
768
- releases: {
769
- endpoints: [
770
- { path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
771
- {
772
- path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
773
- types: [PermissionTypes.Post, PermissionTypes.Put],
774
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.upload]
775
- },
776
- {
777
- path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
778
- types: [PermissionTypes.Delete],
779
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage]
780
- }
781
- ],
782
- explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
783
- key: "releases",
784
- scope: "ReleaseTags",
785
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
786
- title: "Release Management"
787
- },
788
- tenantManagement: {
789
- endpoints: [
790
- { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
791
- { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
792
- { path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
793
- ],
794
- explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
795
- key: "tenantManagement",
796
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
797
- title: "Tenant Management"
798
- },
799
- userManagement: {
800
- endpoints: [
801
- { path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
802
- { path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
803
- ],
804
- explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
805
- key: "userManagement",
806
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
807
- title: "User Management"
808
- }
809
- };
810
- var permissionMapper = (permission) => permission.value;
811
- var rolesById = Object.freeze({
812
- [staticRolesByName.admin]: {
813
- name: "Admin",
814
- value: staticRolesByName.admin,
815
- description: "Full access",
816
- permissions: [],
817
- // permissions refers to the values returned from the backend
818
- uiPermissions: {
819
- ...emptyUiPermissions,
820
- auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
821
- deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
822
- groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
823
- releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
824
- userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
825
- }
826
- },
827
- [staticRolesByName.readOnly]: {
828
- name: "Read Access",
829
- value: staticRolesByName.readOnly,
830
- description: "",
831
- permissions: [],
832
- uiPermissions: {
833
- ...emptyUiPermissions,
834
- deployments: [uiPermissionsById.read.value],
835
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
836
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
837
- userManagement: [uiPermissionsById.read.value]
838
- }
839
- },
840
- [staticRolesByName.ci]: {
841
- name: "Releases Manager",
842
- value: staticRolesByName.ci,
843
- description: "",
844
- permissions: [],
845
- uiPermissions: {
846
- ...emptyUiPermissions,
847
- releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
848
- }
849
- },
850
- [staticRolesByName.deploymentsManager]: {
851
- name: "Deployments Manager",
852
- value: staticRolesByName.deploymentsManager,
853
- description: "",
854
- permissions: [],
855
- uiPermissions: {
856
- ...emptyUiPermissions,
857
- deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
858
- groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
859
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
860
- }
861
- },
862
- [staticRolesByName.terminalAccess]: {
863
- name: "Troubleshooting",
864
- value: staticRolesByName.terminalAccess,
865
- description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
866
- permissions: [],
867
- uiPermissions: {
868
- ...emptyUiPermissions,
869
- groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
870
- }
871
- }
872
- });
873
- var serviceProviderRolesById = {
874
- admin: {
875
- name: "Admin",
876
- value: staticRolesByName.admin,
877
- description: "Full access",
878
- permissions: [],
879
- uiPermissions: {
880
- ...emptyUiPermissions,
881
- auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
882
- userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
883
- tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
884
- }
885
- },
886
- readOnly: {
887
- name: "Read access",
888
- value: staticRolesByName.admin,
889
- description: "This role can see all linked organizations but cannot make any changes",
890
- permissions: [],
891
- uiPermissions: {
892
- ...emptyUiPermissions,
893
- auditlog: [uiPermissionsById.read.value],
894
- userManagement: [uiPermissionsById.read.value],
895
- tenantManagement: [uiPermissionsById.read.value]
896
- }
897
- }
898
- };
899
- var defaultPermissionSets = {
900
- [permissionSetIds.Basic]: {
901
- name: permissionSetIds.Basic,
902
- result: {
903
- // this is needed to prevent the detailed permissions of the basic permission set from being interpreted as allowing read & management access to user endpoints
904
- userManagement: [uiPermissionsById.read.value]
905
- }
906
- },
907
- [permissionSetIds.SuperUser]: {
908
- name: permissionSetIds.SuperUser,
909
- result: {
910
- ...rolesById[staticRolesByName.admin].uiPermissions
911
- }
912
- },
913
- [permissionSetIds.ManageUsers]: {
914
- name: permissionSetIds.ManageUsers,
915
- result: {
916
- userManagement: [uiPermissionsById.manage.value]
917
- }
918
- },
919
- [permissionSetIds.ReadAuditLogs]: {
920
- name: permissionSetIds.ReadAuditLogs,
921
- result: {
922
- auditlog: [uiPermissionsById.read.value]
923
- }
924
- },
925
- [permissionSetIds.ReadReleases]: {
926
- name: permissionSetIds.ReadReleases,
927
- result: {
928
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
929
- }
930
- },
931
- [permissionSetIds.ReadTenants]: {
932
- name: permissionSetIds.ReadTenants,
933
- result: {
934
- tenantManagement: [uiPermissionsById.read.value]
935
- }
936
- },
937
- [permissionSetIds.ManageTenants]: {
938
- name: permissionSetIds.ManageTenants,
939
- result: {
940
- tenantManagement: [uiPermissionsById.manage.value]
941
- }
942
- },
943
- [permissionSetIds.ReadUsers]: {
944
- name: permissionSetIds.ReadUsers,
945
- result: {
946
- userManagement: [uiPermissionsById.read.value]
947
- }
948
- },
949
- [permissionSetIds.UploadArtifacts]: {
950
- name: permissionSetIds.UploadArtifacts,
951
- result: {
952
- releases: { [ALL_RELEASES]: [uiPermissionsById.upload.value] }
953
- }
954
- },
955
- [permissionSetIds.ManageReleases]: {
956
- name: permissionSetIds.ManageReleases,
957
- result: {
958
- releases: { [ALL_RELEASES]: [uiPermissionsById.manage.value] }
959
- }
960
- },
961
- [permissionSetIds.ConfigureDevices]: {
962
- name: permissionSetIds.ConfigureDevices,
963
- result: {
964
- deployments: [uiPermissionsById.read.value, uiPermissionsById.deploy.value],
965
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.configure.value] }
966
- }
967
- },
968
- [permissionSetIds.ConnectToDevices]: {
969
- name: permissionSetIds.ConnectToDevices,
970
- result: {
971
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.connect.value] }
972
- }
973
- },
974
- [permissionSetIds.DeployToDevices]: {
975
- name: permissionSetIds.DeployToDevices,
976
- result: {
977
- deployments: [uiPermissionsById.deploy.value, uiPermissionsById.manage.value, uiPermissionsById.read.value],
978
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.deploy.value] }
979
- }
980
- },
981
- [permissionSetIds.ManageDevices]: {
982
- name: permissionSetIds.ManageDevices,
983
- result: {
984
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.manage.value] }
985
- }
986
- },
987
- [permissionSetIds.ReadDevices]: {
988
- name: permissionSetIds.ReadDevices,
989
- result: {
990
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] }
991
- }
992
- }
993
- };
994
- var USER_LOGOUT = "USER_LOGOUT";
995
- var rolesByName = {
996
- ...staticRolesByName,
997
- deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
998
- groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
999
- userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
1000
- };
1001
- var twoFAStates = {
1002
- enabled: "enabled",
1003
- disabled: "disabled",
1004
- unverified: "unverified"
1005
- };
1006
- var settingsKeys = { initialized: "settings-initialized" };
1007
- var READ_STATES = {
1008
- read: "read",
1009
- seen: "seen",
1010
- unread: "unread"
1011
- };
1012
-
1013
- // src/appSlice/index.ts
1014
- var import_toolkit = require("@reduxjs/toolkit");
1015
- var sliceName = "app";
1016
- var getYesterday = () => {
1017
- const today = /* @__PURE__ */ new Date();
1018
- today.setDate(today.getDate() - 1);
1019
- return today.toISOString();
1020
- };
1021
- var initialState = {
1022
- cancelSource: void 0,
1023
- demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
1024
- hostAddress: null,
1025
- snackbar: {
1026
- open: false,
1027
- message: "",
1028
- maxWidth: 900,
1029
- autoHideDuration: void 0,
1030
- action: void 0,
1031
- children: void 0,
1032
- onClick: void 0,
1033
- onClose: void 0
1034
- },
1035
- // return boolean rather than organization details
1036
- features: {
1037
- hasAuditlogs: false,
1038
- hasDeltaProgress: false,
1039
- hasMultitenancy: false,
1040
- hasDeviceConfig: false,
1041
- hasDeviceConnect: false,
1042
- hasFeedbackEnabled: false,
1043
- hasMonitor: false,
1044
- hasReporting: false,
1045
- isDemoMode: false,
1046
- isHosted: false,
1047
- isEnterprise: false
1048
- },
1049
- feedbackProbability: 0.3,
1050
- firstLoginAfterSignup: false,
1051
- hostedAnnouncement: "",
1052
- docsVersion: "",
1053
- recaptchaSiteKey: "",
1054
- searchState: {
1055
- deviceIds: [],
1056
- searchTerm: "",
1057
- searchTotal: 0,
1058
- sort: {
1059
- direction: SORTING_OPTIONS.desc
1060
- // key: null,
1061
- // scope: null
1062
- }
1063
- },
1064
- stripeAPIKey: "",
1065
- trackerCode: "",
1066
- uploadsById: {
1067
- // id: { uploading: false, uploadProgress: 0, cancelSource: undefined }
1068
- },
1069
- newThreshold: getYesterday(),
1070
- offlineThreshold: getYesterday(),
1071
- versionInformation: {
1072
- Integration: "",
1073
- "Mender-Client": "",
1074
- "Mender-Artifact": "",
1075
- "Meta-Mender": "",
1076
- Deployments: "",
1077
- Deviceauth: "",
1078
- Inventory: "",
1079
- GUI: "latest"
1080
- },
1081
- yesterday: void 0
1082
- };
1083
- var appSlice = (0, import_toolkit.createSlice)({
1084
- name: sliceName,
1085
- initialState,
1086
- reducers: {
1087
- setFeatures: (state, action) => {
1088
- state.features = {
1089
- ...state.features,
1090
- ...action.payload
1091
- };
1092
- },
1093
- setSnackbar: (state, { payload }) => {
1094
- let { message, autoHideDuration, action, children, onClick, onClose } = payload;
1095
- if (typeof payload === "string" || payload instanceof String) {
1096
- message = payload;
1097
- }
1098
- state.snackbar = {
1099
- open: message ? true : false,
1100
- message,
1101
- maxWidth: 900,
1102
- autoHideDuration,
1103
- action,
1104
- children,
1105
- onClick,
1106
- onClose
1107
- };
1108
- },
1109
- setFirstLoginAfterSignup: (state, action) => {
1110
- state.firstLoginAfterSignup = action.payload;
1111
- },
1112
- setAnnouncement: (state, action) => {
1113
- state.hostedAnnouncement = action.payload;
1114
- },
1115
- setSearchState: (state, action) => {
1116
- state.searchState = {
1117
- ...state.searchState,
1118
- ...action.payload
1119
- };
1120
- },
1121
- setOfflineThreshold: (state, action) => {
1122
- state.offlineThreshold = action.payload;
1123
- },
1124
- initUpload: (state, action) => {
1125
- const { id, upload } = action.payload;
1126
- state.uploadsById[id] = upload;
1127
- },
1128
- uploadProgress: (state, action) => {
1129
- const { id, progress } = action.payload;
1130
- state.uploadsById[id] = {
1131
- ...state.uploadsById[id],
1132
- progress
1133
- };
1134
- },
1135
- cleanUpUpload: (state, action) => {
1136
- const { [action.payload]: current, ...remainder } = state.uploadsById;
1137
- state.uploadsById = remainder;
1138
- },
1139
- setVersionInformation: (state, action) => {
1140
- state.versionInformation = {
1141
- ...state.versionInformation,
1142
- ...action.payload
1143
- };
1144
- },
1145
- setEnvironmentData: (state, action) => {
1146
- return { ...state, ...action.payload };
1147
- }
1148
- }
1149
- });
1150
- var actions = appSlice.actions;
1151
- var appSlice_default = appSlice.reducer;
1152
-
1153
- // src/deploymentsSlice/index.ts
1154
- var import_toolkit2 = require("@reduxjs/toolkit");
1155
- var sliceName2 = "deployments";
1156
- var initialState2 = {
1157
- byId: {
1158
- // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
1159
- },
1160
- byStatus: {
1161
- finished: { deploymentIds: [], total: 0 },
1162
- inprogress: { deploymentIds: [], total: 0 },
1163
- pending: { deploymentIds: [], total: 0 },
1164
- scheduled: { deploymentIds: [], total: 0 }
1165
- },
1166
- config: {
1167
- binaryDelta: {
1168
- timeout: -1,
1169
- duplicatesWindow: -1,
1170
- compressionLevel: -1,
1171
- disableChecksum: false,
1172
- disableDecompression: false,
1173
- inputWindow: -1,
1174
- instructionBuffer: -1,
1175
- sourceWindow: -1
1176
- },
1177
- binaryDeltaLimits: {
1178
- timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
1179
- sourceWindow: limitDefault,
1180
- inputWindow: limitDefault,
1181
- duplicatesWindow: limitDefault,
1182
- instructionBuffer: limitDefault
1183
- }
1184
- },
1185
- deploymentDeviceLimit: 5e3,
1186
- selectedDeviceIds: [],
1187
- selectionState: {
1188
- finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
1189
- inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1190
- pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1191
- scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
1192
- general: {
1193
- state: DEPLOYMENT_ROUTES.active.key,
1194
- showCreationDialog: false,
1195
- showReportDialog: false,
1196
- reportType: null
1197
- // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
1198
- },
1199
- selectedId: void 0
1200
- }
1201
- };
1202
- var deploymentsSlice = (0, import_toolkit2.createSlice)({
1203
- name: sliceName2,
1204
- initialState: initialState2,
1205
- reducers: {
1206
- createdDeployment: (state, action) => {
1207
- state.byId[action.payload.id] = {
1208
- ...deploymentPrototype,
1209
- ...action.payload
1210
- };
1211
- state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
1212
- state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
1213
- state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection], state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1;
1214
- },
1215
- removedDeployment: (state, action) => {
1216
- const { [action.payload]: removedDeployment, ...remainder } = state.byId;
1217
- state.byId = remainder;
1218
- },
1219
- receivedDeployment: (state, action) => {
1220
- state.byId[action.payload.id] = {
1221
- ...state.byId[action.payload.id] || {},
1222
- ...action.payload
1223
- };
1224
- },
1225
- receivedDeploymentDeviceLog: (state, action) => {
1226
- const { id, deviceId, log } = action.payload;
1227
- const deployment = {
1228
- ...deploymentPrototype,
1229
- ...state.byId[id]
1230
- };
1231
- state.byId[id] = {
1232
- ...deployment,
1233
- devices: {
1234
- ...deployment.devices,
1235
- [deviceId]: {
1236
- ...deployment.devices[deviceId],
1237
- log
1238
- }
1239
- }
1240
- };
1241
- },
1242
- receivedDeploymentDevices: (state, action) => {
1243
- const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
1244
- state.byId[id] = {
1245
- ...state.byId[id],
1246
- devices,
1247
- totalDeviceCount
1248
- };
1249
- state.selectedDeviceIds = selectedDeviceIds;
1250
- },
1251
- receivedDeployments: (state, action) => {
1252
- state.byId = {
1253
- ...state.byId,
1254
- ...action.payload
1255
- };
1256
- },
1257
- receivedDeploymentsForStatus: (state, action) => {
1258
- const { status, deploymentIds, total } = action.payload;
1259
- state.byStatus[status].deploymentIds = deploymentIds;
1260
- state.byStatus[status].total = total;
1261
- },
1262
- selectDeploymentsForStatus: (state, action) => {
1263
- const { status, deploymentIds, total } = action.payload;
1264
- state.selectionState[status].selection = deploymentIds;
1265
- state.selectionState[status].total = total;
1266
- },
1267
- setDeploymentsState: (state, action) => {
1268
- state.selectionState = action.payload;
1269
- },
1270
- setDeploymentsConfig: (state, action) => {
1271
- state.config = action.payload;
1272
- }
1273
- }
1274
- });
1275
- var actions2 = deploymentsSlice.actions;
1276
- var deploymentsSlice_default = deploymentsSlice.reducer;
1277
-
1278
- // src/devicesSlice/index.ts
1279
- var import_helpers = require("@northern.tech/utils/helpers");
1280
- var import_toolkit3 = require("@reduxjs/toolkit");
1281
- var sliceName3 = "devices";
1282
- var initialState3 = {
1283
- byId: {
1284
- // [deviceId]: {
1285
- // ...,
1286
- // twinsByIntegration: { [external.provider.id]: twinData }
1287
- // }
1288
- },
1289
- byStatus: {
1290
- [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1291
- active: { deviceIds: [], total: 0 },
1292
- inactive: { deviceIds: [], total: 0 },
1293
- [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
1294
- [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
1295
- [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
1296
- },
1297
- deviceList: {
1298
- deviceIds: [],
1299
- ...DEVICE_LIST_DEFAULTS,
1300
- selectedAttributes: [],
1301
- selectedIssues: [],
1302
- selection: [],
1303
- sort: {
1304
- direction: SORTING_OPTIONS.desc
1305
- // key: null,
1306
- // scope: null
1307
- },
1308
- state: DEVICE_STATES.accepted,
1309
- total: 0
1310
- },
1311
- filters: [
1312
- // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
1313
- ],
1314
- filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },
1315
- filteringAttributesLimit: 10,
1316
- filteringAttributesConfig: {
1317
- attributes: {
1318
- // inventory: ['some_attribute']
1319
- },
1320
- count: 0,
1321
- limit: 100
1322
- },
1323
- reports: [
1324
- // { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
1325
- ],
1326
- total: 0,
1327
- limit: 0,
1328
- groups: {
1329
- byId: {
1330
- // groupName: { deviceIds: [], total: 0, filters: [] },
1331
- // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }
1332
- },
1333
- selectedGroup: void 0
1334
- }
1335
- };
1336
- var devicesSlice = (0, import_toolkit3.createSlice)({
1337
- name: sliceName3,
1338
- initialState: initialState3,
1339
- reducers: {
1340
- receivedGroups: (state, action) => {
1341
- state.groups.byId = action.payload;
1342
- },
1343
- addToGroup: (state, action) => {
1344
- const { group, deviceIds } = action.payload;
1345
- const maybeExistingGroup = {
1346
- filters: [],
1347
- deviceIds: [],
1348
- ...state.groups.byId[group]
1349
- };
1350
- state.groups.byId[group] = {
1351
- ...maybeExistingGroup,
1352
- deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
1353
- total: (maybeExistingGroup.total || 0) + 1
1354
- };
1355
- },
1356
- removeFromGroup: (state, action) => {
1357
- const { group, deviceIds: removedIds } = action.payload;
1358
- const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
1359
- const changedGroup = {
1360
- ...maybeExistingGroup,
1361
- deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
1362
- total: Math.max(total - removedIds.length, 0)
1363
- };
1364
- if (changedGroup.total || changedGroup.deviceIds.length) {
1365
- state.groups.byId[group] = changedGroup;
1366
- return;
1367
- } else if (state.groups.selectedGroup === group) {
1368
- state.groups.selectedGroup = void 0;
1369
- }
1370
- const { [group]: removal, ...remainingById } = state.groups.byId;
1371
- state.groups.byId = remainingById;
1372
- },
1373
- addGroup: (state, action) => {
1374
- const { groupName, group } = action.payload;
1375
- state.groups.byId[groupName] = {
1376
- ...state.groups.byId[groupName],
1377
- ...group
1378
- };
1379
- },
1380
- selectGroup: (state, { payload: group }) => {
1381
- state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1382
- state.groups.selectedGroup = group;
1383
- },
1384
- removeGroup: (state, action) => {
1385
- const { [action.payload]: removal, ...remainingById } = state.groups.byId;
1386
- state.groups.byId = remainingById;
1387
- state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
1388
- },
1389
- setDeviceListState: (state, action) => {
1390
- state.deviceList = {
1391
- ...state.deviceList,
1392
- ...action.payload,
1393
- sort: {
1394
- ...state.deviceList.sort,
1395
- ...action.payload.sort
1396
- }
1397
- };
1398
- },
1399
- setFilterAttributes: (state, action) => {
1400
- state.filteringAttributes = action.payload;
1401
- },
1402
- setFilterablesConfig: (state, action) => {
1403
- state.filteringAttributesConfig = action.payload;
1404
- },
1405
- receivedDevices: (state, action) => {
1406
- state.byId = {
1407
- ...state.byId,
1408
- ...action.payload
1409
- };
1410
- },
1411
- setDeviceFilters: (state, action) => {
1412
- if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
1413
- return;
1414
- }
1415
- state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
1416
- },
1417
- setInactiveDevices: (state, action) => {
1418
- const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;
1419
- state.byStatus.active.total = activeDeviceTotal;
1420
- state.byStatus.inactive.total = inactiveDeviceTotal;
1421
- },
1422
- setDeviceReports: (state, action) => {
1423
- state.reports = action.payload;
1424
- },
1425
- setDevicesByStatus: (state, action) => {
1426
- const { forceUpdate, status, total, deviceIds } = action.payload;
1427
- state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];
1428
- },
1429
- setDevicesCountByStatus: (state, action) => {
1430
- const { count, status } = action.payload;
1431
- state.byStatus[status].total = count;
1432
- },
1433
- setTotalDevices: (state, action) => {
1434
- state.total = action.payload;
1435
- },
1436
- setDeviceLimit: (state, action) => {
1437
- state.limit = action.payload;
1438
- },
1439
- receivedDevice: (state, action) => {
1440
- state.byId[action.payload.id] = {
1441
- ...state.byId[action.payload.id],
1442
- ...action.payload
1443
- };
1444
- },
1445
- maybeUpdateDevicesByStatus: (state, action) => {
1446
- const { deviceId, authId } = action.payload;
1447
- const device = state.byId[deviceId];
1448
- const hasMultipleAuthSets = authId ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1449
- if (!hasMultipleAuthSets && Object.values(DEVICE_STATES).includes(device.status)) {
1450
- const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1451
- state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
1452
- }
1453
- }
1454
- }
1455
- });
1456
- var actions3 = devicesSlice.actions;
1457
- var devicesSlice_default = devicesSlice.reducer;
1458
-
1459
- // src/monitorSlice/index.ts
1460
- var import_toolkit4 = require("@reduxjs/toolkit");
1461
- var sliceName4 = "monitor";
1462
- var initialState4 = {
1463
- alerts: {
1464
- alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
1465
- byDeviceId: {}
1466
- },
1467
- issueCounts: {
1468
- byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
1469
- },
1470
- settings: {
1471
- global: {
1472
- channels: {
1473
- ...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1474
- }
1475
- }
1476
- }
1477
- };
1478
- var monitorSlice = (0, import_toolkit4.createSlice)({
1479
- name: sliceName4,
1480
- initialState: initialState4,
1481
- reducers: {
1482
- changeAlertChannel: (state, action) => {
1483
- const { channel, enabled } = action.payload;
1484
- state.settings.global.channels[channel] = { enabled };
1485
- },
1486
- receiveDeviceAlerts: (state, action) => {
1487
- const { deviceId, alerts } = action.payload;
1488
- state.alerts.byDeviceId[deviceId] = { alerts };
1489
- },
1490
- receiveLatestDeviceAlerts: (state, action) => {
1491
- const { deviceId, alerts } = action.payload;
1492
- state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
1493
- },
1494
- receiveDeviceIssueCounts: (state, action) => {
1495
- const { issueType, counts } = action.payload;
1496
- state.issueCounts.byType[issueType] = counts;
1497
- },
1498
- setAlertListState: (state, action) => {
1499
- state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
1500
- }
1501
- }
1502
- });
1503
- var actions4 = monitorSlice.actions;
1504
- var monitorSlice_default = monitorSlice.reducer;
1505
-
1506
- // src/onboardingSlice/index.ts
1507
- var import_toolkit5 = require("@reduxjs/toolkit");
1508
- var sliceName5 = "onboarding";
1509
- var initialState5 = {
1510
- approach: null,
1511
- complete: false,
1512
- deviceType: null,
1513
- demoArtifactPort: 85,
1514
- progress: null,
1515
- showTips: null,
1516
- showTipsDialog: false
1517
- };
1518
- var onboardingSlice = (0, import_toolkit5.createSlice)({
1519
- name: sliceName5,
1520
- initialState: initialState5,
1521
- reducers: {
1522
- setOnboardingState: (state, action) => {
1523
- return { ...state, ...action.payload };
1524
- },
1525
- setDemoArtifactPort: (state, action) => {
1526
- state.demoArtifactPort = action.payload;
1527
- },
1528
- setShowOnboardingHelp: (state, action) => {
1529
- state.showTips = action.payload;
1530
- },
1531
- setShowDismissOnboardingTipsDialog: (state, action) => {
1532
- state.showTipsDialog = action.payload;
1533
- },
1534
- setOnboardingComplete: (state, action) => {
1535
- state.complete = action.payload;
1536
- },
1537
- setOnboardingProgress: (state, action) => {
1538
- state.progress = action.payload;
1539
- },
1540
- setOnboardingDeviceType: (state, action) => {
1541
- state.deviceType = action.payload;
1542
- },
1543
- setOnboardingApproach: (state, action) => {
1544
- state.approach = action.payload;
1545
- }
1546
- }
1547
- });
1548
- var actions5 = onboardingSlice.actions;
1549
- var onboardingSlice_default = onboardingSlice.reducer;
1550
-
1551
- // src/organizationSlice/index.ts
1552
- var import_toolkit6 = require("@reduxjs/toolkit");
1553
- var sliceName6 = "organization";
1554
- var initialState6 = {
1555
- card: {
1556
- last4: "",
1557
- expiration: { month: 1, year: 2020 },
1558
- brand: ""
1559
- },
1560
- intentId: null,
1561
- tenantList: {
1562
- ...TENANT_LIST_DEFAULT,
1563
- total: 0,
1564
- tenants: [],
1565
- selectedTenant: null,
1566
- sort: {
1567
- direction: SORTING_OPTIONS.desc,
1568
- key: "name"
1569
- }
1570
- },
1571
- organization: {
1572
- // id, name, status, tenant_token, plan
1573
- },
1574
- auditlog: {
1575
- events: [],
1576
- selectionState: {
1577
- ...DEVICE_LIST_DEFAULTS,
1578
- detail: void 0,
1579
- endDate: void 0,
1580
- selectedIssue: void 0,
1581
- sort: { direction: SORTING_OPTIONS.desc },
1582
- startDate: void 0,
1583
- total: 0,
1584
- type: void 0,
1585
- user: void 0
1586
- }
1587
- },
1588
- externalDeviceIntegrations: [
1589
- // { <connection_string|x509|...>, id, provider }
1590
- ],
1591
- ssoConfigs: [],
1592
- webhooks: {
1593
- // [id]: { events: [] }
1594
- // for now:
1595
- events: [],
1596
- eventsTotal: 0
1597
- }
1598
- };
1599
- var organizationSlice = (0, import_toolkit6.createSlice)({
1600
- name: sliceName6,
1601
- initialState: initialState6,
1602
- reducers: {
1603
- receiveAuditLogs: (state, action) => {
1604
- const { events, total } = action.payload;
1605
- state.auditlog.events = events;
1606
- state.auditlog.selectionState.total = total;
1607
- },
1608
- setAuditLogState: (state, action) => {
1609
- state.auditlog.selectionState = {
1610
- ...state.auditlog.selectionState,
1611
- ...action.payload
1612
- };
1613
- },
1614
- receiveCurrentCard: (state, action) => {
1615
- state.card = action.payload;
1616
- },
1617
- receiveSetupIntent: (state, action) => {
1618
- state.intentId = action.payload;
1619
- },
1620
- setOrganization: (state, action) => {
1621
- state.organization = { ...state.organization, ...action.payload };
1622
- },
1623
- setTenantListState: (state, action) => {
1624
- state.tenantList = action.payload;
1625
- },
1626
- receiveExternalDeviceIntegrations: (state, action) => {
1627
- state.externalDeviceIntegrations = action.payload;
1628
- },
1629
- receiveSsoConfigs: (state, action) => {
1630
- state.ssoConfigs = action.payload;
1631
- },
1632
- receiveWebhookEvents: (state, action) => {
1633
- const { value, total } = action.payload;
1634
- state.webhooks.events = value;
1635
- state.webhooks.eventsTotal = total;
1636
- }
1637
- }
1638
- });
1639
- var actions6 = organizationSlice.actions;
1640
- var organizationSlice_default = organizationSlice.reducer;
1641
-
1642
- // src/releasesSlice/index.ts
1643
- var import_toolkit7 = require("@reduxjs/toolkit");
1644
- var sliceName7 = "releases";
1645
- var initialState7 = {
1646
- /*
1647
- * Return list of saved artifacts objects
1648
- */
1649
- /*
1650
- * return list of artifacts where duplicate names are collated with device compatibility lists combined
1651
- */
1652
- // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),
1653
- artifacts: [],
1654
- /*
1655
- * Return list of saved release objects
1656
- */
1657
- byId: {
1658
- /*
1659
- [releaseName]: {
1660
- artifacts: [
1661
- {
1662
- id: '',
1663
- name: '',
1664
- description: '',
1665
- device_types_compatible: [],
1666
- ...
1667
- updates: [{
1668
- files: [
1669
- { size: 123, name: '' }
1670
- ],
1671
- type_info: { type: '' }
1672
- }],
1673
- url: '' // optional
1674
- }
1675
- ],
1676
- modified: ''
1677
- device_types_compatible,
1678
- name: '',
1679
- tags: ['something'],
1680
- notes: ''
1681
- }
1682
- */
1683
- },
1684
- releasesList: {
1685
- ...DEVICE_LIST_DEFAULTS,
1686
- searchedIds: [],
1687
- releaseIds: [],
1688
- selection: [],
1689
- sort: {
1690
- direction: SORTING_OPTIONS.desc,
1691
- key: "modified"
1692
- },
1693
- isLoading: void 0,
1694
- searchTerm: "",
1695
- searchTotal: 0,
1696
- selectedTags: [],
1697
- total: 0,
1698
- type: ""
1699
- },
1700
- tags: [],
1701
- updateTypes: [],
1702
- /*
1703
- * Return single release with corresponding Artifacts
1704
- */
1705
- selectedRelease: null
1706
- };
1707
- var releaseSlice = (0, import_toolkit7.createSlice)({
1708
- name: sliceName7,
1709
- initialState: initialState7,
1710
- reducers: {
1711
- receiveRelease: (state, action) => {
1712
- const { name } = action.payload;
1713
- state.byId[name] = action.payload;
1714
- },
1715
- receiveReleases: (state, action) => {
1716
- state.byId = action.payload;
1717
- },
1718
- receiveReleaseTags: (state, action) => {
1719
- state.tags = action.payload;
1720
- },
1721
- receiveReleaseTypes: (state, action) => {
1722
- state.updateTypes = action.payload;
1723
- },
1724
- removeRelease: (state, action) => {
1725
- const { [action.payload]: toBeRemoved, ...byId } = state.byId;
1726
- state.byId = byId;
1727
- state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
1728
- },
1729
- selectedRelease: (state, action) => {
1730
- state.selectedRelease = action.payload;
1731
- },
1732
- setReleaseListState: (state, action) => {
1733
- state.releasesList = action.payload;
1734
- }
1735
- }
1736
- });
1737
- var actions7 = releaseSlice.actions;
1738
- var releasesSlice_default = releaseSlice.reducer;
1739
-
1740
- // src/usersSlice/index.ts
1741
- var import_toolkit8 = require("@reduxjs/toolkit");
1742
- var sliceName8 = "users";
1743
- var initialState8 = {
1744
- activationCode: void 0,
1745
- byId: {},
1746
- currentUser: null,
1747
- currentSession: {
1748
- // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting
1749
- },
1750
- customColumns: [],
1751
- qrCode: null,
1752
- globalSettings: {
1753
- id_attribute: void 0,
1754
- previousFilters: [],
1755
- previousPhases: [],
1756
- retries: 0
1757
- },
1758
- permissionSetsById: {
1759
- ...defaultPermissionSets
1760
- },
1761
- rolesById: {
1762
- ...rolesById
1763
- },
1764
- settingsInitialized: false,
1765
- showConnectDeviceDialog: false,
1766
- showFeedbackDialog: false,
1767
- showStartupNotification: false,
1768
- tooltips: {
1769
- byId: {
1770
- // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants
1771
- }
1772
- },
1773
- userSettings: {
1774
- columnSelection: [],
1775
- onboarding: {}
1776
- },
1777
- userSettingsInitialized: false
1778
- };
1779
- var usersSlice = (0, import_toolkit8.createSlice)({
1780
- name: sliceName8,
1781
- initialState: initialState8,
1782
- reducers: {
1783
- receivedQrCode: (state, action) => {
1784
- state.qrCode = action.payload;
1785
- },
1786
- successfullyLoggedIn: (state, action) => {
1787
- state.currentSession = action.payload;
1788
- },
1789
- receivedUserList: (state, action) => {
1790
- state.byId = action.payload;
1791
- },
1792
- receivedActivationCode: (state, action) => {
1793
- state.activationCode = action.payload;
1794
- },
1795
- receivedUser: (state, action) => {
1796
- state.byId[action.payload.id] = action.payload;
1797
- state.currentUser = action.payload.id;
1798
- },
1799
- createdUser: (state, action) => {
1800
- state.byId[0] = action.payload;
1801
- },
1802
- removedUser: (state, action) => {
1803
- const { [action.payload]: removedUser, ...byId } = state.byId;
1804
- state.byId = byId;
1805
- state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
1806
- },
1807
- updatedUser: (state, action) => {
1808
- state.byId[action.payload.id] = {
1809
- ...state.byId[action.payload.id],
1810
- ...action.payload
1811
- };
1812
- },
1813
- receivedPermissionSets: (state, action) => {
1814
- state.permissionSetsById = action.payload;
1815
- },
1816
- receivedRoles: (state, action) => {
1817
- state.rolesById = action.payload;
1818
- },
1819
- createdRole: (state, action) => {
1820
- state.rolesById[action.payload.name] = {
1821
- ...state.rolesById[action.payload.name],
1822
- ...action.payload
1823
- };
1824
- },
1825
- removedRole: (state, action) => {
1826
- const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
1827
- state.rolesById = rolesById2;
1828
- },
1829
- setCustomColumns: (state, action) => {
1830
- state.customColumns = action.payload;
1831
- },
1832
- setGlobalSettings: (state, action) => {
1833
- state.settingsInitialized = true;
1834
- state.globalSettings = {
1835
- ...state.globalSettings,
1836
- ...action.payload
1837
- };
1838
- },
1839
- setUserSettings: (state, action) => {
1840
- state.userSettingsInitialized = true;
1841
- state.userSettings = {
1842
- ...state.userSettings,
1843
- ...action.payload
1844
- };
1845
- },
1846
- setTooltipState: (state, action) => {
1847
- const { id, readState = READ_STATES.read } = action.payload;
1848
- state.tooltips.byId[id].readState = readState;
1849
- },
1850
- setTooltipsState: (state, action) => {
1851
- state.tooltips.byId = {
1852
- ...state.tooltips.byId,
1853
- ...action.payload
1854
- };
1855
- },
1856
- setShowFeedbackDialog: (state, action) => {
1857
- state.showFeedbackDialog = action.payload;
1858
- },
1859
- setShowConnectingDialog: (state, action) => {
1860
- state.showConnectDeviceDialog = action.payload;
1861
- },
1862
- setShowStartupNotification: (state, action) => {
1863
- state.showStartupNotification = action.payload;
1864
- }
1865
- }
1866
- });
1867
- var actions8 = usersSlice.actions;
1868
- var usersSlice_default = usersSlice.reducer;
1869
-
1870
- // src/actions.ts
1871
- var actions_default = {
1872
- ...actions,
1873
- ...actions2,
1874
- ...actions3,
1875
- ...actions4,
1876
- ...actions5,
1877
- ...actions6,
1878
- ...actions7,
1879
- ...actions8
1880
- };
1881
-
1882
- // src/api/general-api.ts
1883
- var import_axios = __toESM(require("axios"));
1884
-
1885
- // src/auth.ts
1886
- var import_universal_cookie = __toESM(require("universal-cookie"));
1887
- var cookies = new import_universal_cookie.default();
1888
- var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
1889
- var tokenCache = "";
1890
- var getSessionInfo = () => {
1891
- let sessionInfo = { ...emptySession };
1892
- try {
1893
- sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
1894
- } catch {
1895
- }
1896
- if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
1897
- cleanUp();
1898
- return { ...emptySession };
1899
- }
1900
- if (!sessionInfo.token) {
1901
- let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1902
- if (jwtTokenFromCookie) {
1903
- setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
1904
- sessionInfo.token = jwtTokenFromCookie;
1905
- cookies.remove("JWT");
1906
- cookies.remove("JWT", { path: "/" });
1907
- }
1908
- }
1909
- sessionInfo.token = sessionInfo.token || void 0;
1910
- tokenCache = sessionInfo.token;
1911
- return sessionInfo;
1912
- };
1913
- var getToken = () => tokenCache ? tokenCache : getSessionInfo().token;
1914
- var setSessionInfo = ({ token, expiresAt }) => {
1915
- tokenCache = token;
1916
- window.localStorage.setItem("JWT", JSON.stringify({ token, expiresAt }));
1917
- };
1918
- var cleanUp = () => {
1919
- tokenCache = "";
1920
- cookies.remove("JWT");
1921
- cookies.remove("JWT", { path: "/" });
1922
- window.localStorage.removeItem("JWT");
1923
- window.localStorage.removeItem("oauth");
1924
- };
1925
-
1926
- // src/api/general-api.ts
1927
- var unauthorizedRedirect = (error) => {
1928
- if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
1929
- cleanUp();
1930
- window.location.replace("/ui/");
1931
- }
1932
- return Promise.reject(error);
1933
- };
1934
- var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Content-Type": "application/json" } };
1935
- var authenticatedRequest = import_axios.default.create(commonRequestConfig);
1936
- authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
1937
- authenticatedRequest.interceptors.request.use(
1938
- (config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
1939
- (error) => Promise.reject(error)
1940
- );
1941
- var Api = {
1942
- get: authenticatedRequest.get,
1943
- delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
1944
- patch: authenticatedRequest.patch,
1945
- post: authenticatedRequest.post,
1946
- postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
1947
- put: authenticatedRequest.put,
1948
- upload: (url, formData, progress, cancelSignal) => authenticatedRequest.post(url, formData, {
1949
- headers: { "Content-Type": "multipart/form-data" },
1950
- onUploadProgress: progress,
1951
- timeout: 0,
1952
- signal: cancelSignal
1953
- }),
1954
- uploadPut: (url, formData, progress, cancelSignal) => authenticatedRequest.put(url, formData, {
1955
- headers: { "Content-Type": "multipart/form-data" },
1956
- onUploadProgress: progress,
1957
- timeout: 0,
1958
- signal: cancelSignal
1959
- })
1960
- };
1961
- var general_api_default = Api;
1962
-
1963
- // src/appSlice/selectors.ts
1964
- var import_helpers2 = require("@northern.tech/utils/helpers");
1965
- var import_toolkit9 = require("@reduxjs/toolkit");
1966
- var getAppDocsVersion = (state) => state.app.docsVersion;
1967
- var getFeatures = (state) => state.app.features;
1968
- var getFullVersionInformation = (state) => state.app.versionInformation;
1969
- var getDocsVersion = (0, import_toolkit9.createSelector)([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
1970
- const docsVersion = appDocsVersion ? `${appDocsVersion}/` : "development/";
1971
- return isHosted ? "" : docsVersion;
1972
- });
1973
- var getSearchState = (state) => state.app.searchState;
1974
- var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
1975
- var getVersionInformation = (0, import_toolkit9.createSelector)(
1976
- [getFullVersionInformation, getFeatures],
1977
- ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1978
- );
1979
- var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
1980
-
1981
- // src/commonSelectors.ts
1982
- var import_helpers5 = require("@northern.tech/utils/helpers");
1983
- var import_toolkit15 = require("@reduxjs/toolkit");
1984
-
1985
- // src/deploymentsSlice/selectors.ts
1986
- var import_toolkit10 = require("@reduxjs/toolkit");
1987
- var getDeploymentsById = (state) => state.deployments.byId;
1988
- var getDeploymentsByStatus = (state) => state.deployments.byStatus;
1989
- var getSelectedDeploymentDeviceIds = (state) => state.deployments.selectedDeviceIds;
1990
- var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
1991
- var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
1992
- [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
1993
- (selectionState, deploymentsState, deploymentsById) => {
1994
- const { selection = [] } = selectionState[deploymentsState] ?? {};
1995
- return selection.reduce((accu, id) => {
1996
- if (deploymentsById[id]) {
1997
- accu.push(deploymentsById[id]);
1998
- }
1999
- return accu;
2000
- }, []);
2001
- }
2002
- );
2003
- var relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];
2004
- var DEPLOYMENT_CUTOFF = 3;
2005
- var getRecentDeployments = (0, import_toolkit10.createSelector)(
2006
- [getDeploymentsById, getDeploymentsByStatus],
2007
- (deploymentsById, deploymentsByStatus) => Object.entries(deploymentsByStatus).reduce(
2008
- (accu, [state, byStatus]) => {
2009
- if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {
2010
- return accu;
2011
- }
2012
- accu[state] = byStatus.deploymentIds.reduce((accu2, id) => {
2013
- if (deploymentsById[id]) {
2014
- accu2.push(deploymentsById[id]);
2015
- }
2016
- return accu2;
2017
- }, []).slice(0, DEPLOYMENT_CUTOFF);
2018
- accu.total += byStatus.total;
2019
- return accu;
2020
- },
2021
- { total: 0 }
2022
- )
2023
- );
2024
-
2025
- // src/devicesSlice/selectors.ts
2026
- var import_helpers3 = require("@northern.tech/utils/helpers");
2027
- var import_toolkit11 = require("@reduxjs/toolkit");
2028
- var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
2029
- var getDevicesByStatus = (state) => state.devices.byStatus;
2030
- var getDevicesById = (state) => state.devices.byId;
2031
- var getGroupsById = (state) => state.devices.groups.byId;
2032
- var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
2033
- var getListedDevices = (state) => state.devices.deviceList.deviceIds;
2034
- var getFilteringAttributes = (state) => state.devices.filteringAttributes;
2035
- var getDeviceFilters = (state) => state.devices.filters || [];
2036
- var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
2037
- var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
2038
- ...filteringAttributes,
2039
- identityAttributes: [...filteringAttributes.identityAttributes, "id"]
2040
- }));
2041
- var getDeviceLimit = (state) => state.devices.limit;
2042
- var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
2043
- var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
2044
- [getFilteringAttributes, getFilteringAttributesLimit],
2045
- ({ identityAttributes }, filteringAttributesLimit) => {
2046
- const attributes = identityAttributes.slice(0, filteringAttributesLimit);
2047
- return attributes.reduce(
2048
- (accu, value) => {
2049
- accu.push({ value, label: value, scope: "identity" });
2050
- return accu;
2051
- },
2052
- [
2053
- { value: "name", label: "Name", scope: "tags" },
2054
- { value: "id", label: "Device ID", scope: "identity" }
2055
- ]
2056
- );
2057
- }
2058
- );
2059
- var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
2060
- [getDevicesByStatus],
2061
- (byStatus) => Object.values(DEVICE_STATES).reduce((accu, state) => {
2062
- accu[state] = byStatus[state].total || 0;
2063
- return accu;
2064
- }, {})
2065
- );
2066
- var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
2067
- var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
2068
- [getAcceptedDevices, getGroupsById, getSelectedGroup],
2069
- ({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
2070
- let groupCount = acceptedDeviceTotal;
2071
- let groupFilters = [];
2072
- if (selectedGroup && groupsById[selectedGroup]) {
2073
- groupCount = groupsById[selectedGroup].total;
2074
- groupFilters = groupsById[selectedGroup].filters || [];
2075
- }
2076
- return { groupCount, selectedGroup, groupFilters };
2077
- }
2078
- );
2079
- var getLimitMaxed = (0, import_toolkit11.createSelector)(
2080
- [getAcceptedDevices, getDeviceLimit],
2081
- ({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
2082
- );
2083
- var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
2084
- var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
2085
- const groupNames = Object.keys(groupsById).sort();
2086
- const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
2087
- (accu, [groupname, group]) => {
2088
- const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
2089
- const groupItem = { ...group, groupId: name, name: groupname };
2090
- if (group.filters.length > 0) {
2091
- if (groupname !== UNGROUPED_GROUP.id) {
2092
- accu.dynamic.push(groupItem);
2093
- } else {
2094
- accu.ungrouped.push(groupItem);
2095
- }
2096
- } else {
2097
- accu.static.push(groupItem);
2098
- }
2099
- return accu;
2100
- },
2101
- { dynamic: [], static: [], ungrouped: [] }
2102
- );
2103
- return { groupNames, ...groupedGroups };
2104
- });
2105
- var getAttributesList = (0, import_toolkit11.createSelector)(
2106
- [getFilteringAttributes, getFilteringAttributesFromConfig],
2107
- ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
2108
- );
2109
- var getDeviceTypes = (0, import_toolkit11.createSelector)(
2110
- [getAcceptedDevices, getDevicesById],
2111
- ({ deviceIds = [] }, devicesById) => Object.keys(
2112
- deviceIds.slice(0, 200).reduce((accu, item) => {
2113
- const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};
2114
- accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {
2115
- if (deviceType.length > 1) {
2116
- deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;
2117
- }
2118
- return deviceTypeAccu;
2119
- }, accu);
2120
- return accu;
2121
- }, {})
2122
- )
2123
- );
2124
-
2125
- // src/monitorSlice/selectors.ts
2126
- var getIssueCountsByType = (state) => state.monitor.issueCounts.byType;
2127
-
2128
- // src/onboardingSlice/selectors.ts
2129
- var getOnboarding = (state) => state.onboarding;
2130
-
2131
- // src/organizationSlice/selectors.ts
2132
- var import_toolkit12 = require("@reduxjs/toolkit");
2133
- var getOrganization = (state) => state.organization.organization;
2134
- var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
2135
- var getAuditLog = (state) => state.organization.auditlog.events;
2136
- var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
2137
- var getWebhookEvents = (state) => state.organization.webhooks.events;
2138
- var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
2139
- var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
2140
- [getExternalIntegrations],
2141
- (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
2142
- );
2143
- var getIsServiceProvider = (state) => state.organization.organization.service_provider;
2144
- var getWebhooks = (0, import_toolkit12.createSelector)(
2145
- [getExternalIntegrations],
2146
- (integrations) => integrations.filter((integration) => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)
2147
- );
2148
- var getWebhookEventInfo = (0, import_toolkit12.createSelector)(
2149
- [getWebhooks, getWebhookEvents, getWebhookEventTotal],
2150
- (webhooks, events, eventTotal) => webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }
2151
- );
2152
- var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {
2153
- if (!selectedId) {
2154
- return;
2155
- }
2156
- const [eventAction, eventTime] = atob(selectedId).split("|");
2157
- return events.find((item) => item.action === eventAction && item.time === eventTime);
2158
- });
2159
-
2160
- // src/utils.ts
2161
- var import_helpers4 = require("@northern.tech/utils/helpers");
2162
- var filterProcessors = {
2163
- $gt: (val) => Number(val) || val,
2164
- $gte: (val) => Number(val) || val,
2165
- $lt: (val) => Number(val) || val,
2166
- $lte: (val) => Number(val) || val,
2167
- $in: (val) => ("" + val).split(",").map((i) => i.trim()),
2168
- $nin: (val) => ("" + val).split(",").map((i) => i.trim()),
2169
- $exists: import_helpers4.yes,
2170
- $nexists: () => false
2171
- };
2172
- var filterAliases = {
2173
- $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
2174
- };
2175
- var mapFiltersToTerms = (filters) => filters.map((filter) => ({
2176
- scope: filter.scope,
2177
- attribute: filter.key,
2178
- type: filterAliases[filter.operator]?.alias || filter.operator,
2179
- value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
2180
- }));
2181
- var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
2182
- if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
2183
- return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
2184
- }
2185
- return DEVICE_ISSUE_OPTIONS[item].filterRule;
2186
- });
2187
- var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
2188
- let applicableFilters = [...filters];
2189
- if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2190
- applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
2191
- }
2192
- const nonMonitorFilters = applicableFilters.filter(
2193
- (filter) => !Object.values(DEVICE_ISSUE_OPTIONS).some(
2194
- ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2195
- )
2196
- );
2197
- const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2198
- applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2199
- const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
2200
- return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2201
- };
2202
- var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
2203
- return ids.slice(0, cutOffSize).reduce((accu, id) => {
2204
- if (id && byId[id]) {
2205
- accu.push({ ...defaultObject, ...byId[id] });
2206
- }
2207
- return accu;
2208
- }, []);
2209
- };
2210
- var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2211
- (accu, [key, value]) => {
2212
- let values;
2213
- if (!accu[key]) {
2214
- accu[key] = value;
2215
- return accu;
2216
- }
2217
- if (Array.isArray(value)) {
2218
- values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
2219
- } else {
2220
- values = mergePermissions(accu[key], { ...value });
2221
- }
2222
- accu[key] = values;
2223
- return accu;
2224
- },
2225
- { ...addedPermissions }
2226
- );
2227
- var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2228
- (accu, roleId) => {
2229
- if (!(roleId && roles[roleId])) {
2230
- return accu;
2231
- }
2232
- return mergePermissions(accu, roles[roleId].uiPermissions);
2233
- },
2234
- { ...emptyUiPermissions }
2235
- );
2236
- var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
2237
- var preformatWithRequestID = (res, failMsg) => {
2238
- if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
2239
- try {
2240
- if (res?.data && Object.keys(res.data).includes("request_id")) {
2241
- let shortRequestUUID = res.data["request_id"].substring(0, 8);
2242
- return `${failMsg} [Request ID: ${shortRequestUUID}]`;
2243
- }
2244
- } catch (e) {
2245
- console.log("failed to extract request id:", e);
2246
- }
2247
- return failMsg;
2248
- };
2249
- var isDarkMode = (mode) => mode === DARK_MODE;
2250
-
2251
- // src/releasesSlice/selectors.ts
2252
- var import_toolkit13 = require("@reduxjs/toolkit");
2253
- var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2254
- var getReleasesById = (state) => state.releases.byId;
2255
- var getReleaseTags = (state) => state.releases.tags;
2256
- var getReleaseListState = (state) => state.releases.releasesList;
2257
- var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2258
- var getReleaseMappingDefaults = () => ({});
2259
- var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2260
- var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2261
- var getHasReleases = (0, import_toolkit13.createSelector)(
2262
- [getReleaseListState, getReleasesById],
2263
- ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2264
- );
2265
- var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
2266
-
2267
- // src/usersSlice/selectors.ts
2268
- var import_toolkit14 = require("@reduxjs/toolkit");
2269
- var getRolesById = (state) => state.users.rolesById;
2270
- var getTooltipsById = (state) => state.users.tooltips.byId;
2271
- var getGlobalSettings = (state) => state.users.globalSettings;
2272
- var getCurrentUserId = (state) => state.users.currentUser;
2273
- var getUsersById = (state) => state.users.byId;
2274
- var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
2275
- var getUserSettings = (state) => state.users.userSettings;
2276
- var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2277
- var getShowHelptips = (0, import_toolkit14.createSelector)(
2278
- [getTooltipsById],
2279
- (tooltips) => Object.values(tooltips).reduce((accu, { readState }) => accu || readState === READ_STATES.unread, false)
2280
- );
2281
- var getTooltipsState = (0, import_toolkit14.createSelector)(
2282
- [getTooltipsById, getUserSettings],
2283
- (byId, { tooltips = {} }) => Object.entries(byId).reduce(
2284
- (accu, [id, value]) => {
2285
- accu[id] = { ...accu[id], ...value };
2286
- return accu;
2287
- },
2288
- { ...tooltips }
2289
- )
2290
- );
2291
- var getHas2FA = (0, import_toolkit14.createSelector)(
2292
- [getCurrentUser],
2293
- (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
2294
- );
2295
- var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2296
- var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
2297
- interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
2298
- intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
2299
- }));
2300
- var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
2301
-
2302
- // src/commonSelectors.ts
2303
- var getIsEnterprise = (0, import_toolkit15.createSelector)(
2304
- [getOrganization, getFeatures],
2305
- ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || isHosted && plan === PLANS.enterprise.id
2306
- );
2307
- var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2308
- [getFeatures],
2309
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`
2310
- );
2311
- var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2312
- [getFeatures],
2313
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`
2314
- );
2315
- var getUserRoles = (0, import_toolkit15.createSelector)(
2316
- [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
2317
- (currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
2318
- const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
2319
- const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2320
- return { isAdmin, uiPermissions };
2321
- }
2322
- );
2323
- var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2324
- var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2325
- const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);
2326
- const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);
2327
- const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);
2328
- const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);
2329
- const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);
2330
- const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);
2331
- const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);
2332
- const canWriteDevices = Object.values(uiPermissions.groups).some(
2333
- (groupPermissions) => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1
2334
- );
2335
- const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);
2336
- const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);
2337
- const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);
2338
- const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);
2339
- const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);
2340
- return {
2341
- canAuditlog,
2342
- canConfigure,
2343
- canDeploy,
2344
- canManageDevices,
2345
- canManageReleases,
2346
- canManageUsers,
2347
- canReadDeployments,
2348
- canReadDevices,
2349
- canReadReleases,
2350
- canReadUsers,
2351
- canTroubleshoot,
2352
- canUploadReleases,
2353
- canWriteDevices,
2354
- groupsPermissions: uiPermissions.groups,
2355
- releasesPermissions: uiPermissions.releases,
2356
- SPTenant: isServiceProvider
2357
- };
2358
- });
2359
- var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2360
- [getFeatures, getOrganization, getIsEnterprise],
2361
- ({ hasAuditlogs: isAuditlogEnabled, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2362
- const canDelta = isEnterprise || plan === PLANS.professional.id;
2363
- const hasAuditlogs = isAuditlogEnabled && isEnterprise;
2364
- const hasDeviceConfig = isDeviceConfigEnabled && addons.some((addon) => addon.name === "configure" && Boolean(addon.enabled));
2365
- const hasDeviceConnect = isDeviceConnectEnabled && (!isEnterprise || addons.some((addon) => addon.name === "troubleshoot" && Boolean(addon.enabled)));
2366
- const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === "monitor" && Boolean(addon.enabled));
2367
- return {
2368
- canDelta,
2369
- canRetry: canDelta,
2370
- canSchedule: canDelta,
2371
- hasAuditlogs,
2372
- hasDeviceConfig,
2373
- hasDeviceConnect,
2374
- hasFullFiltering: canDelta,
2375
- hasMonitor,
2376
- isEnterprise,
2377
- plan
2378
- };
2379
- }
2380
- );
2381
- var getFilterAttributes = (0, import_toolkit15.createSelector)(
2382
- [getGlobalSettings, getFilteringAttributes],
2383
- ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2384
- const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
2385
- const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
2386
- const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2387
- const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2388
- const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2389
- const attributes = [
2390
- ...previousFilters.map((item) => ({
2391
- ...item,
2392
- value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
2393
- category: "recently used",
2394
- priority: 0
2395
- })),
2396
- deviceNameAttribute,
2397
- deviceIdAttribute,
2398
- ...identityAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),
2399
- ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2400
- ...tagAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),
2401
- checkInAttribute,
2402
- updateAttribute,
2403
- firstRequestAttribute,
2404
- ...systemAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))
2405
- ];
2406
- return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
2407
- }
2408
- );
2409
- var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({
2410
- ...remainder,
2411
- ...onboarding,
2412
- complete: onboarding.complete || complete,
2413
- progress: Object.keys(onboardingSteps).findIndex((step) => step === progress) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress : onboarding.progress,
2414
- showTips: !onboarding.showTips ? onboarding.showTips : showTips
2415
- }));
2416
- var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
2417
- const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
2418
- return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
2419
- });
2420
- var getDeviceConfigDeployment = (0, import_toolkit15.createSelector)([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
2421
- const { config = {} } = device;
2422
- const { deployment_id: configDeploymentId } = config;
2423
- const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};
2424
- return { device, deviceConfigDeployment };
2425
- });
2426
- var getDeploymentRelease = (0, import_toolkit15.createSelector)(
2427
- [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],
2428
- (deploymentsById, { selectedId }, releasesById) => {
2429
- const deployment = deploymentsById[selectedId] || {};
2430
- return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };
2431
- }
2432
- );
2433
- var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2434
- [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
2435
- (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
2436
- const deployment = deploymentsById[selectedId] ?? {};
2437
- const { devices = {} } = deployment;
2438
- return {
2439
- deployment,
2440
- selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
2441
- };
2442
- }
2443
- );
2444
- var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2445
- [getFeatures, getTenantCapabilities, getIssueCountsByType],
2446
- ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2447
- if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2448
- return accu;
2449
- }
2450
- accu[key] = { count: issueCounts[key].filtered, key, title };
2451
- return accu;
2452
- }, {})
2453
- );
2454
- var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
2455
- const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2456
- if (staticOnly) {
2457
- return Object.keys(uiPermissions.groups).sort();
2458
- }
2459
- return Object.keys(
2460
- Object.entries(groups).reduce((accu, [groupName, group]) => {
2461
- if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {
2462
- accu[groupName] = group;
2463
- }
2464
- return accu;
2465
- }, uiPermissions.groups)
2466
- ).sort();
2467
- });
2468
- var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
2469
- [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
2470
- ({ reports }, { id: currentUserId }, globalSettings, devicesById) => {
2471
- return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);
2472
- }
2473
- );
2474
- var listTypeDeviceIdMap = {
2475
- deviceList: getListedDevices,
2476
- search: getSearchedDevices
2477
- };
2478
- var deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };
2479
- var getDeviceMappingDefaults = () => deviceMapDefault;
2480
- var getMappedDevicesList = (0, import_toolkit15.createSelector)(
2481
- [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],
2482
- listItemMapper
2483
- );
2484
- var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {
2485
- let auditlogDevice = {};
2486
- if (auditlogEvent) {
2487
- const { object = {} } = auditlogEvent;
2488
- const { device = {}, id, type } = object;
2489
- auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
2490
- }
2491
- return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
2492
- });
2493
- var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2494
- if (service_provider) {
2495
- return roles.reduce((accu, role) => {
2496
- if (rolesById[role.id]) {
2497
- return accu;
2498
- }
2499
- accu.push(role);
2500
- return accu;
2501
- }, Object.values(serviceProviderRolesById));
2502
- }
2503
- return Object.keys(rolesById).reverse().reduce((accu, key) => {
2504
- const index = accu.findIndex(({ id }) => id === key);
2505
- accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2506
- return accu;
2507
- }, roles);
2508
- });
2509
-
2510
- // src/store.ts
2511
- var import_toolkit16 = require("@reduxjs/toolkit");
2512
- var { setSnackbar, uploadProgress } = actions_default;
2513
- var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2514
- var resetEnvironment = () => {
2515
- keys.map((key) => window.sessionStorage.removeItem(key));
2516
- };
2517
- resetEnvironment();
2518
- var commonErrorFallback = "Please check your connection.";
2519
- var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
2520
- const errMsg = extractErrorMessage(err, fallback);
2521
- if (mightBeAuthRelated || getToken()) {
2522
- dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: "Copy to clipboard" }));
2523
- }
2524
- return Promise.reject(err);
2525
- };
2526
- var rootReducer = (0, import_toolkit16.combineReducers)({
2527
- app: appSlice_default,
2528
- devices: devicesSlice_default,
2529
- deployments: deploymentsSlice_default,
2530
- monitor: monitorSlice_default,
2531
- onboarding: onboardingSlice_default,
2532
- organization: organizationSlice_default,
2533
- releases: releasesSlice_default,
2534
- users: usersSlice_default
2535
- });
2536
- var sessionReducer = (state, action) => {
2537
- if (action.type === USER_LOGOUT) {
2538
- state = void 0;
2539
- }
2540
- return rootReducer(state, action);
2541
- };
2542
- var getConfiguredStore = (options = {}) => {
2543
- const { preloadedState = {}, ...config } = options;
2544
- return (0, import_toolkit16.configureStore)({
2545
- ...config,
2546
- preloadedState,
2547
- reducer: sessionReducer,
2548
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2549
- immutableCheck: {
2550
- ignoredPaths: ["app.uploadsById"]
2551
- },
2552
- serializableCheck: {
2553
- ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],
2554
- ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
2555
- ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
2556
- }
2557
- })
2558
- });
2559
- };
2560
- var store = getConfiguredStore({
2561
- preloadedState: {}
2562
- });
2563
-
2564
- // src/monitorSlice/thunks.ts
2565
- var import_toolkit17 = require("@reduxjs/toolkit");
2566
- var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
2567
- var cutoffLength = 75;
2568
- var ellipsis = "...";
2569
- var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
2570
- var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
2571
- var getDeviceAlerts = (0, import_toolkit17.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
2572
- const { page = defaultPage, perPage = defaultPerPage, issuedBefore, issuedAfter, sortAscending = false } = config;
2573
- const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
2574
- const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : "";
2575
- return general_api_default.get(`${monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then(
2576
- (res) => Promise.all([
2577
- dispatch(actions4.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),
2578
- dispatch(actions4.setAlertListState({ total: Number(res.headers[headerNames.total]) }))
2579
- ])
2580
- );
2581
- });
2582
- var getLatestDeviceAlerts = (0, import_toolkit17.createAsyncThunk)(`${sliceName4}/getLatestDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
2583
- const { page = defaultPage, perPage = 10 } = config;
2584
- return general_api_default.get(`${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(actions4.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));
2585
- });
2586
- var getIssueCountsByType2 = (0, import_toolkit17.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
2587
- const state = getState();
2588
- const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
2589
- const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
2590
- ...remainder,
2591
- filters,
2592
- group,
2593
- offlineThreshold: state.app.offlineThreshold,
2594
- selectedIssues: [type],
2595
- status
2596
- });
2597
- return general_api_default.post(getSearchEndpoint(getState()), {
2598
- page: 1,
2599
- per_page: 1,
2600
- filters: filterTerms,
2601
- attributes: [{ scope: "identity", attribute: "status" }]
2602
- }).catch((err) => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback)).then((res) => {
2603
- const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[headerNames.total]);
2604
- const filtered = nonMonitorFilters.length ? Number(res.headers[headerNames.total]) : total;
2605
- if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {
2606
- return Promise.resolve();
2607
- }
2608
- return Promise.resolve(dispatch(actions4.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type })));
2609
- });
2610
- });
2611
- var getDeviceMonitorConfig = (0, import_toolkit17.createAsyncThunk)(
2612
- `${sliceName4}/getDeviceMonitorConfig`,
2613
- (id, { dispatch }) => general_api_default.get(`${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))]))
2614
- );
2615
- var changeNotificationSetting = (0, import_toolkit17.createAsyncThunk)(
2616
- `${sliceName4}/changeNotificationSetting`,
2617
- ({ enabled, channel = alertChannels.email }, { dispatch }) => {
2618
- return general_api_default.put(`${monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled }).catch((err) => commonErrorHandler(err, `${enabled ? "En" : "Dis"}abling ${channel} alerts failed:`, dispatch)).then(
2619
- () => Promise.all([
2620
- dispatch(actions4.changeAlertChannel({ channel, enabled })),
2621
- dispatch(actions_default.setSnackbar(`Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, TIMEOUTS.fiveSeconds))
2622
- ])
2623
- );
2624
- }
2625
- );
2626
43
  //# sourceMappingURL=thunks.js.map