@northern.tech/store 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/actions.cjs +20 -17
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.js +8 -8
  4. package/dist/api/general-api.js +2 -2
  5. package/dist/api/types/Tenant.ts +17 -12
  6. package/dist/api/users-api.js +2 -2
  7. package/dist/appSlice/constants.cjs +18 -10
  8. package/dist/appSlice/constants.cjs.map +1 -1
  9. package/dist/appSlice/constants.d.cts +41 -84
  10. package/dist/appSlice/constants.d.ts +41 -84
  11. package/dist/appSlice/constants.js +1 -1
  12. package/dist/appSlice/index.js +2 -2
  13. package/dist/appSlice/thunks.cjs +137 -94
  14. package/dist/appSlice/thunks.cjs.map +1 -1
  15. package/dist/appSlice/thunks.js +19 -19
  16. package/dist/auth.js +2 -2
  17. package/dist/{chunk-Q6M5TTDQ.js → chunk-2CYOM4BK.js} +1 -1
  18. package/dist/chunk-2CYOM4BK.js.map +1 -0
  19. package/dist/{chunk-74OJIKXF.js → chunk-2JHFUQ6B.js} +133 -96
  20. package/dist/chunk-2JHFUQ6B.js.map +1 -0
  21. package/dist/{chunk-YETZPQFR.js → chunk-4XJMRVFI.js} +12 -11
  22. package/dist/chunk-4XJMRVFI.js.map +1 -0
  23. package/dist/{chunk-RX55KAKX.js → chunk-7JKWI5FK.js} +2 -2
  24. package/dist/{chunk-A6CT6GTI.js → chunk-C5NEDBJI.js} +17 -11
  25. package/dist/chunk-C5NEDBJI.js.map +1 -0
  26. package/dist/{chunk-NNADGHSL.js → chunk-DAPAXWA5.js} +8 -8
  27. package/dist/{chunk-ANB5BM5J.js → chunk-DCK2DBOA.js} +27 -20
  28. package/dist/chunk-DCK2DBOA.js.map +1 -0
  29. package/dist/{chunk-E5LEU5PF.js → chunk-HPBE6KYY.js} +2 -2
  30. package/dist/{chunk-2RJIDREZ.js → chunk-LEMVXAYP.js} +25 -16
  31. package/dist/chunk-LEMVXAYP.js.map +1 -0
  32. package/dist/{chunk-NI4SZOCF.js → chunk-LGNOTPUG.js} +9 -9
  33. package/dist/{chunk-MDC7Y3EX.js → chunk-LTKOV26W.js} +22 -20
  34. package/dist/chunk-LTKOV26W.js.map +1 -0
  35. package/dist/{chunk-YTQUNAZP.js → chunk-QRGTG4YB.js} +2 -2
  36. package/dist/{chunk-XTRPX7JZ.js → chunk-TI2RL5P2.js} +2 -2
  37. package/dist/chunk-TI2RL5P2.js.map +1 -0
  38. package/dist/{chunk-YGBFDXXA.js → chunk-TUACATJA.js} +2 -2
  39. package/dist/{chunk-25AKG5HH.js → chunk-UWMYZNUB.js} +19 -11
  40. package/dist/chunk-UWMYZNUB.js.map +1 -0
  41. package/dist/{chunk-UEP36GCI.js → chunk-VMNMD6KF.js} +2 -2
  42. package/dist/{chunk-KAQJH2YL.js → chunk-WXL7PVI5.js} +12 -4
  43. package/dist/chunk-WXL7PVI5.js.map +1 -0
  44. package/dist/{chunk-VOCOFE4I.js → chunk-X7IEZBM4.js} +2 -2
  45. package/dist/{chunk-XXHONFSQ.js → chunk-YDS36ALB.js} +3 -3
  46. package/dist/{chunk-XXHONFSQ.js.map → chunk-YDS36ALB.js.map} +1 -1
  47. package/dist/commonSelectors.cjs +40 -18
  48. package/dist/commonSelectors.cjs.map +1 -1
  49. package/dist/commonSelectors.d.cts +54 -46
  50. package/dist/commonSelectors.d.ts +54 -46
  51. package/dist/commonSelectors.js +9 -9
  52. package/dist/constants.cjs +35 -19
  53. package/dist/constants.cjs.map +1 -1
  54. package/dist/constants.d.cts +3 -3
  55. package/dist/constants.d.ts +3 -3
  56. package/dist/constants.js +6 -2
  57. package/dist/deploymentdevicehook.cjs +143 -99
  58. package/dist/deploymentdevicehook.cjs.map +1 -1
  59. package/dist/deploymentdevicehook.d.cts +1 -1
  60. package/dist/deploymentdevicehook.d.ts +1 -1
  61. package/dist/deploymentdevicehook.js +24 -22
  62. package/dist/deploymentdevicehook.js.map +1 -1
  63. package/dist/deploymentsSlice/constants.cjs +8 -8
  64. package/dist/deploymentsSlice/constants.cjs.map +1 -1
  65. package/dist/deploymentsSlice/constants.js +2 -2
  66. package/dist/deploymentsSlice/index.cjs +8 -8
  67. package/dist/deploymentsSlice/index.cjs.map +1 -1
  68. package/dist/deploymentsSlice/index.js +3 -3
  69. package/dist/deploymentsSlice/selectors.cjs +8 -8
  70. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  71. package/dist/deploymentsSlice/selectors.js +3 -3
  72. package/dist/deploymentsSlice/thunks.cjs +137 -94
  73. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  74. package/dist/deploymentsSlice/thunks.js +19 -19
  75. package/dist/devicesSlice/constants.cjs +11 -8
  76. package/dist/devicesSlice/constants.cjs.map +1 -1
  77. package/dist/devicesSlice/constants.d.cts +2 -1
  78. package/dist/devicesSlice/constants.d.ts +2 -1
  79. package/dist/devicesSlice/constants.js +4 -2
  80. package/dist/devicesSlice/index.cjs +8 -8
  81. package/dist/devicesSlice/index.cjs.map +1 -1
  82. package/dist/devicesSlice/index.js +3 -3
  83. package/dist/devicesSlice/selectors.cjs +9 -9
  84. package/dist/devicesSlice/selectors.cjs.map +1 -1
  85. package/dist/devicesSlice/selectors.js +3 -3
  86. package/dist/devicesSlice/thunks.cjs +139 -94
  87. package/dist/devicesSlice/thunks.cjs.map +1 -1
  88. package/dist/devicesSlice/thunks.d.cts +12 -2
  89. package/dist/devicesSlice/thunks.d.ts +12 -2
  90. package/dist/devicesSlice/thunks.js +21 -19
  91. package/dist/flag-eu-5477R2P4.svg +130 -0
  92. package/dist/flag-us-HNQAF66I.svg +63 -0
  93. package/dist/monitorSlice/constants.cjs +8 -8
  94. package/dist/monitorSlice/constants.cjs.map +1 -1
  95. package/dist/monitorSlice/constants.js +2 -2
  96. package/dist/monitorSlice/index.cjs +8 -8
  97. package/dist/monitorSlice/index.cjs.map +1 -1
  98. package/dist/monitorSlice/index.js +3 -3
  99. package/dist/monitorSlice/thunks.cjs +59 -37
  100. package/dist/monitorSlice/thunks.cjs.map +1 -1
  101. package/dist/monitorSlice/thunks.js +17 -17
  102. package/dist/onboardingSlice/thunks.cjs +146 -100
  103. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  104. package/dist/onboardingSlice/thunks.d.cts +1 -32
  105. package/dist/onboardingSlice/thunks.d.ts +1 -32
  106. package/dist/onboardingSlice/thunks.js +19 -19
  107. package/dist/organizationSlice/constants.cjs +22 -17
  108. package/dist/organizationSlice/constants.cjs.map +1 -1
  109. package/dist/organizationSlice/constants.d.cts +33 -1
  110. package/dist/organizationSlice/constants.d.ts +33 -1
  111. package/dist/organizationSlice/constants.js +4 -2
  112. package/dist/organizationSlice/index.cjs +18 -15
  113. package/dist/organizationSlice/index.cjs.map +1 -1
  114. package/dist/organizationSlice/index.d.cts +26 -1012
  115. package/dist/organizationSlice/index.d.ts +26 -1012
  116. package/dist/organizationSlice/index.js +3 -3
  117. package/dist/organizationSlice/selectors.cjs.map +1 -1
  118. package/dist/organizationSlice/selectors.d.cts +9 -1
  119. package/dist/organizationSlice/selectors.d.ts +9 -1
  120. package/dist/organizationSlice/selectors.js +3 -3
  121. package/dist/organizationSlice/thunks.cjs +1605 -1539
  122. package/dist/organizationSlice/thunks.cjs.map +1 -1
  123. package/dist/organizationSlice/thunks.d.cts +61 -36
  124. package/dist/organizationSlice/thunks.d.ts +61 -36
  125. package/dist/organizationSlice/thunks.js +19 -19
  126. package/dist/organizationSlice/types.cjs +19 -0
  127. package/dist/organizationSlice/types.cjs.map +1 -0
  128. package/dist/organizationSlice/types.d.cts +114 -0
  129. package/dist/organizationSlice/types.d.ts +114 -0
  130. package/dist/organizationSlice/types.js +1 -0
  131. package/dist/organizationSlice/types.js.map +1 -0
  132. package/dist/releasesSlice/index.js +2 -2
  133. package/dist/releasesSlice/selectors.cjs +11 -0
  134. package/dist/releasesSlice/selectors.cjs.map +1 -1
  135. package/dist/releasesSlice/selectors.js +4 -4
  136. package/dist/releasesSlice/thunks.cjs +73 -49
  137. package/dist/releasesSlice/thunks.cjs.map +1 -1
  138. package/dist/releasesSlice/thunks.d.cts +1 -4
  139. package/dist/releasesSlice/thunks.d.ts +1 -4
  140. package/dist/releasesSlice/thunks.js +17 -17
  141. package/dist/selectors.cjs +46 -18
  142. package/dist/selectors.cjs.map +1 -1
  143. package/dist/selectors.d.cts +9 -1
  144. package/dist/selectors.d.ts +9 -1
  145. package/dist/selectors.js +36 -30
  146. package/dist/store.cjs +36 -23
  147. package/dist/store.cjs.map +1 -1
  148. package/dist/store.d.cts +12 -231
  149. package/dist/store.d.ts +12 -231
  150. package/dist/store.js +13 -11
  151. package/dist/storehooks.cjs +216 -137
  152. package/dist/storehooks.cjs.map +1 -1
  153. package/dist/storehooks.js +36 -24
  154. package/dist/storehooks.js.map +1 -1
  155. package/dist/thunks.cjs +193 -122
  156. package/dist/thunks.cjs.map +1 -1
  157. package/dist/thunks.d.cts +5 -1
  158. package/dist/thunks.d.ts +5 -1
  159. package/dist/thunks.js +21 -19
  160. package/dist/usersSlice/constants.cjs +10 -10
  161. package/dist/usersSlice/constants.cjs.map +1 -1
  162. package/dist/usersSlice/constants.js +2 -2
  163. package/dist/usersSlice/index.cjs +10 -10
  164. package/dist/usersSlice/index.cjs.map +1 -1
  165. package/dist/usersSlice/index.js +3 -3
  166. package/dist/usersSlice/selectors.cjs +35 -13
  167. package/dist/usersSlice/selectors.cjs.map +1 -1
  168. package/dist/usersSlice/selectors.d.cts +44 -1
  169. package/dist/usersSlice/selectors.d.ts +44 -1
  170. package/dist/usersSlice/selectors.js +12 -6
  171. package/dist/usersSlice/thunks.cjs +135 -94
  172. package/dist/usersSlice/thunks.cjs.map +1 -1
  173. package/dist/usersSlice/thunks.d.cts +10 -9
  174. package/dist/usersSlice/thunks.d.ts +10 -9
  175. package/dist/usersSlice/thunks.js +19 -19
  176. package/dist/utils.cjs +17 -16
  177. package/dist/utils.cjs.map +1 -1
  178. package/dist/utils.js +3 -3
  179. package/package.json +7 -7
  180. package/dist/chunk-25AKG5HH.js.map +0 -1
  181. package/dist/chunk-2RJIDREZ.js.map +0 -1
  182. package/dist/chunk-74OJIKXF.js.map +0 -1
  183. package/dist/chunk-A6CT6GTI.js.map +0 -1
  184. package/dist/chunk-ANB5BM5J.js.map +0 -1
  185. package/dist/chunk-KAQJH2YL.js.map +0 -1
  186. package/dist/chunk-MDC7Y3EX.js.map +0 -1
  187. package/dist/chunk-Q6M5TTDQ.js.map +0 -1
  188. package/dist/chunk-XTRPX7JZ.js.map +0 -1
  189. package/dist/chunk-YETZPQFR.js.map +0 -1
  190. /package/dist/{chunk-RX55KAKX.js.map → chunk-7JKWI5FK.js.map} +0 -0
  191. /package/dist/{chunk-NNADGHSL.js.map → chunk-DAPAXWA5.js.map} +0 -0
  192. /package/dist/{chunk-E5LEU5PF.js.map → chunk-HPBE6KYY.js.map} +0 -0
  193. /package/dist/{chunk-NI4SZOCF.js.map → chunk-LGNOTPUG.js.map} +0 -0
  194. /package/dist/{chunk-YTQUNAZP.js.map → chunk-QRGTG4YB.js.map} +0 -0
  195. /package/dist/{chunk-YGBFDXXA.js.map → chunk-TUACATJA.js.map} +0 -0
  196. /package/dist/{chunk-UEP36GCI.js.map → chunk-VMNMD6KF.js.map} +0 -0
  197. /package/dist/{chunk-VOCOFE4I.js.map → chunk-X7IEZBM4.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/releasesSlice/selectors.ts","../../src/utils.ts","../../src/commonConstants.tsx"],"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 { listItemMapper } from '@northern.tech/store/utils';\nimport { createSelector } from '@reduxjs/toolkit';\n\nconst getSelectedReleaseId = state => state.releases.selectedRelease;\nexport const getReleasesById = state => state.releases.byId;\nexport const getReleaseTags = state => state.releases.tags;\nexport const getReleaseListState = state => state.releases.releasesList;\nconst getListedReleases = state => state.releases.releasesList.releaseIds;\nexport const getUpdateTypes = state => state.releases.updateTypes;\n\nconst getReleaseMappingDefaults = () => ({});\nexport const getReleasesList = createSelector([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);\n\nexport const getReleaseTagsById = createSelector([getReleaseTags], releaseTags => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));\nexport const getHasReleases = createSelector(\n [getReleaseListState, getReleasesById],\n ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)\n);\n\nexport const getSelectedRelease = createSelector([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});\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 { duplicateFilter, yes } from '@northern.tech/utils/helpers';\n\nimport { ATTRIBUTE_SCOPES, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_MAXIMUM_LENGTH, emptyUiPermissions } from './commonConstants';\nimport {\n DARK_MODE,\n DEPLOYMENT_STATES,\n defaultStats,\n deploymentDisplayStates,\n deploymentStatesToSubstates,\n deploymentStatesToSubstatesWithSkipped,\n emptyFilter\n} from './constants';\n\n// for some reason these functions can not be stored in the deviceConstants...\nconst filterProcessors = {\n $gt: val => Number(val) || val,\n $gte: val => Number(val) || val,\n $lt: val => Number(val) || val,\n $lte: val => Number(val) || val,\n $in: val => ('' + val).split(',').map(i => i.trim()),\n $nin: val => ('' + val).split(',').map(i => i.trim()),\n $exists: yes,\n $nexists: () => false\n};\nconst filterAliases = {\n $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }\n};\nexport const mapFiltersToTerms = filters =>\n filters.map(filter => ({\n scope: filter.scope,\n attribute: filter.key,\n type: filterAliases[filter.operator]?.alias || filter.operator,\n value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value\n }));\nexport const mapTermsToFilters = terms =>\n terms.map(term => {\n const aliasedFilter = Object.entries(filterAliases).find(\n aliasDefinition => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value\n );\n const operator = aliasedFilter ? aliasedFilter[0] : term.type;\n return { scope: term.scope, key: term.attribute, operator, value: term.value };\n });\n\nconst convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) =>\n issuesSelection.map(item => {\n if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === 'function') {\n return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };\n }\n return DEVICE_ISSUE_OPTIONS[item].filterRule;\n });\n\nexport const convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {\n let applicableFilters = [...filters];\n if (typeof group === 'string' && !(groups.byId[group]?.filters || applicableFilters).length) {\n applicableFilters.push({ key: 'group', value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'system' });\n }\n const nonMonitorFilters = applicableFilters.filter(\n filter =>\n !Object.values(DEVICE_ISSUE_OPTIONS).some(\n ({ filterRule }) => filter.scope !== 'inventory' && filterRule.scope === filter.scope && filterRule.key === filter.key\n )\n );\n const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });\n applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];\n const effectiveFilters = status\n ? [...applicableFilters, { key: 'status', value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'identity' }]\n : applicableFilters;\n return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };\n};\n\nconst filterCompare = (filter, item) => Object.keys(emptyFilter).every(key => item[key].toString() === filter[key].toString());\n\nexport const filtersFilter = (item, index, array) => {\n const firstIndex = array.findIndex(filter => filterCompare(filter, item));\n return firstIndex === index;\n};\n\nexport const listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {\n return ids.slice(0, cutOffSize).reduce((accu, id) => {\n if (id && byId[id]) {\n accu.push({ ...defaultObject, ...byId[id] });\n }\n return accu;\n }, []);\n};\n\nexport const mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) =>\n Object.entries(existingPermissions).reduce(\n (accu, [key, value]) => {\n let values;\n if (!accu[key]) {\n accu[key] = value;\n return accu;\n }\n if (Array.isArray(value)) {\n values = [...value, ...accu[key]].filter(duplicateFilter);\n } else {\n values = mergePermissions(accu[key], { ...value });\n }\n accu[key] = values;\n return accu;\n },\n { ...addedPermissions }\n );\n\nexport const mapUserRolesToUiPermissions = (userRoles, roles) =>\n userRoles.reduce(\n (accu, roleId) => {\n if (!(roleId && roles[roleId])) {\n return accu;\n }\n return mergePermissions(accu, roles[roleId].uiPermissions);\n },\n { ...emptyUiPermissions }\n );\n\nexport const progress = ({ loaded, total }) => {\n let uploadProgress = (loaded / total) * 100;\n return (uploadProgress = uploadProgress < 50 ? Math.ceil(uploadProgress) : Math.round(uploadProgress));\n};\n\nexport const getComparisonCompatibleVersion = version => (isNaN(version.charAt(0)) && version !== 'next' ? 'master' : version);\n\nexport const stringToBoolean = content => {\n if (!content) {\n return false;\n }\n const string = content + '';\n switch (string.trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case '1':\n return true;\n case 'false':\n case 'no':\n case '0':\n case null:\n return false;\n default:\n return Boolean(string);\n }\n};\n\nexport const groupDeploymentDevicesStats = deployment => {\n const deviceStatCollector = (deploymentStates, devices) =>\n Object.values(devices).reduce((accu, device) => (deploymentStates.includes(device.status) ? accu + 1 : accu), 0);\n\n const inprogress = deviceStatCollector(deploymentStatesToSubstates.inprogress, deployment.devices);\n const pending = deviceStatCollector(deploymentStatesToSubstates.pending, deployment.devices);\n const successes = deviceStatCollector(deploymentStatesToSubstates.successes, deployment.devices);\n const failures = deviceStatCollector(deploymentStatesToSubstates.failures, deployment.devices);\n const paused = deviceStatCollector(deploymentStatesToSubstates.paused, deployment.devices);\n return { inprogress, paused, pending, successes, failures };\n};\n\nexport const statCollector = (items, statistics) => items.reduce((accu, property) => accu + Number(statistics[property] || 0), 0);\nexport const groupDeploymentStats = (deployment, withSkipped) => {\n const { statistics = {} } = deployment;\n const { status = {} } = statistics;\n const stats = { ...defaultStats, ...status };\n let groupStates = deploymentStatesToSubstates;\n let result = {};\n if (withSkipped) {\n groupStates = deploymentStatesToSubstatesWithSkipped;\n result.skipped = statCollector(groupStates.skipped, stats);\n }\n result = {\n ...result,\n // don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership\n inprogress: statCollector(groupStates.inprogress, stats),\n pending: (deployment.max_devices ? deployment.max_devices - deployment.device_count : 0) + statCollector(groupStates.pending, stats),\n successes: statCollector(groupStates.successes, stats),\n failures: statCollector(groupStates.failures, stats),\n paused: statCollector(groupStates.paused, stats)\n };\n return result;\n};\n\nexport const getDeploymentState = deployment => {\n const { status: deploymentStatus = DEPLOYMENT_STATES.pending } = deployment;\n const { inprogress: currentProgressCount, paused } = groupDeploymentStats(deployment);\n\n let status = deploymentDisplayStates[deploymentStatus];\n if (deploymentStatus === DEPLOYMENT_STATES.pending && currentProgressCount === 0) {\n status = 'queued';\n } else if (paused > 0) {\n status = deploymentDisplayStates.paused;\n }\n return status;\n};\n\nexport const generateDeploymentGroupDetails = (filter, groupName) =>\n filter && filter.terms?.length\n ? `${groupName} (${filter.terms\n .map(filter => `${filter.attribute || filter.key} ${DEVICE_FILTERING_OPTIONS[filter.type || filter.operator].shortform} ${filter.value}`)\n .join(', ')})`\n : groupName;\n\nexport const mapDeviceAttributes = (attributes = []) =>\n attributes.reduce(\n (accu, attribute) => {\n if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n return accu;\n }\n accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {\n ...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],\n [attribute.name]: attribute.value\n };\n if (attribute.name === 'device_type' && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n accu.inventory.device_type = [].concat(attribute.value);\n }\n return accu;\n },\n { inventory: { device_type: [], artifact_name: '' }, identity: {}, monitor: {}, system: {}, tags: {} }\n );\n\nexport const isDarkMode = mode => mode === DARK_MODE;\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 React from 'react';\n\nimport { mdiAws as AWS, mdiMicrosoftAzure as Azure } from '@mdi/js';\n\nexport const DEVICE_LIST_DEFAULTS = {\n page: 1,\n perPage: 20\n};\n\nexport const timeUnits = {\n days: 'days',\n minutes: 'minutes',\n hours: 'hours'\n};\n\nexport const ALL_DEVICES = 'All devices';\nexport const UNGROUPED_GROUP = { id: '*|=ungrouped=|*', name: 'Unassigned' };\n\nexport const DEVICE_LIST_MAXIMUM_LENGTH = 50;\n\nexport const DEVICE_FILTERING_OPTIONS = {\n $eq: { key: '$eq', title: 'equals', shortform: '=' },\n $ne: { key: '$ne', title: 'not equal', shortform: '!=' },\n $gt: {\n key: '$gt',\n title: '>',\n shortform: '>',\n help: 'The \"greater than\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $gte: {\n title: '>=',\n shortform: '>=',\n help: 'The \"greater than or equal\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $lt: {\n key: '$lt',\n title: '<',\n shortform: '<',\n help: 'The \"lesser than\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $lte: {\n title: '<=',\n shortform: '<=',\n help: 'The \"lesser than or equal\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $ltne: {\n key: '$ltne',\n title: '$ltne',\n shortform: 'ltne',\n help: 'The \"lesser than or does not exist\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $in: {\n key: '$in',\n title: 'in',\n shortform: 'in',\n help: 'The \"in\" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'\n },\n $nin: {\n key: '$nin',\n title: 'not in',\n shortform: 'not in',\n help: `The \"not in\" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`\n },\n $exists: {\n key: '$exists',\n title: 'exists',\n shortform: 'exists',\n value: true,\n help: `The \"exists\" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`\n },\n $nexists: {\n key: '$nexists',\n title: `doesn't exist`,\n shortform: `doesn't exist`,\n value: true,\n help: `The \"doesn't exist\" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`\n },\n $regex: {\n key: '$regex',\n title: `matches regular expression`,\n shortform: `matches`,\n help: `The \"regular expression\" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`\n }\n};\n\nexport const DEVICE_ISSUE_OPTIONS = {\n issues: {\n isCategory: true,\n key: 'issues',\n title: 'Devices with issues',\n filterRule: {}\n },\n offline: {\n issueCategory: 'issues',\n key: 'offline',\n needsFullFiltering: true,\n needsMonitor: false,\n needsReporting: false,\n filterRule: {\n scope: 'system',\n key: 'check_in_time',\n operator: DEVICE_FILTERING_OPTIONS.$ltne.key,\n value: ({ offlineThreshold }) => offlineThreshold\n },\n title: 'Offline devices'\n },\n failedLastUpdate: {\n issueCategory: 'issues',\n key: 'failedLastUpdate',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'monitor', key: 'failed_last_update', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },\n title: 'Deployment failed'\n },\n monitoring: {\n issueCategory: 'issues',\n key: 'monitoring',\n needsFullFiltering: false,\n needsMonitor: true,\n needsReporting: false,\n filterRule: { scope: 'monitor', key: 'alerts', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },\n title: 'Monitoring alert'\n },\n authRequests: {\n key: 'authRequests',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'monitor', key: 'auth_requests', operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },\n title: 'Devices with new authentication requests'\n },\n gatewayDevices: {\n key: 'gatewayDevices',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'inventory', key: 'mender_is_gateway', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: 'true' },\n title: 'Gateway devices'\n }\n};\nconst oneSecond = 1000;\nexport const TIMEOUTS = {\n debounceDefault: 700,\n debounceShort: 300,\n halfASecond: 0.5 * oneSecond,\n oneSecond,\n twoSeconds: 2 * oneSecond,\n threeSeconds: 3 * oneSecond,\n fiveSeconds: 5 * oneSecond,\n refreshDefault: 10 * oneSecond,\n refreshLong: 60 * oneSecond\n};\n\nexport const SORTING_OPTIONS = {\n asc: 'asc',\n desc: 'desc'\n};\n\nexport const DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };\n\nexport const ATTRIBUTE_SCOPES = {\n inventory: 'inventory',\n identity: 'identity',\n monitor: 'monitor',\n system: 'system',\n tags: 'tags'\n};\n\nexport const defaultIdAttribute = Object.freeze({ attribute: 'id', scope: ATTRIBUTE_SCOPES.identity });\n\nconst credentialTypes = {\n aws: 'aws',\n http: 'http',\n sas: 'sas',\n x509: 'x509'\n};\nexport const EXTERNAL_PROVIDER = {\n 'iot-core': {\n credentialsType: credentialTypes.aws,\n icon: AWS,\n title: 'AWS IoT Core',\n twinTitle: 'Device Shadow',\n provider: 'iot-core',\n enabled: true,\n deviceTwin: true,\n configHint: <>For help finding your AWS IoT Core connection string, check the AWS IoT documentation.</>\n },\n 'iot-hub': {\n credentialsType: credentialTypes.sas,\n icon: Azure,\n title: 'Azure IoT Hub',\n twinTitle: 'Device Twin',\n provider: 'iot-hub',\n enabled: true,\n deviceTwin: true,\n configHint: (\n <span>\n For help finding your Azure IoT Hub connection string, look under &apos;Shared access policies&apos; in the Microsoft Azure UI as described{' '}\n {\n <a\n href=\"https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n here\n </a>\n }\n .\n </span>\n )\n },\n webhook: {\n credentialsType: credentialTypes.http,\n deviceTwin: false,\n // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.\n enabled: false,\n provider: 'webhook'\n }\n};\nexport const MAX_PAGE_SIZE = 500;\n\nexport const ALL_RELEASES = 'All releases';\n\nexport type UiPermissionsDefinition = Readonly<{\n auditlog: string[];\n deployments?: string[]; // deployments are so far only covered indirectly through releases + device group permissions\n groups: Record<string, string[]>;\n releases: Record<string, string[]>;\n tenantManagement: string[];\n userManagement: string[];\n}>;\n\nexport type UiRoleDefinition = {\n name: string;\n description: string;\n editable?: boolean;\n isCustom?: boolean;\n permissions?: object[];\n uiPermissions: UiPermissionsDefinition;\n};\n\nexport const emptyUiPermissions: UiPermissionsDefinition = Object.freeze({\n auditlog: [],\n deployments: [],\n groups: Object.freeze({}),\n releases: Object.freeze({}),\n tenantManagement: [],\n userManagement: []\n});\n\nexport const emptyRole: UiRoleDefinition = Object.freeze({\n name: undefined,\n description: '',\n permissions: [],\n uiPermissions: Object.freeze({ ...emptyUiPermissions })\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,qBAAqC;;;ACErC,gBAA0D;AAwL1C;AAjLT,IAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAKO,IAAM,6BAA6B;AAEnC,IAAM,2BAA2B;AAAA,EACtC,KAAK,EAAE,KAAK,OAAO,OAAO,UAAU,WAAW,IAAI;AAAA,EACnD,KAAK,EAAE,KAAK,OAAO,OAAO,aAAa,WAAW,KAAK;AAAA,EACvD,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,SAAS;AAAA,IACP,KAAK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IAAM,kBAAkB,WAAS,MAAM,SAAS;AAChD,IAAM,iBAAiB,WAAS,MAAM,SAAS;AAC/C,IAAM,sBAAsB,WAAS,MAAM,SAAS;AAC3D,IAAM,oBAAoB,WAAS,MAAM,SAAS,aAAa;AACxD,IAAM,iBAAiB,WAAS,MAAM,SAAS;AAEtD,IAAM,4BAA4B,OAAO,CAAC;AACnC,IAAM,sBAAkB,+BAAe,CAAC,iBAAiB,mBAAmB,yBAAyB,GAAG,cAAc;AAEtH,IAAM,yBAAqB,+BAAe,CAAC,cAAc,GAAG,iBAAe,YAAY,OAAO,CAAC,MAAM,SAAS,EAAE,GAAG,MAAM,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;AAC3I,IAAM,qBAAiB;AAAA,EAC5B,CAAC,qBAAqB,eAAe;AAAA,EACrC,CAAC,EAAE,aAAa,MAAM,GAAG,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,UAAU,SAAS;AAC5E;AAEO,IAAM,yBAAqB,+BAAe,CAAC,iBAAiB,oBAAoB,GAAG,CAAC,MAAM,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;","names":["AWS","Azure"]}
1
+ {"version":3,"sources":["../../src/releasesSlice/selectors.ts","../../src/utils.ts","../../src/commonConstants.tsx"],"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 { listItemMapper } from '@northern.tech/store/utils';\nimport { createSelector } from '@reduxjs/toolkit';\n\nconst getSelectedReleaseId = state => state.releases.selectedRelease;\nexport const getReleasesById = state => state.releases.byId;\nexport const getReleaseTags = state => state.releases.tags;\nexport const getReleaseListState = state => state.releases.releasesList;\nconst getListedReleases = state => state.releases.releasesList.releaseIds;\nexport const getUpdateTypes = state => state.releases.updateTypes;\n\nconst getReleaseMappingDefaults = () => ({});\nexport const getReleasesList = createSelector([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);\n\nexport const getReleaseTagsById = createSelector([getReleaseTags], releaseTags => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));\nexport const getHasReleases = createSelector(\n [getReleaseListState, getReleasesById],\n ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)\n);\n\nexport const getSelectedRelease = createSelector([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});\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 { duplicateFilter, yes } from '@northern.tech/utils/helpers';\n\nimport { ATTRIBUTE_SCOPES, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_MAXIMUM_LENGTH, emptyUiPermissions } from './commonConstants';\nimport {\n DARK_MODE,\n DEPLOYMENT_STATES,\n defaultStats,\n deploymentDisplayStates,\n deploymentStatesToSubstates,\n deploymentStatesToSubstatesWithSkipped,\n emptyFilter\n} from './constants';\n\n// for some reason these functions can not be stored in the deviceConstants...\nconst filterProcessors = {\n [DEVICE_FILTERING_OPTIONS.$gt.key]: val => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$gte.key]: val => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lt.key]: val => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$lte.key]: val => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$ltne.key]: val => Number(val) || val,\n [DEVICE_FILTERING_OPTIONS.$in.key]: val => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$nin.key]: val => ('' + val).split(',').map(i => i.trim()),\n [DEVICE_FILTERING_OPTIONS.$exists.key]: yes,\n [DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false\n};\nconst filterAliases = {\n $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }\n};\nexport const mapFiltersToTerms = filters =>\n filters.map(filter => ({\n scope: filter.scope,\n attribute: filter.key,\n type: filterAliases[filter.operator]?.alias || filter.operator,\n value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value\n }));\nexport const mapTermsToFilters = terms =>\n terms.map(term => {\n const aliasedFilter = Object.entries(filterAliases).find(\n aliasDefinition => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value\n );\n const operator = aliasedFilter ? aliasedFilter[0] : term.type;\n return { scope: term.scope, key: term.attribute, operator, value: term.value };\n });\n\nconst convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) =>\n issuesSelection.map(item => {\n if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === 'function') {\n return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };\n }\n return DEVICE_ISSUE_OPTIONS[item].filterRule;\n });\n\nexport const convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {\n let applicableFilters = [...filters];\n if (typeof group === 'string' && !(groups.byId[group]?.filters || applicableFilters).length) {\n applicableFilters.push({ key: 'group', value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'system' });\n }\n const nonMonitorFilters = applicableFilters.filter(\n filter =>\n !Object.values(DEVICE_ISSUE_OPTIONS).some(\n ({ filterRule }) => filter.scope !== 'inventory' && filterRule.scope === filter.scope && filterRule.key === filter.key\n )\n );\n const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });\n applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];\n const effectiveFilters = status\n ? [...applicableFilters, { key: 'status', value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'identity' }]\n : applicableFilters;\n return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };\n};\n\nconst filterCompare = (filter, item) => Object.keys(emptyFilter).every(key => item[key].toString() === filter[key].toString());\n\nexport const filtersFilter = (item, index, array) => {\n const firstIndex = array.findIndex(filter => filterCompare(filter, item));\n return firstIndex === index;\n};\n\nexport const listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {\n return ids.slice(0, cutOffSize).reduce((accu, id) => {\n if (id && byId[id]) {\n accu.push({ ...defaultObject, ...byId[id] });\n }\n return accu;\n }, []);\n};\n\nexport const mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) =>\n Object.entries(existingPermissions).reduce(\n (accu, [key, value]) => {\n let values;\n if (!accu[key]) {\n accu[key] = value;\n return accu;\n }\n if (Array.isArray(value)) {\n values = [...value, ...accu[key]].filter(duplicateFilter);\n } else {\n values = mergePermissions(accu[key], { ...value });\n }\n accu[key] = values;\n return accu;\n },\n { ...addedPermissions }\n );\n\nexport const mapUserRolesToUiPermissions = (userRoles, roles) =>\n userRoles.reduce(\n (accu, roleId) => {\n if (!(roleId && roles[roleId])) {\n return accu;\n }\n return mergePermissions(accu, roles[roleId].uiPermissions);\n },\n { ...emptyUiPermissions }\n );\n\nexport const progress = ({ loaded, total }) => {\n let uploadProgress = (loaded / total) * 100;\n return (uploadProgress = uploadProgress < 50 ? Math.ceil(uploadProgress) : Math.round(uploadProgress));\n};\n\nexport const getComparisonCompatibleVersion = version => (isNaN(version.charAt(0)) && version !== 'next' ? 'master' : version);\n\nexport const stringToBoolean = content => {\n if (!content) {\n return false;\n }\n const string = content + '';\n switch (string.trim().toLowerCase()) {\n case 'true':\n case 'yes':\n case '1':\n return true;\n case 'false':\n case 'no':\n case '0':\n case null:\n return false;\n default:\n return Boolean(string);\n }\n};\n\nexport const groupDeploymentDevicesStats = deployment => {\n const deviceStatCollector = (deploymentStates, devices) =>\n Object.values(devices).reduce((accu, device) => (deploymentStates.includes(device.status) ? accu + 1 : accu), 0);\n\n const inprogress = deviceStatCollector(deploymentStatesToSubstates.inprogress, deployment.devices);\n const pending = deviceStatCollector(deploymentStatesToSubstates.pending, deployment.devices);\n const successes = deviceStatCollector(deploymentStatesToSubstates.successes, deployment.devices);\n const failures = deviceStatCollector(deploymentStatesToSubstates.failures, deployment.devices);\n const paused = deviceStatCollector(deploymentStatesToSubstates.paused, deployment.devices);\n return { inprogress, paused, pending, successes, failures };\n};\n\nexport const statCollector = (items, statistics) => items.reduce((accu, property) => accu + Number(statistics[property] || 0), 0);\nexport const groupDeploymentStats = (deployment, withSkipped) => {\n const { statistics = {} } = deployment;\n const { status = {} } = statistics;\n const stats = { ...defaultStats, ...status };\n let groupStates = deploymentStatesToSubstates;\n let result = {};\n if (withSkipped) {\n groupStates = deploymentStatesToSubstatesWithSkipped;\n result.skipped = statCollector(groupStates.skipped, stats);\n }\n result = {\n ...result,\n // don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership\n inprogress: statCollector(groupStates.inprogress, stats),\n pending: (deployment.max_devices ? deployment.max_devices - deployment.device_count : 0) + statCollector(groupStates.pending, stats),\n successes: statCollector(groupStates.successes, stats),\n failures: statCollector(groupStates.failures, stats),\n paused: statCollector(groupStates.paused, stats)\n };\n return result;\n};\n\nexport const getDeploymentState = deployment => {\n const { status: deploymentStatus = DEPLOYMENT_STATES.pending } = deployment;\n const { inprogress: currentProgressCount, paused } = groupDeploymentStats(deployment);\n\n let status = deploymentDisplayStates[deploymentStatus];\n if (deploymentStatus === DEPLOYMENT_STATES.pending && currentProgressCount === 0) {\n status = 'queued';\n } else if (paused > 0) {\n status = deploymentDisplayStates.paused;\n }\n return status;\n};\n\nexport const generateDeploymentGroupDetails = (filter, groupName) =>\n filter && filter.terms?.length\n ? `${groupName} (${filter.terms\n .map(filter => `${filter.attribute || filter.key} ${DEVICE_FILTERING_OPTIONS[filter.type || filter.operator].shortform} ${filter.value}`)\n .join(', ')})`\n : groupName;\n\nexport const mapDeviceAttributes = (attributes = []) =>\n attributes.reduce(\n (accu, attribute) => {\n if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n return accu;\n }\n accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {\n ...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],\n [attribute.name]: attribute.value\n };\n if (attribute.name === 'device_type' && attribute.scope === ATTRIBUTE_SCOPES.inventory) {\n accu.inventory.device_type = [].concat(attribute.value);\n }\n return accu;\n },\n { inventory: { device_type: [], artifact_name: '' }, identity: {}, monitor: {}, system: {}, tags: {} }\n );\n\nexport const isDarkMode = mode => mode === DARK_MODE;\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 React from 'react';\n\nimport { mdiAws as AWS, mdiMicrosoftAzure as Azure } from '@mdi/js';\n\nexport const DEVICE_LIST_DEFAULTS = {\n page: 1,\n perPage: 20\n};\n\nexport const timeUnits = {\n days: 'days',\n minutes: 'minutes',\n hours: 'hours'\n};\n\nexport const ALL_DEVICES = 'All devices';\nexport const UNGROUPED_GROUP = { id: '*|=ungrouped=|*', name: 'Unassigned' };\n\nexport const DEVICE_LIST_MAXIMUM_LENGTH = 50;\n\nexport const DEVICE_FILTERING_OPTIONS = {\n $eq: { key: '$eq', title: 'equals', shortform: '=' },\n $ne: { key: '$ne', title: 'not equal', shortform: '!=' },\n $gt: {\n key: '$gt',\n title: '>',\n shortform: '>',\n help: 'The \"greater than\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $gte: {\n title: '>=',\n shortform: '>=',\n help: 'The \"greater than or equal\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $lt: {\n key: '$lt',\n title: '<',\n shortform: '<',\n help: 'The \"lesser than\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $lte: {\n title: '<=',\n shortform: '<=',\n help: 'The \"lesser than or equal\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $ltne: {\n key: '$ltne',\n title: '$ltne',\n shortform: 'ltne',\n help: 'The \"lesser than or does not exist\" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'\n },\n $in: {\n key: '$in',\n title: 'in',\n shortform: 'in',\n help: 'The \"in\" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'\n },\n $nin: {\n key: '$nin',\n title: 'not in',\n shortform: 'not in',\n help: `The \"not in\" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`\n },\n $exists: {\n key: '$exists',\n title: 'exists',\n shortform: 'exists',\n value: true,\n help: `The \"exists\" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`\n },\n $nexists: {\n key: '$nexists',\n title: `doesn't exist`,\n shortform: `doesn't exist`,\n value: true,\n help: `The \"doesn't exist\" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`\n },\n $regex: {\n key: '$regex',\n title: `matches regular expression`,\n shortform: `matches`,\n help: `The \"regular expression\" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`\n }\n};\n\nexport const DEVICE_ISSUE_OPTIONS = {\n issues: {\n isCategory: true,\n key: 'issues',\n title: 'Devices with issues',\n filterRule: {}\n },\n offline: {\n issueCategory: 'issues',\n key: 'offline',\n needsFullFiltering: true,\n needsMonitor: false,\n needsReporting: false,\n filterRule: {\n scope: 'system',\n key: 'check_in_time',\n operator: DEVICE_FILTERING_OPTIONS.$ltne.key,\n value: ({ offlineThreshold }) => offlineThreshold\n },\n title: 'Offline devices'\n },\n failedLastUpdate: {\n issueCategory: 'issues',\n key: 'failedLastUpdate',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'monitor', key: 'failed_last_update', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },\n title: 'Deployment failed'\n },\n monitoring: {\n issueCategory: 'issues',\n key: 'monitoring',\n needsFullFiltering: false,\n needsMonitor: true,\n needsReporting: false,\n filterRule: { scope: 'monitor', key: 'alerts', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },\n title: 'Monitoring alert'\n },\n authRequests: {\n key: 'authRequests',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'monitor', key: 'auth_requests', operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },\n title: 'Devices with new authentication requests'\n },\n gatewayDevices: {\n key: 'gatewayDevices',\n needsFullFiltering: false,\n needsMonitor: false,\n needsReporting: true,\n filterRule: { scope: 'inventory', key: 'mender_is_gateway', operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: 'true' },\n title: 'Gateway devices'\n }\n};\nconst oneSecond = 1000;\nexport const TIMEOUTS = {\n debounceDefault: 700,\n debounceShort: 300,\n halfASecond: 0.5 * oneSecond,\n oneSecond,\n twoSeconds: 2 * oneSecond,\n threeSeconds: 3 * oneSecond,\n fiveSeconds: 5 * oneSecond,\n refreshDefault: 10 * oneSecond,\n refreshLong: 60 * oneSecond\n};\n\nexport const SORTING_OPTIONS = {\n asc: 'asc',\n desc: 'desc'\n};\n\nexport const DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };\n\nexport const ATTRIBUTE_SCOPES = {\n inventory: 'inventory',\n identity: 'identity',\n monitor: 'monitor',\n system: 'system',\n tags: 'tags'\n};\n\nexport const defaultIdAttribute = Object.freeze({ attribute: 'id', scope: ATTRIBUTE_SCOPES.identity });\n\nconst credentialTypes = {\n aws: 'aws',\n http: 'http',\n sas: 'sas',\n x509: 'x509'\n};\nexport const EXTERNAL_PROVIDER = {\n 'iot-core': {\n credentialsType: credentialTypes.aws,\n icon: AWS,\n title: 'AWS IoT Core',\n twinTitle: 'Device Shadow',\n provider: 'iot-core',\n enabled: true,\n deviceTwin: true,\n configHint: <>For help finding your AWS IoT Core connection string, check the AWS IoT documentation.</>\n },\n 'iot-hub': {\n credentialsType: credentialTypes.sas,\n icon: Azure,\n title: 'Azure IoT Hub',\n twinTitle: 'Device Twin',\n provider: 'iot-hub',\n enabled: true,\n deviceTwin: true,\n configHint: (\n <span>\n For help finding your Azure IoT Hub connection string, look under &apos;Shared access policies&apos; in the Microsoft Azure UI as described{' '}\n {\n <a\n href=\"https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n here\n </a>\n }\n .\n </span>\n )\n },\n webhook: {\n credentialsType: credentialTypes.http,\n deviceTwin: false,\n // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.\n enabled: false,\n provider: 'webhook'\n }\n};\nexport const MAX_PAGE_SIZE = 500;\n\nexport const ALL_RELEASES = 'All releases';\n\nexport type UiPermissionsDefinition = Readonly<{\n auditlog: string[];\n deployments?: string[]; // deployments are so far only covered indirectly through releases + device group permissions\n groups: Record<string, string[]>;\n releases: Record<string, string[]>;\n tenantManagement: string[];\n userManagement: string[];\n}>;\n\nexport type UiRoleDefinition = {\n name: string;\n description: string;\n editable?: boolean;\n isCustom?: boolean;\n permissions?: object[];\n uiPermissions: UiPermissionsDefinition;\n};\n\nexport const emptyUiPermissions: UiPermissionsDefinition = Object.freeze({\n auditlog: [],\n deployments: [],\n groups: Object.freeze({}),\n releases: Object.freeze({}),\n tenantManagement: [],\n userManagement: []\n});\n\nexport const emptyRole: UiRoleDefinition = Object.freeze({\n name: undefined,\n description: '',\n permissions: [],\n uiPermissions: Object.freeze({ ...emptyUiPermissions })\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,qBAAqC;;;ACErC,gBAA0D;AAwL1C;AAjLT,IAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AACT;AAKO,IAAM,6BAA6B;AAEnC,IAAM,2BAA2B;AAAA,EACtC,KAAK,EAAE,KAAK,OAAO,OAAO,UAAU,WAAW,IAAI;AAAA,EACnD,KAAK,EAAE,KAAK,OAAO,OAAO,aAAa,WAAW,KAAK;AAAA,EACvD,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,KAAK;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,MAAM;AAAA,EACR;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AAG,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;AAC3I,IAAM,qBAAiB;AAAA,EAC5B,CAAC,qBAAqB,eAAe;AAAA,EACrC,CAAC,EAAE,aAAa,MAAM,GAAG,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,UAAU,SAAS;AAC5E;AAEO,IAAM,yBAAqB,+BAAe,CAAC,iBAAiB,oBAAoB,GAAG,CAAC,MAAM,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;","names":["AWS","Azure"]}
@@ -7,12 +7,12 @@ import {
7
7
  getReleasesList,
8
8
  getSelectedRelease,
9
9
  getUpdateTypes
10
- } from "../chunk-VOCOFE4I.js";
11
- import "../chunk-YETZPQFR.js";
12
- import "../chunk-A6CT6GTI.js";
10
+ } from "../chunk-X7IEZBM4.js";
11
+ import "../chunk-4XJMRVFI.js";
12
+ import "../chunk-C5NEDBJI.js";
13
13
  import "../chunk-CK6YE6AN.js";
14
14
  import "../chunk-MRCFLG45.js";
15
- import "../chunk-25AKG5HH.js";
15
+ import "../chunk-UWMYZNUB.js";
16
16
  import "../chunk-4B3IMP4I.js";
17
17
  export {
18
18
  getHasReleases,
@@ -77,28 +77,28 @@ var PLANS = {
77
77
  id: "os",
78
78
  name: "Basic",
79
79
  offer: true,
80
- price: "$32/month",
80
+ price: "$32 / month",
81
81
  deviceCount: startingDeviceCount.os,
82
- offerprice: "$23/month for first 50 devices",
82
+ offerprice: "$23 / month for first 50 devices",
83
83
  price2: "for first 6 months;\n$29/month thereafter",
84
- features: ["Basic OTA features"]
84
+ features: ["Access to core features of Mender", "Basic support"]
85
85
  },
86
86
  professional: {
87
87
  id: "professional",
88
88
  name: "Professional",
89
89
  offer: true,
90
- price: "$269/month",
90
+ price: "$269 / month",
91
91
  deviceCount: startingDeviceCount.professional,
92
- offerprice: "$200/month for first 50 devices",
92
+ offerprice: "$200 / month for first 50 devices",
93
93
  price2: "for first 6 months;\n$249/month thereafter",
94
- features: ["+ Advanced OTA features", "+ Standard support"]
94
+ features: ["Advanced OTA features", "Higher priority support"]
95
95
  },
96
96
  enterprise: {
97
97
  id: "enterprise",
98
98
  name: "Enterprise",
99
99
  price: "Custom pricing",
100
- deviceCount: "unlimited devices",
101
- features: ["+ Enterprise-grade OTA features", "+ Premium support"]
100
+ deviceCount: "Unlimited devices",
101
+ features: ["All Mender features", "Advanced security features", "SLA-backed support"]
102
102
  }
103
103
  };
104
104
  var ADDONS = {
@@ -612,13 +612,16 @@ var auditLogsApiUrl = `${apiUrl.v1}/auditlogs`;
612
612
  var tenantadmApiUrlv1 = `${apiUrl.v1}/tenantadm`;
613
613
  var tenantadmApiUrlv2 = `${apiUrl.v2}/tenantadm`;
614
614
  var ssoIdpApiUrlv1 = `${apiUrl.v1}/useradm/sso/idp/metadata`;
615
- var AUDIT_LOGS_TYPES = [
616
- { title: "Artifact", queryParameter: "object_type", value: "artifact" },
617
- { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
618
- { title: "Device", queryParameter: "object_id", value: "device" },
619
- { title: "User", queryParameter: "object_id", value: "user" }
620
- ];
621
- var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
615
+ var auditlogTypes = {
616
+ artifact: { title: "Artifact", queryParameter: "object_type", value: "artifact" },
617
+ deployment: { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
618
+ device: { title: "Device", queryParameter: "object_id", value: "device" },
619
+ user_access_token: { title: "Personal Access Token", queryParameter: "user_access_token", value: "user_access_token" },
620
+ user: { title: "User", queryParameter: "object_id", value: "user" },
621
+ tenant: { title: "Tenant", queryParameter: "object_id", value: "tenant" }
622
+ };
623
+ var AUDIT_LOGS_TYPES = [auditlogTypes.artifact, auditlogTypes.deployment, auditlogTypes.device, auditlogTypes.user_access_token, auditlogTypes.user];
624
+ var SP_AUDIT_LOGS_TYPES = [auditlogTypes.user, auditlogTypes.tenant];
622
625
  var emptyWebhook = {
623
626
  description: "",
624
627
  enabled: true,
@@ -752,7 +755,7 @@ var uiPermissionsByArea = {
752
755
  explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
753
756
  key: "auditlog",
754
757
  uiPermissions: [uiPermissionsById.read],
755
- title: "System audit log"
758
+ title: "System Audit Log"
756
759
  },
757
760
  deployments: {
758
761
  endpoints: [
@@ -902,7 +905,7 @@ var serviceProviderRolesById = {
902
905
  },
903
906
  readOnly: {
904
907
  name: "Read access",
905
- value: staticRolesByName.admin,
908
+ value: staticRolesByName.readOnly,
906
909
  description: "This role can see all linked organizations but cannot make any changes",
907
910
  permissions: [],
908
911
  uiPermissions: {
@@ -2103,7 +2106,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
2103
2106
  (accu, [groupname, group]) => {
2104
2107
  const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
2105
2108
  const groupItem = { ...group, groupId: name, name: groupname };
2106
- if (group.filters.length > 0) {
2109
+ if (group.filters?.length > 0) {
2107
2110
  if (groupname !== UNGROUPED_GROUP.id) {
2108
2111
  accu.dynamic.push(groupItem);
2109
2112
  } else {
@@ -2176,14 +2179,15 @@ var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAud
2176
2179
  // src/utils.ts
2177
2180
  var import_helpers4 = require("@northern.tech/utils/helpers");
2178
2181
  var filterProcessors = {
2179
- $gt: (val) => Number(val) || val,
2180
- $gte: (val) => Number(val) || val,
2181
- $lt: (val) => Number(val) || val,
2182
- $lte: (val) => Number(val) || val,
2183
- $in: (val) => ("" + val).split(",").map((i) => i.trim()),
2184
- $nin: (val) => ("" + val).split(",").map((i) => i.trim()),
2185
- $exists: import_helpers4.yes,
2186
- $nexists: () => false
2182
+ [DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
2183
+ [DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
2184
+ [DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
2185
+ [DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
2186
+ [DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
2187
+ [DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2188
+ [DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2189
+ [DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers4.yes,
2190
+ [DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
2187
2191
  };
2188
2192
  var filterAliases = {
2189
2193
  $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
@@ -2278,8 +2282,13 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
2278
2282
  var getGlobalSettings = (state) => state.users.globalSettings;
2279
2283
  var getCurrentUserId = (state) => state.users.currentUser;
2280
2284
  var getUsersById = (state) => state.users.byId;
2285
+ var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
2281
2286
  var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
2282
2287
  var getUserSettings = (state) => state.users.userSettings;
2288
+ var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
2289
+ [getUserSettings],
2290
+ ({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
2291
+ );
2283
2292
  var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2284
2293
  var getShowHelptips = (0, import_toolkit14.createSelector)(
2285
2294
  [getTooltipsById],
@@ -2304,7 +2313,7 @@ var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGloba
2304
2313
  interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
2305
2314
  intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
2306
2315
  }));
2307
- var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
2316
+ var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([value, role]) => ({ value, ...role })));
2308
2317
 
2309
2318
  // src/commonSelectors.ts
2310
2319
  var getIsEnterprise = (0, import_toolkit15.createSelector)(
@@ -2365,12 +2374,18 @@ var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, ge
2365
2374
  });
2366
2375
  var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2367
2376
  [getFeatures, getOrganization, getIsEnterprise],
2368
- ({ hasAuditlogs: isAuditlogEnabled, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2377
+ ({
2378
+ hasAuditlogs: isAuditlogEnabled,
2379
+ hasDeviceConfig: isDeviceConfigEnabled,
2380
+ hasDeviceConnect: isDeviceConnectEnabled,
2381
+ hasMonitor: isMonitorEnabled,
2382
+ isHosted
2383
+ }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2369
2384
  const canDelta = isEnterprise || plan === PLANS.professional.id;
2370
2385
  const hasAuditlogs = isAuditlogEnabled && isEnterprise;
2371
- const hasDeviceConfig = isDeviceConfigEnabled && addons.some((addon) => addon.name === "configure" && Boolean(addon.enabled));
2372
- const hasDeviceConnect = isDeviceConnectEnabled && (!isEnterprise || addons.some((addon) => addon.name === "troubleshoot" && Boolean(addon.enabled)));
2373
- const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === "monitor" && Boolean(addon.enabled));
2386
+ const hasDeviceConfig = addons.some((addon) => addon.name === ADDONS.configure.id && addon.enabled) || isDeviceConfigEnabled && !isHosted;
2387
+ const hasDeviceConnect = addons.some((addon) => addon.name === ADDONS.troubleshoot.id && addon.enabled) || isDeviceConnectEnabled && !isHosted;
2388
+ const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === ADDONS.monitor.id && addon.enabled);
2374
2389
  return {
2375
2390
  canDelta,
2376
2391
  canRetry: canDelta,
@@ -2500,7 +2515,7 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
2500
2515
  var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2501
2516
  if (service_provider) {
2502
2517
  return roles.reduce((accu, role) => {
2503
- if (rolesById[role.id]) {
2518
+ if (rolesById[role.value]) {
2504
2519
  return accu;
2505
2520
  }
2506
2521
  accu.push(role);
@@ -2508,20 +2523,19 @@ var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, ge
2508
2523
  }, Object.values(serviceProviderRolesById));
2509
2524
  }
2510
2525
  return Object.keys(rolesById).reverse().reduce((accu, key) => {
2511
- const index = accu.findIndex(({ id }) => id === key);
2526
+ const index = accu.findIndex(({ value }) => value === key);
2512
2527
  accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2513
2528
  return accu;
2514
2529
  }, roles);
2515
2530
  });
2516
2531
 
2517
2532
  // src/store.ts
2533
+ var import_react_redux = require("react-redux");
2518
2534
  var import_helpers6 = require("@northern.tech/utils/helpers");
2519
2535
  var import_toolkit16 = require("@reduxjs/toolkit");
2520
2536
  var { setSnackbar, uploadProgress } = actions_default;
2521
2537
  var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2522
- var resetEnvironment = () => {
2523
- keys.map((key) => window.sessionStorage.removeItem(key));
2524
- };
2538
+ var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
2525
2539
  resetEnvironment();
2526
2540
  var commonErrorFallback = "Please check your connection.";
2527
2541
  var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
@@ -2547,6 +2561,14 @@ var sessionReducer = (state, action) => {
2547
2561
  }
2548
2562
  return rootReducer(state, action);
2549
2563
  };
2564
+ var rejectionLoggerMiddleware = () => (next) => (action) => {
2565
+ if (action.type.endsWith("/rejected")) {
2566
+ const { error } = action;
2567
+ console.error("Rejection in action:", action);
2568
+ console.error(error.stack);
2569
+ }
2570
+ return next(action);
2571
+ };
2550
2572
  var getConfiguredStore = (options = {}) => {
2551
2573
  const { preloadedState = {}, ...config } = options;
2552
2574
  return (0, import_toolkit16.configureStore)({
@@ -2562,7 +2584,7 @@ var getConfiguredStore = (options = {}) => {
2562
2584
  ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
2563
2585
  ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
2564
2586
  }
2565
- })
2587
+ }).concat(rejectionLoggerMiddleware)
2566
2588
  });
2567
2589
  };
2568
2590
  var store = getConfiguredStore({
@@ -2735,9 +2757,12 @@ var editArtifact = (0, import_toolkit17.createAsyncThunk)(
2735
2757
  if (!release || index === -1) {
2736
2758
  return dispatch(getReleases());
2737
2759
  }
2738
- release.artifacts[index].description = body.description;
2760
+ const updatedRelease = {
2761
+ ...release,
2762
+ artifacts: release.artifacts.map((artifact, i) => i === index ? { ...artifact, description: body.description } : artifact)
2763
+ };
2739
2764
  return Promise.all([
2740
- dispatch(actions7.receiveRelease(release)),
2765
+ dispatch(actions7.receiveRelease(updatedRelease)),
2741
2766
  dispatch(setSnackbar2("Artifact details were updated successfully.", TIMEOUTS.fiveSeconds, "")),
2742
2767
  dispatch(getRelease(release.name)),
2743
2768
  dispatch(selectRelease(release.name))
@@ -2838,16 +2863,15 @@ var getReleases = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getRelea
2838
2863
  return Promise.all(tasks);
2839
2864
  }).catch((err) => commonErrorHandler(err, `Please check your connection`, dispatch));
2840
2865
  });
2841
- var getRelease = (0, import_toolkit17.createAsyncThunk)(
2842
- `${sliceName7}/getReleases`,
2843
- (name, { dispatch, getState }) => releaseListRetrieval({ searchTerm: name, page: 1, perPage: 1 }).then(({ data: releases }) => {
2844
- if (releases.length) {
2845
- const stateRelease = getReleasesById(getState())[releases[0].name] || {};
2846
- return Promise.resolve(dispatch(actions7.receiveRelease(flattenRelease(releases[0], stateRelease))));
2847
- }
2848
- return Promise.resolve(null);
2849
- })
2850
- );
2866
+ var getRelease = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getReleases`, async (name, { dispatch, getState }) => {
2867
+ const releaseResponse = await general_api_default.get(`${deploymentsApiUrlV2}/deployments/releases/${name}`);
2868
+ const { data: release } = releaseResponse;
2869
+ if (release) {
2870
+ const stateRelease = getReleasesById(getState())[release.name] || {};
2871
+ await dispatch(actions7.receiveRelease(flattenRelease(release, stateRelease)));
2872
+ }
2873
+ return Promise.resolve(null);
2874
+ });
2851
2875
  var updateReleaseInfo = (0, import_toolkit17.createAsyncThunk)(
2852
2876
  `${sliceName7}/updateReleaseInfo`,
2853
2877
  ({ name, info }, { dispatch, getState }) => general_api_default.patch(`${deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(() => {