@northern.tech/store 0.3.2 → 0.3.4
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/BillingProfile-ChP2_Sqw.d.cts +45 -0
- package/dist/BillingProfile-ChP2_Sqw.d.ts +45 -0
- package/dist/actions.cjs +22 -23
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.js +12 -12
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.js +5 -5
- package/dist/api/types/Tenant.ts +17 -12
- package/dist/api/users-api.cjs.map +1 -1
- package/dist/api/users-api.js +6 -6
- package/dist/appSlice/constants.cjs +18 -10
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +41 -84
- package/dist/appSlice/constants.d.ts +41 -84
- package/dist/appSlice/constants.js +1 -1
- package/dist/appSlice/index.cjs +1 -3
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.js +4 -4
- package/dist/appSlice/thunks.cjs +153 -120
- package/dist/appSlice/thunks.cjs.map +1 -1
- package/dist/appSlice/thunks.js +28 -27
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.js +4 -4
- package/dist/{chunk-NI4SZOCF.js → chunk-4RWZR3BN.js} +23 -25
- package/dist/{chunk-NI4SZOCF.js.map → chunk-4RWZR3BN.js.map} +1 -1
- package/dist/{chunk-YGBFDXXA.js → chunk-7YZCUAXZ.js} +2 -2
- package/dist/{chunk-7PVGDMNM.js → chunk-AFICTIVU.js} +3 -5
- package/dist/{chunk-7PVGDMNM.js.map → chunk-AFICTIVU.js.map} +1 -1
- package/dist/{chunk-YT73QWCN.js → chunk-AUBJUUP3.js} +3 -3
- package/dist/{chunk-UEP36GCI.js → chunk-AVX7VVOK.js} +3 -3
- package/dist/{chunk-4B3IMP4I.js → chunk-BSN2TOQC.js} +1 -1
- package/dist/{chunk-4B3IMP4I.js.map → chunk-BSN2TOQC.js.map} +1 -1
- package/dist/{chunk-VOCOFE4I.js → chunk-DCEKU6UV.js} +2 -2
- package/dist/{chunk-E5LEU5PF.js → chunk-DGQKXSRI.js} +3 -3
- package/dist/{chunk-74OJIKXF.js → chunk-EQLHIPPR.js} +182 -142
- package/dist/chunk-EQLHIPPR.js.map +1 -0
- package/dist/{chunk-MDC7Y3EX.js → chunk-EYCORLYU.js} +44 -40
- package/dist/chunk-EYCORLYU.js.map +1 -0
- package/dist/{chunk-KAQJH2YL.js → chunk-FQDSV3NK.js} +13 -5
- package/dist/chunk-FQDSV3NK.js.map +1 -0
- package/dist/{chunk-XTRPX7JZ.js → chunk-FRSA2YB5.js} +3 -3
- package/dist/chunk-FRSA2YB5.js.map +1 -0
- package/dist/{chunk-ANB5BM5J.js → chunk-FVCYB5OP.js} +37 -32
- package/dist/chunk-FVCYB5OP.js.map +1 -0
- package/dist/{chunk-AMGWP7A4.js → chunk-GAI4VYRZ.js} +2 -2
- package/dist/{chunk-YETZPQFR.js → chunk-GWJIY56H.js} +19 -20
- package/dist/chunk-GWJIY56H.js.map +1 -0
- package/dist/{chunk-Q6M5TTDQ.js → chunk-JO33IORF.js} +2 -2
- package/dist/chunk-JO33IORF.js.map +1 -0
- package/dist/chunk-K4MMUDYT.js +391 -0
- package/dist/chunk-K4MMUDYT.js.map +1 -0
- package/dist/{chunk-XXHONFSQ.js → chunk-L3SY3J5M.js} +4 -4
- package/dist/{chunk-XXHONFSQ.js.map → chunk-L3SY3J5M.js.map} +1 -1
- package/dist/{chunk-JAROCU6M.js → chunk-NCSKCF2S.js} +3 -3
- package/dist/{chunk-CYV6632F.js → chunk-NOQR3TE7.js} +2 -2
- package/dist/{chunk-A6CT6GTI.js → chunk-OEP2D6QL.js} +18 -12
- package/dist/chunk-OEP2D6QL.js.map +1 -0
- package/dist/{chunk-2RJIDREZ.js → chunk-PAIB5V27.js} +32 -23
- package/dist/chunk-PAIB5V27.js.map +1 -0
- package/dist/{chunk-FGKMJS3B.js → chunk-RX32WLVJ.js} +2 -4
- package/dist/chunk-RX32WLVJ.js.map +1 -0
- package/dist/{chunk-YTQUNAZP.js → chunk-X3GZILYD.js} +3 -3
- package/dist/{chunk-25AKG5HH.js → chunk-Y575RZHR.js} +19 -11
- package/dist/chunk-Y575RZHR.js.map +1 -0
- package/dist/{chunk-RX55KAKX.js → chunk-ZWOAFHAR.js} +2 -2
- package/dist/{chunk-NNADGHSL.js → chunk-ZZMFXRQK.js} +14 -14
- package/dist/commonConstants.cjs.map +1 -1
- package/dist/commonConstants.d.cts +1 -1
- package/dist/commonConstants.d.ts +1 -1
- package/dist/commonConstants.js +1 -1
- package/dist/commonSelectors.cjs +47 -29
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +55 -46
- package/dist/commonSelectors.d.ts +55 -46
- package/dist/commonSelectors.js +11 -11
- package/dist/constants.cjs +35 -19
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +7 -3
- package/dist/deploymentdevicehook.cjs +159 -125
- package/dist/deploymentdevicehook.cjs.map +1 -1
- package/dist/deploymentdevicehook.d.cts +1 -1
- package/dist/deploymentdevicehook.d.ts +1 -1
- package/dist/deploymentdevicehook.js +34 -31
- package/dist/deploymentdevicehook.js.map +1 -1
- package/dist/deploymentsSlice/constants.cjs +8 -8
- package/dist/deploymentsSlice/constants.cjs.map +1 -1
- package/dist/deploymentsSlice/constants.js +3 -3
- package/dist/deploymentsSlice/index.cjs +8 -8
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.js +4 -4
- package/dist/deploymentsSlice/selectors.cjs +8 -8
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.js +4 -4
- package/dist/deploymentsSlice/thunks.cjs +153 -120
- package/dist/deploymentsSlice/thunks.cjs.map +1 -1
- package/dist/deploymentsSlice/thunks.js +28 -27
- package/dist/devicesSlice/constants.cjs +11 -8
- package/dist/devicesSlice/constants.cjs.map +1 -1
- package/dist/devicesSlice/constants.d.cts +2 -1
- package/dist/devicesSlice/constants.d.ts +2 -1
- package/dist/devicesSlice/constants.js +5 -3
- package/dist/devicesSlice/index.cjs +8 -8
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.js +4 -4
- package/dist/devicesSlice/selectors.cjs +9 -9
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.js +4 -4
- package/dist/devicesSlice/thunks.cjs +155 -120
- package/dist/devicesSlice/thunks.cjs.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +12 -2
- package/dist/devicesSlice/thunks.d.ts +12 -2
- package/dist/devicesSlice/thunks.js +30 -27
- package/dist/flag-eu-5477R2P4.svg +130 -0
- package/dist/flag-us-HNQAF66I.svg +63 -0
- package/dist/liststatehook.cjs +971 -0
- package/dist/liststatehook.cjs.map +1 -0
- package/dist/liststatehook.d.cts +246 -0
- package/dist/liststatehook.d.ts +246 -0
- package/dist/liststatehook.js +88 -0
- package/dist/liststatehook.js.map +1 -0
- package/dist/locationutils.cjs +942 -0
- package/dist/locationutils.cjs.map +1 -0
- package/dist/locationutils.d.cts +113 -0
- package/dist/locationutils.d.ts +113 -0
- package/dist/locationutils.js +46 -0
- package/dist/locationutils.js.map +1 -0
- package/dist/monitorSlice/constants.cjs +8 -8
- package/dist/monitorSlice/constants.cjs.map +1 -1
- package/dist/monitorSlice/constants.js +3 -3
- package/dist/monitorSlice/index.cjs +8 -8
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.js +4 -4
- package/dist/monitorSlice/thunks.cjs +74 -62
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.js +24 -24
- package/dist/onboardingSlice/index.cjs +1 -3
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.js +1 -1
- package/dist/onboardingSlice/thunks.cjs +157 -124
- package/dist/onboardingSlice/thunks.cjs.map +1 -1
- package/dist/onboardingSlice/thunks.d.cts +2 -34
- package/dist/onboardingSlice/thunks.d.ts +2 -34
- package/dist/onboardingSlice/thunks.js +28 -29
- package/dist/organizationSlice/constants.cjs +22 -17
- package/dist/organizationSlice/constants.cjs.map +1 -1
- package/dist/organizationSlice/constants.d.cts +33 -1
- package/dist/organizationSlice/constants.d.ts +33 -1
- package/dist/organizationSlice/constants.js +5 -3
- package/dist/organizationSlice/index.cjs +18 -15
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +27 -1012
- package/dist/organizationSlice/index.d.ts +27 -1012
- package/dist/organizationSlice/index.js +4 -4
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +10 -1
- package/dist/organizationSlice/selectors.d.ts +10 -1
- package/dist/organizationSlice/selectors.js +4 -4
- package/dist/organizationSlice/thunks.cjs +1619 -1559
- package/dist/organizationSlice/thunks.cjs.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +62 -37
- package/dist/organizationSlice/thunks.d.ts +62 -37
- package/dist/organizationSlice/thunks.js +28 -27
- package/dist/organizationSlice/types.cjs +19 -0
- package/dist/organizationSlice/types.cjs.map +1 -0
- package/dist/organizationSlice/types.d.cts +5 -0
- package/dist/organizationSlice/types.d.ts +5 -0
- package/dist/organizationSlice/types.js +1 -0
- package/dist/organizationSlice/types.js.map +1 -0
- package/dist/releasesSlice/index.cjs.map +1 -1
- package/dist/releasesSlice/index.js +4 -4
- package/dist/releasesSlice/selectors.cjs +17 -8
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.js +5 -5
- package/dist/releasesSlice/thunks.cjs +123 -94
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +1 -4
- package/dist/releasesSlice/thunks.d.ts +1 -4
- package/dist/releasesSlice/thunks.js +25 -24
- package/dist/selectors.cjs +53 -29
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +10 -1
- package/dist/selectors.d.ts +10 -1
- package/dist/selectors.js +49 -43
- package/dist/sockethook.cjs +529 -0
- package/dist/sockethook.cjs.map +1 -0
- package/dist/sockethook.d.cts +10 -0
- package/dist/sockethook.d.ts +10 -0
- package/dist/sockethook.js +141 -0
- package/dist/sockethook.js.map +1 -0
- package/dist/store.cjs +38 -29
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +13 -231
- package/dist/store.d.ts +13 -231
- package/dist/store.js +18 -16
- package/dist/storehooks.cjs +273 -198
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.js +38 -37
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +259 -184
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +6 -2
- package/dist/thunks.d.ts +6 -2
- package/dist/thunks.js +30 -29
- package/dist/types-DBj17FZO.d.cts +135 -0
- package/dist/types-DnfZa6xd.d.ts +135 -0
- package/dist/usersSlice/constants.cjs +10 -10
- package/dist/usersSlice/constants.cjs.map +1 -1
- package/dist/usersSlice/constants.d.cts +6 -6
- package/dist/usersSlice/constants.d.ts +6 -6
- package/dist/usersSlice/constants.js +3 -3
- package/dist/usersSlice/index.cjs +10 -10
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.js +4 -4
- package/dist/usersSlice/selectors.cjs +35 -13
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.d.cts +44 -1
- package/dist/usersSlice/selectors.d.ts +44 -1
- package/dist/usersSlice/selectors.js +13 -7
- package/dist/usersSlice/thunks.cjs +151 -120
- package/dist/usersSlice/thunks.cjs.map +1 -1
- package/dist/usersSlice/thunks.d.cts +10 -9
- package/dist/usersSlice/thunks.d.ts +10 -9
- package/dist/usersSlice/thunks.js +28 -27
- package/dist/utils.cjs +23 -24
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +4 -4
- package/package.json +7 -6
- package/dist/chunk-25AKG5HH.js.map +0 -1
- package/dist/chunk-2RJIDREZ.js.map +0 -1
- package/dist/chunk-74OJIKXF.js.map +0 -1
- package/dist/chunk-A6CT6GTI.js.map +0 -1
- package/dist/chunk-ANB5BM5J.js.map +0 -1
- package/dist/chunk-FGKMJS3B.js.map +0 -1
- package/dist/chunk-KAQJH2YL.js.map +0 -1
- package/dist/chunk-MDC7Y3EX.js.map +0 -1
- package/dist/chunk-Q6M5TTDQ.js.map +0 -1
- package/dist/chunk-XTRPX7JZ.js.map +0 -1
- package/dist/chunk-YETZPQFR.js.map +0 -1
- /package/dist/{chunk-YGBFDXXA.js.map → chunk-7YZCUAXZ.js.map} +0 -0
- /package/dist/{chunk-YT73QWCN.js.map → chunk-AUBJUUP3.js.map} +0 -0
- /package/dist/{chunk-UEP36GCI.js.map → chunk-AVX7VVOK.js.map} +0 -0
- /package/dist/{chunk-VOCOFE4I.js.map → chunk-DCEKU6UV.js.map} +0 -0
- /package/dist/{chunk-E5LEU5PF.js.map → chunk-DGQKXSRI.js.map} +0 -0
- /package/dist/{chunk-AMGWP7A4.js.map → chunk-GAI4VYRZ.js.map} +0 -0
- /package/dist/{chunk-JAROCU6M.js.map → chunk-NCSKCF2S.js.map} +0 -0
- /package/dist/{chunk-CYV6632F.js.map → chunk-NOQR3TE7.js.map} +0 -0
- /package/dist/{chunk-YTQUNAZP.js.map → chunk-X3GZILYD.js.map} +0 -0
- /package/dist/{chunk-RX55KAKX.js.map → chunk-ZWOAFHAR.js.map} +0 -0
- /package/dist/{chunk-NNADGHSL.js.map → chunk-ZZMFXRQK.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 'Shared access policies' 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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;AAAA,IAC7C;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;ADpFA,qBAA+B;AAE/B,IAAM,uBAAuB,WAAS,MAAM,SAAS;AAC9C,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 ids.slice(0, cutOffSize).reduce((accu, id) => {\n if (id && byId[id]) {\n accu.push({ ...defaultObject, ...byId[id] });\n }\n return accu;\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 'Shared access policies' 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 description: string;\n editable?: boolean;\n isCustom?: boolean;\n name: string;\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;AA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,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"]}
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
getReleasesList,
|
|
8
8
|
getSelectedRelease,
|
|
9
9
|
getUpdateTypes
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-DCEKU6UV.js";
|
|
11
|
+
import "../chunk-GWJIY56H.js";
|
|
12
|
+
import "../chunk-OEP2D6QL.js";
|
|
13
13
|
import "../chunk-CK6YE6AN.js";
|
|
14
14
|
import "../chunk-MRCFLG45.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-Y575RZHR.js";
|
|
16
|
+
import "../chunk-BSN2TOQC.js";
|
|
17
17
|
export {
|
|
18
18
|
getHasReleases,
|
|
19
19
|
getReleaseListState,
|
|
@@ -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: ["
|
|
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: ["
|
|
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: "
|
|
101
|
-
features: ["
|
|
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
|
|
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: "
|
|
620
|
-
|
|
621
|
-
|
|
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
|
|
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.
|
|
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: {
|
|
@@ -1159,9 +1162,7 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1159
1162
|
...action.payload
|
|
1160
1163
|
};
|
|
1161
1164
|
},
|
|
1162
|
-
setEnvironmentData: (state, action) => {
|
|
1163
|
-
return { ...state, ...action.payload };
|
|
1164
|
-
}
|
|
1165
|
+
setEnvironmentData: (state, action) => ({ ...state, ...action.payload })
|
|
1165
1166
|
}
|
|
1166
1167
|
});
|
|
1167
1168
|
var actions = appSlice.actions;
|
|
@@ -1536,9 +1537,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1536
1537
|
name: sliceName5,
|
|
1537
1538
|
initialState: initialState5,
|
|
1538
1539
|
reducers: {
|
|
1539
|
-
setOnboardingState: (state, action) => {
|
|
1540
|
-
return { ...state, ...action.payload };
|
|
1541
|
-
},
|
|
1540
|
+
setOnboardingState: (state, action) => ({ ...state, ...action.payload }),
|
|
1542
1541
|
setDemoArtifactPort: (state, action) => {
|
|
1543
1542
|
state.demoArtifactPort = action.payload;
|
|
1544
1543
|
},
|
|
@@ -1977,8 +1976,22 @@ var Api = {
|
|
|
1977
1976
|
};
|
|
1978
1977
|
var general_api_default = Api;
|
|
1979
1978
|
|
|
1980
|
-
// src/
|
|
1979
|
+
// src/locationutils.ts
|
|
1981
1980
|
var import_helpers2 = require("@northern.tech/utils/helpers");
|
|
1981
|
+
var defaultSelector = (result) => result[0];
|
|
1982
|
+
var commonFields = {
|
|
1983
|
+
...Object.keys(DEVICE_LIST_DEFAULTS).reduce((accu, key) => ({ ...accu, [key]: { parse: Number, select: defaultSelector, target: key } }), {}),
|
|
1984
|
+
id: { parse: String, select: (i) => i, target: "id" },
|
|
1985
|
+
issues: { parse: void 0, select: defaultSelector, target: "selectedIssues" },
|
|
1986
|
+
open: { parse: Boolean, select: defaultSelector, target: "open" }
|
|
1987
|
+
};
|
|
1988
|
+
var formatReleases = ({ pageState: { searchTerm, selectedTags = [], tab, type } }) => Object.entries({ name: searchTerm, tab, type }).reduce(
|
|
1989
|
+
(accu, [key, value]) => value ? [...accu, `${key}=${value}`] : accu,
|
|
1990
|
+
selectedTags.map((tag) => `tag=${tag}`)
|
|
1991
|
+
).join("&");
|
|
1992
|
+
|
|
1993
|
+
// src/appSlice/selectors.ts
|
|
1994
|
+
var import_helpers3 = require("@northern.tech/utils/helpers");
|
|
1982
1995
|
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
1983
1996
|
var getAppDocsVersion = (state) => state.app.docsVersion;
|
|
1984
1997
|
var getFeatures = (state) => state.app.features;
|
|
@@ -1993,10 +2006,10 @@ var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
|
1993
2006
|
[getFullVersionInformation, getFeatures],
|
|
1994
2007
|
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
1995
2008
|
);
|
|
1996
|
-
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0,
|
|
2009
|
+
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers3.versionCompare)(Integration, "next") > -1);
|
|
1997
2010
|
|
|
1998
2011
|
// src/commonSelectors.ts
|
|
1999
|
-
var
|
|
2012
|
+
var import_helpers6 = require("@northern.tech/utils/helpers");
|
|
2000
2013
|
var import_toolkit15 = require("@reduxjs/toolkit");
|
|
2001
2014
|
|
|
2002
2015
|
// src/deploymentsSlice/selectors.ts
|
|
@@ -2040,7 +2053,7 @@ var getRecentDeployments = (0, import_toolkit10.createSelector)(
|
|
|
2040
2053
|
);
|
|
2041
2054
|
|
|
2042
2055
|
// src/devicesSlice/selectors.ts
|
|
2043
|
-
var
|
|
2056
|
+
var import_helpers4 = require("@northern.tech/utils/helpers");
|
|
2044
2057
|
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
2045
2058
|
var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
|
|
2046
2059
|
var getDevicesByStatus = (state) => state.devices.byStatus;
|
|
@@ -2103,7 +2116,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2103
2116
|
(accu, [groupname, group]) => {
|
|
2104
2117
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2105
2118
|
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2106
|
-
if (group.filters
|
|
2119
|
+
if (group.filters?.length > 0) {
|
|
2107
2120
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2108
2121
|
accu.dynamic.push(groupItem);
|
|
2109
2122
|
} else {
|
|
@@ -2120,7 +2133,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2120
2133
|
});
|
|
2121
2134
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2122
2135
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
2123
|
-
({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(
|
|
2136
|
+
({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers4.duplicateFilter)
|
|
2124
2137
|
);
|
|
2125
2138
|
var getDeviceTypes = (0, import_toolkit11.createSelector)(
|
|
2126
2139
|
[getAcceptedDevices, getDevicesById],
|
|
@@ -2174,16 +2187,17 @@ var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAud
|
|
|
2174
2187
|
});
|
|
2175
2188
|
|
|
2176
2189
|
// src/utils.ts
|
|
2177
|
-
var
|
|
2190
|
+
var import_helpers5 = require("@northern.tech/utils/helpers");
|
|
2178
2191
|
var filterProcessors = {
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2192
|
+
[DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
|
|
2193
|
+
[DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
|
|
2194
|
+
[DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
|
|
2195
|
+
[DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
|
|
2196
|
+
[DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
|
|
2197
|
+
[DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
|
|
2198
|
+
[DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
|
|
2199
|
+
[DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers5.yes,
|
|
2200
|
+
[DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
|
|
2187
2201
|
};
|
|
2188
2202
|
var filterAliases = {
|
|
2189
2203
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
@@ -2215,14 +2229,12 @@ var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {
|
|
|
2215
2229
|
const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
|
|
2216
2230
|
return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
|
|
2217
2231
|
};
|
|
2218
|
-
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
}, []);
|
|
2225
|
-
};
|
|
2232
|
+
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2233
|
+
if (id && byId[id]) {
|
|
2234
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2235
|
+
}
|
|
2236
|
+
return accu;
|
|
2237
|
+
}, []);
|
|
2226
2238
|
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2227
2239
|
(accu, [key, value]) => {
|
|
2228
2240
|
let values;
|
|
@@ -2231,7 +2243,7 @@ var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPe
|
|
|
2231
2243
|
return accu;
|
|
2232
2244
|
}
|
|
2233
2245
|
if (Array.isArray(value)) {
|
|
2234
|
-
values = [...value, ...accu[key]].filter(
|
|
2246
|
+
values = [...value, ...accu[key]].filter(import_helpers5.duplicateFilter);
|
|
2235
2247
|
} else {
|
|
2236
2248
|
values = mergePermissions(accu[key], { ...value });
|
|
2237
2249
|
}
|
|
@@ -2278,8 +2290,13 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2278
2290
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2279
2291
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2280
2292
|
var getUsersById = (state) => state.users.byId;
|
|
2293
|
+
var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
|
|
2281
2294
|
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2282
2295
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2296
|
+
var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
|
|
2297
|
+
[getUserSettings],
|
|
2298
|
+
({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
|
|
2299
|
+
);
|
|
2283
2300
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2284
2301
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
2285
2302
|
[getTooltipsById],
|
|
@@ -2304,7 +2321,7 @@ var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGloba
|
|
|
2304
2321
|
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2305
2322
|
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2306
2323
|
}));
|
|
2307
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([
|
|
2324
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([value, role]) => ({ value, ...role })));
|
|
2308
2325
|
|
|
2309
2326
|
// src/commonSelectors.ts
|
|
2310
2327
|
var getIsEnterprise = (0, import_toolkit15.createSelector)(
|
|
@@ -2365,12 +2382,18 @@ var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, ge
|
|
|
2365
2382
|
});
|
|
2366
2383
|
var getTenantCapabilities = (0, import_toolkit15.createSelector)(
|
|
2367
2384
|
[getFeatures, getOrganization, getIsEnterprise],
|
|
2368
|
-
({
|
|
2385
|
+
({
|
|
2386
|
+
hasAuditlogs: isAuditlogEnabled,
|
|
2387
|
+
hasDeviceConfig: isDeviceConfigEnabled,
|
|
2388
|
+
hasDeviceConnect: isDeviceConnectEnabled,
|
|
2389
|
+
hasMonitor: isMonitorEnabled,
|
|
2390
|
+
isHosted
|
|
2391
|
+
}, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
|
|
2369
2392
|
const canDelta = isEnterprise || plan === PLANS.professional.id;
|
|
2370
2393
|
const hasAuditlogs = isAuditlogEnabled && isEnterprise;
|
|
2371
|
-
const hasDeviceConfig =
|
|
2372
|
-
const hasDeviceConnect =
|
|
2373
|
-
const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name ===
|
|
2394
|
+
const hasDeviceConfig = addons.some((addon) => addon.name === ADDONS.configure.id && addon.enabled) || isDeviceConfigEnabled && !isHosted;
|
|
2395
|
+
const hasDeviceConnect = addons.some((addon) => addon.name === ADDONS.troubleshoot.id && addon.enabled) || isDeviceConnectEnabled && !isHosted;
|
|
2396
|
+
const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === ADDONS.monitor.id && addon.enabled);
|
|
2374
2397
|
return {
|
|
2375
2398
|
canDelta,
|
|
2376
2399
|
canRetry: canDelta,
|
|
@@ -2410,7 +2433,7 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2410
2433
|
firstRequestAttribute,
|
|
2411
2434
|
...systemAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))
|
|
2412
2435
|
];
|
|
2413
|
-
return (0,
|
|
2436
|
+
return (0, import_helpers6.attributeDuplicateFilter)(attributes, "key");
|
|
2414
2437
|
}
|
|
2415
2438
|
);
|
|
2416
2439
|
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
@@ -2421,7 +2444,7 @@ var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, ge
|
|
|
2421
2444
|
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2422
2445
|
}));
|
|
2423
2446
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2424
|
-
const demoDeviceAddress = `http://${(0,
|
|
2447
|
+
const demoDeviceAddress = `http://${(0, import_helpers6.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2425
2448
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
2426
2449
|
});
|
|
2427
2450
|
var getDeviceConfigDeployment = (0, import_toolkit15.createSelector)([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
|
|
@@ -2474,9 +2497,7 @@ var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUser
|
|
|
2474
2497
|
});
|
|
2475
2498
|
var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
|
|
2476
2499
|
[getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
|
|
2477
|
-
({ reports }, { id: currentUserId }, globalSettings, devicesById) => {
|
|
2478
|
-
return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);
|
|
2479
|
-
}
|
|
2500
|
+
({ reports }, { id: currentUserId }, globalSettings, devicesById) => reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])
|
|
2480
2501
|
);
|
|
2481
2502
|
var listTypeDeviceIdMap = {
|
|
2482
2503
|
deviceList: getListedDevices,
|
|
@@ -2500,7 +2521,7 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2500
2521
|
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2501
2522
|
if (service_provider) {
|
|
2502
2523
|
return roles.reduce((accu, role) => {
|
|
2503
|
-
if (rolesById[role.
|
|
2524
|
+
if (rolesById[role.value]) {
|
|
2504
2525
|
return accu;
|
|
2505
2526
|
}
|
|
2506
2527
|
accu.push(role);
|
|
@@ -2508,26 +2529,25 @@ var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, ge
|
|
|
2508
2529
|
}, Object.values(serviceProviderRolesById));
|
|
2509
2530
|
}
|
|
2510
2531
|
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2511
|
-
const index = accu.findIndex(({
|
|
2532
|
+
const index = accu.findIndex(({ value }) => value === key);
|
|
2512
2533
|
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2513
2534
|
return accu;
|
|
2514
2535
|
}, roles);
|
|
2515
2536
|
});
|
|
2516
2537
|
|
|
2517
2538
|
// src/store.ts
|
|
2518
|
-
var
|
|
2539
|
+
var import_react_redux = require("react-redux");
|
|
2540
|
+
var import_helpers7 = require("@northern.tech/utils/helpers");
|
|
2519
2541
|
var import_toolkit16 = require("@reduxjs/toolkit");
|
|
2520
2542
|
var { setSnackbar, uploadProgress } = actions_default;
|
|
2521
2543
|
var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
|
|
2522
|
-
var resetEnvironment = () =>
|
|
2523
|
-
keys.map((key) => window.sessionStorage.removeItem(key));
|
|
2524
|
-
};
|
|
2544
|
+
var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
|
|
2525
2545
|
resetEnvironment();
|
|
2526
2546
|
var commonErrorFallback = "Please check your connection.";
|
|
2527
2547
|
var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
|
|
2528
|
-
const errMsg = (0,
|
|
2548
|
+
const errMsg = (0, import_helpers7.extractErrorMessage)(err, fallback);
|
|
2529
2549
|
if (mightBeAuthRelated || getToken()) {
|
|
2530
|
-
dispatch(setSnackbar({ message: (0,
|
|
2550
|
+
dispatch(setSnackbar({ message: (0, import_helpers7.preformatWithRequestID)(err.response, `${errorContext} ${errMsg}`), action: "Copy to clipboard" }));
|
|
2531
2551
|
}
|
|
2532
2552
|
return Promise.reject(err);
|
|
2533
2553
|
};
|
|
@@ -2547,6 +2567,14 @@ var sessionReducer = (state, action) => {
|
|
|
2547
2567
|
}
|
|
2548
2568
|
return rootReducer(state, action);
|
|
2549
2569
|
};
|
|
2570
|
+
var rejectionLoggerMiddleware = () => (next) => (action) => {
|
|
2571
|
+
if (action.type.endsWith("/rejected")) {
|
|
2572
|
+
const { error } = action;
|
|
2573
|
+
console.error("Rejection in action:", action);
|
|
2574
|
+
console.error(error.stack);
|
|
2575
|
+
}
|
|
2576
|
+
return next(action);
|
|
2577
|
+
};
|
|
2550
2578
|
var getConfiguredStore = (options = {}) => {
|
|
2551
2579
|
const { preloadedState = {}, ...config } = options;
|
|
2552
2580
|
return (0, import_toolkit16.configureStore)({
|
|
@@ -2562,7 +2590,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2562
2590
|
ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
|
|
2563
2591
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2564
2592
|
}
|
|
2565
|
-
})
|
|
2593
|
+
}).concat(rejectionLoggerMiddleware)
|
|
2566
2594
|
});
|
|
2567
2595
|
};
|
|
2568
2596
|
var store = getConfiguredStore({
|
|
@@ -2570,8 +2598,7 @@ var store = getConfiguredStore({
|
|
|
2570
2598
|
});
|
|
2571
2599
|
|
|
2572
2600
|
// src/releasesSlice/thunks.ts
|
|
2573
|
-
var
|
|
2574
|
-
var import_locationutils = require("@northern.tech/utils/locationutils");
|
|
2601
|
+
var import_helpers8 = require("@northern.tech/utils/helpers");
|
|
2575
2602
|
var import_toolkit17 = require("@reduxjs/toolkit");
|
|
2576
2603
|
var import_axios2 = require("axios");
|
|
2577
2604
|
var import_uuid = require("uuid");
|
|
@@ -2579,7 +2606,7 @@ var { setSnackbar: setSnackbar2, initUpload, uploadProgress: uploadProgress2, cl
|
|
|
2579
2606
|
var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
2580
2607
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
2581
2608
|
var flattenRelease = (release, stateRelease) => {
|
|
2582
|
-
const updatedArtifacts = release.artifacts?.sort((0,
|
|
2609
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers8.customSort)(true, "modified")) || [];
|
|
2583
2610
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
2584
2611
|
(accu, item) => {
|
|
2585
2612
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
@@ -2593,7 +2620,7 @@ var flattenRelease = (release, stateRelease) => {
|
|
|
2593
2620
|
},
|
|
2594
2621
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
2595
2622
|
);
|
|
2596
|
-
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(
|
|
2623
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers8.duplicateFilter), modified };
|
|
2597
2624
|
};
|
|
2598
2625
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
2599
2626
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -2617,7 +2644,7 @@ var getArtifactInstallCount = (0, import_toolkit17.createAsyncThunk)(`${sliceNam
|
|
|
2617
2644
|
}
|
|
2618
2645
|
const releaseArtifacts = [...release.artifacts];
|
|
2619
2646
|
const artifact = releaseArtifacts[index];
|
|
2620
|
-
const { key, name, version } = (0,
|
|
2647
|
+
const { key, name, version } = (0, import_helpers8.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
2621
2648
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
2622
2649
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
2623
2650
|
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
@@ -2735,9 +2762,12 @@ var editArtifact = (0, import_toolkit17.createAsyncThunk)(
|
|
|
2735
2762
|
if (!release || index === -1) {
|
|
2736
2763
|
return dispatch(getReleases());
|
|
2737
2764
|
}
|
|
2738
|
-
|
|
2765
|
+
const updatedRelease = {
|
|
2766
|
+
...release,
|
|
2767
|
+
artifacts: release.artifacts.map((artifact, i) => i === index ? { ...artifact, description: body.description } : artifact)
|
|
2768
|
+
};
|
|
2739
2769
|
return Promise.all([
|
|
2740
|
-
dispatch(actions7.receiveRelease(
|
|
2770
|
+
dispatch(actions7.receiveRelease(updatedRelease)),
|
|
2741
2771
|
dispatch(setSnackbar2("Artifact details were updated successfully.", TIMEOUTS.fiveSeconds, "")),
|
|
2742
2772
|
dispatch(getRelease(release.name)),
|
|
2743
2773
|
dispatch(selectRelease(release.name))
|
|
@@ -2790,7 +2820,7 @@ var setReleasesListState = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}
|
|
|
2790
2820
|
let tasks = [];
|
|
2791
2821
|
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
2792
2822
|
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
2793
|
-
if (!(0,
|
|
2823
|
+
if (!(0, import_helpers8.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
2794
2824
|
nextState.isLoading = true;
|
|
2795
2825
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
2796
2826
|
}
|
|
@@ -2800,7 +2830,7 @@ var setReleasesListState = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}
|
|
|
2800
2830
|
var releaseListRetrieval = (config) => {
|
|
2801
2831
|
const { searchTerm = "", page = defaultPage, perPage = defaultPerPage, sort = sortingDefaults, selectedTags = [], type = "" } = config;
|
|
2802
2832
|
const { key: attribute, direction } = sort;
|
|
2803
|
-
const filterQuery =
|
|
2833
|
+
const filterQuery = formatReleases({ pageState: { searchTerm, selectedTags } });
|
|
2804
2834
|
const updateType = type ? `update_type=${type}` : "";
|
|
2805
2835
|
const sorting = attribute ? `sort=${attribute}:${direction}`.toLowerCase() : "";
|
|
2806
2836
|
return general_api_default.get(
|
|
@@ -2810,7 +2840,7 @@ var releaseListRetrieval = (config) => {
|
|
|
2810
2840
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
2811
2841
|
let releaseListState = { ...state.releasesList };
|
|
2812
2842
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
2813
|
-
const flattenedReleases = Object.values(receivedReleases).sort((0,
|
|
2843
|
+
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers8.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
2814
2844
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
2815
2845
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
2816
2846
|
if (searchOnly) {
|
|
@@ -2838,33 +2868,32 @@ var getReleases = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getRelea
|
|
|
2838
2868
|
return Promise.all(tasks);
|
|
2839
2869
|
}).catch((err) => commonErrorHandler(err, `Please check your connection`, dispatch));
|
|
2840
2870
|
});
|
|
2841
|
-
var getRelease = (0, import_toolkit17.createAsyncThunk)(
|
|
2842
|
-
`${
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
);
|
|
2871
|
+
var getRelease = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getReleases`, async (name, { dispatch, getState }) => {
|
|
2872
|
+
const releaseResponse = await general_api_default.get(`${deploymentsApiUrlV2}/deployments/releases/${name}`);
|
|
2873
|
+
const { data: release } = releaseResponse;
|
|
2874
|
+
if (release) {
|
|
2875
|
+
const stateRelease = getReleasesById(getState())[release.name] || {};
|
|
2876
|
+
await dispatch(actions7.receiveRelease(flattenRelease(release, stateRelease)));
|
|
2877
|
+
}
|
|
2878
|
+
return Promise.resolve(null);
|
|
2879
|
+
});
|
|
2851
2880
|
var updateReleaseInfo = (0, import_toolkit17.createAsyncThunk)(
|
|
2852
2881
|
`${sliceName7}/updateReleaseInfo`,
|
|
2853
|
-
({ 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(
|
|
2854
|
-
|
|
2882
|
+
({ 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(
|
|
2883
|
+
() => Promise.all([
|
|
2855
2884
|
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
2856
2885
|
dispatch(setSnackbar2("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
2857
|
-
])
|
|
2858
|
-
|
|
2886
|
+
])
|
|
2887
|
+
)
|
|
2859
2888
|
);
|
|
2860
2889
|
var setReleaseTags = (0, import_toolkit17.createAsyncThunk)(
|
|
2861
2890
|
`${sliceName7}/setReleaseTags`,
|
|
2862
|
-
({ name, tags = [] }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(
|
|
2863
|
-
|
|
2891
|
+
({ name, tags = [] }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(
|
|
2892
|
+
() => Promise.all([
|
|
2864
2893
|
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
2865
2894
|
dispatch(setSnackbar2("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
2866
|
-
])
|
|
2867
|
-
|
|
2895
|
+
])
|
|
2896
|
+
)
|
|
2868
2897
|
);
|
|
2869
2898
|
var getExistingReleaseTags = (0, import_toolkit17.createAsyncThunk)(
|
|
2870
2899
|
`${sliceName7}/getReleaseTags`,
|