@northern.tech/store 0.9.0 → 0.11.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 +7 -3
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +1 -1
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js +6 -6
- package/dist/api/general-api.js +1 -1
- package/dist/api/users-api.js +1 -1
- package/dist/appSlice/index.js +1 -1
- package/dist/appSlice/mocks.js +1 -1
- package/dist/appSlice/thunks.cjs +17 -8
- package/dist/appSlice/thunks.cjs.map +1 -1
- package/dist/appSlice/thunks.js +15 -15
- package/dist/auth.js +1 -1
- package/dist/{chunk-ITGVP27I.js → chunk-4FNSLYK5.js} +11 -11
- package/dist/{chunk-MUZHPRLI.js → chunk-6KNRR7A5.js} +4 -4
- package/dist/{chunk-ZOF45MII.js → chunk-CUU3N6KW.js} +13 -13
- package/dist/{chunk-ZRSVD5QY.js → chunk-I3H5EFZK.js} +15 -15
- package/dist/{chunk-UVYRVFZX.js → chunk-MH5WPYQI.js} +11 -5
- package/dist/chunk-MH5WPYQI.js.map +1 -0
- package/dist/{chunk-VWNMAIL2.js → chunk-NVNO3I3K.js} +37 -28
- package/dist/chunk-NVNO3I3K.js.map +1 -0
- package/dist/{chunk-KQ6AGXRK.js → chunk-REZWSU22.js} +8 -4
- package/dist/chunk-REZWSU22.js.map +1 -0
- package/dist/{chunk-CKF76YO4.js → chunk-RFF52JYU.js} +1 -1
- package/dist/chunk-RFF52JYU.js.map +1 -0
- package/dist/{chunk-N3TU2WH2.js → chunk-X3NF4KNC.js} +5 -5
- package/dist/{chunk-VANBSJS5.js → chunk-ZNAJKEP2.js} +1 -1
- package/dist/chunk-ZNAJKEP2.js.map +1 -0
- package/dist/commonConstants.js +1 -1
- package/dist/commonSelectors.cjs +8 -3
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.js +6 -6
- package/dist/constants.js +1 -1
- package/dist/deploymentsSlice/constants.js +1 -1
- package/dist/deploymentsSlice/index.js +1 -1
- package/dist/deploymentsSlice/mocks.js +1 -1
- package/dist/deploymentsSlice/selectors.js +1 -1
- package/dist/deploymentsSlice/thunks.cjs +17 -8
- package/dist/deploymentsSlice/thunks.cjs.map +1 -1
- package/dist/deploymentsSlice/thunks.js +15 -15
- package/dist/devicesSlice/constants.js +1 -1
- package/dist/devicesSlice/index.cjs +7 -3
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.d.cts +4 -4
- package/dist/devicesSlice/index.d.ts +4 -4
- package/dist/devicesSlice/index.js +2 -2
- package/dist/devicesSlice/mocks.cjs +8 -4
- package/dist/devicesSlice/mocks.cjs.map +1 -1
- package/dist/devicesSlice/mocks.d.cts +5 -1
- package/dist/devicesSlice/mocks.d.ts +5 -1
- package/dist/devicesSlice/mocks.js +3 -3
- package/dist/devicesSlice/mocks.js.map +1 -1
- package/dist/devicesSlice/selectors.cjs +12 -5
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +310 -3
- package/dist/devicesSlice/selectors.d.ts +310 -3
- package/dist/devicesSlice/selectors.js +6 -4
- package/dist/devicesSlice/thunks.cjs +19 -10
- package/dist/devicesSlice/thunks.cjs.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +5 -5
- package/dist/devicesSlice/thunks.d.ts +5 -5
- package/dist/devicesSlice/thunks.js +17 -17
- package/dist/liststatehook.js +1 -1
- package/dist/locationutils.js +1 -1
- package/dist/monitorSlice/index.js +1 -1
- package/dist/monitorSlice/mocks.js +1 -1
- package/dist/monitorSlice/thunks.cjs +15 -6
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.js +13 -13
- 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 +27 -9
- package/dist/onboardingSlice/thunks.cjs.map +1 -1
- package/dist/onboardingSlice/thunks.js +15 -15
- package/dist/organizationSlice/constants.js +1 -1
- package/dist/organizationSlice/index.js +1 -1
- package/dist/organizationSlice/mocks.js +1 -1
- package/dist/organizationSlice/selectors.js +1 -1
- package/dist/organizationSlice/thunks.cjs +19 -10
- package/dist/organizationSlice/thunks.cjs.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +3 -3
- package/dist/organizationSlice/thunks.d.ts +3 -3
- package/dist/organizationSlice/thunks.js +15 -15
- package/dist/releasesSlice/index.js +1 -1
- package/dist/releasesSlice/mocks.js +1 -1
- package/dist/releasesSlice/selectors.js +1 -1
- package/dist/releasesSlice/thunks.cjs +15 -6
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.js +13 -13
- package/dist/selectors.cjs +12 -5
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +37 -35
- package/dist/sockethook.js +1 -1
- package/dist/store.cjs +7 -3
- package/dist/store.cjs.map +1 -1
- package/dist/store.js +7 -7
- package/dist/storehooks.cjs +38 -17
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.js +26 -23
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +31 -13
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +1 -1
- package/dist/thunks.d.ts +1 -1
- package/dist/thunks.js +17 -17
- package/dist/useDeploymentDevice.cjs +17 -8
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/useDeploymentDevice.js +16 -16
- package/dist/usersSlice/constants.js +1 -1
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.d.cts +1 -1
- package/dist/usersSlice/index.d.ts +1 -1
- package/dist/usersSlice/index.js +2 -2
- package/dist/usersSlice/mocks.cjs.map +1 -1
- package/dist/usersSlice/mocks.js +2 -2
- package/dist/usersSlice/selectors.js +1 -1
- package/dist/usersSlice/thunks.cjs +17 -8
- package/dist/usersSlice/thunks.cjs.map +1 -1
- package/dist/usersSlice/thunks.js +15 -15
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CKF76YO4.js.map +0 -1
- package/dist/chunk-KQ6AGXRK.js.map +0 -1
- package/dist/chunk-UVYRVFZX.js.map +0 -1
- package/dist/chunk-VANBSJS5.js.map +0 -1
- package/dist/chunk-VWNMAIL2.js.map +0 -1
- /package/dist/{chunk-ITGVP27I.js.map → chunk-4FNSLYK5.js.map} +0 -0
- /package/dist/{chunk-MUZHPRLI.js.map → chunk-6KNRR7A5.js.map} +0 -0
- /package/dist/{chunk-ZOF45MII.js.map → chunk-CUU3N6KW.js.map} +0 -0
- /package/dist/{chunk-ZRSVD5QY.js.map → chunk-I3H5EFZK.js.map} +0 -0
- /package/dist/{chunk-N3TU2WH2.js.map → chunk-X3NF4KNC.js.map} +0 -0
|
@@ -13,38 +13,38 @@ 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-NVNO3I3K.js";
|
|
17
|
+
import "../chunk-6KNRR7A5.js";
|
|
18
|
+
import "../chunk-X3NF4KNC.js";
|
|
19
|
+
import "../chunk-CUU3N6KW.js";
|
|
20
20
|
import "../chunk-Y3DJIMEN.js";
|
|
21
21
|
import "../chunk-5M6EUVNO.js";
|
|
22
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-4FNSLYK5.js";
|
|
23
|
+
import "../chunk-C2LGE3P6.js";
|
|
24
|
+
import "../chunk-RFF52JYU.js";
|
|
23
25
|
import "../chunk-TRKA7XYU.js";
|
|
24
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-ZNAJKEP2.js";
|
|
25
27
|
import "../chunk-QOFVCPRW.js";
|
|
26
28
|
import "../chunk-HLX5L3IM.js";
|
|
27
|
-
import "../chunk-VANBSJS5.js";
|
|
28
|
-
import "../chunk-KQ6AGXRK.js";
|
|
29
29
|
import "../chunk-OFGCC3GM.js";
|
|
30
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-REZWSU22.js";
|
|
31
31
|
import "../chunk-FDSMCFV5.js";
|
|
32
32
|
import "../chunk-53W2NRSL.js";
|
|
33
33
|
import "../chunk-NMAXZ3ZY.js";
|
|
34
|
-
import "../chunk-
|
|
35
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-I3H5EFZK.js";
|
|
35
|
+
import "../chunk-WR6RQKF5.js";
|
|
36
36
|
import "../chunk-7QKCBSFU.js";
|
|
37
|
+
import "../chunk-GGBE6KJV.js";
|
|
38
|
+
import "../chunk-JIS4PA3R.js";
|
|
37
39
|
import "../chunk-3NOV7X4M.js";
|
|
40
|
+
import "../chunk-MH5WPYQI.js";
|
|
38
41
|
import "../chunk-YO22XLHI.js";
|
|
39
|
-
import "../chunk-JIS4PA3R.js";
|
|
40
|
-
import "../chunk-WR6RQKF5.js";
|
|
41
|
-
import "../chunk-UVYRVFZX.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-FAJ3I2UQ.js";
|
|
47
46
|
import "../chunk-ZKAH3APE.js";
|
|
47
|
+
import "../chunk-FAJ3I2UQ.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-FAJ3I2UQ.js";
|
|
12
11
|
import "../chunk-ZKAH3APE.js";
|
|
12
|
+
import "../chunk-FAJ3I2UQ.js";
|
|
13
13
|
import "../chunk-OWWCFJZ5.js";
|
|
14
14
|
export {
|
|
15
15
|
DEVICE_CONNECT_STATES,
|
|
@@ -84,7 +84,11 @@ var initialState = {
|
|
|
84
84
|
// { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
|
|
85
85
|
],
|
|
86
86
|
total: 0,
|
|
87
|
-
|
|
87
|
+
limits: {
|
|
88
|
+
standard: 0,
|
|
89
|
+
micro: 0,
|
|
90
|
+
system: 0
|
|
91
|
+
},
|
|
88
92
|
groups: {
|
|
89
93
|
byId: {
|
|
90
94
|
// groupName: { deviceIds: [], total: 0, filters: [] },
|
|
@@ -190,8 +194,8 @@ var devicesSlice = (0, import_toolkit.createSlice)({
|
|
|
190
194
|
const { count, status } = action.payload;
|
|
191
195
|
state.byStatus[status].total = count;
|
|
192
196
|
},
|
|
193
|
-
|
|
194
|
-
state.
|
|
197
|
+
setDeviceLimits: (state, action) => {
|
|
198
|
+
state.limits = action.payload;
|
|
195
199
|
},
|
|
196
200
|
receivedDevice: (state, action) => {
|
|
197
201
|
state.byId[action.payload.id] = {
|
|
@@ -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 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 limit: number;\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 limit: 0,\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 setDeviceLimit: (state, action: PayloadAction<number>) => {\n state.limit = 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;AAuBA,qBAA6C;AAE7C,qBAA4B;;;ACX5B,uBA8CO;;;AD5BA,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,W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AAE,aAAa,QAAQ,OAAO,UAAU,IAAI,OAAO;AACzD,YAAM,SAAS,MAAM,IAAI,SAAS,cAAc,EAAE,WAAW,MAAM,IAAI,MAAM,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,gBAAgB,CAAC,OAAO,WAAkC;AACxD,YAAM,QAAQ,OAAO;AAAA,IACvB;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};\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,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,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":[]}
|
|
@@ -2,7 +2,7 @@ import * as redux from 'redux';
|
|
|
2
2
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
3
3
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
4
4
|
import * as immer from 'immer';
|
|
5
|
-
import { SortCriteria, Device as Device$1, DeviceConfiguration, ConnectionState, MonitorConfiguration, Status, DeviceState } from '@northern.tech/types/MenderTypes';
|
|
5
|
+
import { SortCriteria, Device as Device$1, DeviceConfiguration, ConnectionState, MonitorConfiguration, Status, DeviceState, DeviceTierLimits } from '@northern.tech/types/MenderTypes';
|
|
6
6
|
import { DeviceIssueOptionKey, SortOptions, ALL_DEVICE_STATES } from '@northern.tech/utils/constants';
|
|
7
7
|
import { FilterOperator } from '../commonConstants.cjs';
|
|
8
8
|
import { DeviceAuthState } from './constants.cjs';
|
|
@@ -111,7 +111,7 @@ type DeviceSliceType = {
|
|
|
111
111
|
filteringAttributesLimit: number;
|
|
112
112
|
filters: DeviceFilter[];
|
|
113
113
|
groups: DeviceGroups;
|
|
114
|
-
|
|
114
|
+
limits: DeviceTierLimits;
|
|
115
115
|
reports: DeviceReport[];
|
|
116
116
|
total: number;
|
|
117
117
|
};
|
|
@@ -152,7 +152,7 @@ declare const devicesSlice: _reduxjs_toolkit.Slice<DeviceSliceType, {
|
|
|
152
152
|
count: number;
|
|
153
153
|
status: DeviceStatus;
|
|
154
154
|
}>) => void;
|
|
155
|
-
|
|
155
|
+
setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
|
|
156
156
|
receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
157
157
|
id: string;
|
|
158
158
|
} & Partial<Device>>) => void;
|
|
@@ -197,7 +197,7 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
|
|
|
197
197
|
count: number;
|
|
198
198
|
status: DeviceStatus;
|
|
199
199
|
}>) => void;
|
|
200
|
-
|
|
200
|
+
setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
|
|
201
201
|
receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
202
202
|
id: string;
|
|
203
203
|
} & Partial<Device>>) => void;
|
|
@@ -2,7 +2,7 @@ import * as redux from 'redux';
|
|
|
2
2
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
3
3
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
4
4
|
import * as immer from 'immer';
|
|
5
|
-
import { SortCriteria, Device as Device$1, DeviceConfiguration, ConnectionState, MonitorConfiguration, Status, DeviceState } from '@northern.tech/types/MenderTypes';
|
|
5
|
+
import { SortCriteria, Device as Device$1, DeviceConfiguration, ConnectionState, MonitorConfiguration, Status, DeviceState, DeviceTierLimits } from '@northern.tech/types/MenderTypes';
|
|
6
6
|
import { DeviceIssueOptionKey, SortOptions, ALL_DEVICE_STATES } from '@northern.tech/utils/constants';
|
|
7
7
|
import { FilterOperator } from '../commonConstants.js';
|
|
8
8
|
import { DeviceAuthState } from './constants.js';
|
|
@@ -111,7 +111,7 @@ type DeviceSliceType = {
|
|
|
111
111
|
filteringAttributesLimit: number;
|
|
112
112
|
filters: DeviceFilter[];
|
|
113
113
|
groups: DeviceGroups;
|
|
114
|
-
|
|
114
|
+
limits: DeviceTierLimits;
|
|
115
115
|
reports: DeviceReport[];
|
|
116
116
|
total: number;
|
|
117
117
|
};
|
|
@@ -152,7 +152,7 @@ declare const devicesSlice: _reduxjs_toolkit.Slice<DeviceSliceType, {
|
|
|
152
152
|
count: number;
|
|
153
153
|
status: DeviceStatus;
|
|
154
154
|
}>) => void;
|
|
155
|
-
|
|
155
|
+
setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
|
|
156
156
|
receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
157
157
|
id: string;
|
|
158
158
|
} & Partial<Device>>) => void;
|
|
@@ -197,7 +197,7 @@ declare const actions: _reduxjs_toolkit.CaseReducerActions<{
|
|
|
197
197
|
count: number;
|
|
198
198
|
status: DeviceStatus;
|
|
199
199
|
}>) => void;
|
|
200
|
-
|
|
200
|
+
setDeviceLimits: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<DeviceTierLimits>) => void;
|
|
201
201
|
receivedDevice: (state: immer.WritableDraft<DeviceSliceType>, action: PayloadAction<{
|
|
202
202
|
id: string;
|
|
203
203
|
} & Partial<Device>>) => void;
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
devicesSlice_default,
|
|
5
5
|
initialState,
|
|
6
6
|
sliceName
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-REZWSU22.js";
|
|
8
8
|
import "../chunk-WWED74SG.js";
|
|
9
9
|
import "../chunk-2DYA3X77.js";
|
|
10
|
-
import "../chunk-FAJ3I2UQ.js";
|
|
11
10
|
import "../chunk-ZKAH3APE.js";
|
|
11
|
+
import "../chunk-FAJ3I2UQ.js";
|
|
12
12
|
import "../chunk-OWWCFJZ5.js";
|
|
13
13
|
export {
|
|
14
14
|
actions,
|
|
@@ -80,7 +80,11 @@ var initialState = {
|
|
|
80
80
|
// { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
|
|
81
81
|
],
|
|
82
82
|
total: 0,
|
|
83
|
-
|
|
83
|
+
limits: {
|
|
84
|
+
standard: 0,
|
|
85
|
+
micro: 0,
|
|
86
|
+
system: 0
|
|
87
|
+
},
|
|
84
88
|
groups: {
|
|
85
89
|
byId: {
|
|
86
90
|
// groupName: { deviceIds: [], total: 0, filters: [] },
|
|
@@ -186,8 +190,8 @@ var devicesSlice = (0, import_toolkit.createSlice)({
|
|
|
186
190
|
const { count, status } = action.payload;
|
|
187
191
|
state.byStatus[status].total = count;
|
|
188
192
|
},
|
|
189
|
-
|
|
190
|
-
state.
|
|
193
|
+
setDeviceLimits: (state, action) => {
|
|
194
|
+
state.limits = action.payload;
|
|
191
195
|
},
|
|
192
196
|
receivedDevice: (state, action) => {
|
|
193
197
|
state.byId[action.payload.id] = {
|
|
@@ -327,7 +331,7 @@ var mockState = {
|
|
|
327
331
|
},
|
|
328
332
|
selectedGroup: void 0
|
|
329
333
|
},
|
|
330
|
-
|
|
334
|
+
limits: { standard: 500, micro: 0, system: 0 }
|
|
331
335
|
};
|
|
332
336
|
// Annotate the CommonJS export names for ESM import in node:
|
|
333
337
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/devicesSlice/mocks.ts","../../src/constants.ts","../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2025 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 { DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport { initialState } from './index';\n\nconst deviceTypes = { qemu: 'qemux86-64' };\nconst checkInTimeRounded = '2019-01-01T00:00:00.000Z';\nconst checkInTimeExact = '2019-01-01T10:25:00.000Z';\nconst defaultMacAddress = 'dc:a6:32:12:ad:bf';\nconst defaultCreationDate = '2019-01-13T06:25:00.000Z';\n\nexport const mockState = {\n ...initialState,\n byId: {\n a1: {\n id: 'a1',\n attributes: {\n device_type: ['raspberrypi4'],\n ipv4_wlan0: '192.168.10.141/24'\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n b1: {\n id: 'b1',\n attributes: {\n ipv4_wlan0: '192.168.10.141/24',\n device_type: [deviceTypes.qemu]\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n c1: {\n id: 'c1',\n auth_sets: [],\n attributes: {\n device_type: ['qemux86-128']\n }\n }\n },\n byStatus: {\n accepted: { deviceIds: ['a1', 'b1'], total: 2 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n pending: { deviceIds: ['c1'], total: 1 },\n preauthorized: { deviceIds: [], total: 0 },\n rejected: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n isLoading: false,\n page: 1,\n perPage: 20,\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 },\n filteringAttributes: {\n identityAttributes: ['mac'],\n inventoryAttributes: ['artifact_name'],\n systemAttributes: [],\n tagAttributes: []\n },\n filteringAttributesLimit: 10,\n filters: [],\n groups: {\n byId: {\n testGroup: {\n deviceIds: ['a1', 'b1'],\n filters: [],\n total: 2\n },\n testGroupDynamic: {\n id: 'filter1',\n name: 'filter1',\n filters: [{ scope: 'system', key: 'group', operator: '$eq', value: 'things' }]\n } as const\n },\n selectedGroup: undefined\n },\n limit: 500\n};\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","// 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 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 limit: number;\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 limit: 0,\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 setDeviceLimit: (state, action: PayloadAction<number>) => {\n state.limit = 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,uBA8CO;;;ACrCP,qBAA6C;AAE7C,qBAA4B;AAOrB,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;AAAA,IACZ,MAAM;AAAA,MACJ,WAAW,iCAAgB;AAAA;AAAA;AAAA,IAG7B;AAAA,IACA,OAAO,+BAAc;AAAA,IACrB,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AAAA,EACA,SAAS;AAAA;AAAA,EAET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AAA,IACV,WAAW,CAAC;AAAA,IACZ,WAAW;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,IACT,oBAAoB,CAAC;AAAA,IACrB,gBAAgB,CAAC;AAAA,IACjB,WAAW,CAAC;AAAA,IACZ,MAAM;AAAA,MACJ,WAAW,iCAAgB;AAAA;AAAA;AAAA,IAG7B;AAAA,IACA,OAAO,+BAAc;AAAA,IACrB,OAAO;AAAA,EACT;AAAA,EACA,qBAAqB;AAAA,IACnB,oBAAoB,CAAC,KAAK;AAAA,IAC1B,qBAAqB,CAAC,eAAe;AAAA,IACrC,kBAAkB,CAAC;AAAA,IACnB,eAAe,CAAC;AAAA,EAClB;AAAA,EACA,0BAA0B;AAAA,EAC1B,SAAS,CAAC;AAAA,EACV,QAAQ;AAAA,IACN,MAAM;AAAA,MACJ,WAAW;AAAA,QACT,WAAW,CAAC,MAAM,IAAI;AAAA,QACtB,SAAS,CAAC;AAAA,QACV,OAAO;AAAA,MACT;AAAA,MACA,kBAAkB;AAAA,QAChB,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,SAAS,CAAC,EAAE,OAAO,UAAU,KAAK,SAAS,UAAU,OAAO,OAAO,SAAS,CAAC;AAAA,MAC/E;AAAA,IACF;AAAA,IACA,eAAe;AAAA,EACjB;AAAA,EACA,OAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/devicesSlice/mocks.ts","../../src/constants.ts","../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2025 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 { DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport { initialState } from './index';\n\nconst deviceTypes = { qemu: 'qemux86-64' };\nconst checkInTimeRounded = '2019-01-01T00:00:00.000Z';\nconst checkInTimeExact = '2019-01-01T10:25:00.000Z';\nconst defaultMacAddress = 'dc:a6:32:12:ad:bf';\nconst defaultCreationDate = '2019-01-13T06:25:00.000Z';\n\nexport const mockState = {\n ...initialState,\n byId: {\n a1: {\n id: 'a1',\n attributes: {\n device_type: ['raspberrypi4'],\n ipv4_wlan0: '192.168.10.141/24'\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n b1: {\n id: 'b1',\n attributes: {\n ipv4_wlan0: '192.168.10.141/24',\n device_type: [deviceTypes.qemu]\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n c1: {\n id: 'c1',\n auth_sets: [],\n attributes: {\n device_type: ['qemux86-128']\n }\n }\n },\n byStatus: {\n accepted: { deviceIds: ['a1', 'b1'], total: 2 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n pending: { deviceIds: ['c1'], total: 1 },\n preauthorized: { deviceIds: [], total: 0 },\n rejected: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n isLoading: false,\n page: 1,\n perPage: 20,\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 },\n filteringAttributes: {\n identityAttributes: ['mac'],\n inventoryAttributes: ['artifact_name'],\n systemAttributes: [],\n tagAttributes: []\n },\n filteringAttributesLimit: 10,\n filters: [],\n groups: {\n byId: {\n testGroup: {\n deviceIds: ['a1', 'b1'],\n filters: [],\n total: 2\n },\n testGroupDynamic: {\n id: 'filter1',\n name: 'filter1',\n filters: [{ scope: 'system', key: 'group', operator: '$eq', value: 'things' }]\n } as const\n },\n selectedGroup: undefined\n },\n limits: { standard: 500, micro: 0, system: 0 }\n};\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","// 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,uBA8CO;;;ACpCP,qBAA6C;AAE7C,qBAA4B;AAOrB,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;AA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@ declare const mockState: {
|
|
|
134
134
|
};
|
|
135
135
|
selectedGroup: undefined;
|
|
136
136
|
};
|
|
137
|
-
|
|
137
|
+
limits: {
|
|
138
|
+
standard: number;
|
|
139
|
+
micro: number;
|
|
140
|
+
system: number;
|
|
141
|
+
};
|
|
138
142
|
filteringAttributesConfig: {
|
|
139
143
|
attributes: Record<string, string[]>;
|
|
140
144
|
count: number;
|
|
@@ -134,7 +134,11 @@ declare const mockState: {
|
|
|
134
134
|
};
|
|
135
135
|
selectedGroup: undefined;
|
|
136
136
|
};
|
|
137
|
-
|
|
137
|
+
limits: {
|
|
138
|
+
standard: number;
|
|
139
|
+
micro: number;
|
|
140
|
+
system: number;
|
|
141
|
+
};
|
|
138
142
|
filteringAttributesConfig: {
|
|
139
143
|
attributes: Record<string, string[]>;
|
|
140
144
|
count: number;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
initialState
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-REZWSU22.js";
|
|
4
4
|
import {
|
|
5
5
|
DEVICE_STATES,
|
|
6
6
|
SORTING_OPTIONS
|
|
7
7
|
} from "../chunk-WWED74SG.js";
|
|
8
8
|
import "../chunk-2DYA3X77.js";
|
|
9
|
-
import "../chunk-FAJ3I2UQ.js";
|
|
10
9
|
import "../chunk-ZKAH3APE.js";
|
|
10
|
+
import "../chunk-FAJ3I2UQ.js";
|
|
11
11
|
import "../chunk-OWWCFJZ5.js";
|
|
12
12
|
|
|
13
13
|
// src/devicesSlice/mocks.ts
|
|
@@ -128,7 +128,7 @@ var mockState = {
|
|
|
128
128
|
},
|
|
129
129
|
selectedGroup: void 0
|
|
130
130
|
},
|
|
131
|
-
|
|
131
|
+
limits: { standard: 500, micro: 0, system: 0 }
|
|
132
132
|
};
|
|
133
133
|
export {
|
|
134
134
|
mockState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/devicesSlice/mocks.ts"],"sourcesContent":["// Copyright 2025 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 { DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport { initialState } from './index';\n\nconst deviceTypes = { qemu: 'qemux86-64' };\nconst checkInTimeRounded = '2019-01-01T00:00:00.000Z';\nconst checkInTimeExact = '2019-01-01T10:25:00.000Z';\nconst defaultMacAddress = 'dc:a6:32:12:ad:bf';\nconst defaultCreationDate = '2019-01-13T06:25:00.000Z';\n\nexport const mockState = {\n ...initialState,\n byId: {\n a1: {\n id: 'a1',\n attributes: {\n device_type: ['raspberrypi4'],\n ipv4_wlan0: '192.168.10.141/24'\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n b1: {\n id: 'b1',\n attributes: {\n ipv4_wlan0: '192.168.10.141/24',\n device_type: [deviceTypes.qemu]\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n c1: {\n id: 'c1',\n auth_sets: [],\n attributes: {\n device_type: ['qemux86-128']\n }\n }\n },\n byStatus: {\n accepted: { deviceIds: ['a1', 'b1'], total: 2 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n pending: { deviceIds: ['c1'], total: 1 },\n preauthorized: { deviceIds: [], total: 0 },\n rejected: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n isLoading: false,\n page: 1,\n perPage: 20,\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 },\n filteringAttributes: {\n identityAttributes: ['mac'],\n inventoryAttributes: ['artifact_name'],\n systemAttributes: [],\n tagAttributes: []\n },\n filteringAttributesLimit: 10,\n filters: [],\n groups: {\n byId: {\n testGroup: {\n deviceIds: ['a1', 'b1'],\n filters: [],\n total: 2\n },\n testGroupDynamic: {\n id: 'filter1',\n name: 'filter1',\n filters: [{ scope: 'system', key: 'group', operator: '$eq', value: 'things' }]\n } as const\n },\n selectedGroup: undefined\n },\n
|
|
1
|
+
{"version":3,"sources":["../../src/devicesSlice/mocks.ts"],"sourcesContent":["// Copyright 2025 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 { DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport { initialState } from './index';\n\nconst deviceTypes = { qemu: 'qemux86-64' };\nconst checkInTimeRounded = '2019-01-01T00:00:00.000Z';\nconst checkInTimeExact = '2019-01-01T10:25:00.000Z';\nconst defaultMacAddress = 'dc:a6:32:12:ad:bf';\nconst defaultCreationDate = '2019-01-13T06:25:00.000Z';\n\nexport const mockState = {\n ...initialState,\n byId: {\n a1: {\n id: 'a1',\n attributes: {\n device_type: ['raspberrypi4'],\n ipv4_wlan0: '192.168.10.141/24'\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n b1: {\n id: 'b1',\n attributes: {\n ipv4_wlan0: '192.168.10.141/24',\n device_type: [deviceTypes.qemu]\n },\n system: {\n check_in_time: checkInTimeRounded\n },\n check_in_time: checkInTimeExact,\n check_in_time_exact: checkInTimeExact,\n check_in_time_rounded: checkInTimeRounded,\n identity_data: { mac: defaultMacAddress },\n status: DEVICE_STATES.accepted,\n decommissioning: false,\n created_ts: defaultCreationDate,\n updated_ts: '2019-01-01T09:25:00.000Z',\n auth_sets: [\n {\n id: 'auth1',\n identity_data: { mac: defaultMacAddress },\n pubkey: '-----BEGIN PUBLIC KEY-----\\nMIIBojWELzgJ62hcXIhAfqfoNiaB1326XZByZwcnHr5BuSPAgMBAAE=\\n-----END PUBLIC KEY-----\\n',\n ts: defaultCreationDate,\n status: DEVICE_STATES.accepted\n }\n ]\n },\n c1: {\n id: 'c1',\n auth_sets: [],\n attributes: {\n device_type: ['qemux86-128']\n }\n }\n },\n byStatus: {\n accepted: { deviceIds: ['a1', 'b1'], total: 2 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n pending: { deviceIds: ['c1'], total: 1 },\n preauthorized: { deviceIds: [], total: 0 },\n rejected: { deviceIds: [], total: 0 }\n },\n deviceList: {\n deviceIds: [],\n isLoading: false,\n page: 1,\n perPage: 20,\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 },\n filteringAttributes: {\n identityAttributes: ['mac'],\n inventoryAttributes: ['artifact_name'],\n systemAttributes: [],\n tagAttributes: []\n },\n filteringAttributesLimit: 10,\n filters: [],\n groups: {\n byId: {\n testGroup: {\n deviceIds: ['a1', 'b1'],\n filters: [],\n total: 2\n },\n testGroupDynamic: {\n id: 'filter1',\n name: 'filter1',\n filters: [{ scope: 'system', key: 'group', operator: '$eq', value: 'things' }]\n } as const\n },\n selectedGroup: undefined\n },\n limits: { standard: 500, micro: 0, system: 0 }\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,IAAM,cAAc,EAAE,MAAM,aAAa;AACzC,IAAM,qBAAqB;AAC3B,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB;AAErB,IAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,IAAI;AAAA,MACJ,YAAY;AAAA,QACV,aAAa,CAAC,cAAc;AAAA,QAC5B,YAAY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AAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpC,SAAS,EAAE,WAAW,CAAC,IAAI,GAAG,OAAO,EAAE;AAAA,IACvC,eAAe,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACzC,UAAU,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,EACtC;AAAA,EACA,YAAY;AAAA,IACV,WAAW,CAAC;AAAA,IACZ,WAAW;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,IACT,oBAAoB,CAAC;AAAA,IACrB,gBAAgB,CAAC;AAAA,IACjB,WAAW,CAAC;AAAA,IACZ,MAAM;AAAA,MACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA,IAG7B;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,OAAO;AAAA,EACT;AAAA,EACA,qBAAqB;AAAA,IACnB,oBAAoB,CAAC,KAAK;AAAA,IAC1B,qBAAqB,CAAC,eAAe;AAAA,IACrC,kBAAkB,CAAC;AAAA,IACnB,eAAe,CAAC;AAAA,EAClB;AAAA,EACA,0BAA0B;AAAA,EAC1B,SAAS,CAAC;AAAA,EACV,QAAQ;AAAA,IACN,MAAM;AAAA,MACJ,WAAW;AAAA,QACT,WAAW,CAAC,MAAM,IAAI;AAAA,QACtB,SAAS,CAAC;AAAA,QACV,OAAO;AAAA,MACT;AAAA,MACA,kBAAkB;AAAA,QAChB,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,SAAS,CAAC,EAAE,OAAO,UAAU,KAAK,SAAS,UAAU,OAAO,OAAO,SAAS,CAAC;AAAA,MAC/E;AAAA,IACF;AAAA,IACA,eAAe;AAAA,EACjB;AAAA,EACA,QAAQ,EAAE,UAAU,KAAK,OAAO,GAAG,QAAQ,EAAE;AAC/C;","names":[]}
|
|
@@ -22,11 +22,12 @@ var selectors_exports = {};
|
|
|
22
22
|
__export(selectors_exports, {
|
|
23
23
|
getAcceptedDevices: () => getAcceptedDevices,
|
|
24
24
|
getAttributesList: () => getAttributesList,
|
|
25
|
+
getCombinedLimit: () => getCombinedLimit,
|
|
25
26
|
getDeviceById: () => getDeviceById,
|
|
26
27
|
getDeviceCountsByStatus: () => getDeviceCountsByStatus,
|
|
27
28
|
getDeviceFilters: () => getDeviceFilters,
|
|
28
29
|
getDeviceIdentityAttributes: () => getDeviceIdentityAttributes,
|
|
29
|
-
|
|
30
|
+
getDeviceLimits: () => getDeviceLimits,
|
|
30
31
|
getDeviceListState: () => getDeviceListState,
|
|
31
32
|
getDeviceReports: () => getDeviceReports,
|
|
32
33
|
getDeviceTypes: () => getDeviceTypes,
|
|
@@ -401,7 +402,7 @@ var getSortedFilteringAttributes = (0, import_toolkit.createSelector)([getFilter
|
|
|
401
402
|
...filteringAttributes,
|
|
402
403
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
403
404
|
}));
|
|
404
|
-
var
|
|
405
|
+
var getDeviceLimits = (state) => state.devices.limits;
|
|
405
406
|
var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
|
|
406
407
|
var getDeviceIdentityAttributes = (0, import_toolkit.createSelector)(
|
|
407
408
|
[getFilteringAttributes, getFilteringAttributesLimit],
|
|
@@ -439,9 +440,14 @@ var getSelectedGroupInfo = (0, import_toolkit.createSelector)(
|
|
|
439
440
|
return { groupCount, selectedGroup, groupFilters };
|
|
440
441
|
}
|
|
441
442
|
);
|
|
443
|
+
var getCombinedLimit = (0, import_toolkit.createSelector)(
|
|
444
|
+
[getDeviceLimits],
|
|
445
|
+
(deviceLimits) => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0)
|
|
446
|
+
// limit might be -1 for unlimited devices
|
|
447
|
+
);
|
|
442
448
|
var getLimitMaxed = (0, import_toolkit.createSelector)(
|
|
443
|
-
[getAcceptedDevices,
|
|
444
|
-
({ total: acceptedDevices = 0 },
|
|
449
|
+
[getAcceptedDevices, getCombinedLimit],
|
|
450
|
+
({ total: acceptedDevices = 0 }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices
|
|
445
451
|
);
|
|
446
452
|
var getGroupsByIdWithoutUngrouped = (0, import_toolkit.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
447
453
|
var getGroupData = (0, import_toolkit.createSelector)([getGroupsByIdWithoutUngrouped], (groups) => {
|
|
@@ -493,11 +499,12 @@ var getDeviceTypes = (0, import_toolkit.createSelector)(
|
|
|
493
499
|
0 && (module.exports = {
|
|
494
500
|
getAcceptedDevices,
|
|
495
501
|
getAttributesList,
|
|
502
|
+
getCombinedLimit,
|
|
496
503
|
getDeviceById,
|
|
497
504
|
getDeviceCountsByStatus,
|
|
498
505
|
getDeviceFilters,
|
|
499
506
|
getDeviceIdentityAttributes,
|
|
500
|
-
|
|
507
|
+
getDeviceLimits,
|
|
501
508
|
getDeviceListState,
|
|
502
509
|
getDeviceReports,
|
|
503
510
|
getDeviceTypes,
|