@northern.tech/store 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.mts +95 -0
- package/dist/actions.d.ts +95 -0
- package/dist/actions.js +1746 -0
- package/dist/actions.js.map +1 -0
- package/dist/actions.mjs +21 -0
- package/dist/actions.mjs.map +1 -0
- package/dist/api/general-api.d.mts +21 -0
- package/dist/api/general-api.d.ts +21 -0
- package/dist/api/general-api.js +1002 -0
- package/dist/api/general-api.js.map +1 -0
- package/dist/api/general-api.mjs +18 -0
- package/dist/api/general-api.mjs.map +1 -0
- package/dist/api/types/Address.ts +6 -0
- package/dist/api/types/AddressUpdate.ts +12 -0
- package/dist/api/types/AuthSet.ts +37 -0
- package/{api/types/AuthSet.ts → dist/api/types/AuthSetIot_manager.ts} +2 -2
- package/dist/api/types/BillingProfile.ts +37 -0
- package/dist/api/types/BillingProfileUpdate.ts +37 -0
- package/{api → dist/api}/types/BinaryDeltaLimits.ts +6 -0
- package/{api → dist/api}/types/BoundingBox.ts +1 -3
- package/dist/api/types/Deployment.ts +45 -0
- package/{api → dist/api}/types/DeploymentAggregation.ts +1 -3
- package/{api → dist/api}/types/DeploymentAggregationItem.ts +1 -3
- package/{api → dist/api}/types/DeploymentAggregationTerm.ts +1 -2
- package/{api → dist/api}/types/DeploymentAggregationTerms.ts +1 -3
- package/{api → dist/api}/types/DeploymentAttributeProjection.ts +1 -2
- package/{api → dist/api}/types/DeploymentDeployments.ts +4 -5
- package/{api → dist/api}/types/DeploymentFilterTerm.ts +1 -3
- package/dist/api/types/DeploymentPhaseDeployments.ts +23 -0
- package/{api → dist/api}/types/DeploymentSearchTerms.ts +1 -3
- package/{api → dist/api}/types/DeploymentSortTerm.ts +1 -3
- package/dist/api/types/DeploymentStatisticsDeployments.ts +15 -0
- package/dist/api/types/DeploymentStatusStatisticsDeployments.ts +54 -0
- package/dist/api/types/Device.ts +20 -0
- package/{api → dist/api}/types/DeviceAggregation.ts +1 -3
- package/{api → dist/api}/types/DeviceAggregationItem.ts +1 -3
- package/{api → dist/api}/types/DeviceAggregationTerm.ts +1 -2
- package/{api → dist/api}/types/DeviceAggregationTerms.ts +1 -3
- package/{api → dist/api}/types/DeviceAttribute.ts +1 -2
- package/{api → dist/api}/types/DeviceAttributeProjection.ts +1 -2
- package/{api/types/Device.ts → dist/api/types/DeviceDeployments.ts} +1 -1
- package/{api → dist/api}/types/DeviceFilterAttribute.ts +1 -2
- package/{api → dist/api}/types/DeviceFilterTerm.ts +1 -3
- package/{api → dist/api}/types/DeviceSearchTerms.ts +1 -3
- package/{api → dist/api}/types/DeviceSortTerm.ts +1 -3
- package/{api → dist/api}/types/Error.ts +1 -1
- package/{api/types/FilterInventory.ts → dist/api/types/Filter.ts} +3 -4
- package/{api/types/Filter.ts → dist/api/types/FilterInventory.ts} +1 -1
- package/dist/api/types/FilterPredicate.ts +48 -0
- package/{api/types/FilterPredicate.ts → dist/api/types/FilterPredicateInventory.ts} +3 -3
- package/{api → dist/api}/types/GeoBoundingBox.ts +1 -3
- package/{api → dist/api}/types/GeoBoundingBoxFilter.ts +1 -2
- package/{api → dist/api}/types/GeoDistance.ts +1 -3
- package/{api → dist/api}/types/GeoDistanceFilter.ts +1 -3
- package/{api → dist/api}/types/GeoPoint.ts +1 -2
- package/{api → dist/api}/types/Integration.ts +6 -0
- package/{api → dist/api}/types/MenderTypes.ts +41 -11
- package/{api → dist/api}/types/NewDeploymentV2.ts +3 -0
- package/{api → dist/api}/types/NewTenant.ts +16 -8
- package/{api → dist/api}/types/Object.ts +3 -0
- package/{api → dist/api}/types/PreAuthSet.ts +1 -1
- package/{api → dist/api}/types/Settings.ts +3 -3
- package/{api → dist/api}/types/Status.ts +5 -4
- package/{api → dist/api}/types/StatusTenantadm.ts +1 -3
- package/dist/api/types/Tenant.ts +21 -0
- package/{api → dist/api}/types/TenantTenantadm.ts +16 -0
- package/dist/api/types/UpdateChildTenant.ts +17 -0
- package/{api → dist/api}/types/UpdateDeployments.ts +1 -1
- package/{api → dist/api}/types/UpgradeCompleteRequest.ts +2 -0
- package/{api → dist/api}/types/UserWithTenantInfo.ts +7 -3
- package/dist/api/users-api.d.mts +16 -0
- package/dist/api/users-api.d.ts +16 -0
- package/dist/api/users-api.js +1026 -0
- package/dist/api/users-api.js.map +1 -0
- package/dist/api/users-api.mjs +15 -0
- package/dist/api/users-api.mjs.map +1 -0
- package/dist/appSlice/constants.d.mts +210 -0
- package/dist/appSlice/constants.d.ts +210 -0
- package/dist/appSlice/constants.js +221 -0
- package/dist/appSlice/constants.js.map +1 -0
- package/dist/appSlice/constants.mjs +42 -0
- package/dist/appSlice/constants.mjs.map +1 -0
- package/dist/appSlice/index.d.mts +1557 -0
- package/dist/appSlice/index.d.ts +1557 -0
- package/dist/appSlice/index.js +1067 -0
- package/dist/appSlice/index.js.map +1 -0
- package/dist/appSlice/index.mjs +21 -0
- package/dist/appSlice/index.mjs.map +1 -0
- package/dist/appSlice/selectors.d.mts +91 -0
- package/dist/appSlice/selectors.d.ts +91 -0
- package/dist/appSlice/selectors.js +90 -0
- package/dist/appSlice/selectors.js.map +1 -0
- package/dist/appSlice/selectors.mjs +20 -0
- package/dist/appSlice/selectors.mjs.map +1 -0
- package/dist/appSlice/thunks.d.mts +46 -0
- package/dist/appSlice/thunks.d.ts +46 -0
- package/dist/appSlice/thunks.js +5655 -0
- package/dist/appSlice/thunks.js.map +1 -0
- package/dist/appSlice/thunks.mjs +45 -0
- package/dist/appSlice/thunks.mjs.map +1 -0
- package/dist/auth.d.mts +17 -0
- package/dist/auth.d.ts +17 -0
- package/dist/auth.js +985 -0
- package/dist/auth.js.map +1 -0
- package/dist/auth.mjs +23 -0
- package/dist/auth.mjs.map +1 -0
- package/dist/chunk-6667TCAJ.mjs +135 -0
- package/dist/chunk-6667TCAJ.mjs.map +1 -0
- package/{releasesSlice/index.ts → dist/chunk-7E7KJHY3.mjs} +33 -32
- package/dist/chunk-7E7KJHY3.mjs.map +1 -0
- package/{usersSlice/index.ts → dist/chunk-BJSH2G7W.mjs} +39 -58
- package/dist/chunk-BJSH2G7W.mjs.map +1 -0
- package/dist/chunk-BOSBROA3.mjs +168 -0
- package/dist/chunk-BOSBROA3.mjs.map +1 -0
- package/dist/chunk-BRHSKNFC.mjs +70 -0
- package/dist/chunk-BRHSKNFC.mjs.map +1 -0
- package/dist/chunk-C2YZYTJ6.mjs +37 -0
- package/dist/chunk-C2YZYTJ6.mjs.map +1 -0
- package/dist/chunk-DZBVTSIX.mjs +55 -0
- package/dist/chunk-DZBVTSIX.mjs.map +1 -0
- package/{appSlice/index.ts → dist/chunk-F37LUTBX.mjs} +58 -68
- package/dist/chunk-F37LUTBX.mjs.map +1 -0
- package/dist/chunk-G32LAKW4.mjs +239 -0
- package/dist/chunk-G32LAKW4.mjs.map +1 -0
- package/dist/chunk-G3I53JGW.mjs +243 -0
- package/dist/chunk-G3I53JGW.mjs.map +1 -0
- package/dist/chunk-G4FGNSV3.mjs +13 -0
- package/dist/chunk-G4FGNSV3.mjs.map +1 -0
- package/dist/chunk-G7LATUT6.mjs +110 -0
- package/dist/chunk-G7LATUT6.mjs.map +1 -0
- package/dist/chunk-H2PQQMRY.mjs +7 -0
- package/dist/chunk-H2PQQMRY.mjs.map +1 -0
- package/{devicesSlice/index.ts → dist/chunk-HRWZJQMH.mjs} +57 -77
- package/dist/chunk-HRWZJQMH.mjs.map +1 -0
- package/dist/chunk-HVHZG2H4.mjs +56 -0
- package/dist/chunk-HVHZG2H4.mjs.map +1 -0
- package/dist/chunk-HXPYJ6QN.mjs +75 -0
- package/dist/chunk-HXPYJ6QN.mjs.map +1 -0
- package/dist/chunk-IPPIKGIB.mjs +35 -0
- package/dist/chunk-IPPIKGIB.mjs.map +1 -0
- package/dist/chunk-IU4OXOPA.mjs +46 -0
- package/dist/chunk-IU4OXOPA.mjs.map +1 -0
- package/dist/chunk-IVSYYXTC.mjs +36 -0
- package/dist/chunk-IVSYYXTC.mjs.map +1 -0
- package/{onboardingSlice/index.ts → dist/chunk-M4U5R7A4.mjs} +19 -22
- package/dist/chunk-M4U5R7A4.mjs.map +1 -0
- package/dist/chunk-N7G6QK2E.mjs +414 -0
- package/dist/chunk-N7G6QK2E.mjs.map +1 -0
- package/dist/chunk-O6O3D52B.mjs +39 -0
- package/dist/chunk-O6O3D52B.mjs.map +1 -0
- package/dist/chunk-QBKCUIWO.mjs +7 -0
- package/dist/chunk-QBKCUIWO.mjs.map +1 -0
- package/dist/chunk-R2GBNXLV.mjs +57 -0
- package/dist/chunk-R2GBNXLV.mjs.map +1 -0
- package/dist/chunk-RH6ONMG7.mjs +65 -0
- package/dist/chunk-RH6ONMG7.mjs.map +1 -0
- package/dist/chunk-RQOE5OOT.mjs +284 -0
- package/dist/chunk-RQOE5OOT.mjs.map +1 -0
- package/dist/chunk-TD45YTYK.mjs +108 -0
- package/dist/chunk-TD45YTYK.mjs.map +1 -0
- package/dist/chunk-V32GTKOS.mjs +1 -0
- package/dist/chunk-V32GTKOS.mjs.map +1 -0
- package/dist/chunk-XWBD7VOK.mjs +93 -0
- package/dist/chunk-XWBD7VOK.mjs.map +1 -0
- package/dist/chunk-XYVPYFSM.mjs +106 -0
- package/dist/chunk-XYVPYFSM.mjs.map +1 -0
- package/dist/chunk-YNVSU3AA.mjs +2977 -0
- package/dist/chunk-YNVSU3AA.mjs.map +1 -0
- package/dist/chunk-ZIYGEXSJ.mjs +145 -0
- package/dist/chunk-ZIYGEXSJ.mjs.map +1 -0
- package/dist/chunk-ZNST5R6O.mjs +658 -0
- package/dist/chunk-ZNST5R6O.mjs.map +1 -0
- package/dist/commonConstants.d.mts +248 -0
- package/dist/commonConstants.d.ts +248 -0
- package/dist/commonConstants.js +303 -0
- package/dist/commonConstants.js.map +1 -0
- package/dist/commonConstants.mjs +40 -0
- package/dist/commonConstants.mjs.map +1 -0
- package/dist/commonSelectors.d.mts +896 -0
- package/dist/commonSelectors.d.ts +896 -0
- package/dist/commonSelectors.js +1482 -0
- package/dist/commonSelectors.js.map +1 -0
- package/dist/commonSelectors.mjs +54 -0
- package/dist/commonSelectors.mjs.map +1 -0
- package/dist/constants.d.mts +12 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +1246 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +219 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/deploymentsSlice/constants.d.mts +142 -0
- package/dist/deploymentsSlice/constants.d.ts +142 -0
- package/dist/deploymentsSlice/constants.js +969 -0
- package/dist/deploymentsSlice/constants.js.map +1 -0
- package/dist/deploymentsSlice/constants.mjs +42 -0
- package/dist/deploymentsSlice/constants.mjs.map +1 -0
- package/dist/deploymentsSlice/index.d.mts +2373 -0
- package/dist/deploymentsSlice/index.d.ts +2373 -0
- package/dist/deploymentsSlice/index.js +1053 -0
- package/dist/deploymentsSlice/index.js.map +1 -0
- package/dist/deploymentsSlice/index.mjs +21 -0
- package/dist/deploymentsSlice/index.mjs.map +1 -0
- package/dist/deploymentsSlice/selectors.d.mts +59 -0
- package/dist/deploymentsSlice/selectors.d.ts +59 -0
- package/dist/deploymentsSlice/selectors.js +969 -0
- package/dist/deploymentsSlice/selectors.js.map +1 -0
- package/dist/deploymentsSlice/selectors.mjs +25 -0
- package/dist/deploymentsSlice/selectors.mjs.map +1 -0
- package/dist/deploymentsSlice/thunks.d.mts +202 -0
- package/dist/deploymentsSlice/thunks.d.ts +202 -0
- package/dist/deploymentsSlice/thunks.js +5671 -0
- package/dist/deploymentsSlice/thunks.js.map +1 -0
- package/dist/deploymentsSlice/thunks.mjs +63 -0
- package/dist/deploymentsSlice/thunks.mjs.map +1 -0
- package/dist/devicesSlice/constants.d.mts +44 -0
- package/dist/devicesSlice/constants.d.ts +44 -0
- package/dist/devicesSlice/constants.js +969 -0
- package/dist/devicesSlice/constants.js.map +1 -0
- package/dist/devicesSlice/constants.mjs +40 -0
- package/dist/devicesSlice/constants.mjs.map +1 -0
- package/dist/devicesSlice/index.d.mts +2223 -0
- package/dist/devicesSlice/index.d.ts +2223 -0
- package/dist/devicesSlice/index.js +1109 -0
- package/dist/devicesSlice/index.js.map +1 -0
- package/dist/devicesSlice/index.mjs +21 -0
- package/dist/devicesSlice/index.mjs.map +1 -0
- package/dist/devicesSlice/selectors.d.mts +261 -0
- package/dist/devicesSlice/selectors.d.ts +261 -0
- package/dist/devicesSlice/selectors.js +1084 -0
- package/dist/devicesSlice/selectors.js.map +1 -0
- package/dist/devicesSlice/selectors.mjs +53 -0
- package/dist/devicesSlice/selectors.mjs.map +1 -0
- package/dist/devicesSlice/thunks.d.mts +742 -0
- package/dist/devicesSlice/thunks.d.ts +742 -0
- package/dist/devicesSlice/thunks.js +5743 -0
- package/dist/devicesSlice/thunks.js.map +1 -0
- package/dist/devicesSlice/thunks.mjs +135 -0
- package/dist/devicesSlice/thunks.mjs.map +1 -0
- package/dist/monitorSlice/constants.d.mts +6 -0
- package/dist/monitorSlice/constants.d.ts +6 -0
- package/dist/monitorSlice/constants.js +919 -0
- package/dist/monitorSlice/constants.js.map +1 -0
- package/dist/monitorSlice/constants.mjs +14 -0
- package/dist/monitorSlice/constants.mjs.map +1 -0
- package/dist/monitorSlice/index.d.mts +291 -0
- package/dist/monitorSlice/index.d.ts +291 -0
- package/dist/monitorSlice/index.js +971 -0
- package/dist/monitorSlice/index.js.map +1 -0
- package/dist/monitorSlice/index.mjs +21 -0
- package/dist/monitorSlice/index.mjs.map +1 -0
- package/dist/monitorSlice/selectors.d.mts +3 -0
- package/dist/monitorSlice/selectors.d.ts +3 -0
- package/dist/monitorSlice/selectors.js +31 -0
- package/dist/monitorSlice/selectors.js.map +1 -0
- package/dist/monitorSlice/selectors.mjs +8 -0
- package/dist/monitorSlice/selectors.mjs.map +1 -0
- package/dist/monitorSlice/thunks.d.mts +71 -0
- package/dist/monitorSlice/thunks.d.ts +71 -0
- package/dist/monitorSlice/thunks.js +2531 -0
- package/dist/monitorSlice/thunks.js.map +1 -0
- package/dist/monitorSlice/thunks.mjs +44 -0
- package/dist/monitorSlice/thunks.mjs.map +1 -0
- package/dist/onboardingSlice/constants.d.mts +23 -0
- package/dist/onboardingSlice/constants.d.ts +23 -0
- package/dist/onboardingSlice/constants.js +71 -0
- package/dist/onboardingSlice/constants.js.map +1 -0
- package/dist/onboardingSlice/constants.mjs +10 -0
- package/dist/onboardingSlice/constants.mjs.map +1 -0
- package/dist/onboardingSlice/index.d.mts +237 -0
- package/dist/onboardingSlice/index.d.ts +237 -0
- package/dist/onboardingSlice/index.js +94 -0
- package/dist/onboardingSlice/index.js.map +1 -0
- package/dist/onboardingSlice/index.mjs +16 -0
- package/dist/onboardingSlice/index.mjs.map +1 -0
- package/dist/onboardingSlice/selectors.d.mts +3 -0
- package/dist/onboardingSlice/selectors.d.ts +3 -0
- package/dist/onboardingSlice/selectors.js +31 -0
- package/dist/onboardingSlice/selectors.js.map +1 -0
- package/dist/onboardingSlice/selectors.mjs +8 -0
- package/dist/onboardingSlice/selectors.mjs.map +1 -0
- package/dist/onboardingSlice/thunks.d.mts +172 -0
- package/dist/onboardingSlice/thunks.d.ts +172 -0
- package/dist/onboardingSlice/thunks.js +5661 -0
- package/dist/onboardingSlice/thunks.js.map +1 -0
- package/dist/onboardingSlice/thunks.mjs +51 -0
- package/dist/onboardingSlice/thunks.mjs.map +1 -0
- package/dist/organizationSlice/constants.d.mts +134 -0
- package/dist/organizationSlice/constants.d.ts +134 -0
- package/dist/organizationSlice/constants.js +978 -0
- package/dist/organizationSlice/constants.js.map +1 -0
- package/dist/organizationSlice/constants.mjs +34 -0
- package/dist/organizationSlice/constants.mjs.map +1 -0
- package/dist/organizationSlice/index.d.mts +1097 -0
- package/dist/organizationSlice/index.d.ts +1097 -0
- package/dist/organizationSlice/index.js +1015 -0
- package/dist/organizationSlice/index.js.map +1 -0
- package/dist/organizationSlice/index.mjs +21 -0
- package/dist/organizationSlice/index.mjs.map +1 -0
- package/dist/organizationSlice/selectors.d.mts +134 -0
- package/dist/organizationSlice/selectors.d.ts +134 -0
- package/dist/organizationSlice/selectors.js +977 -0
- package/dist/organizationSlice/selectors.js.map +1 -0
- package/dist/organizationSlice/selectors.mjs +39 -0
- package/dist/organizationSlice/selectors.mjs.map +1 -0
- package/dist/organizationSlice/thunks.d.mts +502 -0
- package/dist/organizationSlice/thunks.d.ts +502 -0
- package/dist/organizationSlice/thunks.js +5709 -0
- package/dist/organizationSlice/thunks.js.map +1 -0
- package/dist/organizationSlice/thunks.mjs +101 -0
- package/dist/organizationSlice/thunks.mjs.map +1 -0
- package/dist/releasesSlice/constants.d.mts +14 -0
- package/dist/releasesSlice/constants.d.ts +14 -0
- package/dist/releasesSlice/constants.js +40 -0
- package/dist/releasesSlice/constants.js.map +1 -0
- package/dist/releasesSlice/constants.mjs +14 -0
- package/dist/releasesSlice/constants.mjs.map +1 -0
- package/dist/releasesSlice/index.d.mts +483 -0
- package/dist/releasesSlice/index.d.ts +483 -0
- package/dist/releasesSlice/index.js +1034 -0
- package/dist/releasesSlice/index.js.map +1 -0
- package/dist/releasesSlice/index.mjs +21 -0
- package/dist/releasesSlice/index.mjs.map +1 -0
- package/dist/releasesSlice/selectors.d.mts +92 -0
- package/dist/releasesSlice/selectors.d.ts +92 -0
- package/dist/releasesSlice/selectors.js +967 -0
- package/dist/releasesSlice/selectors.js.map +1 -0
- package/dist/releasesSlice/selectors.mjs +28 -0
- package/dist/releasesSlice/selectors.mjs.map +1 -0
- package/dist/releasesSlice/thunks.d.mts +276 -0
- package/dist/releasesSlice/thunks.d.ts +276 -0
- package/dist/releasesSlice/thunks.js +2843 -0
- package/dist/releasesSlice/thunks.js.map +1 -0
- package/dist/releasesSlice/thunks.mjs +66 -0
- package/dist/releasesSlice/thunks.mjs.map +1 -0
- package/dist/selectors.d.mts +10 -0
- package/dist/selectors.d.ts +10 -0
- package/dist/selectors.js +1636 -0
- package/dist/selectors.js.map +1 -0
- package/dist/selectors.mjs +207 -0
- package/dist/selectors.mjs.map +1 -0
- package/dist/store.d.mts +2306 -0
- package/dist/store.d.ts +2306 -0
- package/dist/store.js +1877 -0
- package/dist/store.js.map +1 -0
- package/dist/store.mjs +32 -0
- package/dist/store.mjs.map +1 -0
- package/dist/storehooks.d.mts +4 -0
- package/dist/storehooks.d.ts +4 -0
- package/dist/storehooks.js +5844 -0
- package/dist/storehooks.js.map +1 -0
- package/dist/storehooks.mjs +265 -0
- package/dist/storehooks.mjs.map +1 -0
- package/dist/thunks.d.mts +12 -0
- package/dist/thunks.d.ts +12 -0
- package/dist/thunks.js +5973 -0
- package/dist/thunks.js.map +1 -0
- package/dist/thunks.mjs +363 -0
- package/dist/thunks.mjs.map +1 -0
- package/dist/usersSlice/constants.d.mts +635 -0
- package/dist/usersSlice/constants.d.ts +635 -0
- package/dist/usersSlice/constants.js +967 -0
- package/dist/usersSlice/constants.js.map +1 -0
- package/dist/usersSlice/constants.mjs +43 -0
- package/dist/usersSlice/constants.mjs.map +1 -0
- package/dist/usersSlice/index.d.mts +6993 -0
- package/dist/usersSlice/index.d.ts +6993 -0
- package/dist/usersSlice/index.js +1054 -0
- package/dist/usersSlice/index.js.map +1 -0
- package/dist/usersSlice/index.mjs +21 -0
- package/dist/usersSlice/index.mjs.map +1 -0
- package/dist/usersSlice/selectors.d.mts +209 -0
- package/dist/usersSlice/selectors.d.ts +209 -0
- package/dist/usersSlice/selectors.js +997 -0
- package/dist/usersSlice/selectors.js.map +1 -0
- package/dist/usersSlice/selectors.mjs +38 -0
- package/dist/usersSlice/selectors.mjs.map +1 -0
- package/dist/usersSlice/thunks.d.mts +881 -0
- package/dist/usersSlice/thunks.d.ts +881 -0
- package/dist/usersSlice/thunks.js +5717 -0
- package/dist/usersSlice/thunks.js.map +1 -0
- package/dist/usersSlice/thunks.mjs +109 -0
- package/dist/usersSlice/thunks.mjs.map +1 -0
- package/dist/utils.d.mts +60 -0
- package/dist/utils.d.ts +60 -0
- package/dist/utils.js +1160 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +49 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +22 -5
- package/.eslintrc.cjs +0 -9
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -19
- package/actions.ts +0 -32
- package/api/general-api.test.ts +0 -51
- package/api/general-api.ts +0 -60
- package/api/types/Deployment.ts +0 -95
- package/api/types/DeviceDeployments.ts +0 -31
- package/api/types/FilterPredicateInventory.ts +0 -76
- package/api/types/Tenant.ts +0 -38
- package/api/users-api.ts +0 -34
- package/appSlice/constants.ts +0 -166
- package/appSlice/reducer.test.ts +0 -97
- package/appSlice/selectors.ts +0 -33
- package/appSlice/thunks.test.ts +0 -118
- package/appSlice/thunks.ts +0 -148
- package/auth.test.ts +0 -36
- package/auth.ts +0 -82
- package/commonConstants.tsx +0 -252
- package/commonSelectors.ts +0 -255
- package/constants.ts +0 -22
- package/deploymentsSlice/constants.ts +0 -175
- package/deploymentsSlice/index.ts +0 -145
- package/deploymentsSlice/reducer.test.ts +0 -108
- package/deploymentsSlice/selectors.ts +0 -58
- package/deploymentsSlice/thunks.test.ts +0 -425
- package/deploymentsSlice/thunks.ts +0 -382
- package/devicesSlice/constants.ts +0 -56
- package/devicesSlice/reducer.test.ts +0 -194
- package/devicesSlice/selectors.ts +0 -127
- package/devicesSlice/thunks.test.tsx +0 -1245
- package/devicesSlice/thunks.tsx +0 -1098
- package/monitorSlice/constants.ts +0 -17
- package/monitorSlice/index.ts +0 -65
- package/monitorSlice/reducer.test.ts +0 -79
- package/monitorSlice/selectors.ts +0 -15
- package/monitorSlice/thunks.test.ts +0 -112
- package/monitorSlice/thunks.ts +0 -101
- package/onboardingSlice/constants.ts +0 -53
- package/onboardingSlice/reducer.test.ts +0 -45
- package/onboardingSlice/selectors.ts +0 -15
- package/onboardingSlice/thunks.test.ts +0 -235
- package/onboardingSlice/thunks.ts +0 -142
- package/organizationSlice/constants.ts +0 -82
- package/organizationSlice/index.ts +0 -111
- package/organizationSlice/reducer.test.ts +0 -78
- package/organizationSlice/selectors.ts +0 -45
- package/organizationSlice/thunks.test.ts +0 -619
- package/organizationSlice/thunks.ts +0 -383
- package/releasesSlice/constants.ts +0 -18
- package/releasesSlice/reducer.test.ts +0 -78
- package/releasesSlice/selectors.ts +0 -33
- package/releasesSlice/thunks.test.ts +0 -389
- package/releasesSlice/thunks.ts +0 -379
- package/selectors.ts +0 -22
- package/store.ts +0 -89
- package/storehooks.test.tsx +0 -386
- package/storehooks.ts +0 -250
- package/thunks.ts +0 -21
- package/tsconfig.json +0 -11
- package/tsup.config.ts +0 -11
- package/usersSlice/constants.ts +0 -374
- package/usersSlice/reducer.test.ts +0 -141
- package/usersSlice/selectors.ts +0 -60
- package/usersSlice/thunks.test.ts +0 -660
- package/usersSlice/thunks.ts +0 -773
- package/utils.test.ts +0 -187
- package/utils.ts +0 -249
- /package/{api → dist/api}/types/AWSCredentials.ts +0 -0
- /package/{api → dist/api}/types/Actor.ts +0 -0
- /package/{api → dist/api}/types/Addon.ts +0 -0
- /package/{api → dist/api}/types/AddonTenantadm.ts +0 -0
- /package/{api → dist/api}/types/Alert.ts +0 -0
- /package/{api → dist/api}/types/AlertDetails.ts +0 -0
- /package/{api → dist/api}/types/AlertSubject.ts +0 -0
- /package/{api → dist/api}/types/ApiBurst.ts +0 -0
- /package/{api → dist/api}/types/ApiBurstTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ApiLimits.ts +0 -0
- /package/{api → dist/api}/types/ApiLimitsTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ApiQuota.ts +0 -0
- /package/{api → dist/api}/types/ApiQuotaTenantadm.ts +0 -0
- /package/{api → dist/api}/types/Artifact.ts +0 -0
- /package/{api → dist/api}/types/ArtifactDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactInfo.ts +0 -0
- /package/{api → dist/api}/types/ArtifactInfoDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactLink.ts +0 -0
- /package/{api → dist/api}/types/ArtifactTypeInfo.ts +0 -0
- /package/{api → dist/api}/types/ArtifactTypeInfoDeployments.ts +0 -0
- /package/{api → dist/api}/types/ArtifactUpdate.ts +0 -0
- /package/{api → dist/api}/types/ArtifactUploadLink.ts +0 -0
- /package/{api → dist/api}/types/Attribute.ts +0 -0
- /package/{api → dist/api}/types/AttributeInventory.ts +0 -0
- /package/{api → dist/api}/types/AuditLog.ts +0 -0
- /package/{api → dist/api}/types/AuthSetDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/AutoAuthRequest.ts +0 -0
- /package/{api → dist/api}/types/AzureSharedAccessSecret.ts +0 -0
- /package/{api → dist/api}/types/BillingInfo.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaConfiguration.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaConfigurationDeployments.ts +0 -0
- /package/{api → dist/api}/types/BinaryDeltaLimitsDeployments.ts +0 -0
- /package/{api → dist/api}/types/CancelRequest.ts +0 -0
- /package/{api → dist/api}/types/CardData.ts +0 -0
- /package/{api → dist/api}/types/CardSetupData.ts +0 -0
- /package/{api → dist/api}/types/CheckoutData.ts +0 -0
- /package/{api → dist/api}/types/Configuration.ts +0 -0
- /package/{api → dist/api}/types/Count.ts +0 -0
- /package/{api → dist/api}/types/Credentials.ts +0 -0
- /package/{api → dist/api}/types/DBusSubsystem.ts +0 -0
- /package/{api → dist/api}/types/DeltaConfiguration.ts +0 -0
- /package/{api → dist/api}/types/DeltaConfigurationDeployments.ts +0 -0
- /package/{api → dist/api}/types/DeploymentAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/DeploymentIdentifier.ts +0 -0
- /package/{api → dist/api}/types/DeploymentPhase.ts +0 -0
- /package/{api → dist/api}/types/DeploymentReporting.ts +0 -0
- /package/{api → dist/api}/types/DeploymentStatistics.ts +0 -0
- /package/{api → dist/api}/types/DeploymentStatusStatistics.ts +0 -0
- /package/{api → dist/api}/types/DeviceAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/DeviceAuthEvent.ts +0 -0
- /package/{api → dist/api}/types/DeviceConfiguration.ts +0 -0
- /package/{api → dist/api}/types/DeviceDeployment.ts +0 -0
- /package/{api → dist/api}/types/DeviceDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/DeviceInventory.ts +0 -0
- /package/{api → dist/api}/types/DeviceInventoryInventory.ts +0 -0
- /package/{api → dist/api}/types/DeviceReporting.ts +0 -0
- /package/{api → dist/api}/types/DeviceState.ts +0 -0
- /package/{api → dist/api}/types/DeviceStateDeviceconnect.ts +0 -0
- /package/{api → dist/api}/types/DeviceStateIot_manager.ts +0 -0
- /package/{api → dist/api}/types/DeviceStatus.ts +0 -0
- /package/{api → dist/api}/types/DeviceWithImage.ts +0 -0
- /package/{api → dist/api}/types/DirectUploadMetadata.ts +0 -0
- /package/{api → dist/api}/types/EmailVerificationCompletion.ts +0 -0
- /package/{api → dist/api}/types/EmailVerificationRequest.ts +0 -0
- /package/{api → dist/api}/types/ErrorAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeployments.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceconfig.ts +0 -0
- /package/{api → dist/api}/types/ErrorDeviceconnect.ts +0 -0
- /package/{api → dist/api}/types/ErrorDevicemonitor.ts +0 -0
- /package/{api → dist/api}/types/ErrorExt.ts +0 -0
- /package/{api → dist/api}/types/ErrorInventory.ts +0 -0
- /package/{api → dist/api}/types/ErrorIot_manager.ts +0 -0
- /package/{api → dist/api}/types/ErrorNotFound.ts +0 -0
- /package/{api → dist/api}/types/ErrorReporting.ts +0 -0
- /package/{api → dist/api}/types/ErrorTenantadm.ts +0 -0
- /package/{api → dist/api}/types/ErrorUseradm.ts +0 -0
- /package/{api → dist/api}/types/Event.ts +0 -0
- /package/{api → dist/api}/types/ExternalIdentity.ts +0 -0
- /package/{api → dist/api}/types/Features.ts +0 -0
- /package/{api → dist/api}/types/FileUpload.ts +0 -0
- /package/{api → dist/api}/types/FilterAttribute.ts +0 -0
- /package/{api → dist/api}/types/FilterDefinition.ts +0 -0
- /package/{api → dist/api}/types/FilterDeployments.ts +0 -0
- /package/{api → dist/api}/types/FilterPredicateDeployments.ts +0 -0
- /package/{api → dist/api}/types/Group.ts +0 -0
- /package/{api → dist/api}/types/HTTP.ts +0 -0
- /package/{api → dist/api}/types/IdentityData.ts +0 -0
- /package/{api → dist/api}/types/InputParameter.ts +0 -0
- /package/{api → dist/api}/types/JobStatus.ts +0 -0
- /package/{api → dist/api}/types/Limit.ts +0 -0
- /package/{api → dist/api}/types/LimitDeployments.ts +0 -0
- /package/{api → dist/api}/types/LimitDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/LimitUseradm.ts +0 -0
- /package/{api → dist/api}/types/Limits.ts +0 -0
- /package/{api → dist/api}/types/LineDescriptor.ts +0 -0
- /package/{api → dist/api}/types/LogSubsystem.ts +0 -0
- /package/{api → dist/api}/types/LoginOptions.ts +0 -0
- /package/{api → dist/api}/types/ManagementAPIConfiguration.ts +0 -0
- /package/{api → dist/api}/types/MonitorConfiguration.ts +0 -0
- /package/{api → dist/api}/types/NewConfigurationDeployment.ts +0 -0
- /package/{api → dist/api}/types/NewConfigurationDeploymentResponse.ts +0 -0
- /package/{api → dist/api}/types/NewDeployment.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentForGroup.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentPhase.ts +0 -0
- /package/{api → dist/api}/types/NewDeploymentPhaseDeployments.ts +0 -0
- /package/{api → dist/api}/types/OwnUserUpdate.ts +0 -0
- /package/{api → dist/api}/types/PasswordResetCompletion.ts +0 -0
- /package/{api → dist/api}/types/PasswordResetRequest.ts +0 -0
- /package/{api → dist/api}/types/Permission.ts +0 -0
- /package/{api → dist/api}/types/PermissionObject.ts +0 -0
- /package/{api → dist/api}/types/PermissionSet.ts +0 -0
- /package/{api → dist/api}/types/PermissionSetWithScope.ts +0 -0
- /package/{api → dist/api}/types/PersonalAccessToken.ts +0 -0
- /package/{api → dist/api}/types/PersonalAccessTokenRequest.ts +0 -0
- /package/{api → dist/api}/types/Plan.ts +0 -0
- /package/{api → dist/api}/types/PlanBindingDetails.ts +0 -0
- /package/{api → dist/api}/types/PlanChangeRequest.ts +0 -0
- /package/{api → dist/api}/types/PlanLimits.ts +0 -0
- /package/{api → dist/api}/types/Release.ts +0 -0
- /package/{api → dist/api}/types/ReleaseDeployments.ts +0 -0
- /package/{api → dist/api}/types/ReleaseUpdate.ts +0 -0
- /package/{api → dist/api}/types/Releases.ts +0 -0
- /package/{api → dist/api}/types/ReleasesDeleteError.ts +0 -0
- /package/{api → dist/api}/types/ReleasesDeployments.ts +0 -0
- /package/{api → dist/api}/types/Role.ts +0 -0
- /package/{api → dist/api}/types/RolePermission.ts +0 -0
- /package/{api → dist/api}/types/RolePermissionObject.ts +0 -0
- /package/{api → dist/api}/types/RoleUseradm.ts +0 -0
- /package/{api → dist/api}/types/SAMLMetadata.ts +0 -0
- /package/{api → dist/api}/types/Scope.ts +0 -0
- /package/{api → dist/api}/types/SelectAttribute.ts +0 -0
- /package/{api → dist/api}/types/ServiceSubsystem.ts +0 -0
- /package/{api → dist/api}/types/SortCriteria.ts +0 -0
- /package/{api → dist/api}/types/SsoObject.ts +0 -0
- /package/{api → dist/api}/types/StatusDeviceauth.ts +0 -0
- /package/{api → dist/api}/types/StorageLimit.ts +0 -0
- /package/{api → dist/api}/types/SubscriptionData.ts +0 -0
- /package/{api → dist/api}/types/SupportRequest.ts +0 -0
- /package/{api → dist/api}/types/Tag.ts +0 -0
- /package/{api → dist/api}/types/Tags.ts +0 -0
- /package/{api → dist/api}/types/TaskResult.ts +0 -0
- /package/{api → dist/api}/types/TaskResultCLI.ts +0 -0
- /package/{api → dist/api}/types/TaskResultHTTPRequest.ts +0 -0
- /package/{api → dist/api}/types/TaskResultHTTPResponse.ts +0 -0
- /package/{api → dist/api}/types/TenantApiLimits.ts +0 -0
- /package/{api → dist/api}/types/TenantApiLimitsTenantadm.ts +0 -0
- /package/{api → dist/api}/types/TenantIdName.ts +0 -0
- /package/{api → dist/api}/types/TenantIdsData.ts +0 -0
- /package/{api → dist/api}/types/TenantInfo.ts +0 -0
- /package/{api → dist/api}/types/TenantShortInfo.ts +0 -0
- /package/{api → dist/api}/types/TenantsIdName.ts +0 -0
- /package/{api → dist/api}/types/Update.ts +0 -0
- /package/{api → dist/api}/types/UpdateFile.ts +0 -0
- /package/{api → dist/api}/types/UpdateFileDeployments.ts +0 -0
- /package/{api → dist/api}/types/UpdateTypes.ts +0 -0
- /package/{api → dist/api}/types/User.ts +0 -0
- /package/{api → dist/api}/types/UserAuditlogs.ts +0 -0
- /package/{api → dist/api}/types/UserNew.ts +0 -0
- /package/{api → dist/api}/types/UserUpdate.ts +0 -0
- /package/{api → dist/api}/types/UserUseradm.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgs.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsDeployments.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsLimits.ts +0 -0
- /package/{api → dist/api}/types/XDeltaArgsLimitsDeployments.ts +0 -0
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Northern.tech AS
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
// @ts-nocheck
|
|
15
|
-
|
|
16
|
-
/*eslint import/namespace: ['error', { allowComputed: true }]*/
|
|
17
|
-
import storeActions from '@northern.tech/store/actions';
|
|
18
|
-
import GeneralApi from '@northern.tech/store/api/general-api';
|
|
19
|
-
import { DEVICE_LIST_DEFAULTS, SORTING_OPTIONS, TIMEOUTS, headerNames } from '@northern.tech/store/constants';
|
|
20
|
-
import { getDevicesById, getGlobalSettings, getUserCapabilities } from '@northern.tech/store/selectors';
|
|
21
|
-
import { commonErrorHandler } from '@northern.tech/store/store';
|
|
22
|
-
import { getDeviceAuth, getDeviceById, saveGlobalSettings } from '@northern.tech/store/thunks';
|
|
23
|
-
import { mapTermsToFilters } from '@northern.tech/store/utils';
|
|
24
|
-
import { deepCompare, isEmpty, standardizePhases, startTimeSort } from '@northern.tech/utils/helpers';
|
|
25
|
-
import { createAsyncThunk } from '@reduxjs/toolkit';
|
|
26
|
-
import isUUID from 'validator/lib/isUUID';
|
|
27
|
-
|
|
28
|
-
import { actions, sliceName } from '.';
|
|
29
|
-
import { DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, deploymentPrototype, deploymentsApiUrl, deploymentsApiUrlV2 } from './constants';
|
|
30
|
-
import { getDeploymentsById, getDeploymentsByStatus as getDeploymentsByStatusSelector } from './selectors';
|
|
31
|
-
|
|
32
|
-
const { receivedDevice, setSnackbar } = storeActions;
|
|
33
|
-
|
|
34
|
-
// default per page until pagination and counting integrated
|
|
35
|
-
const { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
36
|
-
|
|
37
|
-
export const deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => (group || (groups.length === 1 && !isUUID(name)) ? groups[0] : filter.name);
|
|
38
|
-
|
|
39
|
-
const transformDeployments = (deployments, deploymentsById) =>
|
|
40
|
-
deployments.sort(startTimeSort).reduce(
|
|
41
|
-
(accu, item) => {
|
|
42
|
-
const filter = item.filter ?? {};
|
|
43
|
-
let deployment = {
|
|
44
|
-
...deploymentPrototype,
|
|
45
|
-
...deploymentsById[item.id],
|
|
46
|
-
...item,
|
|
47
|
-
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : undefined,
|
|
48
|
-
name: decodeURIComponent(item.name)
|
|
49
|
-
};
|
|
50
|
-
// deriving the group in a second step to potentially make use of the merged data from the existing group state + the decoded name
|
|
51
|
-
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
52
|
-
accu.deployments[item.id] = deployment;
|
|
53
|
-
accu.deploymentIds.push(item.id);
|
|
54
|
-
return accu;
|
|
55
|
-
},
|
|
56
|
-
{ deployments: {}, deploymentIds: [] }
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
/*Deployments */
|
|
60
|
-
export const getDeploymentsByStatus = createAsyncThunk(`${sliceName}/getDeploymentsByStatus`, (options = {}, { dispatch, getState }) => {
|
|
61
|
-
const { status, page = defaultPage, per_page = defaultPerPage, startDate, endDate, group, type, shouldSelect = true, sort = SORTING_OPTIONS.desc } = options;
|
|
62
|
-
const created_after = startDate ? `&created_after=${startDate}` : '';
|
|
63
|
-
const created_before = endDate ? `&created_before=${endDate}` : '';
|
|
64
|
-
const search = group ? `&search=${group}` : '';
|
|
65
|
-
const typeFilter = type ? `&type=${type}` : '';
|
|
66
|
-
return GeneralApi.get(
|
|
67
|
-
`${deploymentsApiUrl}/deployments?status=${status}&per_page=${per_page}&page=${page}${created_after}${created_before}${search}${typeFilter}&sort=${sort}`
|
|
68
|
-
).then(res => {
|
|
69
|
-
const { deployments, deploymentIds } = transformDeployments(res.data, getState().deployments.byId);
|
|
70
|
-
const total = Number(res.headers[headerNames.total]);
|
|
71
|
-
let tasks = [
|
|
72
|
-
dispatch(actions.receivedDeployments(deployments)),
|
|
73
|
-
dispatch(
|
|
74
|
-
actions.receivedDeploymentsForStatus({
|
|
75
|
-
deploymentIds,
|
|
76
|
-
status,
|
|
77
|
-
total: !(startDate || endDate || group || type) ? total : getState().deployments.byStatus[status].total
|
|
78
|
-
})
|
|
79
|
-
)
|
|
80
|
-
];
|
|
81
|
-
tasks = deploymentIds.reduce((accu, deploymentId) => {
|
|
82
|
-
if (deployments[deploymentId].type === DEPLOYMENT_TYPES.configuration) {
|
|
83
|
-
accu.push(dispatch(getSingleDeployment(deploymentId)));
|
|
84
|
-
}
|
|
85
|
-
return accu;
|
|
86
|
-
}, tasks);
|
|
87
|
-
if (shouldSelect) {
|
|
88
|
-
tasks.push(dispatch(actions.selectDeploymentsForStatus({ deploymentIds, status, total })));
|
|
89
|
-
}
|
|
90
|
-
tasks.push({ deploymentIds, total });
|
|
91
|
-
return Promise.all(tasks);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const MAX_PREVIOUS_PHASES_COUNT = 5;
|
|
96
|
-
export const createDeployment = createAsyncThunk(`${sliceName}/createDeployment`, ({ newDeployment, hasNewRetryDefault = false }, { dispatch, getState }) => {
|
|
97
|
-
let request;
|
|
98
|
-
if (newDeployment.filter_id) {
|
|
99
|
-
request = GeneralApi.post(`${deploymentsApiUrlV2}/deployments`, newDeployment);
|
|
100
|
-
} else if (newDeployment.group) {
|
|
101
|
-
request = GeneralApi.post(`${deploymentsApiUrl}/deployments/group/${newDeployment.group}`, newDeployment);
|
|
102
|
-
} else {
|
|
103
|
-
request = GeneralApi.post(`${deploymentsApiUrl}/deployments`, newDeployment);
|
|
104
|
-
}
|
|
105
|
-
return request
|
|
106
|
-
.catch(err => commonErrorHandler(err, 'Error creating deployment.', dispatch))
|
|
107
|
-
.then(data => {
|
|
108
|
-
const lastslashindex = data.headers.location.lastIndexOf('/');
|
|
109
|
-
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
110
|
-
const deployment = {
|
|
111
|
-
...newDeployment,
|
|
112
|
-
id: deploymentId,
|
|
113
|
-
devices: newDeployment.devices ? newDeployment.devices.map(id => ({ id, status: 'pending' })) : [],
|
|
114
|
-
statistics: { status: {} }
|
|
115
|
-
};
|
|
116
|
-
let tasks = [
|
|
117
|
-
dispatch(actions.createdDeployment(deployment)),
|
|
118
|
-
dispatch(getSingleDeployment(deploymentId)),
|
|
119
|
-
dispatch(setSnackbar('Deployment created successfully', TIMEOUTS.fiveSeconds))
|
|
120
|
-
];
|
|
121
|
-
const { canManageUsers } = getUserCapabilities(getState());
|
|
122
|
-
if (canManageUsers) {
|
|
123
|
-
const { phases, retries } = newDeployment;
|
|
124
|
-
const { previousPhases = [], retries: previousRetries = 0 } = getGlobalSettings(getState());
|
|
125
|
-
let newSettings = { retries: hasNewRetryDefault ? retries : previousRetries, hasDeployments: true };
|
|
126
|
-
if (phases) {
|
|
127
|
-
const standardPhases = standardizePhases(phases);
|
|
128
|
-
let prevPhases = previousPhases.map(standardizePhases);
|
|
129
|
-
if (!prevPhases.find(previousPhaseList => previousPhaseList.every(oldPhase => standardPhases.find(phase => deepCompare(phase, oldPhase))))) {
|
|
130
|
-
prevPhases.push(standardPhases);
|
|
131
|
-
}
|
|
132
|
-
newSettings.previousPhases = prevPhases.slice(-1 * MAX_PREVIOUS_PHASES_COUNT);
|
|
133
|
-
}
|
|
134
|
-
tasks.push(dispatch(saveGlobalSettings(newSettings)));
|
|
135
|
-
}
|
|
136
|
-
return Promise.all(tasks);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
export const getDeploymentDevices = createAsyncThunk(`${sliceName}/getDeploymentDevices`, (options, { dispatch, getState }) => {
|
|
141
|
-
const { id, page = defaultPage, perPage = defaultPerPage } = options;
|
|
142
|
-
return GeneralApi.get(`${deploymentsApiUrl}/deployments/${id}/devices/list?&page=${page}&per_page=${perPage}`).then(response => {
|
|
143
|
-
const { devices: deploymentDevices = {} } = getState().deployments.byId[id] || {};
|
|
144
|
-
const devices = response.data.reduce((accu, item) => {
|
|
145
|
-
accu[item.id] = item;
|
|
146
|
-
const log = (deploymentDevices[item.id] || {}).log;
|
|
147
|
-
if (log) {
|
|
148
|
-
accu[item.id].log = log;
|
|
149
|
-
}
|
|
150
|
-
return accu;
|
|
151
|
-
}, {});
|
|
152
|
-
const selectedDeviceIds = Object.keys(devices);
|
|
153
|
-
let tasks = [
|
|
154
|
-
dispatch(
|
|
155
|
-
actions.receivedDeploymentDevices({
|
|
156
|
-
id,
|
|
157
|
-
devices,
|
|
158
|
-
selectedDeviceIds,
|
|
159
|
-
totalDeviceCount: Number(response.headers[headerNames.total])
|
|
160
|
-
})
|
|
161
|
-
)
|
|
162
|
-
];
|
|
163
|
-
const devicesById = getDevicesById(getState());
|
|
164
|
-
// only update those that have changed & lack data
|
|
165
|
-
const lackingData = selectedDeviceIds.reduce((accu, deviceId) => {
|
|
166
|
-
const device = devicesById[deviceId];
|
|
167
|
-
if (!device || !device.identity_data || !device.attributes || Object.keys(device.attributes).length === 0) {
|
|
168
|
-
accu.push(deviceId);
|
|
169
|
-
}
|
|
170
|
-
return accu;
|
|
171
|
-
}, []);
|
|
172
|
-
// get device artifact, inventory and identity details not listed in schedule data
|
|
173
|
-
tasks = lackingData.reduce((accu, deviceId) => [...accu, dispatch(getDeviceById(deviceId)), dispatch(getDeviceAuth(deviceId))], tasks);
|
|
174
|
-
return Promise.all(tasks);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const parseDeviceDeployment = ({
|
|
179
|
-
deployment: { id, artifact_name: release, status: deploymentStatus },
|
|
180
|
-
device: { created, deleted, id: deviceId, finished, status, log }
|
|
181
|
-
}) => ({
|
|
182
|
-
id,
|
|
183
|
-
release,
|
|
184
|
-
created,
|
|
185
|
-
deleted,
|
|
186
|
-
deviceId,
|
|
187
|
-
finished,
|
|
188
|
-
status,
|
|
189
|
-
log,
|
|
190
|
-
route: Object.values(DEPLOYMENT_ROUTES).reduce((accu, { key, states }) => {
|
|
191
|
-
if (!accu) {
|
|
192
|
-
return states.includes(deploymentStatus) ? key : accu;
|
|
193
|
-
}
|
|
194
|
-
return accu;
|
|
195
|
-
}, '')
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
export const getDeviceDeployments = createAsyncThunk(`${sliceName}/getDeviceDeployments`, (options, { dispatch }) => {
|
|
199
|
-
const { deviceId, filterSelection = [], page = defaultPage, perPage = defaultPerPage } = options;
|
|
200
|
-
const filters = filterSelection.map(item => `&status=${item}`).join('');
|
|
201
|
-
return GeneralApi.get(`${deploymentsApiUrl}/deployments/devices/${deviceId}?page=${page}&per_page=${perPage}${filters}`)
|
|
202
|
-
.then(({ data, headers }) =>
|
|
203
|
-
Promise.resolve(
|
|
204
|
-
dispatch(
|
|
205
|
-
receivedDevice({
|
|
206
|
-
id: deviceId,
|
|
207
|
-
deviceDeployments: data.map(parseDeviceDeployment),
|
|
208
|
-
deploymentsCount: Number(headers[headerNames.total])
|
|
209
|
-
})
|
|
210
|
-
)
|
|
211
|
-
)
|
|
212
|
-
)
|
|
213
|
-
.catch(err => commonErrorHandler(err, 'There was an error retrieving the device deployment history:', dispatch));
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
export const resetDeviceDeployments = createAsyncThunk(`${sliceName}/resetDeviceDeployments`, (deviceId, { dispatch }) =>
|
|
217
|
-
GeneralApi.delete(`${deploymentsApiUrl}/deployments/devices/${deviceId}/history`)
|
|
218
|
-
.then(() => Promise.resolve(dispatch(getDeviceDeployments({ deviceId }))))
|
|
219
|
-
.catch(err => commonErrorHandler(err, 'There was an error resetting the device deployment history:', dispatch))
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
export const getSingleDeployment = createAsyncThunk(`${sliceName}/getSingleDeployment`, (id, { dispatch, getState }) =>
|
|
223
|
-
GeneralApi.get(`${deploymentsApiUrl}/deployments/${id}`).then(({ data }) => {
|
|
224
|
-
const { deployments } = transformDeployments([data], getState().deployments.byId);
|
|
225
|
-
return Promise.resolve(dispatch(actions.receivedDeployment(deployments[id])));
|
|
226
|
-
})
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
export const getDeviceLog = createAsyncThunk(`${sliceName}/getDeviceLog`, ({ deploymentId, deviceId }, { dispatch }) =>
|
|
230
|
-
GeneralApi.get(`${deploymentsApiUrl}/deployments/${deploymentId}/devices/${deviceId}/log`)
|
|
231
|
-
.catch(e => {
|
|
232
|
-
console.log('no log here', e);
|
|
233
|
-
return Promise.reject();
|
|
234
|
-
})
|
|
235
|
-
.then(({ data: log }) =>
|
|
236
|
-
Promise.all([Promise.resolve(dispatch(actions.receivedDeploymentDeviceLog({ id: deploymentId, deviceId, log }))), Promise.resolve(log)])
|
|
237
|
-
)
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
export const abortDeployment = createAsyncThunk(`${sliceName}/abortDeployment`, (deploymentId, { dispatch, getState }) =>
|
|
241
|
-
GeneralApi.put(`${deploymentsApiUrl}/deployments/${deploymentId}/status`, { status: 'aborted' })
|
|
242
|
-
.then(() => {
|
|
243
|
-
const deploymentsByStatus = getDeploymentsByStatusSelector(getState());
|
|
244
|
-
let status = DEPLOYMENT_STATES.pending;
|
|
245
|
-
let index = deploymentsByStatus.pending.deploymentIds.findIndex(id => id === deploymentId);
|
|
246
|
-
if (index < 0) {
|
|
247
|
-
status = DEPLOYMENT_STATES.inprogress;
|
|
248
|
-
index = deploymentsByStatus.inprogress.deploymentIds.findIndex(id => id === deploymentId);
|
|
249
|
-
}
|
|
250
|
-
const deploymentIds = [...deploymentsByStatus[status].deploymentIds.slice(0, index), ...deploymentsByStatus[status].deploymentIds.slice(index + 1)];
|
|
251
|
-
const deploymentsById = getDeploymentsById(getState());
|
|
252
|
-
const deployments = deploymentIds.reduce((accu, id) => {
|
|
253
|
-
accu[id] = deploymentsById[id];
|
|
254
|
-
return accu;
|
|
255
|
-
}, {});
|
|
256
|
-
const total = Math.max(deploymentsByStatus[status].total - 1, 0);
|
|
257
|
-
return Promise.all([
|
|
258
|
-
dispatch(actions.receivedDeployments(deployments)),
|
|
259
|
-
dispatch(actions.receivedDeploymentsForStatus({ deploymentIds, status, total })),
|
|
260
|
-
dispatch(actions.removedDeployment(deploymentId)),
|
|
261
|
-
dispatch(setSnackbar('The deployment was successfully aborted'))
|
|
262
|
-
]);
|
|
263
|
-
})
|
|
264
|
-
.catch(err => commonErrorHandler(err, 'There was an error while aborting the deployment:', dispatch))
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
export const updateDeploymentControlMap = createAsyncThunk(`${sliceName}/updateDeploymentControlMap`, ({ deploymentId, updateControlMap }, { dispatch }) =>
|
|
268
|
-
GeneralApi.patch(`${deploymentsApiUrl}/deployments/${deploymentId}`, { update_control_map: updateControlMap })
|
|
269
|
-
.catch(err => commonErrorHandler(err, 'There was an error while updating the deployment status:', dispatch))
|
|
270
|
-
.then(() => Promise.resolve(dispatch(getSingleDeployment(deploymentId))))
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
export const setDeploymentsState = createAsyncThunk(`${sliceName}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
274
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
275
|
-
const { page, perPage, ...selectionState } = selection;
|
|
276
|
-
const currentState = getState().deployments.selectionState;
|
|
277
|
-
let nextState = {
|
|
278
|
-
...currentState,
|
|
279
|
-
...selectionState,
|
|
280
|
-
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
281
|
-
accu[item] = {
|
|
282
|
-
...currentState[item],
|
|
283
|
-
...selectionState[item]
|
|
284
|
-
};
|
|
285
|
-
return accu;
|
|
286
|
-
}, {}),
|
|
287
|
-
general: {
|
|
288
|
-
...currentState.general,
|
|
289
|
-
...selectionState.general
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
let tasks = [dispatch(actions.setDeploymentsState(nextState))];
|
|
293
|
-
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
294
|
-
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
295
|
-
}
|
|
296
|
-
return Promise.all(tasks);
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
const deltaAttributeMappings = [
|
|
300
|
-
{ here: 'compressionLevel', there: 'compression_level' },
|
|
301
|
-
{ here: 'disableChecksum', there: 'disable_checksum' },
|
|
302
|
-
{ here: 'disableDecompression', there: 'disable_external_decompression' },
|
|
303
|
-
{ here: 'sourceWindow', there: 'source_window_size' },
|
|
304
|
-
{ here: 'inputWindow', there: 'input_window_size' },
|
|
305
|
-
{ here: 'duplicatesWindow', there: 'compression_duplicates_window' },
|
|
306
|
-
{ here: 'instructionBuffer', there: 'instruction_buffer_size' }
|
|
307
|
-
];
|
|
308
|
-
|
|
309
|
-
const mapExternalDeltaConfig = (config = {}) =>
|
|
310
|
-
deltaAttributeMappings.reduce((accu, { here, there }) => {
|
|
311
|
-
if (config[there] !== undefined) {
|
|
312
|
-
accu[here] = config[there];
|
|
313
|
-
}
|
|
314
|
-
return accu;
|
|
315
|
-
}, {});
|
|
316
|
-
|
|
317
|
-
export const getDeploymentsConfig = createAsyncThunk(`${sliceName}/getDeploymentsConfig`, (_, { dispatch, getState }) =>
|
|
318
|
-
GeneralApi.get(`${deploymentsApiUrl}/config`).then(({ data }) => {
|
|
319
|
-
const oldConfig = getState().deployments.config;
|
|
320
|
-
const { delta = {} } = data;
|
|
321
|
-
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
322
|
-
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
323
|
-
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
324
|
-
const config = {
|
|
325
|
-
...oldConfig,
|
|
326
|
-
hasDelta: Boolean(delta.enabled),
|
|
327
|
-
binaryDelta: {
|
|
328
|
-
...oldConfig.binaryDelta,
|
|
329
|
-
timeout: timeoutConfig,
|
|
330
|
-
...mapExternalDeltaConfig(xdelta_args)
|
|
331
|
-
},
|
|
332
|
-
binaryDeltaLimits: {
|
|
333
|
-
...oldConfig.binaryDeltaLimits,
|
|
334
|
-
timeout: timeoutLimit,
|
|
335
|
-
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
return Promise.resolve(dispatch(actions.setDeploymentsConfig(config)));
|
|
339
|
-
})
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
// traverse a source object and remove undefined & empty object properties to only return an attribute if there really is content worth sending
|
|
343
|
-
const deepClean = source =>
|
|
344
|
-
Object.entries(source).reduce((accu, [key, value]) => {
|
|
345
|
-
if (value !== undefined) {
|
|
346
|
-
let cleanedValue = typeof value === 'object' ? deepClean(value) : value;
|
|
347
|
-
if (cleanedValue === undefined || (typeof cleanedValue === 'object' && isEmpty(cleanedValue))) {
|
|
348
|
-
return accu;
|
|
349
|
-
}
|
|
350
|
-
accu = { ...(accu ?? {}), [key]: cleanedValue };
|
|
351
|
-
}
|
|
352
|
-
return accu;
|
|
353
|
-
}, undefined);
|
|
354
|
-
|
|
355
|
-
export const saveDeltaDeploymentsConfig = createAsyncThunk(`${sliceName}/saveDeltaDeploymentsConfig`, (config, { dispatch, getState }) => {
|
|
356
|
-
const configChange = {
|
|
357
|
-
timeout: config.timeout,
|
|
358
|
-
xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
|
|
359
|
-
if (config[here] !== undefined) {
|
|
360
|
-
accu[there] = config[here];
|
|
361
|
-
}
|
|
362
|
-
return accu;
|
|
363
|
-
}, {})
|
|
364
|
-
};
|
|
365
|
-
const result = deepClean(configChange);
|
|
366
|
-
if (!result) {
|
|
367
|
-
return Promise.resolve();
|
|
368
|
-
}
|
|
369
|
-
return GeneralApi.put(`${deploymentsApiUrl}/config/binary_delta`, result)
|
|
370
|
-
.catch(err => commonErrorHandler(err, 'There was a problem storing your delta artifact generation configuration.', dispatch))
|
|
371
|
-
.then(() => {
|
|
372
|
-
const oldConfig = getState().deployments.config;
|
|
373
|
-
const newConfig = {
|
|
374
|
-
...oldConfig,
|
|
375
|
-
binaryDelta: {
|
|
376
|
-
...oldConfig.binaryDelta,
|
|
377
|
-
...config
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
return Promise.all([dispatch(actions.setDeploymentsConfig(newConfig)), dispatch(setSnackbar('Settings saved successfully'))]);
|
|
381
|
-
});
|
|
382
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 Northern.tech AS
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import { DEVICE_FILTERING_OPTIONS, apiUrl } from '@northern.tech/store/constants';
|
|
15
|
-
|
|
16
|
-
export const emptyFilter = { key: null, value: '', operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: 'inventory' };
|
|
17
|
-
|
|
18
|
-
export const deviceAuthV2 = `${apiUrl.v2}/devauth`;
|
|
19
|
-
export const deviceConnect = `${apiUrl.v1}/deviceconnect`;
|
|
20
|
-
export const inventoryApiUrl = `${apiUrl.v1}/inventory`;
|
|
21
|
-
export const inventoryApiUrlV2 = `${apiUrl.v2}/inventory`;
|
|
22
|
-
export const deviceConfig = `${apiUrl.v1}/deviceconfig/configurations/device`;
|
|
23
|
-
export const reportingApiUrl = `${apiUrl.v1}/reporting`;
|
|
24
|
-
export const iotManagerBaseURL = `${apiUrl.v1}/iot-manager`;
|
|
25
|
-
|
|
26
|
-
// see https://github.com/mendersoftware/go-lib-micro/tree/master/ws
|
|
27
|
-
// for the description of proto_header and the consts
|
|
28
|
-
// *Note*: this needs to be aligned with mender-connect and deviceconnect.
|
|
29
|
-
export const DEVICE_MESSAGE_PROTOCOLS = {
|
|
30
|
-
Shell: 1
|
|
31
|
-
};
|
|
32
|
-
export const DEVICE_MESSAGE_TYPES = {
|
|
33
|
-
Delay: 'delay',
|
|
34
|
-
New: 'new',
|
|
35
|
-
Ping: 'ping',
|
|
36
|
-
Pong: 'pong',
|
|
37
|
-
Resize: 'resize',
|
|
38
|
-
Shell: 'shell',
|
|
39
|
-
Stop: 'stop'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// we can't include the dismiss state with the rest since this would include dismissed devices in several queries
|
|
43
|
-
export const DEVICE_DISMISSAL_STATE = 'dismiss';
|
|
44
|
-
export const DEVICE_STATES = {
|
|
45
|
-
accepted: 'accepted',
|
|
46
|
-
pending: 'pending',
|
|
47
|
-
preauth: 'preauthorized',
|
|
48
|
-
rejected: 'rejected'
|
|
49
|
-
};
|
|
50
|
-
export const DEVICE_CONNECT_STATES = {
|
|
51
|
-
connected: 'connected',
|
|
52
|
-
disconnected: 'disconnected',
|
|
53
|
-
unknown: 'unknown'
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const geoAttributes = ['geo-lat', 'geo-lon'].map(attribute => ({ attribute, scope: 'inventory' }));
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Northern.tech AS
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
// @ts-nocheck
|
|
15
|
-
|
|
16
|
-
/*eslint import/namespace: ['error', { allowComputed: true }]*/
|
|
17
|
-
import reducer, { actions, initialState } from '.';
|
|
18
|
-
import { defaultState } from '../../../../tests/mockData';
|
|
19
|
-
import { DEVICE_STATES } from './constants';
|
|
20
|
-
|
|
21
|
-
describe('device reducer', () => {
|
|
22
|
-
it('should return the initial state', async () => {
|
|
23
|
-
expect(reducer(undefined, {})).toEqual(initialState);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should handle RECEIVE_GROUPS', async () => {
|
|
27
|
-
expect(reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId }).groups.byId).toEqual(
|
|
28
|
-
defaultState.devices.groups.byId
|
|
29
|
-
);
|
|
30
|
-
expect(reducer(initialState, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId }).groups.byId).toEqual(
|
|
31
|
-
defaultState.devices.groups.byId
|
|
32
|
-
);
|
|
33
|
-
expect(
|
|
34
|
-
reducer(initialState, { type: actions.receivedGroups, payload: { testExtra: { deviceIds: [], total: 0, filters: [] } } }).groups.byId.testExtra
|
|
35
|
-
).toEqual({
|
|
36
|
-
deviceIds: [],
|
|
37
|
-
total: 0,
|
|
38
|
-
filters: []
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it('should handle RECEIVE_GROUP_DEVICES', async () => {
|
|
42
|
-
expect(
|
|
43
|
-
reducer(undefined, {
|
|
44
|
-
type: actions.addGroup,
|
|
45
|
-
payload: {
|
|
46
|
-
groupName: 'testGroupDynamic',
|
|
47
|
-
group: defaultState.devices.groups.byId.testGroupDynamic
|
|
48
|
-
}
|
|
49
|
-
}).groups.byId.testGroupDynamic
|
|
50
|
-
).toEqual(defaultState.devices.groups.byId.testGroupDynamic);
|
|
51
|
-
expect(
|
|
52
|
-
reducer(initialState, {
|
|
53
|
-
type: actions.addGroup,
|
|
54
|
-
payload: {
|
|
55
|
-
groupName: 'testGroupDynamic',
|
|
56
|
-
group: defaultState.devices.groups.byId.testGroupDynamic
|
|
57
|
-
}
|
|
58
|
-
}).groups.byId.testGroupDynamic
|
|
59
|
-
).toEqual(defaultState.devices.groups.byId.testGroupDynamic);
|
|
60
|
-
});
|
|
61
|
-
it('should handle RECEIVE_DYNAMIC_GROUPS', async () => {
|
|
62
|
-
expect(reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId }).groups.byId).toEqual(
|
|
63
|
-
defaultState.devices.groups.byId
|
|
64
|
-
);
|
|
65
|
-
expect(reducer(initialState, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId }).groups.byId).toEqual(
|
|
66
|
-
defaultState.devices.groups.byId
|
|
67
|
-
);
|
|
68
|
-
expect(
|
|
69
|
-
reducer(initialState, { type: actions.receivedGroups, payload: { testExtra: { deviceIds: [], total: 0, filters: [] } } }).groups.byId.testExtra
|
|
70
|
-
).toEqual({ deviceIds: [], total: 0, filters: [] });
|
|
71
|
-
});
|
|
72
|
-
it('should handle ADD_TO_GROUP', async () => {
|
|
73
|
-
let state = reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId });
|
|
74
|
-
expect(reducer(state, { type: actions.addToGroup, payload: { group: 'testExtra', deviceIds: ['d1'] } }).groups.byId.testExtra.deviceIds).toHaveLength(1);
|
|
75
|
-
expect(
|
|
76
|
-
reducer(initialState, { type: actions.addToGroup, payload: { group: 'testGroup', deviceIds: ['123', '1243'] } }).groups.byId.testGroup.deviceIds
|
|
77
|
-
).toHaveLength(2);
|
|
78
|
-
});
|
|
79
|
-
it('should handle REMOVE_FROM_GROUP', async () => {
|
|
80
|
-
let state = reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId });
|
|
81
|
-
state = reducer(state, { type: actions.selectGroup, payload: 'testGroup' });
|
|
82
|
-
expect(
|
|
83
|
-
reducer(state, { type: actions.removeFromGroup, payload: { group: 'testGroup', deviceIds: [defaultState.devices.groups.byId.testGroup.deviceIds[0]] } })
|
|
84
|
-
.groups.byId.testGroup.deviceIds
|
|
85
|
-
).toHaveLength(defaultState.devices.groups.byId.testGroup.deviceIds.length - 1);
|
|
86
|
-
expect(
|
|
87
|
-
reducer(state, { type: actions.removeFromGroup, payload: { group: 'testGroup', deviceIds: defaultState.devices.groups.byId.testGroup.deviceIds } }).groups
|
|
88
|
-
.byId.testGroup
|
|
89
|
-
).toBeFalsy();
|
|
90
|
-
expect(
|
|
91
|
-
reducer(initialState, { type: actions.removeFromGroup, payload: { group: 'testExtra', deviceIds: ['123', '1243'] } }).groups.byId.testExtra
|
|
92
|
-
).toBeFalsy();
|
|
93
|
-
});
|
|
94
|
-
it('should handle ADD_DYNAMIC_GROUP', async () => {
|
|
95
|
-
expect(
|
|
96
|
-
reducer(undefined, { type: actions.addGroup, payload: { groupName: 'test', group: { something: 'test' } } }).groups.byId.test.something
|
|
97
|
-
).toBeTruthy();
|
|
98
|
-
expect(
|
|
99
|
-
reducer(initialState, { type: actions.addGroup, payload: { groupName: 'test', group: { something: 'test' } } }).groups.byId.test.something
|
|
100
|
-
).toBeTruthy();
|
|
101
|
-
});
|
|
102
|
-
it('should handle ADD_STATIC_GROUP', async () => {
|
|
103
|
-
expect(
|
|
104
|
-
reducer(undefined, { type: actions.addGroup, payload: { groupName: 'test', group: { something: 'test' } } }).groups.byId.test.something
|
|
105
|
-
).toBeTruthy();
|
|
106
|
-
expect(
|
|
107
|
-
reducer(initialState, { type: actions.addGroup, payload: { groupName: 'test', group: { something: 'test' } } }).groups.byId.test.something
|
|
108
|
-
).toBeTruthy();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('should handle REMOVE_DYNAMIC_GROUP', async () => {
|
|
112
|
-
let state = reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId });
|
|
113
|
-
expect(Object.keys(reducer(state, { type: actions.removeGroup, payload: 'testGroupDynamic' }).groups.byId)).toHaveLength(
|
|
114
|
-
Object.keys(defaultState.devices.groups.byId).length - 1
|
|
115
|
-
);
|
|
116
|
-
expect(Object.keys(reducer(initialState, { type: actions.removeGroup, payload: 'testGroupDynamic' }).groups.byId)).toHaveLength(0);
|
|
117
|
-
});
|
|
118
|
-
it('should handle REMOVE_STATIC_GROUP', async () => {
|
|
119
|
-
let state = reducer(undefined, { type: actions.receivedGroups, payload: defaultState.devices.groups.byId });
|
|
120
|
-
expect(Object.keys(reducer(state, { type: actions.removeGroup, payload: 'testGroup' }).groups.byId)).toHaveLength(
|
|
121
|
-
Object.keys(defaultState.devices.groups.byId).length - 1
|
|
122
|
-
);
|
|
123
|
-
expect(Object.keys(reducer(initialState, { type: actions.removeGroup, payload: 'testGroup' }).groups.byId)).toHaveLength(0);
|
|
124
|
-
});
|
|
125
|
-
it('should handle SET_DEVICE_LIST_STATE', async () => {
|
|
126
|
-
expect(reducer(undefined, { type: actions.setDeviceListState, payload: { deviceIds: ['test'] } }).deviceList.deviceIds).toEqual(['test']);
|
|
127
|
-
expect(reducer(initialState, { type: actions.setDeviceListState, payload: { deviceIds: ['test'] } }).deviceList.deviceIds).toEqual(['test']);
|
|
128
|
-
});
|
|
129
|
-
it('should handle SET_DEVICE_FILTERS', async () => {
|
|
130
|
-
expect(reducer(undefined, { type: actions.setDeviceFilters, payload: defaultState.devices.groups.byId.testGroupDynamic.filters }).filters).toHaveLength(1);
|
|
131
|
-
expect(reducer(initialState, { type: actions.setDeviceFilters, payload: [{ key: 'test', operator: 'test' }] }).filters).toHaveLength(0);
|
|
132
|
-
});
|
|
133
|
-
it('should handle SET_FILTERABLES_CONFIG', async () => {
|
|
134
|
-
expect(reducer(undefined, { type: actions.setFilterablesConfig, payload: { attributes: { asd: true } } }).filteringAttributesConfig).toEqual({
|
|
135
|
-
attributes: { asd: true },
|
|
136
|
-
count: undefined,
|
|
137
|
-
limit: undefined
|
|
138
|
-
});
|
|
139
|
-
expect(
|
|
140
|
-
reducer(initialState, { type: actions.setFilterablesConfig, payload: { attributes: { asd: true }, count: 1, limit: 10 } }).filteringAttributesConfig
|
|
141
|
-
).toEqual({ attributes: { asd: true }, count: 1, limit: 10 });
|
|
142
|
-
});
|
|
143
|
-
it('should handle SET_FILTER_ATTRIBUTES', async () => {
|
|
144
|
-
expect(reducer(undefined, { type: actions.setFilterAttributes, payload: { things: '12' } }).filteringAttributes).toEqual({ things: '12' });
|
|
145
|
-
expect(reducer(initialState, { type: actions.setFilterAttributes, payload: { things: '12' } }).filteringAttributes).toEqual({ things: '12' });
|
|
146
|
-
});
|
|
147
|
-
it('should handle SET_TOTAL_DEVICES', async () => {
|
|
148
|
-
expect(reducer(undefined, { type: actions.setTotalDevices, payload: 2 }).total).toEqual(2);
|
|
149
|
-
expect(reducer(initialState, { type: actions.setTotalDevices, payload: 4 }).total).toEqual(4);
|
|
150
|
-
});
|
|
151
|
-
it('should handle SET_DEVICE_LIMIT', async () => {
|
|
152
|
-
expect(reducer(undefined, { type: actions.setDeviceLimit, payload: 500 }).limit).toEqual(500);
|
|
153
|
-
expect(reducer(initialState, { type: actions.setDeviceLimit, payload: 200 }).limit).toEqual(200);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('should handle RECEIVE_DEVICE', async () => {
|
|
157
|
-
expect(reducer(undefined, { type: actions.receivedDevice, payload: defaultState.devices.byId.b1 }).byId.b1).toEqual(defaultState.devices.byId.b1);
|
|
158
|
-
expect(reducer(initialState, { type: actions.receivedDevice, payload: defaultState.devices.byId.b1 }).byId).not.toBe({});
|
|
159
|
-
});
|
|
160
|
-
it('should handle RECEIVE_DEVICES', async () => {
|
|
161
|
-
expect(reducer(undefined, { type: actions.receivedDevices, payload: defaultState.devices.byId }).byId).toEqual(defaultState.devices.byId);
|
|
162
|
-
expect(reducer(initialState, { type: actions.receivedDevices, payload: defaultState.devices.byId }).byId).toEqual(defaultState.devices.byId);
|
|
163
|
-
});
|
|
164
|
-
it('should handle SET_INACTIVE_DEVICES', async () => {
|
|
165
|
-
expect(
|
|
166
|
-
reducer(undefined, { type: actions.setInactiveDevices, payload: { activeDeviceTotal: 1, inactiveDeviceTotal: 1 } }).byStatus.active.total
|
|
167
|
-
).toBeTruthy();
|
|
168
|
-
expect(
|
|
169
|
-
reducer(initialState, { type: actions.setInactiveDevices, payload: { activeDeviceTotal: 1, inactiveDeviceTotal: 1 } }).byStatus.inactive.total
|
|
170
|
-
).toEqual(1);
|
|
171
|
-
});
|
|
172
|
-
it('should handle SET_DEVICE_REPORTS', async () => {
|
|
173
|
-
expect(reducer(undefined, { type: actions.setDeviceReports, payload: [1, 2, 3] }).reports).toHaveLength(3);
|
|
174
|
-
expect(reducer(initialState, { type: actions.setDeviceReports, payload: [{ something: 'here' }] }).reports).toEqual([{ something: 'here' }]);
|
|
175
|
-
});
|
|
176
|
-
it('should handle SET_<authstatus>_DEVICES', async () => {
|
|
177
|
-
Object.values(DEVICE_STATES).forEach(status => {
|
|
178
|
-
expect(reducer(undefined, { type: actions.setDevicesByStatus, payload: { deviceIds: ['a1'], total: 1, status } }).byStatus[status]).toEqual({
|
|
179
|
-
deviceIds: ['a1'],
|
|
180
|
-
total: 1
|
|
181
|
-
});
|
|
182
|
-
expect(reducer(initialState, { type: actions.setDevicesByStatus, payload: { deviceIds: ['a1'], status } }).byStatus[status]).toEqual({
|
|
183
|
-
deviceIds: [],
|
|
184
|
-
total: 0
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
it('should handle SET_<authstatus>_DEVICES_COUNT', async () => {
|
|
189
|
-
Object.values(DEVICE_STATES).forEach(status => {
|
|
190
|
-
expect(reducer(undefined, { type: actions.setDevicesCountByStatus, payload: { count: 1, status } }).byStatus[status].total).toEqual(1);
|
|
191
|
-
expect(reducer(initialState, { type: actions.setDevicesCountByStatus, payload: { count: 1, status } }).byStatus[status].total).toEqual(1);
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
});
|