@northern.tech/store 0.12.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.
- package/dist/actions.cjs +20 -16
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +7 -22
- package/dist/actions.d.ts +7 -22
- package/dist/actions.js +8 -8
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.d.cts +1 -1
- package/dist/appSlice/index.d.ts +1 -1
- package/dist/appSlice/index.js +1 -1
- package/dist/appSlice/mocks.cjs.map +1 -1
- package/dist/appSlice/mocks.js +1 -1
- package/dist/appSlice/selectors.d.cts +34 -528
- package/dist/appSlice/selectors.d.ts +34 -528
- package/dist/appSlice/thunks.cjs +45 -41
- package/dist/appSlice/thunks.cjs.map +1 -1
- package/dist/appSlice/thunks.d.cts +5 -3
- package/dist/appSlice/thunks.d.ts +5 -3
- package/dist/appSlice/thunks.js +14 -14
- package/dist/{chunk-QOFVCPRW.js → chunk-5PUF4LA5.js} +1 -1
- package/dist/chunk-5PUF4LA5.js.map +1 -0
- package/dist/{chunk-TKIOEF3B.js → chunk-6KAV62BW.js} +6 -6
- package/dist/{chunk-OFGCC3GM.js → chunk-7MTM3BDT.js} +1 -1
- package/dist/chunk-7MTM3BDT.js.map +1 -0
- package/dist/{chunk-4HSH7RH3.js → chunk-AR4FTKSL.js} +8 -8
- package/dist/{chunk-ZRMB4U7Z.js → chunk-BZAXFAGT.js} +4 -4
- package/dist/{chunk-ZNAJKEP2.js → chunk-CQXDAXQF.js} +1 -1
- package/dist/chunk-CQXDAXQF.js.map +1 -0
- package/dist/{chunk-5ZCZTTYX.js → chunk-EOZ665GA.js} +2 -2
- package/dist/{chunk-C5NXNZ7F.js → chunk-ETZVJXPD.js} +23 -30
- package/dist/chunk-ETZVJXPD.js.map +1 -0
- package/dist/{chunk-WCBHYLUK.js → chunk-KJ4BPXMB.js} +1 -1
- package/dist/chunk-KJ4BPXMB.js.map +1 -0
- package/dist/{chunk-C2LGE3P6.js → chunk-OLKM53RL.js} +1 -1
- package/dist/chunk-OLKM53RL.js.map +1 -0
- package/dist/{chunk-HLX5L3IM.js → chunk-PVCHKW35.js} +1 -1
- package/dist/chunk-PVCHKW35.js.map +1 -0
- package/dist/{chunk-REZWSU22.js → chunk-VODRLEDP.js} +21 -17
- package/dist/chunk-VODRLEDP.js.map +1 -0
- package/dist/{chunk-MH5WPYQI.js → chunk-X7NEALMI.js} +16 -9
- package/dist/chunk-X7NEALMI.js.map +1 -0
- package/dist/{chunk-OGUVURJ5.js → chunk-YFAIYNQG.js} +9 -9
- package/dist/commonSelectors.cjs +15 -8
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +178 -3523
- package/dist/commonSelectors.d.ts +178 -3523
- package/dist/commonSelectors.js +2 -2
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.d.cts +1 -1
- package/dist/deploymentsSlice/index.d.ts +1 -1
- package/dist/deploymentsSlice/index.js +1 -1
- package/dist/deploymentsSlice/mocks.cjs.map +1 -1
- package/dist/deploymentsSlice/mocks.js +1 -1
- package/dist/deploymentsSlice/selectors.d.cts +16 -138
- package/dist/deploymentsSlice/selectors.d.ts +16 -138
- package/dist/deploymentsSlice/thunks.cjs +45 -41
- package/dist/deploymentsSlice/thunks.cjs.map +1 -1
- package/dist/deploymentsSlice/thunks.d.cts +4 -2
- package/dist/deploymentsSlice/thunks.d.ts +4 -2
- package/dist/deploymentsSlice/thunks.js +14 -14
- package/dist/devicesSlice/index.cjs +20 -16
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.d.cts +11 -20
- package/dist/devicesSlice/index.d.ts +11 -20
- package/dist/devicesSlice/index.js +1 -1
- package/dist/devicesSlice/mocks.cjs +24 -22
- package/dist/devicesSlice/mocks.cjs.map +1 -1
- package/dist/devicesSlice/mocks.d.cts +20 -12
- package/dist/devicesSlice/mocks.d.ts +20 -12
- package/dist/devicesSlice/mocks.js +5 -7
- package/dist/devicesSlice/mocks.js.map +1 -1
- package/dist/devicesSlice/selectors.cjs +15 -8
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +207 -1730
- package/dist/devicesSlice/selectors.d.ts +207 -1730
- package/dist/devicesSlice/selectors.js +1 -1
- package/dist/devicesSlice/thunks.cjs +45 -43
- package/dist/devicesSlice/thunks.cjs.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +12 -46
- package/dist/devicesSlice/thunks.d.ts +12 -46
- package/dist/devicesSlice/thunks.js +14 -16
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.d.cts +1 -1
- package/dist/monitorSlice/index.d.ts +1 -1
- package/dist/monitorSlice/index.js +1 -1
- package/dist/monitorSlice/mocks.cjs.map +1 -1
- package/dist/monitorSlice/mocks.js +1 -1
- package/dist/monitorSlice/thunks.cjs +35 -24
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.d.cts +3 -2
- package/dist/monitorSlice/thunks.d.ts +3 -2
- package/dist/monitorSlice/thunks.js +12 -12
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.d.cts +1 -1
- package/dist/onboardingSlice/index.d.ts +1 -1
- package/dist/onboardingSlice/index.js +1 -1
- package/dist/onboardingSlice/mocks.cjs.map +1 -1
- package/dist/onboardingSlice/mocks.js +1 -1
- package/dist/onboardingSlice/thunks.cjs +45 -41
- package/dist/onboardingSlice/thunks.cjs.map +1 -1
- package/dist/onboardingSlice/thunks.d.cts +7 -15
- package/dist/onboardingSlice/thunks.d.ts +7 -15
- package/dist/onboardingSlice/thunks.js +14 -14
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +41 -31
- package/dist/organizationSlice/index.d.ts +41 -31
- package/dist/organizationSlice/index.js +1 -1
- package/dist/organizationSlice/mocks.cjs.map +1 -1
- package/dist/organizationSlice/mocks.js +1 -1
- package/dist/organizationSlice/selectors.d.cts +42 -659
- package/dist/organizationSlice/selectors.d.ts +42 -659
- package/dist/organizationSlice/thunks.cjs +45 -41
- package/dist/organizationSlice/thunks.cjs.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +4 -1
- package/dist/organizationSlice/thunks.d.ts +4 -1
- package/dist/organizationSlice/thunks.js +14 -14
- package/dist/organizationSlice/types.cjs.map +1 -1
- package/dist/organizationSlice/types.d.cts +2 -12
- package/dist/organizationSlice/types.d.ts +2 -12
- package/dist/releasesSlice/mocks.d.cts +7 -1
- package/dist/releasesSlice/mocks.d.ts +7 -1
- package/dist/releasesSlice/selectors.d.cts +155 -930
- package/dist/releasesSlice/selectors.d.ts +155 -930
- package/dist/releasesSlice/thunks.cjs +35 -24
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +4 -2
- package/dist/releasesSlice/thunks.d.ts +4 -2
- package/dist/releasesSlice/thunks.js +12 -12
- package/dist/selectors.cjs +15 -8
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +6 -3
- package/dist/selectors.d.ts +6 -3
- package/dist/selectors.js +2 -2
- package/dist/store.cjs +20 -16
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +40 -658
- package/dist/store.d.ts +40 -658
- package/dist/store.js +9 -9
- package/dist/storehooks.cjs +45 -41
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.js +14 -14
- package/dist/thunks.cjs +45 -43
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +7 -5
- package/dist/thunks.d.ts +7 -5
- package/dist/thunks.js +14 -16
- package/dist/useDeploymentDevice.cjs +45 -41
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/useDeploymentDevice.js +14 -14
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.d.cts +46 -46
- package/dist/usersSlice/index.d.ts +46 -46
- package/dist/usersSlice/index.js +1 -1
- package/dist/usersSlice/mocks.cjs.map +1 -1
- package/dist/usersSlice/mocks.js +1 -1
- package/dist/usersSlice/selectors.d.cts +75 -1436
- package/dist/usersSlice/selectors.d.ts +75 -1436
- package/dist/usersSlice/thunks.cjs +45 -41
- package/dist/usersSlice/thunks.cjs.map +1 -1
- package/dist/usersSlice/thunks.d.cts +3 -1
- package/dist/usersSlice/thunks.d.ts +3 -1
- package/dist/usersSlice/thunks.js +14 -14
- package/package.json +1 -1
- package/dist/chunk-C2LGE3P6.js.map +0 -1
- package/dist/chunk-C5NXNZ7F.js.map +0 -1
- package/dist/chunk-HLX5L3IM.js.map +0 -1
- package/dist/chunk-MH5WPYQI.js.map +0 -1
- package/dist/chunk-OFGCC3GM.js.map +0 -1
- package/dist/chunk-QOFVCPRW.js.map +0 -1
- package/dist/chunk-REZWSU22.js.map +0 -1
- package/dist/chunk-WCBHYLUK.js.map +0 -1
- package/dist/chunk-ZNAJKEP2.js.map +0 -1
- /package/dist/{chunk-TKIOEF3B.js.map → chunk-6KAV62BW.js.map} +0 -0
- /package/dist/{chunk-4HSH7RH3.js.map → chunk-AR4FTKSL.js.map} +0 -0
- /package/dist/{chunk-ZRMB4U7Z.js.map → chunk-BZAXFAGT.js.map} +0 -0
- /package/dist/{chunk-5ZCZTTYX.js.map → chunk-EOZ665GA.js.map} +0 -0
- /package/dist/{chunk-OGUVURJ5.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 '
|
|
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 '
|
|
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,32 +13,32 @@ import {
|
|
|
13
13
|
saveDeltaDeploymentsConfig,
|
|
14
14
|
setDeploymentsState,
|
|
15
15
|
updateDeploymentControlMap
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
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-
|
|
22
|
+
import "../chunk-AR4FTKSL.js";
|
|
23
23
|
import "../chunk-TRKA7XYU.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
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-
|
|
34
|
+
import "../chunk-EOZ665GA.js";
|
|
35
35
|
import "../chunk-GGBE6KJV.js";
|
|
36
36
|
import "../chunk-7QKCBSFU.js";
|
|
37
37
|
import "../chunk-3NOV7X4M.js";
|
|
38
38
|
import "../chunk-YO22XLHI.js";
|
|
39
39
|
import "../chunk-JIS4PA3R.js";
|
|
40
40
|
import "../chunk-WR6RQKF5.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-X7NEALMI.js";
|
|
42
42
|
import "../chunk-BYUPW7RA.js";
|
|
43
43
|
import "../chunk-GX2TWNLC.js";
|
|
44
44
|
import "../chunk-WWED74SG.js";
|
|
@@ -43,12 +43,10 @@ var initialState = {
|
|
|
43
43
|
// }
|
|
44
44
|
},
|
|
45
45
|
byStatus: {
|
|
46
|
-
[import_constants.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[import_constants.DEVICE_STATES.
|
|
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 {
|
|
191
|
-
|
|
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 {
|
|
195
|
-
state.byStatus[status].
|
|
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
|
-
|
|
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,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AM,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;AA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,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,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<
|
|
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
|
-
|
|
148
|
-
status: DeviceStatus;
|
|
144
|
+
status: DeviceAuthState;
|
|
149
145
|
total: number;
|
|
150
146
|
}>) => void;
|
|
151
147
|
setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
152
|
-
|
|
153
|
-
status:
|
|
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
|
-
|
|
193
|
-
status: DeviceStatus;
|
|
184
|
+
status: DeviceAuthState;
|
|
194
185
|
total: number;
|
|
195
186
|
}>) => void;
|
|
196
187
|
setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
197
|
-
|
|
198
|
-
status:
|
|
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
|
|
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<
|
|
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
|
-
|
|
148
|
-
status: DeviceStatus;
|
|
144
|
+
status: DeviceAuthState;
|
|
149
145
|
total: number;
|
|
150
146
|
}>) => void;
|
|
151
147
|
setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
152
|
-
|
|
153
|
-
status:
|
|
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
|
-
|
|
193
|
-
status: DeviceStatus;
|
|
184
|
+
status: DeviceAuthState;
|
|
194
185
|
total: number;
|
|
195
186
|
}>) => void;
|
|
196
187
|
setDevicesCountByStatus: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
197
|
-
|
|
198
|
-
status:
|
|
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
|
|
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 };
|
|
@@ -39,12 +39,10 @@ var initialState = {
|
|
|
39
39
|
// }
|
|
40
40
|
},
|
|
41
41
|
byStatus: {
|
|
42
|
-
[import_constants.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[import_constants.DEVICE_STATES.
|
|
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 {
|
|
187
|
-
|
|
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 {
|
|
191
|
-
state.byStatus[status].
|
|
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
|
-
|
|
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"],
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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: [],
|