@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 = {};
|
|
@@ -467,7 +417,7 @@ var chartTypes = {
|
|
|
467
417
|
};
|
|
468
418
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
469
419
|
var defaultReportType = "distribution";
|
|
470
|
-
var defaultReports = [
|
|
420
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
471
421
|
var locations = {};
|
|
472
422
|
var PLANS = {
|
|
473
423
|
os: {
|
|
@@ -800,7 +750,7 @@ var emptyRole = Object.freeze({
|
|
|
800
750
|
name: void 0,
|
|
801
751
|
description: "",
|
|
802
752
|
permissions: [],
|
|
803
|
-
uiPermissions: Object.freeze(
|
|
753
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
804
754
|
});
|
|
805
755
|
|
|
806
756
|
// src/deploymentsSlice/constants.ts
|
|
@@ -829,11 +779,12 @@ var deploymentStatesToSubstates = {
|
|
|
829
779
|
pending: [deploymentSubstates.pending],
|
|
830
780
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
831
781
|
};
|
|
832
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
782
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
783
|
+
...deploymentStatesToSubstates,
|
|
833
784
|
failures: [deploymentSubstates.failure],
|
|
834
785
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
835
786
|
successes: [deploymentSubstates.success]
|
|
836
|
-
}
|
|
787
|
+
};
|
|
837
788
|
var installationSubstatesMap = {
|
|
838
789
|
download: {
|
|
839
790
|
title: "download",
|
|
@@ -878,8 +829,8 @@ var DEPLOYMENT_STATES = {
|
|
|
878
829
|
var listDefaultsByState = {
|
|
879
830
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
880
831
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
881
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
882
|
-
[DEPLOYMENT_STATES.finished]:
|
|
832
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
833
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
883
834
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
884
835
|
};
|
|
885
836
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1254,7 +1205,7 @@ var uiPermissionsByArea = {
|
|
|
1254
1205
|
}
|
|
1255
1206
|
};
|
|
1256
1207
|
var permissionMapper = (permission) => permission.value;
|
|
1257
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1208
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1258
1209
|
var rolesById = Object.freeze({
|
|
1259
1210
|
[staticRolesByName.admin]: {
|
|
1260
1211
|
name: "Admin",
|
|
@@ -1262,54 +1213,59 @@ var rolesById = Object.freeze({
|
|
|
1262
1213
|
description: "Full access",
|
|
1263
1214
|
permissions: [],
|
|
1264
1215
|
// permissions refers to the values returned from the backend
|
|
1265
|
-
uiPermissions:
|
|
1216
|
+
uiPermissions: {
|
|
1217
|
+
...emptyUiPermissions,
|
|
1266
1218
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1267
1219
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1268
1220
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1269
1221
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1270
1222
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1271
|
-
}
|
|
1223
|
+
}
|
|
1272
1224
|
},
|
|
1273
1225
|
[staticRolesByName.readOnly]: {
|
|
1274
1226
|
name: "Read Access",
|
|
1275
1227
|
value: staticRolesByName.readOnly,
|
|
1276
1228
|
description: "",
|
|
1277
1229
|
permissions: [],
|
|
1278
|
-
uiPermissions:
|
|
1230
|
+
uiPermissions: {
|
|
1231
|
+
...emptyUiPermissions,
|
|
1279
1232
|
deployments: [uiPermissionsById.read.value],
|
|
1280
1233
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1281
1234
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1282
1235
|
userManagement: [uiPermissionsById.read.value]
|
|
1283
|
-
}
|
|
1236
|
+
}
|
|
1284
1237
|
},
|
|
1285
1238
|
[staticRolesByName.ci]: {
|
|
1286
1239
|
name: "Releases Manager",
|
|
1287
1240
|
value: staticRolesByName.ci,
|
|
1288
1241
|
description: "",
|
|
1289
1242
|
permissions: [],
|
|
1290
|
-
uiPermissions:
|
|
1243
|
+
uiPermissions: {
|
|
1244
|
+
...emptyUiPermissions,
|
|
1291
1245
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1292
|
-
}
|
|
1246
|
+
}
|
|
1293
1247
|
},
|
|
1294
1248
|
[staticRolesByName.deploymentsManager]: {
|
|
1295
1249
|
name: "Deployments Manager",
|
|
1296
1250
|
value: staticRolesByName.deploymentsManager,
|
|
1297
1251
|
description: "",
|
|
1298
1252
|
permissions: [],
|
|
1299
|
-
uiPermissions:
|
|
1253
|
+
uiPermissions: {
|
|
1254
|
+
...emptyUiPermissions,
|
|
1300
1255
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1301
1256
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1302
1257
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1303
|
-
}
|
|
1258
|
+
}
|
|
1304
1259
|
},
|
|
1305
1260
|
[staticRolesByName.terminalAccess]: {
|
|
1306
1261
|
name: "Troubleshooting",
|
|
1307
1262
|
value: staticRolesByName.terminalAccess,
|
|
1308
1263
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1309
1264
|
permissions: [],
|
|
1310
|
-
uiPermissions:
|
|
1265
|
+
uiPermissions: {
|
|
1266
|
+
...emptyUiPermissions,
|
|
1311
1267
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1312
|
-
}
|
|
1268
|
+
}
|
|
1313
1269
|
}
|
|
1314
1270
|
});
|
|
1315
1271
|
var serviceProviderRolesById = {
|
|
@@ -1318,22 +1274,24 @@ var serviceProviderRolesById = {
|
|
|
1318
1274
|
value: staticRolesByName.admin,
|
|
1319
1275
|
description: "Full access",
|
|
1320
1276
|
permissions: [],
|
|
1321
|
-
uiPermissions:
|
|
1277
|
+
uiPermissions: {
|
|
1278
|
+
...emptyUiPermissions,
|
|
1322
1279
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1323
1280
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1324
1281
|
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1325
|
-
}
|
|
1282
|
+
}
|
|
1326
1283
|
},
|
|
1327
1284
|
readOnly: {
|
|
1328
1285
|
name: "Read access",
|
|
1329
1286
|
value: staticRolesByName.admin,
|
|
1330
1287
|
description: "This role can see all linked organizations but cannot make any changes",
|
|
1331
1288
|
permissions: [],
|
|
1332
|
-
uiPermissions:
|
|
1289
|
+
uiPermissions: {
|
|
1290
|
+
...emptyUiPermissions,
|
|
1333
1291
|
auditlog: [uiPermissionsById.read.value],
|
|
1334
1292
|
userManagement: [uiPermissionsById.read.value],
|
|
1335
1293
|
tenantManagement: [uiPermissionsById.read.value]
|
|
1336
|
-
}
|
|
1294
|
+
}
|
|
1337
1295
|
}
|
|
1338
1296
|
};
|
|
1339
1297
|
var defaultPermissionSets = {
|
|
@@ -1346,7 +1304,9 @@ var defaultPermissionSets = {
|
|
|
1346
1304
|
},
|
|
1347
1305
|
[permissionSetIds.SuperUser]: {
|
|
1348
1306
|
name: permissionSetIds.SuperUser,
|
|
1349
|
-
result:
|
|
1307
|
+
result: {
|
|
1308
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1309
|
+
}
|
|
1350
1310
|
},
|
|
1351
1311
|
[permissionSetIds.ManageUsers]: {
|
|
1352
1312
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1431,11 +1391,12 @@ var defaultPermissionSets = {
|
|
|
1431
1391
|
};
|
|
1432
1392
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1433
1393
|
var OWN_USER_ID = "me";
|
|
1434
|
-
var rolesByName =
|
|
1394
|
+
var rolesByName = {
|
|
1395
|
+
...staticRolesByName,
|
|
1435
1396
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1436
1397
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1437
1398
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1438
|
-
}
|
|
1399
|
+
};
|
|
1439
1400
|
var twoFAStates = {
|
|
1440
1401
|
enabled: "enabled",
|
|
1441
1402
|
disabled: "disabled",
|
|
@@ -1462,10 +1423,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
1462
1423
|
var getSearchedDevices = (0, import_toolkit.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
1463
1424
|
var getVersionInformation = (0, import_toolkit.createSelector)(
|
|
1464
1425
|
[getFullVersionInformation, getFeatures],
|
|
1465
|
-
(
|
|
1466
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
1467
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
1468
|
-
}
|
|
1426
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
1469
1427
|
);
|
|
1470
1428
|
var getIsPreview = (0, import_toolkit.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers.versionCompare)(Integration, "next") > -1);
|
|
1471
1429
|
|
|
@@ -1482,8 +1440,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
1482
1440
|
var getMappedDeploymentSelection = (0, import_toolkit2.createSelector)(
|
|
1483
1441
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
1484
1442
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
1485
|
-
|
|
1486
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
1443
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
1487
1444
|
return selection.reduce((accu, id) => {
|
|
1488
1445
|
if (deploymentsById[id]) {
|
|
1489
1446
|
accu.push(deploymentsById[id]);
|
|
@@ -1527,7 +1484,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
1527
1484
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
1528
1485
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
1529
1486
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
1530
|
-
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
1487
|
+
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
1488
|
+
...filteringAttributes,
|
|
1531
1489
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
1532
1490
|
}));
|
|
1533
1491
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -1555,10 +1513,7 @@ var getDeviceCountsByStatus = (0, import_toolkit3.createSelector)(
|
|
|
1555
1513
|
return accu;
|
|
1556
1514
|
}, {})
|
|
1557
1515
|
);
|
|
1558
|
-
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
1559
|
-
var _a;
|
|
1560
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
1561
|
-
});
|
|
1516
|
+
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
1562
1517
|
var getSelectedGroupInfo = (0, import_toolkit3.createSelector)(
|
|
1563
1518
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
1564
1519
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -1575,17 +1530,13 @@ var getLimitMaxed = (0, import_toolkit3.createSelector)(
|
|
|
1575
1530
|
[getAcceptedDevices, getDeviceLimit],
|
|
1576
1531
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
1577
1532
|
);
|
|
1578
|
-
var
|
|
1579
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], (_a) => {
|
|
1580
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
1581
|
-
return groups;
|
|
1582
|
-
});
|
|
1533
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
1583
1534
|
var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById) => {
|
|
1584
1535
|
const groupNames = Object.keys(groupsById).sort();
|
|
1585
1536
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
1586
1537
|
(accu, [groupname, group]) => {
|
|
1587
1538
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
1588
|
-
const groupItem =
|
|
1539
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
1589
1540
|
if (group.filters.length > 0) {
|
|
1590
1541
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
1591
1542
|
accu.dynamic.push(groupItem);
|
|
@@ -1599,7 +1550,7 @@ var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById
|
|
|
1599
1550
|
},
|
|
1600
1551
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
1601
1552
|
);
|
|
1602
|
-
return
|
|
1553
|
+
return { groupNames, ...groupedGroups };
|
|
1603
1554
|
});
|
|
1604
1555
|
var getAttributesList = (0, import_toolkit3.createSelector)(
|
|
1605
1556
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -1639,10 +1590,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
1639
1590
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
1640
1591
|
var getDeviceTwinIntegrations = (0, import_toolkit4.createSelector)(
|
|
1641
1592
|
[getExternalIntegrations],
|
|
1642
|
-
(integrations) => integrations.filter((integration) =>
|
|
1643
|
-
var _a;
|
|
1644
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
1645
|
-
})
|
|
1593
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
1646
1594
|
);
|
|
1647
1595
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
1648
1596
|
var getWebhooks = (0, import_toolkit4.createSelector)(
|
|
@@ -1676,15 +1624,12 @@ var filterProcessors = {
|
|
|
1676
1624
|
var filterAliases = {
|
|
1677
1625
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
1678
1626
|
};
|
|
1679
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1686
|
-
};
|
|
1687
|
-
});
|
|
1627
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
1628
|
+
scope: filter.scope,
|
|
1629
|
+
attribute: filter.key,
|
|
1630
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
1631
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1632
|
+
}));
|
|
1688
1633
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
1689
1634
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
1690
1635
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -1694,14 +1639,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
1694
1639
|
});
|
|
1695
1640
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
1696
1641
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
1697
|
-
return
|
|
1642
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
1698
1643
|
}
|
|
1699
1644
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
1700
1645
|
});
|
|
1701
1646
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
1702
|
-
var _a;
|
|
1703
1647
|
let applicableFilters = [...filters];
|
|
1704
|
-
if (typeof group === "string" && !(
|
|
1648
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
1705
1649
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
1706
1650
|
}
|
|
1707
1651
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -1722,12 +1666,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
1722
1666
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
1723
1667
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
1724
1668
|
if (id && byId[id]) {
|
|
1725
|
-
accu.push(
|
|
1669
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
1726
1670
|
}
|
|
1727
1671
|
return accu;
|
|
1728
1672
|
}, []);
|
|
1729
1673
|
};
|
|
1730
|
-
var mergePermissions = (existingPermissions =
|
|
1674
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
1731
1675
|
(accu, [key, value]) => {
|
|
1732
1676
|
let values;
|
|
1733
1677
|
if (!accu[key]) {
|
|
@@ -1737,12 +1681,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
1737
1681
|
if (Array.isArray(value)) {
|
|
1738
1682
|
values = [...value, ...accu[key]].filter(import_helpers3.duplicateFilter);
|
|
1739
1683
|
} else {
|
|
1740
|
-
values = mergePermissions(accu[key],
|
|
1684
|
+
values = mergePermissions(accu[key], { ...value });
|
|
1741
1685
|
}
|
|
1742
1686
|
accu[key] = values;
|
|
1743
1687
|
return accu;
|
|
1744
1688
|
},
|
|
1745
|
-
|
|
1689
|
+
{ ...addedPermissions }
|
|
1746
1690
|
);
|
|
1747
1691
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
1748
1692
|
(accu, roleId) => {
|
|
@@ -1751,20 +1695,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
1751
1695
|
}
|
|
1752
1696
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
1753
1697
|
},
|
|
1754
|
-
|
|
1698
|
+
{ ...emptyUiPermissions }
|
|
1755
1699
|
);
|
|
1756
1700
|
var progress = ({ loaded, total }) => {
|
|
1757
1701
|
let uploadProgress4 = loaded / total * 100;
|
|
1758
1702
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
1759
1703
|
};
|
|
1760
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
1761
|
-
var _a, _b2, _c, _d, _e;
|
|
1762
|
-
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;
|
|
1763
|
-
};
|
|
1704
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
1764
1705
|
var preformatWithRequestID = (res, failMsg) => {
|
|
1765
1706
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
1766
1707
|
try {
|
|
1767
|
-
if (
|
|
1708
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
1768
1709
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
1769
1710
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
1770
1711
|
}
|
|
@@ -1779,9 +1720,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
1779
1720
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1780
1721
|
return accu;
|
|
1781
1722
|
}
|
|
1782
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
1723
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
1724
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
1783
1725
|
[attribute.name]: attribute.value
|
|
1784
|
-
}
|
|
1726
|
+
};
|
|
1785
1727
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1786
1728
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
1787
1729
|
}
|
|
@@ -1800,15 +1742,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
1800
1742
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
1801
1743
|
var getReleaseMappingDefaults = () => ({});
|
|
1802
1744
|
var getReleasesList = (0, import_toolkit5.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
1803
|
-
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
1745
|
+
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
1804
1746
|
var getHasReleases = (0, import_toolkit5.createSelector)(
|
|
1805
1747
|
[getReleaseListState, getReleasesById],
|
|
1806
1748
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
1807
1749
|
);
|
|
1808
|
-
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
1809
|
-
var _a;
|
|
1810
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
1811
|
-
});
|
|
1750
|
+
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
1812
1751
|
|
|
1813
1752
|
// src/usersSlice/selectors.ts
|
|
1814
1753
|
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
@@ -1817,10 +1756,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
1817
1756
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
1818
1757
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
1819
1758
|
var getUsersById = (state) => state.users.byId;
|
|
1820
|
-
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
1821
|
-
var _a;
|
|
1822
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
1823
|
-
});
|
|
1759
|
+
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
1824
1760
|
var getUserSettings = (state) => state.users.userSettings;
|
|
1825
1761
|
var getIsDarkMode = (0, import_toolkit6.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
1826
1762
|
var getShowHelptips = (0, import_toolkit6.createSelector)(
|
|
@@ -1831,22 +1767,22 @@ var getTooltipsState = (0, import_toolkit6.createSelector)(
|
|
|
1831
1767
|
[getTooltipsById, getUserSettings],
|
|
1832
1768
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
1833
1769
|
(accu, [id, value]) => {
|
|
1834
|
-
accu[id] =
|
|
1770
|
+
accu[id] = { ...accu[id], ...value };
|
|
1835
1771
|
return accu;
|
|
1836
1772
|
},
|
|
1837
|
-
|
|
1773
|
+
{ ...tooltips }
|
|
1838
1774
|
)
|
|
1839
1775
|
);
|
|
1840
1776
|
var getHas2FA = (0, import_toolkit6.createSelector)(
|
|
1841
1777
|
[getCurrentUser],
|
|
1842
1778
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
1843
1779
|
);
|
|
1844
|
-
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
1780
|
+
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
1845
1781
|
var getOfflineThresholdSettings = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
1846
|
-
interval:
|
|
1847
|
-
intervalUnit:
|
|
1782
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
1783
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
1848
1784
|
}));
|
|
1849
|
-
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
1785
|
+
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
1850
1786
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
1851
1787
|
|
|
1852
1788
|
// src/commonSelectors.ts
|
|
@@ -1865,8 +1801,7 @@ var getSearchEndpoint = (0, import_toolkit7.createSelector)(
|
|
|
1865
1801
|
var getUserRoles = (0, import_toolkit7.createSelector)(
|
|
1866
1802
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
1867
1803
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
1868
|
-
|
|
1869
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1804
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1870
1805
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
1871
1806
|
return { isAdmin, uiPermissions };
|
|
1872
1807
|
}
|
|
@@ -1935,10 +1870,11 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1935
1870
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
1936
1871
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
1937
1872
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1938
|
-
const updateAttribute =
|
|
1873
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
1939
1874
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1940
1875
|
const attributes = [
|
|
1941
|
-
...previousFilters.map((item) =>
|
|
1876
|
+
...previousFilters.map((item) => ({
|
|
1877
|
+
...item,
|
|
1942
1878
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
1943
1879
|
category: "recently used",
|
|
1944
1880
|
priority: 0
|
|
@@ -1956,14 +1892,13 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1956
1892
|
return (0, import_helpers4.attributeDuplicateFilter)(attributes, "key");
|
|
1957
1893
|
}
|
|
1958
1894
|
);
|
|
1959
|
-
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], (
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
});
|
|
1895
|
+
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
1896
|
+
...remainder,
|
|
1897
|
+
...onboarding,
|
|
1898
|
+
complete: onboarding.complete || complete,
|
|
1899
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
1900
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
1901
|
+
}));
|
|
1967
1902
|
var getDemoDeviceAddress = (0, import_toolkit7.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
1968
1903
|
const demoDeviceAddress = `http://${(0, import_helpers4.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
1969
1904
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -1984,12 +1919,11 @@ var getDeploymentRelease = (0, import_toolkit7.createSelector)(
|
|
|
1984
1919
|
var getSelectedDeploymentData = (0, import_toolkit7.createSelector)(
|
|
1985
1920
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
1986
1921
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
1987
|
-
|
|
1988
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
1922
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
1989
1923
|
const { devices = {} } = deployment;
|
|
1990
1924
|
return {
|
|
1991
1925
|
deployment,
|
|
1992
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
1926
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
1993
1927
|
};
|
|
1994
1928
|
}
|
|
1995
1929
|
);
|
|
@@ -2004,8 +1938,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit7.createSelector)(
|
|
|
2004
1938
|
}, {})
|
|
2005
1939
|
);
|
|
2006
1940
|
var getGroupNames = (0, import_toolkit7.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2007
|
-
|
|
2008
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
1941
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2009
1942
|
if (staticOnly) {
|
|
2010
1943
|
return Object.keys(uiPermissions.groups).sort();
|
|
2011
1944
|
}
|
|
@@ -2039,9 +1972,9 @@ var getAuditlogDevice = (0, import_toolkit7.createSelector)([getAuditLogEntry, g
|
|
|
2039
1972
|
if (auditlogEvent) {
|
|
2040
1973
|
const { object = {} } = auditlogEvent;
|
|
2041
1974
|
const { device = {}, id, type } = object;
|
|
2042
|
-
auditlogDevice = type === "device" ?
|
|
1975
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2043
1976
|
}
|
|
2044
|
-
return
|
|
1977
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2045
1978
|
});
|
|
2046
1979
|
var getRelevantRoles = (0, import_toolkit7.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2047
1980
|
if (service_provider) {
|
|
@@ -2069,18 +2002,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2069
2002
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2070
2003
|
var tokenCache = "";
|
|
2071
2004
|
var getSessionInfo = () => {
|
|
2072
|
-
|
|
2073
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2005
|
+
let sessionInfo = { ...emptySession };
|
|
2074
2006
|
try {
|
|
2075
|
-
sessionInfo = JSON.parse(
|
|
2076
|
-
} catch
|
|
2007
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2008
|
+
} catch {
|
|
2077
2009
|
}
|
|
2078
2010
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2079
2011
|
cleanUp();
|
|
2080
|
-
return
|
|
2012
|
+
return { ...emptySession };
|
|
2081
2013
|
}
|
|
2082
2014
|
if (!sessionInfo.token) {
|
|
2083
|
-
let jwtTokenFromCookie =
|
|
2015
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2084
2016
|
if (jwtTokenFromCookie) {
|
|
2085
2017
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2086
2018
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2108,8 +2040,7 @@ var maxSessionAge = 900;
|
|
|
2108
2040
|
|
|
2109
2041
|
// src/api/general-api.ts
|
|
2110
2042
|
var unauthorizedRedirect = (error) => {
|
|
2111
|
-
|
|
2112
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2043
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2113
2044
|
cleanUp();
|
|
2114
2045
|
window.location.replace("/ui/");
|
|
2115
2046
|
}
|
|
@@ -2119,7 +2050,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2119
2050
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2120
2051
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2121
2052
|
authenticatedRequest.interceptors.request.use(
|
|
2122
|
-
(config) =>
|
|
2053
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2123
2054
|
(error) => Promise.reject(error)
|
|
2124
2055
|
);
|
|
2125
2056
|
var Api = {
|
|
@@ -2127,7 +2058,7 @@ var Api = {
|
|
|
2127
2058
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2128
2059
|
patch: authenticatedRequest.patch,
|
|
2129
2060
|
post: authenticatedRequest.post,
|
|
2130
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2061
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2131
2062
|
put: authenticatedRequest.put,
|
|
2132
2063
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2133
2064
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2224,7 +2155,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2224
2155
|
initialState,
|
|
2225
2156
|
reducers: {
|
|
2226
2157
|
setFeatures: (state, action) => {
|
|
2227
|
-
state.features =
|
|
2158
|
+
state.features = {
|
|
2159
|
+
...state.features,
|
|
2160
|
+
...action.payload
|
|
2161
|
+
};
|
|
2228
2162
|
},
|
|
2229
2163
|
setSnackbar: (state, { payload }) => {
|
|
2230
2164
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -2249,7 +2183,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2249
2183
|
state.hostedAnnouncement = action.payload;
|
|
2250
2184
|
},
|
|
2251
2185
|
setSearchState: (state, action) => {
|
|
2252
|
-
state.searchState =
|
|
2186
|
+
state.searchState = {
|
|
2187
|
+
...state.searchState,
|
|
2188
|
+
...action.payload
|
|
2189
|
+
};
|
|
2253
2190
|
},
|
|
2254
2191
|
setOfflineThreshold: (state, action) => {
|
|
2255
2192
|
state.offlineThreshold = action.payload;
|
|
@@ -2260,20 +2197,23 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2260
2197
|
},
|
|
2261
2198
|
uploadProgress: (state, action) => {
|
|
2262
2199
|
const { id, progress: progress2 } = action.payload;
|
|
2263
|
-
state.uploadsById[id] =
|
|
2200
|
+
state.uploadsById[id] = {
|
|
2201
|
+
...state.uploadsById[id],
|
|
2264
2202
|
progress: progress2
|
|
2265
|
-
}
|
|
2203
|
+
};
|
|
2266
2204
|
},
|
|
2267
2205
|
cleanUpUpload: (state, action) => {
|
|
2268
|
-
|
|
2269
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2206
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
2270
2207
|
state.uploadsById = remainder;
|
|
2271
2208
|
},
|
|
2272
2209
|
setVersionInformation: (state, action) => {
|
|
2273
|
-
state.versionInformation =
|
|
2210
|
+
state.versionInformation = {
|
|
2211
|
+
...state.versionInformation,
|
|
2212
|
+
...action.payload
|
|
2213
|
+
};
|
|
2274
2214
|
},
|
|
2275
2215
|
setEnvironmentData: (state, action) => {
|
|
2276
|
-
return
|
|
2216
|
+
return { ...state, ...action.payload };
|
|
2277
2217
|
}
|
|
2278
2218
|
}
|
|
2279
2219
|
});
|
|
@@ -2291,17 +2231,16 @@ var dateFunctionMap = {
|
|
|
2291
2231
|
setDays: "setDate"
|
|
2292
2232
|
};
|
|
2293
2233
|
var setOfflineThreshold = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2294
|
-
var _a, _b2;
|
|
2295
2234
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2296
2235
|
const today = /* @__PURE__ */ new Date();
|
|
2297
2236
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2298
|
-
const setter =
|
|
2299
|
-
const getter =
|
|
2237
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
2238
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2300
2239
|
today[setter](today[getter]() - interval);
|
|
2301
2240
|
let value;
|
|
2302
2241
|
try {
|
|
2303
2242
|
value = today.toISOString();
|
|
2304
|
-
} catch
|
|
2243
|
+
} catch {
|
|
2305
2244
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2306
2245
|
}
|
|
2307
2246
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -2342,37 +2281,43 @@ var getLatestReleaseInfo = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/g
|
|
|
2342
2281
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
2343
2282
|
return accu;
|
|
2344
2283
|
},
|
|
2345
|
-
{ latestVersions:
|
|
2284
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
2346
2285
|
);
|
|
2347
2286
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
2348
2287
|
return Promise.resolve(
|
|
2349
2288
|
dispatch(
|
|
2350
|
-
actions.setVersionInformation(
|
|
2289
|
+
actions.setVersionInformation({
|
|
2290
|
+
...latestVersions,
|
|
2351
2291
|
backend: info,
|
|
2352
2292
|
GUI: info,
|
|
2353
2293
|
latestRelease: {
|
|
2354
2294
|
releaseDate: latestRelease.release_date,
|
|
2355
2295
|
repos: latestRepos
|
|
2356
2296
|
}
|
|
2357
|
-
})
|
|
2297
|
+
})
|
|
2358
2298
|
)
|
|
2359
2299
|
);
|
|
2360
2300
|
});
|
|
2361
2301
|
});
|
|
2362
2302
|
var setSearchState = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
2363
2303
|
const currentState = getSearchState(getState());
|
|
2364
|
-
let nextState =
|
|
2365
|
-
|
|
2366
|
-
|
|
2304
|
+
let nextState = {
|
|
2305
|
+
...currentState,
|
|
2306
|
+
...searchState,
|
|
2307
|
+
sort: {
|
|
2308
|
+
...currentState.sort,
|
|
2309
|
+
...searchState.sort
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2367
2312
|
let tasks = [];
|
|
2368
|
-
const
|
|
2369
|
-
const
|
|
2313
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
2314
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
2370
2315
|
if (nextRequestState.searchTerm && !(0, import_helpers5.deepCompare)(currentRequestState, nextRequestState)) {
|
|
2371
2316
|
nextState.isSearching = true;
|
|
2372
2317
|
tasks.push(
|
|
2373
2318
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
2374
2319
|
const searchResult = results[results.length - 1];
|
|
2375
|
-
return dispatch(actions.setSearchState(
|
|
2320
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
2376
2321
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
2377
2322
|
);
|
|
2378
2323
|
}
|
|
@@ -2405,7 +2350,7 @@ var initialState2 = {
|
|
|
2405
2350
|
sourceWindow: -1
|
|
2406
2351
|
},
|
|
2407
2352
|
binaryDeltaLimits: {
|
|
2408
|
-
timeout:
|
|
2353
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
2409
2354
|
sourceWindow: limitDefault,
|
|
2410
2355
|
inputWindow: limitDefault,
|
|
2411
2356
|
duplicatesWindow: limitDefault,
|
|
@@ -2415,10 +2360,10 @@ var initialState2 = {
|
|
|
2415
2360
|
deploymentDeviceLimit: 5e3,
|
|
2416
2361
|
selectedDeviceIds: [],
|
|
2417
2362
|
selectionState: {
|
|
2418
|
-
finished:
|
|
2419
|
-
inprogress:
|
|
2420
|
-
pending:
|
|
2421
|
-
scheduled:
|
|
2363
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
2364
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2365
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2366
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
2422
2367
|
general: {
|
|
2423
2368
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
2424
2369
|
showCreationDialog: false,
|
|
@@ -2434,40 +2379,55 @@ var deploymentsSlice = (0, import_toolkit10.createSlice)({
|
|
|
2434
2379
|
initialState: initialState2,
|
|
2435
2380
|
reducers: {
|
|
2436
2381
|
createdDeployment: (state, action) => {
|
|
2437
|
-
state.byId[action.payload.id] =
|
|
2382
|
+
state.byId[action.payload.id] = {
|
|
2383
|
+
...deploymentPrototype,
|
|
2384
|
+
...action.payload
|
|
2385
|
+
};
|
|
2438
2386
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
2439
2387
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
2440
2388
|
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;
|
|
2441
2389
|
},
|
|
2442
2390
|
removedDeployment: (state, action) => {
|
|
2443
|
-
|
|
2444
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2391
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
2445
2392
|
state.byId = remainder;
|
|
2446
2393
|
},
|
|
2447
2394
|
receivedDeployment: (state, action) => {
|
|
2448
|
-
state.byId[action.payload.id] =
|
|
2395
|
+
state.byId[action.payload.id] = {
|
|
2396
|
+
...state.byId[action.payload.id] || {},
|
|
2397
|
+
...action.payload
|
|
2398
|
+
};
|
|
2449
2399
|
},
|
|
2450
2400
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
2451
2401
|
const { id, deviceId, log } = action.payload;
|
|
2452
|
-
const deployment =
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2402
|
+
const deployment = {
|
|
2403
|
+
...deploymentPrototype,
|
|
2404
|
+
...state.byId[id]
|
|
2405
|
+
};
|
|
2406
|
+
state.byId[id] = {
|
|
2407
|
+
...deployment,
|
|
2408
|
+
devices: {
|
|
2409
|
+
...deployment.devices,
|
|
2410
|
+
[deviceId]: {
|
|
2411
|
+
...deployment.devices[deviceId],
|
|
2456
2412
|
log
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2460
2416
|
},
|
|
2461
2417
|
receivedDeploymentDevices: (state, action) => {
|
|
2462
2418
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
2463
|
-
state.byId[id] =
|
|
2419
|
+
state.byId[id] = {
|
|
2420
|
+
...state.byId[id],
|
|
2464
2421
|
devices,
|
|
2465
2422
|
totalDeviceCount
|
|
2466
|
-
}
|
|
2423
|
+
};
|
|
2467
2424
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
2468
2425
|
},
|
|
2469
2426
|
receivedDeployments: (state, action) => {
|
|
2470
|
-
state.byId =
|
|
2427
|
+
state.byId = {
|
|
2428
|
+
...state.byId,
|
|
2429
|
+
...action.payload
|
|
2430
|
+
};
|
|
2471
2431
|
},
|
|
2472
2432
|
receivedDeploymentsForStatus: (state, action) => {
|
|
2473
2433
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -2509,9 +2469,9 @@ var initialState3 = {
|
|
|
2509
2469
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
2510
2470
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
2511
2471
|
},
|
|
2512
|
-
deviceList:
|
|
2513
|
-
deviceIds: []
|
|
2514
|
-
|
|
2472
|
+
deviceList: {
|
|
2473
|
+
deviceIds: [],
|
|
2474
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2515
2475
|
selectedAttributes: [],
|
|
2516
2476
|
selectedIssues: [],
|
|
2517
2477
|
selection: [],
|
|
@@ -2522,7 +2482,7 @@ var initialState3 = {
|
|
|
2522
2482
|
},
|
|
2523
2483
|
state: DEVICE_STATES.accepted,
|
|
2524
2484
|
total: 0
|
|
2525
|
-
}
|
|
2485
|
+
},
|
|
2526
2486
|
filters: [
|
|
2527
2487
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
2528
2488
|
],
|
|
@@ -2557,49 +2517,59 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2557
2517
|
},
|
|
2558
2518
|
addToGroup: (state, action) => {
|
|
2559
2519
|
const { group, deviceIds } = action.payload;
|
|
2560
|
-
const maybeExistingGroup =
|
|
2520
|
+
const maybeExistingGroup = {
|
|
2561
2521
|
filters: [],
|
|
2562
|
-
deviceIds: []
|
|
2563
|
-
|
|
2564
|
-
|
|
2522
|
+
deviceIds: [],
|
|
2523
|
+
...state.groups.byId[group]
|
|
2524
|
+
};
|
|
2525
|
+
state.groups.byId[group] = {
|
|
2526
|
+
...maybeExistingGroup,
|
|
2565
2527
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers6.duplicateFilter),
|
|
2566
2528
|
total: (maybeExistingGroup.total || 0) + 1
|
|
2567
|
-
}
|
|
2529
|
+
};
|
|
2568
2530
|
},
|
|
2569
2531
|
removeFromGroup: (state, action) => {
|
|
2570
2532
|
const { group, deviceIds: removedIds } = action.payload;
|
|
2571
|
-
const
|
|
2572
|
-
const changedGroup =
|
|
2533
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
2534
|
+
const changedGroup = {
|
|
2535
|
+
...maybeExistingGroup,
|
|
2573
2536
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
2574
2537
|
total: Math.max(total - removedIds.length, 0)
|
|
2575
|
-
}
|
|
2538
|
+
};
|
|
2576
2539
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
2577
2540
|
state.groups.byId[group] = changedGroup;
|
|
2578
2541
|
return;
|
|
2579
2542
|
} else if (state.groups.selectedGroup === group) {
|
|
2580
2543
|
state.groups.selectedGroup = void 0;
|
|
2581
2544
|
}
|
|
2582
|
-
const
|
|
2545
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
2583
2546
|
state.groups.byId = remainingById;
|
|
2584
2547
|
},
|
|
2585
2548
|
addGroup: (state, action) => {
|
|
2586
2549
|
const { groupName, group } = action.payload;
|
|
2587
|
-
state.groups.byId[groupName] =
|
|
2550
|
+
state.groups.byId[groupName] = {
|
|
2551
|
+
...state.groups.byId[groupName],
|
|
2552
|
+
...group
|
|
2553
|
+
};
|
|
2588
2554
|
},
|
|
2589
2555
|
selectGroup: (state, { payload: group }) => {
|
|
2590
2556
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
2591
2557
|
state.groups.selectedGroup = group;
|
|
2592
2558
|
},
|
|
2593
2559
|
removeGroup: (state, action) => {
|
|
2594
|
-
|
|
2595
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
2560
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
2596
2561
|
state.groups.byId = remainingById;
|
|
2597
2562
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
2598
2563
|
},
|
|
2599
2564
|
setDeviceListState: (state, action) => {
|
|
2600
|
-
state.deviceList =
|
|
2601
|
-
|
|
2602
|
-
|
|
2565
|
+
state.deviceList = {
|
|
2566
|
+
...state.deviceList,
|
|
2567
|
+
...action.payload,
|
|
2568
|
+
sort: {
|
|
2569
|
+
...state.deviceList.sort,
|
|
2570
|
+
...action.payload.sort
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2603
2573
|
},
|
|
2604
2574
|
setFilterAttributes: (state, action) => {
|
|
2605
2575
|
state.filteringAttributes = action.payload;
|
|
@@ -2608,7 +2578,10 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2608
2578
|
state.filteringAttributesConfig = action.payload;
|
|
2609
2579
|
},
|
|
2610
2580
|
receivedDevices: (state, action) => {
|
|
2611
|
-
state.byId =
|
|
2581
|
+
state.byId = {
|
|
2582
|
+
...state.byId,
|
|
2583
|
+
...action.payload
|
|
2584
|
+
};
|
|
2612
2585
|
},
|
|
2613
2586
|
setDeviceFilters: (state, action) => {
|
|
2614
2587
|
if ((0, import_helpers6.deepCompare)(action.payload, state.filters)) {
|
|
@@ -2639,7 +2612,10 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2639
2612
|
state.limit = action.payload;
|
|
2640
2613
|
},
|
|
2641
2614
|
receivedDevice: (state, action) => {
|
|
2642
|
-
state.byId[action.payload.id] =
|
|
2615
|
+
state.byId[action.payload.id] = {
|
|
2616
|
+
...state.byId[action.payload.id],
|
|
2617
|
+
...action.payload
|
|
2618
|
+
};
|
|
2643
2619
|
},
|
|
2644
2620
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
2645
2621
|
const { deviceId, authId } = action.payload;
|
|
@@ -2660,15 +2636,17 @@ var import_toolkit12 = require("@reduxjs/toolkit");
|
|
|
2660
2636
|
var sliceName4 = "monitor";
|
|
2661
2637
|
var initialState4 = {
|
|
2662
2638
|
alerts: {
|
|
2663
|
-
alertList:
|
|
2639
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
2664
2640
|
byDeviceId: {}
|
|
2665
2641
|
},
|
|
2666
2642
|
issueCounts: {
|
|
2667
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
2643
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
2668
2644
|
},
|
|
2669
2645
|
settings: {
|
|
2670
2646
|
global: {
|
|
2671
|
-
channels:
|
|
2647
|
+
channels: {
|
|
2648
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
2649
|
+
}
|
|
2672
2650
|
}
|
|
2673
2651
|
}
|
|
2674
2652
|
};
|
|
@@ -2686,14 +2664,14 @@ var monitorSlice = (0, import_toolkit12.createSlice)({
|
|
|
2686
2664
|
},
|
|
2687
2665
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
2688
2666
|
const { deviceId, alerts } = action.payload;
|
|
2689
|
-
state.alerts.byDeviceId[deviceId] =
|
|
2667
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
2690
2668
|
},
|
|
2691
2669
|
receiveDeviceIssueCounts: (state, action) => {
|
|
2692
2670
|
const { issueType, counts } = action.payload;
|
|
2693
2671
|
state.issueCounts.byType[issueType] = counts;
|
|
2694
2672
|
},
|
|
2695
2673
|
setAlertListState: (state, action) => {
|
|
2696
|
-
state.alerts.alertList =
|
|
2674
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
2697
2675
|
}
|
|
2698
2676
|
}
|
|
2699
2677
|
});
|
|
@@ -2717,7 +2695,7 @@ var onboardingSlice = (0, import_toolkit13.createSlice)({
|
|
|
2717
2695
|
initialState: initialState5,
|
|
2718
2696
|
reducers: {
|
|
2719
2697
|
setOnboardingState: (state, action) => {
|
|
2720
|
-
return
|
|
2698
|
+
return { ...state, ...action.payload };
|
|
2721
2699
|
},
|
|
2722
2700
|
setDemoArtifactPort: (state, action) => {
|
|
2723
2701
|
state.demoArtifactPort = action.payload;
|
|
@@ -2755,7 +2733,8 @@ var initialState6 = {
|
|
|
2755
2733
|
brand: ""
|
|
2756
2734
|
},
|
|
2757
2735
|
intentId: null,
|
|
2758
|
-
tenantList:
|
|
2736
|
+
tenantList: {
|
|
2737
|
+
...TENANT_LIST_DEFAULT,
|
|
2759
2738
|
total: 0,
|
|
2760
2739
|
tenants: [],
|
|
2761
2740
|
selectedTenant: null,
|
|
@@ -2763,13 +2742,14 @@ var initialState6 = {
|
|
|
2763
2742
|
direction: SORTING_OPTIONS.desc,
|
|
2764
2743
|
key: "name"
|
|
2765
2744
|
}
|
|
2766
|
-
}
|
|
2745
|
+
},
|
|
2767
2746
|
organization: {
|
|
2768
2747
|
// id, name, status, tenant_token, plan
|
|
2769
2748
|
},
|
|
2770
2749
|
auditlog: {
|
|
2771
2750
|
events: [],
|
|
2772
|
-
selectionState:
|
|
2751
|
+
selectionState: {
|
|
2752
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2773
2753
|
detail: void 0,
|
|
2774
2754
|
endDate: void 0,
|
|
2775
2755
|
selectedIssue: void 0,
|
|
@@ -2778,7 +2758,7 @@ var initialState6 = {
|
|
|
2778
2758
|
total: 0,
|
|
2779
2759
|
type: void 0,
|
|
2780
2760
|
user: void 0
|
|
2781
|
-
}
|
|
2761
|
+
}
|
|
2782
2762
|
},
|
|
2783
2763
|
externalDeviceIntegrations: [
|
|
2784
2764
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2801,7 +2781,10 @@ var organizationSlice = (0, import_toolkit14.createSlice)({
|
|
|
2801
2781
|
state.auditlog.selectionState.total = total;
|
|
2802
2782
|
},
|
|
2803
2783
|
setAuditLogState: (state, action) => {
|
|
2804
|
-
state.auditlog.selectionState =
|
|
2784
|
+
state.auditlog.selectionState = {
|
|
2785
|
+
...state.auditlog.selectionState,
|
|
2786
|
+
...action.payload
|
|
2787
|
+
};
|
|
2805
2788
|
},
|
|
2806
2789
|
receiveCurrentCard: (state, action) => {
|
|
2807
2790
|
state.card = action.payload;
|
|
@@ -2810,7 +2793,7 @@ var organizationSlice = (0, import_toolkit14.createSlice)({
|
|
|
2810
2793
|
state.intentId = action.payload;
|
|
2811
2794
|
},
|
|
2812
2795
|
setOrganization: (state, action) => {
|
|
2813
|
-
state.organization =
|
|
2796
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2814
2797
|
},
|
|
2815
2798
|
setTenantListState: (state, action) => {
|
|
2816
2799
|
state.tenantList = action.payload;
|
|
@@ -2873,7 +2856,8 @@ var initialState7 = {
|
|
|
2873
2856
|
}
|
|
2874
2857
|
*/
|
|
2875
2858
|
},
|
|
2876
|
-
releasesList:
|
|
2859
|
+
releasesList: {
|
|
2860
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2877
2861
|
searchedIds: [],
|
|
2878
2862
|
releaseIds: [],
|
|
2879
2863
|
selection: [],
|
|
@@ -2887,7 +2871,7 @@ var initialState7 = {
|
|
|
2887
2871
|
selectedTags: [],
|
|
2888
2872
|
total: 0,
|
|
2889
2873
|
type: ""
|
|
2890
|
-
}
|
|
2874
|
+
},
|
|
2891
2875
|
tags: [],
|
|
2892
2876
|
updateTypes: [],
|
|
2893
2877
|
/*
|
|
@@ -2913,8 +2897,7 @@ var releaseSlice = (0, import_toolkit15.createSlice)({
|
|
|
2913
2897
|
state.updateTypes = action.payload;
|
|
2914
2898
|
},
|
|
2915
2899
|
removeRelease: (state, action) => {
|
|
2916
|
-
|
|
2917
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2900
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2918
2901
|
state.byId = byId;
|
|
2919
2902
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2920
2903
|
},
|
|
@@ -2947,8 +2930,12 @@ var initialState8 = {
|
|
|
2947
2930
|
previousPhases: [],
|
|
2948
2931
|
retries: 0
|
|
2949
2932
|
},
|
|
2950
|
-
permissionSetsById:
|
|
2951
|
-
|
|
2933
|
+
permissionSetsById: {
|
|
2934
|
+
...defaultPermissionSets
|
|
2935
|
+
},
|
|
2936
|
+
rolesById: {
|
|
2937
|
+
...rolesById
|
|
2938
|
+
},
|
|
2952
2939
|
settingsInitialized: false,
|
|
2953
2940
|
showConnectDeviceDialog: false,
|
|
2954
2941
|
showFeedbackDialog: false,
|
|
@@ -2988,13 +2975,15 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
2988
2975
|
state.byId[0] = action.payload;
|
|
2989
2976
|
},
|
|
2990
2977
|
removedUser: (state, action) => {
|
|
2991
|
-
|
|
2992
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2978
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2993
2979
|
state.byId = byId;
|
|
2994
2980
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2995
2981
|
},
|
|
2996
2982
|
updatedUser: (state, action) => {
|
|
2997
|
-
state.byId[action.payload.id] =
|
|
2983
|
+
state.byId[action.payload.id] = {
|
|
2984
|
+
...state.byId[action.payload.id],
|
|
2985
|
+
...action.payload
|
|
2986
|
+
};
|
|
2998
2987
|
},
|
|
2999
2988
|
receivedPermissionSets: (state, action) => {
|
|
3000
2989
|
state.permissionSetsById = action.payload;
|
|
@@ -3003,11 +2992,13 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
3003
2992
|
state.rolesById = action.payload;
|
|
3004
2993
|
},
|
|
3005
2994
|
createdRole: (state, action) => {
|
|
3006
|
-
state.rolesById[action.payload.name] =
|
|
2995
|
+
state.rolesById[action.payload.name] = {
|
|
2996
|
+
...state.rolesById[action.payload.name],
|
|
2997
|
+
...action.payload
|
|
2998
|
+
};
|
|
3007
2999
|
},
|
|
3008
3000
|
removedRole: (state, action) => {
|
|
3009
|
-
|
|
3010
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
3001
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
3011
3002
|
state.rolesById = rolesById2;
|
|
3012
3003
|
},
|
|
3013
3004
|
setCustomColumns: (state, action) => {
|
|
@@ -3015,18 +3006,27 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
3015
3006
|
},
|
|
3016
3007
|
setGlobalSettings: (state, action) => {
|
|
3017
3008
|
state.settingsInitialized = true;
|
|
3018
|
-
state.globalSettings =
|
|
3009
|
+
state.globalSettings = {
|
|
3010
|
+
...state.globalSettings,
|
|
3011
|
+
...action.payload
|
|
3012
|
+
};
|
|
3019
3013
|
},
|
|
3020
3014
|
setUserSettings: (state, action) => {
|
|
3021
3015
|
state.userSettingsInitialized = true;
|
|
3022
|
-
state.userSettings =
|
|
3016
|
+
state.userSettings = {
|
|
3017
|
+
...state.userSettings,
|
|
3018
|
+
...action.payload
|
|
3019
|
+
};
|
|
3023
3020
|
},
|
|
3024
3021
|
setTooltipState: (state, action) => {
|
|
3025
3022
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
3026
3023
|
state.tooltips.byId[id].readState = readState;
|
|
3027
3024
|
},
|
|
3028
3025
|
setTooltipsState: (state, action) => {
|
|
3029
|
-
state.tooltips.byId =
|
|
3026
|
+
state.tooltips.byId = {
|
|
3027
|
+
...state.tooltips.byId,
|
|
3028
|
+
...action.payload
|
|
3029
|
+
};
|
|
3030
3030
|
},
|
|
3031
3031
|
setShowFeedbackDialog: (state, action) => {
|
|
3032
3032
|
state.showFeedbackDialog = action.payload;
|
|
@@ -3043,7 +3043,16 @@ var actions8 = usersSlice.actions;
|
|
|
3043
3043
|
var usersSlice_default = usersSlice.reducer;
|
|
3044
3044
|
|
|
3045
3045
|
// src/actions.ts
|
|
3046
|
-
var actions_default =
|
|
3046
|
+
var actions_default = {
|
|
3047
|
+
...actions,
|
|
3048
|
+
...actions2,
|
|
3049
|
+
...actions3,
|
|
3050
|
+
...actions4,
|
|
3051
|
+
...actions5,
|
|
3052
|
+
...actions6,
|
|
3053
|
+
...actions7,
|
|
3054
|
+
...actions8
|
|
3055
|
+
};
|
|
3047
3056
|
|
|
3048
3057
|
// src/store.ts
|
|
3049
3058
|
var import_toolkit17 = require("@reduxjs/toolkit");
|
|
@@ -3078,8 +3087,9 @@ var sessionReducer = (state, action) => {
|
|
|
3078
3087
|
return rootReducer(state, action);
|
|
3079
3088
|
};
|
|
3080
3089
|
var getConfiguredStore = (options = {}) => {
|
|
3081
|
-
const
|
|
3082
|
-
return (0, import_toolkit17.configureStore)(
|
|
3090
|
+
const { preloadedState = {}, ...config } = options;
|
|
3091
|
+
return (0, import_toolkit17.configureStore)({
|
|
3092
|
+
...config,
|
|
3083
3093
|
preloadedState,
|
|
3084
3094
|
reducer: sessionReducer,
|
|
3085
3095
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -3092,7 +3102,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
3092
3102
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
3093
3103
|
}
|
|
3094
3104
|
})
|
|
3095
|
-
})
|
|
3105
|
+
});
|
|
3096
3106
|
};
|
|
3097
3107
|
var store = getConfiguredStore({
|
|
3098
3108
|
preloadedState: {}
|
|
@@ -3107,13 +3117,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3107
3117
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3108
3118
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3109
3119
|
(accu, item) => {
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3120
|
+
const filter = item.filter ?? {};
|
|
3121
|
+
let deployment = {
|
|
3122
|
+
...deploymentPrototype,
|
|
3123
|
+
...deploymentsById[item.id],
|
|
3124
|
+
...item,
|
|
3125
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3114
3126
|
name: decodeURIComponent(item.name)
|
|
3115
|
-
}
|
|
3116
|
-
deployment =
|
|
3127
|
+
};
|
|
3128
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3117
3129
|
accu.deployments[item.id] = deployment;
|
|
3118
3130
|
accu.deploymentIds.push(item.id);
|
|
3119
3131
|
return accu;
|
|
@@ -3167,11 +3179,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3167
3179
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3168
3180
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3169
3181
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3170
|
-
const deployment =
|
|
3182
|
+
const deployment = {
|
|
3183
|
+
...newDeployment,
|
|
3171
3184
|
id: deploymentId,
|
|
3172
3185
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3173
3186
|
statistics: { status: {} }
|
|
3174
|
-
}
|
|
3187
|
+
};
|
|
3175
3188
|
let tasks = [
|
|
3176
3189
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3177
3190
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3314,14 +3327,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3314
3327
|
({ 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))))
|
|
3315
3328
|
);
|
|
3316
3329
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3317
|
-
const
|
|
3330
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3318
3331
|
const currentState = getState().deployments.selectionState;
|
|
3319
|
-
let nextState =
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3332
|
+
let nextState = {
|
|
3333
|
+
...currentState,
|
|
3334
|
+
...selectionState,
|
|
3335
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3336
|
+
accu[item] = {
|
|
3337
|
+
...currentState[item],
|
|
3338
|
+
...selectionState[item]
|
|
3339
|
+
};
|
|
3340
|
+
return accu;
|
|
3341
|
+
}, {}),
|
|
3342
|
+
general: {
|
|
3343
|
+
...currentState.general,
|
|
3344
|
+
...selectionState.general
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3325
3347
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3326
3348
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3327
3349
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3351,15 +3373,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3351
3373
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3352
3374
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3353
3375
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3354
|
-
const config =
|
|
3376
|
+
const config = {
|
|
3377
|
+
...oldConfig,
|
|
3355
3378
|
hasDelta: Boolean(delta.enabled),
|
|
3356
|
-
binaryDelta:
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3379
|
+
binaryDelta: {
|
|
3380
|
+
...oldConfig.binaryDelta,
|
|
3381
|
+
timeout: timeoutConfig,
|
|
3382
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3383
|
+
},
|
|
3384
|
+
binaryDeltaLimits: {
|
|
3385
|
+
...oldConfig.binaryDeltaLimits,
|
|
3386
|
+
timeout: timeoutLimit,
|
|
3387
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3388
|
+
}
|
|
3389
|
+
};
|
|
3363
3390
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3364
3391
|
})
|
|
3365
3392
|
);
|
|
@@ -3369,7 +3396,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3369
3396
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3370
3397
|
return accu;
|
|
3371
3398
|
}
|
|
3372
|
-
accu =
|
|
3399
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3373
3400
|
}
|
|
3374
3401
|
return accu;
|
|
3375
3402
|
}, void 0);
|
|
@@ -3389,9 +3416,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3389
3416
|
}
|
|
3390
3417
|
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(() => {
|
|
3391
3418
|
const oldConfig = getState().deployments.config;
|
|
3392
|
-
const newConfig =
|
|
3393
|
-
|
|
3394
|
-
|
|
3419
|
+
const newConfig = {
|
|
3420
|
+
...oldConfig,
|
|
3421
|
+
binaryDelta: {
|
|
3422
|
+
...oldConfig.binaryDelta,
|
|
3423
|
+
...config
|
|
3424
|
+
}
|
|
3425
|
+
};
|
|
3395
3426
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3396
3427
|
});
|
|
3397
3428
|
});
|
|
@@ -3404,19 +3435,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3404
3435
|
var import_axios2 = require("axios");
|
|
3405
3436
|
var import_pluralize = __toESM(require_pluralize());
|
|
3406
3437
|
|
|
3407
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3408
|
-
var
|
|
3409
|
-
var
|
|
3410
|
-
var poolPtr = rnds8Pool.length;
|
|
3438
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3439
|
+
var getRandomValues;
|
|
3440
|
+
var rnds8 = new Uint8Array(16);
|
|
3411
3441
|
function rng() {
|
|
3412
|
-
if (
|
|
3413
|
-
|
|
3414
|
-
|
|
3442
|
+
if (!getRandomValues) {
|
|
3443
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3444
|
+
if (!getRandomValues) {
|
|
3445
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3446
|
+
}
|
|
3415
3447
|
}
|
|
3416
|
-
return
|
|
3448
|
+
return getRandomValues(rnds8);
|
|
3417
3449
|
}
|
|
3418
3450
|
|
|
3419
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3451
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3420
3452
|
var byteToHex = [];
|
|
3421
3453
|
for (let i = 0; i < 256; ++i) {
|
|
3422
3454
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3425,13 +3457,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3425
3457
|
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]];
|
|
3426
3458
|
}
|
|
3427
3459
|
|
|
3428
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3429
|
-
var
|
|
3460
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3461
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3430
3462
|
var native_default = {
|
|
3431
|
-
randomUUID
|
|
3463
|
+
randomUUID
|
|
3432
3464
|
};
|
|
3433
3465
|
|
|
3434
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3466
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3435
3467
|
function v4(options, buf, offset) {
|
|
3436
3468
|
if (native_default.randomUUID && !buf && !options) {
|
|
3437
3469
|
return native_default.randomUUID();
|
|
@@ -3473,14 +3505,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3473
3505
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3474
3506
|
const state = getGroupsById(getState());
|
|
3475
3507
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3476
|
-
|
|
3477
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3508
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3478
3509
|
accu[id] = group;
|
|
3479
3510
|
}
|
|
3480
3511
|
return accu;
|
|
3481
3512
|
}, {});
|
|
3482
3513
|
const groups = res.data.reduce((accu, group) => {
|
|
3483
|
-
accu[group] =
|
|
3514
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3484
3515
|
return accu;
|
|
3485
3516
|
}, dynamicGroups);
|
|
3486
3517
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3538,7 +3569,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3538
3569
|
() => Promise.resolve(
|
|
3539
3570
|
dispatch(
|
|
3540
3571
|
actions3.addGroup({
|
|
3541
|
-
group:
|
|
3572
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3542
3573
|
groupName: group
|
|
3543
3574
|
})
|
|
3544
3575
|
)
|
|
@@ -3566,20 +3597,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3566
3597
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3567
3598
|
const state = getGroupsById(getState());
|
|
3568
3599
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3569
|
-
|
|
3570
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3600
|
+
if (!(group.id || group.filters?.length)) {
|
|
3571
3601
|
accu[id] = group;
|
|
3572
3602
|
}
|
|
3573
3603
|
return accu;
|
|
3574
3604
|
}, {});
|
|
3575
3605
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3576
|
-
accu[filter.name] =
|
|
3606
|
+
accu[filter.name] = {
|
|
3577
3607
|
deviceIds: [],
|
|
3578
|
-
total: 0
|
|
3579
|
-
|
|
3608
|
+
total: 0,
|
|
3609
|
+
...state[filter.name],
|
|
3580
3610
|
id: filter.id,
|
|
3581
3611
|
filters: mapTermsToFilters(filter.terms)
|
|
3582
|
-
}
|
|
3612
|
+
};
|
|
3583
3613
|
return accu;
|
|
3584
3614
|
}, staticGroups);
|
|
3585
3615
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3619,10 +3649,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3619
3649
|
);
|
|
3620
3650
|
});
|
|
3621
3651
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3622
|
-
var _a;
|
|
3623
3652
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3624
3653
|
const selectedGroup = groupsState.byId[groupName];
|
|
3625
|
-
const groupFilterLength =
|
|
3654
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3626
3655
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3627
3656
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3628
3657
|
};
|
|
@@ -3645,7 +3674,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3645
3674
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3646
3675
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3647
3676
|
(accu, device) => {
|
|
3648
|
-
var _a, _b2, _c;
|
|
3649
3677
|
const stateDevice = getDeviceById(state, device.id);
|
|
3650
3678
|
const {
|
|
3651
3679
|
attributes: storedAttributes = {},
|
|
@@ -3655,29 +3683,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3655
3683
|
group: storedGroup
|
|
3656
3684
|
} = stateDevice;
|
|
3657
3685
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3658
|
-
device.tags =
|
|
3659
|
-
device.group =
|
|
3660
|
-
device.monitor =
|
|
3661
|
-
device.identity_data =
|
|
3686
|
+
device.tags = { ...storedTags, ...tags };
|
|
3687
|
+
device.group = system.group ?? storedGroup;
|
|
3688
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3689
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3662
3690
|
device.status = status ? status : device.status || identity.status;
|
|
3663
|
-
device.check_in_time_rounded =
|
|
3664
|
-
device.check_in_time_exact =
|
|
3691
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3692
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3665
3693
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3666
3694
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3667
3695
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3668
3696
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3669
|
-
device.attributes = device.attributes ?
|
|
3670
|
-
accu.devicesById[device.id] =
|
|
3697
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3698
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3671
3699
|
accu.ids.push(device.id);
|
|
3672
3700
|
return accu;
|
|
3673
3701
|
},
|
|
3674
3702
|
{ ids, devicesById: {} }
|
|
3675
3703
|
);
|
|
3676
3704
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3677
|
-
const
|
|
3705
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3678
3706
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3679
3707
|
return Promise.resolve(
|
|
3680
|
-
dispatch(getDevicesByStatus2(
|
|
3708
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3681
3709
|
).unwrap().then((results) => {
|
|
3682
3710
|
if (!group) {
|
|
3683
3711
|
return Promise.resolve();
|
|
@@ -3691,7 +3719,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3691
3719
|
dispatch(
|
|
3692
3720
|
actions3.addGroup({
|
|
3693
3721
|
group: {
|
|
3694
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3722
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3695
3723
|
total
|
|
3696
3724
|
},
|
|
3697
3725
|
groupName: group
|
|
@@ -3840,27 +3868,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3840
3868
|
);
|
|
3841
3869
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3842
3870
|
`${sliceName3}/setDeviceListState`,
|
|
3843
|
-
(
|
|
3844
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3845
|
-
var _c;
|
|
3871
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3846
3872
|
const currentState = getDeviceListState(getState());
|
|
3847
3873
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3848
|
-
let nextState =
|
|
3874
|
+
let nextState = {
|
|
3875
|
+
...currentState,
|
|
3849
3876
|
setOnly: false,
|
|
3850
|
-
refreshTrigger
|
|
3851
|
-
|
|
3852
|
-
sort:
|
|
3853
|
-
}
|
|
3877
|
+
refreshTrigger,
|
|
3878
|
+
...selectionState,
|
|
3879
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3880
|
+
};
|
|
3854
3881
|
let tasks = [];
|
|
3855
|
-
const
|
|
3856
|
-
const
|
|
3882
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3883
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3857
3884
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3858
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3885
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3859
3886
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3860
3887
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3861
3888
|
nextState.isLoading = true;
|
|
3862
3889
|
tasks.push(
|
|
3863
|
-
dispatch(getDevicesByStatus2(
|
|
3890
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3864
3891
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3865
3892
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3866
3893
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3885,8 +3912,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3885
3912
|
} = options;
|
|
3886
3913
|
const state = getState();
|
|
3887
3914
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3888
|
-
filters: filterSelection
|
|
3889
|
-
group: group
|
|
3915
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3916
|
+
group: group ?? getSelectedGroup(state),
|
|
3890
3917
|
groups: state.devices.groups,
|
|
3891
3918
|
offlineThreshold: state.app.offlineThreshold,
|
|
3892
3919
|
selectedIssues,
|
|
@@ -3947,7 +3974,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3947
3974
|
});
|
|
3948
3975
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3949
3976
|
const state = getState();
|
|
3950
|
-
let options =
|
|
3977
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3951
3978
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3952
3979
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3953
3980
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4082,8 +4109,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4082
4109
|
({ data: auditLogEntries }) => {
|
|
4083
4110
|
const { start, end } = auditLogEntries.reduce(
|
|
4084
4111
|
(accu, item) => {
|
|
4085
|
-
|
|
4086
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4112
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4087
4113
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4088
4114
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4089
4115
|
}
|
|
@@ -4190,8 +4216,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4190
4216
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4191
4217
|
`${sliceName3}/getDeviceConfig`,
|
|
4192
4218
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4193
|
-
|
|
4194
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4219
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4195
4220
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4196
4221
|
}
|
|
4197
4222
|
})
|
|
@@ -4203,15 +4228,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4203
4228
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4204
4229
|
`${sliceName3}/applyDeviceConfig`,
|
|
4205
4230
|
({ 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 }) => {
|
|
4206
|
-
var _a;
|
|
4207
4231
|
const device = getDeviceById(getState(), deviceId);
|
|
4208
4232
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4209
4233
|
let tasks = [
|
|
4210
|
-
dispatch(actions3.receivedDevice(
|
|
4234
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4211
4235
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4212
4236
|
];
|
|
4213
4237
|
if (isDefault && canManageUsers) {
|
|
4214
|
-
const { previous } =
|
|
4238
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4215
4239
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4216
4240
|
}
|
|
4217
4241
|
return Promise.all(tasks);
|
|
@@ -4227,21 +4251,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4227
4251
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4228
4252
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4229
4253
|
{ headers }
|
|
4230
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4254
|
+
).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"))]));
|
|
4231
4255
|
})
|
|
4232
4256
|
)
|
|
4233
4257
|
);
|
|
4234
4258
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4235
4259
|
let providerResult = {};
|
|
4236
4260
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4237
|
-
providerResult =
|
|
4261
|
+
providerResult = { ...data, twinError: "" };
|
|
4238
4262
|
}).catch((err) => {
|
|
4239
4263
|
providerResult = {
|
|
4240
4264
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4241
4265
|
};
|
|
4242
4266
|
}).finally(() => {
|
|
4243
4267
|
const device = getDeviceById(getState(), deviceId);
|
|
4244
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4268
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4245
4269
|
});
|
|
4246
4270
|
});
|
|
4247
4271
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4257,7 +4281,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4257
4281
|
const { twinsByIntegration = {} } = device;
|
|
4258
4282
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4259
4283
|
return Promise.resolve(
|
|
4260
|
-
dispatch(actions3.receivedDevice(
|
|
4284
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4261
4285
|
);
|
|
4262
4286
|
})
|
|
4263
4287
|
);
|
|
@@ -4278,8 +4302,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4278
4302
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4279
4303
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4280
4304
|
const filters = [
|
|
4281
|
-
|
|
4282
|
-
|
|
4305
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4306
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4283
4307
|
];
|
|
4284
4308
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4285
4309
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4291,11 +4315,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4291
4315
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4292
4316
|
const state2 = getState();
|
|
4293
4317
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4294
|
-
const device =
|
|
4318
|
+
const device = {
|
|
4319
|
+
...getDeviceById(state2, id),
|
|
4295
4320
|
systemDeviceIds: ids,
|
|
4296
4321
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4297
|
-
}
|
|
4298
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4322
|
+
};
|
|
4323
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4299
4324
|
});
|
|
4300
4325
|
});
|
|
4301
4326
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4303,9 +4328,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4303
4328
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4304
4329
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4305
4330
|
const filters = [
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4331
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4332
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4333
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4309
4334
|
];
|
|
4310
4335
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4311
4336
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4352,7 +4377,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4352
4377
|
var cutoffLength = 75;
|
|
4353
4378
|
var ellipsis = "...";
|
|
4354
4379
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4355
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4380
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4356
4381
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4357
4382
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4358
4383
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4370,14 +4395,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4370
4395
|
});
|
|
4371
4396
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4372
4397
|
const state = getState();
|
|
4373
|
-
const
|
|
4374
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4398
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4399
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4400
|
+
...remainder,
|
|
4375
4401
|
filters,
|
|
4376
4402
|
group,
|
|
4377
4403
|
offlineThreshold: state.app.offlineThreshold,
|
|
4378
4404
|
selectedIssues: [type],
|
|
4379
4405
|
status
|
|
4380
|
-
})
|
|
4406
|
+
});
|
|
4381
4407
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4382
4408
|
page: 1,
|
|
4383
4409
|
per_page: 1,
|
|
@@ -4486,8 +4512,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4486
4512
|
({ 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())))
|
|
4487
4513
|
);
|
|
4488
4514
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4489
|
-
const userId =
|
|
4490
|
-
const detail =
|
|
4515
|
+
const userId = userFilter?.id || userFilter;
|
|
4516
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4491
4517
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4492
4518
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4493
4519
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4514,12 +4540,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4514
4540
|
);
|
|
4515
4541
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4516
4542
|
const currentState = getAuditlogState(getState());
|
|
4517
|
-
let nextState =
|
|
4518
|
-
|
|
4519
|
-
|
|
4543
|
+
let nextState = {
|
|
4544
|
+
...currentState,
|
|
4545
|
+
...selectionState,
|
|
4546
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4547
|
+
};
|
|
4520
4548
|
let tasks = [];
|
|
4521
|
-
const
|
|
4522
|
-
const
|
|
4549
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4550
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4523
4551
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4524
4552
|
nextState.isLoading = true;
|
|
4525
4553
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4531,27 +4559,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4531
4559
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4532
4560
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar4("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
4533
4561
|
});
|
|
4534
|
-
var tenantListRetrieval = (config) =>
|
|
4562
|
+
var tenantListRetrieval = async (config) => {
|
|
4535
4563
|
const { page, perPage } = config;
|
|
4536
4564
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4537
|
-
const tenantList =
|
|
4565
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4538
4566
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4539
4567
|
return [tenantList.data, Number(totalCount)];
|
|
4540
|
-
}
|
|
4541
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4568
|
+
};
|
|
4569
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4542
4570
|
const currentState = getTenantsList(getState());
|
|
4543
|
-
const [tenants, pageCount] =
|
|
4544
|
-
dispatch(actions6.setTenantListState(
|
|
4545
|
-
})
|
|
4546
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4571
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4572
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4573
|
+
});
|
|
4574
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4547
4575
|
const currentState = getTenantsList(getState());
|
|
4548
|
-
const nextState =
|
|
4576
|
+
const nextState = {
|
|
4577
|
+
...currentState,
|
|
4578
|
+
...selectionState
|
|
4579
|
+
};
|
|
4549
4580
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4550
|
-
const [tenants, pageCount] =
|
|
4551
|
-
return dispatch(actions6.setTenantListState(
|
|
4581
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4582
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4552
4583
|
}
|
|
4553
|
-
return dispatch(actions6.setTenantListState(
|
|
4554
|
-
})
|
|
4584
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4585
|
+
});
|
|
4555
4586
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4556
4587
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4557
4588
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4594,10 +4625,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4594
4625
|
);
|
|
4595
4626
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4596
4627
|
`${sliceName6}/createIntegration`,
|
|
4597
|
-
(
|
|
4598
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4599
|
-
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(setSnackbar4("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
4600
|
-
}
|
|
4628
|
+
({ 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(setSnackbar4("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
4601
4629
|
);
|
|
4602
4630
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4603
4631
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4618,9 +4646,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4618
4646
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4619
4647
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4620
4648
|
const integrations = data.reduce((accu, item) => {
|
|
4621
|
-
|
|
4622
|
-
const
|
|
4623
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4649
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4650
|
+
const integration = { ...existingIntegration, ...item };
|
|
4624
4651
|
accu.push(integration);
|
|
4625
4652
|
return accu;
|
|
4626
4653
|
}, []);
|
|
@@ -4672,7 +4699,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4672
4699
|
`${sliceName6}/getSsoConfigById`,
|
|
4673
4700
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4674
4701
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4675
|
-
return sso ? Promise.resolve(
|
|
4702
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4676
4703
|
})
|
|
4677
4704
|
);
|
|
4678
4705
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4691,20 +4718,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4691
4718
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4692
4719
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4693
4720
|
var flattenRelease = (release, stateRelease) => {
|
|
4694
|
-
|
|
4695
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4721
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4696
4722
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4697
4723
|
(accu, item) => {
|
|
4698
|
-
var _a2;
|
|
4699
4724
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4700
|
-
const stateArtifact =
|
|
4725
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4701
4726
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4702
|
-
accu.artifacts.push(
|
|
4727
|
+
accu.artifacts.push({
|
|
4728
|
+
...stateArtifact,
|
|
4729
|
+
...item
|
|
4730
|
+
});
|
|
4703
4731
|
return accu;
|
|
4704
4732
|
},
|
|
4705
4733
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4706
4734
|
);
|
|
4707
|
-
return
|
|
4735
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4708
4736
|
};
|
|
4709
4737
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4710
4738
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4722,17 +4750,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4722
4750
|
{ release: null, index: -1 }
|
|
4723
4751
|
);
|
|
4724
4752
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4725
|
-
var _a;
|
|
4726
4753
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4727
4754
|
if (!release || index === -1) {
|
|
4728
4755
|
return;
|
|
4729
4756
|
}
|
|
4730
4757
|
const releaseArtifacts = [...release.artifacts];
|
|
4731
4758
|
const artifact = releaseArtifacts[index];
|
|
4732
|
-
const { key, name, version } = (
|
|
4759
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4733
4760
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4734
4761
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4735
|
-
filters: [
|
|
4762
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4736
4763
|
});
|
|
4737
4764
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4738
4765
|
page: 1,
|
|
@@ -4746,10 +4773,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4746
4773
|
}
|
|
4747
4774
|
const installCount = Number(headers[headerNames.total]);
|
|
4748
4775
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4749
|
-
releaseArtifacts2[index2] =
|
|
4750
|
-
release2 =
|
|
4776
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4777
|
+
release2 = {
|
|
4778
|
+
...release2,
|
|
4751
4779
|
artifacts: releaseArtifacts2
|
|
4752
|
-
}
|
|
4780
|
+
};
|
|
4753
4781
|
return dispatch(actions7.receiveRelease(release2));
|
|
4754
4782
|
});
|
|
4755
4783
|
});
|
|
@@ -4761,12 +4789,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4761
4789
|
return dispatch(getReleases());
|
|
4762
4790
|
}
|
|
4763
4791
|
const releaseArtifacts = [...release.artifacts];
|
|
4764
|
-
releaseArtifacts[index] =
|
|
4792
|
+
releaseArtifacts[index] = {
|
|
4793
|
+
...releaseArtifacts[index],
|
|
4765
4794
|
url: response.data.uri
|
|
4766
|
-
}
|
|
4767
|
-
release =
|
|
4795
|
+
};
|
|
4796
|
+
release = {
|
|
4797
|
+
...release,
|
|
4768
4798
|
artifacts: releaseArtifacts
|
|
4769
|
-
}
|
|
4799
|
+
};
|
|
4770
4800
|
return dispatch(actions7.receiveRelease(release));
|
|
4771
4801
|
})
|
|
4772
4802
|
);
|
|
@@ -4891,12 +4921,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4891
4921
|
});
|
|
4892
4922
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4893
4923
|
const currentState = getState().releases.releasesList;
|
|
4894
|
-
let nextState =
|
|
4895
|
-
|
|
4896
|
-
|
|
4924
|
+
let nextState = {
|
|
4925
|
+
...currentState,
|
|
4926
|
+
...selectionState,
|
|
4927
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4928
|
+
};
|
|
4897
4929
|
let tasks = [];
|
|
4898
|
-
const
|
|
4899
|
-
const
|
|
4930
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4931
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4900
4932
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4901
4933
|
nextState.isLoading = true;
|
|
4902
4934
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4915,29 +4947,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4915
4947
|
);
|
|
4916
4948
|
};
|
|
4917
4949
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4918
|
-
let releaseListState =
|
|
4950
|
+
let releaseListState = { ...state.releasesList };
|
|
4919
4951
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4920
4952
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4921
4953
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4922
4954
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4923
4955
|
if (searchOnly) {
|
|
4924
|
-
releaseListState =
|
|
4956
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4925
4957
|
} else {
|
|
4926
|
-
releaseListState =
|
|
4958
|
+
releaseListState = {
|
|
4959
|
+
...releaseListState,
|
|
4927
4960
|
releaseIds,
|
|
4928
4961
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4929
4962
|
total: !isFiltering ? total : state.releasesList.total
|
|
4930
|
-
}
|
|
4963
|
+
};
|
|
4931
4964
|
}
|
|
4932
4965
|
return releaseListState;
|
|
4933
4966
|
};
|
|
4934
4967
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4935
|
-
const config =
|
|
4968
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4936
4969
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4937
4970
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4938
4971
|
const state = getState().releases;
|
|
4939
4972
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4940
|
-
const combinedReleases =
|
|
4973
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4941
4974
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4942
4975
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4943
4976
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4958,7 +4991,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4958
4991
|
`${sliceName7}/updateReleaseInfo`,
|
|
4959
4992
|
({ 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(() => {
|
|
4960
4993
|
return Promise.all([
|
|
4961
|
-
dispatch(actions7.receiveRelease(
|
|
4994
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4962
4995
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4963
4996
|
]);
|
|
4964
4997
|
})
|
|
@@ -4967,7 +5000,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4967
5000
|
`${sliceName7}/setReleaseTags`,
|
|
4968
5001
|
({ 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(() => {
|
|
4969
5002
|
return Promise.all([
|
|
4970
|
-
dispatch(actions7.receiveRelease(
|
|
5003
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4971
5004
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4972
5005
|
]);
|
|
4973
5006
|
})
|
|
@@ -4984,19 +5017,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4984
5017
|
// src/api/users-api.ts
|
|
4985
5018
|
var import_axios4 = __toESM(require("axios"));
|
|
4986
5019
|
var Api2 = {
|
|
4987
|
-
postLogin: (url,
|
|
4988
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4989
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4990
|
-
var _a2;
|
|
4991
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4992
|
-
});
|
|
4993
|
-
},
|
|
5020
|
+
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"] })),
|
|
4994
5021
|
putVerifyTFA: (url, userData) => {
|
|
4995
5022
|
let body = {};
|
|
4996
5023
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4997
5024
|
body = { token2fa: userData.token2fa };
|
|
4998
5025
|
}
|
|
4999
|
-
return import_axios4.default.put(url, body,
|
|
5026
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
5000
5027
|
}
|
|
5001
5028
|
};
|
|
5002
5029
|
var users_api_default = Api2;
|
|
@@ -5024,43 +5051,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
5024
5051
|
};
|
|
5025
5052
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5026
5053
|
`${sliceName8}/loginUser`,
|
|
5027
|
-
(
|
|
5028
|
-
|
|
5029
|
-
return
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
Promise.
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
window.
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
);
|
|
5062
|
-
});
|
|
5063
|
-
}
|
|
5054
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5055
|
+
cleanUp();
|
|
5056
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5057
|
+
}).then(({ text: response, contentType }) => {
|
|
5058
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5059
|
+
const { id, kind } = response;
|
|
5060
|
+
const type = kind.split("/")[1];
|
|
5061
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5062
|
+
window.location.replace(ssoLoginUrl);
|
|
5063
|
+
return;
|
|
5064
|
+
}
|
|
5065
|
+
const token = response;
|
|
5066
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5067
|
+
return;
|
|
5068
|
+
}
|
|
5069
|
+
let now = /* @__PURE__ */ new Date();
|
|
5070
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5071
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5072
|
+
setSessionInfo({ token, expiresAt });
|
|
5073
|
+
cookies4.remove("JWT", { path: "/" });
|
|
5074
|
+
return (
|
|
5075
|
+
// @ts-ignore
|
|
5076
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5077
|
+
cleanUp();
|
|
5078
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5079
|
+
}).then(() => {
|
|
5080
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5081
|
+
if (window.location.pathname !== "/ui/") {
|
|
5082
|
+
window.location.replace("/ui/");
|
|
5083
|
+
}
|
|
5084
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5085
|
+
})
|
|
5086
|
+
);
|
|
5087
|
+
})
|
|
5064
5088
|
);
|
|
5065
5089
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
5066
5090
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -5077,7 +5101,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
5077
5101
|
return Promise.reject();
|
|
5078
5102
|
}
|
|
5079
5103
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5080
|
-
setSessionInfo(
|
|
5104
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5081
5105
|
window.location.reload();
|
|
5082
5106
|
});
|
|
5083
5107
|
});
|
|
@@ -5140,13 +5164,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5140
5164
|
);
|
|
5141
5165
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5142
5166
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5143
|
-
const userId = currentUserId
|
|
5167
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5144
5168
|
const storageKey = `${userId}-column-widths`;
|
|
5145
5169
|
let customColumns = [];
|
|
5146
5170
|
if (!columns) {
|
|
5147
5171
|
try {
|
|
5148
5172
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5149
|
-
} catch
|
|
5173
|
+
} catch {
|
|
5150
5174
|
}
|
|
5151
5175
|
} else {
|
|
5152
5176
|
customColumns = columns;
|
|
@@ -5175,10 +5199,7 @@ var userActions = {
|
|
|
5175
5199
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5176
5200
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5177
5201
|
`${sliceName8}/createUser`,
|
|
5178
|
-
(
|
|
5179
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5180
|
-
return general_api_default.post(`${useradmApiUrlv1}/users`, __spreadProps(__spreadValues({}, userData), { send_reset_password: shouldResetPassword })).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar6(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch));
|
|
5181
|
-
}
|
|
5202
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar6(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
5182
5203
|
);
|
|
5183
5204
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5184
5205
|
`${sliceName8}/removeUser`,
|
|
@@ -5189,15 +5210,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5189
5210
|
);
|
|
5190
5211
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5191
5212
|
`${sliceName8}/editUser`,
|
|
5192
|
-
(
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
()
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
])
|
|
5199
|
-
);
|
|
5200
|
-
}
|
|
5213
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5214
|
+
() => Promise.all([
|
|
5215
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5216
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5217
|
+
])
|
|
5218
|
+
)
|
|
5201
5219
|
);
|
|
5202
5220
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5203
5221
|
const { id } = getOrganization(getState());
|
|
@@ -5232,7 +5250,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5232
5250
|
}
|
|
5233
5251
|
return accu;
|
|
5234
5252
|
},
|
|
5235
|
-
|
|
5253
|
+
{ ...emptyUiPermissions }
|
|
5236
5254
|
);
|
|
5237
5255
|
var permissionActionTypes = {
|
|
5238
5256
|
any: mapHttpPermission,
|
|
@@ -5255,20 +5273,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5255
5273
|
}, existingPermissions);
|
|
5256
5274
|
var tryParseCustomPermission = (permission) => {
|
|
5257
5275
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5258
|
-
const result = mergePermissions(
|
|
5276
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5259
5277
|
return { isCustom: true, permission, result };
|
|
5260
5278
|
};
|
|
5261
5279
|
var customPermissionHandler = (accu, permission) => {
|
|
5262
5280
|
let processor = tryParseCustomPermission(permission);
|
|
5263
|
-
return
|
|
5281
|
+
return {
|
|
5282
|
+
...accu,
|
|
5264
5283
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5265
5284
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5266
|
-
}
|
|
5285
|
+
};
|
|
5267
5286
|
};
|
|
5268
5287
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5269
5288
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5270
5289
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5271
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5290
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5272
5291
|
};
|
|
5273
5292
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5274
5293
|
if (Array.isArray(permissions)) {
|
|
@@ -5283,60 +5302,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5283
5302
|
if (!processor) {
|
|
5284
5303
|
return accu;
|
|
5285
5304
|
}
|
|
5286
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5287
|
-
var _a;
|
|
5288
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5289
|
-
});
|
|
5305
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5290
5306
|
if (scope) {
|
|
5291
5307
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5292
|
-
return
|
|
5308
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5293
5309
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5294
5310
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5295
5311
|
}
|
|
5296
|
-
return
|
|
5312
|
+
return {
|
|
5313
|
+
...accu,
|
|
5297
5314
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5298
5315
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5299
|
-
}
|
|
5316
|
+
};
|
|
5300
5317
|
},
|
|
5301
|
-
{ isCustom: false, uiPermissions:
|
|
5318
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5302
5319
|
);
|
|
5303
5320
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5304
5321
|
};
|
|
5305
5322
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5306
5323
|
(accu, role) => {
|
|
5307
|
-
var _a;
|
|
5308
5324
|
let normalizedPermissions;
|
|
5309
5325
|
let isCustom = false;
|
|
5310
5326
|
if (rolesById2[role.name]) {
|
|
5311
|
-
normalizedPermissions =
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5327
|
+
normalizedPermissions = {
|
|
5328
|
+
...rolesById2[role.name].uiPermissions,
|
|
5329
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5330
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5331
|
+
};
|
|
5315
5332
|
} else {
|
|
5316
5333
|
const result = parseRolePermissions(role, permissionSets);
|
|
5317
5334
|
normalizedPermissions = result.uiPermissions;
|
|
5318
5335
|
isCustom = result.isCustom;
|
|
5319
5336
|
}
|
|
5320
|
-
const roleState =
|
|
5321
|
-
accu[role.name] =
|
|
5337
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5338
|
+
accu[role.name] = {
|
|
5339
|
+
...roleState,
|
|
5340
|
+
...role,
|
|
5322
5341
|
description: roleState.description ? roleState.description : role.description,
|
|
5323
5342
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5324
5343
|
isCustom,
|
|
5325
5344
|
name: roleState.name ? roleState.name : role.name,
|
|
5326
5345
|
uiPermissions: normalizedPermissions
|
|
5327
|
-
}
|
|
5346
|
+
};
|
|
5328
5347
|
return accu;
|
|
5329
5348
|
},
|
|
5330
|
-
|
|
5349
|
+
{ ...rolesById2 }
|
|
5331
5350
|
);
|
|
5332
5351
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5333
5352
|
`${sliceName8}/getPermissionSets`,
|
|
5334
5353
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5335
5354
|
const permissionSets = data.reduce(
|
|
5336
5355
|
(accu, permissionSet) => {
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5356
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5357
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5340
5358
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5341
5359
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5342
5360
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5347,11 +5365,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5347
5365
|
}
|
|
5348
5366
|
return collector;
|
|
5349
5367
|
}, accu2),
|
|
5350
|
-
|
|
5368
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5351
5369
|
);
|
|
5352
5370
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5353
|
-
|
|
5354
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5371
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5355
5372
|
accu2.push(key);
|
|
5356
5373
|
}
|
|
5357
5374
|
return accu2;
|
|
@@ -5364,7 +5381,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5364
5381
|
return accu;
|
|
5365
5382
|
},
|
|
5366
5383
|
// @ts-ignore
|
|
5367
|
-
|
|
5384
|
+
{ ...getState().users.permissionSetsById }
|
|
5368
5385
|
);
|
|
5369
5386
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5370
5387
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5397,28 +5414,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5397
5414
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5398
5415
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5399
5416
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5400
|
-
|
|
5401
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5417
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5402
5418
|
type: uiPermissionsByArea[area].scope,
|
|
5403
5419
|
value: []
|
|
5404
5420
|
};
|
|
5405
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5421
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5422
|
+
...permissionSetState,
|
|
5406
5423
|
value: [...permissionSetState.value, item]
|
|
5407
|
-
}
|
|
5424
|
+
};
|
|
5408
5425
|
return itemPermissionAccu;
|
|
5409
5426
|
}, accu);
|
|
5410
5427
|
return accu;
|
|
5411
5428
|
}, {});
|
|
5412
|
-
return Object.entries(permissionSetObject).map((
|
|
5413
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5429
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5414
5430
|
if (value.includes(excessiveAccessSelector)) {
|
|
5415
5431
|
return { name };
|
|
5416
5432
|
}
|
|
5417
|
-
return { name, scope:
|
|
5433
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5418
5434
|
});
|
|
5419
5435
|
};
|
|
5420
5436
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5421
|
-
const role =
|
|
5437
|
+
const role = { ...roleState, ...roleData };
|
|
5422
5438
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5423
5439
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5424
5440
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5454,12 +5470,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5454
5470
|
}, []);
|
|
5455
5471
|
return {
|
|
5456
5472
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5457
|
-
role:
|
|
5473
|
+
role: {
|
|
5474
|
+
...emptyRole,
|
|
5458
5475
|
name,
|
|
5459
5476
|
// @ts-ignore
|
|
5460
5477
|
description: description ? description : roleState.description,
|
|
5461
|
-
uiPermissions:
|
|
5462
|
-
|
|
5478
|
+
uiPermissions: {
|
|
5479
|
+
...emptyUiPermissions,
|
|
5480
|
+
...roleUiPermissions,
|
|
5481
|
+
...maybeUiPermissions
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5463
5484
|
};
|
|
5464
5485
|
};
|
|
5465
5486
|
var roleActions = {
|
|
@@ -5510,13 +5531,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5510
5531
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5511
5532
|
`${sliceName8}/saveGlobalSettings`,
|
|
5512
5533
|
// @ts-ignore
|
|
5513
|
-
(
|
|
5514
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5534
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5515
5535
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5516
5536
|
return;
|
|
5517
5537
|
}
|
|
5518
5538
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5519
|
-
let updatedSettings =
|
|
5539
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5520
5540
|
if (getCurrentUser(getState()).verified) {
|
|
5521
5541
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5522
5542
|
} else {
|
|
@@ -5554,10 +5574,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5554
5574
|
const userSettings = getUserSettings(getState());
|
|
5555
5575
|
const onboardingState = getOnboardingState(getState());
|
|
5556
5576
|
const tooltipState = getTooltipsState(getState());
|
|
5557
|
-
const updatedSettings =
|
|
5558
|
-
|
|
5577
|
+
const updatedSettings = {
|
|
5578
|
+
...userSettings,
|
|
5579
|
+
// @ts-ignore
|
|
5580
|
+
...settings,
|
|
5581
|
+
onboarding: {
|
|
5582
|
+
...onboardingState,
|
|
5583
|
+
// @ts-ignore
|
|
5584
|
+
...settings.onboarding
|
|
5585
|
+
},
|
|
5559
5586
|
tooltips: tooltipState
|
|
5560
|
-
}
|
|
5587
|
+
};
|
|
5561
5588
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5562
5589
|
return Promise.all([
|
|
5563
5590
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5583,9 +5610,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5583
5610
|
`${sliceName8}/getTokens`,
|
|
5584
5611
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5585
5612
|
const user = getCurrentUser(getState());
|
|
5586
|
-
const updatedUser =
|
|
5613
|
+
const updatedUser = {
|
|
5614
|
+
...user,
|
|
5587
5615
|
tokens
|
|
5588
|
-
}
|
|
5616
|
+
};
|
|
5589
5617
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5590
5618
|
})
|
|
5591
5619
|
);
|
|
@@ -5601,8 +5629,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5601
5629
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5602
5630
|
)
|
|
5603
5631
|
);
|
|
5604
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5605
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5632
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5606
5633
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5607
5634
|
if (persist) {
|
|
5608
5635
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5610,14 +5637,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5610
5637
|
return Promise.all(tasks);
|
|
5611
5638
|
});
|
|
5612
5639
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5613
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5640
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5614
5641
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5615
5642
|
});
|
|
5616
5643
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5617
5644
|
`${sliceName8}/submitFeedback`,
|
|
5618
5645
|
// @ts-ignore
|
|
5619
|
-
(
|
|
5620
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5646
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5621
5647
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5622
5648
|
subject: "feedback submission",
|
|
5623
5649
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5650,21 +5676,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
5650
5676
|
return steps[progress2];
|
|
5651
5677
|
};
|
|
5652
5678
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
5653
|
-
var _a;
|
|
5654
5679
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
5655
5680
|
const userCookie = cookies5.get(`${userId}-onboarded`);
|
|
5656
5681
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
5657
5682
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
5658
|
-
let deviceType =
|
|
5683
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
5659
5684
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
5660
5685
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
5661
|
-
return
|
|
5686
|
+
return {
|
|
5687
|
+
...onboardingState,
|
|
5662
5688
|
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)),
|
|
5663
5689
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
5664
5690
|
deviceType,
|
|
5665
5691
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
5666
5692
|
progress: progress2
|
|
5667
|
-
}
|
|
5693
|
+
};
|
|
5668
5694
|
};
|
|
5669
5695
|
var getOnboardingState2 = (0, import_toolkit24.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
5670
5696
|
const state = getState();
|
|
@@ -5722,18 +5748,8 @@ var advanceOnboarding = (0, import_toolkit24.createAsyncThunk)(`${sliceName5}/ad
|
|
|
5722
5748
|
return;
|
|
5723
5749
|
}
|
|
5724
5750
|
const madeProgress = steps[stepIndex + 1];
|
|
5725
|
-
const state =
|
|
5751
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
5726
5752
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
5727
5753
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
5728
5754
|
});
|
|
5729
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5730
|
-
0 && (module.exports = {
|
|
5731
|
-
advanceOnboarding,
|
|
5732
|
-
applyOnboardingFallbacks,
|
|
5733
|
-
getOnboardingState,
|
|
5734
|
-
setOnboardingApproach,
|
|
5735
|
-
setOnboardingCanceled,
|
|
5736
|
-
setOnboardingComplete,
|
|
5737
|
-
setOnboardingDeviceType
|
|
5738
|
-
});
|
|
5739
5755
|
//# sourceMappingURL=thunks.js.map
|