@northern.tech/store 0.41.2 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.cts +9 -10
- package/dist/actions.d.ts +9 -10
- package/dist/api/general-api.cjs +1 -1
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.d.cts +0 -1
- package/dist/api/general-api.d.ts +0 -1
- package/dist/api/general-api.js +1 -1
- package/dist/api/users-api.cjs +1 -1
- package/dist/api/users-api.d.cts +1 -6
- package/dist/api/users-api.d.ts +1 -6
- package/dist/appSlice/constants.cjs +0 -5
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +1 -1
- package/dist/appSlice/constants.d.ts +1 -1
- package/dist/appSlice/constants.js +0 -5
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.d.cts +1 -1
- package/dist/appSlice/index.d.ts +1 -1
- package/dist/appSlice/index.js +1 -1
- package/dist/appSlice/mocks.d.cts +1 -2
- package/dist/appSlice/mocks.d.ts +1 -2
- package/dist/appSlice/selectors.cjs.map +1 -1
- package/dist/appSlice/selectors.d.cts +9 -10
- package/dist/appSlice/selectors.d.ts +9 -10
- package/dist/appSlice/thunks.d.cts +2 -3
- package/dist/appSlice/thunks.d.ts +2 -3
- package/dist/auth.cjs +1 -1
- package/dist/auth.d.cts +3 -10
- package/dist/auth.d.ts +3 -10
- package/dist/auth.js +1 -1
- package/dist/commonConstants.d.cts +1 -1
- package/dist/commonConstants.d.ts +1 -1
- package/dist/commonConstants.js +1 -1
- package/dist/commonSelectors.cjs +4 -3
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +20 -21
- package/dist/commonSelectors.d.ts +20 -21
- package/dist/commonSelectors.js +4 -3
- package/dist/commonSelectors.js.map +1 -1
- package/dist/{constants-Sn4gnNA3.d.ts → constants-B3Jdkn2b.d.cts} +2 -5
- package/dist/{constants-Sn4gnNA3.d.cts → constants-B3Jdkn2b.d.ts} +2 -5
- package/dist/{constants-CzjK2gV-.d.ts → constants-B_H4squx.d.ts} +4 -4
- package/dist/{constants-D9o0Cnk_.d.ts → constants-C6TIYaY4.d.cts} +1 -2
- package/dist/{constants-D9o0Cnk_.d.cts → constants-C6TIYaY4.d.ts} +1 -2
- package/dist/{constants-6kYRTdox.d.ts → constants-CEwun8TL.d.cts} +3 -2
- package/dist/{constants-6kYRTdox.d.cts → constants-CEwun8TL.d.ts} +3 -2
- package/dist/constants-C_SC_VKE.cjs.map +1 -1
- package/dist/{constants-xpheFFkA.js → constants-CerzXHnQ.js} +3 -3
- package/dist/{constants-xpheFFkA.js.map → constants-CerzXHnQ.js.map} +1 -1
- package/dist/{constants-DAi2zOZN.d.cts → constants-Rl3FJzFf.d.cts} +4 -4
- package/dist/{constants-B_7FCJQX.d.ts → constants-nKSWZ8oD.d.cts} +3 -8
- package/dist/{constants-B_7FCJQX.d.cts → constants-nKSWZ8oD.d.ts} +3 -8
- package/dist/constants.cjs +2 -0
- package/dist/constants.d.cts +6 -6
- package/dist/constants.d.ts +6 -6
- package/dist/constants.js +3 -3
- package/dist/deploymentsSlice/constants.d.cts +1 -1
- package/dist/deploymentsSlice/constants.d.ts +1 -1
- package/dist/deploymentsSlice/constants.js +1 -1
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.d.cts +1 -1
- package/dist/deploymentsSlice/index.d.ts +1 -1
- package/dist/deploymentsSlice/index.js +1 -1
- package/dist/deploymentsSlice/mocks.d.cts +1 -2
- package/dist/deploymentsSlice/mocks.d.ts +1 -2
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.d.cts +9 -10
- package/dist/deploymentsSlice/selectors.d.ts +9 -10
- package/dist/deploymentsSlice/selectors.js +1 -1
- package/dist/deploymentsSlice/thunks.d.cts +7 -13
- package/dist/deploymentsSlice/thunks.d.ts +7 -13
- package/dist/devicesSlice/constants.d.cts +1 -1
- package/dist/devicesSlice/constants.d.ts +1 -1
- package/dist/devicesSlice/constants.js +1 -1
- package/dist/devicesSlice/index.cjs +1 -1
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.d.cts +2 -2
- package/dist/devicesSlice/index.d.ts +2 -2
- package/dist/devicesSlice/index.js +2 -2
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/mocks.js +1 -1
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +9 -10
- package/dist/devicesSlice/selectors.d.ts +9 -10
- package/dist/devicesSlice/selectors.js +1 -1
- package/dist/devicesSlice/thunks.cjs +1 -2
- package/dist/devicesSlice/thunks.d.cts +11 -23
- package/dist/devicesSlice/thunks.d.ts +11 -23
- package/dist/devicesSlice/thunks.js +2 -2
- package/dist/{index-Bb4yvvgG.d.ts → index-B8td4-rY.d.ts} +1 -2
- package/dist/{index-C5oQrJGU.d.ts → index-BAGyeC-q.d.ts} +2 -3
- package/dist/{index-CgPgKMve.d.cts → index-BgF6rhXn.d.cts} +3 -4
- package/dist/{index-CnH51JfB.d.ts → index-Bs0c1-WY.d.ts} +4 -9
- package/dist/{index-BtGhTFBc.d.ts → index-Bvyf8OO6.d.ts} +9 -13
- package/dist/{index-m1c0qk2s.d.ts → index-C8uiyxnb.d.ts} +2 -3
- package/dist/{index-CSOj22xK.d.cts → index-C_LGDJN2.d.cts} +2 -3
- package/dist/{index-H9zg_3UV.d.ts → index-ChKTa1aL.d.ts} +2 -3
- package/dist/{index-vXsWdis1.d.cts → index-CiQ95u1W.d.cts} +9 -13
- package/dist/{index-DBUt8xVc.d.ts → index-CoObjWL4.d.cts} +1 -2
- package/dist/{index-DBUt8xVc.d.cts → index-CoObjWL4.d.ts} +1 -2
- package/dist/{index-BCErsO5h.d.ts → index-CpfhQHfg.d.ts} +3 -4
- package/dist/{index-BQCnJ5gh.d.cts → index-Ctj2r57a.d.cts} +2 -3
- package/dist/{index-Dn1SqQYh.d.cts → index-DeOpb2oK.d.cts} +4 -9
- package/dist/{index-VEayiYkv.d.cts → index-DiAjzARZ.d.cts} +2 -3
- package/dist/{index-EPmsL6Lb.d.cts → index-mvxjivTJ.d.cts} +1 -2
- package/dist/liststatehook.cjs.map +1 -1
- package/dist/liststatehook.d.cts +0 -1
- package/dist/liststatehook.d.ts +0 -1
- package/dist/locationutils.cjs +36 -28
- package/dist/locationutils.cjs.map +1 -1
- package/dist/locationutils.d.cts +14 -67
- package/dist/locationutils.d.ts +14 -67
- package/dist/locationutils.js +37 -29
- package/dist/locationutils.js.map +1 -1
- package/dist/monitorSlice/constants.d.cts +1 -1
- package/dist/monitorSlice/constants.d.ts +1 -1
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.d.cts +1 -1
- package/dist/monitorSlice/index.d.ts +1 -1
- package/dist/monitorSlice/index.js +1 -1
- package/dist/monitorSlice/mocks.d.cts +1 -2
- package/dist/monitorSlice/mocks.d.ts +1 -2
- package/dist/monitorSlice/mocks.js +1 -1
- package/dist/monitorSlice/selectors.d.cts +1 -2
- package/dist/monitorSlice/selectors.d.ts +1 -2
- package/dist/monitorSlice/thunks.d.cts +4 -5
- package/dist/monitorSlice/thunks.d.ts +4 -5
- package/dist/monitorSlice/thunks.js +1 -1
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.d.cts +1 -1
- package/dist/onboardingSlice/index.d.ts +1 -1
- package/dist/onboardingSlice/mocks.d.cts +1 -2
- package/dist/onboardingSlice/mocks.d.ts +1 -2
- package/dist/onboardingSlice/selectors.d.cts +2 -3
- package/dist/onboardingSlice/selectors.d.ts +2 -3
- package/dist/onboardingSlice/thunks.d.cts +4 -4
- package/dist/onboardingSlice/thunks.d.ts +4 -4
- package/dist/organizationSlice/constants.js +1 -1
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +1 -1
- package/dist/organizationSlice/index.d.ts +1 -1
- package/dist/organizationSlice/index.js +1 -1
- package/dist/organizationSlice/mocks.d.cts +3 -3
- package/dist/organizationSlice/mocks.d.ts +3 -3
- package/dist/organizationSlice/mocks.js +1 -1
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +11 -16
- package/dist/organizationSlice/selectors.d.ts +11 -16
- package/dist/organizationSlice/selectors.js +1 -1
- package/dist/organizationSlice/thunks.d.cts +6 -7
- package/dist/organizationSlice/thunks.d.ts +6 -7
- package/dist/organizationSlice/types.d.cts +1 -1
- package/dist/organizationSlice/types.d.ts +1 -1
- package/dist/releasesSlice/constants.cjs +2 -0
- package/dist/releasesSlice/constants.cjs.map +1 -1
- package/dist/releasesSlice/constants.d.cts +2 -2
- package/dist/releasesSlice/constants.d.ts +2 -2
- package/dist/releasesSlice/constants.js +2 -1
- package/dist/releasesSlice/constants.js.map +1 -1
- package/dist/releasesSlice/index.cjs.map +1 -1
- package/dist/releasesSlice/index.d.cts +1 -1
- package/dist/releasesSlice/index.d.ts +1 -1
- package/dist/releasesSlice/index.js +1 -1
- package/dist/releasesSlice/mocks.js +1 -1
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.d.cts +9 -10
- package/dist/releasesSlice/selectors.d.ts +9 -10
- package/dist/releasesSlice/thunks.cjs +1 -1
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +4 -5
- package/dist/releasesSlice/thunks.d.ts +4 -5
- package/dist/releasesSlice/thunks.js +1 -1
- package/dist/{rolldown-runtime-D6vf50IK.cjs → rolldown-runtime-VH7oDXx4.cjs} +1 -1
- package/dist/sockethook.cjs +1 -2
- package/dist/sockethook.cjs.map +1 -1
- package/dist/sockethook.d.cts +1 -8
- package/dist/sockethook.d.ts +1 -8
- package/dist/sockethook.js +1 -2
- package/dist/sockethook.js.map +1 -1
- package/dist/{store-CkgokFlk.d.ts → store-CPptM5Ts.d.ts} +27 -48
- package/dist/{store-CGP5pCH8.d.cts → store-CUUm1GTI.d.cts} +27 -48
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/storehooks.cjs +30 -20
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.d.cts +13 -4
- package/dist/storehooks.d.ts +13 -4
- package/dist/storehooks.js +31 -22
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +16 -112
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +2 -2
- package/dist/thunks.d.ts +2 -2
- package/dist/thunks.js +16 -111
- package/dist/thunks.js.map +1 -1
- package/dist/{types-uHmaedGU.d.ts → types-B3qGQoMx.d.ts} +3 -4
- package/dist/{types-yQ0ypHMZ.d.cts → types-B80ckxiy.d.cts} +3 -4
- package/dist/useDeploymentDevice.cjs +1 -1
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/usersSlice/constants.d.cts +1 -1
- package/dist/usersSlice/constants.d.ts +1 -1
- package/dist/usersSlice/constants.js +1 -1
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.d.cts +1 -1
- package/dist/usersSlice/index.d.ts +1 -1
- package/dist/usersSlice/index.js +1 -1
- package/dist/usersSlice/mocks.d.cts +2 -3
- package/dist/usersSlice/mocks.d.ts +2 -3
- package/dist/usersSlice/mocks.js +1 -1
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.d.cts +10 -11
- package/dist/usersSlice/selectors.d.ts +10 -11
- package/dist/usersSlice/selectors.js +1 -1
- package/dist/usersSlice/thunks.d.cts +5 -6
- package/dist/usersSlice/thunks.d.ts +5 -6
- package/dist/utils.cjs +2 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +9 -9
package/dist/constants.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as locations, a as AvailablePlans, c as DARK_MODE, d as Plan, f as canAccess, g as emptyChartSelection, h as defaultReports, i as AvailableAddon, l as LIGHT_MODE, m as defaultReportType, n as Addon, o as BEGINNING_OF_TIME, p as chartTypes, r as AddonId, s as BENEFITS, t as ADDONS, u as PLANS, v as yes } from "./constants-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "./constants-
|
|
1
|
+
import { _ as locations, a as AvailablePlans, c as DARK_MODE, d as Plan, f as canAccess, g as emptyChartSelection, h as defaultReports, i as AvailableAddon, l as LIGHT_MODE, m as defaultReportType, n as Addon, o as BEGINNING_OF_TIME, p as chartTypes, r as AddonId, s as BENEFITS, t as ADDONS, u as PLANS, v as yes } from "./constants-nKSWZ8oD.js";
|
|
2
|
+
import { $ as scopedPermissionAreas, A as alertChannels, At as countries, B as deviceConnect, C as SORTING_OPTIONS, Ct as FilterOperator, D as UiPermissionsByIdKey, Dt as TIMEOUTS, E as UiPermissionsByAreaKey, Et as ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, F as deploymentsApiUrl, Ft as timeUnits, G as inventoryApiUrlV2, H as emptyUiPermissions, I as deploymentsApiUrlV1alpha1, J as limitDefault, K as inventoryApiUrlV2alpha1, L as deploymentsApiUrlV2, M as apiUrl, Mt as defaultIdAttribute, N as auditLogsApiUrl, Nt as emptyWebhook, O as UiPermissionsDefinition, Ot as UNGROUPED_GROUP, P as defaultPermissionSets, Pt as productOrder, Q as rolesByName, R as deviceAuthV2, S as Role, St as EXTERNAL_PROVIDER, T as SortOptions, Tt as MAX_PAGE_SIZE, U as headerNames, V as emptyRole, W as inventoryApiUrl, X as monitorApiUrlv1, Y as maxSessionAge, Z as rolesById, _ as PermissionObject, _t as emptyFilter, a as APPLICATION_JWT_CONTENT_TYPE, at as uiPermissionsByArea, b as PermissionTypes, bt as DEVICE_LIST_MAXIMUM_LENGTH, c as AuditLogPermission, ct as useradmApiUrlv1, d as DEVICE_LIST_DEFAULTS, dt as DEVICE_CONNECT_STATES, et as serviceProviderRolesById, f as DEVICE_STATES, ft as DEVICE_DISMISSAL_STATE, g as PaginationOptions, gt as REPORT_CHART_SIZE_LIMIT, h as GroupsPermission, ht as DeviceAuthState, i as APPLICATION_JSON_CONTENT_TYPE, it as twoFAStates, j as apiRoot, jt as credentialTypes, k as UserManagementPermission, kt as Webhook, l as DEVICE_FILTERING_OPTIONS, lt as useradmApiUrlv2, m as DeviceIssueOptionKey, mt as DEVICE_MESSAGE_TYPES, n as ALL_DEVICE_STATES, nt as tenantadmApiUrlv1, o as ATTRIBUTE_SCOPES, ot as uiPermissionsById, p as DeploymentPermission, pt as DEVICE_MESSAGE_PROTOCOLS, q as iotManagerBaseURL, r as ALL_RELEASES, rt as tenantadmApiUrlv2, s as AnyPermission, st as useradmApiUrl, t as ALL_DEVICES, tt as ssoIdpApiUrlv1, u as DEVICE_ISSUE_OPTIONS, ut as AlertChannelKey, v as PermissionSet, vt as geoAttributes, w as ScopedPermissionsByAreaKey, wt as IdAttribute, x as ReleasesPermission, xt as DEVICE_ONLINE_CUTOFF, y as PermissionSetId, yt as ATTRIBUTE_SCOPE_LABELS, z as deviceConfig } from "./constants-B_H4squx.js";
|
|
3
|
+
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "./constants-C6TIYaY4.js";
|
|
4
4
|
import { i as orderedOnboardingSteps, n as OnboardingStepKey, r as onboardingSteps, t as OnboardingStep } from "./constants-Db_RBdlV.js";
|
|
5
5
|
import { a as SSO_TYPES, c as auditlogTypes, i as SP_AUDIT_LOGS_TYPES, l as getOidcStartUrl, n as ContentType, o as TENANT_LIST_DEFAULT, r as JSON_METADATA_FORMAT, s as XML_METADATA_FORMAT, t as AUDIT_LOGS_TYPES, u as getSamlStartUrl } from "./constants-OZiiFKiA.js";
|
|
6
|
-
import { a as
|
|
7
|
-
import { a as USER_LOGOUT, c as itemUiPermissionsReducer, i as ReadState, l as settingsKeys, n as PermissionsArea, o as UiPermission, r as READ_STATES, s as checkPermissionsObject, t as OWN_USER_ID } from "./constants-
|
|
8
|
-
export { ADDONS, ALL_DEVICES, ALL_DEVICE_STATES, ALL_RELEASES, APPLICATION_JSON_CONTENT_TYPE, APPLICATION_JWT_CONTENT_TYPE, ARTIFACT_GENERATION_TYPE, ATTRIBUTE_SCOPES, ATTRIBUTE_SCOPE_LABELS, AUDIT_LOGS_TYPES, Addon, AddonId, AlertChannelKey, type AnyPermission, type AuditLogPermission, AvailableAddon, AvailablePlans, BEGINNING_OF_TIME, BENEFITS, ContentType, DARK_MODE, DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_DEFAULTS, DEVICE_LIST_MAXIMUM_LENGTH, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DEVICE_ONLINE_CUTOFF, DEVICE_STATES, type DeploymentPermission, DeploymentSubstateMapping, DeviceAuthState, type DeviceIssueOptionKey, EXTERNAL_PROVIDER, FilterOperator, type GroupsPermission, IdAttribute, JSON_METADATA_FORMAT, LIGHT_MODE, MAX_PAGE_SIZE, ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, OWN_USER_ID, OnboardingStep, OnboardingStepKey, PLANS, type PaginationOptions, type PermissionObject, type PermissionSet, type PermissionSetId, PermissionTypes, PermissionsArea, Plan, READ_STATES, REPORT_CHART_SIZE_LIMIT, ReadState, type ReleasesPermission, type Role, SORTING_OPTIONS, SP_AUDIT_LOGS_TYPES, SSO_TYPES, type ScopedPermissionsByAreaKey, type SortOptions, TENANT_LIST_DEFAULT, TIMEOUTS, UNGROUPED_GROUP, USER_LOGOUT, UiPermission, type UiPermissionsByAreaKey, type UiPermissionsByIdKey, type UiPermissionsDefinition, type UserManagementPermission, Webhook, XML_METADATA_FORMAT, alertChannels, apiRoot, apiUrl, auditLogsApiUrl, auditlogTypes, canAccess, chartTypes, checkPermissionsObject, countries, credentialTypes, currentArtifact, defaultIdAttribute, defaultPermissionSets, defaultReportType, defaultReports, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, deploymentsApiUrl, deploymentsApiUrlV1alpha1, deploymentsApiUrlV2, deviceAuthV2, deviceConfig, deviceConnect, emptyChartSelection, emptyFilter, emptyRole, emptyUiPermissions, emptyWebhook, geoAttributes, getOidcStartUrl, getSamlStartUrl, headerNames, installationSubstatesMap, inventoryApiUrl, inventoryApiUrlV2, iotManagerBaseURL, itemUiPermissionsReducer, limitDefault, listDefaultsByState, locations, maxSessionAge, monitorApiUrlv1, onboardingSteps, orderedOnboardingSteps, pauseMap, productOrder, rolesById, rolesByName, rootfsImageVersion, scopedPermissionAreas, serviceProviderRolesById, settingsKeys, softwareIndicator, softwareTitleMap, ssoIdpApiUrlv1, tenantadmApiUrlv1, tenantadmApiUrlv2, timeUnits, twoFAStates, uiPermissionsByArea, uiPermissionsById, useradmApiUrl, useradmApiUrlv1, useradmApiUrlv2, yes };
|
|
6
|
+
import { a as softwareIndicator, i as rootfsManifestVersion, n as currentArtifact, o as softwareTitleMap, r as rootfsImageVersion, t as ARTIFACT_GENERATION_TYPE } from "./constants-CEwun8TL.js";
|
|
7
|
+
import { a as USER_LOGOUT, c as itemUiPermissionsReducer, i as ReadState, l as settingsKeys, n as PermissionsArea, o as UiPermission, r as READ_STATES, s as checkPermissionsObject, t as OWN_USER_ID } from "./constants-B3Jdkn2b.js";
|
|
8
|
+
export { ADDONS, ALL_DEVICES, ALL_DEVICE_STATES, ALL_RELEASES, APPLICATION_JSON_CONTENT_TYPE, APPLICATION_JWT_CONTENT_TYPE, ARTIFACT_GENERATION_TYPE, ATTRIBUTE_SCOPES, ATTRIBUTE_SCOPE_LABELS, AUDIT_LOGS_TYPES, Addon, AddonId, AlertChannelKey, type AnyPermission, type AuditLogPermission, AvailableAddon, AvailablePlans, BEGINNING_OF_TIME, BENEFITS, ContentType, DARK_MODE, DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_DEFAULTS, DEVICE_LIST_MAXIMUM_LENGTH, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DEVICE_ONLINE_CUTOFF, DEVICE_STATES, type DeploymentPermission, DeploymentSubstateMapping, DeviceAuthState, type DeviceIssueOptionKey, EXTERNAL_PROVIDER, FilterOperator, type GroupsPermission, IdAttribute, JSON_METADATA_FORMAT, LIGHT_MODE, MAX_PAGE_SIZE, ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, OWN_USER_ID, OnboardingStep, OnboardingStepKey, PLANS, type PaginationOptions, type PermissionObject, type PermissionSet, type PermissionSetId, PermissionTypes, PermissionsArea, Plan, READ_STATES, REPORT_CHART_SIZE_LIMIT, ReadState, type ReleasesPermission, type Role, SORTING_OPTIONS, SP_AUDIT_LOGS_TYPES, SSO_TYPES, type ScopedPermissionsByAreaKey, type SortOptions, TENANT_LIST_DEFAULT, TIMEOUTS, UNGROUPED_GROUP, USER_LOGOUT, UiPermission, type UiPermissionsByAreaKey, type UiPermissionsByIdKey, type UiPermissionsDefinition, type UserManagementPermission, Webhook, XML_METADATA_FORMAT, alertChannels, apiRoot, apiUrl, auditLogsApiUrl, auditlogTypes, canAccess, chartTypes, checkPermissionsObject, countries, credentialTypes, currentArtifact, defaultIdAttribute, defaultPermissionSets, defaultReportType, defaultReports, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, deploymentsApiUrl, deploymentsApiUrlV1alpha1, deploymentsApiUrlV2, deviceAuthV2, deviceConfig, deviceConnect, emptyChartSelection, emptyFilter, emptyRole, emptyUiPermissions, emptyWebhook, geoAttributes, getOidcStartUrl, getSamlStartUrl, headerNames, installationSubstatesMap, inventoryApiUrl, inventoryApiUrlV2, inventoryApiUrlV2alpha1, iotManagerBaseURL, itemUiPermissionsReducer, limitDefault, listDefaultsByState, locations, maxSessionAge, monitorApiUrlv1, onboardingSteps, orderedOnboardingSteps, pauseMap, productOrder, rolesById, rolesByName, rootfsImageVersion, rootfsManifestVersion, scopedPermissionAreas, serviceProviderRolesById, settingsKeys, softwareIndicator, softwareTitleMap, ssoIdpApiUrlv1, tenantadmApiUrlv1, tenantadmApiUrlv2, timeUnits, twoFAStates, uiPermissionsByArea, uiPermissionsById, useradmApiUrl, useradmApiUrlv1, useradmApiUrlv2, yes };
|
package/dist/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ADDONS, BEGINNING_OF_TIME, BENEFITS, DARK_MODE, LIGHT_MODE, PLANS, canAccess, chartTypes, defaultReportType, defaultReports, emptyChartSelection, locations, yes } from "./appSlice/constants.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as AUDIT_LOGS_TYPES, A as iotManagerBaseURL, At as DEVICE_ONLINE_CUTOFF, B as tenantadmApiUrlv2, Bt as productOrder, C as deviceConnect, Ct as deploymentStatesToSubstatesWithSkipped, D as inventoryApiUrl, Dt as pauseMap, E as headerNames, Et as listDefaultsByState, F as rolesByName, Ft as UNGROUPED_GROUP, G as useradmApiUrlv1, H as uiPermissionsByArea, I as scopedPermissionAreas, It as countries, J as READ_STATES, K as useradmApiUrlv2, L as serviceProviderRolesById, Lt as credentialTypes, M as maxSessionAge, Mt as MAX_PAGE_SIZE, N as monitorApiUrlv1, Nt as ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, O as inventoryApiUrlV2, Ot as ATTRIBUTE_SCOPE_LABELS, P as rolesById, Pt as TIMEOUTS, Q as settingsKeys, R as ssoIdpApiUrlv1, Rt as defaultIdAttribute, S as deviceConfig, St as deploymentStatesToSubstates, T as emptyUiPermissions, Tt as installationSubstatesMap, U as uiPermissionsById, V as twoFAStates, Vt as timeUnits, W as useradmApiUrl, X as checkPermissionsObject, Y as USER_LOGOUT, Z as itemUiPermissionsReducer, _ as defaultPermissionSets, _t as DEPLOYMENT_STATES, a as APPLICATION_JWT_CONTENT_TYPE, at as auditlogTypes, b as deploymentsApiUrlV2, bt as deploymentDisplayStates, c as DEVICE_ISSUE_OPTIONS, ct as DEVICE_CONNECT_STATES, d as PermissionTypes, dt as DEVICE_MESSAGE_TYPES, et as JSON_METADATA_FORMAT, f as SORTING_OPTIONS, ft as REPORT_CHART_SIZE_LIMIT, g as auditLogsApiUrl, gt as DEPLOYMENT_ROUTES, h as apiUrl, ht as DEFAULT_PENDING_INPROGRESS_COUNT, i as APPLICATION_JSON_CONTENT_TYPE, it as XML_METADATA_FORMAT, j as limitDefault, jt as EXTERNAL_PROVIDER, k as inventoryApiUrlV2alpha1, kt as DEVICE_LIST_MAXIMUM_LENGTH, l as DEVICE_LIST_DEFAULTS, lt as DEVICE_DISMISSAL_STATE, m as apiRoot, mt as geoAttributes, n as ALL_DEVICE_STATES, nt as SSO_TYPES, o as ATTRIBUTE_SCOPES, ot as getOidcStartUrl, p as alertChannels, pt as emptyFilter, q as OWN_USER_ID, r as ALL_RELEASES, rt as TENANT_LIST_DEFAULT, s as DEVICE_FILTERING_OPTIONS, st as getSamlStartUrl, t as ALL_DEVICES, tt as SP_AUDIT_LOGS_TYPES, u as DEVICE_STATES, ut as DEVICE_MESSAGE_PROTOCOLS, v as deploymentsApiUrl, vt as DEPLOYMENT_TYPES, w as emptyRole, wt as deploymentSubstates, x as deviceAuthV2, xt as deploymentPrototype, y as deploymentsApiUrlV1alpha1, yt as defaultStats, z as tenantadmApiUrlv1, zt as emptyWebhook } from "./constants-CerzXHnQ.js";
|
|
3
3
|
import { onboardingSteps, orderedOnboardingSteps } from "./onboardingSlice/constants.js";
|
|
4
|
-
import { ARTIFACT_GENERATION_TYPE, currentArtifact, rootfsImageVersion, softwareIndicator, softwareTitleMap } from "./releasesSlice/constants.js";
|
|
5
|
-
export { ADDONS, ALL_DEVICES, ALL_DEVICE_STATES, ALL_RELEASES, APPLICATION_JSON_CONTENT_TYPE, APPLICATION_JWT_CONTENT_TYPE, ARTIFACT_GENERATION_TYPE, ATTRIBUTE_SCOPES, ATTRIBUTE_SCOPE_LABELS, AUDIT_LOGS_TYPES, BEGINNING_OF_TIME, BENEFITS, DARK_MODE, DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_DEFAULTS, DEVICE_LIST_MAXIMUM_LENGTH, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DEVICE_ONLINE_CUTOFF, DEVICE_STATES, EXTERNAL_PROVIDER, JSON_METADATA_FORMAT, LIGHT_MODE, MAX_PAGE_SIZE, ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, OWN_USER_ID, PLANS, PermissionTypes, READ_STATES, REPORT_CHART_SIZE_LIMIT, SORTING_OPTIONS, SP_AUDIT_LOGS_TYPES, SSO_TYPES, TENANT_LIST_DEFAULT, TIMEOUTS, UNGROUPED_GROUP, USER_LOGOUT, XML_METADATA_FORMAT, alertChannels, apiRoot, apiUrl, auditLogsApiUrl, auditlogTypes, canAccess, chartTypes, checkPermissionsObject, countries, credentialTypes, currentArtifact, defaultIdAttribute, defaultPermissionSets, defaultReportType, defaultReports, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, deploymentsApiUrl, deploymentsApiUrlV1alpha1, deploymentsApiUrlV2, deviceAuthV2, deviceConfig, deviceConnect, emptyChartSelection, emptyFilter, emptyRole, emptyUiPermissions, emptyWebhook, geoAttributes, getOidcStartUrl, getSamlStartUrl, headerNames, installationSubstatesMap, inventoryApiUrl, inventoryApiUrlV2, iotManagerBaseURL, itemUiPermissionsReducer, limitDefault, listDefaultsByState, locations, maxSessionAge, monitorApiUrlv1, onboardingSteps, orderedOnboardingSteps, pauseMap, productOrder, rolesById, rolesByName, rootfsImageVersion, scopedPermissionAreas, serviceProviderRolesById, settingsKeys, softwareIndicator, softwareTitleMap, ssoIdpApiUrlv1, tenantadmApiUrlv1, tenantadmApiUrlv2, timeUnits, twoFAStates, uiPermissionsByArea, uiPermissionsById, useradmApiUrl, useradmApiUrlv1, useradmApiUrlv2, yes };
|
|
4
|
+
import { ARTIFACT_GENERATION_TYPE, currentArtifact, rootfsImageVersion, rootfsManifestVersion, softwareIndicator, softwareTitleMap } from "./releasesSlice/constants.js";
|
|
5
|
+
export { ADDONS, ALL_DEVICES, ALL_DEVICE_STATES, ALL_RELEASES, APPLICATION_JSON_CONTENT_TYPE, APPLICATION_JWT_CONTENT_TYPE, ARTIFACT_GENERATION_TYPE, ATTRIBUTE_SCOPES, ATTRIBUTE_SCOPE_LABELS, AUDIT_LOGS_TYPES, BEGINNING_OF_TIME, BENEFITS, DARK_MODE, DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_FILTERING_OPTIONS, DEVICE_ISSUE_OPTIONS, DEVICE_LIST_DEFAULTS, DEVICE_LIST_MAXIMUM_LENGTH, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DEVICE_ONLINE_CUTOFF, DEVICE_STATES, EXTERNAL_PROVIDER, JSON_METADATA_FORMAT, LIGHT_MODE, MAX_PAGE_SIZE, ORCHESTRATOR_MANIFEST_ATTRIBUTE_PREFIX, OWN_USER_ID, PLANS, PermissionTypes, READ_STATES, REPORT_CHART_SIZE_LIMIT, SORTING_OPTIONS, SP_AUDIT_LOGS_TYPES, SSO_TYPES, TENANT_LIST_DEFAULT, TIMEOUTS, UNGROUPED_GROUP, USER_LOGOUT, XML_METADATA_FORMAT, alertChannels, apiRoot, apiUrl, auditLogsApiUrl, auditlogTypes, canAccess, chartTypes, checkPermissionsObject, countries, credentialTypes, currentArtifact, defaultIdAttribute, defaultPermissionSets, defaultReportType, defaultReports, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, deploymentsApiUrl, deploymentsApiUrlV1alpha1, deploymentsApiUrlV2, deviceAuthV2, deviceConfig, deviceConnect, emptyChartSelection, emptyFilter, emptyRole, emptyUiPermissions, emptyWebhook, geoAttributes, getOidcStartUrl, getSamlStartUrl, headerNames, installationSubstatesMap, inventoryApiUrl, inventoryApiUrlV2, inventoryApiUrlV2alpha1, iotManagerBaseURL, itemUiPermissionsReducer, limitDefault, listDefaultsByState, locations, maxSessionAge, monitorApiUrlv1, onboardingSteps, orderedOnboardingSteps, pauseMap, productOrder, rolesById, rolesByName, rootfsImageVersion, rootfsManifestVersion, scopedPermissionAreas, serviceProviderRolesById, settingsKeys, softwareIndicator, softwareTitleMap, ssoIdpApiUrlv1, tenantadmApiUrlv1, tenantadmApiUrlv2, timeUnits, twoFAStates, uiPermissionsByArea, uiPermissionsById, useradmApiUrl, useradmApiUrlv1, useradmApiUrlv2, yes };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "../constants-
|
|
1
|
+
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "../constants-C6TIYaY4.cjs";
|
|
2
2
|
export { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DeploymentSubstateMapping, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, installationSubstatesMap, listDefaultsByState, pauseMap };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "../constants-
|
|
1
|
+
import { a as DeploymentSubstateMapping, c as deploymentPrototype, d as deploymentSubstates, f as installationSubstatesMap, i as DEPLOYMENT_TYPES, l as deploymentStatesToSubstates, m as pauseMap, n as DEPLOYMENT_ROUTES, o as defaultStats, p as listDefaultsByState, r as DEPLOYMENT_STATES, s as deploymentDisplayStates, t as DEFAULT_PENDING_INPROGRESS_COUNT, u as deploymentStatesToSubstatesWithSkipped } from "../constants-C6TIYaY4.js";
|
|
2
2
|
export { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, DeploymentSubstateMapping, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, installationSubstatesMap, listDefaultsByState, pauseMap };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { Ct as deploymentStatesToSubstatesWithSkipped, Dt as pauseMap, Et as listDefaultsByState, St as deploymentStatesToSubstates, Tt as installationSubstatesMap, _t as DEPLOYMENT_STATES, bt as deploymentDisplayStates, gt as DEPLOYMENT_ROUTES, ht as DEFAULT_PENDING_INPROGRESS_COUNT, vt as DEPLOYMENT_TYPES, wt as deploymentSubstates, xt as deploymentPrototype, yt as defaultStats } from "../constants-CerzXHnQ.js";
|
|
2
2
|
export { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, DEPLOYMENT_TYPES, defaultStats, deploymentDisplayStates, deploymentPrototype, deploymentStatesToSubstates, deploymentStatesToSubstatesWithSkipped, deploymentSubstates, installationSubstatesMap, listDefaultsByState, pauseMap };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["limitDefault","DEVICE_LIST_DEFAULTS","DEPLOYMENT_ROUTES","deploymentPrototype","DEPLOYMENT_STATES"],"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.\nimport type {\n DeploymentV1 as BackendDeploymentV1,\n DeploymentV2 as BackendDeploymentV2,\n Filter as BackendFilter,\n DeviceWithImage,\n FilterPredicate,\n Limit,\n Scope\n} from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEVICE_LIST_DEFAULTS, limitDefault } from '../constants';\nimport { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, deploymentPrototype } from './constants';\n\nexport const sliceName = 'deployments';\n\ntype Filter = {\n key: string;\n operator: FilterPredicate['type'];\n scope: string;\n value: any;\n};\nexport type DeviceDeployment = DeviceWithImage & {\n deviceId: string;\n release: string;\n route: string;\n};\n\nexport type Deployment = BackendDeploymentV1 &\n BackendDeploymentV2 & {\n devices: Record<string, DeviceWithImage>;\n filter?: BackendFilter & { filters: Filter[]; name?: string; scope?: Scope };\n group?: string;\n totalDeviceCount: number;\n };\n\nexport type DeploymentStatus = { deploymentIds: string[]; total: number };\nexport type DeploymentByStatus = {\n finished: DeploymentStatus;\n inprogress: DeploymentStatus;\n pending: DeploymentStatus;\n scheduled: DeploymentStatus;\n};\nexport type DeploymentByStatusKey = keyof DeploymentByStatus;\nexport type DeploymentConfig = {\n binaryDelta: {\n compressionLevel: number;\n disableChecksum: boolean;\n disableDecompression: boolean;\n duplicatesWindow: number;\n inputWindow: number;\n instructionBuffer: number;\n sourceWindow: number;\n timeout: number;\n };\n binaryDeltaLimits: {\n duplicatesWindow: Limit;\n inputWindow: Limit;\n instructionBuffer: Limit;\n sourceWindow: Limit;\n timeout: Limit;\n };\n};\n\nexport type SelectionListState = {\n endDate?: string;\n page?: number;\n perPage?: number;\n search?: string;\n selection: string[];\n startDate?: string;\n total?: number;\n type?: string;\n};\nexport type SelectionState = {\n finished: SelectionListState;\n general: {\n reportType: string | null;\n showCreationDialog: boolean;\n showReportDialog: boolean;\n state: string;\n };\n inprogress: SelectionListState;\n pending: SelectionListState;\n scheduled: SelectionListState;\n\n selectedId?: string;\n};\n\nexport type DeploymentsSliceType = {\n byId: Record<string, Deployment>;\n byStatus: DeploymentByStatus;\n config: DeploymentConfig;\n deploymentDeviceLimit: number;\n selectedDeviceIds: string[];\n selectionState: SelectionState;\n};\n\nexport const initialState: DeploymentsSliceType = {\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 || 0) + 1;\n },\n removedDeployment: (state, action: PayloadAction<string>) => {\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: PayloadAction<Deployment>) => {\n state.byId[action.payload.id] = {\n ...(state.byId[action.payload.id] || {}),\n ...action.payload\n };\n },\n receivedDeploymentDeviceLog: (state, action: PayloadAction<{ deviceId: string; id: string; log: boolean }>) => {\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: (\n state,\n action: PayloadAction<{ devices: Record<string, DeviceWithImage>; id: string; selectedDeviceIds: string[]; totalDeviceCount: number }>\n ) => {\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: PayloadAction<Record<string, Deployment>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n receivedDeploymentsForStatus: (state, action: PayloadAction<{ deploymentIds: string[]; status: DeploymentByStatusKey; total: number }>) => {\n const { status, deploymentIds, total } = action.payload;\n state.byStatus[status].deploymentIds = deploymentIds;\n state.byStatus[status].total = total;\n },\n selectDeploymentsForStatus: (state, action: PayloadAction<{ deploymentIds: string[]; status: DeploymentByStatusKey; total: number }>) => {\n const { status, deploymentIds, total } = action.payload;\n state.selectionState[status].selection = deploymentIds;\n state.selectionState[status].total = total;\n },\n setDeploymentsState: (state, action: PayloadAction<SelectionState>) => {\n state.selectionState = action.payload;\n },\n setDeploymentsConfig: (state, action: PayloadAction<DeploymentConfig>) => {\n state.config = action.payload;\n }\n }\n});\n\nexport const actions = deploymentsSlice.actions;\nexport default deploymentsSlice.reducer;\n"],"mappings":";;;;;;;;AA4BA,MAAa,YAAY;AAoFzB,MAAa,eAAqC;CAChD,MAAM,CAEN;CACA,UAAU;EACR,UAAU;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EACxC,YAAY;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EAC1C,SAAS;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EACvC,WAAW;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;CAC3C;CACA,QAAQ;EACN,aAAa;GACX,SAAS;GACT,kBAAkB;GAClB,kBAAkB;GAClB,iBAAiB;GACjB,sBAAsB;GACtB,aAAa;GACb,mBAAmB;GACnB,cAAc;EAChB;EACA,mBAAmB;GACjB,SAAS;IAAE,GAAGA,+BAAAA;IAAc,SAAS;IAAI,KAAK;IAAM,KAAK;GAAG;GAC5D,cAAcA,+BAAAA;GACd,aAAaA,+BAAAA;GACb,kBAAkBA,+BAAAA;GAClB,mBAAmBA,+BAAAA;EAC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IST_DEFAULTS","DEPLOYMENT_ROUTES","createSlice","deploymentPrototype","DEPLOYMENT_STATES"],"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.\nimport type {\n DeploymentV1 as BackendDeploymentV1,\n DeploymentV2 as BackendDeploymentV2,\n Filter as BackendFilter,\n DeviceWithImage,\n FilterPredicate,\n Limit,\n Scope\n} from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { DEVICE_LIST_DEFAULTS, limitDefault } from '../constants';\nimport { DEFAULT_PENDING_INPROGRESS_COUNT, DEPLOYMENT_ROUTES, DEPLOYMENT_STATES, deploymentPrototype } from './constants';\n\nexport const sliceName = 'deployments';\n\ntype Filter = {\n key: string;\n operator: FilterPredicate['type'];\n scope: string;\n value: any;\n};\nexport type DeviceDeployment = DeviceWithImage & {\n deviceId: string;\n release: string;\n route: string;\n};\n\nexport type Deployment = BackendDeploymentV1 &\n BackendDeploymentV2 & {\n devices: Record<string, DeviceWithImage>;\n filter?: BackendFilter & { filters: Filter[]; name?: string; scope?: Scope };\n group?: string;\n totalDeviceCount: number;\n };\n\nexport type DeploymentStatus = { deploymentIds: string[]; total: number };\nexport type DeploymentByStatus = {\n finished: DeploymentStatus;\n inprogress: DeploymentStatus;\n pending: DeploymentStatus;\n scheduled: DeploymentStatus;\n};\nexport type DeploymentByStatusKey = keyof DeploymentByStatus;\nexport type DeploymentConfig = {\n binaryDelta: {\n compressionLevel: number;\n disableChecksum: boolean;\n disableDecompression: boolean;\n duplicatesWindow: number;\n inputWindow: number;\n instructionBuffer: number;\n sourceWindow: number;\n timeout: number;\n };\n binaryDeltaLimits: {\n duplicatesWindow: Limit;\n inputWindow: Limit;\n instructionBuffer: Limit;\n sourceWindow: Limit;\n timeout: Limit;\n };\n};\n\nexport type SelectionListState = {\n endDate?: string;\n page?: number;\n perPage?: number;\n search?: string;\n selection: string[];\n startDate?: string;\n total?: number;\n type?: string;\n};\nexport type SelectionState = {\n finished: SelectionListState;\n general: {\n reportType: string | null;\n showCreationDialog: boolean;\n showReportDialog: boolean;\n state: string;\n };\n inprogress: SelectionListState;\n pending: SelectionListState;\n scheduled: SelectionListState;\n\n selectedId?: string;\n};\n\nexport type DeploymentsSliceType = {\n byId: Record<string, Deployment>;\n byStatus: DeploymentByStatus;\n config: DeploymentConfig;\n deploymentDeviceLimit: number;\n selectedDeviceIds: string[];\n selectionState: SelectionState;\n};\n\nexport const initialState: DeploymentsSliceType = {\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 || 0) + 1;\n },\n removedDeployment: (state, action: PayloadAction<string>) => {\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: PayloadAction<Deployment>) => {\n state.byId[action.payload.id] = {\n ...(state.byId[action.payload.id] || {}),\n ...action.payload\n };\n },\n receivedDeploymentDeviceLog: (state, action: PayloadAction<{ deviceId: string; id: string; log: boolean }>) => {\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: (\n state,\n action: PayloadAction<{ devices: Record<string, DeviceWithImage>; id: string; selectedDeviceIds: string[]; totalDeviceCount: number }>\n ) => {\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: PayloadAction<Record<string, Deployment>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n receivedDeploymentsForStatus: (state, action: PayloadAction<{ deploymentIds: string[]; status: DeploymentByStatusKey; total: number }>) => {\n const { status, deploymentIds, total } = action.payload;\n state.byStatus[status].deploymentIds = deploymentIds;\n state.byStatus[status].total = total;\n },\n selectDeploymentsForStatus: (state, action: PayloadAction<{ deploymentIds: string[]; status: DeploymentByStatusKey; total: number }>) => {\n const { status, deploymentIds, total } = action.payload;\n state.selectionState[status].selection = deploymentIds;\n state.selectionState[status].total = total;\n },\n setDeploymentsState: (state, action: PayloadAction<SelectionState>) => {\n state.selectionState = action.payload;\n },\n setDeploymentsConfig: (state, action: PayloadAction<DeploymentConfig>) => {\n state.config = action.payload;\n }\n }\n});\n\nexport const actions = deploymentsSlice.actions;\nexport default deploymentsSlice.reducer;\n"],"mappings":";;;;;;;;AA4BA,MAAa,YAAY;AAoFzB,MAAa,eAAqC;CAChD,MAAM,CAEN;CACA,UAAU;EACR,UAAU;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EACxC,YAAY;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EAC1C,SAAS;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;EACvC,WAAW;GAAE,eAAe,CAAC;GAAG,OAAO;EAAE;CAC3C;CACA,QAAQ;EACN,aAAa;GACX,SAAS;GACT,kBAAkB;GAClB,kBAAkB;GAClB,iBAAiB;GACjB,sBAAsB;GACtB,aAAa;GACb,mBAAmB;GACnB,cAAc;EAChB;EACA,mBAAmB;GACjB,SAAS;IAAE,GAAGA,+BAAAA;IAAc,SAAS;IAAI,KAAK;IAAM,KAAK;GAAG;GAC5D,cAAcA,+BAAAA;G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AA,2BAAe,iBAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DeploymentStatus, c as SelectionListState, d as actions, f as deploymentsSlice, i as DeploymentConfig, l as SelectionState, m as sliceName, n as DeploymentByStatus, o as DeploymentsSliceType, p as initialState, r as DeploymentByStatusKey, s as DeviceDeployment, t as Deployment, u as _default } from "../index-
|
|
1
|
+
import { a as DeploymentStatus, c as SelectionListState, d as actions, f as deploymentsSlice, i as DeploymentConfig, l as SelectionState, m as sliceName, n as DeploymentByStatus, o as DeploymentsSliceType, p as initialState, r as DeploymentByStatusKey, s as DeviceDeployment, t as Deployment, u as _default } from "../index-mvxjivTJ.cjs";
|
|
2
2
|
export { Deployment, DeploymentByStatus, DeploymentByStatusKey, DeploymentConfig, DeploymentStatus, DeploymentsSliceType, DeviceDeployment, SelectionListState, SelectionState, actions, _default as default, deploymentsSlice, initialState, sliceName };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DeploymentStatus, c as SelectionListState, d as actions, f as deploymentsSlice, i as DeploymentConfig, l as SelectionState, m as sliceName, n as DeploymentByStatus, o as DeploymentsSliceType, p as initialState, r as DeploymentByStatusKey, s as DeviceDeployment, t as Deployment, u as _default } from "../index-
|
|
1
|
+
import { a as DeploymentStatus, c as SelectionListState, d as actions, f as deploymentsSlice, i as DeploymentConfig, l as SelectionState, m as sliceName, n as DeploymentByStatus, o as DeploymentsSliceType, p as initialState, r as DeploymentByStatusKey, s as DeviceDeployment, t as Deployment, u as _default } from "../index-B8td4-rY.js";
|
|
2
2
|
export { Deployment, DeploymentByStatus, DeploymentByStatusKey, DeploymentConfig, DeploymentStatus, DeploymentsSliceType, DeviceDeployment, SelectionListState, SelectionState, actions, _default as default, deploymentsSlice, initialState, sliceName };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _t as DEPLOYMENT_STATES, gt as DEPLOYMENT_ROUTES, j as limitDefault, l as DEVICE_LIST_DEFAULTS, xt as deploymentPrototype } from "../constants-CerzXHnQ.js";
|
|
2
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
3
3
|
//#region src/deploymentsSlice/index.ts
|
|
4
4
|
const sliceName = "deployments";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.cjs","names":["DEPLOYMENT_STATES"],"sources":["../../src/deploymentsSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport type { Deployment } from '.';\nimport type { RootState } from '../store';\nimport { DEPLOYMENT_STATES } from './constants';\n\nexport const getDeploymentsById = (state: RootState) => state.deployments.byId;\nexport const getDeploymentsByStatus = (state: RootState) => state.deployments.byStatus;\nexport const getSelectedDeploymentDeviceIds = (state: RootState) => state.deployments.selectedDeviceIds;\nexport const getDeploymentsSelectionState = (state: RootState) => state.deployments.selectionState;\n\nexport const getDeploymentById = createSelector(\n [getDeploymentsById, (_, deploymentId) => deploymentId],\n (deploymentsById, deploymentId = '') => deploymentsById[deploymentId]\n);\n\nexport const getMappedDeploymentSelection = createSelector(\n [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],\n (selectionState, deploymentsState, deploymentsById) => {\n const { selection = [] } = selectionState[deploymentsState] ?? {};\n return selection.reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, []);\n }\n);\n\nconst relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished] as const;\nexport const DEPLOYMENT_CUTOFF = 3;\nexport const getRecentDeployments = createSelector([getDeploymentsById, getDeploymentsByStatus], (deploymentsById, deploymentsByStatus) =>\n Object.entries(deploymentsByStatus).reduce(\n (accu, [state, byStatus]) => {\n if (!relevantDeploymentStates.includes(state as (typeof relevantDeploymentStates)[number]) || !byStatus.deploymentIds.length) {\n return accu;\n }\n accu[state] = byStatus.deploymentIds\n .reduce<Deployment[]>((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, [])\n .slice(0, DEPLOYMENT_CUTOFF);\n accu.total += byStatus.total;\n return accu;\n },\n { total: 0 }\n )\n);\n"],"mappings":";;;;AAmBA,MAAa,sBAAsB,UAAqB,MAAM,YAAY;AAC1E,MAAa,0BAA0B,UAAqB,MAAM,YAAY;AAC9E,MAAa,kCAAkC,UAAqB,MAAM,YAAY;AACtF,MAAa,gCAAgC,UAAqB,MAAM,YAAY;AAEpF,MAAa,qBAAA,
|
|
1
|
+
{"version":3,"file":"selectors.cjs","names":["createSelector","DEPLOYMENT_STATES"],"sources":["../../src/deploymentsSlice/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 { createSelector } from '@reduxjs/toolkit';\n\nimport type { Deployment } from '.';\nimport type { RootState } from '../store';\nimport { DEPLOYMENT_STATES } from './constants';\n\nexport const getDeploymentsById = (state: RootState) => state.deployments.byId;\nexport const getDeploymentsByStatus = (state: RootState) => state.deployments.byStatus;\nexport const getSelectedDeploymentDeviceIds = (state: RootState) => state.deployments.selectedDeviceIds;\nexport const getDeploymentsSelectionState = (state: RootState) => state.deployments.selectionState;\n\nexport const getDeploymentById = createSelector(\n [getDeploymentsById, (_, deploymentId) => deploymentId],\n (deploymentsById, deploymentId = '') => deploymentsById[deploymentId]\n);\n\nexport const getMappedDeploymentSelection = createSelector(\n [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],\n (selectionState, deploymentsState, deploymentsById) => {\n const { selection = [] } = selectionState[deploymentsState] ?? {};\n return selection.reduce((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, []);\n }\n);\n\nconst relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished] as const;\nexport const DEPLOYMENT_CUTOFF = 3;\nexport const getRecentDeployments = createSelector([getDeploymentsById, getDeploymentsByStatus], (deploymentsById, deploymentsByStatus) =>\n Object.entries(deploymentsByStatus).reduce(\n (accu, [state, byStatus]) => {\n if (!relevantDeploymentStates.includes(state as (typeof relevantDeploymentStates)[number]) || !byStatus.deploymentIds.length) {\n return accu;\n }\n accu[state] = byStatus.deploymentIds\n .reduce<Deployment[]>((accu, id) => {\n if (deploymentsById[id]) {\n accu.push(deploymentsById[id]);\n }\n return accu;\n }, [])\n .slice(0, DEPLOYMENT_CUTOFF);\n accu.total += byStatus.total;\n return accu;\n },\n { total: 0 }\n )\n);\n"],"mappings":";;;;AAmBA,MAAa,sBAAsB,UAAqB,MAAM,YAAY;AAC1E,MAAa,0BAA0B,UAAqB,MAAM,YAAY;AAC9E,MAAa,kCAAkC,UAAqB,MAAM,YAAY;AACtF,MAAa,gCAAgC,UAAqB,MAAM,YAAY;AAEpF,MAAa,qBAAA,GAAoBA,iBAAAA,eAAAA,CAC/B,CAAC,qBAAqB,GAAG,iBAAiB,YAAY,IACrD,iBAAiB,eAAe,OAAO,gBAAgB,aAC1D;AAEA,MAAa,gCAAA,GAA+BA,iBAAAA,eAAAA,CAC1C;CAAC;EAA+B,GAAG,qBAAqB;CAAkB;AAAkB,IAC3F,gBAAgB,kBAAkB,oBAAoB;CACrD,MAAM,EAAE,YAAY,CAAC,MAAM,eAAe,qBAAqB,CAAC;CAChE,OAAO,UAAU,QAAQ,MAAM,OAAO;EACpC,IAAI,gBAAgB,KAClB,KAAK,KAAK,gBAAgB,GAAG;EAE/B,OAAO;CACT,GAAG,CAAC,CAAC;AACP,CACF;AAEA,MAAM,2BAA2B;CAACC,kBAAAA,kBAAkB;CAASA,kBAAAA,kBAAkB;CAAYA,kBAAAA,kBAAkB;AAAQ;AACrH,MAAa,oBAAoB;AACjC,MAAa,wBAAA,GAAuBD,iBAAAA,eAAAA,CAAe,CAAC,oBAAoB,sBAAsB,IAAI,iBAAiB,wBACjH,OAAO,QAAQ,mBAAmB,CAAC,CAAC,QACjC,MAAM,CAAC,OAAO,cAAc;CAC3B,IAAI,CAAC,yBAAyB,SAAS,KAAkD,KAAK,CAAC,SAAS,cAAc,QACpH,OAAO;CAET,KAAK,SAAS,SAAS,cACpB,QAAsB,MAAM,OAAO;EAClC,IAAI,gBAAgB,KAClB,KAAK,KAAK,gBAAgB,GAAG;EAE/B,OAAO;CACT,GAAG,CAAC,CAAC,CAAC,CACL,MAAM,GAAA,CAAoB;CAC7B,KAAK,SAAS,SAAS;CACvB,OAAO;AACT,GACA,EAAE,OAAO,EAAE,CACb,CACF"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { o as UserSliceType } from "../index-
|
|
2
|
-
import { i as ReleaseSliceType } from "../index-
|
|
3
|
-
import { n as OnboardingSliceType } from "../index-
|
|
4
|
-
import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-
|
|
5
|
-
import {
|
|
6
|
-
import { t as AppSliceType } from "../index-
|
|
7
|
-
import { t as MonitorSliceType } from "../index-
|
|
8
|
-
import { t as OrganizationSliceType } from "../index-
|
|
9
|
-
import { r as RootState } from "../store-
|
|
10
|
-
|
|
1
|
+
import { o as UserSliceType } from "../index-BgF6rhXn.cjs";
|
|
2
|
+
import { i as ReleaseSliceType } from "../index-DiAjzARZ.cjs";
|
|
3
|
+
import { n as OnboardingSliceType } from "../index-CoObjWL4.cjs";
|
|
4
|
+
import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-mvxjivTJ.cjs";
|
|
5
|
+
import { c as DeviceSliceType } from "../index-CiQ95u1W.cjs";
|
|
6
|
+
import { t as AppSliceType } from "../index-DeOpb2oK.cjs";
|
|
7
|
+
import { t as MonitorSliceType } from "../index-Ctj2r57a.cjs";
|
|
8
|
+
import { t as OrganizationSliceType } from "../index-C_LGDJN2.cjs";
|
|
9
|
+
import { r as RootState } from "../store-CUUm1GTI.cjs";
|
|
11
10
|
//#region src/deploymentsSlice/selectors.d.ts
|
|
12
11
|
declare const getDeploymentsById: (state: RootState) => Record<string, Deployment>;
|
|
13
12
|
declare const getDeploymentsByStatus: (state: RootState) => DeploymentByStatus;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { o as UserSliceType } from "../index-
|
|
2
|
-
import { i as ReleaseSliceType } from "../index-
|
|
3
|
-
import { n as OnboardingSliceType } from "../index-
|
|
4
|
-
import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-
|
|
5
|
-
import {
|
|
6
|
-
import { t as AppSliceType } from "../index-
|
|
7
|
-
import { t as MonitorSliceType } from "../index-
|
|
8
|
-
import { t as OrganizationSliceType } from "../index-
|
|
9
|
-
import { r as RootState } from "../store-
|
|
10
|
-
|
|
1
|
+
import { o as UserSliceType } from "../index-CpfhQHfg.js";
|
|
2
|
+
import { i as ReleaseSliceType } from "../index-C8uiyxnb.js";
|
|
3
|
+
import { n as OnboardingSliceType } from "../index-CoObjWL4.js";
|
|
4
|
+
import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-B8td4-rY.js";
|
|
5
|
+
import { c as DeviceSliceType } from "../index-Bvyf8OO6.js";
|
|
6
|
+
import { t as AppSliceType } from "../index-Bs0c1-WY.js";
|
|
7
|
+
import { t as MonitorSliceType } from "../index-BAGyeC-q.js";
|
|
8
|
+
import { t as OrganizationSliceType } from "../index-ChKTa1aL.js";
|
|
9
|
+
import { r as RootState } from "../store-CPptM5Ts.js";
|
|
11
10
|
//#region src/deploymentsSlice/selectors.d.ts
|
|
12
11
|
declare const getDeploymentsById: (state: RootState) => Record<string, Deployment>;
|
|
13
12
|
declare const getDeploymentsByStatus: (state: RootState) => DeploymentByStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _t as DEPLOYMENT_STATES } from "../constants-CerzXHnQ.js";
|
|
2
2
|
import { createSelector } from "@reduxjs/toolkit";
|
|
3
3
|
//#region src/deploymentsSlice/selectors.ts
|
|
4
4
|
const getDeploymentsById = (state) => state.deployments.byId;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { T as SortOptions } from "../constants-
|
|
2
|
-
import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-
|
|
3
|
-
import { t as Device$1 } from "../index-
|
|
4
|
-
import { i as SnackbarContent } from "../index-
|
|
5
|
-
import { r as RootState, t as AppDispatch } from "../store-
|
|
1
|
+
import { T as SortOptions } from "../constants-Rl3FJzFf.cjs";
|
|
2
|
+
import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-mvxjivTJ.cjs";
|
|
3
|
+
import { t as Device$1 } from "../index-CiQ95u1W.cjs";
|
|
4
|
+
import { i as SnackbarContent } from "../index-DeOpb2oK.cjs";
|
|
5
|
+
import { r as RootState, t as AppDispatch } from "../store-CUUm1GTI.cjs";
|
|
6
6
|
import { DeploymentV1, DeploymentV2, NewDeploymentForGroup, NewDeploymentTypeManagement, NewDeploymentV2TypeManagement } from "@northern.tech/types/MenderTypes";
|
|
7
|
-
|
|
8
7
|
//#region src/deploymentsSlice/thunks.d.ts
|
|
9
|
-
declare const deriveDeploymentGroup: ({
|
|
10
|
-
filter,
|
|
11
|
-
group,
|
|
12
|
-
groups,
|
|
13
|
-
name
|
|
14
|
-
}: Deployment) => string | undefined;
|
|
8
|
+
declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
|
|
15
9
|
type ReceivedDeployment = DeploymentV1 | DeploymentV2;
|
|
16
10
|
declare const transformDeployments: (deployments: ReceivedDeployment[], deploymentsById: Record<string, Deployment>) => {
|
|
17
11
|
deploymentIds: string[];
|
|
@@ -200,7 +194,7 @@ declare const updateDeploymentControlMap: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
200
194
|
fulfilledMeta?: unknown;
|
|
201
195
|
rejectedMeta?: unknown;
|
|
202
196
|
}>;
|
|
203
|
-
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] };
|
|
197
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; };
|
|
204
198
|
type SetDeploymentsStatePayload = DeepPartial<SelectionState> & {
|
|
205
199
|
page?: number;
|
|
206
200
|
perPage?: number;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { T as SortOptions } from "../constants-
|
|
2
|
-
import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-
|
|
3
|
-
import { t as Device$1 } from "../index-
|
|
4
|
-
import { i as SnackbarContent } from "../index-
|
|
5
|
-
import { r as RootState, t as AppDispatch } from "../store-
|
|
1
|
+
import { T as SortOptions } from "../constants-B_H4squx.js";
|
|
2
|
+
import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-B8td4-rY.js";
|
|
3
|
+
import { t as Device$1 } from "../index-Bvyf8OO6.js";
|
|
4
|
+
import { i as SnackbarContent } from "../index-Bs0c1-WY.js";
|
|
5
|
+
import { r as RootState, t as AppDispatch } from "../store-CPptM5Ts.js";
|
|
6
6
|
import { DeploymentV1, DeploymentV2, NewDeploymentForGroup, NewDeploymentTypeManagement, NewDeploymentV2TypeManagement } from "@northern.tech/types/MenderTypes";
|
|
7
|
-
|
|
8
7
|
//#region src/deploymentsSlice/thunks.d.ts
|
|
9
|
-
declare const deriveDeploymentGroup: ({
|
|
10
|
-
filter,
|
|
11
|
-
group,
|
|
12
|
-
groups,
|
|
13
|
-
name
|
|
14
|
-
}: Deployment) => string | undefined;
|
|
8
|
+
declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
|
|
15
9
|
type ReceivedDeployment = DeploymentV1 | DeploymentV2;
|
|
16
10
|
declare const transformDeployments: (deployments: ReceivedDeployment[], deploymentsById: Record<string, Deployment>) => {
|
|
17
11
|
deploymentIds: string[];
|
|
@@ -200,7 +194,7 @@ declare const updateDeploymentControlMap: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
200
194
|
fulfilledMeta?: unknown;
|
|
201
195
|
rejectedMeta?: unknown;
|
|
202
196
|
}>;
|
|
203
|
-
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] };
|
|
197
|
+
type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; };
|
|
204
198
|
type SetDeploymentsStatePayload = DeepPartial<SelectionState> & {
|
|
205
199
|
page?: number;
|
|
206
200
|
perPage?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _t as
|
|
1
|
+
import { _t as emptyFilter, dt as DEVICE_CONNECT_STATES, ft as DEVICE_DISMISSAL_STATE, gt as REPORT_CHART_SIZE_LIMIT, ht as DeviceAuthState, mt as DEVICE_MESSAGE_TYPES, pt as DEVICE_MESSAGE_PROTOCOLS, vt as geoAttributes } from "../constants-Rl3FJzFf.cjs";
|
|
2
2
|
export { DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DeviceAuthState, REPORT_CHART_SIZE_LIMIT, emptyFilter, geoAttributes };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _t as
|
|
1
|
+
import { _t as emptyFilter, dt as DEVICE_CONNECT_STATES, ft as DEVICE_DISMISSAL_STATE, gt as REPORT_CHART_SIZE_LIMIT, ht as DeviceAuthState, mt as DEVICE_MESSAGE_TYPES, pt as DEVICE_MESSAGE_PROTOCOLS, vt as geoAttributes } from "../constants-B_H4squx.js";
|
|
2
2
|
export { DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, DeviceAuthState, REPORT_CHART_SIZE_LIMIT, emptyFilter, geoAttributes };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ct as
|
|
1
|
+
import { ct as DEVICE_CONNECT_STATES, dt as DEVICE_MESSAGE_TYPES, ft as REPORT_CHART_SIZE_LIMIT, lt as DEVICE_DISMISSAL_STATE, mt as geoAttributes, pt as emptyFilter, ut as DEVICE_MESSAGE_PROTOCOLS } from "../constants-CerzXHnQ.js";
|
|
2
2
|
export { DEVICE_CONNECT_STATES, DEVICE_DISMISSAL_STATE, DEVICE_MESSAGE_PROTOCOLS, DEVICE_MESSAGE_TYPES, REPORT_CHART_SIZE_LIMIT, emptyFilter, geoAttributes };
|
|
@@ -178,7 +178,7 @@ const devicesSlice = (0, _reduxjs_toolkit.createSlice)({
|
|
|
178
178
|
const { countsPerTier, status } = action.payload;
|
|
179
179
|
state.byStatus[status].counts = {
|
|
180
180
|
...countsPerTier,
|
|
181
|
-
total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu
|
|
181
|
+
total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0)
|
|
182
182
|
};
|
|
183
183
|
},
|
|
184
184
|
setDeviceLimits: (state, action) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["DEVICE_STATES","DEVICE_LIST_DEFAULTS","SORTING_OPTIONS","duplicateFilter"],"sources":["../../src/devicesSlice/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.\nimport type {\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: string[];\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => (accu += tieredCount), 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;AAkCA,MAAa,YAAY;AA+FzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACPA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;EACZ,GAAGC,+BAAAA;EACH,oBAAoB,CAAC;EACrB,gBAAgB,CAAC;EACjB,WAAW,CAAC;EACZ,MAAM,EACJ,WAAWC,+BAAAA,gBAAgB,KAG7B;EACA,OAAOF,+BAAAA,cAAc;EACrB,OAAO;EACP,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,MAAM;CACR;CACA,SAAS,CAET;CACA,qBAAqB;EAAE,oBAAoB,CAAC;EAAG,qBAAqB,CAAC;EAAG,kBAAkB,CAAC;EAAG,eAAe,CAAC;CAAE;CAChH,0BAA0B;CAC1B,2BAA2B;EACzB,YAAY,CAEZ;EACA,OAAO;EACP,OAAO;CACT;CACA,SAAS,CAET;CACA,iBAAiB;CACjB,OAAO;CACP,QAAQ;EACN,UAAU;EACV,OAAO;EACP,QAAQ;CACV;CACA,QAAQ;EAC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SORTING_OPTIONS","createSlice","duplicateFilter","deepCompare"],"sources":["../../src/devicesSlice/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.\nimport type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;AAmCA,MAAa,YAAY;AAiGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACPA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;EACZ,GAAGC,+BAAAA;EACH,oBAAoB,CAAC;EACrB,gBAAgB,CAAC;EACjB,WAAW,CAAC;EACZ,MAAM,EACJ,WAAWC,+BAAAA,gBAAgB,KAG7B;EACA,OAAOF,+BAAAA,cAAc;EACrB,OAAO;EACP,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,MAAM;CACR;CACA,SAAS,CAET;CACA,qBAAqB;EAAE,oBAAoB,CAAC;EAAG,qBAAqB,CAAC;EAAG,kBAAkB,CAAC;EAAG,eAAe,CAAC;CAAE;CAChH,0BAA0B;CAC1B,2BAA2B;EACzB,YAAY,CAEZ;EACA,OAAO;EACP,OAAO;CACT;CACA,SAAS,CAET;CACA,iBAAiB;CACjB,OAAO;CACP,QAAQ;EACN,UAAU;EACV,OAAO;EACP,QAAQ;CAC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
2
|
-
export { Device, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
|
|
1
|
+
import { a as DeviceGroups, c as DeviceSliceType, d as actions, f as devicesSlice, i as DeviceGroup, l as InventoryAttributes, m as sliceName, n as DeviceComponents, o as DeviceListState, p as initialState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as _default } from "../index-CiQ95u1W.cjs";
|
|
2
|
+
export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { Device, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
|
|
1
|
+
import { a as DeviceGroups, c as DeviceSliceType, d as actions, f as devicesSlice, i as DeviceGroup, l as InventoryAttributes, m as sliceName, n as DeviceComponents, o as DeviceListState, p as initialState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as _default } from "../index-Bvyf8OO6.js";
|
|
2
|
+
export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as SORTING_OPTIONS, l as DEVICE_LIST_DEFAULTS, u as DEVICE_STATES } from "../constants-
|
|
1
|
+
import { f as SORTING_OPTIONS, l as DEVICE_LIST_DEFAULTS, u as DEVICE_STATES } from "../constants-CerzXHnQ.js";
|
|
2
2
|
import { createSlice } from "@reduxjs/toolkit";
|
|
3
3
|
import { deepCompare, duplicateFilter } from "@northern.tech/utils/helpers";
|
|
4
4
|
//#region src/devicesSlice/index.ts
|
|
@@ -174,7 +174,7 @@ const devicesSlice = createSlice({
|
|
|
174
174
|
const { countsPerTier, status } = action.payload;
|
|
175
175
|
state.byStatus[status].counts = {
|
|
176
176
|
...countsPerTier,
|
|
177
|
-
total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu
|
|
177
|
+
total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0)
|
|
178
178
|
};
|
|
179
179
|
},
|
|
180
180
|
setDeviceLimits: (state, action) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/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.\nimport type {\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: string[];\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => (accu += tieredCount), 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAkCA,MAAa,YAAY;AA+FzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;EACZ,GAAG;EACH,oBAAoB,CAAC;EACrB,gBAAgB,CAAC;EACjB,WAAW,CAAC;EACZ,MAAM,EACJ,WAAW,gBAAgB,KAG7B;EACA,OAAO,cAAc;EACrB,OAAO;EACP,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,MAAM;CACR;CACA,SAAS,CAET;CACA,qBAAqB;EAAE,oBAAoB,CAAC;EAAG,qBAAqB,CAAC;EAAG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AAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/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.\nimport type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAmCA,MAAa,YAAY;AAiGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChG,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;EACZ,GAAG;EACH,oBAAoB,CAAC;EACrB,gBAAgB,CAAC;EACjB,WAAW,CAAC;EACZ,MAAM,EACJ,WAAW,gBAAgB,KAG7B;EACA,OAAO,cAAc;EACrB,OAAO;EACP,gBAAgB;EAChB,WAAW;EACX,YAAY;EACZ,MAAM;CACR;CACA,SAAS,CAET;CACA,qBAAqB;EAAE,oBAAoB,CAAC;EAAG,qBAAqB,CAAC;EAAG,kBAAkB,CAAC;EAAG,eAAe,CAAC;CAAE;CAChH,0BAA0B;CAC1B,2BAA2B;EACzB,YAAY,CAEZ;EACA,OAAO;EACP,OAAO;CACT;CACA,SAAS,CAET;CACA,iBAAiB;CACjB,OAAO;CACP,QAAQ;EACN,UAAU;EACV,OAAO;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TING_OPTIONS, u as DEVICE_STATES } from "../constants-CerzXHnQ.js";
|
|
2
2
|
import { initialState } from "./index.js";
|
|
3
3
|
//#region src/devicesSlice/mocks.ts
|
|
4
4
|
const deviceTypes = { qemu: "qemux86-64" };
|