@northern.tech/store 0.46.5 → 0.47.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.d.cts +6 -6
- package/dist/actions.d.ts +6 -6
- package/dist/api/general-api.cjs +2 -2
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.js +1 -1
- package/dist/api/general-api.js.map +1 -1
- package/dist/appSlice/constants.cjs +3 -4
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +1 -1
- package/dist/appSlice/constants.d.ts +1 -1
- package/dist/appSlice/constants.js +1 -2
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/index.d.cts +1 -1
- package/dist/appSlice/index.d.ts +1 -1
- package/dist/appSlice/index.js +1 -1
- package/dist/appSlice/mocks.d.cts +1 -1
- package/dist/appSlice/mocks.d.ts +1 -1
- package/dist/appSlice/selectors.cjs.map +1 -1
- package/dist/appSlice/selectors.d.cts +2 -130
- package/dist/appSlice/selectors.d.ts +2 -130
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/thunks.d.cts +2 -2
- package/dist/appSlice/thunks.d.ts +2 -2
- package/dist/auth.cjs +3 -3
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +2 -1
- package/dist/auth.js.map +1 -1
- package/dist/commonConstants.cjs +4 -3
- package/dist/commonConstants.d.cts +2 -2
- package/dist/commonConstants.d.ts +2 -2
- package/dist/commonConstants.js +1 -1
- package/dist/commonSelectors.cjs +1 -1
- package/dist/commonSelectors.d.cts +76 -369
- package/dist/commonSelectors.d.ts +76 -369
- package/dist/commonSelectors.js +1 -1
- package/dist/constants-CCkKh9KM.d.ts +109 -0
- package/dist/constants-CUwYPOYK.d.cts +109 -0
- package/dist/{constants-D5hACLhF.js → constants-DjiC_FnZ.js} +3 -269
- package/dist/constants-DjiC_FnZ.js.map +1 -0
- package/dist/{constants-MVizYy89.cjs → constants-DsOnY5o5.cjs} +1 -279
- package/dist/constants-DsOnY5o5.cjs.map +1 -0
- package/dist/{constants-nKSWZ8oD.d.ts → constants-tC3RR_Oo.d.cts} +2 -3
- package/dist/{constants-nKSWZ8oD.d.cts → constants-tC3RR_Oo.d.ts} +2 -3
- package/dist/constants.cjs +5 -5
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +1 -1
- package/dist/deploymentsSlice/constants.cjs +1 -1
- package/dist/deploymentsSlice/constants.js +1 -1
- package/dist/deploymentsSlice/index.cjs +1 -1
- package/dist/deploymentsSlice/index.js +1 -1
- package/dist/deploymentsSlice/selectors.cjs +1 -1
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.d.cts +2 -97
- package/dist/deploymentsSlice/selectors.d.ts +2 -97
- package/dist/deploymentsSlice/selectors.js +1 -1
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/thunks.d.cts +13 -13
- package/dist/deploymentsSlice/thunks.d.ts +13 -13
- package/dist/devicesSlice/constants.cjs +1 -1
- package/dist/devicesSlice/constants.d.cts +1 -1
- package/dist/devicesSlice/constants.d.ts +1 -1
- package/dist/devicesSlice/constants.js +1 -1
- package/dist/devicesSlice/index.d.cts +1 -1
- package/dist/devicesSlice/index.d.ts +1 -1
- package/dist/devicesSlice/index.js +1 -1
- package/dist/devicesSlice/mocks.js +1 -1
- package/dist/devicesSlice/selectors.cjs +1 -1
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +2 -887
- package/dist/devicesSlice/selectors.d.ts +2 -887
- package/dist/devicesSlice/selectors.js +1 -1
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +4 -4
- package/dist/devicesSlice/thunks.d.ts +4 -4
- package/dist/{index-KxRmyFLr.d.cts → index-7jVuB4tG.d.cts} +2 -2
- package/dist/{index-fGVC5s1C.d.cts → index-BWtIaimn.d.cts} +2 -2
- package/dist/{index-BfmRpbiJ.d.cts → index-BcrZxKLw.d.cts} +2 -2
- package/dist/{index--SKVGToc.d.ts → index-C1vNDCYR.d.ts} +2 -2
- package/dist/{index-CRqnH_go.d.ts → index-C2za83Qs.d.ts} +2 -2
- package/dist/{index-xxqlerg5.d.ts → index-CThE5Gfh.d.ts} +2 -2
- package/dist/{index-BKU1G9-x.d.cts → index-CaNZaXie.d.cts} +2 -2
- package/dist/{index-BVNS-Aut.d.ts → index-CvMpbsOo.d.ts} +2 -2
- package/dist/{index-HjOSTTGF.d.cts → index-CzQRHJ6f.d.cts} +2 -2
- package/dist/{index-CqhXqGLt.d.cts → index-DNYeo7wc.d.cts} +2 -2
- package/dist/{index-D9GJhX1I.d.ts → index-DOPRnlaC.d.ts} +2 -2
- package/dist/{index-BMsafOyJ.d.ts → index-o_m7WKiR.d.ts} +2 -2
- package/dist/locationutils.cjs +1 -1
- package/dist/locationutils.d.cts +2 -2
- package/dist/locationutils.d.ts +2 -2
- package/dist/locationutils.js +1 -1
- package/dist/mockState.cjs +24 -0
- package/dist/mockState.cjs.map +1 -0
- package/dist/mockState.d.cts +7 -0
- package/dist/mockState.d.ts +7 -0
- package/dist/mockState.js +23 -0
- package/dist/mockState.js.map +1 -0
- package/dist/monitorSlice/constants.d.cts +1 -1
- package/dist/monitorSlice/constants.d.ts +1 -1
- package/dist/monitorSlice/index.d.cts +1 -1
- package/dist/monitorSlice/index.d.ts +1 -1
- package/dist/monitorSlice/index.js +1 -1
- package/dist/monitorSlice/mocks.d.cts +1 -1
- package/dist/monitorSlice/mocks.d.ts +1 -1
- package/dist/monitorSlice/mocks.js +1 -1
- package/dist/monitorSlice/selectors.cjs.map +1 -1
- package/dist/monitorSlice/selectors.d.cts +2 -10
- package/dist/monitorSlice/selectors.d.ts +2 -10
- package/dist/monitorSlice/selectors.js.map +1 -1
- package/dist/monitorSlice/thunks.cjs +2 -3
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.d.cts +4 -4
- package/dist/monitorSlice/thunks.d.ts +4 -4
- package/dist/monitorSlice/thunks.js +3 -2
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/selectors.cjs.map +1 -1
- package/dist/onboardingSlice/selectors.d.cts +2 -6
- package/dist/onboardingSlice/selectors.d.ts +2 -6
- package/dist/onboardingSlice/selectors.js.map +1 -1
- package/dist/onboardingSlice/thunks.d.cts +3 -3
- package/dist/onboardingSlice/thunks.d.ts +3 -3
- package/dist/organizationSlice/constants.cjs +1 -1
- package/dist/organizationSlice/constants.js +1 -1
- package/dist/organizationSlice/index.cjs +1 -1
- package/dist/organizationSlice/index.d.cts +1 -1
- package/dist/organizationSlice/index.d.ts +1 -1
- package/dist/organizationSlice/index.js +1 -1
- package/dist/organizationSlice/mocks.d.cts +3 -3
- package/dist/organizationSlice/mocks.d.ts +3 -3
- package/dist/organizationSlice/mocks.js +1 -1
- package/dist/organizationSlice/selectors.cjs +1 -1
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +2 -472
- package/dist/organizationSlice/selectors.d.ts +2 -472
- package/dist/organizationSlice/selectors.js +1 -1
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +25 -21
- package/dist/organizationSlice/thunks.d.ts +25 -21
- package/dist/organizationSlice/types.d.cts +1 -1
- package/dist/organizationSlice/types.d.ts +1 -1
- package/dist/releasesSlice/index.d.cts +1 -1
- package/dist/releasesSlice/index.d.ts +1 -1
- package/dist/releasesSlice/index.js +1 -1
- package/dist/releasesSlice/mocks.js +1 -1
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.d.cts +2 -795
- package/dist/releasesSlice/selectors.d.ts +2 -795
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/thunks.cjs +17 -17
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +4 -4
- package/dist/releasesSlice/thunks.d.ts +4 -4
- package/dist/releasesSlice/thunks.js +2 -1
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/selectors-1394DVvN.d.ts +712 -0
- package/dist/selectors-Ba9LUr_0.d.ts +593 -0
- package/dist/selectors-CAo0fzIZ.d.ts +99 -0
- package/dist/selectors-CH-yXu-7.d.cts +84 -0
- package/dist/selectors-CQYkG1VI.d.cts +9 -0
- package/dist/selectors-D9t4It2i.d.ts +84 -0
- package/dist/selectors-DDsFLtxz.d.cts +712 -0
- package/dist/selectors-DFSv4A_m.d.ts +378 -0
- package/dist/selectors-DQKg681M.d.ts +363 -0
- package/dist/selectors-DeqP_VLU.d.cts +593 -0
- package/dist/selectors-LhR8TyWU.d.cts +378 -0
- package/dist/selectors-XzNyGFJI.d.cts +99 -0
- package/dist/selectors-aLOjKkxN.d.cts +14 -0
- package/dist/selectors-elCimAHX.d.ts +9 -0
- package/dist/selectors-jusUdUdc.d.cts +363 -0
- package/dist/selectors-vk0GUGHf.d.ts +14 -0
- package/dist/selectors.d.cts +9 -9
- package/dist/selectors.d.ts +9 -9
- package/dist/sockethook.cjs +4 -4
- package/dist/sockethook.cjs.map +1 -1
- package/dist/sockethook.js +2 -1
- package/dist/sockethook.js.map +1 -1
- package/dist/{store-Dw8Uo_Df.d.cts → store-CCvk8X-k.d.cts} +14 -33
- package/dist/{store-DLp6ajT8.d.ts → store-v5V-bbB_.d.ts} +15 -34
- package/dist/store.cjs +2 -4
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +2 -2
- package/dist/store.d.ts +2 -2
- package/dist/store.js +2 -4
- package/dist/store.js.map +1 -1
- package/dist/thunks.cjs +30 -38
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.js +10 -17
- package/dist/thunks.js.map +1 -1
- package/dist/{types-DY0J79yF.d.ts → types-B2gphGj8.d.ts} +3 -3
- package/dist/{types-B67YW1jV.d.cts → types-CLASWtVP.d.cts} +3 -3
- package/dist/usersSlice/constants.cjs +1 -1
- package/dist/usersSlice/constants.js +1 -1
- package/dist/usersSlice/index.cjs +1 -1
- package/dist/usersSlice/index.d.cts +1 -1
- package/dist/usersSlice/index.d.ts +1 -1
- package/dist/usersSlice/index.js +1 -1
- package/dist/usersSlice/mocks.d.cts +1 -1
- package/dist/usersSlice/mocks.d.ts +1 -1
- package/dist/usersSlice/mocks.js +1 -1
- package/dist/usersSlice/selectors.cjs +3 -3
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.d.cts +2 -466
- package/dist/usersSlice/selectors.d.ts +2 -466
- package/dist/usersSlice/selectors.js +2 -2
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/thunks.d.cts +88 -88
- package/dist/usersSlice/thunks.d.ts +88 -88
- package/dist/utils.cjs +4 -6
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -4
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/constants-BJuY-ODE.d.ts +0 -124
- package/dist/constants-C2O55iZu.d.cts +0 -124
- package/dist/constants-D5hACLhF.js.map +0 -1
- package/dist/constants-MVizYy89.cjs.map +0 -1
- package/dist/storehooks.cjs +0 -249
- package/dist/storehooks.cjs.map +0 -1
- package/dist/storehooks.d.cts +0 -49
- package/dist/storehooks.d.ts +0 -49
- package/dist/storehooks.js +0 -241
- package/dist/storehooks.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ft as UNGROUPED_GROUP, u as DEVICE_STATES } from "../constants-
|
|
1
|
+
import { Ft as UNGROUPED_GROUP, u as DEVICE_STATES } from "../constants-DjiC_FnZ.js";
|
|
2
2
|
import { createSelector } from "@reduxjs/toolkit";
|
|
3
3
|
import { duplicateFilter } from "@northern.tech/utils/helpers";
|
|
4
4
|
//#region src/devicesSlice/selectors.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","names":[],"sources":["../../src/devicesSlice/selectors.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 { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { DeviceFilter, DeviceGroup } from '.';\nimport type { DeviceAuthState } from '../constants';\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '../constants';\nimport type { RootState } from '../store';\n\nexport const getAcceptedDevices = (state: RootState) => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = (state: RootState) => state.devices.byStatus;\nexport const getDevicesById = (state: RootState) => state.devices.byId;\nexport const getDeviceReports = (state: RootState) => state.devices.reports;\nexport const getGroupsById = (state: RootState) => state.devices.groups.byId;\nexport const getSelectedGroup = (state: RootState) => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = (state: RootState) => state.devices.deviceList;\nexport const getListedDevices = (state: RootState) => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = (state: RootState) => state.devices.filteringAttributes;\nexport const getDeviceFilters = (state: RootState) => state.devices.filters || [];\nexport const getTestDeviceLimit = (state: RootState) => state.devices.testDeviceLimit;\nconst getFilteringAttributesFromConfig = (state: RootState) => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimits = (state: RootState) => state.devices.limits;\nexport const getTestDeviceCount = (state: RootState) => state.devices.testDeviceCount;\nconst getFilteringAttributesLimit = (state: RootState) => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // the device auth status is not a meaningful device identifier\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.filter(attribute => attribute !== 'status').slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce<Record<DeviceAuthState, number>>(\n (accu, deviceState) => {\n const { counts } = byStatus[deviceState];\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { total, ...tieredCounts } = counts;\n const count = Object.values(tieredCounts).reduce((accu, countPerTier) => accu + countPerTier, 0);\n accu[deviceState] = count;\n accu.total = accu.total + count;\n return accu;\n },\n { total: 0 }\n )\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],\n ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters: DeviceFilter[] = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total || 0;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getCombinedLimit = createSelector(\n [getDeviceLimits],\n deviceLimits => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0) // limit might be -1 for unlimited devices\n);\n\nexport const getLimitMaxed = createSelector(\n [getDeviceCountsByStatus, getCombinedLimit],\n ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroupData = createSelector([getGroupsByIdWithoutUngrouped], groups => {\n const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : undefined;\n const hasDynamicGroups = Object.values(groups).some(group => !!group.id);\n return { createdGroup, hasDynamicGroups, groups };\n});\n\ntype SelectorGroup = DeviceGroup & { groupId: string };\ntype SelectorGroups = { dynamic: SelectorGroup[]; static: SelectorGroup[]; ungrouped: SelectorGroup[] };\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce<SelectorGroups>(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if ((group.filters ?? []).length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\nconst getEnabledTierLimits = createSelector([getDeviceLimits], limits => Object.entries(limits).filter(([, limit]) => limit !== 0));\n\nexport const getEnabledTiers = createSelector([getEnabledTierLimits], enabledTierLimits => enabledTierLimits.map(([type]) => type));\n\nexport const getDeviceLimitStats = createSelector([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {\n const { counts } = accepted;\n return enabledTierLimits.map(([type, limit]) => ({\n type,\n limit,\n total: counts[type] || 0\n }));\n});\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":";;;;AAqBA,MAAa,sBAAsB,UAAqB,MAAM,QAAQ,SAAS;AAC/E,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAa,kBAAkB,UAAqB,MAAM,QAAQ;AAClE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ;AACpE,MAAa,iBAAiB,UAAqB,MAAM,QAAQ,OAAO;AACxE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ,OAAO;AAE3E,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAa,oBAAoB,UAAqB,MAAM,QAAQ,WAAW;AAC/E,MAAa,0BAA0B,UAAqB,MAAM,QAAQ;AAC1E,MAAa,oBAAoB,UAAqB,MAAM,QAAQ,WAAW,CAAC;AAChF,MAAa,sBAAsB,UAAqB,MAAM,QAAQ;AACtE,MAAM,oCAAoC,UAAqB,MAAM,QAAQ,0BAA0B;AACvG,MAAa,+BAA+B,eAAe,CAAC,sBAAsB,IAAG,yBAAwB;CAC3G,GAAG;CACH,oBAAoB,CAAC,GAAG,oBAAoB,oBAAoB,IAAI;AACtE,EAAE;AACF,MAAa,mBAAmB,UAAqB,MAAM,QAAQ;A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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 { duplicateFilter } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { DeviceFilter, DeviceGroup, DeviceSliceType } from '.';\nimport type { DeviceAuthState } from '../constants';\nimport { DEVICE_STATES, UNGROUPED_GROUP } from '../constants';\n\nexport type DevicesState = { devices: DeviceSliceType };\n\nexport const getAcceptedDevices = (state: DevicesState) => state.devices.byStatus.accepted;\nexport const getDevicesByStatus = (state: DevicesState) => state.devices.byStatus;\nexport const getDevicesById = (state: DevicesState) => state.devices.byId;\nexport const getDeviceReports = (state: DevicesState) => state.devices.reports;\nexport const getGroupsById = (state: DevicesState) => state.devices.groups.byId;\nexport const getSelectedGroup = (state: DevicesState) => state.devices.groups.selectedGroup;\n\nexport const getDeviceListState = (state: DevicesState) => state.devices.deviceList;\nexport const getListedDevices = (state: DevicesState) => state.devices.deviceList.deviceIds;\nexport const getFilteringAttributes = (state: DevicesState) => state.devices.filteringAttributes;\nexport const getDeviceFilters = (state: DevicesState) => state.devices.filters || [];\nexport const getTestDeviceLimit = (state: DevicesState) => state.devices.testDeviceLimit;\nconst getFilteringAttributesFromConfig = (state: DevicesState) => state.devices.filteringAttributesConfig.attributes;\nexport const getSortedFilteringAttributes = createSelector([getFilteringAttributes], filteringAttributes => ({\n ...filteringAttributes,\n identityAttributes: [...filteringAttributes.identityAttributes, 'id']\n}));\nexport const getDeviceLimits = (state: DevicesState) => state.devices.limits;\nexport const getTestDeviceCount = (state: DevicesState) => state.devices.testDeviceCount;\nconst getFilteringAttributesLimit = (state: DevicesState) => state.devices.filteringAttributesLimit;\n\nexport const getDeviceIdentityAttributes = createSelector(\n [getFilteringAttributes, getFilteringAttributesLimit],\n ({ identityAttributes }, filteringAttributesLimit) => {\n // the device auth status is not a meaningful device identifier\n // limit the selection of the available attribute to AVAILABLE_ATTRIBUTE_LIMIT\n const attributes = identityAttributes.filter(attribute => attribute !== 'status').slice(0, filteringAttributesLimit);\n return attributes.reduce(\n (accu, value) => {\n accu.push({ value, label: value, scope: 'identity' });\n return accu;\n },\n [\n { value: 'name', label: 'Name', scope: 'tags' },\n { value: 'id', label: 'Device ID', scope: 'identity' }\n ]\n );\n }\n);\n\nexport const getDeviceCountsByStatus = createSelector([getDevicesByStatus], byStatus =>\n Object.values(DEVICE_STATES).reduce<Record<DeviceAuthState, number>>(\n (accu, deviceState) => {\n const { counts } = byStatus[deviceState];\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { total, ...tieredCounts } = counts;\n const count = Object.values(tieredCounts).reduce((accu, countPerTier) => accu + countPerTier, 0);\n accu[deviceState] = count;\n accu.total = accu.total + count;\n return accu;\n },\n { total: 0 }\n )\n);\n\nexport const getDeviceById = createSelector([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = '') => devicesById[deviceId] ?? {});\n\nexport const getSelectedGroupInfo = createSelector(\n [getDeviceCountsByStatus, getGroupsById, getSelectedGroup],\n ({ accepted: acceptedDeviceTotal }, groupsById, selectedGroup) => {\n let groupCount = acceptedDeviceTotal;\n let groupFilters: DeviceFilter[] = [];\n if (selectedGroup && groupsById[selectedGroup]) {\n groupCount = groupsById[selectedGroup].total || 0;\n groupFilters = groupsById[selectedGroup].filters || [];\n }\n return { groupCount, selectedGroup, groupFilters };\n }\n);\n\nexport const getCombinedLimit = createSelector(\n [getDeviceLimits],\n deviceLimits => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0) // limit might be -1 for unlimited devices\n);\n\nexport const getLimitMaxed = createSelector(\n [getDeviceCountsByStatus, getCombinedLimit],\n ({ accepted: acceptedDevices }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices\n);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const getGroupsByIdWithoutUngrouped = createSelector([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);\n\nexport const getGroupData = createSelector([getGroupsByIdWithoutUngrouped], groups => {\n const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : undefined;\n const hasDynamicGroups = Object.values(groups).some(group => !!group.id);\n return { createdGroup, hasDynamicGroups, groups };\n});\n\ntype SelectorGroup = DeviceGroup & { groupId: string };\ntype SelectorGroups = { dynamic: SelectorGroup[]; static: SelectorGroup[]; ungrouped: SelectorGroup[] };\n\nexport const getGroups = createSelector([getGroupsById], groupsById => {\n const groupNames = Object.keys(groupsById).sort();\n const groupedGroups = Object.entries(groupsById)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .reduce<SelectorGroups>(\n (accu, [groupname, group]) => {\n const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;\n const groupItem = { ...group, groupId: name, name: groupname };\n if ((group.filters ?? []).length > 0) {\n if (groupname !== UNGROUPED_GROUP.id) {\n accu.dynamic.push(groupItem);\n } else {\n accu.ungrouped.push(groupItem);\n }\n } else {\n accu.static.push(groupItem);\n }\n return accu;\n },\n { dynamic: [], static: [], ungrouped: [] }\n );\n return { groupNames, ...groupedGroups };\n});\nexport const getAttributesList = createSelector(\n [getFilteringAttributes, getFilteringAttributesFromConfig],\n ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) =>\n [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(duplicateFilter)\n);\nconst getEnabledTierLimits = createSelector([getDeviceLimits], limits => Object.entries(limits).filter(([, limit]) => limit !== 0));\n\nexport const getEnabledTiers = createSelector([getEnabledTierLimits], enabledTierLimits => enabledTierLimits.map(([type]) => type));\n\nexport const getDeviceLimitStats = createSelector([getEnabledTierLimits, getAcceptedDevices], (enabledTierLimits, accepted) => {\n const { counts } = accepted;\n return enabledTierLimits.map(([type, limit]) => ({\n type,\n limit,\n total: counts[type] || 0\n }));\n});\n\nexport const getDeviceTypes = createSelector([getAcceptedDevices, getDevicesById], ({ deviceIds = [] }, devicesById) =>\n Object.keys(\n deviceIds.slice(0, 200).reduce((accu, item) => {\n const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};\n accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {\n if (deviceType.length > 1) {\n deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;\n }\n return deviceTypeAccu;\n }, accu);\n return accu;\n }, {})\n )\n);\n"],"mappings":";;;;AAsBA,MAAa,sBAAsB,UAAwB,MAAM,QAAQ,SAAS;AAClF,MAAa,sBAAsB,UAAwB,MAAM,QAAQ;AACzE,MAAa,kBAAkB,UAAwB,MAAM,QAAQ;AACrE,MAAa,oBAAoB,UAAwB,MAAM,QAAQ;AACvE,MAAa,iBAAiB,UAAwB,MAAM,QAAQ,OAAO;AAC3E,MAAa,oBAAoB,UAAwB,MAAM,QAAQ,OAAO;AAE9E,MAAa,sBAAsB,UAAwB,MAAM,QAAQ;AACzE,MAAa,oBAAoB,UAAwB,MAAM,QAAQ,WAAW;AAClF,MAAa,0BAA0B,UAAwB,MAAM,QAAQ;AAC7E,MAAa,oBAAoB,UAAwB,MAAM,QAAQ,WAAW,CAAC;AACnF,MAAa,sBAAsB,UAAwB,MAAM,QAAQ;AACzE,MAAM,oCAAoC,UAAwB,MAAM,QAAQ,0BAA0B;AAC1G,MAAa,+BAA+B,eAAe,CAAC,sBAAsB,IAAG,yBAAwB;CAC3G,GAAG;CACH,oBAAoB,CAAC,GAAG,oBAAoB,oBAAoB,IAAI;AACtE,EAAE;AACF,MAAa,mBAAmB,UAAwB,MAAM,QAAQ;AACtE,MAAa,sBAAsB,UAAwB,MAAM,QAAQ;AACzE,MAAM,+BAA+B,UAA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xC,CAAC;AACD,MAAa,oBAAoB,eAC/B,CAAC,wBAAwB,gCAAgC,IACxD,EAAE,qBAAqB,CAAC,GAAG,sBAAsB,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,YAAY,CAAC,QACpF;CAAC,GAAG;CAAoB,GAAG;CAAqB,GAAG;CAAU,GAAG;AAAS,CAAC,CAAC,OAAO,eAAe,CACrG;AACA,MAAM,uBAAuB,eAAe,CAAC,eAAe,IAAG,WAAU,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,CAAC,CAAC;AAElI,MAAa,kBAAkB,eAAe,CAAC,oBAAoB,IAAG,sBAAqB,kBAAkB,KAAK,CAAC,UAAU,IAAI,CAAC;AAElI,MAAa,sBAAsB,eAAe,CAAC,sBAAsB,kBAAkB,IAAI,mBAAmB,aAAa;CAC7H,MAAM,EAAE,WAAW;CACnB,OAAO,kBAAkB,KAAK,CAAC,MAAM,YAAY;EAC/C;EACA;EACA,OAAO,OAAO,SAAS;CACzB,EAAE;AACJ,CAAC;AAED,MAAa,iBAAiB,eAAe,CAAC,oBAAoB,cAAc,IAAI,EAAE,YAAY,CAAC,KAAK,gBACtG,OAAO,KACL,UAAU,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,MAAM,SAAS;CAC7C,MAAM,EAAE,aAAa,cAAc,CAAC,MAAM,YAAY,QAAQ,YAAY,KAAK,CAAC,aAAa,CAAC;CAC9F,OAAO,YAAY,QAAQ,gBAAgB,eAAe;EACxD,IAAI,WAAW,SAAS,GACtB,eAAe,cAAc,eAAe,cAAc,eAAe,cAAc,IAAI;EAE7F,OAAO;CACT,GAAG,IAAI;CACP,OAAO;AACT,GAAG,CAAC,CAAC,CACP,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ht as DeviceAuthState, m as DeviceIssueOptionKey } from "../constants-
|
|
2
|
-
import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device$1 } from "../index-
|
|
3
|
-
import { i as SnackbarContent, n as SearchState } from "../index-
|
|
4
|
-
import {
|
|
1
|
+
import { ht as DeviceAuthState, m as DeviceIssueOptionKey } from "../constants-CUwYPOYK.cjs";
|
|
2
|
+
import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device$1 } from "../index-7jVuB4tG.cjs";
|
|
3
|
+
import { i as SnackbarContent, n as SearchState } from "../index-CaNZaXie.cjs";
|
|
4
|
+
import { i as RootState, t as AppDispatch } from "../store-CCvk8X-k.cjs";
|
|
5
5
|
import { ConnectionState, Device, DeviceConfiguration, DeviceInventoryResponse, DeviceWithImage, Filter, Integration, ManagementApiConfiguration, NewConfigurationDeployment, PreAuthSet, SearchIdentityParams, SortCriteria, Status } from "@northern.tech/types/MenderTypes";
|
|
6
6
|
//#region src/devicesSlice/thunks.d.ts
|
|
7
7
|
export declare const getGroups: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ht as DeviceAuthState, m as DeviceIssueOptionKey } from "../constants-
|
|
2
|
-
import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device$1 } from "../index-
|
|
3
|
-
import { i as SnackbarContent, n as SearchState } from "../index-
|
|
4
|
-
import {
|
|
1
|
+
import { ht as DeviceAuthState, m as DeviceIssueOptionKey } from "../constants-CCkKh9KM.js";
|
|
2
|
+
import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device$1 } from "../index-DOPRnlaC.js";
|
|
3
|
+
import { i as SnackbarContent, n as SearchState } from "../index-CThE5Gfh.js";
|
|
4
|
+
import { i as RootState, t as AppDispatch } from "../store-v5V-bbB_.js";
|
|
5
5
|
import { ConnectionState, Device, DeviceConfiguration, DeviceInventoryResponse, DeviceWithImage, Filter, Integration, ManagementApiConfiguration, NewConfigurationDeployment, PreAuthSet, SearchIdentityParams, SortCriteria, Status } from "@northern.tech/types/MenderTypes";
|
|
6
6
|
//#region src/devicesSlice/thunks.d.ts
|
|
7
7
|
export declare const getGroups: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as SortOptions, ht as DeviceAuthState, m as DeviceIssueOptionKey, n as ALL_DEVICE_STATES, wt as FilterOperator } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { s as DeviceDeployment } from "./index-mvxjivTJ.cjs";
|
|
3
3
|
import { AttributeResponse, ConnectionState, Device, DeviceConfiguration, DeviceState, DeviceTierLimits, MonitorConfiguration, Scope, SortCriteria, Status } from "@northern.tech/types/MenderTypes";
|
|
4
4
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
@@ -200,4 +200,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
200
200
|
declare const _default: import("redux").Reducer<DeviceSliceType>;
|
|
201
201
|
//#endregion
|
|
202
202
|
export { DeviceGroups as a, DeviceSliceType as c, _default as d, actions as f, sliceName as h, DeviceGroup as i, DeviceTierLimits$1 as l, initialState as m, DeviceComponents as n, DeviceListState as o, devicesSlice as p, DeviceFilter as r, DeviceSelectedAttribute as s, Device$1 as t, InventoryAttributes as u };
|
|
203
|
-
//# sourceMappingURL=index-
|
|
203
|
+
//# sourceMappingURL=index-7jVuB4tG.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { ArtifactV1, ArtifactV2, DeltaJobDetailsItem, DeltaJobsListItem, Manifest, ReleaseV1, ReleaseV2, Software, Tags, Update } from "@northern.tech/types/MenderTypes";
|
|
3
3
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
4
4
|
//#region src/releasesSlice/index.d.ts
|
|
@@ -167,4 +167,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
167
167
|
declare const _default: import("redux").Reducer<ReleaseSliceType>;
|
|
168
168
|
//#endregion
|
|
169
169
|
export { ReleaseSliceType as a, SoftwareList as c, initialState as d, releaseSlice as f, Release as i, _default as l, Manifest$1 as n, ReleasesList as o, sliceName as p, ManifestsList as r, SoftwareKind as s, Artifact as t, actions as u };
|
|
170
|
-
//# sourceMappingURL=index-
|
|
170
|
+
//# sourceMappingURL=index-BWtIaimn.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "./constants-
|
|
1
|
+
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { Alert } from "@northern.tech/types/MenderTypes";
|
|
3
3
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
4
4
|
//#region src/monitorSlice/index.d.ts
|
|
@@ -88,4 +88,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
88
88
|
declare const _default: import("redux").Reducer<MonitorSliceType>;
|
|
89
89
|
//#endregion
|
|
90
90
|
export { monitorSlice as a, initialState as i, _default as n, sliceName as o, actions as r, MonitorSliceType as t };
|
|
91
|
-
//# sourceMappingURL=index-
|
|
91
|
+
//# sourceMappingURL=index-BcrZxKLw.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as Role, v as PermissionSet, wt as FilterOperator } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { i as ReadState } from "./constants-D8-yUk19.js";
|
|
3
3
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
4
4
|
import { DeploymentPhase, PersonalAccessToken, TenantInfo, TenantsIdName, User } from "@northern.tech/types/MenderTypes";
|
|
@@ -147,4 +147,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
147
147
|
declare const _default: import("redux").Reducer<UserSliceType>;
|
|
148
148
|
//#endregion
|
|
149
149
|
export { UserSettings as a, actions as c, usersSlice as d, UserSession as i, initialState as l, GlobalSettings as n, UserSliceType as o, User$1 as r, _default as s, CustomColumn as t, sliceName as u };
|
|
150
|
-
//# sourceMappingURL=index
|
|
150
|
+
//# sourceMappingURL=index-C1vNDCYR.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "./constants-
|
|
1
|
+
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
3
3
|
import { Alert } from "@northern.tech/types/MenderTypes";
|
|
4
4
|
//#region src/monitorSlice/index.d.ts
|
|
@@ -88,4 +88,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
88
88
|
declare const _default: import("redux").Reducer<MonitorSliceType>;
|
|
89
89
|
//#endregion
|
|
90
90
|
export { monitorSlice as a, initialState as i, _default as n, sliceName as o, actions as r, MonitorSliceType as t };
|
|
91
|
-
//# sourceMappingURL=index-
|
|
91
|
+
//# sourceMappingURL=index-C2za83Qs.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
3
3
|
import { SnackbarProps } from "@mui/material";
|
|
4
4
|
//#region src/appSlice/index.d.ts
|
|
@@ -111,4 +111,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
111
111
|
declare const _default: import("redux").Reducer<AppSliceType>;
|
|
112
112
|
//#endregion
|
|
113
113
|
export { Upload as a, appSlice as c, SnackbarContent as i, initialState as l, SearchState as n, _default as o, SentryConfig as r, actions as s, AppSliceType as t, sliceName as u };
|
|
114
|
-
//# sourceMappingURL=index-
|
|
114
|
+
//# sourceMappingURL=index-CThE5Gfh.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
3
3
|
import { SnackbarProps } from "@mui/material";
|
|
4
4
|
//#region src/appSlice/index.d.ts
|
|
@@ -111,4 +111,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
111
111
|
declare const _default: import("redux").Reducer<AppSliceType>;
|
|
112
112
|
//#endregion
|
|
113
113
|
export { Upload as a, appSlice as c, SnackbarContent as i, initialState as l, SearchState as n, _default as o, SentryConfig as r, actions as s, AppSliceType as t, sliceName as u };
|
|
114
|
-
//# sourceMappingURL=index-
|
|
114
|
+
//# sourceMappingURL=index-CaNZaXie.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TenantList, f as Webhook, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card, t as AuditLog$1 } from "./types-
|
|
1
|
+
import { d as TenantList, f as Webhook, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card, t as AuditLog$1 } from "./types-B2gphGj8.js";
|
|
2
2
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
3
3
|
import { AuditLog, BillingProfile, Event, Integration } from "@northern.tech/types/MenderTypes";
|
|
4
4
|
//#region src/organizationSlice/index.d.ts
|
|
@@ -64,4 +64,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
64
64
|
declare const _default: import("redux").Reducer<OrganizationSliceType>;
|
|
65
65
|
//#endregion
|
|
66
66
|
export { organizationSlice as a, initialState as i, _default as n, sliceName as o, actions as r, OrganizationSliceType as t };
|
|
67
|
-
//# sourceMappingURL=index-
|
|
67
|
+
//# sourceMappingURL=index-CvMpbsOo.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TenantList, f as Webhook, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card, t as AuditLog$1 } from "./types-
|
|
1
|
+
import { d as TenantList, f as Webhook, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card, t as AuditLog$1 } from "./types-CLASWtVP.cjs";
|
|
2
2
|
import { AuditLog, BillingProfile, Event, Integration } from "@northern.tech/types/MenderTypes";
|
|
3
3
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
4
4
|
//#region src/organizationSlice/index.d.ts
|
|
@@ -64,4 +64,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
64
64
|
declare const _default: import("redux").Reducer<OrganizationSliceType>;
|
|
65
65
|
//#endregion
|
|
66
66
|
export { organizationSlice as a, initialState as i, _default as n, sliceName as o, actions as r, OrganizationSliceType as t };
|
|
67
|
-
//# sourceMappingURL=index-
|
|
67
|
+
//# sourceMappingURL=index-CzQRHJ6f.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as Role, v as PermissionSet, wt as FilterOperator } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { i as ReadState } from "./constants-D8-yUk19.cjs";
|
|
3
3
|
import { DeploymentPhase, PersonalAccessToken, TenantInfo, TenantsIdName, User } from "@northern.tech/types/MenderTypes";
|
|
4
4
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
@@ -147,4 +147,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
147
147
|
declare const _default: import("redux").Reducer<UserSliceType>;
|
|
148
148
|
//#endregion
|
|
149
149
|
export { UserSettings as a, actions as c, usersSlice as d, UserSession as i, initialState as l, GlobalSettings as n, UserSliceType as o, User$1 as r, _default as s, CustomColumn as t, sliceName as u };
|
|
150
|
-
//# sourceMappingURL=index-
|
|
150
|
+
//# sourceMappingURL=index-DNYeo7wc.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as SortOptions, ht as DeviceAuthState, m as DeviceIssueOptionKey, n as ALL_DEVICE_STATES, wt as FilterOperator } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { s as DeviceDeployment } from "./index-B8td4-rY.js";
|
|
3
3
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
4
4
|
import { AttributeResponse, ConnectionState, Device, DeviceConfiguration, DeviceState, DeviceTierLimits, MonitorConfiguration, Scope, SortCriteria, Status } from "@northern.tech/types/MenderTypes";
|
|
@@ -200,4 +200,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
200
200
|
declare const _default: import("redux").Reducer<DeviceSliceType>;
|
|
201
201
|
//#endregion
|
|
202
202
|
export { DeviceGroups as a, DeviceSliceType as c, _default as d, actions as f, sliceName as h, DeviceGroup as i, DeviceTierLimits$1 as l, initialState as m, DeviceComponents as n, DeviceListState as o, devicesSlice as p, DeviceFilter as r, DeviceSelectedAttribute as s, Device$1 as t, InventoryAttributes as u };
|
|
203
|
-
//# sourceMappingURL=index-
|
|
203
|
+
//# sourceMappingURL=index-DOPRnlaC.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as SortOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
3
3
|
import { ArtifactV1, ArtifactV2, DeltaJobDetailsItem, DeltaJobsListItem, Manifest, ReleaseV1, ReleaseV2, Software, Tags, Update } from "@northern.tech/types/MenderTypes";
|
|
4
4
|
//#region src/releasesSlice/index.d.ts
|
|
@@ -167,4 +167,4 @@ declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
|
167
167
|
declare const _default: import("redux").Reducer<ReleaseSliceType>;
|
|
168
168
|
//#endregion
|
|
169
169
|
export { ReleaseSliceType as a, SoftwareList as c, initialState as d, releaseSlice as f, Release as i, _default as l, Manifest$1 as n, ReleasesList as o, sliceName as p, ManifestsList as r, SoftwareKind as s, Artifact as t, actions as u };
|
|
170
|
-
//# sourceMappingURL=index-
|
|
170
|
+
//# sourceMappingURL=index-o_m7WKiR.d.ts.map
|
package/dist/locationutils.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_constants = require("./constants-
|
|
2
|
+
const require_constants = require("./constants-DsOnY5o5.cjs");
|
|
3
3
|
let _northern_tech_utils_helpers = require("@northern.tech/utils/helpers");
|
|
4
4
|
let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
|
|
5
5
|
//#region src/locationutils.ts
|
package/dist/locationutils.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as SortOptions, g as PaginationOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions, g as PaginationOptions } from "./constants-CUwYPOYK.cjs";
|
|
2
2
|
import { t as AUDIT_LOGS_TYPES } from "./constants-OZiiFKiA.cjs";
|
|
3
|
-
import { r as DeviceFilter } from "./index-
|
|
3
|
+
import { r as DeviceFilter } from "./index-7jVuB4tG.cjs";
|
|
4
4
|
//#region src/locationutils.d.ts
|
|
5
5
|
export type PageState = Partial<PaginationOptions> & {
|
|
6
6
|
[key: string]: unknown;
|
package/dist/locationutils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as SortOptions, g as PaginationOptions } from "./constants-
|
|
1
|
+
import { T as SortOptions, g as PaginationOptions } from "./constants-CCkKh9KM.js";
|
|
2
2
|
import { t as AUDIT_LOGS_TYPES } from "./constants-OZiiFKiA.js";
|
|
3
|
-
import { r as DeviceFilter } from "./index-
|
|
3
|
+
import { r as DeviceFilter } from "./index-DOPRnlaC.js";
|
|
4
4
|
//#region src/locationutils.d.ts
|
|
5
5
|
export type PageState = Partial<PaginationOptions> & {
|
|
6
6
|
[key: string]: unknown;
|
package/dist/locationutils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as AUDIT_LOGS_TYPES, Ft as UNGROUPED_GROUP, _t as DEPLOYMENT_STATES, gt as DEPLOYMENT_ROUTES, l as DEVICE_LIST_DEFAULTS, o as ATTRIBUTE_SCOPES, pt as emptyFilter, s as DEVICE_FILTERING_OPTIONS, t as ALL_DEVICES, vt as DEPLOYMENT_TYPES } from "./constants-
|
|
1
|
+
import { $ as AUDIT_LOGS_TYPES, Ft as UNGROUPED_GROUP, _t as DEPLOYMENT_STATES, gt as DEPLOYMENT_ROUTES, l as DEVICE_LIST_DEFAULTS, o as ATTRIBUTE_SCOPES, pt as emptyFilter, s as DEVICE_FILTERING_OPTIONS, t as ALL_DEVICES, vt as DEPLOYMENT_TYPES } from "./constants-DjiC_FnZ.js";
|
|
2
2
|
import { deepCompare, getISOStringBoundaries } from "@northern.tech/utils/helpers";
|
|
3
3
|
//#region src/locationutils.ts
|
|
4
4
|
const SEPARATOR = ":";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_appSlice_mocks = require("./appSlice/mocks.cjs");
|
|
3
|
+
const require_deploymentsSlice_mocks = require("./deploymentsSlice/mocks.cjs");
|
|
4
|
+
const require_devicesSlice_mocks = require("./devicesSlice/mocks.cjs");
|
|
5
|
+
const require_monitorSlice_mocks = require("./monitorSlice/mocks.cjs");
|
|
6
|
+
const require_onboardingSlice_mocks = require("./onboardingSlice/mocks.cjs");
|
|
7
|
+
const require_organizationSlice_mocks = require("./organizationSlice/mocks.cjs");
|
|
8
|
+
const require_releasesSlice_mocks = require("./releasesSlice/mocks.cjs");
|
|
9
|
+
const require_usersSlice_mocks = require("./usersSlice/mocks.cjs");
|
|
10
|
+
//#region src/mockState.ts
|
|
11
|
+
const defaultState = {
|
|
12
|
+
app: { ...require_appSlice_mocks.mockState },
|
|
13
|
+
deployments: { ...require_deploymentsSlice_mocks.mockState },
|
|
14
|
+
devices: { ...require_devicesSlice_mocks.mockState },
|
|
15
|
+
monitor: { ...require_monitorSlice_mocks.mockState },
|
|
16
|
+
onboarding: { ...require_onboardingSlice_mocks.mockState },
|
|
17
|
+
organization: { ...require_organizationSlice_mocks.mockState },
|
|
18
|
+
releases: { ...require_releasesSlice_mocks.mockState },
|
|
19
|
+
users: { ...require_usersSlice_mocks.mockState }
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.defaultState = defaultState;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=mockState.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockState.cjs","names":["appMockState","deploymentsMockState","devicesMockState","monitorMockState","onboardingMockState","organizationMockState","releasesMockState","usersMockState"],"sources":["../src/mockState.ts"],"sourcesContent":["// Copyright 2026 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 { mockState as appMockState } from './appSlice/mocks';\nimport { mockState as deploymentsMockState } from './deploymentsSlice/mocks';\nimport { mockState as devicesMockState } from './devicesSlice/mocks';\nimport { mockState as monitorMockState } from './monitorSlice/mocks';\nimport { mockState as onboardingMockState } from './onboardingSlice/mocks';\nimport { mockState as organizationMockState } from './organizationSlice/mocks';\nimport { mockState as releasesMockState } from './releasesSlice/mocks';\nimport type { getConfiguredStore } from './store';\nimport { mockState as usersMockState } from './usersSlice/mocks';\n\ntype PreloadedState = NonNullable<Parameters<typeof getConfiguredStore>[0]>['preloadedState'];\ntype MockState = Required<NonNullable<PreloadedState>>;\n\nexport const defaultState = {\n app: { ...appMockState },\n deployments: { ...deploymentsMockState },\n devices: { ...devicesMockState },\n monitor: { ...monitorMockState },\n onboarding: { ...onboardingMockState },\n organization: { ...organizationMockState },\n releases: { ...releasesMockState },\n users: { ...usersMockState }\n} as unknown as MockState;\n"],"mappings":";;;;;;;;;;AA0BA,MAAa,eAAe;CAC1B,KAAK,EAAE,GAAGA,uBAAAA,UAAa;CACvB,aAAa,EAAE,GAAGC,+BAAAA,UAAqB;CACvC,SAAS,EAAE,GAAGC,2BAAAA,UAAiB;CAC/B,SAAS,EAAE,GAAGC,2BAAAA,UAAiB;CAC/B,YAAY,EAAE,GAAGC,8BAAAA,UAAoB;CACrC,cAAc,EAAE,GAAGC,gCAAAA,UAAsB;CACzC,UAAU,EAAE,GAAGC,4BAAAA,UAAkB;CACjC,OAAO,EAAE,GAAGC,yBAAAA,UAAe;AAC7B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { c as getConfiguredStore } from "./store-CCvk8X-k.cjs";
|
|
2
|
+
//#region src/mockState.d.ts
|
|
3
|
+
type PreloadedState = NonNullable<Parameters<typeof getConfiguredStore>[0]>['preloadedState'];
|
|
4
|
+
type MockState = Required<NonNullable<PreloadedState>>;
|
|
5
|
+
export declare const defaultState: MockState;
|
|
6
|
+
//#endregion
|
|
7
|
+
//# sourceMappingURL=mockState.d.cts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { c as getConfiguredStore } from "./store-v5V-bbB_.js";
|
|
2
|
+
//#region src/mockState.d.ts
|
|
3
|
+
type PreloadedState = NonNullable<Parameters<typeof getConfiguredStore>[0]>['preloadedState'];
|
|
4
|
+
type MockState = Required<NonNullable<PreloadedState>>;
|
|
5
|
+
export declare const defaultState: MockState;
|
|
6
|
+
//#endregion
|
|
7
|
+
//# sourceMappingURL=mockState.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { mockState } from "./appSlice/mocks.js";
|
|
2
|
+
import { mockState as mockState$1 } from "./deploymentsSlice/mocks.js";
|
|
3
|
+
import { mockState as mockState$2 } from "./devicesSlice/mocks.js";
|
|
4
|
+
import { mockState as mockState$3 } from "./monitorSlice/mocks.js";
|
|
5
|
+
import { mockState as mockState$4 } from "./onboardingSlice/mocks.js";
|
|
6
|
+
import { mockState as mockState$5 } from "./organizationSlice/mocks.js";
|
|
7
|
+
import { mockState as mockState$6 } from "./releasesSlice/mocks.js";
|
|
8
|
+
import { mockState as mockState$7 } from "./usersSlice/mocks.js";
|
|
9
|
+
//#region src/mockState.ts
|
|
10
|
+
const defaultState = {
|
|
11
|
+
app: { ...mockState },
|
|
12
|
+
deployments: { ...mockState$1 },
|
|
13
|
+
devices: { ...mockState$2 },
|
|
14
|
+
monitor: { ...mockState$3 },
|
|
15
|
+
onboarding: { ...mockState$4 },
|
|
16
|
+
organization: { ...mockState$5 },
|
|
17
|
+
releases: { ...mockState$6 },
|
|
18
|
+
users: { ...mockState$7 }
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { defaultState };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=mockState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockState.js","names":["appMockState","deploymentsMockState","devicesMockState","monitorMockState","onboardingMockState","organizationMockState","releasesMockState","usersMockState"],"sources":["../src/mockState.ts"],"sourcesContent":["// Copyright 2026 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 { mockState as appMockState } from './appSlice/mocks';\nimport { mockState as deploymentsMockState } from './deploymentsSlice/mocks';\nimport { mockState as devicesMockState } from './devicesSlice/mocks';\nimport { mockState as monitorMockState } from './monitorSlice/mocks';\nimport { mockState as onboardingMockState } from './onboardingSlice/mocks';\nimport { mockState as organizationMockState } from './organizationSlice/mocks';\nimport { mockState as releasesMockState } from './releasesSlice/mocks';\nimport type { getConfiguredStore } from './store';\nimport { mockState as usersMockState } from './usersSlice/mocks';\n\ntype PreloadedState = NonNullable<Parameters<typeof getConfiguredStore>[0]>['preloadedState'];\ntype MockState = Required<NonNullable<PreloadedState>>;\n\nexport const defaultState = {\n app: { ...appMockState },\n deployments: { ...deploymentsMockState },\n devices: { ...devicesMockState },\n monitor: { ...monitorMockState },\n onboarding: { ...onboardingMockState },\n organization: { ...organizationMockState },\n releases: { ...releasesMockState },\n users: { ...usersMockState }\n} as unknown as MockState;\n"],"mappings":";;;;;;;;;AA0BA,MAAa,eAAe;CAC1B,KAAK,EAAE,GAAGA,UAAa;CACvB,aAAa,EAAE,GAAGC,YAAqB;CACvC,SAAS,EAAE,GAAGC,YAAiB;CAC/B,SAAS,EAAE,GAAGC,YAAiB;CAC/B,YAAY,EAAE,GAAGC,YAAoB;CACrC,cAAc,EAAE,GAAGC,YAAsB;CACzC,UAAU,EAAE,GAAGC,YAAkB;CACjC,OAAO,EAAE,GAAGC,YAAe;AAC7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ut as AlertChannelKey } from "../constants-
|
|
1
|
+
import { ut as AlertChannelKey } from "../constants-CUwYPOYK.cjs";
|
|
2
2
|
export { AlertChannelKey };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ut as AlertChannelKey } from "../constants-
|
|
1
|
+
import { ut as AlertChannelKey } from "../constants-CCkKh9KM.js";
|
|
2
2
|
export { AlertChannelKey };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as monitorSlice, i as initialState, n as _default, o as sliceName, r as actions, t as MonitorSliceType } from "../index-
|
|
1
|
+
import { a as monitorSlice, i as initialState, n as _default, o as sliceName, r as actions, t as MonitorSliceType } from "../index-BcrZxKLw.cjs";
|
|
2
2
|
export { MonitorSliceType, actions, _default as default, initialState, monitorSlice, sliceName };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as monitorSlice, i as initialState, n as _default, o as sliceName, r as actions, t as MonitorSliceType } from "../index-
|
|
1
|
+
import { a as monitorSlice, i as initialState, n as _default, o as sliceName, r as actions, t as MonitorSliceType } from "../index-C2za83Qs.js";
|
|
2
2
|
export { MonitorSliceType, actions, _default as default, initialState, monitorSlice, sliceName };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DEVICE_ISSUE_OPTIONS, l as DEVICE_LIST_DEFAULTS, p as alertChannels } from "../constants-
|
|
1
|
+
import { c as DEVICE_ISSUE_OPTIONS, l as DEVICE_LIST_DEFAULTS, p as alertChannels } from "../constants-DjiC_FnZ.js";
|
|
2
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
3
3
|
//#region src/monitorSlice/index.ts
|
|
4
4
|
const sliceName = "monitor";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DEVICE_ISSUE_OPTIONS, l as DEVICE_LIST_DEFAULTS } from "../constants-
|
|
1
|
+
import { c as DEVICE_ISSUE_OPTIONS, l as DEVICE_LIST_DEFAULTS } from "../constants-DjiC_FnZ.js";
|
|
2
2
|
import { initialState } from "./index.js";
|
|
3
3
|
//#region src/monitorSlice/mocks.ts
|
|
4
4
|
const mockState = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.cjs","names":[],"sources":["../../src/monitorSlice/selectors.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 {
|
|
1
|
+
{"version":3,"file":"selectors.cjs","names":[],"sources":["../../src/monitorSlice/selectors.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 { MonitorSliceType } from '.';\n\nexport type MonitorState = { monitor: MonitorSliceType };\n\nexport const getIssueCountsByType = (state: MonitorState) => state.monitor.issueCounts.byType;\n"],"mappings":";;AAiBA,MAAa,wBAAwB,UAAwB,MAAM,QAAQ,YAAY"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const getIssueCountsByType: (state: RootState) => {
|
|
4
|
-
[x: string]: {
|
|
5
|
-
filtered: number;
|
|
6
|
-
total: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
//# sourceMappingURL=selectors.d.cts.map
|
|
1
|
+
import { n as getIssueCountsByType, t as MonitorState } from "../selectors-aLOjKkxN.cjs";
|
|
2
|
+
export { MonitorState, getIssueCountsByType };
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const getIssueCountsByType: (state: RootState) => {
|
|
4
|
-
[x: string]: {
|
|
5
|
-
filtered: number;
|
|
6
|
-
total: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
//# sourceMappingURL=selectors.d.ts.map
|
|
1
|
+
import { n as getIssueCountsByType, t as MonitorState } from "../selectors-vk0GUGHf.js";
|
|
2
|
+
export { MonitorState, getIssueCountsByType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.js","names":[],"sources":["../../src/monitorSlice/selectors.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 {
|
|
1
|
+
{"version":3,"file":"selectors.js","names":[],"sources":["../../src/monitorSlice/selectors.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 { MonitorSliceType } from '.';\n\nexport type MonitorState = { monitor: MonitorSliceType };\n\nexport const getIssueCountsByType = (state: MonitorState) => state.monitor.issueCounts.byType;\n"],"mappings":";AAiBA,MAAa,wBAAwB,UAAwB,MAAM,QAAQ,YAAY"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_constants = require("../constants-MVizYy89.cjs");
|
|
3
2
|
const require_monitorSlice_index = require("./index.cjs");
|
|
4
3
|
const require_actions = require("../actions.cjs");
|
|
5
4
|
const require_devicesSlice_selectors = require("../devicesSlice/selectors.cjs");
|
|
@@ -34,7 +33,7 @@ const getLatestDeviceAlerts = require_store.createAppAsyncThunk(`${require_monit
|
|
|
34
33
|
});
|
|
35
34
|
const getIssueCountsByType = require_store.createAppAsyncThunk(`${require_monitorSlice_index.sliceName}/getIssueCountsByType`, async ({ type, options = {} }, { dispatch, getState }) => {
|
|
36
35
|
const state = getState();
|
|
37
|
-
const { filters = require_devicesSlice_selectors.getDeviceFilters(state), group, status, ...remainder } = options;
|
|
36
|
+
const { filters = require_devicesSlice_selectors.getDeviceFilters(state), group, status = _northern_tech_utils_constants.DEVICE_STATES.accepted, ...remainder } = options;
|
|
38
37
|
const { applicableFilters: nonMonitorFilters, filterTerms } = require_utils.convertDeviceListStateToFilters({
|
|
39
38
|
...remainder,
|
|
40
39
|
filters,
|
|
@@ -72,7 +71,7 @@ const changeNotificationSetting = require_store.createAppAsyncThunk(`${require_m
|
|
|
72
71
|
enabled
|
|
73
72
|
})), dispatch(require_actions.setSnackbar({
|
|
74
73
|
message: `Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`,
|
|
75
|
-
autoHideDuration:
|
|
74
|
+
autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
|
|
76
75
|
}))])));
|
|
77
76
|
//#endregion
|
|
78
77
|
exports.changeNotificationSetting = changeNotificationSetting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thunks.cjs","names":["DEVICE_LIST_DEFAULTS","createAppAsyncThunk","sliceName","Api","monitorApiUrlv1","commonErrorHandler","actions","headerNames","getDeviceFilters","convertDeviceListStateToFilters","inventoryApiUrlV2","commonErrorFallback","storeActions","alertChannels","TIMEOUTS"],"sources":["../../src/monitorSlice/thunks.ts"],"sourcesContent":["// Copyright 2021 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 { DeviceFilter } from '@/src/devicesSlice';\nimport type { Alert, DeviceInventoryResponse, MonitorConfiguration } from '@northern.tech/types/MenderTypes';\n\nimport { actions, sliceName } from '.';\nimport storeActions from '../actions';\nimport Api from '../api/general-api';\nimport type { AlertChannelKey, DeviceIssueOptionKey } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, TIMEOUTS, alertChannels, headerNames, inventoryApiUrlV2, monitorApiUrlv1 } from '../constants';\nimport { getDeviceFilters } from '../selectors';\nimport { commonErrorFallback, commonErrorHandler, createAppAsyncThunk } from '../store';\nimport { convertDeviceListStateToFilters } from '../utils';\n\nconst { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;\n\nconst cutoffLength = 75;\nconst ellipsis = '...';\nconst longTextTrimmer = (text: string): string =>\n text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;\n\nconst sanitizeDeviceAlerts = (alerts: Alert[]) => alerts.map(alert => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name || '') }));\n\ninterface GetDeviceAlertsPayload {\n config?: { issuedAfter?: string; issuedBefore?: string; page?: number; perPage?: number; sortAscending?: boolean };\n id: string;\n}\nexport const getDeviceAlerts = createAppAsyncThunk(`${sliceName}/getDeviceAlerts`, ({ id, config = {} }: GetDeviceAlertsPayload, { dispatch }) => {\n const { page = defaultPage, perPage = defaultPerPage, issuedBefore, issuedAfter, sortAscending = false } = config;\n const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : '';\n const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : '';\n return Api.get<Alert[]>(\n `${monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`\n )\n .catch(err => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch))\n .then(res =>\n Promise.all([\n dispatch(actions.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),\n dispatch(actions.setAlertListState({ total: Number(res.headers[headerNames.total]) }))\n ])\n );\n});\n\ninterface GetLatestDeviceAlertsPayload {\n config?: { page?: number; perPage?: number };\n id: string;\n}\nexport const getLatestDeviceAlerts = createAppAsyncThunk(\n `${sliceName}/getLatestDeviceAlerts`,\n ({ id, config = {} }: GetLatestDeviceAlertsPayload, { dispatch }) => {\n const { page = defaultPage, perPage = 10 } = config;\n return Api.get<Alert[]>(`${monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`)\n .catch(err => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch))\n .then(res => Promise.resolve(dispatch(actions.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));\n }\n);\n\ninterface GetIssueCountsByTypePayload {\n options?: Partial<{ filters: DeviceFilter[]; group: string; status: string; type: string }>;\n type: DeviceIssueOptionKey;\n}\nexport const getIssueCountsByType = createAppAsyncThunk(\n `${sliceName}/getIssueCountsByType`,\n async ({ type, options = {} }: GetIssueCountsByTypePayload, { dispatch, getState }) => {\n const state = getState();\n const { filters = getDeviceFilters(state), group, status, ...remainder } = options;\n const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({\n ...remainder,\n filters,\n group,\n offlineThreshold: state.app.offlineThreshold,\n selectedIssues: [type],\n status\n });\n const res = await Api.post<DeviceInventoryResponse[]>(`${inventoryApiUrlV2}/filters/search`, {\n page: 1,\n per_page: 1,\n filters: filterTerms,\n attributes: [{ scope: 'identity', attribute: 'status' }]\n }).catch(err => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback));\n const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[headerNames.total]);\n const filtered = nonMonitorFilters.length ? Number(res.headers[headerNames.total]) : total;\n if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {\n return;\n }\n return dispatch(actions.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type }));\n }\n);\n\nexport const getDeviceMonitorConfig = createAppAsyncThunk(`${sliceName}/getDeviceMonitorConfig`, (id: string, { dispatch }) =>\n Api.get<MonitorConfiguration[]>(`${monitorApiUrlv1}/devices/${id}/config`)\n .catch(err => commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch))\n .then(({ data }) => Promise.all([dispatch(storeActions.receivedDevice({ id, monitors: data }), Promise.resolve(data))]))\n);\n\ninterface ChangeNotificationSettingPayload {\n channel?: AlertChannelKey;\n enabled: boolean;\n}\nexport const changeNotificationSetting = createAppAsyncThunk(\n `${sliceName}/changeNotificationSetting`,\n ({ enabled, channel = alertChannels.email as AlertChannelKey }: ChangeNotificationSettingPayload, { dispatch }) =>\n Api.put(`${monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled })\n .catch(err => commonErrorHandler(err, `${enabled ? 'En' : 'Dis'}abling ${channel} alerts failed:`, dispatch))\n .then(() =>\n Promise.all([\n dispatch(actions.changeAlertChannel({ channel, enabled })),\n dispatch(\n storeActions.setSnackbar({ message: `Successfully ${enabled ? 'en' : 'dis'}abled ${channel} alerts`, autoHideDuration: TIMEOUTS.fiveSeconds })\n )\n ])\n )\n);\n"],"mappings":";;;;;;;;;;AAyBA,MAAM,EAAE,MAAM,aAAa,SAAS,mBAAmBA,+BAAAA;AAGvD,MAAM,WAAW;AACjB,MAAM,mBAAmB,SACvB,KAAK,UAAU,KAAiC,GAAG,KAAK,UAAU,GAAG,EAA8B,IAAI,aAAa;AAEtH,MAAM,wBAAwB,WAAoB,OAAO,KAAI,WAAU;CAAE,GAAG;CAAO,UAAU,MAAM;CAAM,MAAM,gBAAgB,MAAM,QAAQ,EAAE;AAAE,EAAE;AAMnJ,MAAa,kBAAkBC,cAAAA,oBAAoB,GAAGC,2BAAAA,UAAU,oBAAoB,EAAE,IAAI,SAAS,CAAC,KAA6B,EAAE,eAAe;CAChJ,MAAM,EAAE,OAAO,aAAa,UAAU,gBAAgB,cAAc,aAAa,gBAAgB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,IAAI,CAAC,CAAC,CAAC,CAAC,CAC3H;AAMA,MAAa,4BAA4BX,cAAAA,oBACvC,GAAGC,2BAAAA,UAAU,8BACZ,EAAE,SAAS,UAAUW,+BAAAA,cAAc,SAA8D,EAAE,eAClGV,wBAAAA,QAAI,IAAI,GAAGC,+BAAAA,gBAAgB,kCAAkC,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,CACxF,OAAM,QAAOC,cAAAA,mBAAmB,KAAK,GAAG,UAAU,OAAO,MAAM,UAAU,QAAQ,kBAAkB,QAAQ,CAAC,CAAC,CAC7G,WACC,QAAQ,IAAI,CACV,SAASC,2BAAAA,QAAQ,mBAAmB;CAAE;CAAS;AAAQ,CAAC,CAAC,GACzD,SACEM,gBAAa,YAAY;CAAE,SAAS,gBAAgB,UAAU,OAAO,MAAM,QAAQ,QAAQ;CAAU,kBAAkBE,kBAAAA,SAAS;AAAY,CAAC,CAC/I,CACF,CAAC,CACH,CACN"}
|
|
1
|
+
{"version":3,"file":"thunks.cjs","names":["DEVICE_LIST_DEFAULTS","createAppAsyncThunk","sliceName","Api","monitorApiUrlv1","commonErrorHandler","actions","headerNames","getDeviceFilters","DEVICE_STATES","convertDeviceListStateToFilters","inventoryApiUrlV2","commonErrorFallback","storeActions","alertChannels","TIMEOUTS"],"sources":["../../src/monitorSlice/thunks.ts"],"sourcesContent":["// Copyright 2021 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 { DeviceFilter } from '@/src/devicesSlice';\nimport type { Alert, DeviceInventoryResponse, MonitorConfiguration } from '@northern.tech/types/MenderTypes';\nimport { TIMEOUTS } from '@northern.tech/utils/constants';\n\nimport { actions, sliceName } from '.';\nimport storeActions from '../actions';\nimport Api from '../api/general-api';\nimport type { AlertChannelKey, DeviceIssueOptionKey } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, alertChannels, headerNames, inventoryApiUrlV2, monitorApiUrlv1 } from '../constants';\nimport { getDeviceFilters } from '../selectors';\nimport { commonErrorFallback, commonErrorHandler, createAppAsyncThunk } from '../store';\nimport { convertDeviceListStateToFilters } from '../utils';\n\nconst { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;\n\nconst cutoffLength = 75;\nconst ellipsis = '...';\nconst longTextTrimmer = (text: string): string =>\n text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;\n\nconst sanitizeDeviceAlerts = (alerts: Alert[]) => alerts.map(alert => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name || '') }));\n\ninterface GetDeviceAlertsPayload {\n config?: { issuedAfter?: string; issuedBefore?: string; page?: number; perPage?: number; sortAscending?: boolean };\n id: string;\n}\nexport const getDeviceAlerts = createAppAsyncThunk(`${sliceName}/getDeviceAlerts`, ({ id, config = {} }: GetDeviceAlertsPayload, { dispatch }) => {\n const { page = defaultPage, perPage = defaultPerPage, issuedBefore, issuedAfter, sortAscending = false } = config;\n const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : '';\n const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : '';\n return Api.get<Alert[]>(\n `${monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`\n )\n .catch(err => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch))\n .then(res =>\n Promise.all([\n dispatch(actions.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),\n dispatch(actions.setAlertListState({ total: Number(res.headers[headerNames.total]) }))\n ])\n );\n});\n\ninterface GetLatestDeviceAlertsPayload {\n config?: { page?: number; perPage?: number };\n id: string;\n}\nexport const getLatestDeviceAlerts = createAppAsyncThunk(\n `${sliceName}/getLatestDeviceAlerts`,\n ({ id, config = {} }: GetLatestDeviceAlertsPayload, { dispatch }) => {\n const { page = defaultPage, perPage = 10 } = config;\n return Api.get<Alert[]>(`${monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`)\n .catch(err => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch))\n .then(res => Promise.resolve(dispatch(actions.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));\n }\n);\n\ninterface GetIssueCountsByTypePayload {\n options?: Partial<{ filters: DeviceFilter[]; group: string; status: string; type: string }>;\n type: DeviceIssueOptionKey;\n}\nexport const getIssueCountsByType = createAppAsyncThunk(\n `${sliceName}/getIssueCountsByType`,\n async ({ type, options = {} }: GetIssueCountsByTypePayload, { dispatch, getState }) => {\n const state = getState();\n const { filters = getDeviceFilters(state), group, status = DEVICE_STATES.accepted, ...remainder } = options;\n const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({\n ...remainder,\n filters,\n group,\n offlineThreshold: state.app.offlineThreshold,\n selectedIssues: [type],\n status\n });\n const res = await Api.post<DeviceInventoryResponse[]>(`${inventoryApiUrlV2}/filters/search`, {\n page: 1,\n per_page: 1,\n filters: filterTerms,\n attributes: [{ scope: 'identity', attribute: 'status' }]\n }).catch(err => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback));\n const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[headerNames.total]);\n const filtered = nonMonitorFilters.length ? Number(res.headers[headerNames.total]) : total;\n if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {\n return;\n }\n return dispatch(actions.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type }));\n }\n);\n\nexport const getDeviceMonitorConfig = createAppAsyncThunk(`${sliceName}/getDeviceMonitorConfig`, (id: string, { dispatch }) =>\n Api.get<MonitorConfiguration[]>(`${monitorApiUrlv1}/devices/${id}/config`)\n .catch(err => commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch))\n .then(({ data }) => Promise.all([dispatch(storeActions.receivedDevice({ id, monitors: data }), Promise.resolve(data))]))\n);\n\ninterface ChangeNotificationSettingPayload {\n channel?: AlertChannelKey;\n enabled: boolean;\n}\nexport const changeNotificationSetting = createAppAsyncThunk(\n `${sliceName}/changeNotificationSetting`,\n ({ enabled, channel = alertChannels.email as AlertChannelKey }: ChangeNotificationSettingPayload, { dispatch }) =>\n Api.put(`${monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled })\n .catch(err => commonErrorHandler(err, `${enabled ? 'En' : 'Dis'}abling ${channel} alerts failed:`, dispatch))\n .then(() =>\n Promise.all([\n dispatch(actions.changeAlertChannel({ channel, enabled })),\n dispatch(\n storeActions.setSnackbar({ message: `Successfully ${enabled ? 'en' : 'dis'}abled ${channel} alerts`, autoHideDuration: TIMEOUTS.fiveSeconds })\n )\n ])\n )\n);\n"],"mappings":";;;;;;;;;AA0BA,MAAM,EAAE,MAAM,aAAa,SAAS,mBAAmBA,+BAAAA;AAGvD,MAAM,WAAW;AACjB,MAAM,mBAAmB,SACvB,KAAK,UAAU,KAAiC,GAAG,KAAK,UAAU,GAAG,EAA8B,IAAI,aAAa;AAEtH,MAAM,wBAAwB,WAAoB,OAAO,KAAI,WAAU;CAAE,GAAG;CAAO,UAAU,MAAM;CAAM,MAAM,gBAAgB,MAAM,QAAQ,EAAE;AAAE,EAAE;AAMnJ,MAAa,kBAAkBC,cAAAA,oBAAoB,GAAGC,2BAAAA,UAAU,oBAAoB,EAAE,IAAI,SAAS,CAAC,KAA6B,EAAE,eAAe;CAChJ,MAAM,EAAE,OAAO,aAAa,UAAU,gBAAgB,cAAc,aAAa,gBAAgB,UAAU;CAC3G,MAAM,eA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I,CAAC,CAAC,CAAC,CAAC,CAC3H;AAMA,MAAa,4BAA4BZ,cAAAA,oBACvC,GAAGC,2BAAAA,UAAU,8BACZ,EAAE,SAAS,UAAUY,+BAAAA,cAAc,SAA8D,EAAE,eAClGX,wBAAAA,QAAI,IAAI,GAAGC,+BAAAA,gBAAgB,kCAAkC,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,CACxF,OAAM,QAAOC,cAAAA,mBAAmB,KAAK,GAAG,UAAU,OAAO,MAAM,UAAU,QAAQ,kBAAkB,QAAQ,CAAC,CAAC,CAC7G,WACC,QAAQ,IAAI,CACV,SAASC,2BAAAA,QAAQ,mBAAmB;CAAE;CAAS;AAAQ,CAAC,CAAC,GACzD,SACEO,gBAAa,YAAY;CAAE,SAAS,gBAAgB,UAAU,OAAO,MAAM,QAAQ,QAAQ;CAAU,kBAAkBE,+BAAAA,SAAS;AAAY,CAAC,CAC/I,CACF,CAAC,CACH,CACN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "../constants-
|
|
2
|
-
import { r as DeviceFilter, t as Device } from "../index-
|
|
3
|
-
import { i as SnackbarContent } from "../index-
|
|
4
|
-
import {
|
|
1
|
+
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "../constants-CUwYPOYK.cjs";
|
|
2
|
+
import { r as DeviceFilter, t as Device } from "../index-7jVuB4tG.cjs";
|
|
3
|
+
import { i as SnackbarContent } from "../index-CaNZaXie.cjs";
|
|
4
|
+
import { i as RootState, t as AppDispatch } from "../store-CCvk8X-k.cjs";
|
|
5
5
|
//#region src/monitorSlice/thunks.d.ts
|
|
6
6
|
interface GetDeviceAlertsPayload {
|
|
7
7
|
config?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "../constants-
|
|
2
|
-
import { r as DeviceFilter, t as Device } from "../index-
|
|
3
|
-
import { i as SnackbarContent } from "../index-
|
|
4
|
-
import {
|
|
1
|
+
import { m as DeviceIssueOptionKey, ut as AlertChannelKey } from "../constants-CCkKh9KM.js";
|
|
2
|
+
import { r as DeviceFilter, t as Device } from "../index-DOPRnlaC.js";
|
|
3
|
+
import { i as SnackbarContent } from "../index-CThE5Gfh.js";
|
|
4
|
+
import { i as RootState, t as AppDispatch } from "../store-v5V-bbB_.js";
|
|
5
5
|
//#region src/monitorSlice/thunks.d.ts
|
|
6
6
|
interface GetDeviceAlertsPayload {
|
|
7
7
|
config?: {
|