@northern.tech/store 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +183 -129
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +42 -55
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +44 -70
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +51 -68
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +563 -544
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +39 -55
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-OWHFMKTA.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-OWHFMKTA.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-NCI6JV5R.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-NCI6JV5R.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-2P4VECEE.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-2P4VECEE.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-QG4PT5WK.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-QG4PT5WK.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-X65NMDPS.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-X65NMDPS.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-BWFTQHNM.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-BWFTQHNM.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-UPMSYTWW.mjs → chunk-DIZJVB6M.mjs} +306 -291
- package/dist/{chunk-UPMSYTWW.mjs.map → chunk-DIZJVB6M.mjs.map} +1 -1
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-ENLZPHTQ.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-MQIKQKSW.mjs → chunk-IFWKT27G.mjs} +37 -33
- package/dist/{chunk-MQIKQKSW.mjs.map → chunk-IFWKT27G.mjs.map} +1 -1
- package/dist/{chunk-EM2HUGUY.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-EM2HUGUY.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-2HCZYULZ.mjs → chunk-K2NZL5V4.mjs} +3 -6
- package/dist/{chunk-2HCZYULZ.mjs.map → chunk-K2NZL5V4.mjs.map} +1 -1
- package/dist/{chunk-Y47SYXII.mjs → chunk-KJAZNKV2.mjs} +43 -52
- package/dist/{chunk-Y47SYXII.mjs.map → chunk-KJAZNKV2.mjs.map} +1 -1
- package/dist/{chunk-U6YTBIDT.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-U6YTBIDT.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-EFHEROXZ.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-EFHEROXZ.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-RWYS5MKN.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-RWYS5MKN.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-ZLRZO4EY.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-OGAMVFPS.mjs → chunk-QQBUNZHA.mjs} +2 -6
- package/dist/{chunk-OGAMVFPS.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-WS3YYLTJ.mjs → chunk-R7LXL3KJ.mjs} +14 -13
- package/dist/{chunk-WS3YYLTJ.mjs.map → chunk-R7LXL3KJ.mjs.map} +1 -1
- package/dist/{chunk-MJW4632R.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-MJW4632R.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-L4HIW3KB.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-XJNI62IP.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-XJNI62IP.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-4U4X4KAC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-4U4X4KAC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-ZZ6VIQ3U.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-ZZ6VIQ3U.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-4C6IY46N.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-4C6IY46N.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.js +1 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.js +73 -135
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +12 -12
- package/dist/constants.js +36 -153
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +14 -14
- package/dist/deploymentsSlice/constants.js +34 -59
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +68 -79
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +35 -52
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +563 -553
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +34 -58
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +71 -81
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +40 -89
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +563 -589
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +34 -45
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +41 -52
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +249 -232
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +563 -547
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.js +34 -56
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +4 -4
- package/dist/organizationSlice/index.js +45 -53
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +35 -61
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +563 -572
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +38 -64
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +37 -57
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +293 -281
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.js +73 -207
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +43 -43
- package/dist/store.js +194 -151
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.js +568 -547
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +38 -41
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +563 -702
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.js +36 -66
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +4 -4
- package/dist/usersSlice/index.js +62 -71
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +41 -66
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +563 -576
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.js +57 -93
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-ENLZPHTQ.mjs +0 -35
- package/dist/chunk-L4HIW3KB.mjs +0 -36
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-ZLRZO4EY.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -496,7 +446,7 @@ var chartTypes = {
|
|
|
496
446
|
};
|
|
497
447
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
498
448
|
var defaultReportType = "distribution";
|
|
499
|
-
var defaultReports = [
|
|
449
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
500
450
|
var locations = {};
|
|
501
451
|
var PLANS = {
|
|
502
452
|
os: {
|
|
@@ -829,7 +779,7 @@ var emptyRole = Object.freeze({
|
|
|
829
779
|
name: void 0,
|
|
830
780
|
description: "",
|
|
831
781
|
permissions: [],
|
|
832
|
-
uiPermissions: Object.freeze(
|
|
782
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
833
783
|
});
|
|
834
784
|
|
|
835
785
|
// src/deploymentsSlice/constants.ts
|
|
@@ -858,11 +808,12 @@ var deploymentStatesToSubstates = {
|
|
|
858
808
|
pending: [deploymentSubstates.pending],
|
|
859
809
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
860
810
|
};
|
|
861
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
811
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
812
|
+
...deploymentStatesToSubstates,
|
|
862
813
|
failures: [deploymentSubstates.failure],
|
|
863
814
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
864
815
|
successes: [deploymentSubstates.success]
|
|
865
|
-
}
|
|
816
|
+
};
|
|
866
817
|
var installationSubstatesMap = {
|
|
867
818
|
download: {
|
|
868
819
|
title: "download",
|
|
@@ -907,8 +858,8 @@ var DEPLOYMENT_STATES = {
|
|
|
907
858
|
var listDefaultsByState = {
|
|
908
859
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
909
860
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
910
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
911
|
-
[DEPLOYMENT_STATES.finished]:
|
|
861
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
862
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
912
863
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
913
864
|
};
|
|
914
865
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1283,7 +1234,7 @@ var uiPermissionsByArea = {
|
|
|
1283
1234
|
}
|
|
1284
1235
|
};
|
|
1285
1236
|
var permissionMapper = (permission) => permission.value;
|
|
1286
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1237
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1287
1238
|
var rolesById = Object.freeze({
|
|
1288
1239
|
[staticRolesByName.admin]: {
|
|
1289
1240
|
name: "Admin",
|
|
@@ -1291,54 +1242,59 @@ var rolesById = Object.freeze({
|
|
|
1291
1242
|
description: "Full access",
|
|
1292
1243
|
permissions: [],
|
|
1293
1244
|
// permissions refers to the values returned from the backend
|
|
1294
|
-
uiPermissions:
|
|
1245
|
+
uiPermissions: {
|
|
1246
|
+
...emptyUiPermissions,
|
|
1295
1247
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1296
1248
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1297
1249
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1298
1250
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1299
1251
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1300
|
-
}
|
|
1252
|
+
}
|
|
1301
1253
|
},
|
|
1302
1254
|
[staticRolesByName.readOnly]: {
|
|
1303
1255
|
name: "Read Access",
|
|
1304
1256
|
value: staticRolesByName.readOnly,
|
|
1305
1257
|
description: "",
|
|
1306
1258
|
permissions: [],
|
|
1307
|
-
uiPermissions:
|
|
1259
|
+
uiPermissions: {
|
|
1260
|
+
...emptyUiPermissions,
|
|
1308
1261
|
deployments: [uiPermissionsById.read.value],
|
|
1309
1262
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1310
1263
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1311
1264
|
userManagement: [uiPermissionsById.read.value]
|
|
1312
|
-
}
|
|
1265
|
+
}
|
|
1313
1266
|
},
|
|
1314
1267
|
[staticRolesByName.ci]: {
|
|
1315
1268
|
name: "Releases Manager",
|
|
1316
1269
|
value: staticRolesByName.ci,
|
|
1317
1270
|
description: "",
|
|
1318
1271
|
permissions: [],
|
|
1319
|
-
uiPermissions:
|
|
1272
|
+
uiPermissions: {
|
|
1273
|
+
...emptyUiPermissions,
|
|
1320
1274
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1321
|
-
}
|
|
1275
|
+
}
|
|
1322
1276
|
},
|
|
1323
1277
|
[staticRolesByName.deploymentsManager]: {
|
|
1324
1278
|
name: "Deployments Manager",
|
|
1325
1279
|
value: staticRolesByName.deploymentsManager,
|
|
1326
1280
|
description: "",
|
|
1327
1281
|
permissions: [],
|
|
1328
|
-
uiPermissions:
|
|
1282
|
+
uiPermissions: {
|
|
1283
|
+
...emptyUiPermissions,
|
|
1329
1284
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1330
1285
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1331
1286
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1332
|
-
}
|
|
1287
|
+
}
|
|
1333
1288
|
},
|
|
1334
1289
|
[staticRolesByName.terminalAccess]: {
|
|
1335
1290
|
name: "Troubleshooting",
|
|
1336
1291
|
value: staticRolesByName.terminalAccess,
|
|
1337
1292
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1338
1293
|
permissions: [],
|
|
1339
|
-
uiPermissions:
|
|
1294
|
+
uiPermissions: {
|
|
1295
|
+
...emptyUiPermissions,
|
|
1340
1296
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1341
|
-
}
|
|
1297
|
+
}
|
|
1342
1298
|
}
|
|
1343
1299
|
});
|
|
1344
1300
|
var serviceProviderRolesById = {
|
|
@@ -1347,22 +1303,24 @@ var serviceProviderRolesById = {
|
|
|
1347
1303
|
value: staticRolesByName.admin,
|
|
1348
1304
|
description: "Full access",
|
|
1349
1305
|
permissions: [],
|
|
1350
|
-
uiPermissions:
|
|
1306
|
+
uiPermissions: {
|
|
1307
|
+
...emptyUiPermissions,
|
|
1351
1308
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1352
1309
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1353
1310
|
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1354
|
-
}
|
|
1311
|
+
}
|
|
1355
1312
|
},
|
|
1356
1313
|
readOnly: {
|
|
1357
1314
|
name: "Read access",
|
|
1358
1315
|
value: staticRolesByName.admin,
|
|
1359
1316
|
description: "This role can see all linked organizations but cannot make any changes",
|
|
1360
1317
|
permissions: [],
|
|
1361
|
-
uiPermissions:
|
|
1318
|
+
uiPermissions: {
|
|
1319
|
+
...emptyUiPermissions,
|
|
1362
1320
|
auditlog: [uiPermissionsById.read.value],
|
|
1363
1321
|
userManagement: [uiPermissionsById.read.value],
|
|
1364
1322
|
tenantManagement: [uiPermissionsById.read.value]
|
|
1365
|
-
}
|
|
1323
|
+
}
|
|
1366
1324
|
}
|
|
1367
1325
|
};
|
|
1368
1326
|
var defaultPermissionSets = {
|
|
@@ -1375,7 +1333,9 @@ var defaultPermissionSets = {
|
|
|
1375
1333
|
},
|
|
1376
1334
|
[permissionSetIds.SuperUser]: {
|
|
1377
1335
|
name: permissionSetIds.SuperUser,
|
|
1378
|
-
result:
|
|
1336
|
+
result: {
|
|
1337
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1338
|
+
}
|
|
1379
1339
|
},
|
|
1380
1340
|
[permissionSetIds.ManageUsers]: {
|
|
1381
1341
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1460,11 +1420,12 @@ var defaultPermissionSets = {
|
|
|
1460
1420
|
};
|
|
1461
1421
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1462
1422
|
var OWN_USER_ID = "me";
|
|
1463
|
-
var rolesByName =
|
|
1423
|
+
var rolesByName = {
|
|
1424
|
+
...staticRolesByName,
|
|
1464
1425
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1465
1426
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1466
1427
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1467
|
-
}
|
|
1428
|
+
};
|
|
1468
1429
|
var twoFAStates = {
|
|
1469
1430
|
enabled: "enabled",
|
|
1470
1431
|
disabled: "disabled",
|
|
@@ -1552,7 +1513,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1552
1513
|
initialState,
|
|
1553
1514
|
reducers: {
|
|
1554
1515
|
setFeatures: (state, action) => {
|
|
1555
|
-
state.features =
|
|
1516
|
+
state.features = {
|
|
1517
|
+
...state.features,
|
|
1518
|
+
...action.payload
|
|
1519
|
+
};
|
|
1556
1520
|
},
|
|
1557
1521
|
setSnackbar: (state, { payload }) => {
|
|
1558
1522
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1577,7 +1541,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1577
1541
|
state.hostedAnnouncement = action.payload;
|
|
1578
1542
|
},
|
|
1579
1543
|
setSearchState: (state, action) => {
|
|
1580
|
-
state.searchState =
|
|
1544
|
+
state.searchState = {
|
|
1545
|
+
...state.searchState,
|
|
1546
|
+
...action.payload
|
|
1547
|
+
};
|
|
1581
1548
|
},
|
|
1582
1549
|
setOfflineThreshold: (state, action) => {
|
|
1583
1550
|
state.offlineThreshold = action.payload;
|
|
@@ -1588,20 +1555,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1588
1555
|
},
|
|
1589
1556
|
uploadProgress: (state, action) => {
|
|
1590
1557
|
const { id, progress: progress2 } = action.payload;
|
|
1591
|
-
state.uploadsById[id] =
|
|
1558
|
+
state.uploadsById[id] = {
|
|
1559
|
+
...state.uploadsById[id],
|
|
1592
1560
|
progress: progress2
|
|
1593
|
-
}
|
|
1561
|
+
};
|
|
1594
1562
|
},
|
|
1595
1563
|
cleanUpUpload: (state, action) => {
|
|
1596
|
-
|
|
1597
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1564
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1598
1565
|
state.uploadsById = remainder;
|
|
1599
1566
|
},
|
|
1600
1567
|
setVersionInformation: (state, action) => {
|
|
1601
|
-
state.versionInformation =
|
|
1568
|
+
state.versionInformation = {
|
|
1569
|
+
...state.versionInformation,
|
|
1570
|
+
...action.payload
|
|
1571
|
+
};
|
|
1602
1572
|
},
|
|
1603
1573
|
setEnvironmentData: (state, action) => {
|
|
1604
|
-
return
|
|
1574
|
+
return { ...state, ...action.payload };
|
|
1605
1575
|
}
|
|
1606
1576
|
}
|
|
1607
1577
|
});
|
|
@@ -1633,7 +1603,7 @@ var initialState2 = {
|
|
|
1633
1603
|
sourceWindow: -1
|
|
1634
1604
|
},
|
|
1635
1605
|
binaryDeltaLimits: {
|
|
1636
|
-
timeout:
|
|
1606
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1637
1607
|
sourceWindow: limitDefault,
|
|
1638
1608
|
inputWindow: limitDefault,
|
|
1639
1609
|
duplicatesWindow: limitDefault,
|
|
@@ -1643,10 +1613,10 @@ var initialState2 = {
|
|
|
1643
1613
|
deploymentDeviceLimit: 5e3,
|
|
1644
1614
|
selectedDeviceIds: [],
|
|
1645
1615
|
selectionState: {
|
|
1646
|
-
finished:
|
|
1647
|
-
inprogress:
|
|
1648
|
-
pending:
|
|
1649
|
-
scheduled:
|
|
1616
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1617
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1618
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1619
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1650
1620
|
general: {
|
|
1651
1621
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1652
1622
|
showCreationDialog: false,
|
|
@@ -1662,40 +1632,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1662
1632
|
initialState: initialState2,
|
|
1663
1633
|
reducers: {
|
|
1664
1634
|
createdDeployment: (state, action) => {
|
|
1665
|
-
state.byId[action.payload.id] =
|
|
1635
|
+
state.byId[action.payload.id] = {
|
|
1636
|
+
...deploymentPrototype,
|
|
1637
|
+
...action.payload
|
|
1638
|
+
};
|
|
1666
1639
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1667
1640
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1668
1641
|
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;
|
|
1669
1642
|
},
|
|
1670
1643
|
removedDeployment: (state, action) => {
|
|
1671
|
-
|
|
1672
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1644
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1673
1645
|
state.byId = remainder;
|
|
1674
1646
|
},
|
|
1675
1647
|
receivedDeployment: (state, action) => {
|
|
1676
|
-
state.byId[action.payload.id] =
|
|
1648
|
+
state.byId[action.payload.id] = {
|
|
1649
|
+
...state.byId[action.payload.id] || {},
|
|
1650
|
+
...action.payload
|
|
1651
|
+
};
|
|
1677
1652
|
},
|
|
1678
1653
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1679
1654
|
const { id, deviceId, log } = action.payload;
|
|
1680
|
-
const deployment =
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1655
|
+
const deployment = {
|
|
1656
|
+
...deploymentPrototype,
|
|
1657
|
+
...state.byId[id]
|
|
1658
|
+
};
|
|
1659
|
+
state.byId[id] = {
|
|
1660
|
+
...deployment,
|
|
1661
|
+
devices: {
|
|
1662
|
+
...deployment.devices,
|
|
1663
|
+
[deviceId]: {
|
|
1664
|
+
...deployment.devices[deviceId],
|
|
1684
1665
|
log
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1688
1669
|
},
|
|
1689
1670
|
receivedDeploymentDevices: (state, action) => {
|
|
1690
1671
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1691
|
-
state.byId[id] =
|
|
1672
|
+
state.byId[id] = {
|
|
1673
|
+
...state.byId[id],
|
|
1692
1674
|
devices,
|
|
1693
1675
|
totalDeviceCount
|
|
1694
|
-
}
|
|
1676
|
+
};
|
|
1695
1677
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1696
1678
|
},
|
|
1697
1679
|
receivedDeployments: (state, action) => {
|
|
1698
|
-
state.byId =
|
|
1680
|
+
state.byId = {
|
|
1681
|
+
...state.byId,
|
|
1682
|
+
...action.payload
|
|
1683
|
+
};
|
|
1699
1684
|
},
|
|
1700
1685
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1701
1686
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1737,9 +1722,9 @@ var initialState3 = {
|
|
|
1737
1722
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1738
1723
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1739
1724
|
},
|
|
1740
|
-
deviceList:
|
|
1741
|
-
deviceIds: []
|
|
1742
|
-
|
|
1725
|
+
deviceList: {
|
|
1726
|
+
deviceIds: [],
|
|
1727
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1743
1728
|
selectedAttributes: [],
|
|
1744
1729
|
selectedIssues: [],
|
|
1745
1730
|
selection: [],
|
|
@@ -1750,7 +1735,7 @@ var initialState3 = {
|
|
|
1750
1735
|
},
|
|
1751
1736
|
state: DEVICE_STATES.accepted,
|
|
1752
1737
|
total: 0
|
|
1753
|
-
}
|
|
1738
|
+
},
|
|
1754
1739
|
filters: [
|
|
1755
1740
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1756
1741
|
],
|
|
@@ -1785,49 +1770,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1785
1770
|
},
|
|
1786
1771
|
addToGroup: (state, action) => {
|
|
1787
1772
|
const { group, deviceIds } = action.payload;
|
|
1788
|
-
const maybeExistingGroup =
|
|
1773
|
+
const maybeExistingGroup = {
|
|
1789
1774
|
filters: [],
|
|
1790
|
-
deviceIds: []
|
|
1791
|
-
|
|
1792
|
-
|
|
1775
|
+
deviceIds: [],
|
|
1776
|
+
...state.groups.byId[group]
|
|
1777
|
+
};
|
|
1778
|
+
state.groups.byId[group] = {
|
|
1779
|
+
...maybeExistingGroup,
|
|
1793
1780
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1794
1781
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1795
|
-
}
|
|
1782
|
+
};
|
|
1796
1783
|
},
|
|
1797
1784
|
removeFromGroup: (state, action) => {
|
|
1798
1785
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1799
|
-
const
|
|
1800
|
-
const changedGroup =
|
|
1786
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1787
|
+
const changedGroup = {
|
|
1788
|
+
...maybeExistingGroup,
|
|
1801
1789
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1802
1790
|
total: Math.max(total - removedIds.length, 0)
|
|
1803
|
-
}
|
|
1791
|
+
};
|
|
1804
1792
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1805
1793
|
state.groups.byId[group] = changedGroup;
|
|
1806
1794
|
return;
|
|
1807
1795
|
} else if (state.groups.selectedGroup === group) {
|
|
1808
1796
|
state.groups.selectedGroup = void 0;
|
|
1809
1797
|
}
|
|
1810
|
-
const
|
|
1798
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1811
1799
|
state.groups.byId = remainingById;
|
|
1812
1800
|
},
|
|
1813
1801
|
addGroup: (state, action) => {
|
|
1814
1802
|
const { groupName, group } = action.payload;
|
|
1815
|
-
state.groups.byId[groupName] =
|
|
1803
|
+
state.groups.byId[groupName] = {
|
|
1804
|
+
...state.groups.byId[groupName],
|
|
1805
|
+
...group
|
|
1806
|
+
};
|
|
1816
1807
|
},
|
|
1817
1808
|
selectGroup: (state, { payload: group }) => {
|
|
1818
1809
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1819
1810
|
state.groups.selectedGroup = group;
|
|
1820
1811
|
},
|
|
1821
1812
|
removeGroup: (state, action) => {
|
|
1822
|
-
|
|
1823
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1813
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1824
1814
|
state.groups.byId = remainingById;
|
|
1825
1815
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1826
1816
|
},
|
|
1827
1817
|
setDeviceListState: (state, action) => {
|
|
1828
|
-
state.deviceList =
|
|
1829
|
-
|
|
1830
|
-
|
|
1818
|
+
state.deviceList = {
|
|
1819
|
+
...state.deviceList,
|
|
1820
|
+
...action.payload,
|
|
1821
|
+
sort: {
|
|
1822
|
+
...state.deviceList.sort,
|
|
1823
|
+
...action.payload.sort
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1831
1826
|
},
|
|
1832
1827
|
setFilterAttributes: (state, action) => {
|
|
1833
1828
|
state.filteringAttributes = action.payload;
|
|
@@ -1836,7 +1831,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1836
1831
|
state.filteringAttributesConfig = action.payload;
|
|
1837
1832
|
},
|
|
1838
1833
|
receivedDevices: (state, action) => {
|
|
1839
|
-
state.byId =
|
|
1834
|
+
state.byId = {
|
|
1835
|
+
...state.byId,
|
|
1836
|
+
...action.payload
|
|
1837
|
+
};
|
|
1840
1838
|
},
|
|
1841
1839
|
setDeviceFilters: (state, action) => {
|
|
1842
1840
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1867,7 +1865,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1867
1865
|
state.limit = action.payload;
|
|
1868
1866
|
},
|
|
1869
1867
|
receivedDevice: (state, action) => {
|
|
1870
|
-
state.byId[action.payload.id] =
|
|
1868
|
+
state.byId[action.payload.id] = {
|
|
1869
|
+
...state.byId[action.payload.id],
|
|
1870
|
+
...action.payload
|
|
1871
|
+
};
|
|
1871
1872
|
},
|
|
1872
1873
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1873
1874
|
const { deviceId, authId } = action.payload;
|
|
@@ -1888,15 +1889,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1888
1889
|
var sliceName4 = "monitor";
|
|
1889
1890
|
var initialState4 = {
|
|
1890
1891
|
alerts: {
|
|
1891
|
-
alertList:
|
|
1892
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1892
1893
|
byDeviceId: {}
|
|
1893
1894
|
},
|
|
1894
1895
|
issueCounts: {
|
|
1895
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1896
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1896
1897
|
},
|
|
1897
1898
|
settings: {
|
|
1898
1899
|
global: {
|
|
1899
|
-
channels:
|
|
1900
|
+
channels: {
|
|
1901
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1902
|
+
}
|
|
1900
1903
|
}
|
|
1901
1904
|
}
|
|
1902
1905
|
};
|
|
@@ -1914,14 +1917,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1914
1917
|
},
|
|
1915
1918
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1916
1919
|
const { deviceId, alerts } = action.payload;
|
|
1917
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1920
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1918
1921
|
},
|
|
1919
1922
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1920
1923
|
const { issueType, counts } = action.payload;
|
|
1921
1924
|
state.issueCounts.byType[issueType] = counts;
|
|
1922
1925
|
},
|
|
1923
1926
|
setAlertListState: (state, action) => {
|
|
1924
|
-
state.alerts.alertList =
|
|
1927
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1925
1928
|
}
|
|
1926
1929
|
}
|
|
1927
1930
|
});
|
|
@@ -1945,7 +1948,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1945
1948
|
initialState: initialState5,
|
|
1946
1949
|
reducers: {
|
|
1947
1950
|
setOnboardingState: (state, action) => {
|
|
1948
|
-
return
|
|
1951
|
+
return { ...state, ...action.payload };
|
|
1949
1952
|
},
|
|
1950
1953
|
setDemoArtifactPort: (state, action) => {
|
|
1951
1954
|
state.demoArtifactPort = action.payload;
|
|
@@ -1983,7 +1986,8 @@ var initialState6 = {
|
|
|
1983
1986
|
brand: ""
|
|
1984
1987
|
},
|
|
1985
1988
|
intentId: null,
|
|
1986
|
-
tenantList:
|
|
1989
|
+
tenantList: {
|
|
1990
|
+
...TENANT_LIST_DEFAULT,
|
|
1987
1991
|
total: 0,
|
|
1988
1992
|
tenants: [],
|
|
1989
1993
|
selectedTenant: null,
|
|
@@ -1991,13 +1995,14 @@ var initialState6 = {
|
|
|
1991
1995
|
direction: SORTING_OPTIONS.desc,
|
|
1992
1996
|
key: "name"
|
|
1993
1997
|
}
|
|
1994
|
-
}
|
|
1998
|
+
},
|
|
1995
1999
|
organization: {
|
|
1996
2000
|
// id, name, status, tenant_token, plan
|
|
1997
2001
|
},
|
|
1998
2002
|
auditlog: {
|
|
1999
2003
|
events: [],
|
|
2000
|
-
selectionState:
|
|
2004
|
+
selectionState: {
|
|
2005
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2001
2006
|
detail: void 0,
|
|
2002
2007
|
endDate: void 0,
|
|
2003
2008
|
selectedIssue: void 0,
|
|
@@ -2006,7 +2011,7 @@ var initialState6 = {
|
|
|
2006
2011
|
total: 0,
|
|
2007
2012
|
type: void 0,
|
|
2008
2013
|
user: void 0
|
|
2009
|
-
}
|
|
2014
|
+
}
|
|
2010
2015
|
},
|
|
2011
2016
|
externalDeviceIntegrations: [
|
|
2012
2017
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2029,7 +2034,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2029
2034
|
state.auditlog.selectionState.total = total;
|
|
2030
2035
|
},
|
|
2031
2036
|
setAuditLogState: (state, action) => {
|
|
2032
|
-
state.auditlog.selectionState =
|
|
2037
|
+
state.auditlog.selectionState = {
|
|
2038
|
+
...state.auditlog.selectionState,
|
|
2039
|
+
...action.payload
|
|
2040
|
+
};
|
|
2033
2041
|
},
|
|
2034
2042
|
receiveCurrentCard: (state, action) => {
|
|
2035
2043
|
state.card = action.payload;
|
|
@@ -2038,7 +2046,7 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2038
2046
|
state.intentId = action.payload;
|
|
2039
2047
|
},
|
|
2040
2048
|
setOrganization: (state, action) => {
|
|
2041
|
-
state.organization =
|
|
2049
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2042
2050
|
},
|
|
2043
2051
|
setTenantListState: (state, action) => {
|
|
2044
2052
|
state.tenantList = action.payload;
|
|
@@ -2101,7 +2109,8 @@ var initialState7 = {
|
|
|
2101
2109
|
}
|
|
2102
2110
|
*/
|
|
2103
2111
|
},
|
|
2104
|
-
releasesList:
|
|
2112
|
+
releasesList: {
|
|
2113
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2105
2114
|
searchedIds: [],
|
|
2106
2115
|
releaseIds: [],
|
|
2107
2116
|
selection: [],
|
|
@@ -2115,7 +2124,7 @@ var initialState7 = {
|
|
|
2115
2124
|
selectedTags: [],
|
|
2116
2125
|
total: 0,
|
|
2117
2126
|
type: ""
|
|
2118
|
-
}
|
|
2127
|
+
},
|
|
2119
2128
|
tags: [],
|
|
2120
2129
|
updateTypes: [],
|
|
2121
2130
|
/*
|
|
@@ -2141,8 +2150,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2141
2150
|
state.updateTypes = action.payload;
|
|
2142
2151
|
},
|
|
2143
2152
|
removeRelease: (state, action) => {
|
|
2144
|
-
|
|
2145
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2153
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2146
2154
|
state.byId = byId;
|
|
2147
2155
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2148
2156
|
},
|
|
@@ -2175,8 +2183,12 @@ var initialState8 = {
|
|
|
2175
2183
|
previousPhases: [],
|
|
2176
2184
|
retries: 0
|
|
2177
2185
|
},
|
|
2178
|
-
permissionSetsById:
|
|
2179
|
-
|
|
2186
|
+
permissionSetsById: {
|
|
2187
|
+
...defaultPermissionSets
|
|
2188
|
+
},
|
|
2189
|
+
rolesById: {
|
|
2190
|
+
...rolesById
|
|
2191
|
+
},
|
|
2180
2192
|
settingsInitialized: false,
|
|
2181
2193
|
showConnectDeviceDialog: false,
|
|
2182
2194
|
showFeedbackDialog: false,
|
|
@@ -2216,13 +2228,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2216
2228
|
state.byId[0] = action.payload;
|
|
2217
2229
|
},
|
|
2218
2230
|
removedUser: (state, action) => {
|
|
2219
|
-
|
|
2220
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2231
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2221
2232
|
state.byId = byId;
|
|
2222
2233
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2223
2234
|
},
|
|
2224
2235
|
updatedUser: (state, action) => {
|
|
2225
|
-
state.byId[action.payload.id] =
|
|
2236
|
+
state.byId[action.payload.id] = {
|
|
2237
|
+
...state.byId[action.payload.id],
|
|
2238
|
+
...action.payload
|
|
2239
|
+
};
|
|
2226
2240
|
},
|
|
2227
2241
|
receivedPermissionSets: (state, action) => {
|
|
2228
2242
|
state.permissionSetsById = action.payload;
|
|
@@ -2231,11 +2245,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2231
2245
|
state.rolesById = action.payload;
|
|
2232
2246
|
},
|
|
2233
2247
|
createdRole: (state, action) => {
|
|
2234
|
-
state.rolesById[action.payload.name] =
|
|
2248
|
+
state.rolesById[action.payload.name] = {
|
|
2249
|
+
...state.rolesById[action.payload.name],
|
|
2250
|
+
...action.payload
|
|
2251
|
+
};
|
|
2235
2252
|
},
|
|
2236
2253
|
removedRole: (state, action) => {
|
|
2237
|
-
|
|
2238
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2254
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2239
2255
|
state.rolesById = rolesById2;
|
|
2240
2256
|
},
|
|
2241
2257
|
setCustomColumns: (state, action) => {
|
|
@@ -2243,18 +2259,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2243
2259
|
},
|
|
2244
2260
|
setGlobalSettings: (state, action) => {
|
|
2245
2261
|
state.settingsInitialized = true;
|
|
2246
|
-
state.globalSettings =
|
|
2262
|
+
state.globalSettings = {
|
|
2263
|
+
...state.globalSettings,
|
|
2264
|
+
...action.payload
|
|
2265
|
+
};
|
|
2247
2266
|
},
|
|
2248
2267
|
setUserSettings: (state, action) => {
|
|
2249
2268
|
state.userSettingsInitialized = true;
|
|
2250
|
-
state.userSettings =
|
|
2269
|
+
state.userSettings = {
|
|
2270
|
+
...state.userSettings,
|
|
2271
|
+
...action.payload
|
|
2272
|
+
};
|
|
2251
2273
|
},
|
|
2252
2274
|
setTooltipState: (state, action) => {
|
|
2253
2275
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2254
2276
|
state.tooltips.byId[id].readState = readState;
|
|
2255
2277
|
},
|
|
2256
2278
|
setTooltipsState: (state, action) => {
|
|
2257
|
-
state.tooltips.byId =
|
|
2279
|
+
state.tooltips.byId = {
|
|
2280
|
+
...state.tooltips.byId,
|
|
2281
|
+
...action.payload
|
|
2282
|
+
};
|
|
2258
2283
|
},
|
|
2259
2284
|
setShowFeedbackDialog: (state, action) => {
|
|
2260
2285
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2271,7 +2296,16 @@ var actions8 = usersSlice.actions;
|
|
|
2271
2296
|
var usersSlice_default = usersSlice.reducer;
|
|
2272
2297
|
|
|
2273
2298
|
// src/actions.ts
|
|
2274
|
-
var actions_default =
|
|
2299
|
+
var actions_default = {
|
|
2300
|
+
...actions,
|
|
2301
|
+
...actions2,
|
|
2302
|
+
...actions3,
|
|
2303
|
+
...actions4,
|
|
2304
|
+
...actions5,
|
|
2305
|
+
...actions6,
|
|
2306
|
+
...actions7,
|
|
2307
|
+
...actions8
|
|
2308
|
+
};
|
|
2275
2309
|
|
|
2276
2310
|
// src/api/general-api.ts
|
|
2277
2311
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2282,18 +2316,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2282
2316
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2283
2317
|
var tokenCache = "";
|
|
2284
2318
|
var getSessionInfo = () => {
|
|
2285
|
-
|
|
2286
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2319
|
+
let sessionInfo = { ...emptySession };
|
|
2287
2320
|
try {
|
|
2288
|
-
sessionInfo = JSON.parse(
|
|
2289
|
-
} catch
|
|
2321
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2322
|
+
} catch {
|
|
2290
2323
|
}
|
|
2291
2324
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2292
2325
|
cleanUp();
|
|
2293
|
-
return
|
|
2326
|
+
return { ...emptySession };
|
|
2294
2327
|
}
|
|
2295
2328
|
if (!sessionInfo.token) {
|
|
2296
|
-
let jwtTokenFromCookie =
|
|
2329
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2297
2330
|
if (jwtTokenFromCookie) {
|
|
2298
2331
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2299
2332
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2321,8 +2354,7 @@ var maxSessionAge = 900;
|
|
|
2321
2354
|
|
|
2322
2355
|
// src/api/general-api.ts
|
|
2323
2356
|
var unauthorizedRedirect = (error) => {
|
|
2324
|
-
|
|
2325
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2357
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2326
2358
|
cleanUp();
|
|
2327
2359
|
window.location.replace("/ui/");
|
|
2328
2360
|
}
|
|
@@ -2332,7 +2364,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2332
2364
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2333
2365
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2334
2366
|
authenticatedRequest.interceptors.request.use(
|
|
2335
|
-
(config) =>
|
|
2367
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2336
2368
|
(error) => Promise.reject(error)
|
|
2337
2369
|
);
|
|
2338
2370
|
var Api = {
|
|
@@ -2340,7 +2372,7 @@ var Api = {
|
|
|
2340
2372
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2341
2373
|
patch: authenticatedRequest.patch,
|
|
2342
2374
|
post: authenticatedRequest.post,
|
|
2343
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2375
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2344
2376
|
put: authenticatedRequest.put,
|
|
2345
2377
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2346
2378
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2360,19 +2392,13 @@ var general_api_default = Api;
|
|
|
2360
2392
|
// src/api/users-api.ts
|
|
2361
2393
|
var import_axios2 = __toESM(require("axios"));
|
|
2362
2394
|
var Api2 = {
|
|
2363
|
-
postLogin: (url,
|
|
2364
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
2365
|
-
return import_axios2.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
2366
|
-
var _a2;
|
|
2367
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
2368
|
-
});
|
|
2369
|
-
},
|
|
2395
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios2.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
2370
2396
|
putVerifyTFA: (url, userData) => {
|
|
2371
2397
|
let body = {};
|
|
2372
2398
|
if (userData.hasOwnProperty("token2fa")) {
|
|
2373
2399
|
body = { token2fa: userData.token2fa };
|
|
2374
2400
|
}
|
|
2375
|
-
return import_axios2.default.put(url, body,
|
|
2401
|
+
return import_axios2.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
2376
2402
|
}
|
|
2377
2403
|
};
|
|
2378
2404
|
var users_api_default = Api2;
|
|
@@ -2391,10 +2417,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2391
2417
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2392
2418
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2393
2419
|
[getFullVersionInformation, getFeatures],
|
|
2394
|
-
(
|
|
2395
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2396
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2397
|
-
}
|
|
2420
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2398
2421
|
);
|
|
2399
2422
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2400
2423
|
|
|
@@ -2411,8 +2434,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2411
2434
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2412
2435
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2413
2436
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2414
|
-
|
|
2415
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2437
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2416
2438
|
return selection.reduce((accu, id) => {
|
|
2417
2439
|
if (deploymentsById[id]) {
|
|
2418
2440
|
accu.push(deploymentsById[id]);
|
|
@@ -2456,7 +2478,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2456
2478
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2457
2479
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2458
2480
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2459
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2481
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2482
|
+
...filteringAttributes,
|
|
2460
2483
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2461
2484
|
}));
|
|
2462
2485
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2484,10 +2507,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2484
2507
|
return accu;
|
|
2485
2508
|
}, {})
|
|
2486
2509
|
);
|
|
2487
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2488
|
-
var _a;
|
|
2489
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2490
|
-
});
|
|
2510
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2491
2511
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2492
2512
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2493
2513
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2504,17 +2524,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2504
2524
|
[getAcceptedDevices, getDeviceLimit],
|
|
2505
2525
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2506
2526
|
);
|
|
2507
|
-
var
|
|
2508
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2509
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2510
|
-
return groups;
|
|
2511
|
-
});
|
|
2527
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2512
2528
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2513
2529
|
const groupNames = Object.keys(groupsById).sort();
|
|
2514
2530
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2515
2531
|
(accu, [groupname, group]) => {
|
|
2516
2532
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2517
|
-
const groupItem =
|
|
2533
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2518
2534
|
if (group.filters.length > 0) {
|
|
2519
2535
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2520
2536
|
accu.dynamic.push(groupItem);
|
|
@@ -2528,7 +2544,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2528
2544
|
},
|
|
2529
2545
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2530
2546
|
);
|
|
2531
|
-
return
|
|
2547
|
+
return { groupNames, ...groupedGroups };
|
|
2532
2548
|
});
|
|
2533
2549
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2534
2550
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2568,10 +2584,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
2568
2584
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2569
2585
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2570
2586
|
[getExternalIntegrations],
|
|
2571
|
-
(integrations) => integrations.filter((integration) =>
|
|
2572
|
-
var _a;
|
|
2573
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2574
|
-
})
|
|
2587
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2575
2588
|
);
|
|
2576
2589
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2577
2590
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2605,15 +2618,12 @@ var filterProcessors = {
|
|
|
2605
2618
|
var filterAliases = {
|
|
2606
2619
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2607
2620
|
};
|
|
2608
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2615
|
-
};
|
|
2616
|
-
});
|
|
2621
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2622
|
+
scope: filter.scope,
|
|
2623
|
+
attribute: filter.key,
|
|
2624
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2625
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2626
|
+
}));
|
|
2617
2627
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2618
2628
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2619
2629
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2623,14 +2633,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2623
2633
|
});
|
|
2624
2634
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2625
2635
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2626
|
-
return
|
|
2636
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2627
2637
|
}
|
|
2628
2638
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2629
2639
|
});
|
|
2630
2640
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2631
|
-
var _a;
|
|
2632
2641
|
let applicableFilters = [...filters];
|
|
2633
|
-
if (typeof group === "string" && !(
|
|
2642
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2634
2643
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2635
2644
|
}
|
|
2636
2645
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2651,12 +2660,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2651
2660
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2652
2661
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2653
2662
|
if (id && byId[id]) {
|
|
2654
|
-
accu.push(
|
|
2663
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2655
2664
|
}
|
|
2656
2665
|
return accu;
|
|
2657
2666
|
}, []);
|
|
2658
2667
|
};
|
|
2659
|
-
var mergePermissions = (existingPermissions =
|
|
2668
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2660
2669
|
(accu, [key, value]) => {
|
|
2661
2670
|
let values;
|
|
2662
2671
|
if (!accu[key]) {
|
|
@@ -2666,12 +2675,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2666
2675
|
if (Array.isArray(value)) {
|
|
2667
2676
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2668
2677
|
} else {
|
|
2669
|
-
values = mergePermissions(accu[key],
|
|
2678
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2670
2679
|
}
|
|
2671
2680
|
accu[key] = values;
|
|
2672
2681
|
return accu;
|
|
2673
2682
|
},
|
|
2674
|
-
|
|
2683
|
+
{ ...addedPermissions }
|
|
2675
2684
|
);
|
|
2676
2685
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2677
2686
|
(accu, roleId) => {
|
|
@@ -2680,20 +2689,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2680
2689
|
}
|
|
2681
2690
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2682
2691
|
},
|
|
2683
|
-
|
|
2692
|
+
{ ...emptyUiPermissions }
|
|
2684
2693
|
);
|
|
2685
2694
|
var progress = ({ loaded, total }) => {
|
|
2686
2695
|
let uploadProgress4 = loaded / total * 100;
|
|
2687
2696
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2688
2697
|
};
|
|
2689
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2690
|
-
var _a, _b2, _c, _d, _e;
|
|
2691
|
-
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;
|
|
2692
|
-
};
|
|
2698
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2693
2699
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2694
2700
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2695
2701
|
try {
|
|
2696
|
-
if (
|
|
2702
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2697
2703
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2698
2704
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2699
2705
|
}
|
|
@@ -2708,9 +2714,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2708
2714
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2709
2715
|
return accu;
|
|
2710
2716
|
}
|
|
2711
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2717
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2718
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2712
2719
|
[attribute.name]: attribute.value
|
|
2713
|
-
}
|
|
2720
|
+
};
|
|
2714
2721
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2715
2722
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2716
2723
|
}
|
|
@@ -2729,15 +2736,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2729
2736
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2730
2737
|
var getReleaseMappingDefaults = () => ({});
|
|
2731
2738
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2732
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2739
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2733
2740
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2734
2741
|
[getReleaseListState, getReleasesById],
|
|
2735
2742
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2736
2743
|
);
|
|
2737
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2738
|
-
var _a;
|
|
2739
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2740
|
-
});
|
|
2744
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2741
2745
|
|
|
2742
2746
|
// src/usersSlice/selectors.ts
|
|
2743
2747
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2746,10 +2750,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2746
2750
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2747
2751
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2748
2752
|
var getUsersById = (state) => state.users.byId;
|
|
2749
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2750
|
-
var _a;
|
|
2751
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2752
|
-
});
|
|
2753
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2753
2754
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2754
2755
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2755
2756
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2760,22 +2761,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2760
2761
|
[getTooltipsById, getUserSettings],
|
|
2761
2762
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2762
2763
|
(accu, [id, value]) => {
|
|
2763
|
-
accu[id] =
|
|
2764
|
+
accu[id] = { ...accu[id], ...value };
|
|
2764
2765
|
return accu;
|
|
2765
2766
|
},
|
|
2766
|
-
|
|
2767
|
+
{ ...tooltips }
|
|
2767
2768
|
)
|
|
2768
2769
|
);
|
|
2769
2770
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2770
2771
|
[getCurrentUser],
|
|
2771
2772
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2772
2773
|
);
|
|
2773
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2774
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2774
2775
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2775
|
-
interval:
|
|
2776
|
-
intervalUnit:
|
|
2776
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2777
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2777
2778
|
}));
|
|
2778
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2779
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2779
2780
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2780
2781
|
|
|
2781
2782
|
// src/commonSelectors.ts
|
|
@@ -2794,8 +2795,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2794
2795
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2795
2796
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2796
2797
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2797
|
-
|
|
2798
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2798
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2799
2799
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2800
2800
|
return { isAdmin, uiPermissions };
|
|
2801
2801
|
}
|
|
@@ -2864,10 +2864,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2864
2864
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2865
2865
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2866
2866
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2867
|
-
const updateAttribute =
|
|
2867
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2868
2868
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2869
2869
|
const attributes = [
|
|
2870
|
-
...previousFilters.map((item) =>
|
|
2870
|
+
...previousFilters.map((item) => ({
|
|
2871
|
+
...item,
|
|
2871
2872
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2872
2873
|
category: "recently used",
|
|
2873
2874
|
priority: 0
|
|
@@ -2885,14 +2886,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2885
2886
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2886
2887
|
}
|
|
2887
2888
|
);
|
|
2888
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
});
|
|
2889
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2890
|
+
...remainder,
|
|
2891
|
+
...onboarding,
|
|
2892
|
+
complete: onboarding.complete || complete,
|
|
2893
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2894
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2895
|
+
}));
|
|
2896
2896
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2897
2897
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2898
2898
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2913,12 +2913,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2913
2913
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2914
2914
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2915
2915
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2916
|
-
|
|
2917
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2916
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2918
2917
|
const { devices = {} } = deployment;
|
|
2919
2918
|
return {
|
|
2920
2919
|
deployment,
|
|
2921
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2920
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2922
2921
|
};
|
|
2923
2922
|
}
|
|
2924
2923
|
);
|
|
@@ -2933,8 +2932,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2933
2932
|
}, {})
|
|
2934
2933
|
);
|
|
2935
2934
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2936
|
-
|
|
2937
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2935
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2938
2936
|
if (staticOnly) {
|
|
2939
2937
|
return Object.keys(uiPermissions.groups).sort();
|
|
2940
2938
|
}
|
|
@@ -2968,9 +2966,9 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2968
2966
|
if (auditlogEvent) {
|
|
2969
2967
|
const { object = {} } = auditlogEvent;
|
|
2970
2968
|
const { device = {}, id, type } = object;
|
|
2971
|
-
auditlogDevice = type === "device" ?
|
|
2969
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2972
2970
|
}
|
|
2973
|
-
return
|
|
2971
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2974
2972
|
});
|
|
2975
2973
|
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2976
2974
|
if (service_provider) {
|
|
@@ -3022,8 +3020,9 @@ var sessionReducer = (state, action) => {
|
|
|
3022
3020
|
return rootReducer(state, action);
|
|
3023
3021
|
};
|
|
3024
3022
|
var getConfiguredStore = (options = {}) => {
|
|
3025
|
-
const
|
|
3026
|
-
return (0, import_toolkit16.configureStore)(
|
|
3023
|
+
const { preloadedState = {}, ...config } = options;
|
|
3024
|
+
return (0, import_toolkit16.configureStore)({
|
|
3025
|
+
...config,
|
|
3027
3026
|
preloadedState,
|
|
3028
3027
|
reducer: sessionReducer,
|
|
3029
3028
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -3036,7 +3035,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
3036
3035
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
3037
3036
|
}
|
|
3038
3037
|
})
|
|
3039
|
-
})
|
|
3038
|
+
});
|
|
3040
3039
|
};
|
|
3041
3040
|
var store = getConfiguredStore({
|
|
3042
3041
|
preloadedState: {}
|
|
@@ -3056,17 +3055,16 @@ var dateFunctionMap = {
|
|
|
3056
3055
|
setDays: "setDate"
|
|
3057
3056
|
};
|
|
3058
3057
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
3059
|
-
var _a, _b2;
|
|
3060
3058
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
3061
3059
|
const today = /* @__PURE__ */ new Date();
|
|
3062
3060
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
3063
|
-
const setter =
|
|
3064
|
-
const getter =
|
|
3061
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3062
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
3065
3063
|
today[setter](today[getter]() - interval);
|
|
3066
3064
|
let value;
|
|
3067
3065
|
try {
|
|
3068
3066
|
value = today.toISOString();
|
|
3069
|
-
} catch
|
|
3067
|
+
} catch {
|
|
3070
3068
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
3071
3069
|
}
|
|
3072
3070
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3107,37 +3105,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3107
3105
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3108
3106
|
return accu;
|
|
3109
3107
|
},
|
|
3110
|
-
{ latestVersions:
|
|
3108
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3111
3109
|
);
|
|
3112
3110
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3113
3111
|
return Promise.resolve(
|
|
3114
3112
|
dispatch(
|
|
3115
|
-
actions.setVersionInformation(
|
|
3113
|
+
actions.setVersionInformation({
|
|
3114
|
+
...latestVersions,
|
|
3116
3115
|
backend: info,
|
|
3117
3116
|
GUI: info,
|
|
3118
3117
|
latestRelease: {
|
|
3119
3118
|
releaseDate: latestRelease.release_date,
|
|
3120
3119
|
repos: latestRepos
|
|
3121
3120
|
}
|
|
3122
|
-
})
|
|
3121
|
+
})
|
|
3123
3122
|
)
|
|
3124
3123
|
);
|
|
3125
3124
|
});
|
|
3126
3125
|
});
|
|
3127
3126
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3128
3127
|
const currentState = getSearchState(getState());
|
|
3129
|
-
let nextState =
|
|
3130
|
-
|
|
3131
|
-
|
|
3128
|
+
let nextState = {
|
|
3129
|
+
...currentState,
|
|
3130
|
+
...searchState,
|
|
3131
|
+
sort: {
|
|
3132
|
+
...currentState.sort,
|
|
3133
|
+
...searchState.sort
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3132
3136
|
let tasks = [];
|
|
3133
|
-
const
|
|
3134
|
-
const
|
|
3137
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3138
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3135
3139
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3136
3140
|
nextState.isSearching = true;
|
|
3137
3141
|
tasks.push(
|
|
3138
3142
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3139
3143
|
const searchResult = results[results.length - 1];
|
|
3140
|
-
return dispatch(actions.setSearchState(
|
|
3144
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3141
3145
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3142
3146
|
);
|
|
3143
3147
|
}
|
|
@@ -3154,13 +3158,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3154
3158
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3155
3159
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3156
3160
|
(accu, item) => {
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
+
const filter = item.filter ?? {};
|
|
3162
|
+
let deployment = {
|
|
3163
|
+
...deploymentPrototype,
|
|
3164
|
+
...deploymentsById[item.id],
|
|
3165
|
+
...item,
|
|
3166
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3161
3167
|
name: decodeURIComponent(item.name)
|
|
3162
|
-
}
|
|
3163
|
-
deployment =
|
|
3168
|
+
};
|
|
3169
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3164
3170
|
accu.deployments[item.id] = deployment;
|
|
3165
3171
|
accu.deploymentIds.push(item.id);
|
|
3166
3172
|
return accu;
|
|
@@ -3214,11 +3220,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3214
3220
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3215
3221
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3216
3222
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3217
|
-
const deployment =
|
|
3223
|
+
const deployment = {
|
|
3224
|
+
...newDeployment,
|
|
3218
3225
|
id: deploymentId,
|
|
3219
3226
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3220
3227
|
statistics: { status: {} }
|
|
3221
|
-
}
|
|
3228
|
+
};
|
|
3222
3229
|
let tasks = [
|
|
3223
3230
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3224
3231
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3361,14 +3368,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3361
3368
|
({ 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))))
|
|
3362
3369
|
);
|
|
3363
3370
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3364
|
-
const
|
|
3371
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3365
3372
|
const currentState = getState().deployments.selectionState;
|
|
3366
|
-
let nextState =
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3373
|
+
let nextState = {
|
|
3374
|
+
...currentState,
|
|
3375
|
+
...selectionState,
|
|
3376
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3377
|
+
accu[item] = {
|
|
3378
|
+
...currentState[item],
|
|
3379
|
+
...selectionState[item]
|
|
3380
|
+
};
|
|
3381
|
+
return accu;
|
|
3382
|
+
}, {}),
|
|
3383
|
+
general: {
|
|
3384
|
+
...currentState.general,
|
|
3385
|
+
...selectionState.general
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3372
3388
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3373
3389
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3374
3390
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3398,15 +3414,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3398
3414
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3399
3415
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3400
3416
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3401
|
-
const config =
|
|
3417
|
+
const config = {
|
|
3418
|
+
...oldConfig,
|
|
3402
3419
|
hasDelta: Boolean(delta.enabled),
|
|
3403
|
-
binaryDelta:
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3420
|
+
binaryDelta: {
|
|
3421
|
+
...oldConfig.binaryDelta,
|
|
3422
|
+
timeout: timeoutConfig,
|
|
3423
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3424
|
+
},
|
|
3425
|
+
binaryDeltaLimits: {
|
|
3426
|
+
...oldConfig.binaryDeltaLimits,
|
|
3427
|
+
timeout: timeoutLimit,
|
|
3428
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3410
3431
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3411
3432
|
})
|
|
3412
3433
|
);
|
|
@@ -3416,7 +3437,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3416
3437
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3417
3438
|
return accu;
|
|
3418
3439
|
}
|
|
3419
|
-
accu =
|
|
3440
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3420
3441
|
}
|
|
3421
3442
|
return accu;
|
|
3422
3443
|
}, void 0);
|
|
@@ -3436,9 +3457,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3436
3457
|
}
|
|
3437
3458
|
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(() => {
|
|
3438
3459
|
const oldConfig = getState().deployments.config;
|
|
3439
|
-
const newConfig =
|
|
3440
|
-
|
|
3441
|
-
|
|
3460
|
+
const newConfig = {
|
|
3461
|
+
...oldConfig,
|
|
3462
|
+
binaryDelta: {
|
|
3463
|
+
...oldConfig.binaryDelta,
|
|
3464
|
+
...config
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3442
3467
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3443
3468
|
});
|
|
3444
3469
|
});
|
|
@@ -3451,19 +3476,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3451
3476
|
var import_axios3 = require("axios");
|
|
3452
3477
|
var import_pluralize = __toESM(require_pluralize());
|
|
3453
3478
|
|
|
3454
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3455
|
-
var
|
|
3456
|
-
var
|
|
3457
|
-
var poolPtr = rnds8Pool.length;
|
|
3479
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3480
|
+
var getRandomValues;
|
|
3481
|
+
var rnds8 = new Uint8Array(16);
|
|
3458
3482
|
function rng() {
|
|
3459
|
-
if (
|
|
3460
|
-
|
|
3461
|
-
|
|
3483
|
+
if (!getRandomValues) {
|
|
3484
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3485
|
+
if (!getRandomValues) {
|
|
3486
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3487
|
+
}
|
|
3462
3488
|
}
|
|
3463
|
-
return
|
|
3489
|
+
return getRandomValues(rnds8);
|
|
3464
3490
|
}
|
|
3465
3491
|
|
|
3466
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3492
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3467
3493
|
var byteToHex = [];
|
|
3468
3494
|
for (let i = 0; i < 256; ++i) {
|
|
3469
3495
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3472,13 +3498,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3472
3498
|
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]];
|
|
3473
3499
|
}
|
|
3474
3500
|
|
|
3475
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3476
|
-
var
|
|
3501
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3502
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3477
3503
|
var native_default = {
|
|
3478
|
-
randomUUID
|
|
3504
|
+
randomUUID
|
|
3479
3505
|
};
|
|
3480
3506
|
|
|
3481
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3507
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3482
3508
|
function v4(options, buf, offset) {
|
|
3483
3509
|
if (native_default.randomUUID && !buf && !options) {
|
|
3484
3510
|
return native_default.randomUUID();
|
|
@@ -3520,14 +3546,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3520
3546
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3521
3547
|
const state = getGroupsById(getState());
|
|
3522
3548
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3523
|
-
|
|
3524
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3549
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3525
3550
|
accu[id] = group;
|
|
3526
3551
|
}
|
|
3527
3552
|
return accu;
|
|
3528
3553
|
}, {});
|
|
3529
3554
|
const groups = res.data.reduce((accu, group) => {
|
|
3530
|
-
accu[group] =
|
|
3555
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3531
3556
|
return accu;
|
|
3532
3557
|
}, dynamicGroups);
|
|
3533
3558
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3585,7 +3610,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3585
3610
|
() => Promise.resolve(
|
|
3586
3611
|
dispatch(
|
|
3587
3612
|
actions3.addGroup({
|
|
3588
|
-
group:
|
|
3613
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3589
3614
|
groupName: group
|
|
3590
3615
|
})
|
|
3591
3616
|
)
|
|
@@ -3613,20 +3638,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3613
3638
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3614
3639
|
const state = getGroupsById(getState());
|
|
3615
3640
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3616
|
-
|
|
3617
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3641
|
+
if (!(group.id || group.filters?.length)) {
|
|
3618
3642
|
accu[id] = group;
|
|
3619
3643
|
}
|
|
3620
3644
|
return accu;
|
|
3621
3645
|
}, {});
|
|
3622
3646
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3623
|
-
accu[filter.name] =
|
|
3647
|
+
accu[filter.name] = {
|
|
3624
3648
|
deviceIds: [],
|
|
3625
|
-
total: 0
|
|
3626
|
-
|
|
3649
|
+
total: 0,
|
|
3650
|
+
...state[filter.name],
|
|
3627
3651
|
id: filter.id,
|
|
3628
3652
|
filters: mapTermsToFilters(filter.terms)
|
|
3629
|
-
}
|
|
3653
|
+
};
|
|
3630
3654
|
return accu;
|
|
3631
3655
|
}, staticGroups);
|
|
3632
3656
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3666,10 +3690,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3666
3690
|
);
|
|
3667
3691
|
});
|
|
3668
3692
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3669
|
-
var _a;
|
|
3670
3693
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3671
3694
|
const selectedGroup = groupsState.byId[groupName];
|
|
3672
|
-
const groupFilterLength =
|
|
3695
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3673
3696
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3674
3697
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3675
3698
|
};
|
|
@@ -3692,7 +3715,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3692
3715
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3693
3716
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3694
3717
|
(accu, device) => {
|
|
3695
|
-
var _a, _b2, _c;
|
|
3696
3718
|
const stateDevice = getDeviceById(state, device.id);
|
|
3697
3719
|
const {
|
|
3698
3720
|
attributes: storedAttributes = {},
|
|
@@ -3702,29 +3724,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3702
3724
|
group: storedGroup
|
|
3703
3725
|
} = stateDevice;
|
|
3704
3726
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3705
|
-
device.tags =
|
|
3706
|
-
device.group =
|
|
3707
|
-
device.monitor =
|
|
3708
|
-
device.identity_data =
|
|
3727
|
+
device.tags = { ...storedTags, ...tags };
|
|
3728
|
+
device.group = system.group ?? storedGroup;
|
|
3729
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3730
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3709
3731
|
device.status = status ? status : device.status || identity.status;
|
|
3710
|
-
device.check_in_time_rounded =
|
|
3711
|
-
device.check_in_time_exact =
|
|
3732
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3733
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3712
3734
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3713
3735
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3714
3736
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3715
3737
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3716
|
-
device.attributes = device.attributes ?
|
|
3717
|
-
accu.devicesById[device.id] =
|
|
3738
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3739
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3718
3740
|
accu.ids.push(device.id);
|
|
3719
3741
|
return accu;
|
|
3720
3742
|
},
|
|
3721
3743
|
{ ids, devicesById: {} }
|
|
3722
3744
|
);
|
|
3723
3745
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3724
|
-
const
|
|
3746
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3725
3747
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3726
3748
|
return Promise.resolve(
|
|
3727
|
-
dispatch(getDevicesByStatus2(
|
|
3749
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3728
3750
|
).unwrap().then((results) => {
|
|
3729
3751
|
if (!group) {
|
|
3730
3752
|
return Promise.resolve();
|
|
@@ -3738,7 +3760,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3738
3760
|
dispatch(
|
|
3739
3761
|
actions3.addGroup({
|
|
3740
3762
|
group: {
|
|
3741
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3763
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3742
3764
|
total
|
|
3743
3765
|
},
|
|
3744
3766
|
groupName: group
|
|
@@ -3887,27 +3909,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3887
3909
|
);
|
|
3888
3910
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3889
3911
|
`${sliceName3}/setDeviceListState`,
|
|
3890
|
-
(
|
|
3891
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3892
|
-
var _c;
|
|
3912
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3893
3913
|
const currentState = getDeviceListState(getState());
|
|
3894
3914
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3895
|
-
let nextState =
|
|
3915
|
+
let nextState = {
|
|
3916
|
+
...currentState,
|
|
3896
3917
|
setOnly: false,
|
|
3897
|
-
refreshTrigger
|
|
3898
|
-
|
|
3899
|
-
sort:
|
|
3900
|
-
}
|
|
3918
|
+
refreshTrigger,
|
|
3919
|
+
...selectionState,
|
|
3920
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3921
|
+
};
|
|
3901
3922
|
let tasks = [];
|
|
3902
|
-
const
|
|
3903
|
-
const
|
|
3923
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3924
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3904
3925
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3905
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3926
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3906
3927
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3907
3928
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3908
3929
|
nextState.isLoading = true;
|
|
3909
3930
|
tasks.push(
|
|
3910
|
-
dispatch(getDevicesByStatus2(
|
|
3931
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3911
3932
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3912
3933
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3913
3934
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3932,8 +3953,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3932
3953
|
} = options;
|
|
3933
3954
|
const state = getState();
|
|
3934
3955
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3935
|
-
filters: filterSelection
|
|
3936
|
-
group: group
|
|
3956
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3957
|
+
group: group ?? getSelectedGroup(state),
|
|
3937
3958
|
groups: state.devices.groups,
|
|
3938
3959
|
offlineThreshold: state.app.offlineThreshold,
|
|
3939
3960
|
selectedIssues,
|
|
@@ -3994,7 +4015,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3994
4015
|
});
|
|
3995
4016
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3996
4017
|
const state = getState();
|
|
3997
|
-
let options =
|
|
4018
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3998
4019
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3999
4020
|
const { columnSelection = [] } = getUserSettings(state);
|
|
4000
4021
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4129,8 +4150,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4129
4150
|
({ data: auditLogEntries }) => {
|
|
4130
4151
|
const { start, end } = auditLogEntries.reduce(
|
|
4131
4152
|
(accu, item) => {
|
|
4132
|
-
|
|
4133
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4153
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4134
4154
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4135
4155
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4136
4156
|
}
|
|
@@ -4237,8 +4257,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4237
4257
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4238
4258
|
`${sliceName3}/getDeviceConfig`,
|
|
4239
4259
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4240
|
-
|
|
4241
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4260
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4242
4261
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4243
4262
|
}
|
|
4244
4263
|
})
|
|
@@ -4250,15 +4269,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4250
4269
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4251
4270
|
`${sliceName3}/applyDeviceConfig`,
|
|
4252
4271
|
({ 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 }) => {
|
|
4253
|
-
var _a;
|
|
4254
4272
|
const device = getDeviceById(getState(), deviceId);
|
|
4255
4273
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4256
4274
|
let tasks = [
|
|
4257
|
-
dispatch(actions3.receivedDevice(
|
|
4275
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4258
4276
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4259
4277
|
];
|
|
4260
4278
|
if (isDefault && canManageUsers) {
|
|
4261
|
-
const { previous } =
|
|
4279
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4262
4280
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4263
4281
|
}
|
|
4264
4282
|
return Promise.all(tasks);
|
|
@@ -4274,21 +4292,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4274
4292
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4275
4293
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4276
4294
|
{ headers }
|
|
4277
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4295
|
+
).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"))]));
|
|
4278
4296
|
})
|
|
4279
4297
|
)
|
|
4280
4298
|
);
|
|
4281
4299
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4282
4300
|
let providerResult = {};
|
|
4283
4301
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4284
|
-
providerResult =
|
|
4302
|
+
providerResult = { ...data, twinError: "" };
|
|
4285
4303
|
}).catch((err) => {
|
|
4286
4304
|
providerResult = {
|
|
4287
4305
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4288
4306
|
};
|
|
4289
4307
|
}).finally(() => {
|
|
4290
4308
|
const device = getDeviceById(getState(), deviceId);
|
|
4291
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4309
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4292
4310
|
});
|
|
4293
4311
|
});
|
|
4294
4312
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4304,7 +4322,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4304
4322
|
const { twinsByIntegration = {} } = device;
|
|
4305
4323
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4306
4324
|
return Promise.resolve(
|
|
4307
|
-
dispatch(actions3.receivedDevice(
|
|
4325
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4308
4326
|
);
|
|
4309
4327
|
})
|
|
4310
4328
|
);
|
|
@@ -4325,8 +4343,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4325
4343
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4326
4344
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4327
4345
|
const filters = [
|
|
4328
|
-
|
|
4329
|
-
|
|
4346
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4347
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4330
4348
|
];
|
|
4331
4349
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4332
4350
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4338,11 +4356,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4338
4356
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4339
4357
|
const state2 = getState();
|
|
4340
4358
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4341
|
-
const device =
|
|
4359
|
+
const device = {
|
|
4360
|
+
...getDeviceById(state2, id),
|
|
4342
4361
|
systemDeviceIds: ids,
|
|
4343
4362
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4344
|
-
}
|
|
4345
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4363
|
+
};
|
|
4364
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4346
4365
|
});
|
|
4347
4366
|
});
|
|
4348
4367
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4350,9 +4369,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4350
4369
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4351
4370
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4352
4371
|
const filters = [
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4372
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4373
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4374
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4356
4375
|
];
|
|
4357
4376
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4358
4377
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4399,7 +4418,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4399
4418
|
var cutoffLength = 75;
|
|
4400
4419
|
var ellipsis = "...";
|
|
4401
4420
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4402
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4421
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4403
4422
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4404
4423
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4405
4424
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4417,14 +4436,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4417
4436
|
});
|
|
4418
4437
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4419
4438
|
const state = getState();
|
|
4420
|
-
const
|
|
4421
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4439
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4440
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4441
|
+
...remainder,
|
|
4422
4442
|
filters,
|
|
4423
4443
|
group,
|
|
4424
4444
|
offlineThreshold: state.app.offlineThreshold,
|
|
4425
4445
|
selectedIssues: [type],
|
|
4426
4446
|
status
|
|
4427
|
-
})
|
|
4447
|
+
});
|
|
4428
4448
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4429
4449
|
page: 1,
|
|
4430
4450
|
per_page: 1,
|
|
@@ -4476,21 +4496,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4476
4496
|
return steps[progress2];
|
|
4477
4497
|
};
|
|
4478
4498
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4479
|
-
var _a;
|
|
4480
4499
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4481
4500
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4482
4501
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4483
4502
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4484
|
-
let deviceType =
|
|
4503
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4485
4504
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4486
4505
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4487
|
-
return
|
|
4506
|
+
return {
|
|
4507
|
+
...onboardingState,
|
|
4488
4508
|
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)),
|
|
4489
4509
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4490
4510
|
deviceType,
|
|
4491
4511
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4492
4512
|
progress: progress2
|
|
4493
|
-
}
|
|
4513
|
+
};
|
|
4494
4514
|
};
|
|
4495
4515
|
var getOnboardingState2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4496
4516
|
const state = getState();
|
|
@@ -4548,7 +4568,7 @@ var advanceOnboarding = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4548
4568
|
return;
|
|
4549
4569
|
}
|
|
4550
4570
|
const madeProgress = steps[stepIndex + 1];
|
|
4551
|
-
const state =
|
|
4571
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4552
4572
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4553
4573
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4554
4574
|
});
|
|
@@ -4631,8 +4651,8 @@ var completeUpgrade = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4631
4651
|
({ 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())))
|
|
4632
4652
|
);
|
|
4633
4653
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4634
|
-
const userId =
|
|
4635
|
-
const detail =
|
|
4654
|
+
const userId = userFilter?.id || userFilter;
|
|
4655
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4636
4656
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4637
4657
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4638
4658
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4659,12 +4679,14 @@ var getAuditLogsCsvLink = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4659
4679
|
);
|
|
4660
4680
|
var setAuditlogsState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4661
4681
|
const currentState = getAuditlogState(getState());
|
|
4662
|
-
let nextState =
|
|
4663
|
-
|
|
4664
|
-
|
|
4682
|
+
let nextState = {
|
|
4683
|
+
...currentState,
|
|
4684
|
+
...selectionState,
|
|
4685
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4686
|
+
};
|
|
4665
4687
|
let tasks = [];
|
|
4666
|
-
const
|
|
4667
|
-
const
|
|
4688
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4689
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4668
4690
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4669
4691
|
nextState.isLoading = true;
|
|
4670
4692
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4676,27 +4698,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4676
4698
|
var addTenant = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4677
4699
|
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));
|
|
4678
4700
|
});
|
|
4679
|
-
var tenantListRetrieval = (config) =>
|
|
4701
|
+
var tenantListRetrieval = async (config) => {
|
|
4680
4702
|
const { page, perPage } = config;
|
|
4681
4703
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4682
|
-
const tenantList =
|
|
4704
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4683
4705
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4684
4706
|
return [tenantList.data, Number(totalCount)];
|
|
4685
|
-
}
|
|
4686
|
-
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4707
|
+
};
|
|
4708
|
+
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4687
4709
|
const currentState = getTenantsList(getState());
|
|
4688
|
-
const [tenants, pageCount] =
|
|
4689
|
-
dispatch(actions6.setTenantListState(
|
|
4690
|
-
})
|
|
4691
|
-
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4710
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4711
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4712
|
+
});
|
|
4713
|
+
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4692
4714
|
const currentState = getTenantsList(getState());
|
|
4693
|
-
const nextState =
|
|
4715
|
+
const nextState = {
|
|
4716
|
+
...currentState,
|
|
4717
|
+
...selectionState
|
|
4718
|
+
};
|
|
4694
4719
|
if (!(0, import_helpers10.deepCompare)(currentState, selectionState)) {
|
|
4695
|
-
const [tenants, pageCount] =
|
|
4696
|
-
return dispatch(actions6.setTenantListState(
|
|
4720
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4721
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4697
4722
|
}
|
|
4698
|
-
return dispatch(actions6.setTenantListState(
|
|
4699
|
-
})
|
|
4723
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4724
|
+
});
|
|
4700
4725
|
var editTenantDeviceLimit = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4701
4726
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4702
4727
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4739,10 +4764,7 @@ var downloadLicenseReport = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4739
4764
|
);
|
|
4740
4765
|
var createIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4741
4766
|
`${sliceName6}/createIntegration`,
|
|
4742
|
-
(
|
|
4743
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4744
|
-
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())]));
|
|
4745
|
-
}
|
|
4767
|
+
({ 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())]))
|
|
4746
4768
|
);
|
|
4747
4769
|
var changeIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4748
4770
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4763,9 +4785,8 @@ var getIntegrations = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4763
4785
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4764
4786
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4765
4787
|
const integrations = data.reduce((accu, item) => {
|
|
4766
|
-
|
|
4767
|
-
const
|
|
4768
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4788
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4789
|
+
const integration = { ...existingIntegration, ...item };
|
|
4769
4790
|
accu.push(integration);
|
|
4770
4791
|
return accu;
|
|
4771
4792
|
}, []);
|
|
@@ -4817,7 +4838,7 @@ var getSsoConfigById = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4817
4838
|
`${sliceName6}/getSsoConfigById`,
|
|
4818
4839
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4819
4840
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4820
|
-
return sso ? Promise.resolve(
|
|
4841
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4821
4842
|
})
|
|
4822
4843
|
);
|
|
4823
4844
|
var getSsoConfigs = (0, import_toolkit22.createAsyncThunk)(
|
|
@@ -4836,20 +4857,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4836
4857
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4837
4858
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4838
4859
|
var flattenRelease = (release, stateRelease) => {
|
|
4839
|
-
|
|
4840
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers11.customSort)(1, "modified"))) || [];
|
|
4860
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers11.customSort)(1, "modified")) || [];
|
|
4841
4861
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4842
4862
|
(accu, item) => {
|
|
4843
|
-
var _a2;
|
|
4844
4863
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4845
|
-
const stateArtifact =
|
|
4864
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4846
4865
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4847
|
-
accu.artifacts.push(
|
|
4866
|
+
accu.artifacts.push({
|
|
4867
|
+
...stateArtifact,
|
|
4868
|
+
...item
|
|
4869
|
+
});
|
|
4848
4870
|
return accu;
|
|
4849
4871
|
},
|
|
4850
4872
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4851
4873
|
);
|
|
4852
|
-
return
|
|
4874
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers11.duplicateFilter), modified };
|
|
4853
4875
|
};
|
|
4854
4876
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4855
4877
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4867,17 +4889,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4867
4889
|
{ release: null, index: -1 }
|
|
4868
4890
|
);
|
|
4869
4891
|
var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4870
|
-
var _a;
|
|
4871
4892
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4872
4893
|
if (!release || index === -1) {
|
|
4873
4894
|
return;
|
|
4874
4895
|
}
|
|
4875
4896
|
const releaseArtifacts = [...release.artifacts];
|
|
4876
4897
|
const artifact = releaseArtifacts[index];
|
|
4877
|
-
const { key, name, version } = (
|
|
4898
|
+
const { key, name, version } = (0, import_helpers11.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4878
4899
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4879
4900
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4880
|
-
filters: [
|
|
4901
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4881
4902
|
});
|
|
4882
4903
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4883
4904
|
page: 1,
|
|
@@ -4891,10 +4912,11 @@ var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceNam
|
|
|
4891
4912
|
}
|
|
4892
4913
|
const installCount = Number(headers[headerNames.total]);
|
|
4893
4914
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4894
|
-
releaseArtifacts2[index2] =
|
|
4895
|
-
release2 =
|
|
4915
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4916
|
+
release2 = {
|
|
4917
|
+
...release2,
|
|
4896
4918
|
artifacts: releaseArtifacts2
|
|
4897
|
-
}
|
|
4919
|
+
};
|
|
4898
4920
|
return dispatch(actions7.receiveRelease(release2));
|
|
4899
4921
|
});
|
|
4900
4922
|
});
|
|
@@ -4906,12 +4928,14 @@ var getArtifactUrl = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4906
4928
|
return dispatch(getReleases());
|
|
4907
4929
|
}
|
|
4908
4930
|
const releaseArtifacts = [...release.artifacts];
|
|
4909
|
-
releaseArtifacts[index] =
|
|
4931
|
+
releaseArtifacts[index] = {
|
|
4932
|
+
...releaseArtifacts[index],
|
|
4910
4933
|
url: response.data.uri
|
|
4911
|
-
}
|
|
4912
|
-
release =
|
|
4934
|
+
};
|
|
4935
|
+
release = {
|
|
4936
|
+
...release,
|
|
4913
4937
|
artifacts: releaseArtifacts
|
|
4914
|
-
}
|
|
4938
|
+
};
|
|
4915
4939
|
return dispatch(actions7.receiveRelease(release));
|
|
4916
4940
|
})
|
|
4917
4941
|
);
|
|
@@ -5036,12 +5060,14 @@ var selectRelease = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/select
|
|
|
5036
5060
|
});
|
|
5037
5061
|
var setReleasesListState = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
5038
5062
|
const currentState = getState().releases.releasesList;
|
|
5039
|
-
let nextState =
|
|
5040
|
-
|
|
5041
|
-
|
|
5063
|
+
let nextState = {
|
|
5064
|
+
...currentState,
|
|
5065
|
+
...selectionState,
|
|
5066
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5067
|
+
};
|
|
5042
5068
|
let tasks = [];
|
|
5043
|
-
const
|
|
5044
|
-
const
|
|
5069
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
5070
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
5045
5071
|
if (!(0, import_helpers11.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
5046
5072
|
nextState.isLoading = true;
|
|
5047
5073
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -5060,29 +5086,30 @@ var releaseListRetrieval = (config) => {
|
|
|
5060
5086
|
);
|
|
5061
5087
|
};
|
|
5062
5088
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
5063
|
-
let releaseListState =
|
|
5089
|
+
let releaseListState = { ...state.releasesList };
|
|
5064
5090
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
5065
5091
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers11.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
5066
5092
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
5067
5093
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
5068
5094
|
if (searchOnly) {
|
|
5069
|
-
releaseListState =
|
|
5095
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
5070
5096
|
} else {
|
|
5071
|
-
releaseListState =
|
|
5097
|
+
releaseListState = {
|
|
5098
|
+
...releaseListState,
|
|
5072
5099
|
releaseIds,
|
|
5073
5100
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
5074
5101
|
total: !isFiltering ? total : state.releasesList.total
|
|
5075
|
-
}
|
|
5102
|
+
};
|
|
5076
5103
|
}
|
|
5077
5104
|
return releaseListState;
|
|
5078
5105
|
};
|
|
5079
5106
|
var getReleases = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
5080
|
-
const config =
|
|
5107
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
5081
5108
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
5082
5109
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
5083
5110
|
const state = getState().releases;
|
|
5084
5111
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
5085
|
-
const combinedReleases =
|
|
5112
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
5086
5113
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
5087
5114
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
5088
5115
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -5103,7 +5130,7 @@ var updateReleaseInfo = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5103
5130
|
`${sliceName7}/updateReleaseInfo`,
|
|
5104
5131
|
({ 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(() => {
|
|
5105
5132
|
return Promise.all([
|
|
5106
|
-
dispatch(actions7.receiveRelease(
|
|
5133
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
5107
5134
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
5108
5135
|
]);
|
|
5109
5136
|
})
|
|
@@ -5112,7 +5139,7 @@ var setReleaseTags = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5112
5139
|
`${sliceName7}/setReleaseTags`,
|
|
5113
5140
|
({ 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(() => {
|
|
5114
5141
|
return Promise.all([
|
|
5115
|
-
dispatch(actions7.receiveRelease(
|
|
5142
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
5116
5143
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
5117
5144
|
]);
|
|
5118
5145
|
})
|
|
@@ -5149,43 +5176,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
5149
5176
|
};
|
|
5150
5177
|
var loginUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5151
5178
|
`${sliceName8}/loginUser`,
|
|
5152
|
-
(
|
|
5153
|
-
|
|
5154
|
-
return
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
Promise.
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
window.
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
);
|
|
5187
|
-
});
|
|
5188
|
-
}
|
|
5179
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5180
|
+
cleanUp();
|
|
5181
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5182
|
+
}).then(({ text: response, contentType }) => {
|
|
5183
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5184
|
+
const { id, kind } = response;
|
|
5185
|
+
const type = kind.split("/")[1];
|
|
5186
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5187
|
+
window.location.replace(ssoLoginUrl);
|
|
5188
|
+
return;
|
|
5189
|
+
}
|
|
5190
|
+
const token = response;
|
|
5191
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5192
|
+
return;
|
|
5193
|
+
}
|
|
5194
|
+
let now = /* @__PURE__ */ new Date();
|
|
5195
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5196
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5197
|
+
setSessionInfo({ token, expiresAt });
|
|
5198
|
+
cookies5.remove("JWT", { path: "/" });
|
|
5199
|
+
return (
|
|
5200
|
+
// @ts-ignore
|
|
5201
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5202
|
+
cleanUp();
|
|
5203
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5204
|
+
}).then(() => {
|
|
5205
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5206
|
+
if (window.location.pathname !== "/ui/") {
|
|
5207
|
+
window.location.replace("/ui/");
|
|
5208
|
+
}
|
|
5209
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5210
|
+
})
|
|
5211
|
+
);
|
|
5212
|
+
})
|
|
5189
5213
|
);
|
|
5190
5214
|
var logoutUser = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
5191
5215
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -5202,7 +5226,7 @@ var switchUserOrganization = (0, import_toolkit24.createAsyncThunk)(`${sliceName
|
|
|
5202
5226
|
return Promise.reject();
|
|
5203
5227
|
}
|
|
5204
5228
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5205
|
-
setSessionInfo(
|
|
5229
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5206
5230
|
window.location.reload();
|
|
5207
5231
|
});
|
|
5208
5232
|
});
|
|
@@ -5265,13 +5289,13 @@ var getUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5265
5289
|
);
|
|
5266
5290
|
var initializeSelf = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5267
5291
|
var updateUserColumnSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5268
|
-
const userId = currentUserId
|
|
5292
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5269
5293
|
const storageKey = `${userId}-column-widths`;
|
|
5270
5294
|
let customColumns = [];
|
|
5271
5295
|
if (!columns) {
|
|
5272
5296
|
try {
|
|
5273
5297
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5274
|
-
} catch
|
|
5298
|
+
} catch {
|
|
5275
5299
|
}
|
|
5276
5300
|
} else {
|
|
5277
5301
|
customColumns = columns;
|
|
@@ -5300,10 +5324,7 @@ var userActions = {
|
|
|
5300
5324
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5301
5325
|
var createUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5302
5326
|
`${sliceName8}/createUser`,
|
|
5303
|
-
(
|
|
5304
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5305
|
-
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));
|
|
5306
|
-
}
|
|
5327
|
+
({ 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))
|
|
5307
5328
|
);
|
|
5308
5329
|
var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5309
5330
|
`${sliceName8}/removeUser`,
|
|
@@ -5314,15 +5335,12 @@ var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5314
5335
|
);
|
|
5315
5336
|
var editUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5316
5337
|
`${sliceName8}/editUser`,
|
|
5317
|
-
(
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
()
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
])
|
|
5324
|
-
);
|
|
5325
|
-
}
|
|
5338
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5339
|
+
() => Promise.all([
|
|
5340
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5341
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5342
|
+
])
|
|
5343
|
+
)
|
|
5326
5344
|
);
|
|
5327
5345
|
var addUserToCurrentTenant = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5328
5346
|
const { id } = getOrganization(getState());
|
|
@@ -5357,7 +5375,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5357
5375
|
}
|
|
5358
5376
|
return accu;
|
|
5359
5377
|
},
|
|
5360
|
-
|
|
5378
|
+
{ ...emptyUiPermissions }
|
|
5361
5379
|
);
|
|
5362
5380
|
var permissionActionTypes = {
|
|
5363
5381
|
any: mapHttpPermission,
|
|
@@ -5380,20 +5398,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5380
5398
|
}, existingPermissions);
|
|
5381
5399
|
var tryParseCustomPermission = (permission) => {
|
|
5382
5400
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5383
|
-
const result = mergePermissions(
|
|
5401
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5384
5402
|
return { isCustom: true, permission, result };
|
|
5385
5403
|
};
|
|
5386
5404
|
var customPermissionHandler = (accu, permission) => {
|
|
5387
5405
|
let processor = tryParseCustomPermission(permission);
|
|
5388
|
-
return
|
|
5406
|
+
return {
|
|
5407
|
+
...accu,
|
|
5389
5408
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5390
5409
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5391
|
-
}
|
|
5410
|
+
};
|
|
5392
5411
|
};
|
|
5393
5412
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5394
5413
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5395
5414
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5396
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5415
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5397
5416
|
};
|
|
5398
5417
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5399
5418
|
if (Array.isArray(permissions)) {
|
|
@@ -5408,60 +5427,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5408
5427
|
if (!processor) {
|
|
5409
5428
|
return accu;
|
|
5410
5429
|
}
|
|
5411
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5412
|
-
var _a;
|
|
5413
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5414
|
-
});
|
|
5430
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5415
5431
|
if (scope) {
|
|
5416
5432
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5417
|
-
return
|
|
5433
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5418
5434
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5419
5435
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5420
5436
|
}
|
|
5421
|
-
return
|
|
5437
|
+
return {
|
|
5438
|
+
...accu,
|
|
5422
5439
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5423
5440
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5424
|
-
}
|
|
5441
|
+
};
|
|
5425
5442
|
},
|
|
5426
|
-
{ isCustom: false, uiPermissions:
|
|
5443
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5427
5444
|
);
|
|
5428
5445
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5429
5446
|
};
|
|
5430
5447
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5431
5448
|
(accu, role) => {
|
|
5432
|
-
var _a;
|
|
5433
5449
|
let normalizedPermissions;
|
|
5434
5450
|
let isCustom = false;
|
|
5435
5451
|
if (rolesById2[role.name]) {
|
|
5436
|
-
normalizedPermissions =
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5452
|
+
normalizedPermissions = {
|
|
5453
|
+
...rolesById2[role.name].uiPermissions,
|
|
5454
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5455
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5456
|
+
};
|
|
5440
5457
|
} else {
|
|
5441
5458
|
const result = parseRolePermissions(role, permissionSets);
|
|
5442
5459
|
normalizedPermissions = result.uiPermissions;
|
|
5443
5460
|
isCustom = result.isCustom;
|
|
5444
5461
|
}
|
|
5445
|
-
const roleState =
|
|
5446
|
-
accu[role.name] =
|
|
5462
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5463
|
+
accu[role.name] = {
|
|
5464
|
+
...roleState,
|
|
5465
|
+
...role,
|
|
5447
5466
|
description: roleState.description ? roleState.description : role.description,
|
|
5448
5467
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5449
5468
|
isCustom,
|
|
5450
5469
|
name: roleState.name ? roleState.name : role.name,
|
|
5451
5470
|
uiPermissions: normalizedPermissions
|
|
5452
|
-
}
|
|
5471
|
+
};
|
|
5453
5472
|
return accu;
|
|
5454
5473
|
},
|
|
5455
|
-
|
|
5474
|
+
{ ...rolesById2 }
|
|
5456
5475
|
);
|
|
5457
5476
|
var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
5458
5477
|
`${sliceName8}/getPermissionSets`,
|
|
5459
5478
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5460
5479
|
const permissionSets = data.reduce(
|
|
5461
5480
|
(accu, permissionSet) => {
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5481
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5482
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5465
5483
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5466
5484
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5467
5485
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5472,11 +5490,10 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5472
5490
|
}
|
|
5473
5491
|
return collector;
|
|
5474
5492
|
}, accu2),
|
|
5475
|
-
|
|
5493
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5476
5494
|
);
|
|
5477
5495
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5478
|
-
|
|
5479
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5496
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5480
5497
|
accu2.push(key);
|
|
5481
5498
|
}
|
|
5482
5499
|
return accu2;
|
|
@@ -5489,7 +5506,7 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5489
5506
|
return accu;
|
|
5490
5507
|
},
|
|
5491
5508
|
// @ts-ignore
|
|
5492
|
-
|
|
5509
|
+
{ ...getState().users.permissionSetsById }
|
|
5493
5510
|
);
|
|
5494
5511
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5495
5512
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5522,28 +5539,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5522
5539
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5523
5540
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5524
5541
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5525
|
-
|
|
5526
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5542
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5527
5543
|
type: uiPermissionsByArea[area].scope,
|
|
5528
5544
|
value: []
|
|
5529
5545
|
};
|
|
5530
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5546
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5547
|
+
...permissionSetState,
|
|
5531
5548
|
value: [...permissionSetState.value, item]
|
|
5532
|
-
}
|
|
5549
|
+
};
|
|
5533
5550
|
return itemPermissionAccu;
|
|
5534
5551
|
}, accu);
|
|
5535
5552
|
return accu;
|
|
5536
5553
|
}, {});
|
|
5537
|
-
return Object.entries(permissionSetObject).map((
|
|
5538
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5554
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5539
5555
|
if (value.includes(excessiveAccessSelector)) {
|
|
5540
5556
|
return { name };
|
|
5541
5557
|
}
|
|
5542
|
-
return { name, scope:
|
|
5558
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers12.duplicateFilter) } };
|
|
5543
5559
|
});
|
|
5544
5560
|
};
|
|
5545
5561
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5546
|
-
const role =
|
|
5562
|
+
const role = { ...roleState, ...roleData };
|
|
5547
5563
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5548
5564
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5549
5565
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5579,12 +5595,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5579
5595
|
}, []);
|
|
5580
5596
|
return {
|
|
5581
5597
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5582
|
-
role:
|
|
5598
|
+
role: {
|
|
5599
|
+
...emptyRole,
|
|
5583
5600
|
name,
|
|
5584
5601
|
// @ts-ignore
|
|
5585
5602
|
description: description ? description : roleState.description,
|
|
5586
|
-
uiPermissions:
|
|
5587
|
-
|
|
5603
|
+
uiPermissions: {
|
|
5604
|
+
...emptyUiPermissions,
|
|
5605
|
+
...roleUiPermissions,
|
|
5606
|
+
...maybeUiPermissions
|
|
5607
|
+
}
|
|
5608
|
+
}
|
|
5588
5609
|
};
|
|
5589
5610
|
};
|
|
5590
5611
|
var roleActions = {
|
|
@@ -5635,13 +5656,12 @@ var getGlobalSettings2 = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5635
5656
|
var saveGlobalSettings = (0, import_toolkit24.createAsyncThunk)(
|
|
5636
5657
|
`${sliceName8}/saveGlobalSettings`,
|
|
5637
5658
|
// @ts-ignore
|
|
5638
|
-
(
|
|
5639
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5659
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5640
5660
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5641
5661
|
return;
|
|
5642
5662
|
}
|
|
5643
5663
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5644
|
-
let updatedSettings =
|
|
5664
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5645
5665
|
if (getCurrentUser(getState()).verified) {
|
|
5646
5666
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5647
5667
|
} else {
|
|
@@ -5679,10 +5699,17 @@ var saveUserSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5679
5699
|
const userSettings = getUserSettings(getState());
|
|
5680
5700
|
const onboardingState = getOnboardingState(getState());
|
|
5681
5701
|
const tooltipState = getTooltipsState(getState());
|
|
5682
|
-
const updatedSettings =
|
|
5683
|
-
|
|
5702
|
+
const updatedSettings = {
|
|
5703
|
+
...userSettings,
|
|
5704
|
+
// @ts-ignore
|
|
5705
|
+
...settings,
|
|
5706
|
+
onboarding: {
|
|
5707
|
+
...onboardingState,
|
|
5708
|
+
// @ts-ignore
|
|
5709
|
+
...settings.onboarding
|
|
5710
|
+
},
|
|
5684
5711
|
tooltips: tooltipState
|
|
5685
|
-
}
|
|
5712
|
+
};
|
|
5686
5713
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5687
5714
|
return Promise.all([
|
|
5688
5715
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5708,9 +5735,10 @@ var getTokens = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5708
5735
|
`${sliceName8}/getTokens`,
|
|
5709
5736
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5710
5737
|
const user = getCurrentUser(getState());
|
|
5711
|
-
const updatedUser =
|
|
5738
|
+
const updatedUser = {
|
|
5739
|
+
...user,
|
|
5712
5740
|
tokens
|
|
5713
|
-
}
|
|
5741
|
+
};
|
|
5714
5742
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5715
5743
|
})
|
|
5716
5744
|
);
|
|
@@ -5726,8 +5754,7 @@ var revokeToken = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5726
5754
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5727
5755
|
)
|
|
5728
5756
|
);
|
|
5729
|
-
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5730
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5757
|
+
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5731
5758
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5732
5759
|
if (persist) {
|
|
5733
5760
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5735,14 +5762,13 @@ var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/
|
|
|
5735
5762
|
return Promise.all(tasks);
|
|
5736
5763
|
});
|
|
5737
5764
|
var setAllTooltipsReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5738
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5765
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5739
5766
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5740
5767
|
});
|
|
5741
5768
|
var submitFeedback = (0, import_toolkit24.createAsyncThunk)(
|
|
5742
5769
|
`${sliceName8}/submitFeedback`,
|
|
5743
5770
|
// @ts-ignore
|
|
5744
|
-
(
|
|
5745
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5771
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5746
5772
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5747
5773
|
subject: "feedback submission",
|
|
5748
5774
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5753,43 +5779,4 @@ var submitFeedback = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5753
5779
|
});
|
|
5754
5780
|
}
|
|
5755
5781
|
);
|
|
5756
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5757
|
-
0 && (module.exports = {
|
|
5758
|
-
addUserToCurrentTenant,
|
|
5759
|
-
createRole,
|
|
5760
|
-
createUser,
|
|
5761
|
-
disableUser2fa,
|
|
5762
|
-
editRole,
|
|
5763
|
-
editUser,
|
|
5764
|
-
enableUser2fa,
|
|
5765
|
-
generateToken,
|
|
5766
|
-
get2FAQRCode,
|
|
5767
|
-
getGlobalSettings,
|
|
5768
|
-
getPermissionSets,
|
|
5769
|
-
getRoles,
|
|
5770
|
-
getTokens,
|
|
5771
|
-
getUser,
|
|
5772
|
-
getUserList,
|
|
5773
|
-
getUserSettings,
|
|
5774
|
-
initializeSelf,
|
|
5775
|
-
loginUser,
|
|
5776
|
-
logoutUser,
|
|
5777
|
-
normalizeRbacRoles,
|
|
5778
|
-
passwordResetComplete,
|
|
5779
|
-
passwordResetStart,
|
|
5780
|
-
removeRole,
|
|
5781
|
-
removeUser,
|
|
5782
|
-
revokeToken,
|
|
5783
|
-
saveGlobalSettings,
|
|
5784
|
-
saveUserSettings,
|
|
5785
|
-
setAllTooltipsReadState,
|
|
5786
|
-
setHideAnnouncement,
|
|
5787
|
-
setTooltipReadState,
|
|
5788
|
-
submitFeedback,
|
|
5789
|
-
switchUserOrganization,
|
|
5790
|
-
updateUserColumnSettings,
|
|
5791
|
-
verify2FA,
|
|
5792
|
-
verifyEmailComplete,
|
|
5793
|
-
verifyEmailStart
|
|
5794
|
-
});
|
|
5795
5782
|
//# sourceMappingURL=thunks.js.map
|