@northern.tech/store 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +183 -129
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +42 -55
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +44 -70
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +51 -68
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +563 -544
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +39 -55
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-OWHFMKTA.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-OWHFMKTA.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-NCI6JV5R.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-NCI6JV5R.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-2P4VECEE.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-2P4VECEE.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-QG4PT5WK.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-QG4PT5WK.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-X65NMDPS.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-X65NMDPS.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-BWFTQHNM.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-BWFTQHNM.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-UPMSYTWW.mjs → chunk-DIZJVB6M.mjs} +306 -291
- package/dist/{chunk-UPMSYTWW.mjs.map → chunk-DIZJVB6M.mjs.map} +1 -1
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-ENLZPHTQ.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-MQIKQKSW.mjs → chunk-IFWKT27G.mjs} +37 -33
- package/dist/{chunk-MQIKQKSW.mjs.map → chunk-IFWKT27G.mjs.map} +1 -1
- package/dist/{chunk-EM2HUGUY.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-EM2HUGUY.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-2HCZYULZ.mjs → chunk-K2NZL5V4.mjs} +3 -6
- package/dist/{chunk-2HCZYULZ.mjs.map → chunk-K2NZL5V4.mjs.map} +1 -1
- package/dist/{chunk-Y47SYXII.mjs → chunk-KJAZNKV2.mjs} +43 -52
- package/dist/{chunk-Y47SYXII.mjs.map → chunk-KJAZNKV2.mjs.map} +1 -1
- package/dist/{chunk-U6YTBIDT.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-U6YTBIDT.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-EFHEROXZ.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-EFHEROXZ.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-RWYS5MKN.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-RWYS5MKN.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-ZLRZO4EY.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-OGAMVFPS.mjs → chunk-QQBUNZHA.mjs} +2 -6
- package/dist/{chunk-OGAMVFPS.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-WS3YYLTJ.mjs → chunk-R7LXL3KJ.mjs} +14 -13
- package/dist/{chunk-WS3YYLTJ.mjs.map → chunk-R7LXL3KJ.mjs.map} +1 -1
- package/dist/{chunk-MJW4632R.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-MJW4632R.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-L4HIW3KB.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-XJNI62IP.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-XJNI62IP.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-4U4X4KAC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-4U4X4KAC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-ZZ6VIQ3U.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-ZZ6VIQ3U.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-4C6IY46N.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-4C6IY46N.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.js +1 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.js +73 -135
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +12 -12
- package/dist/constants.js +36 -153
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +14 -14
- package/dist/deploymentsSlice/constants.js +34 -59
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +68 -79
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +35 -52
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +563 -553
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +34 -58
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +71 -81
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +40 -89
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +563 -589
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +34 -45
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +41 -52
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +249 -232
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +563 -547
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.js +34 -56
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +4 -4
- package/dist/organizationSlice/index.js +45 -53
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +35 -61
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +563 -572
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +38 -64
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +37 -57
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +293 -281
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.js +73 -207
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +43 -43
- package/dist/store.js +194 -151
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.js +568 -547
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +38 -41
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +563 -702
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.js +36 -66
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +4 -4
- package/dist/usersSlice/index.js +62 -71
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +41 -66
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +563 -576
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.js +57 -93
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-ENLZPHTQ.mjs +0 -35
- package/dist/chunk-L4HIW3KB.mjs +0 -36
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-ZLRZO4EY.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/deploymentsSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS } from '@northern.tech/store/constants';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, deploymentPrototype, limitDefault } from './constants';\n\nexport const sliceName = 'deployments';\n\nexport const initialState = {\n byId: {\n // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }\n },\n byStatus: {\n finished: { deploymentIds: [], total: 0 },\n inprogress: { deploymentIds: [], total: 0 },\n pending: { deploymentIds: [], total: 0 },\n scheduled: { deploymentIds: [], total: 0 }\n },\n config: {\n binaryDelta: {\n timeout: -1,\n duplicatesWindow: -1,\n compressionLevel: -1,\n disableChecksum: false,\n disableDecompression: false,\n inputWindow: -1,\n instructionBuffer: -1,\n sourceWindow: -1\n },\n binaryDeltaLimits: {\n timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },\n sourceWindow: limitDefault,\n inputWindow: limitDefault,\n duplicatesWindow: limitDefault,\n instructionBuffer: limitDefault\n }\n },\n deploymentDeviceLimit: 5000,\n selectedDeviceIds: [],\n selectionState: {\n finished: { ...DEVICE_LIST_DEFAULTS, endDate: undefined, search: '', selection: [], startDate: undefined, total: 0, type: '' },\n inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },\n pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },\n scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },\n general: {\n state: DEPLOYMENT_ROUTES.active.key,\n showCreationDialog: false,\n showReportDialog: false,\n reportType: null // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software\n },\n selectedId: undefined\n }\n};\n\nexport const deploymentsSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n createdDeployment: (state, action) => {\n state.byId[action.payload.id] = {\n ...deploymentPrototype,\n ...action.payload\n };\n state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;\n state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];\n (state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection]),\n (state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1);\n },\n removedDeployment: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedDeployment, ...remainder } = state.byId;\n state.byId = remainder;\n },\n receivedDeployment: (state, action) => {\n state.byId[action.payload.id] = {\n ...(state.byId[action.payload.id] || {}),\n ...action.payload\n };\n },\n receivedDeploymentDeviceLog: (state, action) => {\n const { id, deviceId, log } = action.payload;\n const deployment = {\n ...deploymentPrototype,\n ...state.byId[id]\n };\n state.byId[id] = {\n ...deployment,\n devices: {\n ...deployment.devices,\n [deviceId]: {\n ...deployment.devices[deviceId],\n log\n }\n }\n };\n },\n receivedDeploymentDevices: (state, action) => {\n const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;\n state.byId[id] = {\n ...state.byId[id],\n devices,\n totalDeviceCount\n };\n state.selectedDeviceIds = selectedDeviceIds;\n },\n receivedDeployments: (state, action) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n receivedDeploymentsForStatus: (state, action) => {\n const { status, deploymentIds, total } = action.payload;\n state.byStatus[status].deploymentIds = deploymentIds;\n state.byStatus[status].total = total;\n },\n selectDeploymentsForStatus: (state, action) => {\n const { status, deploymentIds, total } = action.payload;\n state.selectionState[status].selection = deploymentIds;\n state.selectionState[status].total = total;\n },\n setDeploymentsState: (state, action) => {\n state.selectionState = action.payload;\n },\n setDeploymentsConfig: (state, action) => {\n state.config = action.payload;\n }\n }\n});\n\nexport const actions = deploymentsSlice.actions;\nexport default deploymentsSlice.reducer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/deploymentsSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { DEVICE_LIST_DEFAULTS } from '@northern.tech/store/constants';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, deploymentPrototype, limitDefault } from './constants';\n\nexport const sliceName = 'deployments';\n\nexport const initialState = {\n byId: {\n // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }\n },\n byStatus: {\n finished: { deploymentIds: [], total: 0 },\n inprogress: { deploymentIds: [], total: 0 },\n pending: { deploymentIds: [], total: 0 },\n scheduled: { deploymentIds: [], total: 0 }\n },\n config: {\n binaryDelta: {\n timeout: -1,\n duplicatesWindow: -1,\n compressionLevel: -1,\n disableChecksum: false,\n disableDecompression: false,\n inputWindow: -1,\n instructionBuffer: -1,\n sourceWindow: -1\n },\n binaryDeltaLimits: {\n timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },\n sourceWindow: limitDefault,\n inputWindow: limitDefault,\n duplicatesWindow: limitDefault,\n instructionBuffer: limitDefault\n }\n },\n deploymentDeviceLimit: 5000,\n selectedDeviceIds: [],\n selectionState: {\n finished: { ...DEVICE_LIST_DEFAULTS, endDate: undefined, search: '', selection: [], startDate: undefined, total: 0, type: '' },\n inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },\n pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },\n scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },\n general: {\n state: DEPLOYMENT_ROUTES.active.key,\n showCreationDialog: false,\n showReportDialog: false,\n reportType: null // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software\n },\n selectedId: undefined\n }\n};\n\nexport const deploymentsSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n createdDeployment: (state, action) => {\n state.byId[action.payload.id] = {\n ...deploymentPrototype,\n ...action.payload\n };\n state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;\n state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];\n (state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection]),\n (state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1);\n },\n removedDeployment: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedDeployment, ...remainder } = state.byId;\n state.byId = remainder;\n },\n receivedDeployment: (state, action) => {\n state.byId[action.payload.id] = {\n ...(state.byId[action.payload.id] || {}),\n ...action.payload\n };\n },\n receivedDeploymentDeviceLog: (state, action) => {\n const { id, deviceId, log } = action.payload;\n const deployment = {\n ...deploymentPrototype,\n ...state.byId[id]\n };\n state.byId[id] = {\n ...deployment,\n devices: {\n ...deployment.devices,\n [deviceId]: {\n ...deployment.devices[deviceId],\n log\n }\n }\n };\n },\n receivedDeploymentDevices: (state, action) => {\n const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;\n state.byId[id] = {\n ...state.byId[id],\n devices,\n totalDeviceCount\n };\n state.selectedDeviceIds = selectedDeviceIds;\n },\n receivedDeployments: (state, action) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n receivedDeploymentsForStatus: (state, action) => {\n const { status, deploymentIds, total } = action.payload;\n state.byStatus[status].deploymentIds = deploymentIds;\n state.byStatus[status].total = total;\n },\n selectDeploymentsForStatus: (state, action) => {\n const { status, deploymentIds, total } = action.payload;\n state.selectionState[status].selection = deploymentIds;\n state.selectionState[status].total = total;\n },\n setDeploymentsState: (state, action) => {\n state.selectionState = action.payload;\n },\n setDeploymentsConfig: (state, action) => {\n state.config = action.payload;\n }\n }\n});\n\nexport const actions = deploymentsSlice.actions;\nexport default deploymentsSlice.reducer;\n"],"mappings":";;;;;;;;;;;;AAeA,SAAS,mBAAmB;AAIrB,IAAM,YAAY;AAElB,IAAM,eAAe;AAAA,EAC1B,MAAM;AAAA;AAAA,EAEN;AAAA,EACA,UAAU;AAAA,IACR,UAAU,EAAE,eAAe,CAAC,GAAG,OAAO,EAAE;AAAA,IACxC,YAAY,EAAE,eAAe,CAAC,GAAG,OAAO,EAAE;AAAA,IAC1C,SAAS,EAAE,eAAe,CAAC,GAAG,OAAO,EAAE;AAAA,IACvC,WAAW,EAAE,eAAe,CAAC,GAAG,OAAO,EAAE;AAAA,EAC3C;AAAA,EACA,QAAQ;AAAA,IACN,aAAa;AAAA,MACX,SAAS;AAAA,MACT,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,iBAAiB;AAAA,MACjB,sBAAsB;AAAA,MACtB,aAAa;AAAA,MACb,mBAAmB;AAAA,MACnB,cAAc;AAAA,IAChB;AAAA,IACA,mBAAmB;AAAA,MACjB,SAAS,EAAE,GAAG,cAAc,SAAS,IAAI,KAAK,MAAM,KAAK,GAAG;AAAA,MAC5D,cAAc;AAAA,MACd,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,mBAAmB;AAAA,IACrB;AAAA,EACF;AAAA,EACA,uBAAuB;AAAA,EACvB,mBAAmB,CAAC;AAAA,EACpB,gBAAgB;AAAA,IACd,UAAU,EAAE,GAAG,sBAAsB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C;AAAA,IACA,qBAAqB,CAAC,OAAO,WAAW;AACtC,YAAM,iBAAiB,OAAO;AAAA,IAChC;AAAA,IACA,sBAAsB,CAAC,OAAO,WAAW;AACvC,YAAM,SAAS,OAAO;AAAA,IACxB;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,iBAAiB;AACxC,IAAO,2BAAQ,iBAAiB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EXTERNAL_PROVIDER
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
4
4
|
|
|
5
5
|
// src/organizationSlice/selectors.ts
|
|
6
6
|
import { createSelector } from "@reduxjs/toolkit";
|
|
@@ -15,10 +15,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
15
15
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
16
16
|
var getDeviceTwinIntegrations = createSelector(
|
|
17
17
|
[getExternalIntegrations],
|
|
18
|
-
(integrations) => integrations.filter((integration) =>
|
|
19
|
-
var _a;
|
|
20
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
21
|
-
})
|
|
18
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
22
19
|
);
|
|
23
20
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
24
21
|
var getWebhooks = createSelector(
|
|
@@ -53,4 +50,4 @@ export {
|
|
|
53
50
|
getWebhookEventInfo,
|
|
54
51
|
getAuditLogEntry
|
|
55
52
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-K2NZL5V4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/organizationSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { EXTERNAL_PROVIDER } from '@northern.tech/store/constants';\nimport { createSelector } from '@reduxjs/toolkit';\n\nexport const getOrganization = state => state.organization.organization;\nexport const getExternalIntegrations = state => state.organization.externalDeviceIntegrations;\nexport const getAuditlogState = state => state.organization.auditlog.selectionState;\nexport const getAuditLog = state => state.organization.auditlog.events;\nexport const getAuditLogSelectionState = state => state.organization.auditlog.selectionState;\nexport const getSsoConfig = ({ organization: { ssoConfigs = [] } }) => ssoConfigs[0];\nexport const getTenantsList = state => state.organization.tenantList;\nexport const getWebhookEvents = state => state.organization.webhooks.events;\nexport const getWebhookEventTotal = state => state.organization.webhooks.eventTotal;\n\nexport const getDeviceTwinIntegrations = createSelector([getExternalIntegrations], integrations =>\n integrations.filter(integration => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)\n);\nexport const getIsServiceProvider = state => state.organization.organization.service_provider;\n\nexport const getWebhooks = createSelector([getExternalIntegrations], integrations =>\n integrations.filter(integration => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)\n);\nexport const getWebhookEventInfo = createSelector([getWebhooks, getWebhookEvents, getWebhookEventTotal], (webhooks, events, eventTotal) =>\n webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }\n);\n\nexport const getAuditLogEntry = createSelector([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {\n if (!selectedId) {\n return;\n }\n const [eventAction, eventTime] = atob(selectedId).split('|');\n return events.find(item => item.action === eventAction && item.time === eventTime);\n});\n"],"mappings":";;;;;AAcA,SAAS,sBAAsB;AAExB,IAAM,kBAAkB,WAAS,MAAM,aAAa;AACpD,IAAM,0BAA0B,WAAS,MAAM,aAAa;AAC5D,IAAM,mBAAmB,WAAS,MAAM,aAAa,SAAS;AAC9D,IAAM,cAAc,WAAS,MAAM,aAAa,SAAS;AACzD,IAAM,4BAA4B,WAAS,MAAM,aAAa,SAAS;AACvE,IAAM,eAAe,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,WAAW,CAAC;AAC5E,IAAM,iBAAiB,WAAS,MAAM,aAAa;AACnD,IAAM,mBAAmB,WAAS,MAAM,aAAa,SAAS;AAC9D,IAAM,uBAAuB,WAAS,MAAM,aAAa,SAAS;AAElE,IAAM,4BAA4B;AAAA,EAAe,CAAC,uBAAuB;AAAA,EAAG,kBACjF,aAAa,OAAO,
|
|
1
|
+
{"version":3,"sources":["../src/organizationSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { EXTERNAL_PROVIDER } from '@northern.tech/store/constants';\nimport { createSelector } from '@reduxjs/toolkit';\n\nexport const getOrganization = state => state.organization.organization;\nexport const getExternalIntegrations = state => state.organization.externalDeviceIntegrations;\nexport const getAuditlogState = state => state.organization.auditlog.selectionState;\nexport const getAuditLog = state => state.organization.auditlog.events;\nexport const getAuditLogSelectionState = state => state.organization.auditlog.selectionState;\nexport const getSsoConfig = ({ organization: { ssoConfigs = [] } }) => ssoConfigs[0];\nexport const getTenantsList = state => state.organization.tenantList;\nexport const getWebhookEvents = state => state.organization.webhooks.events;\nexport const getWebhookEventTotal = state => state.organization.webhooks.eventTotal;\n\nexport const getDeviceTwinIntegrations = createSelector([getExternalIntegrations], integrations =>\n integrations.filter(integration => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)\n);\nexport const getIsServiceProvider = state => state.organization.organization.service_provider;\n\nexport const getWebhooks = createSelector([getExternalIntegrations], integrations =>\n integrations.filter(integration => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)\n);\nexport const getWebhookEventInfo = createSelector([getWebhooks, getWebhookEvents, getWebhookEventTotal], (webhooks, events, eventTotal) =>\n webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }\n);\n\nexport const getAuditLogEntry = createSelector([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {\n if (!selectedId) {\n return;\n }\n const [eventAction, eventTime] = atob(selectedId).split('|');\n return events.find(item => item.action === eventAction && item.time === eventTime);\n});\n"],"mappings":";;;;;AAcA,SAAS,sBAAsB;AAExB,IAAM,kBAAkB,WAAS,MAAM,aAAa;AACpD,IAAM,0BAA0B,WAAS,MAAM,aAAa;AAC5D,IAAM,mBAAmB,WAAS,MAAM,aAAa,SAAS;AAC9D,IAAM,cAAc,WAAS,MAAM,aAAa,SAAS;AACzD,IAAM,4BAA4B,WAAS,MAAM,aAAa,SAAS;AACvE,IAAM,eAAe,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,WAAW,CAAC;AAC5E,IAAM,iBAAiB,WAAS,MAAM,aAAa;AACnD,IAAM,mBAAmB,WAAS,MAAM,aAAa,SAAS;AAC9D,IAAM,uBAAuB,WAAS,MAAM,aAAa,SAAS;AAElE,IAAM,4BAA4B;AAAA,EAAe,CAAC,uBAAuB;AAAA,EAAG,kBACjF,aAAa,OAAO,iBAAe,YAAY,MAAM,kBAAkB,YAAY,QAAQ,GAAG,UAAU;AAC1G;AACO,IAAM,uBAAuB,WAAS,MAAM,aAAa,aAAa;AAEtE,IAAM,cAAc;AAAA,EAAe,CAAC,uBAAuB;AAAA,EAAG,kBACnE,aAAa,OAAO,iBAAe,YAAY,MAAM,YAAY,aAAa,kBAAkB,QAAQ,QAAQ;AAClH;AACO,IAAM,sBAAsB;AAAA,EAAe,CAAC,aAAa,kBAAkB,oBAAoB;AAAA,EAAG,CAAC,UAAU,QAAQ,eAC1H,SAAS,SAAS,EAAE,QAAQ,WAAW,IAAI,EAAE,QAAQ,CAAC,GAAG,YAAY,EAAE;AACzE;AAEO,IAAM,mBAAmB,eAAe,CAAC,aAAa,yBAAyB,GAAG,CAAC,QAAQ,EAAE,WAAW,MAAM;AACnH,MAAI,CAAC,YAAY;AACf;AAAA,EACF;AACA,QAAM,CAAC,aAAa,SAAS,IAAI,KAAK,UAAU,EAAE,MAAM,GAAG;AAC3D,SAAO,OAAO,KAAK,UAAQ,KAAK,WAAW,eAAe,KAAK,SAAS,SAAS;AACnF,CAAC;","names":[]}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFeatures,
|
|
3
|
+
getSearchedDevices
|
|
4
|
+
} from "./chunk-2Z3RFYW4.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getAuditLogEntry,
|
|
7
|
+
getIsServiceProvider,
|
|
8
|
+
getOrganization
|
|
9
|
+
} from "./chunk-K2NZL5V4.mjs";
|
|
1
10
|
import {
|
|
2
11
|
getCurrentUser,
|
|
3
12
|
getGlobalSettings,
|
|
4
13
|
getRolesById,
|
|
5
14
|
getRolesList,
|
|
6
15
|
getUserSettings
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
getAuditLogEntry,
|
|
10
|
-
getIsServiceProvider,
|
|
11
|
-
getOrganization
|
|
12
|
-
} from "./chunk-2HCZYULZ.mjs";
|
|
16
|
+
} from "./chunk-XD7INCM4.mjs";
|
|
13
17
|
import {
|
|
14
18
|
getReleasesById
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XC5UXEIB.mjs";
|
|
16
20
|
import {
|
|
17
21
|
getIssueCountsByType
|
|
18
22
|
} from "./chunk-H2PQQMRY.mjs";
|
|
19
|
-
import {
|
|
20
|
-
getOnboarding
|
|
21
|
-
} from "./chunk-QBKCUIWO.mjs";
|
|
22
|
-
import {
|
|
23
|
-
getDeploymentsById,
|
|
24
|
-
getDeploymentsSelectionState,
|
|
25
|
-
getSelectedDeploymentDeviceIds
|
|
26
|
-
} from "./chunk-BWFTQHNM.mjs";
|
|
27
23
|
import {
|
|
28
24
|
getDeviceById,
|
|
29
25
|
getDevicesById,
|
|
30
26
|
getFilteringAttributes,
|
|
31
27
|
getGroupsById,
|
|
32
28
|
getListedDevices
|
|
33
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-6CSGHZ3E.mjs";
|
|
34
30
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
getOnboarding
|
|
32
|
+
} from "./chunk-QBKCUIWO.mjs";
|
|
33
|
+
import {
|
|
34
|
+
getDeploymentsById,
|
|
35
|
+
getDeploymentsSelectionState,
|
|
36
|
+
getSelectedDeploymentDeviceIds
|
|
37
|
+
} from "./chunk-CHUCIHMY.mjs";
|
|
38
38
|
import {
|
|
39
39
|
listItemMapper,
|
|
40
40
|
mapUserRolesToUiPermissions
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-KPPU6OWF.mjs";
|
|
42
42
|
import {
|
|
43
43
|
inventoryApiUrlV2,
|
|
44
44
|
reportingApiUrl,
|
|
@@ -46,27 +46,21 @@ import {
|
|
|
46
46
|
rolesByName,
|
|
47
47
|
serviceProviderRolesById,
|
|
48
48
|
uiPermissionsById
|
|
49
|
-
} from "./chunk-
|
|
50
|
-
import {
|
|
51
|
-
onboardingSteps
|
|
52
|
-
} from "./chunk-IU4OXOPA.mjs";
|
|
49
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
53
50
|
import {
|
|
54
51
|
PLANS,
|
|
55
52
|
defaultReports
|
|
56
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-5VNQCCAQ.mjs";
|
|
54
|
+
import {
|
|
55
|
+
onboardingSteps
|
|
56
|
+
} from "./chunk-IU4OXOPA.mjs";
|
|
57
57
|
import {
|
|
58
58
|
ALL_DEVICES,
|
|
59
59
|
ATTRIBUTE_SCOPES,
|
|
60
60
|
DEVICE_ISSUE_OPTIONS,
|
|
61
61
|
DEVICE_LIST_MAXIMUM_LENGTH,
|
|
62
62
|
UNGROUPED_GROUP
|
|
63
|
-
} from "./chunk-
|
|
64
|
-
import {
|
|
65
|
-
__objRest,
|
|
66
|
-
__restKey,
|
|
67
|
-
__spreadProps,
|
|
68
|
-
__spreadValues
|
|
69
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
63
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
70
64
|
|
|
71
65
|
// src/commonSelectors.ts
|
|
72
66
|
import { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from "@northern.tech/utils/helpers";
|
|
@@ -86,8 +80,7 @@ var getSearchEndpoint = createSelector(
|
|
|
86
80
|
var getUserRoles = createSelector(
|
|
87
81
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
88
82
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
89
|
-
|
|
90
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
83
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
91
84
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
92
85
|
return { isAdmin, uiPermissions };
|
|
93
86
|
}
|
|
@@ -156,10 +149,11 @@ var getFilterAttributes = createSelector(
|
|
|
156
149
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
157
150
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
158
151
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
159
|
-
const updateAttribute =
|
|
152
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
160
153
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
161
154
|
const attributes = [
|
|
162
|
-
...previousFilters.map((item) =>
|
|
155
|
+
...previousFilters.map((item) => ({
|
|
156
|
+
...item,
|
|
163
157
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
164
158
|
category: "recently used",
|
|
165
159
|
priority: 0
|
|
@@ -177,14 +171,13 @@ var getFilterAttributes = createSelector(
|
|
|
177
171
|
return attributeDuplicateFilter(attributes, "key");
|
|
178
172
|
}
|
|
179
173
|
);
|
|
180
|
-
var getOnboardingState = createSelector([getOnboarding, getUserSettings], (
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
174
|
+
var getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
175
|
+
...remainder,
|
|
176
|
+
...onboarding,
|
|
177
|
+
complete: onboarding.complete || complete,
|
|
178
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress : onboarding.progress,
|
|
179
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
180
|
+
}));
|
|
188
181
|
var getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
189
182
|
const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;
|
|
190
183
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -205,12 +198,11 @@ var getDeploymentRelease = createSelector(
|
|
|
205
198
|
var getSelectedDeploymentData = createSelector(
|
|
206
199
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
207
200
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
208
|
-
|
|
209
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
201
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
210
202
|
const { devices = {} } = deployment;
|
|
211
203
|
return {
|
|
212
204
|
deployment,
|
|
213
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
205
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
214
206
|
};
|
|
215
207
|
}
|
|
216
208
|
);
|
|
@@ -225,8 +217,7 @@ var getAvailableIssueOptionsByType = createSelector(
|
|
|
225
217
|
}, {})
|
|
226
218
|
);
|
|
227
219
|
var getGroupNames = createSelector([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
228
|
-
|
|
229
|
-
const _b = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b, groups = __objRest(_b, [__restKey(_a)]);
|
|
220
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
230
221
|
if (staticOnly) {
|
|
231
222
|
return Object.keys(uiPermissions.groups).sort();
|
|
232
223
|
}
|
|
@@ -260,9 +251,9 @@ var getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (audi
|
|
|
260
251
|
if (auditlogEvent) {
|
|
261
252
|
const { object = {} } = auditlogEvent;
|
|
262
253
|
const { device = {}, id, type } = object;
|
|
263
|
-
auditlogDevice = type === "device" ?
|
|
254
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
264
255
|
}
|
|
265
|
-
return
|
|
256
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
266
257
|
});
|
|
267
258
|
var getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
268
259
|
if (service_provider) {
|
|
@@ -301,4 +292,4 @@ export {
|
|
|
301
292
|
getAuditlogDevice,
|
|
302
293
|
getRelevantRoles
|
|
303
294
|
};
|
|
304
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-KJAZNKV2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commonSelectors.ts"],"sourcesContent":["// 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 { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport { PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport { inventoryApiUrlV2, reportingApiUrl } from './devicesSlice/constants';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport { rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './usersSlice/constants';\nimport { getCurrentUser, getGlobalSettings, getRolesById, getRolesList, getUserSettings } from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getAttrsEndpoint = createSelector([getFeatures], ({ hasReporting }) =>\n hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`\n);\nexport const getSearchEndpoint = createSelector([getFeatures], ({ hasReporting }) =>\n hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`\n);\n\nexport const getUserRoles = createSelector(\n [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],\n (currentUser, rolesById, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {\n const isAdmin = currentUser.roles?.length\n ? currentUser.roles.some(role => role === rolesByName.admin)\n : !(hasMultitenancy || isEnterprise || (isHosted && plan !== PLANS.os.id));\n const uiPermissions = isAdmin\n ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById)\n : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n }\n);\n\nconst hasPermission = (thing, permission) => Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n { hasAuditlogs: isAuditlogEnabled, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = isDeviceConfigEnabled && addons.some(addon => addon.name === 'configure' && Boolean(addon.enabled));\n const hasDeviceConnect = isDeviceConnectEnabled && (!isEnterprise || addons.some(addon => addon.name === 'troubleshoot' && Boolean(addon.enabled)));\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === 'monitor' && Boolean(addon.enabled));\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId }, releasesById) => {\n const deployment = deploymentsById[selectedId] || {};\n return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...devices[deviceId] }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector(\n [getFeatures, getTenantCapabilities, getIssueCountsByType],\n ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {\n if (isCategory || (needsReporting && !hasReporting) || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n }, {})\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n if (staticOnly) {\n return Object.keys(uiPermissions.groups).sort();\n }\n return Object.keys(\n Object.entries(groups).reduce((accu, [groupName, group]) => {\n if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n }, uiPermissions.groups)\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) => {\n return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);\n }\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice = {};\n if (auditlogEvent) {\n const { object = {} } = auditlogEvent;\n const { device = {}, id, type } = object;\n auditlogDevice = type === 'device' ? { id, ...device } : auditlogDevice;\n }\n return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };\n});\n\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce((accu, role) => {\n if (rolesById[role.id]) {\n return accu;\n }\n accu.push(role);\n return accu;\n }, Object.values(serviceProviderRolesById));\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ id }) => id === key);\n accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];\n return accu;\n }, roles);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,0BAA0B,wBAAwB,kCAAkC;AAC7F,SAAS,sBAAsB;AAiBxB,IAAM,kBAAkB;AAAA,EAC7B,CAAC,iBAAiB,WAAW;AAAA,EAC7B,CAAC,EAAE,OAAO,MAAM,GAAG,GAAG,GAAG,EAAE,cAAc,SAAS,MAAM,gBAAiB,YAAY,SAAS,MAAM,WAAW;AACjH;AAEO,IAAM,mBAAmB;AAAA,EAAe,CAAC,WAAW;AAAA,EAAG,CAAC,EAAE,aAAa,MAC5E,eAAe,GAAG,eAAe,+BAA+B,GAAG,iBAAiB;AACtF;AACO,IAAM,oBAAoB;AAAA,EAAe,CAAC,WAAW;AAAA,EAAG,CAAC,EAAE,aAAa,MAC7E,eAAe,GAAG,eAAe,oBAAoB,GAAG,iBAAiB;AAC3E;AAEO,IAAM,eAAe;AAAA,EAC1B,CAAC,gBAAgB,cAAc,iBAAiB,aAAa,eAAe;AAAA,EAC5E,CAAC,aAAaA,YAAW,cAAc,EAAE,UAA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e,EAAE;AAC9D,CAAC;AAEM,IAAM,mBAAmB,eAAe,CAAC,iBAAiB,YAAY,GAAG,CAAC,EAAE,iBAAiB,GAAG,UAAU;AAC/G,MAAI,kBAAkB;AACpB,WAAO,MAAM,OAAO,CAAC,MAAM,SAAS;AAClC,UAAI,UAAU,KAAK,EAAE,GAAG;AACtB,eAAO;AAAA,MACT;AACA,WAAK,KAAK,IAAI;AACd,aAAO;AAAA,IACT,GAAG,OAAO,OAAO,wBAAwB,CAAC;AAAA,EAC5C;AACA,SAAO,OAAO,KAAK,SAAS,EACzB,QAAQ,EACR,OAAO,CAAC,MAAM,QAAQ;AACrB,UAAM,QAAQ,KAAK,UAAU,CAAC,EAAE,GAAG,MAAM,OAAO,GAAG;AACnD,WAAO,CAAC,KAAK,KAAK,GAAG,GAAG,KAAK,OAAO,CAAC,MAAM,cAAc,UAAU,SAAS,CAAC;AAC7E,WAAO;AAAA,EACT,GAAG,KAAK;AACZ,CAAC;","names":["rolesById"]}
|
|
1
|
+
{"version":3,"sources":["../src/commonSelectors.ts"],"sourcesContent":["// 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 { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport { PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport { inventoryApiUrlV2, reportingApiUrl } from './devicesSlice/constants';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport { rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './usersSlice/constants';\nimport { getCurrentUser, getGlobalSettings, getRolesById, getRolesList, getUserSettings } from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getAttrsEndpoint = createSelector([getFeatures], ({ hasReporting }) =>\n hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`\n);\nexport const getSearchEndpoint = createSelector([getFeatures], ({ hasReporting }) =>\n hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`\n);\n\nexport const getUserRoles = createSelector(\n [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],\n (currentUser, rolesById, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {\n const isAdmin = currentUser.roles?.length\n ? currentUser.roles.some(role => role === rolesByName.admin)\n : !(hasMultitenancy || isEnterprise || (isHosted && plan !== PLANS.os.id));\n const uiPermissions = isAdmin\n ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById)\n : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n }\n);\n\nconst hasPermission = (thing, permission) => Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n { hasAuditlogs: isAuditlogEnabled, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = isDeviceConfigEnabled && addons.some(addon => addon.name === 'configure' && Boolean(addon.enabled));\n const hasDeviceConnect = isDeviceConnectEnabled && (!isEnterprise || addons.some(addon => addon.name === 'troubleshoot' && Boolean(addon.enabled)));\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === 'monitor' && Boolean(addon.enabled));\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId }, releasesById) => {\n const deployment = deploymentsById[selectedId] || {};\n return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...devices[deviceId] }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector(\n [getFeatures, getTenantCapabilities, getIssueCountsByType],\n ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {\n if (isCategory || (needsReporting && !hasReporting) || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n }, {})\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n if (staticOnly) {\n return Object.keys(uiPermissions.groups).sort();\n }\n return Object.keys(\n Object.entries(groups).reduce((accu, [groupName, group]) => {\n if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n }, uiPermissions.groups)\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) => {\n return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);\n }\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice = {};\n if (auditlogEvent) {\n const { object = {} } = auditlogEvent;\n const { device = {}, id, type } = object;\n auditlogDevice = type === 'device' ? { id, ...device } : auditlogDevice;\n }\n return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };\n});\n\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce((accu, role) => {\n if (rolesById[role.id]) {\n return accu;\n }\n accu.push(role);\n return accu;\n }, Object.values(serviceProviderRolesById));\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ id }) => id === key);\n accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];\n return accu;\n }, roles);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,0BAA0B,wBAAwB,kCAAkC;AAC7F,SAAS,sBAAsB;AAiBxB,IAAM,kBAAkB;AAAA,EAC7B,CAAC,iBAAiB,WAAW;AAAA,EAC7B,CAAC,EAAE,OAAO,MAAM,GAAG,GAAG,GAAG,EAAE,cAAc,SAAS,MAAM,gBAAiB,YAAY,SAAS,MAAM,WAAW;AACjH;AAEO,IAAM,mBAAmB;AAAA,EAAe,CAAC,WAAW;AAAA,EAAG,CAAC,EAAE,aAAa,MAC5E,eAAe,GAAG,eAAe,+BAA+B,GAAG,iBAAiB;AACtF;AACO,IAAM,oBAAoB;AAAA,EAAe,CAAC,WAAW;AAAA,EAAG,CAAC,EAAE,aAAa,MAC7E,eAAe,GAAG,eAAe,oBAAoB,GAAG,iBAAiB;AAC3E;AAEO,IAAM,eAAe;AAAA,EAC1B,CAAC,gBA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AE,EAAE;AAChE,CAAC;AAEM,IAAM,mBAAmB,eAAe,CAAC,iBAAiB,YAAY,GAAG,CAAC,EAAE,iBAAiB,GAAG,UAAU;AAC/G,MAAI,kBAAkB;AACpB,WAAO,MAAM,OAAO,CAAC,MAAM,SAAS;AAClC,UAAI,UAAU,KAAK,EAAE,GAAG;AACtB,eAAO;AAAA,MACT;AACA,WAAK,KAAK,IAAI;AACd,aAAO;AAAA,IACT,GAAG,OAAO,OAAO,wBAAwB,CAAC;AAAA,EAC5C;AACA,SAAO,OAAO,KAAK,SAAS,EACzB,QAAQ,EACR,OAAO,CAAC,MAAM,QAAQ;AACrB,UAAM,QAAQ,KAAK,UAAU,CAAC,EAAE,GAAG,MAAM,OAAO,GAAG;AACnD,WAAO,CAAC,KAAK,KAAK,GAAG,GAAG,KAAK,OAAO,CAAC,MAAM,cAAc,UAAU,SAAS,CAAC;AAC7E,WAAO;AAAA,EACT,GAAG,KAAK;AACZ,CAAC;","names":["rolesById"]}
|
|
@@ -5,21 +5,17 @@ import {
|
|
|
5
5
|
deploymentStatesToSubstates,
|
|
6
6
|
deploymentStatesToSubstatesWithSkipped,
|
|
7
7
|
emptyFilter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
9
9
|
import {
|
|
10
10
|
DARK_MODE
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5VNQCCAQ.mjs";
|
|
12
12
|
import {
|
|
13
13
|
ATTRIBUTE_SCOPES,
|
|
14
14
|
DEVICE_FILTERING_OPTIONS,
|
|
15
15
|
DEVICE_ISSUE_OPTIONS,
|
|
16
16
|
DEVICE_LIST_MAXIMUM_LENGTH,
|
|
17
17
|
emptyUiPermissions
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
__spreadProps,
|
|
21
|
-
__spreadValues
|
|
22
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
18
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
23
19
|
|
|
24
20
|
// src/utils.ts
|
|
25
21
|
import { duplicateFilter, yes } from "@northern.tech/utils/helpers";
|
|
@@ -36,15 +32,12 @@ var filterProcessors = {
|
|
|
36
32
|
var filterAliases = {
|
|
37
33
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
38
34
|
};
|
|
39
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
46
|
-
};
|
|
47
|
-
});
|
|
35
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
36
|
+
scope: filter.scope,
|
|
37
|
+
attribute: filter.key,
|
|
38
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
39
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
40
|
+
}));
|
|
48
41
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
49
42
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
50
43
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -54,14 +47,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
54
47
|
});
|
|
55
48
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
56
49
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
57
|
-
return
|
|
50
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
58
51
|
}
|
|
59
52
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
60
53
|
});
|
|
61
54
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
62
|
-
var _a;
|
|
63
55
|
let applicableFilters = [...filters];
|
|
64
|
-
if (typeof group === "string" && !(
|
|
56
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
65
57
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
66
58
|
}
|
|
67
59
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -82,12 +74,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
82
74
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
83
75
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
84
76
|
if (id && byId[id]) {
|
|
85
|
-
accu.push(
|
|
77
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
86
78
|
}
|
|
87
79
|
return accu;
|
|
88
80
|
}, []);
|
|
89
81
|
};
|
|
90
|
-
var mergePermissions = (existingPermissions =
|
|
82
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
91
83
|
(accu, [key, value]) => {
|
|
92
84
|
let values;
|
|
93
85
|
if (!accu[key]) {
|
|
@@ -97,12 +89,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
97
89
|
if (Array.isArray(value)) {
|
|
98
90
|
values = [...value, ...accu[key]].filter(duplicateFilter);
|
|
99
91
|
} else {
|
|
100
|
-
values = mergePermissions(accu[key],
|
|
92
|
+
values = mergePermissions(accu[key], { ...value });
|
|
101
93
|
}
|
|
102
94
|
accu[key] = values;
|
|
103
95
|
return accu;
|
|
104
96
|
},
|
|
105
|
-
|
|
97
|
+
{ ...addedPermissions }
|
|
106
98
|
);
|
|
107
99
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
108
100
|
(accu, roleId) => {
|
|
@@ -111,20 +103,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
111
103
|
}
|
|
112
104
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
113
105
|
},
|
|
114
|
-
|
|
106
|
+
{ ...emptyUiPermissions }
|
|
115
107
|
);
|
|
116
108
|
var progress = ({ loaded, total }) => {
|
|
117
109
|
let uploadProgress = loaded / total * 100;
|
|
118
110
|
return uploadProgress = uploadProgress < 50 ? Math.ceil(uploadProgress) : Math.round(uploadProgress);
|
|
119
111
|
};
|
|
120
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
121
|
-
var _a, _b, _c, _d, _e;
|
|
122
|
-
return ((_c = (_b = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error) == null ? void 0 : _c.message) || ((_e = (_d = err.response) == null ? void 0 : _d.data) == null ? void 0 : _e.error) || err.error || err.message || fallback;
|
|
123
|
-
};
|
|
112
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
124
113
|
var preformatWithRequestID = (res, failMsg) => {
|
|
125
114
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
126
115
|
try {
|
|
127
|
-
if (
|
|
116
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
128
117
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
129
118
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
130
119
|
}
|
|
@@ -166,21 +155,22 @@ var statCollector = (items, statistics) => items.reduce((accu, property) => accu
|
|
|
166
155
|
var groupDeploymentStats = (deployment, withSkipped) => {
|
|
167
156
|
const { statistics = {} } = deployment;
|
|
168
157
|
const { status = {} } = statistics;
|
|
169
|
-
const stats =
|
|
158
|
+
const stats = { ...defaultStats, ...status };
|
|
170
159
|
let groupStates = deploymentStatesToSubstates;
|
|
171
160
|
let result = {};
|
|
172
161
|
if (withSkipped) {
|
|
173
162
|
groupStates = deploymentStatesToSubstatesWithSkipped;
|
|
174
163
|
result.skipped = statCollector(groupStates.skipped, stats);
|
|
175
164
|
}
|
|
176
|
-
result =
|
|
165
|
+
result = {
|
|
166
|
+
...result,
|
|
177
167
|
// don't include 'pending' as inprogress, as all remaining devices will be pending - we don't discriminate based on phase membership
|
|
178
168
|
inprogress: statCollector(groupStates.inprogress, stats),
|
|
179
169
|
pending: (deployment.max_devices ? deployment.max_devices - deployment.device_count : 0) + statCollector(groupStates.pending, stats),
|
|
180
170
|
successes: statCollector(groupStates.successes, stats),
|
|
181
171
|
failures: statCollector(groupStates.failures, stats),
|
|
182
172
|
paused: statCollector(groupStates.paused, stats)
|
|
183
|
-
}
|
|
173
|
+
};
|
|
184
174
|
return result;
|
|
185
175
|
};
|
|
186
176
|
var getDeploymentState = (deployment) => {
|
|
@@ -194,18 +184,16 @@ var getDeploymentState = (deployment) => {
|
|
|
194
184
|
}
|
|
195
185
|
return status;
|
|
196
186
|
};
|
|
197
|
-
var generateDeploymentGroupDetails = (filter, groupName) => {
|
|
198
|
-
var _a;
|
|
199
|
-
return filter && ((_a = filter.terms) == null ? void 0 : _a.length) ? `${groupName} (${filter.terms.map((filter2) => `${filter2.attribute || filter2.key} ${DEVICE_FILTERING_OPTIONS[filter2.type || filter2.operator].shortform} ${filter2.value}`).join(", ")})` : groupName;
|
|
200
|
-
};
|
|
187
|
+
var generateDeploymentGroupDetails = (filter, groupName) => filter && filter.terms?.length ? `${groupName} (${filter.terms.map((filter2) => `${filter2.attribute || filter2.key} ${DEVICE_FILTERING_OPTIONS[filter2.type || filter2.operator].shortform} ${filter2.value}`).join(", ")})` : groupName;
|
|
201
188
|
var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
202
189
|
(accu, attribute) => {
|
|
203
190
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
204
191
|
return accu;
|
|
205
192
|
}
|
|
206
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
193
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
194
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
207
195
|
[attribute.name]: attribute.value
|
|
208
|
-
}
|
|
196
|
+
};
|
|
209
197
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
210
198
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
211
199
|
}
|
|
@@ -236,4 +224,4 @@ export {
|
|
|
236
224
|
mapDeviceAttributes,
|
|
237
225
|
isDarkMode
|
|
238
226
|
};
|
|
239
|
-
//# sourceMappingURL=chunk-
|
|
227
|
+
//# sourceMappingURL=chunk-KPPU6OWF.mjs.map
|