@northern.tech/store 0.11.0 → 0.13.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 (200) hide show
  1. package/dist/actions.cjs +22 -17
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +7 -22
  4. package/dist/actions.d.ts +7 -22
  5. package/dist/actions.js +9 -9
  6. package/dist/api/general-api.js +1 -1
  7. package/dist/api/users-api.js +1 -1
  8. package/dist/appSlice/index.cjs.map +1 -1
  9. package/dist/appSlice/index.d.cts +1 -1
  10. package/dist/appSlice/index.d.ts +1 -1
  11. package/dist/appSlice/index.js +2 -2
  12. package/dist/appSlice/mocks.cjs.map +1 -1
  13. package/dist/appSlice/mocks.js +2 -2
  14. package/dist/appSlice/selectors.d.cts +34 -528
  15. package/dist/appSlice/selectors.d.ts +34 -528
  16. package/dist/appSlice/thunks.cjs +49 -42
  17. package/dist/appSlice/thunks.cjs.map +1 -1
  18. package/dist/appSlice/thunks.d.cts +5 -3
  19. package/dist/appSlice/thunks.d.ts +5 -3
  20. package/dist/appSlice/thunks.js +18 -18
  21. package/dist/auth.js +1 -1
  22. package/dist/{chunk-QOFVCPRW.js → chunk-5PUF4LA5.js} +1 -1
  23. package/dist/chunk-5PUF4LA5.js.map +1 -0
  24. package/dist/{chunk-X3NF4KNC.js → chunk-6KAV62BW.js} +6 -6
  25. package/dist/{chunk-OFGCC3GM.js → chunk-7MTM3BDT.js} +1 -1
  26. package/dist/chunk-7MTM3BDT.js.map +1 -0
  27. package/dist/{chunk-4FNSLYK5.js → chunk-AR4FTKSL.js} +14 -14
  28. package/dist/{chunk-6KNRR7A5.js → chunk-BZAXFAGT.js} +4 -4
  29. package/dist/{chunk-ZNAJKEP2.js → chunk-CQXDAXQF.js} +1 -1
  30. package/dist/chunk-CQXDAXQF.js.map +1 -0
  31. package/dist/{chunk-I3H5EFZK.js → chunk-EOZ665GA.js} +15 -15
  32. package/dist/{chunk-NVNO3I3K.js → chunk-ETZVJXPD.js} +36 -41
  33. package/dist/chunk-ETZVJXPD.js.map +1 -0
  34. package/dist/{chunk-RFF52JYU.js → chunk-KJ4BPXMB.js} +3 -2
  35. package/dist/chunk-KJ4BPXMB.js.map +1 -0
  36. package/dist/{chunk-C2LGE3P6.js → chunk-OLKM53RL.js} +1 -1
  37. package/dist/chunk-OLKM53RL.js.map +1 -0
  38. package/dist/{chunk-HLX5L3IM.js → chunk-PVCHKW35.js} +1 -1
  39. package/dist/chunk-PVCHKW35.js.map +1 -0
  40. package/dist/{chunk-REZWSU22.js → chunk-VODRLEDP.js} +21 -17
  41. package/dist/chunk-VODRLEDP.js.map +1 -0
  42. package/dist/{chunk-MH5WPYQI.js → chunk-X7NEALMI.js} +16 -9
  43. package/dist/chunk-X7NEALMI.js.map +1 -0
  44. package/dist/{chunk-CUU3N6KW.js → chunk-YFAIYNQG.js} +16 -16
  45. package/dist/commonConstants.js +1 -1
  46. package/dist/commonSelectors.cjs +15 -8
  47. package/dist/commonSelectors.cjs.map +1 -1
  48. package/dist/commonSelectors.d.cts +178 -3523
  49. package/dist/commonSelectors.d.ts +178 -3523
  50. package/dist/commonSelectors.js +6 -6
  51. package/dist/constants.js +1 -1
  52. package/dist/deploymentsSlice/constants.js +1 -1
  53. package/dist/deploymentsSlice/index.cjs.map +1 -1
  54. package/dist/deploymentsSlice/index.d.cts +1 -1
  55. package/dist/deploymentsSlice/index.d.ts +1 -1
  56. package/dist/deploymentsSlice/index.js +2 -2
  57. package/dist/deploymentsSlice/mocks.cjs.map +1 -1
  58. package/dist/deploymentsSlice/mocks.js +2 -2
  59. package/dist/deploymentsSlice/selectors.d.cts +16 -138
  60. package/dist/deploymentsSlice/selectors.d.ts +16 -138
  61. package/dist/deploymentsSlice/selectors.js +1 -1
  62. package/dist/deploymentsSlice/thunks.cjs +49 -42
  63. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  64. package/dist/deploymentsSlice/thunks.d.cts +4 -2
  65. package/dist/deploymentsSlice/thunks.d.ts +4 -2
  66. package/dist/deploymentsSlice/thunks.js +18 -18
  67. package/dist/devicesSlice/constants.js +1 -1
  68. package/dist/devicesSlice/index.cjs +20 -16
  69. package/dist/devicesSlice/index.cjs.map +1 -1
  70. package/dist/devicesSlice/index.d.cts +11 -20
  71. package/dist/devicesSlice/index.d.ts +11 -20
  72. package/dist/devicesSlice/index.js +2 -2
  73. package/dist/devicesSlice/mocks.cjs +24 -22
  74. package/dist/devicesSlice/mocks.cjs.map +1 -1
  75. package/dist/devicesSlice/mocks.d.cts +20 -12
  76. package/dist/devicesSlice/mocks.d.ts +20 -12
  77. package/dist/devicesSlice/mocks.js +6 -8
  78. package/dist/devicesSlice/mocks.js.map +1 -1
  79. package/dist/devicesSlice/selectors.cjs +15 -8
  80. package/dist/devicesSlice/selectors.cjs.map +1 -1
  81. package/dist/devicesSlice/selectors.d.cts +207 -1730
  82. package/dist/devicesSlice/selectors.d.ts +207 -1730
  83. package/dist/devicesSlice/selectors.js +2 -2
  84. package/dist/devicesSlice/thunks.cjs +49 -44
  85. package/dist/devicesSlice/thunks.cjs.map +1 -1
  86. package/dist/devicesSlice/thunks.d.cts +12 -46
  87. package/dist/devicesSlice/thunks.d.ts +12 -46
  88. package/dist/devicesSlice/thunks.js +18 -20
  89. package/dist/liststatehook.js +1 -1
  90. package/dist/locationutils.js +1 -1
  91. package/dist/monitorSlice/index.cjs.map +1 -1
  92. package/dist/monitorSlice/index.d.cts +1 -1
  93. package/dist/monitorSlice/index.d.ts +1 -1
  94. package/dist/monitorSlice/index.js +2 -2
  95. package/dist/monitorSlice/mocks.cjs.map +1 -1
  96. package/dist/monitorSlice/mocks.js +2 -2
  97. package/dist/monitorSlice/thunks.cjs +37 -25
  98. package/dist/monitorSlice/thunks.cjs.map +1 -1
  99. package/dist/monitorSlice/thunks.d.cts +3 -2
  100. package/dist/monitorSlice/thunks.d.ts +3 -2
  101. package/dist/monitorSlice/thunks.js +16 -16
  102. package/dist/onboardingSlice/index.cjs.map +1 -1
  103. package/dist/onboardingSlice/index.d.cts +1 -1
  104. package/dist/onboardingSlice/index.d.ts +1 -1
  105. package/dist/onboardingSlice/index.js +1 -1
  106. package/dist/onboardingSlice/mocks.cjs.map +1 -1
  107. package/dist/onboardingSlice/mocks.js +1 -1
  108. package/dist/onboardingSlice/thunks.cjs +49 -42
  109. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  110. package/dist/onboardingSlice/thunks.d.cts +7 -15
  111. package/dist/onboardingSlice/thunks.d.ts +7 -15
  112. package/dist/onboardingSlice/thunks.js +18 -18
  113. package/dist/organizationSlice/constants.js +1 -1
  114. package/dist/organizationSlice/index.cjs.map +1 -1
  115. package/dist/organizationSlice/index.d.cts +41 -31
  116. package/dist/organizationSlice/index.d.ts +41 -31
  117. package/dist/organizationSlice/index.js +2 -2
  118. package/dist/organizationSlice/mocks.cjs.map +1 -1
  119. package/dist/organizationSlice/mocks.js +2 -2
  120. package/dist/organizationSlice/selectors.d.cts +42 -659
  121. package/dist/organizationSlice/selectors.d.ts +42 -659
  122. package/dist/organizationSlice/selectors.js +1 -1
  123. package/dist/organizationSlice/thunks.cjs +51 -44
  124. package/dist/organizationSlice/thunks.cjs.map +1 -1
  125. package/dist/organizationSlice/thunks.d.cts +4 -1
  126. package/dist/organizationSlice/thunks.d.ts +4 -1
  127. package/dist/organizationSlice/thunks.js +18 -18
  128. package/dist/organizationSlice/types.cjs.map +1 -1
  129. package/dist/organizationSlice/types.d.cts +2 -12
  130. package/dist/organizationSlice/types.d.ts +2 -12
  131. package/dist/releasesSlice/index.js +1 -1
  132. package/dist/releasesSlice/mocks.d.cts +7 -1
  133. package/dist/releasesSlice/mocks.d.ts +7 -1
  134. package/dist/releasesSlice/mocks.js +1 -1
  135. package/dist/releasesSlice/selectors.d.cts +155 -930
  136. package/dist/releasesSlice/selectors.d.ts +155 -930
  137. package/dist/releasesSlice/selectors.js +1 -1
  138. package/dist/releasesSlice/thunks.cjs +37 -25
  139. package/dist/releasesSlice/thunks.cjs.map +1 -1
  140. package/dist/releasesSlice/thunks.d.cts +4 -2
  141. package/dist/releasesSlice/thunks.d.ts +4 -2
  142. package/dist/releasesSlice/thunks.js +16 -16
  143. package/dist/selectors.cjs +15 -8
  144. package/dist/selectors.cjs.map +1 -1
  145. package/dist/selectors.d.cts +6 -3
  146. package/dist/selectors.d.ts +6 -3
  147. package/dist/selectors.js +33 -33
  148. package/dist/sockethook.cjs +1 -1
  149. package/dist/sockethook.cjs.map +1 -1
  150. package/dist/sockethook.js +2 -2
  151. package/dist/sockethook.js.map +1 -1
  152. package/dist/store.cjs +22 -17
  153. package/dist/store.cjs.map +1 -1
  154. package/dist/store.d.cts +40 -658
  155. package/dist/store.d.ts +40 -658
  156. package/dist/store.js +10 -10
  157. package/dist/storehooks.cjs +52 -45
  158. package/dist/storehooks.cjs.map +1 -1
  159. package/dist/storehooks.js +19 -19
  160. package/dist/thunks.cjs +49 -44
  161. package/dist/thunks.cjs.map +1 -1
  162. package/dist/thunks.d.cts +7 -5
  163. package/dist/thunks.d.ts +7 -5
  164. package/dist/thunks.js +18 -20
  165. package/dist/useDeploymentDevice.cjs +49 -42
  166. package/dist/useDeploymentDevice.cjs.map +1 -1
  167. package/dist/useDeploymentDevice.js +19 -19
  168. package/dist/usersSlice/constants.js +1 -1
  169. package/dist/usersSlice/index.cjs +2 -1
  170. package/dist/usersSlice/index.cjs.map +1 -1
  171. package/dist/usersSlice/index.d.cts +47 -46
  172. package/dist/usersSlice/index.d.ts +47 -46
  173. package/dist/usersSlice/index.js +2 -2
  174. package/dist/usersSlice/mocks.cjs +2 -1
  175. package/dist/usersSlice/mocks.cjs.map +1 -1
  176. package/dist/usersSlice/mocks.js +2 -2
  177. package/dist/usersSlice/selectors.d.cts +75 -1436
  178. package/dist/usersSlice/selectors.d.ts +75 -1436
  179. package/dist/usersSlice/selectors.js +1 -1
  180. package/dist/usersSlice/thunks.cjs +49 -42
  181. package/dist/usersSlice/thunks.cjs.map +1 -1
  182. package/dist/usersSlice/thunks.d.cts +3 -1
  183. package/dist/usersSlice/thunks.d.ts +3 -1
  184. package/dist/usersSlice/thunks.js +18 -18
  185. package/dist/utils.js +1 -1
  186. package/package.json +4 -4
  187. package/dist/chunk-C2LGE3P6.js.map +0 -1
  188. package/dist/chunk-HLX5L3IM.js.map +0 -1
  189. package/dist/chunk-MH5WPYQI.js.map +0 -1
  190. package/dist/chunk-NVNO3I3K.js.map +0 -1
  191. package/dist/chunk-OFGCC3GM.js.map +0 -1
  192. package/dist/chunk-QOFVCPRW.js.map +0 -1
  193. package/dist/chunk-REZWSU22.js.map +0 -1
  194. package/dist/chunk-RFF52JYU.js.map +0 -1
  195. package/dist/chunk-ZNAJKEP2.js.map +0 -1
  196. /package/dist/{chunk-X3NF4KNC.js.map → chunk-6KAV62BW.js.map} +0 -0
  197. /package/dist/{chunk-4FNSLYK5.js.map → chunk-AR4FTKSL.js.map} +0 -0
  198. /package/dist/{chunk-6KNRR7A5.js.map → chunk-BZAXFAGT.js.map} +0 -0
  199. /package/dist/{chunk-I3H5EFZK.js.map → chunk-EOZ665GA.js.map} +0 -0
  200. /package/dist/{chunk-CUU3N6KW.js.map → chunk-YFAIYNQG.js.map} +0 -0
@@ -12,15 +12,17 @@ import '../commonConstants.cjs';
12
12
  import 'react/jsx-runtime';
13
13
  import '../devicesSlice/constants.cjs';
14
14
  import 'redux-thunk';
15
- import '../usersSlice/constants.cjs';
16
15
  import '../usersSlice/index.cjs';
16
+ import '../usersSlice/constants.cjs';
17
17
  import '../releasesSlice/index.cjs';
18
+ import '../organizationSlice/index.cjs';
18
19
  import '../organizationSlice/types.cjs';
19
20
  import '../appSlice/constants.cjs';
20
21
  import '@mui/material/OverridableComponent';
21
22
  import '../organizationSlice/constants.cjs';
22
23
  import '../onboardingSlice/index.cjs';
23
- import '@northern.tech/types/types.gen';
24
+ import '../monitorSlice/index.cjs';
25
+ import '../monitorSlice/constants.cjs';
24
26
 
25
27
  declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
26
28
  type GetDeploymentsByStatusPayload = Partial<SelectionListState> & {
@@ -12,15 +12,17 @@ import '../commonConstants.js';
12
12
  import 'react/jsx-runtime';
13
13
  import '../devicesSlice/constants.js';
14
14
  import 'redux-thunk';
15
- import '../usersSlice/constants.js';
16
15
  import '../usersSlice/index.js';
16
+ import '../usersSlice/constants.js';
17
17
  import '../releasesSlice/index.js';
18
+ import '../organizationSlice/index.js';
18
19
  import '../organizationSlice/types.js';
19
20
  import '../appSlice/constants.js';
20
21
  import '@mui/material/OverridableComponent';
21
22
  import '../organizationSlice/constants.js';
22
23
  import '../onboardingSlice/index.js';
23
- import '@northern.tech/types/types.gen';
24
+ import '../monitorSlice/index.js';
25
+ import '../monitorSlice/constants.js';
24
26
 
25
27
  declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
26
28
  type GetDeploymentsByStatusPayload = Partial<SelectionListState> & {
@@ -13,38 +13,38 @@ import {
13
13
  saveDeltaDeploymentsConfig,
14
14
  setDeploymentsState,
15
15
  updateDeploymentControlMap
16
- } from "../chunk-NVNO3I3K.js";
17
- import "../chunk-6KNRR7A5.js";
18
- import "../chunk-X3NF4KNC.js";
19
- import "../chunk-CUU3N6KW.js";
16
+ } from "../chunk-ETZVJXPD.js";
17
+ import "../chunk-BZAXFAGT.js";
18
+ import "../chunk-6KAV62BW.js";
19
+ import "../chunk-YFAIYNQG.js";
20
20
  import "../chunk-Y3DJIMEN.js";
21
21
  import "../chunk-5M6EUVNO.js";
22
- import "../chunk-4FNSLYK5.js";
23
- import "../chunk-C2LGE3P6.js";
24
- import "../chunk-RFF52JYU.js";
22
+ import "../chunk-AR4FTKSL.js";
25
23
  import "../chunk-TRKA7XYU.js";
26
- import "../chunk-ZNAJKEP2.js";
27
- import "../chunk-QOFVCPRW.js";
28
- import "../chunk-HLX5L3IM.js";
29
- import "../chunk-OFGCC3GM.js";
30
- import "../chunk-REZWSU22.js";
24
+ import "../chunk-KJ4BPXMB.js";
25
+ import "../chunk-5PUF4LA5.js";
26
+ import "../chunk-PVCHKW35.js";
27
+ import "../chunk-CQXDAXQF.js";
28
+ import "../chunk-VODRLEDP.js";
29
+ import "../chunk-7MTM3BDT.js";
30
+ import "../chunk-OLKM53RL.js";
31
31
  import "../chunk-FDSMCFV5.js";
32
32
  import "../chunk-53W2NRSL.js";
33
33
  import "../chunk-NMAXZ3ZY.js";
34
- import "../chunk-I3H5EFZK.js";
35
- import "../chunk-WR6RQKF5.js";
36
- import "../chunk-7QKCBSFU.js";
34
+ import "../chunk-EOZ665GA.js";
37
35
  import "../chunk-GGBE6KJV.js";
38
- import "../chunk-JIS4PA3R.js";
36
+ import "../chunk-7QKCBSFU.js";
39
37
  import "../chunk-3NOV7X4M.js";
40
- import "../chunk-MH5WPYQI.js";
41
38
  import "../chunk-YO22XLHI.js";
39
+ import "../chunk-JIS4PA3R.js";
40
+ import "../chunk-WR6RQKF5.js";
41
+ import "../chunk-X7NEALMI.js";
42
42
  import "../chunk-BYUPW7RA.js";
43
43
  import "../chunk-GX2TWNLC.js";
44
44
  import "../chunk-WWED74SG.js";
45
45
  import "../chunk-2DYA3X77.js";
46
- import "../chunk-ZKAH3APE.js";
47
46
  import "../chunk-FAJ3I2UQ.js";
47
+ import "../chunk-ZKAH3APE.js";
48
48
  import "../chunk-OWWCFJZ5.js";
49
49
  export {
50
50
  abortDeployment,
@@ -8,8 +8,8 @@ import {
8
8
  geoAttributes
9
9
  } from "../chunk-WWED74SG.js";
10
10
  import "../chunk-2DYA3X77.js";
11
- import "../chunk-ZKAH3APE.js";
12
11
  import "../chunk-FAJ3I2UQ.js";
12
+ import "../chunk-ZKAH3APE.js";
13
13
  import "../chunk-OWWCFJZ5.js";
14
14
  export {
15
15
  DEVICE_CONNECT_STATES,
@@ -43,12 +43,10 @@ var initialState = {
43
43
  // }
44
44
  },
45
45
  byStatus: {
46
- [import_constants.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
47
- active: { deviceIds: [], total: 0 },
48
- inactive: { deviceIds: [], total: 0 },
49
- [import_constants.DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
50
- [import_constants.DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
51
- [import_constants.DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
46
+ [import_constants.DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
47
+ [import_constants.DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
48
+ [import_constants.DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
49
+ [import_constants.DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }
52
50
  },
53
51
  deviceList: {
54
52
  deviceIds: [],
@@ -178,21 +176,19 @@ var devicesSlice = (0, import_toolkit.createSlice)({
178
176
  }
179
177
  state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
180
178
  },
181
- setInactiveDevices: (state, action) => {
182
- const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;
183
- state.byStatus.active.total = activeDeviceTotal;
184
- state.byStatus.inactive.total = inactiveDeviceTotal;
185
- },
186
179
  setDeviceReports: (state, action) => {
187
180
  state.reports = action.payload;
188
181
  },
189
182
  setDevicesByStatus: (state, action) => {
190
- const { forceUpdate, status, total, deviceIds } = action.payload;
191
- state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];
183
+ const { status, total, deviceIds } = action.payload;
184
+ if (total) {
185
+ state.byStatus[status].deviceIds = deviceIds;
186
+ state.byStatus[status].counts.total = total;
187
+ }
192
188
  },
193
189
  setDevicesCountByStatus: (state, action) => {
194
- const { count, status } = action.payload;
195
- state.byStatus[status].total = count;
190
+ const { countsPerTier, status } = action.payload;
191
+ state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu += tieredCount, 0) };
196
192
  },
197
193
  setDeviceLimits: (state, action) => {
198
194
  state.limits = action.payload;
@@ -209,7 +205,15 @@ var devicesSlice = (0, import_toolkit.createSlice)({
209
205
  const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
210
206
  if (!hasMultipleAuthSets && Object.values(import_constants.DEVICE_STATES).includes(device.status)) {
211
207
  const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
212
- state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
208
+ const deviceTier = device.attributes.tier || "standard";
209
+ state.byStatus[device.status] = {
210
+ deviceIds,
211
+ counts: {
212
+ ...state.byStatus[device.status].counts,
213
+ [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),
214
+ total: Math.max(0, state.byStatus[device.status].counts.total - 1)
215
+ }
216
+ };
213
217
  }
214
218
  }
215
219
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/devicesSlice/index.ts","../../src/constants.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type {\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: string[];\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\nexport type DeviceStatus = DeviceAuthState | 'active' | 'inactive';\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceStatus, { deviceIds: string[]; total: number }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setInactiveDevices: (state, action: PayloadAction<{ activeDeviceTotal: number; inactiveDeviceTotal: number }>) => {\n const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;\n state.byStatus.active.total = activeDeviceTotal;\n state.byStatus.inactive.total = inactiveDeviceTotal;\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; forceUpdate?: boolean; status: DeviceStatus; total: number }>) => {\n const { forceUpdate, status, total, deviceIds } = action.payload;\n state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ count: number; status: DeviceStatus }>) => {\n const { count, status } = action.payload;\n state.byStatus[status].total = count;\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n","// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//@ts-nocheck\nimport {\n ALL_DEVICES,\n ALL_DEVICE_STATES,\n ALL_RELEASES,\n APPLICATION_JSON_CONTENT_TYPE,\n APPLICATION_JWT_CONTENT_TYPE,\n ATTRIBUTE_SCOPES,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_DEFAULTS,\n DEVICE_STATES,\n PermissionTypes,\n SORTING_OPTIONS,\n alertChannels,\n apiRoot,\n apiUrl,\n auditLogsApiUrl,\n defaultPermissionSets,\n deploymentsApiUrl,\n deploymentsApiUrlV2,\n deviceAuthV2,\n deviceConfig,\n deviceConnect,\n emptyRole,\n emptyUiPermissions,\n headerNames,\n inventoryApiUrl,\n inventoryApiUrlV2,\n iotManagerBaseURL,\n limitDefault,\n maxSessionAge,\n monitorApiUrlv1,\n reportingApiUrl,\n rolesById,\n rolesByName,\n scopedPermissionAreas,\n serviceProviderRolesById,\n ssoIdpApiUrlv1,\n tenantadmApiUrlv1,\n tenantadmApiUrlv2,\n twoFAStates,\n uiPermissionsByArea,\n uiPermissionsById,\n useradmApiUrl,\n useradmApiUrlv1,\n useradmApiUrlv2\n} from '@northern.tech/utils/constants';\nimport type {\n AnyPermission,\n AuditLogPermission,\n DeploymentPermission,\n DeviceIssueOptionKey,\n GroupsPermission,\n PermissionObject,\n PermissionSet,\n PermissionSetId,\n ReleasesPermission,\n Role,\n ScopedPermissionsByAreaKey,\n SortOptions,\n UiPermissionsByAreaKey,\n UiPermissionsByIdKey,\n UiPermissionsDefinition,\n UserManagementPermission\n} from '@northern.tech/utils/constants';\n\nexport {\n alertChannels,\n ALL_DEVICE_STATES,\n ALL_DEVICES,\n ALL_RELEASES,\n APPLICATION_JSON_CONTENT_TYPE,\n APPLICATION_JWT_CONTENT_TYPE,\n ATTRIBUTE_SCOPES,\n apiRoot,\n apiUrl,\n auditLogsApiUrl,\n defaultPermissionSets,\n deploymentsApiUrl,\n deploymentsApiUrlV2,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_DEFAULTS,\n DEVICE_STATES,\n deviceAuthV2,\n deviceConfig,\n deviceConnect,\n emptyRole,\n emptyUiPermissions,\n headerNames,\n inventoryApiUrl,\n inventoryApiUrlV2,\n iotManagerBaseURL,\n monitorApiUrlv1,\n limitDefault,\n maxSessionAge,\n PermissionTypes,\n reportingApiUrl,\n rolesById,\n rolesByName,\n scopedPermissionAreas,\n serviceProviderRolesById,\n SORTING_OPTIONS,\n ssoIdpApiUrlv1,\n tenantadmApiUrlv1,\n tenantadmApiUrlv2,\n twoFAStates,\n uiPermissionsByArea,\n uiPermissionsById,\n useradmApiUrl,\n useradmApiUrlv1,\n useradmApiUrlv2\n};\n\nexport type {\n AnyPermission,\n AuditLogPermission,\n DeploymentPermission,\n DeviceIssueOptionKey,\n GroupsPermission,\n PermissionObject,\n PermissionSet,\n PermissionSetId,\n ReleasesPermission,\n Role,\n ScopedPermissionsByAreaKey,\n SortOptions,\n UiPermissionsByAreaKey,\n UiPermissionsByIdKey,\n UiPermissionsDefinition,\n UserManagementPermission\n};\n\nexport * from './appSlice/constants';\nexport * from './commonConstants';\nexport * from './deploymentsSlice/constants';\nexport * from './devicesSlice/constants';\nexport * from './monitorSlice/constants';\nexport * from './onboardingSlice/constants';\nexport * from './organizationSlice/constants';\nexport * from './releasesSlice/constants';\nexport * from './usersSlice/constants';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,qBAA6C;AAE7C,qBAA4B;;;ACZ5B,uBA8CO;;;AD3BA,IAAM,YAAY;AA+FlB,IAAM,eAAgC;AAAA,EAC3C,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN;AAAA,EACA,UAAU;AAAA,IACR,CAAC,+BAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpD,QAAQ,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IAClC,UAAU,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpC,CAAC,+BAAc,OAAO,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACnD,CAAC,+BAAc,OAAO,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACnD,CAAC,+BAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,EACtD;AAAA,EACA,YAAY;AAAA,IACV,WAAW,CAAC;AAAA,IACZ,GAAG;AAAA,IACH,oBAAoB,CAAC;AAAA,IACrB,gBAAgB,CAAC;AAAA,IACjB,WAAW,CAAC;AA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,SAAS,MAAM;AAAA,IAC9F;AAAA,IACA,yBAAyB,CAAC,OAAO,WAAmE;AAClG,YAAM,EAAE,OAAO,OAAO,IAAI,OAAO;AACjC,YAAM,SAAS,MAAM,EAAE,QAAQ;AAAA,IACjC;AAAA,IACA,iBAAiB,CAAC,OAAO,WAA4C;AACnE,YAAM,SAAS,OAAO;AAAA,IACxB;AAAA,IACA,gBAAgB,CAAC,OAAO,WAA4D;AAClF,YAAM,KAAK,OAAO,QAAQ,EAAE,IAAI;AAAA,QAC9B,GAAG,MAAM,KAAK,OAAO,QAAQ,EAAE;AAAA,QAC/B,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,IACA,4BAA4B,CAAC,OAAO,WAAiE;AACnG,YAAM,EAAE,UAAU,OAAO,IAAI,OAAO;AACpC,YAAM,SAAS,MAAM,KAAK,QAAQ;AAClC,YAAM,sBAAsB,UAAU,OAAO,YAAY,OAAO,UAAU,OAAO,aAAW,QAAQ,OAAO,MAAM,EAAE,SAAS,IAAI;AAChI,UAAI,CAAC,uBAAwB,OAAO,OAAO,8BAAa,EAAe,SAAS,OAAO,MAAM,GAAG;AAC9F,cAAM,YAAY,MAAM,SAAS,OAAO,MAAM,EAAE,UAAU,OAAO,QAAM,OAAO,QAAQ;AACtF,cAAM,SAAS,OAAO,MAAM,IAAI,EAAE,WAAW,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE,QAAQ,CAAC,EAAE;AAAA,MAC3G;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,aAAa;AACpC,IAAO,uBAAQ,aAAa;","names":[]}
1
+ {"version":3,"sources":["../../src/devicesSlice/index.ts","../../src/constants.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type {\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: string[];\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => (accu += tieredCount), 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n","// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//@ts-nocheck\nimport {\n ALL_DEVICES,\n ALL_DEVICE_STATES,\n ALL_RELEASES,\n APPLICATION_JSON_CONTENT_TYPE,\n APPLICATION_JWT_CONTENT_TYPE,\n ATTRIBUTE_SCOPES,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_DEFAULTS,\n DEVICE_STATES,\n PermissionTypes,\n SORTING_OPTIONS,\n alertChannels,\n apiRoot,\n apiUrl,\n auditLogsApiUrl,\n defaultPermissionSets,\n deploymentsApiUrl,\n deploymentsApiUrlV2,\n deviceAuthV2,\n deviceConfig,\n deviceConnect,\n emptyRole,\n emptyUiPermissions,\n headerNames,\n inventoryApiUrl,\n inventoryApiUrlV2,\n iotManagerBaseURL,\n limitDefault,\n maxSessionAge,\n monitorApiUrlv1,\n reportingApiUrl,\n rolesById,\n rolesByName,\n scopedPermissionAreas,\n serviceProviderRolesById,\n ssoIdpApiUrlv1,\n tenantadmApiUrlv1,\n tenantadmApiUrlv2,\n twoFAStates,\n uiPermissionsByArea,\n uiPermissionsById,\n useradmApiUrl,\n useradmApiUrlv1,\n useradmApiUrlv2\n} from '@northern.tech/utils/constants';\nimport type {\n AnyPermission,\n AuditLogPermission,\n DeploymentPermission,\n DeviceIssueOptionKey,\n GroupsPermission,\n PermissionObject,\n PermissionSet,\n PermissionSetId,\n ReleasesPermission,\n Role,\n ScopedPermissionsByAreaKey,\n SortOptions,\n UiPermissionsByAreaKey,\n UiPermissionsByIdKey,\n UiPermissionsDefinition,\n UserManagementPermission\n} from '@northern.tech/utils/constants';\n\nexport {\n alertChannels,\n ALL_DEVICE_STATES,\n ALL_DEVICES,\n ALL_RELEASES,\n APPLICATION_JSON_CONTENT_TYPE,\n APPLICATION_JWT_CONTENT_TYPE,\n ATTRIBUTE_SCOPES,\n apiRoot,\n apiUrl,\n auditLogsApiUrl,\n defaultPermissionSets,\n deploymentsApiUrl,\n deploymentsApiUrlV2,\n DEVICE_FILTERING_OPTIONS,\n DEVICE_ISSUE_OPTIONS,\n DEVICE_LIST_DEFAULTS,\n DEVICE_STATES,\n deviceAuthV2,\n deviceConfig,\n deviceConnect,\n emptyRole,\n emptyUiPermissions,\n headerNames,\n inventoryApiUrl,\n inventoryApiUrlV2,\n iotManagerBaseURL,\n monitorApiUrlv1,\n limitDefault,\n maxSessionAge,\n PermissionTypes,\n reportingApiUrl,\n rolesById,\n rolesByName,\n scopedPermissionAreas,\n serviceProviderRolesById,\n SORTING_OPTIONS,\n ssoIdpApiUrlv1,\n tenantadmApiUrlv1,\n tenantadmApiUrlv2,\n twoFAStates,\n uiPermissionsByArea,\n uiPermissionsById,\n useradmApiUrl,\n useradmApiUrlv1,\n useradmApiUrlv2\n};\n\nexport type {\n AnyPermission,\n AuditLogPermission,\n DeploymentPermission,\n DeviceIssueOptionKey,\n GroupsPermission,\n PermissionObject,\n PermissionSet,\n PermissionSetId,\n ReleasesPermission,\n Role,\n ScopedPermissionsByAreaKey,\n SortOptions,\n UiPermissionsByAreaKey,\n UiPermissionsByIdKey,\n UiPermissionsDefinition,\n UserManagementPermission\n};\n\nexport * from './appSlice/constants';\nexport * from './commonConstants';\nexport * from './deploymentsSlice/constants';\nexport * from './devicesSlice/constants';\nexport * from './monitorSlice/constants';\nexport * from './onboardingSlice/constants';\nexport * from './organizationSlice/constants';\nexport * from './releasesSlice/constants';\nexport * from './usersSlice/constants';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,qBAA6C;AAE7C,qBAA4B;;;ACZ5B,uBA8CO;;;AD3BA,IAAM,YAAY;AA8FlB,IAAM,eAAgC;AAAA,EAC3C,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN;AAAA,EACA,UAAU;AAAA,IACR,CAAC,+BAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAE,UAAU,GAAG,OAA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GAAG;AAC9F,cAAM,YAAY,MAAM,SAAS,OAAO,MAAM,EAAE,UAAU,OAAO,QAAM,OAAO,QAAQ;AACtF,cAAM,aAAc,OAAO,WAAW,QAAmB;AACzD,cAAM,SAAS,OAAO,MAAM,IAAI;AAAA,UAC9B;AAAA,UACA,QAAQ;AAAA,YACN,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE;AAAA,YACjC,CAAC,UAAU,GAAG,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE,OAAO,UAAU,IAAI,CAAC;AAAA,YAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE,OAAO,QAAQ,CAAC;AAAA,UACnE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,aAAa;AACpC,IAAO,uBAAQ,aAAa;","names":[]}
@@ -94,16 +94,17 @@ type FilteringAttributesConfig = {
94
94
  count: number;
95
95
  limit: number;
96
96
  };
97
- type DeviceStatus = DeviceAuthState | 'active' | 'inactive';
98
97
  type DeviceGroups = {
99
98
  byId: Record<string, DeviceGroup>;
100
99
  selectedGroup?: string;
101
100
  };
102
101
  type DeviceSliceType = {
103
102
  byId: Record<string, Device>;
104
- byStatus: Record<DeviceStatus, {
103
+ byStatus: Record<DeviceAuthState, {
104
+ counts: DeviceTierLimits & {
105
+ total: number;
106
+ };
105
107
  deviceIds: string[];
106
- total: number;
107
108
  }>;
108
109
  deviceList: DeviceListState;
109
110
  filteringAttributes: FilteringAttributes;
@@ -137,20 +138,15 @@ declare const devicesSlice: _reduxjs_toolkit.Slice<DeviceSliceType, {
137
138
  setFilterablesConfig: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<FilteringAttributesConfig>) => void;
138
139
  receivedDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<Record<string, Device>>) => void;
139
140
  setDeviceFilters: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceFilter[]>) => void;
140
- setInactiveDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
141
- activeDeviceTotal: number;
142
- inactiveDeviceTotal: number;
143
- }>) => void;
144
141
  setDeviceReports: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceReport[]>) => void;
145
142
  setDevicesByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
146
143
  deviceIds: string[];
147
- forceUpdate?: boolean;
148
- status: DeviceStatus;
144
+ status: DeviceAuthState;
149
145
  total: number;
150
146
  }>) => void;
151
147
  setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
152
- count: number;
153
- status: DeviceStatus;
148
+ countsPerTier: DeviceTierLimits;
149
+ status: DeviceAuthState;
154
150
  }>) => void;
155
151
  setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
156
152
  receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
@@ -182,20 +178,15 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
182
178
  setFilterablesConfig: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<FilteringAttributesConfig>) => void;
183
179
  receivedDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<Record<string, Device>>) => void;
184
180
  setDeviceFilters: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceFilter[]>) => void;
185
- setInactiveDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
186
- activeDeviceTotal: number;
187
- inactiveDeviceTotal: number;
188
- }>) => void;
189
181
  setDeviceReports: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceReport[]>) => void;
190
182
  setDevicesByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
191
183
  deviceIds: string[];
192
- forceUpdate?: boolean;
193
- status: DeviceStatus;
184
+ status: DeviceAuthState;
194
185
  total: number;
195
186
  }>) => void;
196
187
  setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
197
- count: number;
198
- status: DeviceStatus;
188
+ countsPerTier: DeviceTierLimits;
189
+ status: DeviceAuthState;
199
190
  }>) => void;
200
191
  setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
201
192
  receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
@@ -208,4 +199,4 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
208
199
  }, "devices">;
209
200
  declare const _default: redux.Reducer<DeviceSliceType>;
210
201
 
211
- export { type Device, type DeviceFilter, type DeviceGroup, type DeviceGroups, type DeviceListState, type DeviceSelectedAttribute, type DeviceSliceType, type DeviceStatus, type InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
202
+ export { type Device, type DeviceFilter, type DeviceGroup, type DeviceGroups, type DeviceListState, type DeviceSelectedAttribute, type DeviceSliceType, type InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
@@ -94,16 +94,17 @@ type FilteringAttributesConfig = {
94
94
  count: number;
95
95
  limit: number;
96
96
  };
97
- type DeviceStatus = DeviceAuthState | 'active' | 'inactive';
98
97
  type DeviceGroups = {
99
98
  byId: Record<string, DeviceGroup>;
100
99
  selectedGroup?: string;
101
100
  };
102
101
  type DeviceSliceType = {
103
102
  byId: Record<string, Device>;
104
- byStatus: Record<DeviceStatus, {
103
+ byStatus: Record<DeviceAuthState, {
104
+ counts: DeviceTierLimits & {
105
+ total: number;
106
+ };
105
107
  deviceIds: string[];
106
- total: number;
107
108
  }>;
108
109
  deviceList: DeviceListState;
109
110
  filteringAttributes: FilteringAttributes;
@@ -137,20 +138,15 @@ declare const devicesSlice: _reduxjs_toolkit.Slice<DeviceSliceType, {
137
138
  setFilterablesConfig: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<FilteringAttributesConfig>) => void;
138
139
  receivedDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<Record<string, Device>>) => void;
139
140
  setDeviceFilters: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceFilter[]>) => void;
140
- setInactiveDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
141
- activeDeviceTotal: number;
142
- inactiveDeviceTotal: number;
143
- }>) => void;
144
141
  setDeviceReports: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceReport[]>) => void;
145
142
  setDevicesByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
146
143
  deviceIds: string[];
147
- forceUpdate?: boolean;
148
- status: DeviceStatus;
144
+ status: DeviceAuthState;
149
145
  total: number;
150
146
  }>) => void;
151
147
  setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
152
- count: number;
153
- status: DeviceStatus;
148
+ countsPerTier: DeviceTierLimits;
149
+ status: DeviceAuthState;
154
150
  }>) => void;
155
151
  setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
156
152
  receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
@@ -182,20 +178,15 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
182
178
  setFilterablesConfig: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<FilteringAttributesConfig>) => void;
183
179
  receivedDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<Record<string, Device>>) => void;
184
180
  setDeviceFilters: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceFilter[]>) => void;
185
- setInactiveDevices: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
186
- activeDeviceTotal: number;
187
- inactiveDeviceTotal: number;
188
- }>) => void;
189
181
  setDeviceReports: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceReport[]>) => void;
190
182
  setDevicesByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
191
183
  deviceIds: string[];
192
- forceUpdate?: boolean;
193
- status: DeviceStatus;
184
+ status: DeviceAuthState;
194
185
  total: number;
195
186
  }>) => void;
196
187
  setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
197
- count: number;
198
- status: DeviceStatus;
188
+ countsPerTier: DeviceTierLimits;
189
+ status: DeviceAuthState;
199
190
  }>) => void;
200
191
  setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
201
192
  receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
@@ -208,4 +199,4 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
208
199
  }, "devices">;
209
200
  declare const _default: redux.Reducer<DeviceSliceType>;
210
201
 
211
- export { type Device, type DeviceFilter, type DeviceGroup, type DeviceGroups, type DeviceListState, type DeviceSelectedAttribute, type DeviceSliceType, type DeviceStatus, type InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
202
+ export { type Device, type DeviceFilter, type DeviceGroup, type DeviceGroups, type DeviceListState, type DeviceSelectedAttribute, type DeviceSliceType, type InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
@@ -4,11 +4,11 @@ import {
4
4
  devicesSlice_default,
5
5
  initialState,
6
6
  sliceName
7
- } from "../chunk-REZWSU22.js";
7
+ } from "../chunk-VODRLEDP.js";
8
8
  import "../chunk-WWED74SG.js";
9
9
  import "../chunk-2DYA3X77.js";
10
- import "../chunk-ZKAH3APE.js";
11
10
  import "../chunk-FAJ3I2UQ.js";
11
+ import "../chunk-ZKAH3APE.js";
12
12
  import "../chunk-OWWCFJZ5.js";
13
13
  export {
14
14
  actions,
@@ -39,12 +39,10 @@ var initialState = {
39
39
  // }
40
40
  },
41
41
  byStatus: {
42
- [import_constants.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
43
- active: { deviceIds: [], total: 0 },
44
- inactive: { deviceIds: [], total: 0 },
45
- [import_constants.DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
46
- [import_constants.DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
47
- [import_constants.DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
42
+ [import_constants.DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
43
+ [import_constants.DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
44
+ [import_constants.DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },
45
+ [import_constants.DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }
48
46
  },
49
47
  deviceList: {
50
48
  deviceIds: [],
@@ -174,21 +172,19 @@ var devicesSlice = (0, import_toolkit.createSlice)({
174
172
  }
175
173
  state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
176
174
  },
177
- setInactiveDevices: (state, action) => {
178
- const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;
179
- state.byStatus.active.total = activeDeviceTotal;
180
- state.byStatus.inactive.total = inactiveDeviceTotal;
181
- },
182
175
  setDeviceReports: (state, action) => {
183
176
  state.reports = action.payload;
184
177
  },
185
178
  setDevicesByStatus: (state, action) => {
186
- const { forceUpdate, status, total, deviceIds } = action.payload;
187
- state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];
179
+ const { status, total, deviceIds } = action.payload;
180
+ if (total) {
181
+ state.byStatus[status].deviceIds = deviceIds;
182
+ state.byStatus[status].counts.total = total;
183
+ }
188
184
  },
189
185
  setDevicesCountByStatus: (state, action) => {
190
- const { count, status } = action.payload;
191
- state.byStatus[status].total = count;
186
+ const { countsPerTier, status } = action.payload;
187
+ state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu += tieredCount, 0) };
192
188
  },
193
189
  setDeviceLimits: (state, action) => {
194
190
  state.limits = action.payload;
@@ -205,7 +201,15 @@ var devicesSlice = (0, import_toolkit.createSlice)({
205
201
  const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
206
202
  if (!hasMultipleAuthSets && Object.values(import_constants.DEVICE_STATES).includes(device.status)) {
207
203
  const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
208
- state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
204
+ const deviceTier = device.attributes.tier || "standard";
205
+ state.byStatus[device.status] = {
206
+ deviceIds,
207
+ counts: {
208
+ ...state.byStatus[device.status].counts,
209
+ [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),
210
+ total: Math.max(0, state.byStatus[device.status].counts.total - 1)
211
+ }
212
+ };
209
213
  }
210
214
  }
211
215
  }
@@ -285,12 +289,10 @@ var mockState = {
285
289
  }
286
290
  },
287
291
  byStatus: {
288
- accepted: { deviceIds: ["a1", "b1"], total: 2 },
289
- active: { deviceIds: [], total: 0 },
290
- inactive: { deviceIds: [], total: 0 },
291
- pending: { deviceIds: ["c1"], total: 1 },
292
- preauthorized: { deviceIds: [], total: 0 },
293
- rejected: { deviceIds: [], total: 0 }
292
+ accepted: { deviceIds: ["a1", "b1"], counts: { micro: 0, standard: 2, system: 0 } },
293
+ pending: { deviceIds: ["c1"], counts: { micro: 0, standard: 1, system: 0 } },
294
+ preauthorized: { deviceIds: [], counts: { micro: 0, standard: 0, system: 0 } },
295
+ rejected: { deviceIds: [], counts: { micro: 0, standard: 0, system: 0 } }
294
296
  },
295
297
  deviceList: {
296
298
  deviceIds: [],