@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
package/dist/appSlice/thunks.js
CHANGED
|
@@ -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 = {};
|
|
@@ -470,7 +420,7 @@ var chartTypes = {
|
|
|
470
420
|
};
|
|
471
421
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
472
422
|
var defaultReportType = "distribution";
|
|
473
|
-
var defaultReports = [
|
|
423
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
474
424
|
var locations = {};
|
|
475
425
|
var PLANS = {
|
|
476
426
|
os: {
|
|
@@ -803,7 +753,7 @@ var emptyRole = Object.freeze({
|
|
|
803
753
|
name: void 0,
|
|
804
754
|
description: "",
|
|
805
755
|
permissions: [],
|
|
806
|
-
uiPermissions: Object.freeze(
|
|
756
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
807
757
|
});
|
|
808
758
|
|
|
809
759
|
// src/deploymentsSlice/constants.ts
|
|
@@ -832,11 +782,12 @@ var deploymentStatesToSubstates = {
|
|
|
832
782
|
pending: [deploymentSubstates.pending],
|
|
833
783
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
834
784
|
};
|
|
835
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
785
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
786
|
+
...deploymentStatesToSubstates,
|
|
836
787
|
failures: [deploymentSubstates.failure],
|
|
837
788
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
838
789
|
successes: [deploymentSubstates.success]
|
|
839
|
-
}
|
|
790
|
+
};
|
|
840
791
|
var installationSubstatesMap = {
|
|
841
792
|
download: {
|
|
842
793
|
title: "download",
|
|
@@ -881,8 +832,8 @@ var DEPLOYMENT_STATES = {
|
|
|
881
832
|
var listDefaultsByState = {
|
|
882
833
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
883
834
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
884
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
885
|
-
[DEPLOYMENT_STATES.finished]:
|
|
835
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
836
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
886
837
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
887
838
|
};
|
|
888
839
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1257,7 +1208,7 @@ var uiPermissionsByArea = {
|
|
|
1257
1208
|
}
|
|
1258
1209
|
};
|
|
1259
1210
|
var permissionMapper = (permission) => permission.value;
|
|
1260
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1211
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1261
1212
|
var rolesById = Object.freeze({
|
|
1262
1213
|
[staticRolesByName.admin]: {
|
|
1263
1214
|
name: "Admin",
|
|
@@ -1265,54 +1216,59 @@ var rolesById = Object.freeze({
|
|
|
1265
1216
|
description: "Full access",
|
|
1266
1217
|
permissions: [],
|
|
1267
1218
|
// permissions refers to the values returned from the backend
|
|
1268
|
-
uiPermissions:
|
|
1219
|
+
uiPermissions: {
|
|
1220
|
+
...emptyUiPermissions,
|
|
1269
1221
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1270
1222
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1271
1223
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1272
1224
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1273
1225
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1274
|
-
}
|
|
1226
|
+
}
|
|
1275
1227
|
},
|
|
1276
1228
|
[staticRolesByName.readOnly]: {
|
|
1277
1229
|
name: "Read Access",
|
|
1278
1230
|
value: staticRolesByName.readOnly,
|
|
1279
1231
|
description: "",
|
|
1280
1232
|
permissions: [],
|
|
1281
|
-
uiPermissions:
|
|
1233
|
+
uiPermissions: {
|
|
1234
|
+
...emptyUiPermissions,
|
|
1282
1235
|
deployments: [uiPermissionsById.read.value],
|
|
1283
1236
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1284
1237
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1285
1238
|
userManagement: [uiPermissionsById.read.value]
|
|
1286
|
-
}
|
|
1239
|
+
}
|
|
1287
1240
|
},
|
|
1288
1241
|
[staticRolesByName.ci]: {
|
|
1289
1242
|
name: "Releases Manager",
|
|
1290
1243
|
value: staticRolesByName.ci,
|
|
1291
1244
|
description: "",
|
|
1292
1245
|
permissions: [],
|
|
1293
|
-
uiPermissions:
|
|
1246
|
+
uiPermissions: {
|
|
1247
|
+
...emptyUiPermissions,
|
|
1294
1248
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1295
|
-
}
|
|
1249
|
+
}
|
|
1296
1250
|
},
|
|
1297
1251
|
[staticRolesByName.deploymentsManager]: {
|
|
1298
1252
|
name: "Deployments Manager",
|
|
1299
1253
|
value: staticRolesByName.deploymentsManager,
|
|
1300
1254
|
description: "",
|
|
1301
1255
|
permissions: [],
|
|
1302
|
-
uiPermissions:
|
|
1256
|
+
uiPermissions: {
|
|
1257
|
+
...emptyUiPermissions,
|
|
1303
1258
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1304
1259
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1305
1260
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1306
|
-
}
|
|
1261
|
+
}
|
|
1307
1262
|
},
|
|
1308
1263
|
[staticRolesByName.terminalAccess]: {
|
|
1309
1264
|
name: "Troubleshooting",
|
|
1310
1265
|
value: staticRolesByName.terminalAccess,
|
|
1311
1266
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1312
1267
|
permissions: [],
|
|
1313
|
-
uiPermissions:
|
|
1268
|
+
uiPermissions: {
|
|
1269
|
+
...emptyUiPermissions,
|
|
1314
1270
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1315
|
-
}
|
|
1271
|
+
}
|
|
1316
1272
|
}
|
|
1317
1273
|
});
|
|
1318
1274
|
var serviceProviderRolesById = {
|
|
@@ -1321,22 +1277,24 @@ var serviceProviderRolesById = {
|
|
|
1321
1277
|
value: staticRolesByName.admin,
|
|
1322
1278
|
description: "Full access",
|
|
1323
1279
|
permissions: [],
|
|
1324
|
-
uiPermissions:
|
|
1280
|
+
uiPermissions: {
|
|
1281
|
+
...emptyUiPermissions,
|
|
1325
1282
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1326
1283
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1327
1284
|
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1328
|
-
}
|
|
1285
|
+
}
|
|
1329
1286
|
},
|
|
1330
1287
|
readOnly: {
|
|
1331
1288
|
name: "Read access",
|
|
1332
1289
|
value: staticRolesByName.admin,
|
|
1333
1290
|
description: "This role can see all linked organizations but cannot make any changes",
|
|
1334
1291
|
permissions: [],
|
|
1335
|
-
uiPermissions:
|
|
1292
|
+
uiPermissions: {
|
|
1293
|
+
...emptyUiPermissions,
|
|
1336
1294
|
auditlog: [uiPermissionsById.read.value],
|
|
1337
1295
|
userManagement: [uiPermissionsById.read.value],
|
|
1338
1296
|
tenantManagement: [uiPermissionsById.read.value]
|
|
1339
|
-
}
|
|
1297
|
+
}
|
|
1340
1298
|
}
|
|
1341
1299
|
};
|
|
1342
1300
|
var defaultPermissionSets = {
|
|
@@ -1349,7 +1307,9 @@ var defaultPermissionSets = {
|
|
|
1349
1307
|
},
|
|
1350
1308
|
[permissionSetIds.SuperUser]: {
|
|
1351
1309
|
name: permissionSetIds.SuperUser,
|
|
1352
|
-
result:
|
|
1310
|
+
result: {
|
|
1311
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1312
|
+
}
|
|
1353
1313
|
},
|
|
1354
1314
|
[permissionSetIds.ManageUsers]: {
|
|
1355
1315
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1434,11 +1394,12 @@ var defaultPermissionSets = {
|
|
|
1434
1394
|
};
|
|
1435
1395
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1436
1396
|
var OWN_USER_ID = "me";
|
|
1437
|
-
var rolesByName =
|
|
1397
|
+
var rolesByName = {
|
|
1398
|
+
...staticRolesByName,
|
|
1438
1399
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1439
1400
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1440
1401
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1441
|
-
}
|
|
1402
|
+
};
|
|
1442
1403
|
var twoFAStates = {
|
|
1443
1404
|
enabled: "enabled",
|
|
1444
1405
|
disabled: "disabled",
|
|
@@ -1456,18 +1417,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
1456
1417
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
1457
1418
|
var tokenCache = "";
|
|
1458
1419
|
var getSessionInfo = () => {
|
|
1459
|
-
|
|
1460
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
1420
|
+
let sessionInfo = { ...emptySession };
|
|
1461
1421
|
try {
|
|
1462
|
-
sessionInfo = JSON.parse(
|
|
1463
|
-
} catch
|
|
1422
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
1423
|
+
} catch {
|
|
1464
1424
|
}
|
|
1465
1425
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
1466
1426
|
cleanUp();
|
|
1467
|
-
return
|
|
1427
|
+
return { ...emptySession };
|
|
1468
1428
|
}
|
|
1469
1429
|
if (!sessionInfo.token) {
|
|
1470
|
-
let jwtTokenFromCookie =
|
|
1430
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
1471
1431
|
if (jwtTokenFromCookie) {
|
|
1472
1432
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
1473
1433
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -1495,8 +1455,7 @@ var maxSessionAge = 900;
|
|
|
1495
1455
|
|
|
1496
1456
|
// src/api/general-api.ts
|
|
1497
1457
|
var unauthorizedRedirect = (error) => {
|
|
1498
|
-
|
|
1499
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
1458
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
1500
1459
|
cleanUp();
|
|
1501
1460
|
window.location.replace("/ui/");
|
|
1502
1461
|
}
|
|
@@ -1506,7 +1465,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
1506
1465
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
1507
1466
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
1508
1467
|
authenticatedRequest.interceptors.request.use(
|
|
1509
|
-
(config) =>
|
|
1468
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
1510
1469
|
(error) => Promise.reject(error)
|
|
1511
1470
|
);
|
|
1512
1471
|
var Api = {
|
|
@@ -1514,7 +1473,7 @@ var Api = {
|
|
|
1514
1473
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
1515
1474
|
patch: authenticatedRequest.patch,
|
|
1516
1475
|
post: authenticatedRequest.post,
|
|
1517
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
1476
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
1518
1477
|
put: authenticatedRequest.put,
|
|
1519
1478
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
1520
1479
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -1545,10 +1504,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
1545
1504
|
var getSearchedDevices = (0, import_toolkit.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
1546
1505
|
var getVersionInformation = (0, import_toolkit.createSelector)(
|
|
1547
1506
|
[getFullVersionInformation, getFeatures],
|
|
1548
|
-
(
|
|
1549
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
1550
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
1551
|
-
}
|
|
1507
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
1552
1508
|
);
|
|
1553
1509
|
var getIsPreview = (0, import_toolkit.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers.versionCompare)(Integration, "next") > -1);
|
|
1554
1510
|
|
|
@@ -1565,8 +1521,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
1565
1521
|
var getMappedDeploymentSelection = (0, import_toolkit2.createSelector)(
|
|
1566
1522
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
1567
1523
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
1568
|
-
|
|
1569
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
1524
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
1570
1525
|
return selection.reduce((accu, id) => {
|
|
1571
1526
|
if (deploymentsById[id]) {
|
|
1572
1527
|
accu.push(deploymentsById[id]);
|
|
@@ -1610,7 +1565,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
1610
1565
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
1611
1566
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
1612
1567
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
1613
|
-
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
1568
|
+
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
1569
|
+
...filteringAttributes,
|
|
1614
1570
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
1615
1571
|
}));
|
|
1616
1572
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -1638,10 +1594,7 @@ var getDeviceCountsByStatus = (0, import_toolkit3.createSelector)(
|
|
|
1638
1594
|
return accu;
|
|
1639
1595
|
}, {})
|
|
1640
1596
|
);
|
|
1641
|
-
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
1642
|
-
var _a;
|
|
1643
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
1644
|
-
});
|
|
1597
|
+
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
1645
1598
|
var getSelectedGroupInfo = (0, import_toolkit3.createSelector)(
|
|
1646
1599
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
1647
1600
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -1658,17 +1611,13 @@ var getLimitMaxed = (0, import_toolkit3.createSelector)(
|
|
|
1658
1611
|
[getAcceptedDevices, getDeviceLimit],
|
|
1659
1612
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
1660
1613
|
);
|
|
1661
|
-
var
|
|
1662
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], (_a) => {
|
|
1663
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
1664
|
-
return groups;
|
|
1665
|
-
});
|
|
1614
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
1666
1615
|
var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById) => {
|
|
1667
1616
|
const groupNames = Object.keys(groupsById).sort();
|
|
1668
1617
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
1669
1618
|
(accu, [groupname, group]) => {
|
|
1670
1619
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
1671
|
-
const groupItem =
|
|
1620
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
1672
1621
|
if (group.filters.length > 0) {
|
|
1673
1622
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
1674
1623
|
accu.dynamic.push(groupItem);
|
|
@@ -1682,7 +1631,7 @@ var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById
|
|
|
1682
1631
|
},
|
|
1683
1632
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
1684
1633
|
);
|
|
1685
|
-
return
|
|
1634
|
+
return { groupNames, ...groupedGroups };
|
|
1686
1635
|
});
|
|
1687
1636
|
var getAttributesList = (0, import_toolkit3.createSelector)(
|
|
1688
1637
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -1722,10 +1671,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
1722
1671
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
1723
1672
|
var getDeviceTwinIntegrations = (0, import_toolkit4.createSelector)(
|
|
1724
1673
|
[getExternalIntegrations],
|
|
1725
|
-
(integrations) => integrations.filter((integration) =>
|
|
1726
|
-
var _a;
|
|
1727
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
1728
|
-
})
|
|
1674
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
1729
1675
|
);
|
|
1730
1676
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
1731
1677
|
var getWebhooks = (0, import_toolkit4.createSelector)(
|
|
@@ -1759,15 +1705,12 @@ var filterProcessors = {
|
|
|
1759
1705
|
var filterAliases = {
|
|
1760
1706
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
1761
1707
|
};
|
|
1762
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1769
|
-
};
|
|
1770
|
-
});
|
|
1708
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
1709
|
+
scope: filter.scope,
|
|
1710
|
+
attribute: filter.key,
|
|
1711
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
1712
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1713
|
+
}));
|
|
1771
1714
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
1772
1715
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
1773
1716
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -1777,14 +1720,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
1777
1720
|
});
|
|
1778
1721
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
1779
1722
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
1780
|
-
return
|
|
1723
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
1781
1724
|
}
|
|
1782
1725
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
1783
1726
|
});
|
|
1784
1727
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
1785
|
-
var _a;
|
|
1786
1728
|
let applicableFilters = [...filters];
|
|
1787
|
-
if (typeof group === "string" && !(
|
|
1729
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
1788
1730
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
1789
1731
|
}
|
|
1790
1732
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -1805,12 +1747,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
1805
1747
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
1806
1748
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
1807
1749
|
if (id && byId[id]) {
|
|
1808
|
-
accu.push(
|
|
1750
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
1809
1751
|
}
|
|
1810
1752
|
return accu;
|
|
1811
1753
|
}, []);
|
|
1812
1754
|
};
|
|
1813
|
-
var mergePermissions = (existingPermissions =
|
|
1755
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
1814
1756
|
(accu, [key, value]) => {
|
|
1815
1757
|
let values;
|
|
1816
1758
|
if (!accu[key]) {
|
|
@@ -1820,12 +1762,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
1820
1762
|
if (Array.isArray(value)) {
|
|
1821
1763
|
values = [...value, ...accu[key]].filter(import_helpers3.duplicateFilter);
|
|
1822
1764
|
} else {
|
|
1823
|
-
values = mergePermissions(accu[key],
|
|
1765
|
+
values = mergePermissions(accu[key], { ...value });
|
|
1824
1766
|
}
|
|
1825
1767
|
accu[key] = values;
|
|
1826
1768
|
return accu;
|
|
1827
1769
|
},
|
|
1828
|
-
|
|
1770
|
+
{ ...addedPermissions }
|
|
1829
1771
|
);
|
|
1830
1772
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
1831
1773
|
(accu, roleId) => {
|
|
@@ -1834,20 +1776,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
1834
1776
|
}
|
|
1835
1777
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
1836
1778
|
},
|
|
1837
|
-
|
|
1779
|
+
{ ...emptyUiPermissions }
|
|
1838
1780
|
);
|
|
1839
1781
|
var progress = ({ loaded, total }) => {
|
|
1840
1782
|
let uploadProgress4 = loaded / total * 100;
|
|
1841
1783
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
1842
1784
|
};
|
|
1843
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
1844
|
-
var _a, _b2, _c, _d, _e;
|
|
1845
|
-
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;
|
|
1846
|
-
};
|
|
1785
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
1847
1786
|
var preformatWithRequestID = (res, failMsg) => {
|
|
1848
1787
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
1849
1788
|
try {
|
|
1850
|
-
if (
|
|
1789
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
1851
1790
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
1852
1791
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
1853
1792
|
}
|
|
@@ -1862,9 +1801,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
1862
1801
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1863
1802
|
return accu;
|
|
1864
1803
|
}
|
|
1865
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
1804
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
1805
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
1866
1806
|
[attribute.name]: attribute.value
|
|
1867
|
-
}
|
|
1807
|
+
};
|
|
1868
1808
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1869
1809
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
1870
1810
|
}
|
|
@@ -1883,15 +1823,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
1883
1823
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
1884
1824
|
var getReleaseMappingDefaults = () => ({});
|
|
1885
1825
|
var getReleasesList = (0, import_toolkit5.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
1886
|
-
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
1826
|
+
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
1887
1827
|
var getHasReleases = (0, import_toolkit5.createSelector)(
|
|
1888
1828
|
[getReleaseListState, getReleasesById],
|
|
1889
1829
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
1890
1830
|
);
|
|
1891
|
-
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
1892
|
-
var _a;
|
|
1893
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
1894
|
-
});
|
|
1831
|
+
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
1895
1832
|
|
|
1896
1833
|
// src/usersSlice/selectors.ts
|
|
1897
1834
|
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
@@ -1900,10 +1837,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
1900
1837
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
1901
1838
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
1902
1839
|
var getUsersById = (state) => state.users.byId;
|
|
1903
|
-
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
1904
|
-
var _a;
|
|
1905
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
1906
|
-
});
|
|
1840
|
+
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
1907
1841
|
var getUserSettings = (state) => state.users.userSettings;
|
|
1908
1842
|
var getIsDarkMode = (0, import_toolkit6.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
1909
1843
|
var getShowHelptips = (0, import_toolkit6.createSelector)(
|
|
@@ -1914,22 +1848,22 @@ var getTooltipsState = (0, import_toolkit6.createSelector)(
|
|
|
1914
1848
|
[getTooltipsById, getUserSettings],
|
|
1915
1849
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
1916
1850
|
(accu, [id, value]) => {
|
|
1917
|
-
accu[id] =
|
|
1851
|
+
accu[id] = { ...accu[id], ...value };
|
|
1918
1852
|
return accu;
|
|
1919
1853
|
},
|
|
1920
|
-
|
|
1854
|
+
{ ...tooltips }
|
|
1921
1855
|
)
|
|
1922
1856
|
);
|
|
1923
1857
|
var getHas2FA = (0, import_toolkit6.createSelector)(
|
|
1924
1858
|
[getCurrentUser],
|
|
1925
1859
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
1926
1860
|
);
|
|
1927
|
-
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
1861
|
+
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
1928
1862
|
var getOfflineThresholdSettings = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
1929
|
-
interval:
|
|
1930
|
-
intervalUnit:
|
|
1863
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
1864
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
1931
1865
|
}));
|
|
1932
|
-
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
1866
|
+
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
1933
1867
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
1934
1868
|
|
|
1935
1869
|
// src/commonSelectors.ts
|
|
@@ -1948,8 +1882,7 @@ var getSearchEndpoint = (0, import_toolkit7.createSelector)(
|
|
|
1948
1882
|
var getUserRoles = (0, import_toolkit7.createSelector)(
|
|
1949
1883
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
1950
1884
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
1951
|
-
|
|
1952
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1885
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1953
1886
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
1954
1887
|
return { isAdmin, uiPermissions };
|
|
1955
1888
|
}
|
|
@@ -2018,10 +1951,11 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
2018
1951
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2019
1952
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2020
1953
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2021
|
-
const updateAttribute =
|
|
1954
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2022
1955
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2023
1956
|
const attributes = [
|
|
2024
|
-
...previousFilters.map((item) =>
|
|
1957
|
+
...previousFilters.map((item) => ({
|
|
1958
|
+
...item,
|
|
2025
1959
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2026
1960
|
category: "recently used",
|
|
2027
1961
|
priority: 0
|
|
@@ -2039,14 +1973,13 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
2039
1973
|
return (0, import_helpers4.attributeDuplicateFilter)(attributes, "key");
|
|
2040
1974
|
}
|
|
2041
1975
|
);
|
|
2042
|
-
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], (
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
});
|
|
1976
|
+
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
1977
|
+
...remainder,
|
|
1978
|
+
...onboarding,
|
|
1979
|
+
complete: onboarding.complete || complete,
|
|
1980
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
1981
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
1982
|
+
}));
|
|
2050
1983
|
var getDemoDeviceAddress = (0, import_toolkit7.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2051
1984
|
const demoDeviceAddress = `http://${(0, import_helpers4.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2052
1985
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2067,12 +2000,11 @@ var getDeploymentRelease = (0, import_toolkit7.createSelector)(
|
|
|
2067
2000
|
var getSelectedDeploymentData = (0, import_toolkit7.createSelector)(
|
|
2068
2001
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2069
2002
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2070
|
-
|
|
2071
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2003
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2072
2004
|
const { devices = {} } = deployment;
|
|
2073
2005
|
return {
|
|
2074
2006
|
deployment,
|
|
2075
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2007
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2076
2008
|
};
|
|
2077
2009
|
}
|
|
2078
2010
|
);
|
|
@@ -2087,8 +2019,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit7.createSelector)(
|
|
|
2087
2019
|
}, {})
|
|
2088
2020
|
);
|
|
2089
2021
|
var getGroupNames = (0, import_toolkit7.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2090
|
-
|
|
2091
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2022
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2092
2023
|
if (staticOnly) {
|
|
2093
2024
|
return Object.keys(uiPermissions.groups).sort();
|
|
2094
2025
|
}
|
|
@@ -2122,9 +2053,9 @@ var getAuditlogDevice = (0, import_toolkit7.createSelector)([getAuditLogEntry, g
|
|
|
2122
2053
|
if (auditlogEvent) {
|
|
2123
2054
|
const { object = {} } = auditlogEvent;
|
|
2124
2055
|
const { device = {}, id, type } = object;
|
|
2125
|
-
auditlogDevice = type === "device" ?
|
|
2056
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2126
2057
|
}
|
|
2127
|
-
return
|
|
2058
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2128
2059
|
});
|
|
2129
2060
|
var getRelevantRoles = (0, import_toolkit7.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2130
2061
|
if (service_provider) {
|
|
@@ -2218,7 +2149,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2218
2149
|
initialState,
|
|
2219
2150
|
reducers: {
|
|
2220
2151
|
setFeatures: (state, action) => {
|
|
2221
|
-
state.features =
|
|
2152
|
+
state.features = {
|
|
2153
|
+
...state.features,
|
|
2154
|
+
...action.payload
|
|
2155
|
+
};
|
|
2222
2156
|
},
|
|
2223
2157
|
setSnackbar: (state, { payload }) => {
|
|
2224
2158
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -2243,7 +2177,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2243
2177
|
state.hostedAnnouncement = action.payload;
|
|
2244
2178
|
},
|
|
2245
2179
|
setSearchState: (state, action) => {
|
|
2246
|
-
state.searchState =
|
|
2180
|
+
state.searchState = {
|
|
2181
|
+
...state.searchState,
|
|
2182
|
+
...action.payload
|
|
2183
|
+
};
|
|
2247
2184
|
},
|
|
2248
2185
|
setOfflineThreshold: (state, action) => {
|
|
2249
2186
|
state.offlineThreshold = action.payload;
|
|
@@ -2254,20 +2191,23 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2254
2191
|
},
|
|
2255
2192
|
uploadProgress: (state, action) => {
|
|
2256
2193
|
const { id, progress: progress2 } = action.payload;
|
|
2257
|
-
state.uploadsById[id] =
|
|
2194
|
+
state.uploadsById[id] = {
|
|
2195
|
+
...state.uploadsById[id],
|
|
2258
2196
|
progress: progress2
|
|
2259
|
-
}
|
|
2197
|
+
};
|
|
2260
2198
|
},
|
|
2261
2199
|
cleanUpUpload: (state, action) => {
|
|
2262
|
-
|
|
2263
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2200
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
2264
2201
|
state.uploadsById = remainder;
|
|
2265
2202
|
},
|
|
2266
2203
|
setVersionInformation: (state, action) => {
|
|
2267
|
-
state.versionInformation =
|
|
2204
|
+
state.versionInformation = {
|
|
2205
|
+
...state.versionInformation,
|
|
2206
|
+
...action.payload
|
|
2207
|
+
};
|
|
2268
2208
|
},
|
|
2269
2209
|
setEnvironmentData: (state, action) => {
|
|
2270
|
-
return
|
|
2210
|
+
return { ...state, ...action.payload };
|
|
2271
2211
|
}
|
|
2272
2212
|
}
|
|
2273
2213
|
});
|
|
@@ -2299,7 +2239,7 @@ var initialState2 = {
|
|
|
2299
2239
|
sourceWindow: -1
|
|
2300
2240
|
},
|
|
2301
2241
|
binaryDeltaLimits: {
|
|
2302
|
-
timeout:
|
|
2242
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
2303
2243
|
sourceWindow: limitDefault,
|
|
2304
2244
|
inputWindow: limitDefault,
|
|
2305
2245
|
duplicatesWindow: limitDefault,
|
|
@@ -2309,10 +2249,10 @@ var initialState2 = {
|
|
|
2309
2249
|
deploymentDeviceLimit: 5e3,
|
|
2310
2250
|
selectedDeviceIds: [],
|
|
2311
2251
|
selectionState: {
|
|
2312
|
-
finished:
|
|
2313
|
-
inprogress:
|
|
2314
|
-
pending:
|
|
2315
|
-
scheduled:
|
|
2252
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
2253
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2254
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2255
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
2316
2256
|
general: {
|
|
2317
2257
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
2318
2258
|
showCreationDialog: false,
|
|
@@ -2328,40 +2268,55 @@ var deploymentsSlice = (0, import_toolkit9.createSlice)({
|
|
|
2328
2268
|
initialState: initialState2,
|
|
2329
2269
|
reducers: {
|
|
2330
2270
|
createdDeployment: (state, action) => {
|
|
2331
|
-
state.byId[action.payload.id] =
|
|
2271
|
+
state.byId[action.payload.id] = {
|
|
2272
|
+
...deploymentPrototype,
|
|
2273
|
+
...action.payload
|
|
2274
|
+
};
|
|
2332
2275
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
2333
2276
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
2334
2277
|
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;
|
|
2335
2278
|
},
|
|
2336
2279
|
removedDeployment: (state, action) => {
|
|
2337
|
-
|
|
2338
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2280
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
2339
2281
|
state.byId = remainder;
|
|
2340
2282
|
},
|
|
2341
2283
|
receivedDeployment: (state, action) => {
|
|
2342
|
-
state.byId[action.payload.id] =
|
|
2284
|
+
state.byId[action.payload.id] = {
|
|
2285
|
+
...state.byId[action.payload.id] || {},
|
|
2286
|
+
...action.payload
|
|
2287
|
+
};
|
|
2343
2288
|
},
|
|
2344
2289
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
2345
2290
|
const { id, deviceId, log } = action.payload;
|
|
2346
|
-
const deployment =
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2291
|
+
const deployment = {
|
|
2292
|
+
...deploymentPrototype,
|
|
2293
|
+
...state.byId[id]
|
|
2294
|
+
};
|
|
2295
|
+
state.byId[id] = {
|
|
2296
|
+
...deployment,
|
|
2297
|
+
devices: {
|
|
2298
|
+
...deployment.devices,
|
|
2299
|
+
[deviceId]: {
|
|
2300
|
+
...deployment.devices[deviceId],
|
|
2350
2301
|
log
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2354
2305
|
},
|
|
2355
2306
|
receivedDeploymentDevices: (state, action) => {
|
|
2356
2307
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
2357
|
-
state.byId[id] =
|
|
2308
|
+
state.byId[id] = {
|
|
2309
|
+
...state.byId[id],
|
|
2358
2310
|
devices,
|
|
2359
2311
|
totalDeviceCount
|
|
2360
|
-
}
|
|
2312
|
+
};
|
|
2361
2313
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
2362
2314
|
},
|
|
2363
2315
|
receivedDeployments: (state, action) => {
|
|
2364
|
-
state.byId =
|
|
2316
|
+
state.byId = {
|
|
2317
|
+
...state.byId,
|
|
2318
|
+
...action.payload
|
|
2319
|
+
};
|
|
2365
2320
|
},
|
|
2366
2321
|
receivedDeploymentsForStatus: (state, action) => {
|
|
2367
2322
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -2403,9 +2358,9 @@ var initialState3 = {
|
|
|
2403
2358
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
2404
2359
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
2405
2360
|
},
|
|
2406
|
-
deviceList:
|
|
2407
|
-
deviceIds: []
|
|
2408
|
-
|
|
2361
|
+
deviceList: {
|
|
2362
|
+
deviceIds: [],
|
|
2363
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2409
2364
|
selectedAttributes: [],
|
|
2410
2365
|
selectedIssues: [],
|
|
2411
2366
|
selection: [],
|
|
@@ -2416,7 +2371,7 @@ var initialState3 = {
|
|
|
2416
2371
|
},
|
|
2417
2372
|
state: DEVICE_STATES.accepted,
|
|
2418
2373
|
total: 0
|
|
2419
|
-
}
|
|
2374
|
+
},
|
|
2420
2375
|
filters: [
|
|
2421
2376
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
2422
2377
|
],
|
|
@@ -2451,49 +2406,59 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2451
2406
|
},
|
|
2452
2407
|
addToGroup: (state, action) => {
|
|
2453
2408
|
const { group, deviceIds } = action.payload;
|
|
2454
|
-
const maybeExistingGroup =
|
|
2409
|
+
const maybeExistingGroup = {
|
|
2455
2410
|
filters: [],
|
|
2456
|
-
deviceIds: []
|
|
2457
|
-
|
|
2458
|
-
|
|
2411
|
+
deviceIds: [],
|
|
2412
|
+
...state.groups.byId[group]
|
|
2413
|
+
};
|
|
2414
|
+
state.groups.byId[group] = {
|
|
2415
|
+
...maybeExistingGroup,
|
|
2459
2416
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers5.duplicateFilter),
|
|
2460
2417
|
total: (maybeExistingGroup.total || 0) + 1
|
|
2461
|
-
}
|
|
2418
|
+
};
|
|
2462
2419
|
},
|
|
2463
2420
|
removeFromGroup: (state, action) => {
|
|
2464
2421
|
const { group, deviceIds: removedIds } = action.payload;
|
|
2465
|
-
const
|
|
2466
|
-
const changedGroup =
|
|
2422
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
2423
|
+
const changedGroup = {
|
|
2424
|
+
...maybeExistingGroup,
|
|
2467
2425
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
2468
2426
|
total: Math.max(total - removedIds.length, 0)
|
|
2469
|
-
}
|
|
2427
|
+
};
|
|
2470
2428
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
2471
2429
|
state.groups.byId[group] = changedGroup;
|
|
2472
2430
|
return;
|
|
2473
2431
|
} else if (state.groups.selectedGroup === group) {
|
|
2474
2432
|
state.groups.selectedGroup = void 0;
|
|
2475
2433
|
}
|
|
2476
|
-
const
|
|
2434
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
2477
2435
|
state.groups.byId = remainingById;
|
|
2478
2436
|
},
|
|
2479
2437
|
addGroup: (state, action) => {
|
|
2480
2438
|
const { groupName, group } = action.payload;
|
|
2481
|
-
state.groups.byId[groupName] =
|
|
2439
|
+
state.groups.byId[groupName] = {
|
|
2440
|
+
...state.groups.byId[groupName],
|
|
2441
|
+
...group
|
|
2442
|
+
};
|
|
2482
2443
|
},
|
|
2483
2444
|
selectGroup: (state, { payload: group }) => {
|
|
2484
2445
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
2485
2446
|
state.groups.selectedGroup = group;
|
|
2486
2447
|
},
|
|
2487
2448
|
removeGroup: (state, action) => {
|
|
2488
|
-
|
|
2489
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
2449
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
2490
2450
|
state.groups.byId = remainingById;
|
|
2491
2451
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
2492
2452
|
},
|
|
2493
2453
|
setDeviceListState: (state, action) => {
|
|
2494
|
-
state.deviceList =
|
|
2495
|
-
|
|
2496
|
-
|
|
2454
|
+
state.deviceList = {
|
|
2455
|
+
...state.deviceList,
|
|
2456
|
+
...action.payload,
|
|
2457
|
+
sort: {
|
|
2458
|
+
...state.deviceList.sort,
|
|
2459
|
+
...action.payload.sort
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2497
2462
|
},
|
|
2498
2463
|
setFilterAttributes: (state, action) => {
|
|
2499
2464
|
state.filteringAttributes = action.payload;
|
|
@@ -2502,7 +2467,10 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2502
2467
|
state.filteringAttributesConfig = action.payload;
|
|
2503
2468
|
},
|
|
2504
2469
|
receivedDevices: (state, action) => {
|
|
2505
|
-
state.byId =
|
|
2470
|
+
state.byId = {
|
|
2471
|
+
...state.byId,
|
|
2472
|
+
...action.payload
|
|
2473
|
+
};
|
|
2506
2474
|
},
|
|
2507
2475
|
setDeviceFilters: (state, action) => {
|
|
2508
2476
|
if ((0, import_helpers5.deepCompare)(action.payload, state.filters)) {
|
|
@@ -2533,7 +2501,10 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2533
2501
|
state.limit = action.payload;
|
|
2534
2502
|
},
|
|
2535
2503
|
receivedDevice: (state, action) => {
|
|
2536
|
-
state.byId[action.payload.id] =
|
|
2504
|
+
state.byId[action.payload.id] = {
|
|
2505
|
+
...state.byId[action.payload.id],
|
|
2506
|
+
...action.payload
|
|
2507
|
+
};
|
|
2537
2508
|
},
|
|
2538
2509
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
2539
2510
|
const { deviceId, authId } = action.payload;
|
|
@@ -2554,15 +2525,17 @@ var import_toolkit11 = require("@reduxjs/toolkit");
|
|
|
2554
2525
|
var sliceName4 = "monitor";
|
|
2555
2526
|
var initialState4 = {
|
|
2556
2527
|
alerts: {
|
|
2557
|
-
alertList:
|
|
2528
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
2558
2529
|
byDeviceId: {}
|
|
2559
2530
|
},
|
|
2560
2531
|
issueCounts: {
|
|
2561
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
2532
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
2562
2533
|
},
|
|
2563
2534
|
settings: {
|
|
2564
2535
|
global: {
|
|
2565
|
-
channels:
|
|
2536
|
+
channels: {
|
|
2537
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
2538
|
+
}
|
|
2566
2539
|
}
|
|
2567
2540
|
}
|
|
2568
2541
|
};
|
|
@@ -2580,14 +2553,14 @@ var monitorSlice = (0, import_toolkit11.createSlice)({
|
|
|
2580
2553
|
},
|
|
2581
2554
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
2582
2555
|
const { deviceId, alerts } = action.payload;
|
|
2583
|
-
state.alerts.byDeviceId[deviceId] =
|
|
2556
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
2584
2557
|
},
|
|
2585
2558
|
receiveDeviceIssueCounts: (state, action) => {
|
|
2586
2559
|
const { issueType, counts } = action.payload;
|
|
2587
2560
|
state.issueCounts.byType[issueType] = counts;
|
|
2588
2561
|
},
|
|
2589
2562
|
setAlertListState: (state, action) => {
|
|
2590
|
-
state.alerts.alertList =
|
|
2563
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
2591
2564
|
}
|
|
2592
2565
|
}
|
|
2593
2566
|
});
|
|
@@ -2611,7 +2584,7 @@ var onboardingSlice = (0, import_toolkit12.createSlice)({
|
|
|
2611
2584
|
initialState: initialState5,
|
|
2612
2585
|
reducers: {
|
|
2613
2586
|
setOnboardingState: (state, action) => {
|
|
2614
|
-
return
|
|
2587
|
+
return { ...state, ...action.payload };
|
|
2615
2588
|
},
|
|
2616
2589
|
setDemoArtifactPort: (state, action) => {
|
|
2617
2590
|
state.demoArtifactPort = action.payload;
|
|
@@ -2649,7 +2622,8 @@ var initialState6 = {
|
|
|
2649
2622
|
brand: ""
|
|
2650
2623
|
},
|
|
2651
2624
|
intentId: null,
|
|
2652
|
-
tenantList:
|
|
2625
|
+
tenantList: {
|
|
2626
|
+
...TENANT_LIST_DEFAULT,
|
|
2653
2627
|
total: 0,
|
|
2654
2628
|
tenants: [],
|
|
2655
2629
|
selectedTenant: null,
|
|
@@ -2657,13 +2631,14 @@ var initialState6 = {
|
|
|
2657
2631
|
direction: SORTING_OPTIONS.desc,
|
|
2658
2632
|
key: "name"
|
|
2659
2633
|
}
|
|
2660
|
-
}
|
|
2634
|
+
},
|
|
2661
2635
|
organization: {
|
|
2662
2636
|
// id, name, status, tenant_token, plan
|
|
2663
2637
|
},
|
|
2664
2638
|
auditlog: {
|
|
2665
2639
|
events: [],
|
|
2666
|
-
selectionState:
|
|
2640
|
+
selectionState: {
|
|
2641
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2667
2642
|
detail: void 0,
|
|
2668
2643
|
endDate: void 0,
|
|
2669
2644
|
selectedIssue: void 0,
|
|
@@ -2672,7 +2647,7 @@ var initialState6 = {
|
|
|
2672
2647
|
total: 0,
|
|
2673
2648
|
type: void 0,
|
|
2674
2649
|
user: void 0
|
|
2675
|
-
}
|
|
2650
|
+
}
|
|
2676
2651
|
},
|
|
2677
2652
|
externalDeviceIntegrations: [
|
|
2678
2653
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2695,7 +2670,10 @@ var organizationSlice = (0, import_toolkit13.createSlice)({
|
|
|
2695
2670
|
state.auditlog.selectionState.total = total;
|
|
2696
2671
|
},
|
|
2697
2672
|
setAuditLogState: (state, action) => {
|
|
2698
|
-
state.auditlog.selectionState =
|
|
2673
|
+
state.auditlog.selectionState = {
|
|
2674
|
+
...state.auditlog.selectionState,
|
|
2675
|
+
...action.payload
|
|
2676
|
+
};
|
|
2699
2677
|
},
|
|
2700
2678
|
receiveCurrentCard: (state, action) => {
|
|
2701
2679
|
state.card = action.payload;
|
|
@@ -2704,7 +2682,7 @@ var organizationSlice = (0, import_toolkit13.createSlice)({
|
|
|
2704
2682
|
state.intentId = action.payload;
|
|
2705
2683
|
},
|
|
2706
2684
|
setOrganization: (state, action) => {
|
|
2707
|
-
state.organization =
|
|
2685
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2708
2686
|
},
|
|
2709
2687
|
setTenantListState: (state, action) => {
|
|
2710
2688
|
state.tenantList = action.payload;
|
|
@@ -2767,7 +2745,8 @@ var initialState7 = {
|
|
|
2767
2745
|
}
|
|
2768
2746
|
*/
|
|
2769
2747
|
},
|
|
2770
|
-
releasesList:
|
|
2748
|
+
releasesList: {
|
|
2749
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2771
2750
|
searchedIds: [],
|
|
2772
2751
|
releaseIds: [],
|
|
2773
2752
|
selection: [],
|
|
@@ -2781,7 +2760,7 @@ var initialState7 = {
|
|
|
2781
2760
|
selectedTags: [],
|
|
2782
2761
|
total: 0,
|
|
2783
2762
|
type: ""
|
|
2784
|
-
}
|
|
2763
|
+
},
|
|
2785
2764
|
tags: [],
|
|
2786
2765
|
updateTypes: [],
|
|
2787
2766
|
/*
|
|
@@ -2807,8 +2786,7 @@ var releaseSlice = (0, import_toolkit14.createSlice)({
|
|
|
2807
2786
|
state.updateTypes = action.payload;
|
|
2808
2787
|
},
|
|
2809
2788
|
removeRelease: (state, action) => {
|
|
2810
|
-
|
|
2811
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2789
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2812
2790
|
state.byId = byId;
|
|
2813
2791
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2814
2792
|
},
|
|
@@ -2841,8 +2819,12 @@ var initialState8 = {
|
|
|
2841
2819
|
previousPhases: [],
|
|
2842
2820
|
retries: 0
|
|
2843
2821
|
},
|
|
2844
|
-
permissionSetsById:
|
|
2845
|
-
|
|
2822
|
+
permissionSetsById: {
|
|
2823
|
+
...defaultPermissionSets
|
|
2824
|
+
},
|
|
2825
|
+
rolesById: {
|
|
2826
|
+
...rolesById
|
|
2827
|
+
},
|
|
2846
2828
|
settingsInitialized: false,
|
|
2847
2829
|
showConnectDeviceDialog: false,
|
|
2848
2830
|
showFeedbackDialog: false,
|
|
@@ -2882,13 +2864,15 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2882
2864
|
state.byId[0] = action.payload;
|
|
2883
2865
|
},
|
|
2884
2866
|
removedUser: (state, action) => {
|
|
2885
|
-
|
|
2886
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2867
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2887
2868
|
state.byId = byId;
|
|
2888
2869
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2889
2870
|
},
|
|
2890
2871
|
updatedUser: (state, action) => {
|
|
2891
|
-
state.byId[action.payload.id] =
|
|
2872
|
+
state.byId[action.payload.id] = {
|
|
2873
|
+
...state.byId[action.payload.id],
|
|
2874
|
+
...action.payload
|
|
2875
|
+
};
|
|
2892
2876
|
},
|
|
2893
2877
|
receivedPermissionSets: (state, action) => {
|
|
2894
2878
|
state.permissionSetsById = action.payload;
|
|
@@ -2897,11 +2881,13 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2897
2881
|
state.rolesById = action.payload;
|
|
2898
2882
|
},
|
|
2899
2883
|
createdRole: (state, action) => {
|
|
2900
|
-
state.rolesById[action.payload.name] =
|
|
2884
|
+
state.rolesById[action.payload.name] = {
|
|
2885
|
+
...state.rolesById[action.payload.name],
|
|
2886
|
+
...action.payload
|
|
2887
|
+
};
|
|
2901
2888
|
},
|
|
2902
2889
|
removedRole: (state, action) => {
|
|
2903
|
-
|
|
2904
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2890
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2905
2891
|
state.rolesById = rolesById2;
|
|
2906
2892
|
},
|
|
2907
2893
|
setCustomColumns: (state, action) => {
|
|
@@ -2909,18 +2895,27 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2909
2895
|
},
|
|
2910
2896
|
setGlobalSettings: (state, action) => {
|
|
2911
2897
|
state.settingsInitialized = true;
|
|
2912
|
-
state.globalSettings =
|
|
2898
|
+
state.globalSettings = {
|
|
2899
|
+
...state.globalSettings,
|
|
2900
|
+
...action.payload
|
|
2901
|
+
};
|
|
2913
2902
|
},
|
|
2914
2903
|
setUserSettings: (state, action) => {
|
|
2915
2904
|
state.userSettingsInitialized = true;
|
|
2916
|
-
state.userSettings =
|
|
2905
|
+
state.userSettings = {
|
|
2906
|
+
...state.userSettings,
|
|
2907
|
+
...action.payload
|
|
2908
|
+
};
|
|
2917
2909
|
},
|
|
2918
2910
|
setTooltipState: (state, action) => {
|
|
2919
2911
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2920
2912
|
state.tooltips.byId[id].readState = readState;
|
|
2921
2913
|
},
|
|
2922
2914
|
setTooltipsState: (state, action) => {
|
|
2923
|
-
state.tooltips.byId =
|
|
2915
|
+
state.tooltips.byId = {
|
|
2916
|
+
...state.tooltips.byId,
|
|
2917
|
+
...action.payload
|
|
2918
|
+
};
|
|
2924
2919
|
},
|
|
2925
2920
|
setShowFeedbackDialog: (state, action) => {
|
|
2926
2921
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2937,7 +2932,16 @@ var actions8 = usersSlice.actions;
|
|
|
2937
2932
|
var usersSlice_default = usersSlice.reducer;
|
|
2938
2933
|
|
|
2939
2934
|
// src/actions.ts
|
|
2940
|
-
var actions_default =
|
|
2935
|
+
var actions_default = {
|
|
2936
|
+
...actions,
|
|
2937
|
+
...actions2,
|
|
2938
|
+
...actions3,
|
|
2939
|
+
...actions4,
|
|
2940
|
+
...actions5,
|
|
2941
|
+
...actions6,
|
|
2942
|
+
...actions7,
|
|
2943
|
+
...actions8
|
|
2944
|
+
};
|
|
2941
2945
|
|
|
2942
2946
|
// src/store.ts
|
|
2943
2947
|
var import_toolkit16 = require("@reduxjs/toolkit");
|
|
@@ -2972,8 +2976,9 @@ var sessionReducer = (state, action) => {
|
|
|
2972
2976
|
return rootReducer(state, action);
|
|
2973
2977
|
};
|
|
2974
2978
|
var getConfiguredStore = (options = {}) => {
|
|
2975
|
-
const
|
|
2976
|
-
return (0, import_toolkit16.configureStore)(
|
|
2979
|
+
const { preloadedState = {}, ...config } = options;
|
|
2980
|
+
return (0, import_toolkit16.configureStore)({
|
|
2981
|
+
...config,
|
|
2977
2982
|
preloadedState,
|
|
2978
2983
|
reducer: sessionReducer,
|
|
2979
2984
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2986,7 +2991,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2986
2991
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2987
2992
|
}
|
|
2988
2993
|
})
|
|
2989
|
-
})
|
|
2994
|
+
});
|
|
2990
2995
|
};
|
|
2991
2996
|
var store = getConfiguredStore({
|
|
2992
2997
|
preloadedState: {}
|
|
@@ -3001,13 +3006,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3001
3006
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3002
3007
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers6.startTimeSort).reduce(
|
|
3003
3008
|
(accu, item) => {
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3009
|
+
const filter = item.filter ?? {};
|
|
3010
|
+
let deployment = {
|
|
3011
|
+
...deploymentPrototype,
|
|
3012
|
+
...deploymentsById[item.id],
|
|
3013
|
+
...item,
|
|
3014
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3008
3015
|
name: decodeURIComponent(item.name)
|
|
3009
|
-
}
|
|
3010
|
-
deployment =
|
|
3016
|
+
};
|
|
3017
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3011
3018
|
accu.deployments[item.id] = deployment;
|
|
3012
3019
|
accu.deploymentIds.push(item.id);
|
|
3013
3020
|
return accu;
|
|
@@ -3061,11 +3068,12 @@ var createDeployment = (0, import_toolkit17.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3061
3068
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3062
3069
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3063
3070
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3064
|
-
const deployment =
|
|
3071
|
+
const deployment = {
|
|
3072
|
+
...newDeployment,
|
|
3065
3073
|
id: deploymentId,
|
|
3066
3074
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3067
3075
|
statistics: { status: {} }
|
|
3068
|
-
}
|
|
3076
|
+
};
|
|
3069
3077
|
let tasks = [
|
|
3070
3078
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3071
3079
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3208,14 +3216,23 @@ var updateDeploymentControlMap = (0, import_toolkit17.createAsyncThunk)(
|
|
|
3208
3216
|
({ 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))))
|
|
3209
3217
|
);
|
|
3210
3218
|
var setDeploymentsState = (0, import_toolkit17.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3211
|
-
const
|
|
3219
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3212
3220
|
const currentState = getState().deployments.selectionState;
|
|
3213
|
-
let nextState =
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3221
|
+
let nextState = {
|
|
3222
|
+
...currentState,
|
|
3223
|
+
...selectionState,
|
|
3224
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3225
|
+
accu[item] = {
|
|
3226
|
+
...currentState[item],
|
|
3227
|
+
...selectionState[item]
|
|
3228
|
+
};
|
|
3229
|
+
return accu;
|
|
3230
|
+
}, {}),
|
|
3231
|
+
general: {
|
|
3232
|
+
...currentState.general,
|
|
3233
|
+
...selectionState.general
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3219
3236
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3220
3237
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3221
3238
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3245,15 +3262,20 @@ var getDeploymentsConfig = (0, import_toolkit17.createAsyncThunk)(
|
|
|
3245
3262
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3246
3263
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3247
3264
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3248
|
-
const config =
|
|
3265
|
+
const config = {
|
|
3266
|
+
...oldConfig,
|
|
3249
3267
|
hasDelta: Boolean(delta.enabled),
|
|
3250
|
-
binaryDelta:
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3268
|
+
binaryDelta: {
|
|
3269
|
+
...oldConfig.binaryDelta,
|
|
3270
|
+
timeout: timeoutConfig,
|
|
3271
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3272
|
+
},
|
|
3273
|
+
binaryDeltaLimits: {
|
|
3274
|
+
...oldConfig.binaryDeltaLimits,
|
|
3275
|
+
timeout: timeoutLimit,
|
|
3276
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3277
|
+
}
|
|
3278
|
+
};
|
|
3257
3279
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3258
3280
|
})
|
|
3259
3281
|
);
|
|
@@ -3263,7 +3285,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3263
3285
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers6.isEmpty)(cleanedValue)) {
|
|
3264
3286
|
return accu;
|
|
3265
3287
|
}
|
|
3266
|
-
accu =
|
|
3288
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3267
3289
|
}
|
|
3268
3290
|
return accu;
|
|
3269
3291
|
}, void 0);
|
|
@@ -3283,9 +3305,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit17.createAsyncThunk)(`${slice
|
|
|
3283
3305
|
}
|
|
3284
3306
|
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(() => {
|
|
3285
3307
|
const oldConfig = getState().deployments.config;
|
|
3286
|
-
const newConfig =
|
|
3287
|
-
|
|
3288
|
-
|
|
3308
|
+
const newConfig = {
|
|
3309
|
+
...oldConfig,
|
|
3310
|
+
binaryDelta: {
|
|
3311
|
+
...oldConfig.binaryDelta,
|
|
3312
|
+
...config
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3289
3315
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3290
3316
|
});
|
|
3291
3317
|
});
|
|
@@ -3298,19 +3324,20 @@ var import_toolkit18 = require("@reduxjs/toolkit");
|
|
|
3298
3324
|
var import_axios2 = require("axios");
|
|
3299
3325
|
var import_pluralize = __toESM(require_pluralize());
|
|
3300
3326
|
|
|
3301
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3302
|
-
var
|
|
3303
|
-
var
|
|
3304
|
-
var poolPtr = rnds8Pool.length;
|
|
3327
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3328
|
+
var getRandomValues;
|
|
3329
|
+
var rnds8 = new Uint8Array(16);
|
|
3305
3330
|
function rng() {
|
|
3306
|
-
if (
|
|
3307
|
-
|
|
3308
|
-
|
|
3331
|
+
if (!getRandomValues) {
|
|
3332
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3333
|
+
if (!getRandomValues) {
|
|
3334
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3335
|
+
}
|
|
3309
3336
|
}
|
|
3310
|
-
return
|
|
3337
|
+
return getRandomValues(rnds8);
|
|
3311
3338
|
}
|
|
3312
3339
|
|
|
3313
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3340
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3314
3341
|
var byteToHex = [];
|
|
3315
3342
|
for (let i = 0; i < 256; ++i) {
|
|
3316
3343
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3319,13 +3346,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3319
3346
|
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]];
|
|
3320
3347
|
}
|
|
3321
3348
|
|
|
3322
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3323
|
-
var
|
|
3349
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3350
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3324
3351
|
var native_default = {
|
|
3325
|
-
randomUUID
|
|
3352
|
+
randomUUID
|
|
3326
3353
|
};
|
|
3327
3354
|
|
|
3328
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3355
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3329
3356
|
function v4(options, buf, offset) {
|
|
3330
3357
|
if (native_default.randomUUID && !buf && !options) {
|
|
3331
3358
|
return native_default.randomUUID();
|
|
@@ -3367,14 +3394,13 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3367
3394
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3368
3395
|
const state = getGroupsById(getState());
|
|
3369
3396
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3370
|
-
|
|
3371
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3397
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3372
3398
|
accu[id] = group;
|
|
3373
3399
|
}
|
|
3374
3400
|
return accu;
|
|
3375
3401
|
}, {});
|
|
3376
3402
|
const groups = res.data.reduce((accu, group) => {
|
|
3377
|
-
accu[group] =
|
|
3403
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3378
3404
|
return accu;
|
|
3379
3405
|
}, dynamicGroups);
|
|
3380
3406
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3432,7 +3458,7 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3432
3458
|
() => Promise.resolve(
|
|
3433
3459
|
dispatch(
|
|
3434
3460
|
actions3.addGroup({
|
|
3435
|
-
group:
|
|
3461
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3436
3462
|
groupName: group
|
|
3437
3463
|
})
|
|
3438
3464
|
)
|
|
@@ -3460,20 +3486,19 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3460
3486
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3461
3487
|
const state = getGroupsById(getState());
|
|
3462
3488
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3463
|
-
|
|
3464
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3489
|
+
if (!(group.id || group.filters?.length)) {
|
|
3465
3490
|
accu[id] = group;
|
|
3466
3491
|
}
|
|
3467
3492
|
return accu;
|
|
3468
3493
|
}, {});
|
|
3469
3494
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3470
|
-
accu[filter.name] =
|
|
3495
|
+
accu[filter.name] = {
|
|
3471
3496
|
deviceIds: [],
|
|
3472
|
-
total: 0
|
|
3473
|
-
|
|
3497
|
+
total: 0,
|
|
3498
|
+
...state[filter.name],
|
|
3474
3499
|
id: filter.id,
|
|
3475
3500
|
filters: mapTermsToFilters(filter.terms)
|
|
3476
|
-
}
|
|
3501
|
+
};
|
|
3477
3502
|
return accu;
|
|
3478
3503
|
}, staticGroups);
|
|
3479
3504
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3513,10 +3538,9 @@ var removeDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/r
|
|
|
3513
3538
|
);
|
|
3514
3539
|
});
|
|
3515
3540
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3516
|
-
var _a;
|
|
3517
3541
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3518
3542
|
const selectedGroup = groupsState.byId[groupName];
|
|
3519
|
-
const groupFilterLength =
|
|
3543
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3520
3544
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3521
3545
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3522
3546
|
};
|
|
@@ -3539,7 +3563,6 @@ var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3539
3563
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3540
3564
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3541
3565
|
(accu, device) => {
|
|
3542
|
-
var _a, _b2, _c;
|
|
3543
3566
|
const stateDevice = getDeviceById(state, device.id);
|
|
3544
3567
|
const {
|
|
3545
3568
|
attributes: storedAttributes = {},
|
|
@@ -3549,29 +3572,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3549
3572
|
group: storedGroup
|
|
3550
3573
|
} = stateDevice;
|
|
3551
3574
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3552
|
-
device.tags =
|
|
3553
|
-
device.group =
|
|
3554
|
-
device.monitor =
|
|
3555
|
-
device.identity_data =
|
|
3575
|
+
device.tags = { ...storedTags, ...tags };
|
|
3576
|
+
device.group = system.group ?? storedGroup;
|
|
3577
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3578
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3556
3579
|
device.status = status ? status : device.status || identity.status;
|
|
3557
|
-
device.check_in_time_rounded =
|
|
3558
|
-
device.check_in_time_exact =
|
|
3580
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3581
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3559
3582
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3560
3583
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3561
3584
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3562
3585
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3563
|
-
device.attributes = device.attributes ?
|
|
3564
|
-
accu.devicesById[device.id] =
|
|
3586
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3587
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3565
3588
|
accu.ids.push(device.id);
|
|
3566
3589
|
return accu;
|
|
3567
3590
|
},
|
|
3568
3591
|
{ ids, devicesById: {} }
|
|
3569
3592
|
);
|
|
3570
3593
|
var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3571
|
-
const
|
|
3594
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3572
3595
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3573
3596
|
return Promise.resolve(
|
|
3574
|
-
dispatch(getDevicesByStatus2(
|
|
3597
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3575
3598
|
).unwrap().then((results) => {
|
|
3576
3599
|
if (!group) {
|
|
3577
3600
|
return Promise.resolve();
|
|
@@ -3585,7 +3608,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3585
3608
|
dispatch(
|
|
3586
3609
|
actions3.addGroup({
|
|
3587
3610
|
group: {
|
|
3588
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3611
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3589
3612
|
total
|
|
3590
3613
|
},
|
|
3591
3614
|
groupName: group
|
|
@@ -3734,27 +3757,26 @@ var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3734
3757
|
);
|
|
3735
3758
|
var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
|
|
3736
3759
|
`${sliceName3}/setDeviceListState`,
|
|
3737
|
-
(
|
|
3738
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3739
|
-
var _c;
|
|
3760
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3740
3761
|
const currentState = getDeviceListState(getState());
|
|
3741
3762
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3742
|
-
let nextState =
|
|
3763
|
+
let nextState = {
|
|
3764
|
+
...currentState,
|
|
3743
3765
|
setOnly: false,
|
|
3744
|
-
refreshTrigger
|
|
3745
|
-
|
|
3746
|
-
sort:
|
|
3747
|
-
}
|
|
3766
|
+
refreshTrigger,
|
|
3767
|
+
...selectionState,
|
|
3768
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3769
|
+
};
|
|
3748
3770
|
let tasks = [];
|
|
3749
|
-
const
|
|
3750
|
-
const
|
|
3771
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3772
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3751
3773
|
if (!nextState.setOnly && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3752
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3774
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3753
3775
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3754
3776
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3755
3777
|
nextState.isLoading = true;
|
|
3756
3778
|
tasks.push(
|
|
3757
|
-
dispatch(getDevicesByStatus2(
|
|
3779
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3758
3780
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3759
3781
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3760
3782
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3779,8 +3801,8 @@ var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/
|
|
|
3779
3801
|
} = options;
|
|
3780
3802
|
const state = getState();
|
|
3781
3803
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3782
|
-
filters: filterSelection
|
|
3783
|
-
group: group
|
|
3804
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3805
|
+
group: group ?? getSelectedGroup(state),
|
|
3784
3806
|
groups: state.devices.groups,
|
|
3785
3807
|
offlineThreshold: state.app.offlineThreshold,
|
|
3786
3808
|
selectedIssues,
|
|
@@ -3841,7 +3863,7 @@ var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3
|
|
|
3841
3863
|
});
|
|
3842
3864
|
var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3843
3865
|
const state = getState();
|
|
3844
|
-
let options =
|
|
3866
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3845
3867
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3846
3868
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3847
3869
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -3976,8 +3998,7 @@ var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
3976
3998
|
({ data: auditLogEntries }) => {
|
|
3977
3999
|
const { start, end } = auditLogEntries.reduce(
|
|
3978
4000
|
(accu, item) => {
|
|
3979
|
-
|
|
3980
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4001
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
3981
4002
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
3982
4003
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
3983
4004
|
}
|
|
@@ -4084,8 +4105,7 @@ var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4084
4105
|
var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
4085
4106
|
`${sliceName3}/getDeviceConfig`,
|
|
4086
4107
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4087
|
-
|
|
4088
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4108
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4089
4109
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4090
4110
|
}
|
|
4091
4111
|
})
|
|
@@ -4097,15 +4117,14 @@ var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4097
4117
|
var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
4098
4118
|
`${sliceName3}/applyDeviceConfig`,
|
|
4099
4119
|
({ 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 }) => {
|
|
4100
|
-
var _a;
|
|
4101
4120
|
const device = getDeviceById(getState(), deviceId);
|
|
4102
4121
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4103
4122
|
let tasks = [
|
|
4104
|
-
dispatch(actions3.receivedDevice(
|
|
4123
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4105
4124
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4106
4125
|
];
|
|
4107
4126
|
if (isDefault && canManageUsers) {
|
|
4108
|
-
const { previous } =
|
|
4127
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4109
4128
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4110
4129
|
}
|
|
4111
4130
|
return Promise.all(tasks);
|
|
@@ -4121,21 +4140,21 @@ var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4121
4140
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4122
4141
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4123
4142
|
{ headers }
|
|
4124
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4143
|
+
).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"))]));
|
|
4125
4144
|
})
|
|
4126
4145
|
)
|
|
4127
4146
|
);
|
|
4128
4147
|
var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4129
4148
|
let providerResult = {};
|
|
4130
4149
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4131
|
-
providerResult =
|
|
4150
|
+
providerResult = { ...data, twinError: "" };
|
|
4132
4151
|
}).catch((err) => {
|
|
4133
4152
|
providerResult = {
|
|
4134
4153
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4135
4154
|
};
|
|
4136
4155
|
}).finally(() => {
|
|
4137
4156
|
const device = getDeviceById(getState(), deviceId);
|
|
4138
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4157
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4139
4158
|
});
|
|
4140
4159
|
});
|
|
4141
4160
|
var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
@@ -4151,7 +4170,7 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4151
4170
|
const { twinsByIntegration = {} } = device;
|
|
4152
4171
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4153
4172
|
return Promise.resolve(
|
|
4154
|
-
dispatch(actions3.receivedDevice(
|
|
4173
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4155
4174
|
);
|
|
4156
4175
|
})
|
|
4157
4176
|
);
|
|
@@ -4172,8 +4191,8 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
4172
4191
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4173
4192
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4174
4193
|
const filters = [
|
|
4175
|
-
|
|
4176
|
-
|
|
4194
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4195
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4177
4196
|
];
|
|
4178
4197
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4179
4198
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4185,11 +4204,12 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
4185
4204
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4186
4205
|
const state2 = getState();
|
|
4187
4206
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4188
|
-
const device =
|
|
4207
|
+
const device = {
|
|
4208
|
+
...getDeviceById(state2, id),
|
|
4189
4209
|
systemDeviceIds: ids,
|
|
4190
4210
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4191
|
-
}
|
|
4192
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4211
|
+
};
|
|
4212
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4193
4213
|
});
|
|
4194
4214
|
});
|
|
4195
4215
|
var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4197,9 +4217,9 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4197
4217
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4198
4218
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4199
4219
|
const filters = [
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4220
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4221
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4222
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4203
4223
|
];
|
|
4204
4224
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4205
4225
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4246,7 +4266,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4246
4266
|
var cutoffLength = 75;
|
|
4247
4267
|
var ellipsis = "...";
|
|
4248
4268
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4249
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4269
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4250
4270
|
var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4251
4271
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4252
4272
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4264,14 +4284,15 @@ var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4
|
|
|
4264
4284
|
});
|
|
4265
4285
|
var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4266
4286
|
const state = getState();
|
|
4267
|
-
const
|
|
4268
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4287
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4288
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4289
|
+
...remainder,
|
|
4269
4290
|
filters,
|
|
4270
4291
|
group,
|
|
4271
4292
|
offlineThreshold: state.app.offlineThreshold,
|
|
4272
4293
|
selectedIssues: [type],
|
|
4273
4294
|
status
|
|
4274
|
-
})
|
|
4295
|
+
});
|
|
4275
4296
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4276
4297
|
page: 1,
|
|
4277
4298
|
per_page: 1,
|
|
@@ -4323,21 +4344,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4323
4344
|
return steps[progress2];
|
|
4324
4345
|
};
|
|
4325
4346
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4326
|
-
var _a;
|
|
4327
4347
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4328
4348
|
const userCookie = cookies2.get(`${userId}-onboarded`);
|
|
4329
4349
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4330
4350
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4331
|
-
let deviceType =
|
|
4351
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4332
4352
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4333
4353
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4334
|
-
return
|
|
4354
|
+
return {
|
|
4355
|
+
...onboardingState,
|
|
4335
4356
|
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)),
|
|
4336
4357
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4337
4358
|
deviceType,
|
|
4338
4359
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4339
4360
|
progress: progress2
|
|
4340
|
-
}
|
|
4361
|
+
};
|
|
4341
4362
|
};
|
|
4342
4363
|
var getOnboardingState2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4343
4364
|
const state = getState();
|
|
@@ -4395,7 +4416,7 @@ var advanceOnboarding = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4395
4416
|
return;
|
|
4396
4417
|
}
|
|
4397
4418
|
const madeProgress = steps[stepIndex + 1];
|
|
4398
|
-
const state =
|
|
4419
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4399
4420
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4400
4421
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4401
4422
|
});
|
|
@@ -4478,8 +4499,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4478
4499
|
({ 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())))
|
|
4479
4500
|
);
|
|
4480
4501
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4481
|
-
const userId =
|
|
4482
|
-
const detail =
|
|
4502
|
+
const userId = userFilter?.id || userFilter;
|
|
4503
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4483
4504
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4484
4505
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4485
4506
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4506,12 +4527,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4506
4527
|
);
|
|
4507
4528
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4508
4529
|
const currentState = getAuditlogState(getState());
|
|
4509
|
-
let nextState =
|
|
4510
|
-
|
|
4511
|
-
|
|
4530
|
+
let nextState = {
|
|
4531
|
+
...currentState,
|
|
4532
|
+
...selectionState,
|
|
4533
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4534
|
+
};
|
|
4512
4535
|
let tasks = [];
|
|
4513
|
-
const
|
|
4514
|
-
const
|
|
4536
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4537
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4515
4538
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4516
4539
|
nextState.isLoading = true;
|
|
4517
4540
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4523,27 +4546,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4523
4546
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4524
4547
|
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));
|
|
4525
4548
|
});
|
|
4526
|
-
var tenantListRetrieval = (config) =>
|
|
4549
|
+
var tenantListRetrieval = async (config) => {
|
|
4527
4550
|
const { page, perPage } = config;
|
|
4528
4551
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4529
|
-
const tenantList =
|
|
4552
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4530
4553
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4531
4554
|
return [tenantList.data, Number(totalCount)];
|
|
4532
|
-
}
|
|
4533
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4555
|
+
};
|
|
4556
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4534
4557
|
const currentState = getTenantsList(getState());
|
|
4535
|
-
const [tenants, pageCount] =
|
|
4536
|
-
dispatch(actions6.setTenantListState(
|
|
4537
|
-
})
|
|
4538
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4558
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4559
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4560
|
+
});
|
|
4561
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4539
4562
|
const currentState = getTenantsList(getState());
|
|
4540
|
-
const nextState =
|
|
4563
|
+
const nextState = {
|
|
4564
|
+
...currentState,
|
|
4565
|
+
...selectionState
|
|
4566
|
+
};
|
|
4541
4567
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4542
|
-
const [tenants, pageCount] =
|
|
4543
|
-
return dispatch(actions6.setTenantListState(
|
|
4568
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4569
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4544
4570
|
}
|
|
4545
|
-
return dispatch(actions6.setTenantListState(
|
|
4546
|
-
})
|
|
4571
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4572
|
+
});
|
|
4547
4573
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4548
4574
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4549
4575
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4586,10 +4612,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4586
4612
|
);
|
|
4587
4613
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4588
4614
|
`${sliceName6}/createIntegration`,
|
|
4589
|
-
(
|
|
4590
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4591
|
-
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())]));
|
|
4592
|
-
}
|
|
4615
|
+
({ 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())]))
|
|
4593
4616
|
);
|
|
4594
4617
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4595
4618
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4610,9 +4633,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4610
4633
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4611
4634
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4612
4635
|
const integrations = data.reduce((accu, item) => {
|
|
4613
|
-
|
|
4614
|
-
const
|
|
4615
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4636
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4637
|
+
const integration = { ...existingIntegration, ...item };
|
|
4616
4638
|
accu.push(integration);
|
|
4617
4639
|
return accu;
|
|
4618
4640
|
}, []);
|
|
@@ -4664,7 +4686,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4664
4686
|
`${sliceName6}/getSsoConfigById`,
|
|
4665
4687
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4666
4688
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4667
|
-
return sso ? Promise.resolve(
|
|
4689
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4668
4690
|
})
|
|
4669
4691
|
);
|
|
4670
4692
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4683,20 +4705,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4683
4705
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4684
4706
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4685
4707
|
var flattenRelease = (release, stateRelease) => {
|
|
4686
|
-
|
|
4687
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4708
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4688
4709
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4689
4710
|
(accu, item) => {
|
|
4690
|
-
var _a2;
|
|
4691
4711
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4692
|
-
const stateArtifact =
|
|
4712
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4693
4713
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4694
|
-
accu.artifacts.push(
|
|
4714
|
+
accu.artifacts.push({
|
|
4715
|
+
...stateArtifact,
|
|
4716
|
+
...item
|
|
4717
|
+
});
|
|
4695
4718
|
return accu;
|
|
4696
4719
|
},
|
|
4697
4720
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4698
4721
|
);
|
|
4699
|
-
return
|
|
4722
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4700
4723
|
};
|
|
4701
4724
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4702
4725
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4714,17 +4737,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4714
4737
|
{ release: null, index: -1 }
|
|
4715
4738
|
);
|
|
4716
4739
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4717
|
-
var _a;
|
|
4718
4740
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4719
4741
|
if (!release || index === -1) {
|
|
4720
4742
|
return;
|
|
4721
4743
|
}
|
|
4722
4744
|
const releaseArtifacts = [...release.artifacts];
|
|
4723
4745
|
const artifact = releaseArtifacts[index];
|
|
4724
|
-
const { key, name, version } = (
|
|
4746
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4725
4747
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4726
4748
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4727
|
-
filters: [
|
|
4749
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4728
4750
|
});
|
|
4729
4751
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4730
4752
|
page: 1,
|
|
@@ -4738,10 +4760,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4738
4760
|
}
|
|
4739
4761
|
const installCount = Number(headers[headerNames.total]);
|
|
4740
4762
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4741
|
-
releaseArtifacts2[index2] =
|
|
4742
|
-
release2 =
|
|
4763
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4764
|
+
release2 = {
|
|
4765
|
+
...release2,
|
|
4743
4766
|
artifacts: releaseArtifacts2
|
|
4744
|
-
}
|
|
4767
|
+
};
|
|
4745
4768
|
return dispatch(actions7.receiveRelease(release2));
|
|
4746
4769
|
});
|
|
4747
4770
|
});
|
|
@@ -4753,12 +4776,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4753
4776
|
return dispatch(getReleases());
|
|
4754
4777
|
}
|
|
4755
4778
|
const releaseArtifacts = [...release.artifacts];
|
|
4756
|
-
releaseArtifacts[index] =
|
|
4779
|
+
releaseArtifacts[index] = {
|
|
4780
|
+
...releaseArtifacts[index],
|
|
4757
4781
|
url: response.data.uri
|
|
4758
|
-
}
|
|
4759
|
-
release =
|
|
4782
|
+
};
|
|
4783
|
+
release = {
|
|
4784
|
+
...release,
|
|
4760
4785
|
artifacts: releaseArtifacts
|
|
4761
|
-
}
|
|
4786
|
+
};
|
|
4762
4787
|
return dispatch(actions7.receiveRelease(release));
|
|
4763
4788
|
})
|
|
4764
4789
|
);
|
|
@@ -4883,12 +4908,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4883
4908
|
});
|
|
4884
4909
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4885
4910
|
const currentState = getState().releases.releasesList;
|
|
4886
|
-
let nextState =
|
|
4887
|
-
|
|
4888
|
-
|
|
4911
|
+
let nextState = {
|
|
4912
|
+
...currentState,
|
|
4913
|
+
...selectionState,
|
|
4914
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4915
|
+
};
|
|
4889
4916
|
let tasks = [];
|
|
4890
|
-
const
|
|
4891
|
-
const
|
|
4917
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4918
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4892
4919
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4893
4920
|
nextState.isLoading = true;
|
|
4894
4921
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4907,29 +4934,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4907
4934
|
);
|
|
4908
4935
|
};
|
|
4909
4936
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4910
|
-
let releaseListState =
|
|
4937
|
+
let releaseListState = { ...state.releasesList };
|
|
4911
4938
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4912
4939
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4913
4940
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4914
4941
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4915
4942
|
if (searchOnly) {
|
|
4916
|
-
releaseListState =
|
|
4943
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4917
4944
|
} else {
|
|
4918
|
-
releaseListState =
|
|
4945
|
+
releaseListState = {
|
|
4946
|
+
...releaseListState,
|
|
4919
4947
|
releaseIds,
|
|
4920
4948
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4921
4949
|
total: !isFiltering ? total : state.releasesList.total
|
|
4922
|
-
}
|
|
4950
|
+
};
|
|
4923
4951
|
}
|
|
4924
4952
|
return releaseListState;
|
|
4925
4953
|
};
|
|
4926
4954
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4927
|
-
const config =
|
|
4955
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4928
4956
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4929
4957
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4930
4958
|
const state = getState().releases;
|
|
4931
4959
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4932
|
-
const combinedReleases =
|
|
4960
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4933
4961
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4934
4962
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4935
4963
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4950,7 +4978,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4950
4978
|
`${sliceName7}/updateReleaseInfo`,
|
|
4951
4979
|
({ 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(() => {
|
|
4952
4980
|
return Promise.all([
|
|
4953
|
-
dispatch(actions7.receiveRelease(
|
|
4981
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4954
4982
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4955
4983
|
]);
|
|
4956
4984
|
})
|
|
@@ -4959,7 +4987,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4959
4987
|
`${sliceName7}/setReleaseTags`,
|
|
4960
4988
|
({ 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(() => {
|
|
4961
4989
|
return Promise.all([
|
|
4962
|
-
dispatch(actions7.receiveRelease(
|
|
4990
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4963
4991
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4964
4992
|
]);
|
|
4965
4993
|
})
|
|
@@ -4976,19 +5004,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4976
5004
|
// src/api/users-api.ts
|
|
4977
5005
|
var import_axios4 = __toESM(require("axios"));
|
|
4978
5006
|
var Api2 = {
|
|
4979
|
-
postLogin: (url,
|
|
4980
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4981
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4982
|
-
var _a2;
|
|
4983
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4984
|
-
});
|
|
4985
|
-
},
|
|
5007
|
+
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"] })),
|
|
4986
5008
|
putVerifyTFA: (url, userData) => {
|
|
4987
5009
|
let body = {};
|
|
4988
5010
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4989
5011
|
body = { token2fa: userData.token2fa };
|
|
4990
5012
|
}
|
|
4991
|
-
return import_axios4.default.put(url, body,
|
|
5013
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4992
5014
|
}
|
|
4993
5015
|
};
|
|
4994
5016
|
var users_api_default = Api2;
|
|
@@ -5016,43 +5038,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
5016
5038
|
};
|
|
5017
5039
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5018
5040
|
`${sliceName8}/loginUser`,
|
|
5019
|
-
(
|
|
5020
|
-
|
|
5021
|
-
return
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
Promise.
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
window.
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
);
|
|
5054
|
-
});
|
|
5055
|
-
}
|
|
5041
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5042
|
+
cleanUp();
|
|
5043
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5044
|
+
}).then(({ text: response, contentType }) => {
|
|
5045
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5046
|
+
const { id, kind } = response;
|
|
5047
|
+
const type = kind.split("/")[1];
|
|
5048
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5049
|
+
window.location.replace(ssoLoginUrl);
|
|
5050
|
+
return;
|
|
5051
|
+
}
|
|
5052
|
+
const token = response;
|
|
5053
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5054
|
+
return;
|
|
5055
|
+
}
|
|
5056
|
+
let now = /* @__PURE__ */ new Date();
|
|
5057
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5058
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5059
|
+
setSessionInfo({ token, expiresAt });
|
|
5060
|
+
cookies4.remove("JWT", { path: "/" });
|
|
5061
|
+
return (
|
|
5062
|
+
// @ts-ignore
|
|
5063
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5064
|
+
cleanUp();
|
|
5065
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5066
|
+
}).then(() => {
|
|
5067
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5068
|
+
if (window.location.pathname !== "/ui/") {
|
|
5069
|
+
window.location.replace("/ui/");
|
|
5070
|
+
}
|
|
5071
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5072
|
+
})
|
|
5073
|
+
);
|
|
5074
|
+
})
|
|
5056
5075
|
);
|
|
5057
5076
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
5058
5077
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -5069,7 +5088,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
5069
5088
|
return Promise.reject();
|
|
5070
5089
|
}
|
|
5071
5090
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5072
|
-
setSessionInfo(
|
|
5091
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5073
5092
|
window.location.reload();
|
|
5074
5093
|
});
|
|
5075
5094
|
});
|
|
@@ -5132,13 +5151,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5132
5151
|
);
|
|
5133
5152
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5134
5153
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5135
|
-
const userId = currentUserId
|
|
5154
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5136
5155
|
const storageKey = `${userId}-column-widths`;
|
|
5137
5156
|
let customColumns = [];
|
|
5138
5157
|
if (!columns) {
|
|
5139
5158
|
try {
|
|
5140
5159
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5141
|
-
} catch
|
|
5160
|
+
} catch {
|
|
5142
5161
|
}
|
|
5143
5162
|
} else {
|
|
5144
5163
|
customColumns = columns;
|
|
@@ -5167,10 +5186,7 @@ var userActions = {
|
|
|
5167
5186
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5168
5187
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5169
5188
|
`${sliceName8}/createUser`,
|
|
5170
|
-
(
|
|
5171
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5172
|
-
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));
|
|
5173
|
-
}
|
|
5189
|
+
({ 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))
|
|
5174
5190
|
);
|
|
5175
5191
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5176
5192
|
`${sliceName8}/removeUser`,
|
|
@@ -5181,15 +5197,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5181
5197
|
);
|
|
5182
5198
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5183
5199
|
`${sliceName8}/editUser`,
|
|
5184
|
-
(
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
()
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
])
|
|
5191
|
-
);
|
|
5192
|
-
}
|
|
5200
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5201
|
+
() => Promise.all([
|
|
5202
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5203
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5204
|
+
])
|
|
5205
|
+
)
|
|
5193
5206
|
);
|
|
5194
5207
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5195
5208
|
const { id } = getOrganization(getState());
|
|
@@ -5224,7 +5237,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5224
5237
|
}
|
|
5225
5238
|
return accu;
|
|
5226
5239
|
},
|
|
5227
|
-
|
|
5240
|
+
{ ...emptyUiPermissions }
|
|
5228
5241
|
);
|
|
5229
5242
|
var permissionActionTypes = {
|
|
5230
5243
|
any: mapHttpPermission,
|
|
@@ -5247,20 +5260,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5247
5260
|
}, existingPermissions);
|
|
5248
5261
|
var tryParseCustomPermission = (permission) => {
|
|
5249
5262
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5250
|
-
const result = mergePermissions(
|
|
5263
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5251
5264
|
return { isCustom: true, permission, result };
|
|
5252
5265
|
};
|
|
5253
5266
|
var customPermissionHandler = (accu, permission) => {
|
|
5254
5267
|
let processor = tryParseCustomPermission(permission);
|
|
5255
|
-
return
|
|
5268
|
+
return {
|
|
5269
|
+
...accu,
|
|
5256
5270
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5257
5271
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5258
|
-
}
|
|
5272
|
+
};
|
|
5259
5273
|
};
|
|
5260
5274
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5261
5275
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5262
5276
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5263
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5277
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5264
5278
|
};
|
|
5265
5279
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5266
5280
|
if (Array.isArray(permissions)) {
|
|
@@ -5275,60 +5289,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5275
5289
|
if (!processor) {
|
|
5276
5290
|
return accu;
|
|
5277
5291
|
}
|
|
5278
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5279
|
-
var _a;
|
|
5280
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5281
|
-
});
|
|
5292
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5282
5293
|
if (scope) {
|
|
5283
5294
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5284
|
-
return
|
|
5295
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5285
5296
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5286
5297
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5287
5298
|
}
|
|
5288
|
-
return
|
|
5299
|
+
return {
|
|
5300
|
+
...accu,
|
|
5289
5301
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5290
5302
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5291
|
-
}
|
|
5303
|
+
};
|
|
5292
5304
|
},
|
|
5293
|
-
{ isCustom: false, uiPermissions:
|
|
5305
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5294
5306
|
);
|
|
5295
5307
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5296
5308
|
};
|
|
5297
5309
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5298
5310
|
(accu, role) => {
|
|
5299
|
-
var _a;
|
|
5300
5311
|
let normalizedPermissions;
|
|
5301
5312
|
let isCustom = false;
|
|
5302
5313
|
if (rolesById2[role.name]) {
|
|
5303
|
-
normalizedPermissions =
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5314
|
+
normalizedPermissions = {
|
|
5315
|
+
...rolesById2[role.name].uiPermissions,
|
|
5316
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5317
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5318
|
+
};
|
|
5307
5319
|
} else {
|
|
5308
5320
|
const result = parseRolePermissions(role, permissionSets);
|
|
5309
5321
|
normalizedPermissions = result.uiPermissions;
|
|
5310
5322
|
isCustom = result.isCustom;
|
|
5311
5323
|
}
|
|
5312
|
-
const roleState =
|
|
5313
|
-
accu[role.name] =
|
|
5324
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5325
|
+
accu[role.name] = {
|
|
5326
|
+
...roleState,
|
|
5327
|
+
...role,
|
|
5314
5328
|
description: roleState.description ? roleState.description : role.description,
|
|
5315
5329
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5316
5330
|
isCustom,
|
|
5317
5331
|
name: roleState.name ? roleState.name : role.name,
|
|
5318
5332
|
uiPermissions: normalizedPermissions
|
|
5319
|
-
}
|
|
5333
|
+
};
|
|
5320
5334
|
return accu;
|
|
5321
5335
|
},
|
|
5322
|
-
|
|
5336
|
+
{ ...rolesById2 }
|
|
5323
5337
|
);
|
|
5324
5338
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5325
5339
|
`${sliceName8}/getPermissionSets`,
|
|
5326
5340
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5327
5341
|
const permissionSets = data.reduce(
|
|
5328
5342
|
(accu, permissionSet) => {
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5343
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5344
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5332
5345
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5333
5346
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5334
5347
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5339,11 +5352,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5339
5352
|
}
|
|
5340
5353
|
return collector;
|
|
5341
5354
|
}, accu2),
|
|
5342
|
-
|
|
5355
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5343
5356
|
);
|
|
5344
5357
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5345
|
-
|
|
5346
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5358
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5347
5359
|
accu2.push(key);
|
|
5348
5360
|
}
|
|
5349
5361
|
return accu2;
|
|
@@ -5356,7 +5368,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5356
5368
|
return accu;
|
|
5357
5369
|
},
|
|
5358
5370
|
// @ts-ignore
|
|
5359
|
-
|
|
5371
|
+
{ ...getState().users.permissionSetsById }
|
|
5360
5372
|
);
|
|
5361
5373
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5362
5374
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5389,28 +5401,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5389
5401
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5390
5402
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5391
5403
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5392
|
-
|
|
5393
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5404
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5394
5405
|
type: uiPermissionsByArea[area].scope,
|
|
5395
5406
|
value: []
|
|
5396
5407
|
};
|
|
5397
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5408
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5409
|
+
...permissionSetState,
|
|
5398
5410
|
value: [...permissionSetState.value, item]
|
|
5399
|
-
}
|
|
5411
|
+
};
|
|
5400
5412
|
return itemPermissionAccu;
|
|
5401
5413
|
}, accu);
|
|
5402
5414
|
return accu;
|
|
5403
5415
|
}, {});
|
|
5404
|
-
return Object.entries(permissionSetObject).map((
|
|
5405
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5416
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5406
5417
|
if (value.includes(excessiveAccessSelector)) {
|
|
5407
5418
|
return { name };
|
|
5408
5419
|
}
|
|
5409
|
-
return { name, scope:
|
|
5420
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5410
5421
|
});
|
|
5411
5422
|
};
|
|
5412
5423
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5413
|
-
const role =
|
|
5424
|
+
const role = { ...roleState, ...roleData };
|
|
5414
5425
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5415
5426
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5416
5427
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5446,12 +5457,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5446
5457
|
}, []);
|
|
5447
5458
|
return {
|
|
5448
5459
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5449
|
-
role:
|
|
5460
|
+
role: {
|
|
5461
|
+
...emptyRole,
|
|
5450
5462
|
name,
|
|
5451
5463
|
// @ts-ignore
|
|
5452
5464
|
description: description ? description : roleState.description,
|
|
5453
|
-
uiPermissions:
|
|
5454
|
-
|
|
5465
|
+
uiPermissions: {
|
|
5466
|
+
...emptyUiPermissions,
|
|
5467
|
+
...roleUiPermissions,
|
|
5468
|
+
...maybeUiPermissions
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5455
5471
|
};
|
|
5456
5472
|
};
|
|
5457
5473
|
var roleActions = {
|
|
@@ -5502,13 +5518,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5502
5518
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5503
5519
|
`${sliceName8}/saveGlobalSettings`,
|
|
5504
5520
|
// @ts-ignore
|
|
5505
|
-
(
|
|
5506
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5521
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5507
5522
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5508
5523
|
return;
|
|
5509
5524
|
}
|
|
5510
5525
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5511
|
-
let updatedSettings =
|
|
5526
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5512
5527
|
if (getCurrentUser(getState()).verified) {
|
|
5513
5528
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5514
5529
|
} else {
|
|
@@ -5546,10 +5561,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5546
5561
|
const userSettings = getUserSettings(getState());
|
|
5547
5562
|
const onboardingState = getOnboardingState(getState());
|
|
5548
5563
|
const tooltipState = getTooltipsState(getState());
|
|
5549
|
-
const updatedSettings =
|
|
5550
|
-
|
|
5564
|
+
const updatedSettings = {
|
|
5565
|
+
...userSettings,
|
|
5566
|
+
// @ts-ignore
|
|
5567
|
+
...settings,
|
|
5568
|
+
onboarding: {
|
|
5569
|
+
...onboardingState,
|
|
5570
|
+
// @ts-ignore
|
|
5571
|
+
...settings.onboarding
|
|
5572
|
+
},
|
|
5551
5573
|
tooltips: tooltipState
|
|
5552
|
-
}
|
|
5574
|
+
};
|
|
5553
5575
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5554
5576
|
return Promise.all([
|
|
5555
5577
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5575,9 +5597,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5575
5597
|
`${sliceName8}/getTokens`,
|
|
5576
5598
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5577
5599
|
const user = getCurrentUser(getState());
|
|
5578
|
-
const updatedUser =
|
|
5600
|
+
const updatedUser = {
|
|
5601
|
+
...user,
|
|
5579
5602
|
tokens
|
|
5580
|
-
}
|
|
5603
|
+
};
|
|
5581
5604
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5582
5605
|
})
|
|
5583
5606
|
);
|
|
@@ -5593,8 +5616,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5593
5616
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5594
5617
|
)
|
|
5595
5618
|
);
|
|
5596
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5597
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5619
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5598
5620
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5599
5621
|
if (persist) {
|
|
5600
5622
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5602,14 +5624,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5602
5624
|
return Promise.all(tasks);
|
|
5603
5625
|
});
|
|
5604
5626
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5605
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5627
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5606
5628
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5607
5629
|
});
|
|
5608
5630
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5609
5631
|
`${sliceName8}/submitFeedback`,
|
|
5610
5632
|
// @ts-ignore
|
|
5611
|
-
(
|
|
5612
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5633
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5613
5634
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5614
5635
|
subject: "feedback submission",
|
|
5615
5636
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5635,17 +5656,16 @@ var dateFunctionMap = {
|
|
|
5635
5656
|
setDays: "setDate"
|
|
5636
5657
|
};
|
|
5637
5658
|
var setOfflineThreshold = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
5638
|
-
var _a, _b2;
|
|
5639
5659
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
5640
5660
|
const today = /* @__PURE__ */ new Date();
|
|
5641
5661
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
5642
|
-
const setter =
|
|
5643
|
-
const getter =
|
|
5662
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
5663
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
5644
5664
|
today[setter](today[getter]() - interval);
|
|
5645
5665
|
let value;
|
|
5646
5666
|
try {
|
|
5647
5667
|
value = today.toISOString();
|
|
5648
|
-
} catch
|
|
5668
|
+
} catch {
|
|
5649
5669
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
5650
5670
|
}
|
|
5651
5671
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -5686,48 +5706,47 @@ var getLatestReleaseInfo = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/
|
|
|
5686
5706
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
5687
5707
|
return accu;
|
|
5688
5708
|
},
|
|
5689
|
-
{ latestVersions:
|
|
5709
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
5690
5710
|
);
|
|
5691
5711
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
5692
5712
|
return Promise.resolve(
|
|
5693
5713
|
dispatch(
|
|
5694
|
-
actions.setVersionInformation(
|
|
5714
|
+
actions.setVersionInformation({
|
|
5715
|
+
...latestVersions,
|
|
5695
5716
|
backend: info,
|
|
5696
5717
|
GUI: info,
|
|
5697
5718
|
latestRelease: {
|
|
5698
5719
|
releaseDate: latestRelease.release_date,
|
|
5699
5720
|
repos: latestRepos
|
|
5700
5721
|
}
|
|
5701
|
-
})
|
|
5722
|
+
})
|
|
5702
5723
|
)
|
|
5703
5724
|
);
|
|
5704
5725
|
});
|
|
5705
5726
|
});
|
|
5706
5727
|
var setSearchState = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
5707
5728
|
const currentState = getSearchState(getState());
|
|
5708
|
-
let nextState =
|
|
5709
|
-
|
|
5710
|
-
|
|
5729
|
+
let nextState = {
|
|
5730
|
+
...currentState,
|
|
5731
|
+
...searchState,
|
|
5732
|
+
sort: {
|
|
5733
|
+
...currentState.sort,
|
|
5734
|
+
...searchState.sort
|
|
5735
|
+
}
|
|
5736
|
+
};
|
|
5711
5737
|
let tasks = [];
|
|
5712
|
-
const
|
|
5713
|
-
const
|
|
5738
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
5739
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
5714
5740
|
if (nextRequestState.searchTerm && !(0, import_helpers12.deepCompare)(currentRequestState, nextRequestState)) {
|
|
5715
5741
|
nextState.isSearching = true;
|
|
5716
5742
|
tasks.push(
|
|
5717
5743
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
5718
5744
|
const searchResult = results[results.length - 1];
|
|
5719
|
-
return dispatch(actions.setSearchState(
|
|
5745
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
5720
5746
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
5721
5747
|
);
|
|
5722
5748
|
}
|
|
5723
5749
|
tasks.push(dispatch(actions.setSearchState(nextState)));
|
|
5724
5750
|
return Promise.all(tasks);
|
|
5725
5751
|
});
|
|
5726
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5727
|
-
0 && (module.exports = {
|
|
5728
|
-
getLatestReleaseInfo,
|
|
5729
|
-
setFirstLoginAfterSignup,
|
|
5730
|
-
setOfflineThreshold,
|
|
5731
|
-
setSearchState
|
|
5732
|
-
});
|
|
5733
5752
|
//# sourceMappingURL=thunks.js.map
|