@northern.tech/store 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +183 -129
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +42 -55
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +44 -70
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +51 -68
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +563 -544
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +39 -55
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-OWHFMKTA.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-OWHFMKTA.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-NCI6JV5R.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-NCI6JV5R.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-2P4VECEE.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-2P4VECEE.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-QG4PT5WK.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-QG4PT5WK.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-X65NMDPS.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-X65NMDPS.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-BWFTQHNM.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-BWFTQHNM.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-UPMSYTWW.mjs → chunk-DIZJVB6M.mjs} +306 -291
- package/dist/{chunk-UPMSYTWW.mjs.map → chunk-DIZJVB6M.mjs.map} +1 -1
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-ENLZPHTQ.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-MQIKQKSW.mjs → chunk-IFWKT27G.mjs} +37 -33
- package/dist/{chunk-MQIKQKSW.mjs.map → chunk-IFWKT27G.mjs.map} +1 -1
- package/dist/{chunk-EM2HUGUY.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-EM2HUGUY.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-2HCZYULZ.mjs → chunk-K2NZL5V4.mjs} +3 -6
- package/dist/{chunk-2HCZYULZ.mjs.map → chunk-K2NZL5V4.mjs.map} +1 -1
- package/dist/{chunk-Y47SYXII.mjs → chunk-KJAZNKV2.mjs} +43 -52
- package/dist/{chunk-Y47SYXII.mjs.map → chunk-KJAZNKV2.mjs.map} +1 -1
- package/dist/{chunk-U6YTBIDT.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-U6YTBIDT.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-EFHEROXZ.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-EFHEROXZ.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-RWYS5MKN.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-RWYS5MKN.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-ZLRZO4EY.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-OGAMVFPS.mjs → chunk-QQBUNZHA.mjs} +2 -6
- package/dist/{chunk-OGAMVFPS.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-WS3YYLTJ.mjs → chunk-R7LXL3KJ.mjs} +14 -13
- package/dist/{chunk-WS3YYLTJ.mjs.map → chunk-R7LXL3KJ.mjs.map} +1 -1
- package/dist/{chunk-MJW4632R.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-MJW4632R.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-L4HIW3KB.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-XJNI62IP.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-XJNI62IP.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-4U4X4KAC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-4U4X4KAC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-ZZ6VIQ3U.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-ZZ6VIQ3U.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-4C6IY46N.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-4C6IY46N.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.js +1 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.js +73 -135
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +12 -12
- package/dist/constants.js +36 -153
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +14 -14
- package/dist/deploymentsSlice/constants.js +34 -59
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +68 -79
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +35 -52
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +563 -553
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +34 -58
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +71 -81
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +40 -89
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +563 -589
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +34 -45
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +41 -52
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +249 -232
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +563 -547
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.js +34 -56
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +4 -4
- package/dist/organizationSlice/index.js +45 -53
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +35 -61
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +563 -572
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +38 -64
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +37 -57
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +293 -281
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.js +73 -207
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +43 -43
- package/dist/store.js +194 -151
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.js +568 -547
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +38 -41
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +563 -702
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.js +36 -66
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +4 -4
- package/dist/usersSlice/index.js +62 -71
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +41 -66
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +563 -576
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.js +57 -93
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-ENLZPHTQ.mjs +0 -35
- package/dist/chunk-L4HIW3KB.mjs +0 -36
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-ZLRZO4EY.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -492,7 +442,7 @@ var chartTypes = {
|
|
|
492
442
|
};
|
|
493
443
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
494
444
|
var defaultReportType = "distribution";
|
|
495
|
-
var defaultReports = [
|
|
445
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
496
446
|
var locations = {};
|
|
497
447
|
var PLANS = {
|
|
498
448
|
os: {
|
|
@@ -825,7 +775,7 @@ var emptyRole = Object.freeze({
|
|
|
825
775
|
name: void 0,
|
|
826
776
|
description: "",
|
|
827
777
|
permissions: [],
|
|
828
|
-
uiPermissions: Object.freeze(
|
|
778
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
829
779
|
});
|
|
830
780
|
|
|
831
781
|
// src/deploymentsSlice/constants.ts
|
|
@@ -854,11 +804,12 @@ var deploymentStatesToSubstates = {
|
|
|
854
804
|
pending: [deploymentSubstates.pending],
|
|
855
805
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
856
806
|
};
|
|
857
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
807
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
808
|
+
...deploymentStatesToSubstates,
|
|
858
809
|
failures: [deploymentSubstates.failure],
|
|
859
810
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
860
811
|
successes: [deploymentSubstates.success]
|
|
861
|
-
}
|
|
812
|
+
};
|
|
862
813
|
var installationSubstatesMap = {
|
|
863
814
|
download: {
|
|
864
815
|
title: "download",
|
|
@@ -903,8 +854,8 @@ var DEPLOYMENT_STATES = {
|
|
|
903
854
|
var listDefaultsByState = {
|
|
904
855
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
905
856
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
906
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
907
|
-
[DEPLOYMENT_STATES.finished]:
|
|
857
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
858
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
908
859
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
909
860
|
};
|
|
910
861
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1279,7 +1230,7 @@ var uiPermissionsByArea = {
|
|
|
1279
1230
|
}
|
|
1280
1231
|
};
|
|
1281
1232
|
var permissionMapper = (permission) => permission.value;
|
|
1282
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1233
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1283
1234
|
var rolesById = Object.freeze({
|
|
1284
1235
|
[staticRolesByName.admin]: {
|
|
1285
1236
|
name: "Admin",
|
|
@@ -1287,54 +1238,59 @@ var rolesById = Object.freeze({
|
|
|
1287
1238
|
description: "Full access",
|
|
1288
1239
|
permissions: [],
|
|
1289
1240
|
// permissions refers to the values returned from the backend
|
|
1290
|
-
uiPermissions:
|
|
1241
|
+
uiPermissions: {
|
|
1242
|
+
...emptyUiPermissions,
|
|
1291
1243
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1292
1244
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1293
1245
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1294
1246
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1295
1247
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1296
|
-
}
|
|
1248
|
+
}
|
|
1297
1249
|
},
|
|
1298
1250
|
[staticRolesByName.readOnly]: {
|
|
1299
1251
|
name: "Read Access",
|
|
1300
1252
|
value: staticRolesByName.readOnly,
|
|
1301
1253
|
description: "",
|
|
1302
1254
|
permissions: [],
|
|
1303
|
-
uiPermissions:
|
|
1255
|
+
uiPermissions: {
|
|
1256
|
+
...emptyUiPermissions,
|
|
1304
1257
|
deployments: [uiPermissionsById.read.value],
|
|
1305
1258
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1306
1259
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1307
1260
|
userManagement: [uiPermissionsById.read.value]
|
|
1308
|
-
}
|
|
1261
|
+
}
|
|
1309
1262
|
},
|
|
1310
1263
|
[staticRolesByName.ci]: {
|
|
1311
1264
|
name: "Releases Manager",
|
|
1312
1265
|
value: staticRolesByName.ci,
|
|
1313
1266
|
description: "",
|
|
1314
1267
|
permissions: [],
|
|
1315
|
-
uiPermissions:
|
|
1268
|
+
uiPermissions: {
|
|
1269
|
+
...emptyUiPermissions,
|
|
1316
1270
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1317
|
-
}
|
|
1271
|
+
}
|
|
1318
1272
|
},
|
|
1319
1273
|
[staticRolesByName.deploymentsManager]: {
|
|
1320
1274
|
name: "Deployments Manager",
|
|
1321
1275
|
value: staticRolesByName.deploymentsManager,
|
|
1322
1276
|
description: "",
|
|
1323
1277
|
permissions: [],
|
|
1324
|
-
uiPermissions:
|
|
1278
|
+
uiPermissions: {
|
|
1279
|
+
...emptyUiPermissions,
|
|
1325
1280
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1326
1281
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1327
1282
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1328
|
-
}
|
|
1283
|
+
}
|
|
1329
1284
|
},
|
|
1330
1285
|
[staticRolesByName.terminalAccess]: {
|
|
1331
1286
|
name: "Troubleshooting",
|
|
1332
1287
|
value: staticRolesByName.terminalAccess,
|
|
1333
1288
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1334
1289
|
permissions: [],
|
|
1335
|
-
uiPermissions:
|
|
1290
|
+
uiPermissions: {
|
|
1291
|
+
...emptyUiPermissions,
|
|
1336
1292
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1337
|
-
}
|
|
1293
|
+
}
|
|
1338
1294
|
}
|
|
1339
1295
|
});
|
|
1340
1296
|
var serviceProviderRolesById = {
|
|
@@ -1343,22 +1299,24 @@ var serviceProviderRolesById = {
|
|
|
1343
1299
|
value: staticRolesByName.admin,
|
|
1344
1300
|
description: "Full access",
|
|
1345
1301
|
permissions: [],
|
|
1346
|
-
uiPermissions:
|
|
1302
|
+
uiPermissions: {
|
|
1303
|
+
...emptyUiPermissions,
|
|
1347
1304
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1348
1305
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1349
1306
|
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1350
|
-
}
|
|
1307
|
+
}
|
|
1351
1308
|
},
|
|
1352
1309
|
readOnly: {
|
|
1353
1310
|
name: "Read access",
|
|
1354
1311
|
value: staticRolesByName.admin,
|
|
1355
1312
|
description: "This role can see all linked organizations but cannot make any changes",
|
|
1356
1313
|
permissions: [],
|
|
1357
|
-
uiPermissions:
|
|
1314
|
+
uiPermissions: {
|
|
1315
|
+
...emptyUiPermissions,
|
|
1358
1316
|
auditlog: [uiPermissionsById.read.value],
|
|
1359
1317
|
userManagement: [uiPermissionsById.read.value],
|
|
1360
1318
|
tenantManagement: [uiPermissionsById.read.value]
|
|
1361
|
-
}
|
|
1319
|
+
}
|
|
1362
1320
|
}
|
|
1363
1321
|
};
|
|
1364
1322
|
var defaultPermissionSets = {
|
|
@@ -1371,7 +1329,9 @@ var defaultPermissionSets = {
|
|
|
1371
1329
|
},
|
|
1372
1330
|
[permissionSetIds.SuperUser]: {
|
|
1373
1331
|
name: permissionSetIds.SuperUser,
|
|
1374
|
-
result:
|
|
1332
|
+
result: {
|
|
1333
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1334
|
+
}
|
|
1375
1335
|
},
|
|
1376
1336
|
[permissionSetIds.ManageUsers]: {
|
|
1377
1337
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1456,11 +1416,12 @@ var defaultPermissionSets = {
|
|
|
1456
1416
|
};
|
|
1457
1417
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1458
1418
|
var OWN_USER_ID = "me";
|
|
1459
|
-
var rolesByName =
|
|
1419
|
+
var rolesByName = {
|
|
1420
|
+
...staticRolesByName,
|
|
1460
1421
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1461
1422
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1462
1423
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1463
|
-
}
|
|
1424
|
+
};
|
|
1464
1425
|
var twoFAStates = {
|
|
1465
1426
|
enabled: "enabled",
|
|
1466
1427
|
disabled: "disabled",
|
|
@@ -1548,7 +1509,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1548
1509
|
initialState,
|
|
1549
1510
|
reducers: {
|
|
1550
1511
|
setFeatures: (state, action) => {
|
|
1551
|
-
state.features =
|
|
1512
|
+
state.features = {
|
|
1513
|
+
...state.features,
|
|
1514
|
+
...action.payload
|
|
1515
|
+
};
|
|
1552
1516
|
},
|
|
1553
1517
|
setSnackbar: (state, { payload }) => {
|
|
1554
1518
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1573,7 +1537,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1573
1537
|
state.hostedAnnouncement = action.payload;
|
|
1574
1538
|
},
|
|
1575
1539
|
setSearchState: (state, action) => {
|
|
1576
|
-
state.searchState =
|
|
1540
|
+
state.searchState = {
|
|
1541
|
+
...state.searchState,
|
|
1542
|
+
...action.payload
|
|
1543
|
+
};
|
|
1577
1544
|
},
|
|
1578
1545
|
setOfflineThreshold: (state, action) => {
|
|
1579
1546
|
state.offlineThreshold = action.payload;
|
|
@@ -1584,20 +1551,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1584
1551
|
},
|
|
1585
1552
|
uploadProgress: (state, action) => {
|
|
1586
1553
|
const { id, progress: progress2 } = action.payload;
|
|
1587
|
-
state.uploadsById[id] =
|
|
1554
|
+
state.uploadsById[id] = {
|
|
1555
|
+
...state.uploadsById[id],
|
|
1588
1556
|
progress: progress2
|
|
1589
|
-
}
|
|
1557
|
+
};
|
|
1590
1558
|
},
|
|
1591
1559
|
cleanUpUpload: (state, action) => {
|
|
1592
|
-
|
|
1593
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1560
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1594
1561
|
state.uploadsById = remainder;
|
|
1595
1562
|
},
|
|
1596
1563
|
setVersionInformation: (state, action) => {
|
|
1597
|
-
state.versionInformation =
|
|
1564
|
+
state.versionInformation = {
|
|
1565
|
+
...state.versionInformation,
|
|
1566
|
+
...action.payload
|
|
1567
|
+
};
|
|
1598
1568
|
},
|
|
1599
1569
|
setEnvironmentData: (state, action) => {
|
|
1600
|
-
return
|
|
1570
|
+
return { ...state, ...action.payload };
|
|
1601
1571
|
}
|
|
1602
1572
|
}
|
|
1603
1573
|
});
|
|
@@ -1629,7 +1599,7 @@ var initialState2 = {
|
|
|
1629
1599
|
sourceWindow: -1
|
|
1630
1600
|
},
|
|
1631
1601
|
binaryDeltaLimits: {
|
|
1632
|
-
timeout:
|
|
1602
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1633
1603
|
sourceWindow: limitDefault,
|
|
1634
1604
|
inputWindow: limitDefault,
|
|
1635
1605
|
duplicatesWindow: limitDefault,
|
|
@@ -1639,10 +1609,10 @@ var initialState2 = {
|
|
|
1639
1609
|
deploymentDeviceLimit: 5e3,
|
|
1640
1610
|
selectedDeviceIds: [],
|
|
1641
1611
|
selectionState: {
|
|
1642
|
-
finished:
|
|
1643
|
-
inprogress:
|
|
1644
|
-
pending:
|
|
1645
|
-
scheduled:
|
|
1612
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1613
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1614
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1615
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1646
1616
|
general: {
|
|
1647
1617
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1648
1618
|
showCreationDialog: false,
|
|
@@ -1658,40 +1628,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1658
1628
|
initialState: initialState2,
|
|
1659
1629
|
reducers: {
|
|
1660
1630
|
createdDeployment: (state, action) => {
|
|
1661
|
-
state.byId[action.payload.id] =
|
|
1631
|
+
state.byId[action.payload.id] = {
|
|
1632
|
+
...deploymentPrototype,
|
|
1633
|
+
...action.payload
|
|
1634
|
+
};
|
|
1662
1635
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1663
1636
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1664
1637
|
state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection], state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1;
|
|
1665
1638
|
},
|
|
1666
1639
|
removedDeployment: (state, action) => {
|
|
1667
|
-
|
|
1668
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1640
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1669
1641
|
state.byId = remainder;
|
|
1670
1642
|
},
|
|
1671
1643
|
receivedDeployment: (state, action) => {
|
|
1672
|
-
state.byId[action.payload.id] =
|
|
1644
|
+
state.byId[action.payload.id] = {
|
|
1645
|
+
...state.byId[action.payload.id] || {},
|
|
1646
|
+
...action.payload
|
|
1647
|
+
};
|
|
1673
1648
|
},
|
|
1674
1649
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1675
1650
|
const { id, deviceId, log } = action.payload;
|
|
1676
|
-
const deployment =
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1651
|
+
const deployment = {
|
|
1652
|
+
...deploymentPrototype,
|
|
1653
|
+
...state.byId[id]
|
|
1654
|
+
};
|
|
1655
|
+
state.byId[id] = {
|
|
1656
|
+
...deployment,
|
|
1657
|
+
devices: {
|
|
1658
|
+
...deployment.devices,
|
|
1659
|
+
[deviceId]: {
|
|
1660
|
+
...deployment.devices[deviceId],
|
|
1680
1661
|
log
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1684
1665
|
},
|
|
1685
1666
|
receivedDeploymentDevices: (state, action) => {
|
|
1686
1667
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1687
|
-
state.byId[id] =
|
|
1668
|
+
state.byId[id] = {
|
|
1669
|
+
...state.byId[id],
|
|
1688
1670
|
devices,
|
|
1689
1671
|
totalDeviceCount
|
|
1690
|
-
}
|
|
1672
|
+
};
|
|
1691
1673
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1692
1674
|
},
|
|
1693
1675
|
receivedDeployments: (state, action) => {
|
|
1694
|
-
state.byId =
|
|
1676
|
+
state.byId = {
|
|
1677
|
+
...state.byId,
|
|
1678
|
+
...action.payload
|
|
1679
|
+
};
|
|
1695
1680
|
},
|
|
1696
1681
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1697
1682
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1733,9 +1718,9 @@ var initialState3 = {
|
|
|
1733
1718
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1734
1719
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1735
1720
|
},
|
|
1736
|
-
deviceList:
|
|
1737
|
-
deviceIds: []
|
|
1738
|
-
|
|
1721
|
+
deviceList: {
|
|
1722
|
+
deviceIds: [],
|
|
1723
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1739
1724
|
selectedAttributes: [],
|
|
1740
1725
|
selectedIssues: [],
|
|
1741
1726
|
selection: [],
|
|
@@ -1746,7 +1731,7 @@ var initialState3 = {
|
|
|
1746
1731
|
},
|
|
1747
1732
|
state: DEVICE_STATES.accepted,
|
|
1748
1733
|
total: 0
|
|
1749
|
-
}
|
|
1734
|
+
},
|
|
1750
1735
|
filters: [
|
|
1751
1736
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1752
1737
|
],
|
|
@@ -1781,49 +1766,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1781
1766
|
},
|
|
1782
1767
|
addToGroup: (state, action) => {
|
|
1783
1768
|
const { group, deviceIds } = action.payload;
|
|
1784
|
-
const maybeExistingGroup =
|
|
1769
|
+
const maybeExistingGroup = {
|
|
1785
1770
|
filters: [],
|
|
1786
|
-
deviceIds: []
|
|
1787
|
-
|
|
1788
|
-
|
|
1771
|
+
deviceIds: [],
|
|
1772
|
+
...state.groups.byId[group]
|
|
1773
|
+
};
|
|
1774
|
+
state.groups.byId[group] = {
|
|
1775
|
+
...maybeExistingGroup,
|
|
1789
1776
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1790
1777
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1791
|
-
}
|
|
1778
|
+
};
|
|
1792
1779
|
},
|
|
1793
1780
|
removeFromGroup: (state, action) => {
|
|
1794
1781
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1795
|
-
const
|
|
1796
|
-
const changedGroup =
|
|
1782
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1783
|
+
const changedGroup = {
|
|
1784
|
+
...maybeExistingGroup,
|
|
1797
1785
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1798
1786
|
total: Math.max(total - removedIds.length, 0)
|
|
1799
|
-
}
|
|
1787
|
+
};
|
|
1800
1788
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1801
1789
|
state.groups.byId[group] = changedGroup;
|
|
1802
1790
|
return;
|
|
1803
1791
|
} else if (state.groups.selectedGroup === group) {
|
|
1804
1792
|
state.groups.selectedGroup = void 0;
|
|
1805
1793
|
}
|
|
1806
|
-
const
|
|
1794
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1807
1795
|
state.groups.byId = remainingById;
|
|
1808
1796
|
},
|
|
1809
1797
|
addGroup: (state, action) => {
|
|
1810
1798
|
const { groupName, group } = action.payload;
|
|
1811
|
-
state.groups.byId[groupName] =
|
|
1799
|
+
state.groups.byId[groupName] = {
|
|
1800
|
+
...state.groups.byId[groupName],
|
|
1801
|
+
...group
|
|
1802
|
+
};
|
|
1812
1803
|
},
|
|
1813
1804
|
selectGroup: (state, { payload: group }) => {
|
|
1814
1805
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1815
1806
|
state.groups.selectedGroup = group;
|
|
1816
1807
|
},
|
|
1817
1808
|
removeGroup: (state, action) => {
|
|
1818
|
-
|
|
1819
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1809
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1820
1810
|
state.groups.byId = remainingById;
|
|
1821
1811
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1822
1812
|
},
|
|
1823
1813
|
setDeviceListState: (state, action) => {
|
|
1824
|
-
state.deviceList =
|
|
1825
|
-
|
|
1826
|
-
|
|
1814
|
+
state.deviceList = {
|
|
1815
|
+
...state.deviceList,
|
|
1816
|
+
...action.payload,
|
|
1817
|
+
sort: {
|
|
1818
|
+
...state.deviceList.sort,
|
|
1819
|
+
...action.payload.sort
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1827
1822
|
},
|
|
1828
1823
|
setFilterAttributes: (state, action) => {
|
|
1829
1824
|
state.filteringAttributes = action.payload;
|
|
@@ -1832,7 +1827,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1832
1827
|
state.filteringAttributesConfig = action.payload;
|
|
1833
1828
|
},
|
|
1834
1829
|
receivedDevices: (state, action) => {
|
|
1835
|
-
state.byId =
|
|
1830
|
+
state.byId = {
|
|
1831
|
+
...state.byId,
|
|
1832
|
+
...action.payload
|
|
1833
|
+
};
|
|
1836
1834
|
},
|
|
1837
1835
|
setDeviceFilters: (state, action) => {
|
|
1838
1836
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1863,7 +1861,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1863
1861
|
state.limit = action.payload;
|
|
1864
1862
|
},
|
|
1865
1863
|
receivedDevice: (state, action) => {
|
|
1866
|
-
state.byId[action.payload.id] =
|
|
1864
|
+
state.byId[action.payload.id] = {
|
|
1865
|
+
...state.byId[action.payload.id],
|
|
1866
|
+
...action.payload
|
|
1867
|
+
};
|
|
1867
1868
|
},
|
|
1868
1869
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1869
1870
|
const { deviceId, authId } = action.payload;
|
|
@@ -1884,15 +1885,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1884
1885
|
var sliceName4 = "monitor";
|
|
1885
1886
|
var initialState4 = {
|
|
1886
1887
|
alerts: {
|
|
1887
|
-
alertList:
|
|
1888
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1888
1889
|
byDeviceId: {}
|
|
1889
1890
|
},
|
|
1890
1891
|
issueCounts: {
|
|
1891
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1892
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1892
1893
|
},
|
|
1893
1894
|
settings: {
|
|
1894
1895
|
global: {
|
|
1895
|
-
channels:
|
|
1896
|
+
channels: {
|
|
1897
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1898
|
+
}
|
|
1896
1899
|
}
|
|
1897
1900
|
}
|
|
1898
1901
|
};
|
|
@@ -1910,14 +1913,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1910
1913
|
},
|
|
1911
1914
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1912
1915
|
const { deviceId, alerts } = action.payload;
|
|
1913
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1916
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1914
1917
|
},
|
|
1915
1918
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1916
1919
|
const { issueType, counts } = action.payload;
|
|
1917
1920
|
state.issueCounts.byType[issueType] = counts;
|
|
1918
1921
|
},
|
|
1919
1922
|
setAlertListState: (state, action) => {
|
|
1920
|
-
state.alerts.alertList =
|
|
1923
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1921
1924
|
}
|
|
1922
1925
|
}
|
|
1923
1926
|
});
|
|
@@ -1941,7 +1944,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1941
1944
|
initialState: initialState5,
|
|
1942
1945
|
reducers: {
|
|
1943
1946
|
setOnboardingState: (state, action) => {
|
|
1944
|
-
return
|
|
1947
|
+
return { ...state, ...action.payload };
|
|
1945
1948
|
},
|
|
1946
1949
|
setDemoArtifactPort: (state, action) => {
|
|
1947
1950
|
state.demoArtifactPort = action.payload;
|
|
@@ -1979,7 +1982,8 @@ var initialState6 = {
|
|
|
1979
1982
|
brand: ""
|
|
1980
1983
|
},
|
|
1981
1984
|
intentId: null,
|
|
1982
|
-
tenantList:
|
|
1985
|
+
tenantList: {
|
|
1986
|
+
...TENANT_LIST_DEFAULT,
|
|
1983
1987
|
total: 0,
|
|
1984
1988
|
tenants: [],
|
|
1985
1989
|
selectedTenant: null,
|
|
@@ -1987,13 +1991,14 @@ var initialState6 = {
|
|
|
1987
1991
|
direction: SORTING_OPTIONS.desc,
|
|
1988
1992
|
key: "name"
|
|
1989
1993
|
}
|
|
1990
|
-
}
|
|
1994
|
+
},
|
|
1991
1995
|
organization: {
|
|
1992
1996
|
// id, name, status, tenant_token, plan
|
|
1993
1997
|
},
|
|
1994
1998
|
auditlog: {
|
|
1995
1999
|
events: [],
|
|
1996
|
-
selectionState:
|
|
2000
|
+
selectionState: {
|
|
2001
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1997
2002
|
detail: void 0,
|
|
1998
2003
|
endDate: void 0,
|
|
1999
2004
|
selectedIssue: void 0,
|
|
@@ -2002,7 +2007,7 @@ var initialState6 = {
|
|
|
2002
2007
|
total: 0,
|
|
2003
2008
|
type: void 0,
|
|
2004
2009
|
user: void 0
|
|
2005
|
-
}
|
|
2010
|
+
}
|
|
2006
2011
|
},
|
|
2007
2012
|
externalDeviceIntegrations: [
|
|
2008
2013
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2025,7 +2030,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2025
2030
|
state.auditlog.selectionState.total = total;
|
|
2026
2031
|
},
|
|
2027
2032
|
setAuditLogState: (state, action) => {
|
|
2028
|
-
state.auditlog.selectionState =
|
|
2033
|
+
state.auditlog.selectionState = {
|
|
2034
|
+
...state.auditlog.selectionState,
|
|
2035
|
+
...action.payload
|
|
2036
|
+
};
|
|
2029
2037
|
},
|
|
2030
2038
|
receiveCurrentCard: (state, action) => {
|
|
2031
2039
|
state.card = action.payload;
|
|
@@ -2034,7 +2042,7 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2034
2042
|
state.intentId = action.payload;
|
|
2035
2043
|
},
|
|
2036
2044
|
setOrganization: (state, action) => {
|
|
2037
|
-
state.organization =
|
|
2045
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2038
2046
|
},
|
|
2039
2047
|
setTenantListState: (state, action) => {
|
|
2040
2048
|
state.tenantList = action.payload;
|
|
@@ -2097,7 +2105,8 @@ var initialState7 = {
|
|
|
2097
2105
|
}
|
|
2098
2106
|
*/
|
|
2099
2107
|
},
|
|
2100
|
-
releasesList:
|
|
2108
|
+
releasesList: {
|
|
2109
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2101
2110
|
searchedIds: [],
|
|
2102
2111
|
releaseIds: [],
|
|
2103
2112
|
selection: [],
|
|
@@ -2111,7 +2120,7 @@ var initialState7 = {
|
|
|
2111
2120
|
selectedTags: [],
|
|
2112
2121
|
total: 0,
|
|
2113
2122
|
type: ""
|
|
2114
|
-
}
|
|
2123
|
+
},
|
|
2115
2124
|
tags: [],
|
|
2116
2125
|
updateTypes: [],
|
|
2117
2126
|
/*
|
|
@@ -2137,8 +2146,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2137
2146
|
state.updateTypes = action.payload;
|
|
2138
2147
|
},
|
|
2139
2148
|
removeRelease: (state, action) => {
|
|
2140
|
-
|
|
2141
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2149
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2142
2150
|
state.byId = byId;
|
|
2143
2151
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2144
2152
|
},
|
|
@@ -2171,8 +2179,12 @@ var initialState8 = {
|
|
|
2171
2179
|
previousPhases: [],
|
|
2172
2180
|
retries: 0
|
|
2173
2181
|
},
|
|
2174
|
-
permissionSetsById:
|
|
2175
|
-
|
|
2182
|
+
permissionSetsById: {
|
|
2183
|
+
...defaultPermissionSets
|
|
2184
|
+
},
|
|
2185
|
+
rolesById: {
|
|
2186
|
+
...rolesById
|
|
2187
|
+
},
|
|
2176
2188
|
settingsInitialized: false,
|
|
2177
2189
|
showConnectDeviceDialog: false,
|
|
2178
2190
|
showFeedbackDialog: false,
|
|
@@ -2212,13 +2224,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2212
2224
|
state.byId[0] = action.payload;
|
|
2213
2225
|
},
|
|
2214
2226
|
removedUser: (state, action) => {
|
|
2215
|
-
|
|
2216
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2227
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2217
2228
|
state.byId = byId;
|
|
2218
2229
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2219
2230
|
},
|
|
2220
2231
|
updatedUser: (state, action) => {
|
|
2221
|
-
state.byId[action.payload.id] =
|
|
2232
|
+
state.byId[action.payload.id] = {
|
|
2233
|
+
...state.byId[action.payload.id],
|
|
2234
|
+
...action.payload
|
|
2235
|
+
};
|
|
2222
2236
|
},
|
|
2223
2237
|
receivedPermissionSets: (state, action) => {
|
|
2224
2238
|
state.permissionSetsById = action.payload;
|
|
@@ -2227,11 +2241,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2227
2241
|
state.rolesById = action.payload;
|
|
2228
2242
|
},
|
|
2229
2243
|
createdRole: (state, action) => {
|
|
2230
|
-
state.rolesById[action.payload.name] =
|
|
2244
|
+
state.rolesById[action.payload.name] = {
|
|
2245
|
+
...state.rolesById[action.payload.name],
|
|
2246
|
+
...action.payload
|
|
2247
|
+
};
|
|
2231
2248
|
},
|
|
2232
2249
|
removedRole: (state, action) => {
|
|
2233
|
-
|
|
2234
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2250
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2235
2251
|
state.rolesById = rolesById2;
|
|
2236
2252
|
},
|
|
2237
2253
|
setCustomColumns: (state, action) => {
|
|
@@ -2239,18 +2255,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2239
2255
|
},
|
|
2240
2256
|
setGlobalSettings: (state, action) => {
|
|
2241
2257
|
state.settingsInitialized = true;
|
|
2242
|
-
state.globalSettings =
|
|
2258
|
+
state.globalSettings = {
|
|
2259
|
+
...state.globalSettings,
|
|
2260
|
+
...action.payload
|
|
2261
|
+
};
|
|
2243
2262
|
},
|
|
2244
2263
|
setUserSettings: (state, action) => {
|
|
2245
2264
|
state.userSettingsInitialized = true;
|
|
2246
|
-
state.userSettings =
|
|
2265
|
+
state.userSettings = {
|
|
2266
|
+
...state.userSettings,
|
|
2267
|
+
...action.payload
|
|
2268
|
+
};
|
|
2247
2269
|
},
|
|
2248
2270
|
setTooltipState: (state, action) => {
|
|
2249
2271
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2250
2272
|
state.tooltips.byId[id].readState = readState;
|
|
2251
2273
|
},
|
|
2252
2274
|
setTooltipsState: (state, action) => {
|
|
2253
|
-
state.tooltips.byId =
|
|
2275
|
+
state.tooltips.byId = {
|
|
2276
|
+
...state.tooltips.byId,
|
|
2277
|
+
...action.payload
|
|
2278
|
+
};
|
|
2254
2279
|
},
|
|
2255
2280
|
setShowFeedbackDialog: (state, action) => {
|
|
2256
2281
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2267,7 +2292,16 @@ var actions8 = usersSlice.actions;
|
|
|
2267
2292
|
var usersSlice_default = usersSlice.reducer;
|
|
2268
2293
|
|
|
2269
2294
|
// src/actions.ts
|
|
2270
|
-
var actions_default =
|
|
2295
|
+
var actions_default = {
|
|
2296
|
+
...actions,
|
|
2297
|
+
...actions2,
|
|
2298
|
+
...actions3,
|
|
2299
|
+
...actions4,
|
|
2300
|
+
...actions5,
|
|
2301
|
+
...actions6,
|
|
2302
|
+
...actions7,
|
|
2303
|
+
...actions8
|
|
2304
|
+
};
|
|
2271
2305
|
|
|
2272
2306
|
// src/api/general-api.ts
|
|
2273
2307
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2278,18 +2312,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2278
2312
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2279
2313
|
var tokenCache = "";
|
|
2280
2314
|
var getSessionInfo = () => {
|
|
2281
|
-
|
|
2282
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2315
|
+
let sessionInfo = { ...emptySession };
|
|
2283
2316
|
try {
|
|
2284
|
-
sessionInfo = JSON.parse(
|
|
2285
|
-
} catch
|
|
2317
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2318
|
+
} catch {
|
|
2286
2319
|
}
|
|
2287
2320
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2288
2321
|
cleanUp();
|
|
2289
|
-
return
|
|
2322
|
+
return { ...emptySession };
|
|
2290
2323
|
}
|
|
2291
2324
|
if (!sessionInfo.token) {
|
|
2292
|
-
let jwtTokenFromCookie =
|
|
2325
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2293
2326
|
if (jwtTokenFromCookie) {
|
|
2294
2327
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2295
2328
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2317,8 +2350,7 @@ var maxSessionAge = 900;
|
|
|
2317
2350
|
|
|
2318
2351
|
// src/api/general-api.ts
|
|
2319
2352
|
var unauthorizedRedirect = (error) => {
|
|
2320
|
-
|
|
2321
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2353
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2322
2354
|
cleanUp();
|
|
2323
2355
|
window.location.replace("/ui/");
|
|
2324
2356
|
}
|
|
@@ -2328,7 +2360,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2328
2360
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2329
2361
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2330
2362
|
authenticatedRequest.interceptors.request.use(
|
|
2331
|
-
(config) =>
|
|
2363
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2332
2364
|
(error) => Promise.reject(error)
|
|
2333
2365
|
);
|
|
2334
2366
|
var Api = {
|
|
@@ -2336,7 +2368,7 @@ var Api = {
|
|
|
2336
2368
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2337
2369
|
patch: authenticatedRequest.patch,
|
|
2338
2370
|
post: authenticatedRequest.post,
|
|
2339
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2371
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2340
2372
|
put: authenticatedRequest.put,
|
|
2341
2373
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2342
2374
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2367,10 +2399,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2367
2399
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2368
2400
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2369
2401
|
[getFullVersionInformation, getFeatures],
|
|
2370
|
-
(
|
|
2371
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2372
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2373
|
-
}
|
|
2402
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2374
2403
|
);
|
|
2375
2404
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2376
2405
|
|
|
@@ -2387,8 +2416,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2387
2416
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2388
2417
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2389
2418
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2390
|
-
|
|
2391
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2419
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2392
2420
|
return selection.reduce((accu, id) => {
|
|
2393
2421
|
if (deploymentsById[id]) {
|
|
2394
2422
|
accu.push(deploymentsById[id]);
|
|
@@ -2432,7 +2460,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2432
2460
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2433
2461
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2434
2462
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2435
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2463
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2464
|
+
...filteringAttributes,
|
|
2436
2465
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2437
2466
|
}));
|
|
2438
2467
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2460,10 +2489,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2460
2489
|
return accu;
|
|
2461
2490
|
}, {})
|
|
2462
2491
|
);
|
|
2463
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2464
|
-
var _a;
|
|
2465
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2466
|
-
});
|
|
2492
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2467
2493
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2468
2494
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2469
2495
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2480,17 +2506,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2480
2506
|
[getAcceptedDevices, getDeviceLimit],
|
|
2481
2507
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2482
2508
|
);
|
|
2483
|
-
var
|
|
2484
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2485
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2486
|
-
return groups;
|
|
2487
|
-
});
|
|
2509
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2488
2510
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2489
2511
|
const groupNames = Object.keys(groupsById).sort();
|
|
2490
2512
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2491
2513
|
(accu, [groupname, group]) => {
|
|
2492
2514
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2493
|
-
const groupItem =
|
|
2515
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2494
2516
|
if (group.filters.length > 0) {
|
|
2495
2517
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2496
2518
|
accu.dynamic.push(groupItem);
|
|
@@ -2504,7 +2526,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2504
2526
|
},
|
|
2505
2527
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2506
2528
|
);
|
|
2507
|
-
return
|
|
2529
|
+
return { groupNames, ...groupedGroups };
|
|
2508
2530
|
});
|
|
2509
2531
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2510
2532
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2544,10 +2566,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
2544
2566
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2545
2567
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2546
2568
|
[getExternalIntegrations],
|
|
2547
|
-
(integrations) => integrations.filter((integration) =>
|
|
2548
|
-
var _a;
|
|
2549
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2550
|
-
})
|
|
2569
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2551
2570
|
);
|
|
2552
2571
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2553
2572
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2581,15 +2600,12 @@ var filterProcessors = {
|
|
|
2581
2600
|
var filterAliases = {
|
|
2582
2601
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2583
2602
|
};
|
|
2584
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2591
|
-
};
|
|
2592
|
-
});
|
|
2603
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2604
|
+
scope: filter.scope,
|
|
2605
|
+
attribute: filter.key,
|
|
2606
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2607
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2608
|
+
}));
|
|
2593
2609
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2594
2610
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2595
2611
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2599,14 +2615,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2599
2615
|
});
|
|
2600
2616
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2601
2617
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2602
|
-
return
|
|
2618
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2603
2619
|
}
|
|
2604
2620
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2605
2621
|
});
|
|
2606
2622
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2607
|
-
var _a;
|
|
2608
2623
|
let applicableFilters = [...filters];
|
|
2609
|
-
if (typeof group === "string" && !(
|
|
2624
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2610
2625
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2611
2626
|
}
|
|
2612
2627
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2627,12 +2642,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2627
2642
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2628
2643
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2629
2644
|
if (id && byId[id]) {
|
|
2630
|
-
accu.push(
|
|
2645
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2631
2646
|
}
|
|
2632
2647
|
return accu;
|
|
2633
2648
|
}, []);
|
|
2634
2649
|
};
|
|
2635
|
-
var mergePermissions = (existingPermissions =
|
|
2650
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2636
2651
|
(accu, [key, value]) => {
|
|
2637
2652
|
let values;
|
|
2638
2653
|
if (!accu[key]) {
|
|
@@ -2642,12 +2657,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2642
2657
|
if (Array.isArray(value)) {
|
|
2643
2658
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2644
2659
|
} else {
|
|
2645
|
-
values = mergePermissions(accu[key],
|
|
2660
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2646
2661
|
}
|
|
2647
2662
|
accu[key] = values;
|
|
2648
2663
|
return accu;
|
|
2649
2664
|
},
|
|
2650
|
-
|
|
2665
|
+
{ ...addedPermissions }
|
|
2651
2666
|
);
|
|
2652
2667
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2653
2668
|
(accu, roleId) => {
|
|
@@ -2656,20 +2671,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2656
2671
|
}
|
|
2657
2672
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2658
2673
|
},
|
|
2659
|
-
|
|
2674
|
+
{ ...emptyUiPermissions }
|
|
2660
2675
|
);
|
|
2661
2676
|
var progress = ({ loaded, total }) => {
|
|
2662
2677
|
let uploadProgress4 = loaded / total * 100;
|
|
2663
2678
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2664
2679
|
};
|
|
2665
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2666
|
-
var _a, _b2, _c, _d, _e;
|
|
2667
|
-
return ((_c = (_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error) == null ? void 0 : _c.message) || ((_e = (_d = err.response) == null ? void 0 : _d.data) == null ? void 0 : _e.error) || err.error || err.message || fallback;
|
|
2668
|
-
};
|
|
2680
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2669
2681
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2670
2682
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2671
2683
|
try {
|
|
2672
|
-
if (
|
|
2684
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2673
2685
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2674
2686
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2675
2687
|
}
|
|
@@ -2684,9 +2696,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2684
2696
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2685
2697
|
return accu;
|
|
2686
2698
|
}
|
|
2687
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2699
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2700
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2688
2701
|
[attribute.name]: attribute.value
|
|
2689
|
-
}
|
|
2702
|
+
};
|
|
2690
2703
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2691
2704
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2692
2705
|
}
|
|
@@ -2705,15 +2718,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2705
2718
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2706
2719
|
var getReleaseMappingDefaults = () => ({});
|
|
2707
2720
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2708
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2721
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2709
2722
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2710
2723
|
[getReleaseListState, getReleasesById],
|
|
2711
2724
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2712
2725
|
);
|
|
2713
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2714
|
-
var _a;
|
|
2715
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2716
|
-
});
|
|
2726
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2717
2727
|
|
|
2718
2728
|
// src/usersSlice/selectors.ts
|
|
2719
2729
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2722,10 +2732,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2722
2732
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2723
2733
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2724
2734
|
var getUsersById = (state) => state.users.byId;
|
|
2725
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2726
|
-
var _a;
|
|
2727
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2728
|
-
});
|
|
2735
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2729
2736
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2730
2737
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2731
2738
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2736,22 +2743,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2736
2743
|
[getTooltipsById, getUserSettings],
|
|
2737
2744
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2738
2745
|
(accu, [id, value]) => {
|
|
2739
|
-
accu[id] =
|
|
2746
|
+
accu[id] = { ...accu[id], ...value };
|
|
2740
2747
|
return accu;
|
|
2741
2748
|
},
|
|
2742
|
-
|
|
2749
|
+
{ ...tooltips }
|
|
2743
2750
|
)
|
|
2744
2751
|
);
|
|
2745
2752
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2746
2753
|
[getCurrentUser],
|
|
2747
2754
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2748
2755
|
);
|
|
2749
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2756
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2750
2757
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2751
|
-
interval:
|
|
2752
|
-
intervalUnit:
|
|
2758
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2759
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2753
2760
|
}));
|
|
2754
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2761
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2755
2762
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2756
2763
|
|
|
2757
2764
|
// src/commonSelectors.ts
|
|
@@ -2770,8 +2777,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2770
2777
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2771
2778
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2772
2779
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2773
|
-
|
|
2774
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2780
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2775
2781
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2776
2782
|
return { isAdmin, uiPermissions };
|
|
2777
2783
|
}
|
|
@@ -2840,10 +2846,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2840
2846
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2841
2847
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2842
2848
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2843
|
-
const updateAttribute =
|
|
2849
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2844
2850
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2845
2851
|
const attributes = [
|
|
2846
|
-
...previousFilters.map((item) =>
|
|
2852
|
+
...previousFilters.map((item) => ({
|
|
2853
|
+
...item,
|
|
2847
2854
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2848
2855
|
category: "recently used",
|
|
2849
2856
|
priority: 0
|
|
@@ -2861,14 +2868,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2861
2868
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2862
2869
|
}
|
|
2863
2870
|
);
|
|
2864
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
});
|
|
2871
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2872
|
+
...remainder,
|
|
2873
|
+
...onboarding,
|
|
2874
|
+
complete: onboarding.complete || complete,
|
|
2875
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2876
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2877
|
+
}));
|
|
2872
2878
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2873
2879
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2874
2880
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2889,12 +2895,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2889
2895
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2890
2896
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2891
2897
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2892
|
-
|
|
2893
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2898
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2894
2899
|
const { devices = {} } = deployment;
|
|
2895
2900
|
return {
|
|
2896
2901
|
deployment,
|
|
2897
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2902
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2898
2903
|
};
|
|
2899
2904
|
}
|
|
2900
2905
|
);
|
|
@@ -2909,8 +2914,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2909
2914
|
}, {})
|
|
2910
2915
|
);
|
|
2911
2916
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2912
|
-
|
|
2913
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2917
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2914
2918
|
if (staticOnly) {
|
|
2915
2919
|
return Object.keys(uiPermissions.groups).sort();
|
|
2916
2920
|
}
|
|
@@ -2944,9 +2948,9 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2944
2948
|
if (auditlogEvent) {
|
|
2945
2949
|
const { object = {} } = auditlogEvent;
|
|
2946
2950
|
const { device = {}, id, type } = object;
|
|
2947
|
-
auditlogDevice = type === "device" ?
|
|
2951
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2948
2952
|
}
|
|
2949
|
-
return
|
|
2953
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2950
2954
|
});
|
|
2951
2955
|
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2952
2956
|
if (service_provider) {
|
|
@@ -2998,8 +3002,9 @@ var sessionReducer = (state, action) => {
|
|
|
2998
3002
|
return rootReducer(state, action);
|
|
2999
3003
|
};
|
|
3000
3004
|
var getConfiguredStore = (options = {}) => {
|
|
3001
|
-
const
|
|
3002
|
-
return (0, import_toolkit16.configureStore)(
|
|
3005
|
+
const { preloadedState = {}, ...config } = options;
|
|
3006
|
+
return (0, import_toolkit16.configureStore)({
|
|
3007
|
+
...config,
|
|
3003
3008
|
preloadedState,
|
|
3004
3009
|
reducer: sessionReducer,
|
|
3005
3010
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -3012,7 +3017,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
3012
3017
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
3013
3018
|
}
|
|
3014
3019
|
})
|
|
3015
|
-
})
|
|
3020
|
+
});
|
|
3016
3021
|
};
|
|
3017
3022
|
var store = getConfiguredStore({
|
|
3018
3023
|
preloadedState: {}
|
|
@@ -3032,17 +3037,16 @@ var dateFunctionMap = {
|
|
|
3032
3037
|
setDays: "setDate"
|
|
3033
3038
|
};
|
|
3034
3039
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
3035
|
-
var _a, _b2;
|
|
3036
3040
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
3037
3041
|
const today = /* @__PURE__ */ new Date();
|
|
3038
3042
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
3039
|
-
const setter =
|
|
3040
|
-
const getter =
|
|
3043
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3044
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
3041
3045
|
today[setter](today[getter]() - interval);
|
|
3042
3046
|
let value;
|
|
3043
3047
|
try {
|
|
3044
3048
|
value = today.toISOString();
|
|
3045
|
-
} catch
|
|
3049
|
+
} catch {
|
|
3046
3050
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
3047
3051
|
}
|
|
3048
3052
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3083,37 +3087,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3083
3087
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3084
3088
|
return accu;
|
|
3085
3089
|
},
|
|
3086
|
-
{ latestVersions:
|
|
3090
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3087
3091
|
);
|
|
3088
3092
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3089
3093
|
return Promise.resolve(
|
|
3090
3094
|
dispatch(
|
|
3091
|
-
actions.setVersionInformation(
|
|
3095
|
+
actions.setVersionInformation({
|
|
3096
|
+
...latestVersions,
|
|
3092
3097
|
backend: info,
|
|
3093
3098
|
GUI: info,
|
|
3094
3099
|
latestRelease: {
|
|
3095
3100
|
releaseDate: latestRelease.release_date,
|
|
3096
3101
|
repos: latestRepos
|
|
3097
3102
|
}
|
|
3098
|
-
})
|
|
3103
|
+
})
|
|
3099
3104
|
)
|
|
3100
3105
|
);
|
|
3101
3106
|
});
|
|
3102
3107
|
});
|
|
3103
3108
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3104
3109
|
const currentState = getSearchState(getState());
|
|
3105
|
-
let nextState =
|
|
3106
|
-
|
|
3107
|
-
|
|
3110
|
+
let nextState = {
|
|
3111
|
+
...currentState,
|
|
3112
|
+
...searchState,
|
|
3113
|
+
sort: {
|
|
3114
|
+
...currentState.sort,
|
|
3115
|
+
...searchState.sort
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3108
3118
|
let tasks = [];
|
|
3109
|
-
const
|
|
3110
|
-
const
|
|
3119
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3120
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3111
3121
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3112
3122
|
nextState.isSearching = true;
|
|
3113
3123
|
tasks.push(
|
|
3114
3124
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3115
3125
|
const searchResult = results[results.length - 1];
|
|
3116
|
-
return dispatch(actions.setSearchState(
|
|
3126
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3117
3127
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3118
3128
|
);
|
|
3119
3129
|
}
|
|
@@ -3130,13 +3140,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3130
3140
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3131
3141
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3132
3142
|
(accu, item) => {
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3143
|
+
const filter = item.filter ?? {};
|
|
3144
|
+
let deployment = {
|
|
3145
|
+
...deploymentPrototype,
|
|
3146
|
+
...deploymentsById[item.id],
|
|
3147
|
+
...item,
|
|
3148
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3137
3149
|
name: decodeURIComponent(item.name)
|
|
3138
|
-
}
|
|
3139
|
-
deployment =
|
|
3150
|
+
};
|
|
3151
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3140
3152
|
accu.deployments[item.id] = deployment;
|
|
3141
3153
|
accu.deploymentIds.push(item.id);
|
|
3142
3154
|
return accu;
|
|
@@ -3190,11 +3202,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3190
3202
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3191
3203
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3192
3204
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3193
|
-
const deployment =
|
|
3205
|
+
const deployment = {
|
|
3206
|
+
...newDeployment,
|
|
3194
3207
|
id: deploymentId,
|
|
3195
3208
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3196
3209
|
statistics: { status: {} }
|
|
3197
|
-
}
|
|
3210
|
+
};
|
|
3198
3211
|
let tasks = [
|
|
3199
3212
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3200
3213
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3337,14 +3350,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3337
3350
|
({ deploymentId, updateControlMap }, { dispatch }) => general_api_default.patch(`${deploymentsApiUrl}/deployments/${deploymentId}`, { update_control_map: updateControlMap }).catch((err) => commonErrorHandler(err, "There was an error while updating the deployment status:", dispatch)).then(() => Promise.resolve(dispatch(getSingleDeployment(deploymentId))))
|
|
3338
3351
|
);
|
|
3339
3352
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3340
|
-
const
|
|
3353
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3341
3354
|
const currentState = getState().deployments.selectionState;
|
|
3342
|
-
let nextState =
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3355
|
+
let nextState = {
|
|
3356
|
+
...currentState,
|
|
3357
|
+
...selectionState,
|
|
3358
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3359
|
+
accu[item] = {
|
|
3360
|
+
...currentState[item],
|
|
3361
|
+
...selectionState[item]
|
|
3362
|
+
};
|
|
3363
|
+
return accu;
|
|
3364
|
+
}, {}),
|
|
3365
|
+
general: {
|
|
3366
|
+
...currentState.general,
|
|
3367
|
+
...selectionState.general
|
|
3368
|
+
}
|
|
3369
|
+
};
|
|
3348
3370
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3349
3371
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3350
3372
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3374,15 +3396,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3374
3396
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3375
3397
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3376
3398
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3377
|
-
const config =
|
|
3399
|
+
const config = {
|
|
3400
|
+
...oldConfig,
|
|
3378
3401
|
hasDelta: Boolean(delta.enabled),
|
|
3379
|
-
binaryDelta:
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3402
|
+
binaryDelta: {
|
|
3403
|
+
...oldConfig.binaryDelta,
|
|
3404
|
+
timeout: timeoutConfig,
|
|
3405
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3406
|
+
},
|
|
3407
|
+
binaryDeltaLimits: {
|
|
3408
|
+
...oldConfig.binaryDeltaLimits,
|
|
3409
|
+
timeout: timeoutLimit,
|
|
3410
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3411
|
+
}
|
|
3412
|
+
};
|
|
3386
3413
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3387
3414
|
})
|
|
3388
3415
|
);
|
|
@@ -3392,7 +3419,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3392
3419
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3393
3420
|
return accu;
|
|
3394
3421
|
}
|
|
3395
|
-
accu =
|
|
3422
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3396
3423
|
}
|
|
3397
3424
|
return accu;
|
|
3398
3425
|
}, void 0);
|
|
@@ -3412,9 +3439,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3412
3439
|
}
|
|
3413
3440
|
return general_api_default.put(`${deploymentsApiUrl}/config/binary_delta`, result).catch((err) => commonErrorHandler(err, "There was a problem storing your delta artifact generation configuration.", dispatch)).then(() => {
|
|
3414
3441
|
const oldConfig = getState().deployments.config;
|
|
3415
|
-
const newConfig =
|
|
3416
|
-
|
|
3417
|
-
|
|
3442
|
+
const newConfig = {
|
|
3443
|
+
...oldConfig,
|
|
3444
|
+
binaryDelta: {
|
|
3445
|
+
...oldConfig.binaryDelta,
|
|
3446
|
+
...config
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3418
3449
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3419
3450
|
});
|
|
3420
3451
|
});
|
|
@@ -3427,19 +3458,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3427
3458
|
var import_axios2 = require("axios");
|
|
3428
3459
|
var import_pluralize = __toESM(require_pluralize());
|
|
3429
3460
|
|
|
3430
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3431
|
-
var
|
|
3432
|
-
var
|
|
3433
|
-
var poolPtr = rnds8Pool.length;
|
|
3461
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3462
|
+
var getRandomValues;
|
|
3463
|
+
var rnds8 = new Uint8Array(16);
|
|
3434
3464
|
function rng() {
|
|
3435
|
-
if (
|
|
3436
|
-
|
|
3437
|
-
|
|
3465
|
+
if (!getRandomValues) {
|
|
3466
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3467
|
+
if (!getRandomValues) {
|
|
3468
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3469
|
+
}
|
|
3438
3470
|
}
|
|
3439
|
-
return
|
|
3471
|
+
return getRandomValues(rnds8);
|
|
3440
3472
|
}
|
|
3441
3473
|
|
|
3442
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3474
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3443
3475
|
var byteToHex = [];
|
|
3444
3476
|
for (let i = 0; i < 256; ++i) {
|
|
3445
3477
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3448,13 +3480,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3448
3480
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
3449
3481
|
}
|
|
3450
3482
|
|
|
3451
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3452
|
-
var
|
|
3483
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3484
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3453
3485
|
var native_default = {
|
|
3454
|
-
randomUUID
|
|
3486
|
+
randomUUID
|
|
3455
3487
|
};
|
|
3456
3488
|
|
|
3457
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3489
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3458
3490
|
function v4(options, buf, offset) {
|
|
3459
3491
|
if (native_default.randomUUID && !buf && !options) {
|
|
3460
3492
|
return native_default.randomUUID();
|
|
@@ -3496,14 +3528,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3496
3528
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3497
3529
|
const state = getGroupsById(getState());
|
|
3498
3530
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3499
|
-
|
|
3500
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3531
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3501
3532
|
accu[id] = group;
|
|
3502
3533
|
}
|
|
3503
3534
|
return accu;
|
|
3504
3535
|
}, {});
|
|
3505
3536
|
const groups = res.data.reduce((accu, group) => {
|
|
3506
|
-
accu[group] =
|
|
3537
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3507
3538
|
return accu;
|
|
3508
3539
|
}, dynamicGroups);
|
|
3509
3540
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3561,7 +3592,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3561
3592
|
() => Promise.resolve(
|
|
3562
3593
|
dispatch(
|
|
3563
3594
|
actions3.addGroup({
|
|
3564
|
-
group:
|
|
3595
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3565
3596
|
groupName: group
|
|
3566
3597
|
})
|
|
3567
3598
|
)
|
|
@@ -3589,20 +3620,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3589
3620
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3590
3621
|
const state = getGroupsById(getState());
|
|
3591
3622
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3592
|
-
|
|
3593
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3623
|
+
if (!(group.id || group.filters?.length)) {
|
|
3594
3624
|
accu[id] = group;
|
|
3595
3625
|
}
|
|
3596
3626
|
return accu;
|
|
3597
3627
|
}, {});
|
|
3598
3628
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3599
|
-
accu[filter.name] =
|
|
3629
|
+
accu[filter.name] = {
|
|
3600
3630
|
deviceIds: [],
|
|
3601
|
-
total: 0
|
|
3602
|
-
|
|
3631
|
+
total: 0,
|
|
3632
|
+
...state[filter.name],
|
|
3603
3633
|
id: filter.id,
|
|
3604
3634
|
filters: mapTermsToFilters(filter.terms)
|
|
3605
|
-
}
|
|
3635
|
+
};
|
|
3606
3636
|
return accu;
|
|
3607
3637
|
}, staticGroups);
|
|
3608
3638
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3642,10 +3672,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3642
3672
|
);
|
|
3643
3673
|
});
|
|
3644
3674
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3645
|
-
var _a;
|
|
3646
3675
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3647
3676
|
const selectedGroup = groupsState.byId[groupName];
|
|
3648
|
-
const groupFilterLength =
|
|
3677
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3649
3678
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3650
3679
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3651
3680
|
};
|
|
@@ -3668,7 +3697,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3668
3697
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3669
3698
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3670
3699
|
(accu, device) => {
|
|
3671
|
-
var _a, _b2, _c;
|
|
3672
3700
|
const stateDevice = getDeviceById(state, device.id);
|
|
3673
3701
|
const {
|
|
3674
3702
|
attributes: storedAttributes = {},
|
|
@@ -3678,29 +3706,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3678
3706
|
group: storedGroup
|
|
3679
3707
|
} = stateDevice;
|
|
3680
3708
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3681
|
-
device.tags =
|
|
3682
|
-
device.group =
|
|
3683
|
-
device.monitor =
|
|
3684
|
-
device.identity_data =
|
|
3709
|
+
device.tags = { ...storedTags, ...tags };
|
|
3710
|
+
device.group = system.group ?? storedGroup;
|
|
3711
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3712
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3685
3713
|
device.status = status ? status : device.status || identity.status;
|
|
3686
|
-
device.check_in_time_rounded =
|
|
3687
|
-
device.check_in_time_exact =
|
|
3714
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3715
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3688
3716
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3689
3717
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3690
3718
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3691
3719
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3692
|
-
device.attributes = device.attributes ?
|
|
3693
|
-
accu.devicesById[device.id] =
|
|
3720
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3721
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3694
3722
|
accu.ids.push(device.id);
|
|
3695
3723
|
return accu;
|
|
3696
3724
|
},
|
|
3697
3725
|
{ ids, devicesById: {} }
|
|
3698
3726
|
);
|
|
3699
3727
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3700
|
-
const
|
|
3728
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3701
3729
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3702
3730
|
return Promise.resolve(
|
|
3703
|
-
dispatch(getDevicesByStatus2(
|
|
3731
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3704
3732
|
).unwrap().then((results) => {
|
|
3705
3733
|
if (!group) {
|
|
3706
3734
|
return Promise.resolve();
|
|
@@ -3714,7 +3742,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3714
3742
|
dispatch(
|
|
3715
3743
|
actions3.addGroup({
|
|
3716
3744
|
group: {
|
|
3717
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3745
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3718
3746
|
total
|
|
3719
3747
|
},
|
|
3720
3748
|
groupName: group
|
|
@@ -3863,27 +3891,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3863
3891
|
);
|
|
3864
3892
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3865
3893
|
`${sliceName3}/setDeviceListState`,
|
|
3866
|
-
(
|
|
3867
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3868
|
-
var _c;
|
|
3894
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3869
3895
|
const currentState = getDeviceListState(getState());
|
|
3870
3896
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3871
|
-
let nextState =
|
|
3897
|
+
let nextState = {
|
|
3898
|
+
...currentState,
|
|
3872
3899
|
setOnly: false,
|
|
3873
|
-
refreshTrigger
|
|
3874
|
-
|
|
3875
|
-
sort:
|
|
3876
|
-
}
|
|
3900
|
+
refreshTrigger,
|
|
3901
|
+
...selectionState,
|
|
3902
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3903
|
+
};
|
|
3877
3904
|
let tasks = [];
|
|
3878
|
-
const
|
|
3879
|
-
const
|
|
3905
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3906
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3880
3907
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3881
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3908
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3882
3909
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3883
3910
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3884
3911
|
nextState.isLoading = true;
|
|
3885
3912
|
tasks.push(
|
|
3886
|
-
dispatch(getDevicesByStatus2(
|
|
3913
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3887
3914
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3888
3915
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3889
3916
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3908,8 +3935,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3908
3935
|
} = options;
|
|
3909
3936
|
const state = getState();
|
|
3910
3937
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3911
|
-
filters: filterSelection
|
|
3912
|
-
group: group
|
|
3938
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3939
|
+
group: group ?? getSelectedGroup(state),
|
|
3913
3940
|
groups: state.devices.groups,
|
|
3914
3941
|
offlineThreshold: state.app.offlineThreshold,
|
|
3915
3942
|
selectedIssues,
|
|
@@ -3970,7 +3997,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3970
3997
|
});
|
|
3971
3998
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3972
3999
|
const state = getState();
|
|
3973
|
-
let options =
|
|
4000
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3974
4001
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3975
4002
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3976
4003
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4105,8 +4132,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4105
4132
|
({ data: auditLogEntries }) => {
|
|
4106
4133
|
const { start, end } = auditLogEntries.reduce(
|
|
4107
4134
|
(accu, item) => {
|
|
4108
|
-
|
|
4109
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4135
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4110
4136
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4111
4137
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4112
4138
|
}
|
|
@@ -4213,8 +4239,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4213
4239
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4214
4240
|
`${sliceName3}/getDeviceConfig`,
|
|
4215
4241
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4216
|
-
|
|
4217
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4242
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4218
4243
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4219
4244
|
}
|
|
4220
4245
|
})
|
|
@@ -4226,15 +4251,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4226
4251
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4227
4252
|
`${sliceName3}/applyDeviceConfig`,
|
|
4228
4253
|
({ deviceId, configDeploymentConfiguration, isDefault, config }, { dispatch, getState }) => general_api_default.post(`${deviceConfig}/${deviceId}/deploy`, configDeploymentConfiguration).catch((err) => commonErrorHandler(err, `There was an error deploying the configuration to device ${deviceId}.`, dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4229
|
-
var _a;
|
|
4230
4254
|
const device = getDeviceById(getState(), deviceId);
|
|
4231
4255
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4232
4256
|
let tasks = [
|
|
4233
|
-
dispatch(actions3.receivedDevice(
|
|
4257
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4234
4258
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4235
4259
|
];
|
|
4236
4260
|
if (isDefault && canManageUsers) {
|
|
4237
|
-
const { previous } =
|
|
4261
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4238
4262
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4239
4263
|
}
|
|
4240
4264
|
return Promise.all(tasks);
|
|
@@ -4250,21 +4274,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4250
4274
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4251
4275
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4252
4276
|
{ headers }
|
|
4253
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4277
|
+
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice({ ...device, id: deviceId, tags })), dispatch(setSnackbar3("Device name changed"))]));
|
|
4254
4278
|
})
|
|
4255
4279
|
)
|
|
4256
4280
|
);
|
|
4257
4281
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4258
4282
|
let providerResult = {};
|
|
4259
4283
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4260
|
-
providerResult =
|
|
4284
|
+
providerResult = { ...data, twinError: "" };
|
|
4261
4285
|
}).catch((err) => {
|
|
4262
4286
|
providerResult = {
|
|
4263
4287
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4264
4288
|
};
|
|
4265
4289
|
}).finally(() => {
|
|
4266
4290
|
const device = getDeviceById(getState(), deviceId);
|
|
4267
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4291
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4268
4292
|
});
|
|
4269
4293
|
});
|
|
4270
4294
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4280,7 +4304,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4280
4304
|
const { twinsByIntegration = {} } = device;
|
|
4281
4305
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4282
4306
|
return Promise.resolve(
|
|
4283
|
-
dispatch(actions3.receivedDevice(
|
|
4307
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4284
4308
|
);
|
|
4285
4309
|
})
|
|
4286
4310
|
);
|
|
@@ -4301,8 +4325,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4301
4325
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4302
4326
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4303
4327
|
const filters = [
|
|
4304
|
-
|
|
4305
|
-
|
|
4328
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4329
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4306
4330
|
];
|
|
4307
4331
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4308
4332
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4314,11 +4338,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4314
4338
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4315
4339
|
const state2 = getState();
|
|
4316
4340
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4317
|
-
const device =
|
|
4341
|
+
const device = {
|
|
4342
|
+
...getDeviceById(state2, id),
|
|
4318
4343
|
systemDeviceIds: ids,
|
|
4319
4344
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4320
|
-
}
|
|
4321
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4345
|
+
};
|
|
4346
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4322
4347
|
});
|
|
4323
4348
|
});
|
|
4324
4349
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4326,9 +4351,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4326
4351
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4327
4352
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4328
4353
|
const filters = [
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4354
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4355
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4356
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4332
4357
|
];
|
|
4333
4358
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4334
4359
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4375,7 +4400,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4375
4400
|
var cutoffLength = 75;
|
|
4376
4401
|
var ellipsis = "...";
|
|
4377
4402
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4378
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4403
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4379
4404
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4380
4405
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4381
4406
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4393,14 +4418,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4393
4418
|
});
|
|
4394
4419
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4395
4420
|
const state = getState();
|
|
4396
|
-
const
|
|
4397
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4421
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4422
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4423
|
+
...remainder,
|
|
4398
4424
|
filters,
|
|
4399
4425
|
group,
|
|
4400
4426
|
offlineThreshold: state.app.offlineThreshold,
|
|
4401
4427
|
selectedIssues: [type],
|
|
4402
4428
|
status
|
|
4403
|
-
})
|
|
4429
|
+
});
|
|
4404
4430
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4405
4431
|
page: 1,
|
|
4406
4432
|
per_page: 1,
|
|
@@ -4452,21 +4478,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4452
4478
|
return steps[progress2];
|
|
4453
4479
|
};
|
|
4454
4480
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4455
|
-
var _a;
|
|
4456
4481
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4457
4482
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4458
4483
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4459
4484
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4460
|
-
let deviceType =
|
|
4485
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4461
4486
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4462
4487
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4463
|
-
return
|
|
4488
|
+
return {
|
|
4489
|
+
...onboardingState,
|
|
4464
4490
|
complete: !!(Boolean(userCookie) || onboardingState.complete || acceptedDevices.length > 1 && pendingDevices.length > 0 && releases.length > 1 && pastDeployments.length > 1 || acceptedDevices.length >= 1 && releases.length >= 2 && pastDeployments.length > 2 || acceptedDevices.length >= 1 && pendingDevices.length > 0 && releases.length >= 2 && pastDeployments.length >= 2 || orderedOnboardingSteps.findIndex((step) => step === progress2) >= orderedOnboardingSteps.length - 1 || onboardingState.disable || ![canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases].every((i) => i)),
|
|
4465
4491
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4466
4492
|
deviceType,
|
|
4467
4493
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4468
4494
|
progress: progress2
|
|
4469
|
-
}
|
|
4495
|
+
};
|
|
4470
4496
|
};
|
|
4471
4497
|
var getOnboardingState2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4472
4498
|
const state = getState();
|
|
@@ -4524,7 +4550,7 @@ var advanceOnboarding = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4524
4550
|
return;
|
|
4525
4551
|
}
|
|
4526
4552
|
const madeProgress = steps[stepIndex + 1];
|
|
4527
|
-
const state =
|
|
4553
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4528
4554
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4529
4555
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4530
4556
|
});
|
|
@@ -4538,20 +4564,21 @@ var { setSnackbar: setSnackbar4, initUpload: initUpload2, uploadProgress: upload
|
|
|
4538
4564
|
var { page: defaultPage4, perPage: defaultPerPage4 } = DEVICE_LIST_DEFAULTS;
|
|
4539
4565
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4540
4566
|
var flattenRelease = (release, stateRelease) => {
|
|
4541
|
-
|
|
4542
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4567
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4543
4568
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4544
4569
|
(accu, item) => {
|
|
4545
|
-
var _a2;
|
|
4546
4570
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4547
|
-
const stateArtifact =
|
|
4571
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4548
4572
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4549
|
-
accu.artifacts.push(
|
|
4573
|
+
accu.artifacts.push({
|
|
4574
|
+
...stateArtifact,
|
|
4575
|
+
...item
|
|
4576
|
+
});
|
|
4550
4577
|
return accu;
|
|
4551
4578
|
},
|
|
4552
4579
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4553
4580
|
);
|
|
4554
|
-
return
|
|
4581
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4555
4582
|
};
|
|
4556
4583
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4557
4584
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4569,17 +4596,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4569
4596
|
{ release: null, index: -1 }
|
|
4570
4597
|
);
|
|
4571
4598
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4572
|
-
var _a;
|
|
4573
4599
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4574
4600
|
if (!release || index === -1) {
|
|
4575
4601
|
return;
|
|
4576
4602
|
}
|
|
4577
4603
|
const releaseArtifacts = [...release.artifacts];
|
|
4578
4604
|
const artifact = releaseArtifacts[index];
|
|
4579
|
-
const { key, name, version } = (
|
|
4605
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4580
4606
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4581
4607
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4582
|
-
filters: [
|
|
4608
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4583
4609
|
});
|
|
4584
4610
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4585
4611
|
page: 1,
|
|
@@ -4593,10 +4619,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4593
4619
|
}
|
|
4594
4620
|
const installCount = Number(headers[headerNames.total]);
|
|
4595
4621
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4596
|
-
releaseArtifacts2[index2] =
|
|
4597
|
-
release2 =
|
|
4622
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4623
|
+
release2 = {
|
|
4624
|
+
...release2,
|
|
4598
4625
|
artifacts: releaseArtifacts2
|
|
4599
|
-
}
|
|
4626
|
+
};
|
|
4600
4627
|
return dispatch(actions7.receiveRelease(release2));
|
|
4601
4628
|
});
|
|
4602
4629
|
});
|
|
@@ -4608,12 +4635,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4608
4635
|
return dispatch(getReleases());
|
|
4609
4636
|
}
|
|
4610
4637
|
const releaseArtifacts = [...release.artifacts];
|
|
4611
|
-
releaseArtifacts[index] =
|
|
4638
|
+
releaseArtifacts[index] = {
|
|
4639
|
+
...releaseArtifacts[index],
|
|
4612
4640
|
url: response.data.uri
|
|
4613
|
-
}
|
|
4614
|
-
release =
|
|
4641
|
+
};
|
|
4642
|
+
release = {
|
|
4643
|
+
...release,
|
|
4615
4644
|
artifacts: releaseArtifacts
|
|
4616
|
-
}
|
|
4645
|
+
};
|
|
4617
4646
|
return dispatch(actions7.receiveRelease(release));
|
|
4618
4647
|
})
|
|
4619
4648
|
);
|
|
@@ -4738,12 +4767,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4738
4767
|
});
|
|
4739
4768
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4740
4769
|
const currentState = getState().releases.releasesList;
|
|
4741
|
-
let nextState =
|
|
4742
|
-
|
|
4743
|
-
|
|
4770
|
+
let nextState = {
|
|
4771
|
+
...currentState,
|
|
4772
|
+
...selectionState,
|
|
4773
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4774
|
+
};
|
|
4744
4775
|
let tasks = [];
|
|
4745
|
-
const
|
|
4746
|
-
const
|
|
4776
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4777
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4747
4778
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4748
4779
|
nextState.isLoading = true;
|
|
4749
4780
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4762,29 +4793,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4762
4793
|
);
|
|
4763
4794
|
};
|
|
4764
4795
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4765
|
-
let releaseListState =
|
|
4796
|
+
let releaseListState = { ...state.releasesList };
|
|
4766
4797
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4767
4798
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4768
4799
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4769
4800
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4770
4801
|
if (searchOnly) {
|
|
4771
|
-
releaseListState =
|
|
4802
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4772
4803
|
} else {
|
|
4773
|
-
releaseListState =
|
|
4804
|
+
releaseListState = {
|
|
4805
|
+
...releaseListState,
|
|
4774
4806
|
releaseIds,
|
|
4775
4807
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4776
4808
|
total: !isFiltering ? total : state.releasesList.total
|
|
4777
|
-
}
|
|
4809
|
+
};
|
|
4778
4810
|
}
|
|
4779
4811
|
return releaseListState;
|
|
4780
4812
|
};
|
|
4781
4813
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4782
|
-
const config =
|
|
4814
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4783
4815
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4784
4816
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4785
4817
|
const state = getState().releases;
|
|
4786
4818
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4787
|
-
const combinedReleases =
|
|
4819
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4788
4820
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4789
4821
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4790
4822
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4805,7 +4837,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4805
4837
|
`${sliceName7}/updateReleaseInfo`,
|
|
4806
4838
|
({ name, info }, { dispatch, getState }) => general_api_default.patch(`${deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(() => {
|
|
4807
4839
|
return Promise.all([
|
|
4808
|
-
dispatch(actions7.receiveRelease(
|
|
4840
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4809
4841
|
dispatch(setSnackbar4("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4810
4842
|
]);
|
|
4811
4843
|
})
|
|
@@ -4814,7 +4846,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4814
4846
|
`${sliceName7}/setReleaseTags`,
|
|
4815
4847
|
({ name, tags = [] }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(() => {
|
|
4816
4848
|
return Promise.all([
|
|
4817
|
-
dispatch(actions7.receiveRelease(
|
|
4849
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4818
4850
|
dispatch(setSnackbar4("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4819
4851
|
]);
|
|
4820
4852
|
})
|
|
@@ -4831,19 +4863,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4831
4863
|
// src/api/users-api.ts
|
|
4832
4864
|
var import_axios4 = __toESM(require("axios"));
|
|
4833
4865
|
var Api2 = {
|
|
4834
|
-
postLogin: (url,
|
|
4835
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4836
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4837
|
-
var _a2;
|
|
4838
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4839
|
-
});
|
|
4840
|
-
},
|
|
4866
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios4.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
4841
4867
|
putVerifyTFA: (url, userData) => {
|
|
4842
4868
|
let body = {};
|
|
4843
4869
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4844
4870
|
body = { token2fa: userData.token2fa };
|
|
4845
4871
|
}
|
|
4846
|
-
return import_axios4.default.put(url, body,
|
|
4872
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4847
4873
|
}
|
|
4848
4874
|
};
|
|
4849
4875
|
var users_api_default = Api2;
|
|
@@ -4871,43 +4897,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4871
4897
|
};
|
|
4872
4898
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4873
4899
|
`${sliceName8}/loginUser`,
|
|
4874
|
-
(
|
|
4875
|
-
|
|
4876
|
-
return
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
Promise.
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
window.
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
);
|
|
4909
|
-
});
|
|
4910
|
-
}
|
|
4900
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
4901
|
+
cleanUp();
|
|
4902
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
4903
|
+
}).then(({ text: response, contentType }) => {
|
|
4904
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
4905
|
+
const { id, kind } = response;
|
|
4906
|
+
const type = kind.split("/")[1];
|
|
4907
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
4908
|
+
window.location.replace(ssoLoginUrl);
|
|
4909
|
+
return;
|
|
4910
|
+
}
|
|
4911
|
+
const token = response;
|
|
4912
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
4913
|
+
return;
|
|
4914
|
+
}
|
|
4915
|
+
let now = /* @__PURE__ */ new Date();
|
|
4916
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
4917
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
4918
|
+
setSessionInfo({ token, expiresAt });
|
|
4919
|
+
cookies4.remove("JWT", { path: "/" });
|
|
4920
|
+
return (
|
|
4921
|
+
// @ts-ignore
|
|
4922
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
4923
|
+
cleanUp();
|
|
4924
|
+
return Promise.reject(dispatch(setSnackbar5(extractErrorMessage(e))));
|
|
4925
|
+
}).then(() => {
|
|
4926
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
4927
|
+
if (window.location.pathname !== "/ui/") {
|
|
4928
|
+
window.location.replace("/ui/");
|
|
4929
|
+
}
|
|
4930
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
4931
|
+
})
|
|
4932
|
+
);
|
|
4933
|
+
})
|
|
4911
4934
|
);
|
|
4912
4935
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4913
4936
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4924,7 +4947,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4924
4947
|
return Promise.reject();
|
|
4925
4948
|
}
|
|
4926
4949
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4927
|
-
setSessionInfo(
|
|
4950
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4928
4951
|
window.location.reload();
|
|
4929
4952
|
});
|
|
4930
4953
|
});
|
|
@@ -4987,13 +5010,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4987
5010
|
);
|
|
4988
5011
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
4989
5012
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
4990
|
-
const userId = currentUserId
|
|
5013
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
4991
5014
|
const storageKey = `${userId}-column-widths`;
|
|
4992
5015
|
let customColumns = [];
|
|
4993
5016
|
if (!columns) {
|
|
4994
5017
|
try {
|
|
4995
5018
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
4996
|
-
} catch
|
|
5019
|
+
} catch {
|
|
4997
5020
|
}
|
|
4998
5021
|
} else {
|
|
4999
5022
|
customColumns = columns;
|
|
@@ -5022,10 +5045,7 @@ var userActions = {
|
|
|
5022
5045
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5023
5046
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5024
5047
|
`${sliceName8}/createUser`,
|
|
5025
|
-
(
|
|
5026
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5027
|
-
return general_api_default.post(`${useradmApiUrlv1}/users`, __spreadProps(__spreadValues({}, userData), { send_reset_password: shouldResetPassword })).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch));
|
|
5028
|
-
}
|
|
5048
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
5029
5049
|
);
|
|
5030
5050
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5031
5051
|
`${sliceName8}/removeUser`,
|
|
@@ -5036,15 +5056,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5036
5056
|
);
|
|
5037
5057
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5038
5058
|
`${sliceName8}/editUser`,
|
|
5039
|
-
(
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
()
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
])
|
|
5046
|
-
);
|
|
5047
|
-
}
|
|
5059
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5060
|
+
() => Promise.all([
|
|
5061
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5062
|
+
dispatch(setSnackbar5(userActions.edit.successMessage))
|
|
5063
|
+
])
|
|
5064
|
+
)
|
|
5048
5065
|
);
|
|
5049
5066
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5050
5067
|
const { id } = getOrganization(getState());
|
|
@@ -5079,7 +5096,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5079
5096
|
}
|
|
5080
5097
|
return accu;
|
|
5081
5098
|
},
|
|
5082
|
-
|
|
5099
|
+
{ ...emptyUiPermissions }
|
|
5083
5100
|
);
|
|
5084
5101
|
var permissionActionTypes = {
|
|
5085
5102
|
any: mapHttpPermission,
|
|
@@ -5102,20 +5119,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5102
5119
|
}, existingPermissions);
|
|
5103
5120
|
var tryParseCustomPermission = (permission) => {
|
|
5104
5121
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5105
|
-
const result = mergePermissions(
|
|
5122
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5106
5123
|
return { isCustom: true, permission, result };
|
|
5107
5124
|
};
|
|
5108
5125
|
var customPermissionHandler = (accu, permission) => {
|
|
5109
5126
|
let processor = tryParseCustomPermission(permission);
|
|
5110
|
-
return
|
|
5127
|
+
return {
|
|
5128
|
+
...accu,
|
|
5111
5129
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5112
5130
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5113
|
-
}
|
|
5131
|
+
};
|
|
5114
5132
|
};
|
|
5115
5133
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5116
5134
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5117
5135
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5118
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5136
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5119
5137
|
};
|
|
5120
5138
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5121
5139
|
if (Array.isArray(permissions)) {
|
|
@@ -5130,60 +5148,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5130
5148
|
if (!processor) {
|
|
5131
5149
|
return accu;
|
|
5132
5150
|
}
|
|
5133
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5134
|
-
var _a;
|
|
5135
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5136
|
-
});
|
|
5151
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5137
5152
|
if (scope) {
|
|
5138
5153
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5139
|
-
return
|
|
5154
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5140
5155
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5141
5156
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5142
5157
|
}
|
|
5143
|
-
return
|
|
5158
|
+
return {
|
|
5159
|
+
...accu,
|
|
5144
5160
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5145
5161
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5146
|
-
}
|
|
5162
|
+
};
|
|
5147
5163
|
},
|
|
5148
|
-
{ isCustom: false, uiPermissions:
|
|
5164
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5149
5165
|
);
|
|
5150
5166
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5151
5167
|
};
|
|
5152
5168
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5153
5169
|
(accu, role) => {
|
|
5154
|
-
var _a;
|
|
5155
5170
|
let normalizedPermissions;
|
|
5156
5171
|
let isCustom = false;
|
|
5157
5172
|
if (rolesById2[role.name]) {
|
|
5158
|
-
normalizedPermissions =
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5173
|
+
normalizedPermissions = {
|
|
5174
|
+
...rolesById2[role.name].uiPermissions,
|
|
5175
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5176
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5177
|
+
};
|
|
5162
5178
|
} else {
|
|
5163
5179
|
const result = parseRolePermissions(role, permissionSets);
|
|
5164
5180
|
normalizedPermissions = result.uiPermissions;
|
|
5165
5181
|
isCustom = result.isCustom;
|
|
5166
5182
|
}
|
|
5167
|
-
const roleState =
|
|
5168
|
-
accu[role.name] =
|
|
5183
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5184
|
+
accu[role.name] = {
|
|
5185
|
+
...roleState,
|
|
5186
|
+
...role,
|
|
5169
5187
|
description: roleState.description ? roleState.description : role.description,
|
|
5170
5188
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5171
5189
|
isCustom,
|
|
5172
5190
|
name: roleState.name ? roleState.name : role.name,
|
|
5173
5191
|
uiPermissions: normalizedPermissions
|
|
5174
|
-
}
|
|
5192
|
+
};
|
|
5175
5193
|
return accu;
|
|
5176
5194
|
},
|
|
5177
|
-
|
|
5195
|
+
{ ...rolesById2 }
|
|
5178
5196
|
);
|
|
5179
5197
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5180
5198
|
`${sliceName8}/getPermissionSets`,
|
|
5181
5199
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5182
5200
|
const permissionSets = data.reduce(
|
|
5183
5201
|
(accu, permissionSet) => {
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5202
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5203
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5187
5204
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5188
5205
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5189
5206
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5194,11 +5211,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5194
5211
|
}
|
|
5195
5212
|
return collector;
|
|
5196
5213
|
}, accu2),
|
|
5197
|
-
|
|
5214
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5198
5215
|
);
|
|
5199
5216
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5200
|
-
|
|
5201
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5217
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5202
5218
|
accu2.push(key);
|
|
5203
5219
|
}
|
|
5204
5220
|
return accu2;
|
|
@@ -5211,7 +5227,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5211
5227
|
return accu;
|
|
5212
5228
|
},
|
|
5213
5229
|
// @ts-ignore
|
|
5214
|
-
|
|
5230
|
+
{ ...getState().users.permissionSetsById }
|
|
5215
5231
|
);
|
|
5216
5232
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5217
5233
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5244,28 +5260,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5244
5260
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5245
5261
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5246
5262
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5247
|
-
|
|
5248
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5263
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5249
5264
|
type: uiPermissionsByArea[area].scope,
|
|
5250
5265
|
value: []
|
|
5251
5266
|
};
|
|
5252
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5267
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5268
|
+
...permissionSetState,
|
|
5253
5269
|
value: [...permissionSetState.value, item]
|
|
5254
|
-
}
|
|
5270
|
+
};
|
|
5255
5271
|
return itemPermissionAccu;
|
|
5256
5272
|
}, accu);
|
|
5257
5273
|
return accu;
|
|
5258
5274
|
}, {});
|
|
5259
|
-
return Object.entries(permissionSetObject).map((
|
|
5260
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5275
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5261
5276
|
if (value.includes(excessiveAccessSelector)) {
|
|
5262
5277
|
return { name };
|
|
5263
5278
|
}
|
|
5264
|
-
return { name, scope:
|
|
5279
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5265
5280
|
});
|
|
5266
5281
|
};
|
|
5267
5282
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5268
|
-
const role =
|
|
5283
|
+
const role = { ...roleState, ...roleData };
|
|
5269
5284
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5270
5285
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5271
5286
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5301,12 +5316,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5301
5316
|
}, []);
|
|
5302
5317
|
return {
|
|
5303
5318
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5304
|
-
role:
|
|
5319
|
+
role: {
|
|
5320
|
+
...emptyRole,
|
|
5305
5321
|
name,
|
|
5306
5322
|
// @ts-ignore
|
|
5307
5323
|
description: description ? description : roleState.description,
|
|
5308
|
-
uiPermissions:
|
|
5309
|
-
|
|
5324
|
+
uiPermissions: {
|
|
5325
|
+
...emptyUiPermissions,
|
|
5326
|
+
...roleUiPermissions,
|
|
5327
|
+
...maybeUiPermissions
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5310
5330
|
};
|
|
5311
5331
|
};
|
|
5312
5332
|
var roleActions = {
|
|
@@ -5357,13 +5377,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5357
5377
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5358
5378
|
`${sliceName8}/saveGlobalSettings`,
|
|
5359
5379
|
// @ts-ignore
|
|
5360
|
-
(
|
|
5361
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5380
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5362
5381
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5363
5382
|
return;
|
|
5364
5383
|
}
|
|
5365
5384
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5366
|
-
let updatedSettings =
|
|
5385
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5367
5386
|
if (getCurrentUser(getState()).verified) {
|
|
5368
5387
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5369
5388
|
} else {
|
|
@@ -5401,10 +5420,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5401
5420
|
const userSettings = getUserSettings(getState());
|
|
5402
5421
|
const onboardingState = getOnboardingState(getState());
|
|
5403
5422
|
const tooltipState = getTooltipsState(getState());
|
|
5404
|
-
const updatedSettings =
|
|
5405
|
-
|
|
5423
|
+
const updatedSettings = {
|
|
5424
|
+
...userSettings,
|
|
5425
|
+
// @ts-ignore
|
|
5426
|
+
...settings,
|
|
5427
|
+
onboarding: {
|
|
5428
|
+
...onboardingState,
|
|
5429
|
+
// @ts-ignore
|
|
5430
|
+
...settings.onboarding
|
|
5431
|
+
},
|
|
5406
5432
|
tooltips: tooltipState
|
|
5407
|
-
}
|
|
5433
|
+
};
|
|
5408
5434
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5409
5435
|
return Promise.all([
|
|
5410
5436
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5430,9 +5456,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5430
5456
|
`${sliceName8}/getTokens`,
|
|
5431
5457
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5432
5458
|
const user = getCurrentUser(getState());
|
|
5433
|
-
const updatedUser =
|
|
5459
|
+
const updatedUser = {
|
|
5460
|
+
...user,
|
|
5434
5461
|
tokens
|
|
5435
|
-
}
|
|
5462
|
+
};
|
|
5436
5463
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5437
5464
|
})
|
|
5438
5465
|
);
|
|
@@ -5448,8 +5475,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5448
5475
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5449
5476
|
)
|
|
5450
5477
|
);
|
|
5451
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5452
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5478
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5453
5479
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5454
5480
|
if (persist) {
|
|
5455
5481
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5457,14 +5483,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5457
5483
|
return Promise.all(tasks);
|
|
5458
5484
|
});
|
|
5459
5485
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5460
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5486
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5461
5487
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5462
5488
|
});
|
|
5463
5489
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5464
5490
|
`${sliceName8}/submitFeedback`,
|
|
5465
5491
|
// @ts-ignore
|
|
5466
|
-
(
|
|
5467
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5492
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5468
5493
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5469
5494
|
subject: "feedback submission",
|
|
5470
5495
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5554,8 +5579,8 @@ var completeUpgrade = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5554
5579
|
({ tenantId, plan }, { dispatch }) => general_api_default.post(`${tenantadmApiUrlv2}/tenants/${tenantId}/upgrade/complete`, { plan }).catch((err) => commonErrorHandler(err, `There was an error upgrading your account:`, dispatch)).then(() => Promise.resolve(dispatch(getUserOrganization())))
|
|
5555
5580
|
);
|
|
5556
5581
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
5557
|
-
const userId =
|
|
5558
|
-
const detail =
|
|
5582
|
+
const userId = userFilter?.id || userFilter;
|
|
5583
|
+
const detail = detailFilter?.id || detailFilter;
|
|
5559
5584
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
5560
5585
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
5561
5586
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -5582,12 +5607,14 @@ var getAuditLogsCsvLink = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5582
5607
|
);
|
|
5583
5608
|
var setAuditlogsState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
5584
5609
|
const currentState = getAuditlogState(getState());
|
|
5585
|
-
let nextState =
|
|
5586
|
-
|
|
5587
|
-
|
|
5610
|
+
let nextState = {
|
|
5611
|
+
...currentState,
|
|
5612
|
+
...selectionState,
|
|
5613
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5614
|
+
};
|
|
5588
5615
|
let tasks = [];
|
|
5589
|
-
const
|
|
5590
|
-
const
|
|
5616
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
5617
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
5591
5618
|
if (!(0, import_helpers12.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
5592
5619
|
nextState.isLoading = true;
|
|
5593
5620
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -5599,27 +5626,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
5599
5626
|
var addTenant = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
5600
5627
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar6("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
5601
5628
|
});
|
|
5602
|
-
var tenantListRetrieval = (config) =>
|
|
5629
|
+
var tenantListRetrieval = async (config) => {
|
|
5603
5630
|
const { page, perPage } = config;
|
|
5604
5631
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
5605
|
-
const tenantList =
|
|
5632
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
5606
5633
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
5607
5634
|
return [tenantList.data, Number(totalCount)];
|
|
5608
|
-
}
|
|
5609
|
-
var getTenants = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
5635
|
+
};
|
|
5636
|
+
var getTenants = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
5610
5637
|
const currentState = getTenantsList(getState());
|
|
5611
|
-
const [tenants, pageCount] =
|
|
5612
|
-
dispatch(actions6.setTenantListState(
|
|
5613
|
-
})
|
|
5614
|
-
var setTenantsListState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
5638
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
5639
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
5640
|
+
});
|
|
5641
|
+
var setTenantsListState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
5615
5642
|
const currentState = getTenantsList(getState());
|
|
5616
|
-
const nextState =
|
|
5643
|
+
const nextState = {
|
|
5644
|
+
...currentState,
|
|
5645
|
+
...selectionState
|
|
5646
|
+
};
|
|
5617
5647
|
if (!(0, import_helpers12.deepCompare)(currentState, selectionState)) {
|
|
5618
|
-
const [tenants, pageCount] =
|
|
5619
|
-
return dispatch(actions6.setTenantListState(
|
|
5648
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
5649
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
5620
5650
|
}
|
|
5621
|
-
return dispatch(actions6.setTenantListState(
|
|
5622
|
-
})
|
|
5651
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
5652
|
+
});
|
|
5623
5653
|
var editTenantDeviceLimit = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
5624
5654
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
5625
5655
|
const tasks = [Promise.resolve(dispatch(setSnackbar6("Device Limit was changed successfully")))];
|
|
@@ -5662,10 +5692,7 @@ var downloadLicenseReport = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5662
5692
|
);
|
|
5663
5693
|
var createIntegration = (0, import_toolkit24.createAsyncThunk)(
|
|
5664
5694
|
`${sliceName6}/createIntegration`,
|
|
5665
|
-
(
|
|
5666
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
5667
|
-
return general_api_default.post(`${iotManagerBaseURL}/integrations`, integration).catch((err) => commonErrorHandler(err, "There was an error creating the integration", dispatch, commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar6("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
5668
|
-
}
|
|
5695
|
+
({ id, ...integration }, { dispatch }) => general_api_default.post(`${iotManagerBaseURL}/integrations`, integration).catch((err) => commonErrorHandler(err, "There was an error creating the integration", dispatch, commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar6("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
5669
5696
|
);
|
|
5670
5697
|
var changeIntegration = (0, import_toolkit24.createAsyncThunk)(
|
|
5671
5698
|
`${sliceName6}/changeIntegration`,
|
|
@@ -5686,9 +5713,8 @@ var getIntegrations = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5686
5713
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
5687
5714
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
5688
5715
|
const integrations = data.reduce((accu, item) => {
|
|
5689
|
-
|
|
5690
|
-
const
|
|
5691
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
5716
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
5717
|
+
const integration = { ...existingIntegration, ...item };
|
|
5692
5718
|
accu.push(integration);
|
|
5693
5719
|
return accu;
|
|
5694
5720
|
}, []);
|
|
@@ -5740,7 +5766,7 @@ var getSsoConfigById = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5740
5766
|
`${sliceName6}/getSsoConfigById`,
|
|
5741
5767
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
5742
5768
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
5743
|
-
return sso ? Promise.resolve(
|
|
5769
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
5744
5770
|
})
|
|
5745
5771
|
);
|
|
5746
5772
|
var getSsoConfigs = (0, import_toolkit24.createAsyncThunk)(
|
|
@@ -5749,39 +5775,4 @@ var getSsoConfigs = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5749
5775
|
({ data }) => Promise.all(data.map((config) => dispatch(getSsoConfigById(config)).unwrap())).then((configs) => dispatch(actions6.receiveSsoConfigs(configs))).catch((err) => commonErrorHandler(err, err, dispatch, ""))
|
|
5750
5776
|
)
|
|
5751
5777
|
);
|
|
5752
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5753
|
-
0 && (module.exports = {
|
|
5754
|
-
addTenant,
|
|
5755
|
-
cancelRequest,
|
|
5756
|
-
cancelUpgrade,
|
|
5757
|
-
changeIntegration,
|
|
5758
|
-
changeSsoConfig,
|
|
5759
|
-
completeUpgrade,
|
|
5760
|
-
confirmCardUpdate,
|
|
5761
|
-
createIntegration,
|
|
5762
|
-
createOrganizationTrial,
|
|
5763
|
-
deleteIntegration,
|
|
5764
|
-
deleteSsoConfig,
|
|
5765
|
-
downloadLicenseReport,
|
|
5766
|
-
editTenantDeviceLimit,
|
|
5767
|
-
getAuditLogs,
|
|
5768
|
-
getAuditLogsCsvLink,
|
|
5769
|
-
getCurrentCard,
|
|
5770
|
-
getIntegrations,
|
|
5771
|
-
getSsoConfigById,
|
|
5772
|
-
getSsoConfigs,
|
|
5773
|
-
getTargetLocation,
|
|
5774
|
-
getTenants,
|
|
5775
|
-
getUserOrganization,
|
|
5776
|
-
getWebhookEvents,
|
|
5777
|
-
removeTenant,
|
|
5778
|
-
requestPlanChange,
|
|
5779
|
-
sendSupportMessage,
|
|
5780
|
-
setAuditlogsState,
|
|
5781
|
-
setTenantsListState,
|
|
5782
|
-
startCardUpdate,
|
|
5783
|
-
startUpgrade,
|
|
5784
|
-
storeSsoConfig,
|
|
5785
|
-
tenantDataDivergedMessage
|
|
5786
|
-
});
|
|
5787
5778
|
//# sourceMappingURL=thunks.js.map
|