@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 = {};
|
|
@@ -473,7 +423,7 @@ var chartTypes = {
|
|
|
473
423
|
};
|
|
474
424
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
475
425
|
var defaultReportType = "distribution";
|
|
476
|
-
var defaultReports = [
|
|
426
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
477
427
|
var locations = {};
|
|
478
428
|
var PLANS = {
|
|
479
429
|
os: {
|
|
@@ -806,7 +756,7 @@ var emptyRole = Object.freeze({
|
|
|
806
756
|
name: void 0,
|
|
807
757
|
description: "",
|
|
808
758
|
permissions: [],
|
|
809
|
-
uiPermissions: Object.freeze(
|
|
759
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
810
760
|
});
|
|
811
761
|
|
|
812
762
|
// src/deploymentsSlice/constants.ts
|
|
@@ -835,11 +785,12 @@ var deploymentStatesToSubstates = {
|
|
|
835
785
|
pending: [deploymentSubstates.pending],
|
|
836
786
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
837
787
|
};
|
|
838
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
788
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
789
|
+
...deploymentStatesToSubstates,
|
|
839
790
|
failures: [deploymentSubstates.failure],
|
|
840
791
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
841
792
|
successes: [deploymentSubstates.success]
|
|
842
|
-
}
|
|
793
|
+
};
|
|
843
794
|
var installationSubstatesMap = {
|
|
844
795
|
download: {
|
|
845
796
|
title: "download",
|
|
@@ -884,8 +835,8 @@ var DEPLOYMENT_STATES = {
|
|
|
884
835
|
var listDefaultsByState = {
|
|
885
836
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
886
837
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
887
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
888
|
-
[DEPLOYMENT_STATES.finished]:
|
|
838
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
839
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
889
840
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
890
841
|
};
|
|
891
842
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1260,7 +1211,7 @@ var uiPermissionsByArea = {
|
|
|
1260
1211
|
}
|
|
1261
1212
|
};
|
|
1262
1213
|
var permissionMapper = (permission) => permission.value;
|
|
1263
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1214
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1264
1215
|
var rolesById = Object.freeze({
|
|
1265
1216
|
[staticRolesByName.admin]: {
|
|
1266
1217
|
name: "Admin",
|
|
@@ -1268,54 +1219,59 @@ var rolesById = Object.freeze({
|
|
|
1268
1219
|
description: "Full access",
|
|
1269
1220
|
permissions: [],
|
|
1270
1221
|
// permissions refers to the values returned from the backend
|
|
1271
|
-
uiPermissions:
|
|
1222
|
+
uiPermissions: {
|
|
1223
|
+
...emptyUiPermissions,
|
|
1272
1224
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1273
1225
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1274
1226
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1275
1227
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1276
1228
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1277
|
-
}
|
|
1229
|
+
}
|
|
1278
1230
|
},
|
|
1279
1231
|
[staticRolesByName.readOnly]: {
|
|
1280
1232
|
name: "Read Access",
|
|
1281
1233
|
value: staticRolesByName.readOnly,
|
|
1282
1234
|
description: "",
|
|
1283
1235
|
permissions: [],
|
|
1284
|
-
uiPermissions:
|
|
1236
|
+
uiPermissions: {
|
|
1237
|
+
...emptyUiPermissions,
|
|
1285
1238
|
deployments: [uiPermissionsById.read.value],
|
|
1286
1239
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1287
1240
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1288
1241
|
userManagement: [uiPermissionsById.read.value]
|
|
1289
|
-
}
|
|
1242
|
+
}
|
|
1290
1243
|
},
|
|
1291
1244
|
[staticRolesByName.ci]: {
|
|
1292
1245
|
name: "Releases Manager",
|
|
1293
1246
|
value: staticRolesByName.ci,
|
|
1294
1247
|
description: "",
|
|
1295
1248
|
permissions: [],
|
|
1296
|
-
uiPermissions:
|
|
1249
|
+
uiPermissions: {
|
|
1250
|
+
...emptyUiPermissions,
|
|
1297
1251
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1298
|
-
}
|
|
1252
|
+
}
|
|
1299
1253
|
},
|
|
1300
1254
|
[staticRolesByName.deploymentsManager]: {
|
|
1301
1255
|
name: "Deployments Manager",
|
|
1302
1256
|
value: staticRolesByName.deploymentsManager,
|
|
1303
1257
|
description: "",
|
|
1304
1258
|
permissions: [],
|
|
1305
|
-
uiPermissions:
|
|
1259
|
+
uiPermissions: {
|
|
1260
|
+
...emptyUiPermissions,
|
|
1306
1261
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1307
1262
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1308
1263
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1309
|
-
}
|
|
1264
|
+
}
|
|
1310
1265
|
},
|
|
1311
1266
|
[staticRolesByName.terminalAccess]: {
|
|
1312
1267
|
name: "Troubleshooting",
|
|
1313
1268
|
value: staticRolesByName.terminalAccess,
|
|
1314
1269
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1315
1270
|
permissions: [],
|
|
1316
|
-
uiPermissions:
|
|
1271
|
+
uiPermissions: {
|
|
1272
|
+
...emptyUiPermissions,
|
|
1317
1273
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1318
|
-
}
|
|
1274
|
+
}
|
|
1319
1275
|
}
|
|
1320
1276
|
});
|
|
1321
1277
|
var serviceProviderRolesById = {
|
|
@@ -1324,22 +1280,24 @@ var serviceProviderRolesById = {
|
|
|
1324
1280
|
value: staticRolesByName.admin,
|
|
1325
1281
|
description: "Full access",
|
|
1326
1282
|
permissions: [],
|
|
1327
|
-
uiPermissions:
|
|
1283
|
+
uiPermissions: {
|
|
1284
|
+
...emptyUiPermissions,
|
|
1328
1285
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1329
1286
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1330
1287
|
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1331
|
-
}
|
|
1288
|
+
}
|
|
1332
1289
|
},
|
|
1333
1290
|
readOnly: {
|
|
1334
1291
|
name: "Read access",
|
|
1335
1292
|
value: staticRolesByName.admin,
|
|
1336
1293
|
description: "This role can see all linked organizations but cannot make any changes",
|
|
1337
1294
|
permissions: [],
|
|
1338
|
-
uiPermissions:
|
|
1295
|
+
uiPermissions: {
|
|
1296
|
+
...emptyUiPermissions,
|
|
1339
1297
|
auditlog: [uiPermissionsById.read.value],
|
|
1340
1298
|
userManagement: [uiPermissionsById.read.value],
|
|
1341
1299
|
tenantManagement: [uiPermissionsById.read.value]
|
|
1342
|
-
}
|
|
1300
|
+
}
|
|
1343
1301
|
}
|
|
1344
1302
|
};
|
|
1345
1303
|
var defaultPermissionSets = {
|
|
@@ -1352,7 +1310,9 @@ var defaultPermissionSets = {
|
|
|
1352
1310
|
},
|
|
1353
1311
|
[permissionSetIds.SuperUser]: {
|
|
1354
1312
|
name: permissionSetIds.SuperUser,
|
|
1355
|
-
result:
|
|
1313
|
+
result: {
|
|
1314
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1315
|
+
}
|
|
1356
1316
|
},
|
|
1357
1317
|
[permissionSetIds.ManageUsers]: {
|
|
1358
1318
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1437,11 +1397,12 @@ var defaultPermissionSets = {
|
|
|
1437
1397
|
};
|
|
1438
1398
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1439
1399
|
var OWN_USER_ID = "me";
|
|
1440
|
-
var rolesByName =
|
|
1400
|
+
var rolesByName = {
|
|
1401
|
+
...staticRolesByName,
|
|
1441
1402
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1442
1403
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1443
1404
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1444
|
-
}
|
|
1405
|
+
};
|
|
1445
1406
|
var twoFAStates = {
|
|
1446
1407
|
enabled: "enabled",
|
|
1447
1408
|
disabled: "disabled",
|
|
@@ -1529,7 +1490,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1529
1490
|
initialState,
|
|
1530
1491
|
reducers: {
|
|
1531
1492
|
setFeatures: (state, action) => {
|
|
1532
|
-
state.features =
|
|
1493
|
+
state.features = {
|
|
1494
|
+
...state.features,
|
|
1495
|
+
...action.payload
|
|
1496
|
+
};
|
|
1533
1497
|
},
|
|
1534
1498
|
setSnackbar: (state, { payload }) => {
|
|
1535
1499
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1554,7 +1518,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1554
1518
|
state.hostedAnnouncement = action.payload;
|
|
1555
1519
|
},
|
|
1556
1520
|
setSearchState: (state, action) => {
|
|
1557
|
-
state.searchState =
|
|
1521
|
+
state.searchState = {
|
|
1522
|
+
...state.searchState,
|
|
1523
|
+
...action.payload
|
|
1524
|
+
};
|
|
1558
1525
|
},
|
|
1559
1526
|
setOfflineThreshold: (state, action) => {
|
|
1560
1527
|
state.offlineThreshold = action.payload;
|
|
@@ -1565,20 +1532,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1565
1532
|
},
|
|
1566
1533
|
uploadProgress: (state, action) => {
|
|
1567
1534
|
const { id, progress: progress2 } = action.payload;
|
|
1568
|
-
state.uploadsById[id] =
|
|
1535
|
+
state.uploadsById[id] = {
|
|
1536
|
+
...state.uploadsById[id],
|
|
1569
1537
|
progress: progress2
|
|
1570
|
-
}
|
|
1538
|
+
};
|
|
1571
1539
|
},
|
|
1572
1540
|
cleanUpUpload: (state, action) => {
|
|
1573
|
-
|
|
1574
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1541
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1575
1542
|
state.uploadsById = remainder;
|
|
1576
1543
|
},
|
|
1577
1544
|
setVersionInformation: (state, action) => {
|
|
1578
|
-
state.versionInformation =
|
|
1545
|
+
state.versionInformation = {
|
|
1546
|
+
...state.versionInformation,
|
|
1547
|
+
...action.payload
|
|
1548
|
+
};
|
|
1579
1549
|
},
|
|
1580
1550
|
setEnvironmentData: (state, action) => {
|
|
1581
|
-
return
|
|
1551
|
+
return { ...state, ...action.payload };
|
|
1582
1552
|
}
|
|
1583
1553
|
}
|
|
1584
1554
|
});
|
|
@@ -1610,7 +1580,7 @@ var initialState2 = {
|
|
|
1610
1580
|
sourceWindow: -1
|
|
1611
1581
|
},
|
|
1612
1582
|
binaryDeltaLimits: {
|
|
1613
|
-
timeout:
|
|
1583
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1614
1584
|
sourceWindow: limitDefault,
|
|
1615
1585
|
inputWindow: limitDefault,
|
|
1616
1586
|
duplicatesWindow: limitDefault,
|
|
@@ -1620,10 +1590,10 @@ var initialState2 = {
|
|
|
1620
1590
|
deploymentDeviceLimit: 5e3,
|
|
1621
1591
|
selectedDeviceIds: [],
|
|
1622
1592
|
selectionState: {
|
|
1623
|
-
finished:
|
|
1624
|
-
inprogress:
|
|
1625
|
-
pending:
|
|
1626
|
-
scheduled:
|
|
1593
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1594
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1595
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1596
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1627
1597
|
general: {
|
|
1628
1598
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1629
1599
|
showCreationDialog: false,
|
|
@@ -1639,40 +1609,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1639
1609
|
initialState: initialState2,
|
|
1640
1610
|
reducers: {
|
|
1641
1611
|
createdDeployment: (state, action) => {
|
|
1642
|
-
state.byId[action.payload.id] =
|
|
1612
|
+
state.byId[action.payload.id] = {
|
|
1613
|
+
...deploymentPrototype,
|
|
1614
|
+
...action.payload
|
|
1615
|
+
};
|
|
1643
1616
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1644
1617
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1645
1618
|
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;
|
|
1646
1619
|
},
|
|
1647
1620
|
removedDeployment: (state, action) => {
|
|
1648
|
-
|
|
1649
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1621
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1650
1622
|
state.byId = remainder;
|
|
1651
1623
|
},
|
|
1652
1624
|
receivedDeployment: (state, action) => {
|
|
1653
|
-
state.byId[action.payload.id] =
|
|
1625
|
+
state.byId[action.payload.id] = {
|
|
1626
|
+
...state.byId[action.payload.id] || {},
|
|
1627
|
+
...action.payload
|
|
1628
|
+
};
|
|
1654
1629
|
},
|
|
1655
1630
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1656
1631
|
const { id, deviceId, log } = action.payload;
|
|
1657
|
-
const deployment =
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1632
|
+
const deployment = {
|
|
1633
|
+
...deploymentPrototype,
|
|
1634
|
+
...state.byId[id]
|
|
1635
|
+
};
|
|
1636
|
+
state.byId[id] = {
|
|
1637
|
+
...deployment,
|
|
1638
|
+
devices: {
|
|
1639
|
+
...deployment.devices,
|
|
1640
|
+
[deviceId]: {
|
|
1641
|
+
...deployment.devices[deviceId],
|
|
1661
1642
|
log
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1665
1646
|
},
|
|
1666
1647
|
receivedDeploymentDevices: (state, action) => {
|
|
1667
1648
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1668
|
-
state.byId[id] =
|
|
1649
|
+
state.byId[id] = {
|
|
1650
|
+
...state.byId[id],
|
|
1669
1651
|
devices,
|
|
1670
1652
|
totalDeviceCount
|
|
1671
|
-
}
|
|
1653
|
+
};
|
|
1672
1654
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1673
1655
|
},
|
|
1674
1656
|
receivedDeployments: (state, action) => {
|
|
1675
|
-
state.byId =
|
|
1657
|
+
state.byId = {
|
|
1658
|
+
...state.byId,
|
|
1659
|
+
...action.payload
|
|
1660
|
+
};
|
|
1676
1661
|
},
|
|
1677
1662
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1678
1663
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1714,9 +1699,9 @@ var initialState3 = {
|
|
|
1714
1699
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1715
1700
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1716
1701
|
},
|
|
1717
|
-
deviceList:
|
|
1718
|
-
deviceIds: []
|
|
1719
|
-
|
|
1702
|
+
deviceList: {
|
|
1703
|
+
deviceIds: [],
|
|
1704
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1720
1705
|
selectedAttributes: [],
|
|
1721
1706
|
selectedIssues: [],
|
|
1722
1707
|
selection: [],
|
|
@@ -1727,7 +1712,7 @@ var initialState3 = {
|
|
|
1727
1712
|
},
|
|
1728
1713
|
state: DEVICE_STATES.accepted,
|
|
1729
1714
|
total: 0
|
|
1730
|
-
}
|
|
1715
|
+
},
|
|
1731
1716
|
filters: [
|
|
1732
1717
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1733
1718
|
],
|
|
@@ -1762,49 +1747,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1762
1747
|
},
|
|
1763
1748
|
addToGroup: (state, action) => {
|
|
1764
1749
|
const { group, deviceIds } = action.payload;
|
|
1765
|
-
const maybeExistingGroup =
|
|
1750
|
+
const maybeExistingGroup = {
|
|
1766
1751
|
filters: [],
|
|
1767
|
-
deviceIds: []
|
|
1768
|
-
|
|
1769
|
-
|
|
1752
|
+
deviceIds: [],
|
|
1753
|
+
...state.groups.byId[group]
|
|
1754
|
+
};
|
|
1755
|
+
state.groups.byId[group] = {
|
|
1756
|
+
...maybeExistingGroup,
|
|
1770
1757
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1771
1758
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1772
|
-
}
|
|
1759
|
+
};
|
|
1773
1760
|
},
|
|
1774
1761
|
removeFromGroup: (state, action) => {
|
|
1775
1762
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1776
|
-
const
|
|
1777
|
-
const changedGroup =
|
|
1763
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1764
|
+
const changedGroup = {
|
|
1765
|
+
...maybeExistingGroup,
|
|
1778
1766
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1779
1767
|
total: Math.max(total - removedIds.length, 0)
|
|
1780
|
-
}
|
|
1768
|
+
};
|
|
1781
1769
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1782
1770
|
state.groups.byId[group] = changedGroup;
|
|
1783
1771
|
return;
|
|
1784
1772
|
} else if (state.groups.selectedGroup === group) {
|
|
1785
1773
|
state.groups.selectedGroup = void 0;
|
|
1786
1774
|
}
|
|
1787
|
-
const
|
|
1775
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1788
1776
|
state.groups.byId = remainingById;
|
|
1789
1777
|
},
|
|
1790
1778
|
addGroup: (state, action) => {
|
|
1791
1779
|
const { groupName, group } = action.payload;
|
|
1792
|
-
state.groups.byId[groupName] =
|
|
1780
|
+
state.groups.byId[groupName] = {
|
|
1781
|
+
...state.groups.byId[groupName],
|
|
1782
|
+
...group
|
|
1783
|
+
};
|
|
1793
1784
|
},
|
|
1794
1785
|
selectGroup: (state, { payload: group }) => {
|
|
1795
1786
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1796
1787
|
state.groups.selectedGroup = group;
|
|
1797
1788
|
},
|
|
1798
1789
|
removeGroup: (state, action) => {
|
|
1799
|
-
|
|
1800
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1790
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1801
1791
|
state.groups.byId = remainingById;
|
|
1802
1792
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1803
1793
|
},
|
|
1804
1794
|
setDeviceListState: (state, action) => {
|
|
1805
|
-
state.deviceList =
|
|
1806
|
-
|
|
1807
|
-
|
|
1795
|
+
state.deviceList = {
|
|
1796
|
+
...state.deviceList,
|
|
1797
|
+
...action.payload,
|
|
1798
|
+
sort: {
|
|
1799
|
+
...state.deviceList.sort,
|
|
1800
|
+
...action.payload.sort
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1808
1803
|
},
|
|
1809
1804
|
setFilterAttributes: (state, action) => {
|
|
1810
1805
|
state.filteringAttributes = action.payload;
|
|
@@ -1813,7 +1808,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1813
1808
|
state.filteringAttributesConfig = action.payload;
|
|
1814
1809
|
},
|
|
1815
1810
|
receivedDevices: (state, action) => {
|
|
1816
|
-
state.byId =
|
|
1811
|
+
state.byId = {
|
|
1812
|
+
...state.byId,
|
|
1813
|
+
...action.payload
|
|
1814
|
+
};
|
|
1817
1815
|
},
|
|
1818
1816
|
setDeviceFilters: (state, action) => {
|
|
1819
1817
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1844,7 +1842,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1844
1842
|
state.limit = action.payload;
|
|
1845
1843
|
},
|
|
1846
1844
|
receivedDevice: (state, action) => {
|
|
1847
|
-
state.byId[action.payload.id] =
|
|
1845
|
+
state.byId[action.payload.id] = {
|
|
1846
|
+
...state.byId[action.payload.id],
|
|
1847
|
+
...action.payload
|
|
1848
|
+
};
|
|
1848
1849
|
},
|
|
1849
1850
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1850
1851
|
const { deviceId, authId } = action.payload;
|
|
@@ -1865,15 +1866,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1865
1866
|
var sliceName4 = "monitor";
|
|
1866
1867
|
var initialState4 = {
|
|
1867
1868
|
alerts: {
|
|
1868
|
-
alertList:
|
|
1869
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1869
1870
|
byDeviceId: {}
|
|
1870
1871
|
},
|
|
1871
1872
|
issueCounts: {
|
|
1872
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1873
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1873
1874
|
},
|
|
1874
1875
|
settings: {
|
|
1875
1876
|
global: {
|
|
1876
|
-
channels:
|
|
1877
|
+
channels: {
|
|
1878
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1879
|
+
}
|
|
1877
1880
|
}
|
|
1878
1881
|
}
|
|
1879
1882
|
};
|
|
@@ -1891,14 +1894,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1891
1894
|
},
|
|
1892
1895
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1893
1896
|
const { deviceId, alerts } = action.payload;
|
|
1894
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1897
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1895
1898
|
},
|
|
1896
1899
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1897
1900
|
const { issueType, counts } = action.payload;
|
|
1898
1901
|
state.issueCounts.byType[issueType] = counts;
|
|
1899
1902
|
},
|
|
1900
1903
|
setAlertListState: (state, action) => {
|
|
1901
|
-
state.alerts.alertList =
|
|
1904
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1902
1905
|
}
|
|
1903
1906
|
}
|
|
1904
1907
|
});
|
|
@@ -1922,7 +1925,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1922
1925
|
initialState: initialState5,
|
|
1923
1926
|
reducers: {
|
|
1924
1927
|
setOnboardingState: (state, action) => {
|
|
1925
|
-
return
|
|
1928
|
+
return { ...state, ...action.payload };
|
|
1926
1929
|
},
|
|
1927
1930
|
setDemoArtifactPort: (state, action) => {
|
|
1928
1931
|
state.demoArtifactPort = action.payload;
|
|
@@ -1960,7 +1963,8 @@ var initialState6 = {
|
|
|
1960
1963
|
brand: ""
|
|
1961
1964
|
},
|
|
1962
1965
|
intentId: null,
|
|
1963
|
-
tenantList:
|
|
1966
|
+
tenantList: {
|
|
1967
|
+
...TENANT_LIST_DEFAULT,
|
|
1964
1968
|
total: 0,
|
|
1965
1969
|
tenants: [],
|
|
1966
1970
|
selectedTenant: null,
|
|
@@ -1968,13 +1972,14 @@ var initialState6 = {
|
|
|
1968
1972
|
direction: SORTING_OPTIONS.desc,
|
|
1969
1973
|
key: "name"
|
|
1970
1974
|
}
|
|
1971
|
-
}
|
|
1975
|
+
},
|
|
1972
1976
|
organization: {
|
|
1973
1977
|
// id, name, status, tenant_token, plan
|
|
1974
1978
|
},
|
|
1975
1979
|
auditlog: {
|
|
1976
1980
|
events: [],
|
|
1977
|
-
selectionState:
|
|
1981
|
+
selectionState: {
|
|
1982
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1978
1983
|
detail: void 0,
|
|
1979
1984
|
endDate: void 0,
|
|
1980
1985
|
selectedIssue: void 0,
|
|
@@ -1983,7 +1988,7 @@ var initialState6 = {
|
|
|
1983
1988
|
total: 0,
|
|
1984
1989
|
type: void 0,
|
|
1985
1990
|
user: void 0
|
|
1986
|
-
}
|
|
1991
|
+
}
|
|
1987
1992
|
},
|
|
1988
1993
|
externalDeviceIntegrations: [
|
|
1989
1994
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2006,7 +2011,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2006
2011
|
state.auditlog.selectionState.total = total;
|
|
2007
2012
|
},
|
|
2008
2013
|
setAuditLogState: (state, action) => {
|
|
2009
|
-
state.auditlog.selectionState =
|
|
2014
|
+
state.auditlog.selectionState = {
|
|
2015
|
+
...state.auditlog.selectionState,
|
|
2016
|
+
...action.payload
|
|
2017
|
+
};
|
|
2010
2018
|
},
|
|
2011
2019
|
receiveCurrentCard: (state, action) => {
|
|
2012
2020
|
state.card = action.payload;
|
|
@@ -2015,7 +2023,7 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
2015
2023
|
state.intentId = action.payload;
|
|
2016
2024
|
},
|
|
2017
2025
|
setOrganization: (state, action) => {
|
|
2018
|
-
state.organization =
|
|
2026
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2019
2027
|
},
|
|
2020
2028
|
setTenantListState: (state, action) => {
|
|
2021
2029
|
state.tenantList = action.payload;
|
|
@@ -2078,7 +2086,8 @@ var initialState7 = {
|
|
|
2078
2086
|
}
|
|
2079
2087
|
*/
|
|
2080
2088
|
},
|
|
2081
|
-
releasesList:
|
|
2089
|
+
releasesList: {
|
|
2090
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2082
2091
|
searchedIds: [],
|
|
2083
2092
|
releaseIds: [],
|
|
2084
2093
|
selection: [],
|
|
@@ -2092,7 +2101,7 @@ var initialState7 = {
|
|
|
2092
2101
|
selectedTags: [],
|
|
2093
2102
|
total: 0,
|
|
2094
2103
|
type: ""
|
|
2095
|
-
}
|
|
2104
|
+
},
|
|
2096
2105
|
tags: [],
|
|
2097
2106
|
updateTypes: [],
|
|
2098
2107
|
/*
|
|
@@ -2118,8 +2127,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2118
2127
|
state.updateTypes = action.payload;
|
|
2119
2128
|
},
|
|
2120
2129
|
removeRelease: (state, action) => {
|
|
2121
|
-
|
|
2122
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2130
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2123
2131
|
state.byId = byId;
|
|
2124
2132
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2125
2133
|
},
|
|
@@ -2152,8 +2160,12 @@ var initialState8 = {
|
|
|
2152
2160
|
previousPhases: [],
|
|
2153
2161
|
retries: 0
|
|
2154
2162
|
},
|
|
2155
|
-
permissionSetsById:
|
|
2156
|
-
|
|
2163
|
+
permissionSetsById: {
|
|
2164
|
+
...defaultPermissionSets
|
|
2165
|
+
},
|
|
2166
|
+
rolesById: {
|
|
2167
|
+
...rolesById
|
|
2168
|
+
},
|
|
2157
2169
|
settingsInitialized: false,
|
|
2158
2170
|
showConnectDeviceDialog: false,
|
|
2159
2171
|
showFeedbackDialog: false,
|
|
@@ -2193,13 +2205,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2193
2205
|
state.byId[0] = action.payload;
|
|
2194
2206
|
},
|
|
2195
2207
|
removedUser: (state, action) => {
|
|
2196
|
-
|
|
2197
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2208
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2198
2209
|
state.byId = byId;
|
|
2199
2210
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2200
2211
|
},
|
|
2201
2212
|
updatedUser: (state, action) => {
|
|
2202
|
-
state.byId[action.payload.id] =
|
|
2213
|
+
state.byId[action.payload.id] = {
|
|
2214
|
+
...state.byId[action.payload.id],
|
|
2215
|
+
...action.payload
|
|
2216
|
+
};
|
|
2203
2217
|
},
|
|
2204
2218
|
receivedPermissionSets: (state, action) => {
|
|
2205
2219
|
state.permissionSetsById = action.payload;
|
|
@@ -2208,11 +2222,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2208
2222
|
state.rolesById = action.payload;
|
|
2209
2223
|
},
|
|
2210
2224
|
createdRole: (state, action) => {
|
|
2211
|
-
state.rolesById[action.payload.name] =
|
|
2225
|
+
state.rolesById[action.payload.name] = {
|
|
2226
|
+
...state.rolesById[action.payload.name],
|
|
2227
|
+
...action.payload
|
|
2228
|
+
};
|
|
2212
2229
|
},
|
|
2213
2230
|
removedRole: (state, action) => {
|
|
2214
|
-
|
|
2215
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2231
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2216
2232
|
state.rolesById = rolesById2;
|
|
2217
2233
|
},
|
|
2218
2234
|
setCustomColumns: (state, action) => {
|
|
@@ -2220,18 +2236,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2220
2236
|
},
|
|
2221
2237
|
setGlobalSettings: (state, action) => {
|
|
2222
2238
|
state.settingsInitialized = true;
|
|
2223
|
-
state.globalSettings =
|
|
2239
|
+
state.globalSettings = {
|
|
2240
|
+
...state.globalSettings,
|
|
2241
|
+
...action.payload
|
|
2242
|
+
};
|
|
2224
2243
|
},
|
|
2225
2244
|
setUserSettings: (state, action) => {
|
|
2226
2245
|
state.userSettingsInitialized = true;
|
|
2227
|
-
state.userSettings =
|
|
2246
|
+
state.userSettings = {
|
|
2247
|
+
...state.userSettings,
|
|
2248
|
+
...action.payload
|
|
2249
|
+
};
|
|
2228
2250
|
},
|
|
2229
2251
|
setTooltipState: (state, action) => {
|
|
2230
2252
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2231
2253
|
state.tooltips.byId[id].readState = readState;
|
|
2232
2254
|
},
|
|
2233
2255
|
setTooltipsState: (state, action) => {
|
|
2234
|
-
state.tooltips.byId =
|
|
2256
|
+
state.tooltips.byId = {
|
|
2257
|
+
...state.tooltips.byId,
|
|
2258
|
+
...action.payload
|
|
2259
|
+
};
|
|
2235
2260
|
},
|
|
2236
2261
|
setShowFeedbackDialog: (state, action) => {
|
|
2237
2262
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2248,7 +2273,16 @@ var actions8 = usersSlice.actions;
|
|
|
2248
2273
|
var usersSlice_default = usersSlice.reducer;
|
|
2249
2274
|
|
|
2250
2275
|
// src/actions.ts
|
|
2251
|
-
var actions_default =
|
|
2276
|
+
var actions_default = {
|
|
2277
|
+
...actions,
|
|
2278
|
+
...actions2,
|
|
2279
|
+
...actions3,
|
|
2280
|
+
...actions4,
|
|
2281
|
+
...actions5,
|
|
2282
|
+
...actions6,
|
|
2283
|
+
...actions7,
|
|
2284
|
+
...actions8
|
|
2285
|
+
};
|
|
2252
2286
|
|
|
2253
2287
|
// src/api/general-api.ts
|
|
2254
2288
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2259,18 +2293,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2259
2293
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2260
2294
|
var tokenCache = "";
|
|
2261
2295
|
var getSessionInfo = () => {
|
|
2262
|
-
|
|
2263
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2296
|
+
let sessionInfo = { ...emptySession };
|
|
2264
2297
|
try {
|
|
2265
|
-
sessionInfo = JSON.parse(
|
|
2266
|
-
} catch
|
|
2298
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2299
|
+
} catch {
|
|
2267
2300
|
}
|
|
2268
2301
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2269
2302
|
cleanUp();
|
|
2270
|
-
return
|
|
2303
|
+
return { ...emptySession };
|
|
2271
2304
|
}
|
|
2272
2305
|
if (!sessionInfo.token) {
|
|
2273
|
-
let jwtTokenFromCookie =
|
|
2306
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2274
2307
|
if (jwtTokenFromCookie) {
|
|
2275
2308
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2276
2309
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2298,8 +2331,7 @@ var maxSessionAge = 900;
|
|
|
2298
2331
|
|
|
2299
2332
|
// src/api/general-api.ts
|
|
2300
2333
|
var unauthorizedRedirect = (error) => {
|
|
2301
|
-
|
|
2302
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2334
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2303
2335
|
cleanUp();
|
|
2304
2336
|
window.location.replace("/ui/");
|
|
2305
2337
|
}
|
|
@@ -2309,7 +2341,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2309
2341
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2310
2342
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2311
2343
|
authenticatedRequest.interceptors.request.use(
|
|
2312
|
-
(config) =>
|
|
2344
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2313
2345
|
(error) => Promise.reject(error)
|
|
2314
2346
|
);
|
|
2315
2347
|
var Api = {
|
|
@@ -2317,7 +2349,7 @@ var Api = {
|
|
|
2317
2349
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2318
2350
|
patch: authenticatedRequest.patch,
|
|
2319
2351
|
post: authenticatedRequest.post,
|
|
2320
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2352
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2321
2353
|
put: authenticatedRequest.put,
|
|
2322
2354
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2323
2355
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2348,10 +2380,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2348
2380
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2349
2381
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2350
2382
|
[getFullVersionInformation, getFeatures],
|
|
2351
|
-
(
|
|
2352
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2353
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2354
|
-
}
|
|
2383
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2355
2384
|
);
|
|
2356
2385
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2357
2386
|
|
|
@@ -2368,8 +2397,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2368
2397
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2369
2398
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2370
2399
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2371
|
-
|
|
2372
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2400
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2373
2401
|
return selection.reduce((accu, id) => {
|
|
2374
2402
|
if (deploymentsById[id]) {
|
|
2375
2403
|
accu.push(deploymentsById[id]);
|
|
@@ -2413,7 +2441,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2413
2441
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2414
2442
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2415
2443
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2416
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2444
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2445
|
+
...filteringAttributes,
|
|
2417
2446
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2418
2447
|
}));
|
|
2419
2448
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2441,10 +2470,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2441
2470
|
return accu;
|
|
2442
2471
|
}, {})
|
|
2443
2472
|
);
|
|
2444
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2445
|
-
var _a;
|
|
2446
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2447
|
-
});
|
|
2473
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2448
2474
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2449
2475
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2450
2476
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2461,17 +2487,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2461
2487
|
[getAcceptedDevices, getDeviceLimit],
|
|
2462
2488
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2463
2489
|
);
|
|
2464
|
-
var
|
|
2465
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2466
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2467
|
-
return groups;
|
|
2468
|
-
});
|
|
2490
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2469
2491
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2470
2492
|
const groupNames = Object.keys(groupsById).sort();
|
|
2471
2493
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2472
2494
|
(accu, [groupname, group]) => {
|
|
2473
2495
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2474
|
-
const groupItem =
|
|
2496
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2475
2497
|
if (group.filters.length > 0) {
|
|
2476
2498
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2477
2499
|
accu.dynamic.push(groupItem);
|
|
@@ -2485,7 +2507,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2485
2507
|
},
|
|
2486
2508
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2487
2509
|
);
|
|
2488
|
-
return
|
|
2510
|
+
return { groupNames, ...groupedGroups };
|
|
2489
2511
|
});
|
|
2490
2512
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2491
2513
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2525,10 +2547,7 @@ var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
|
2525
2547
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2526
2548
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2527
2549
|
[getExternalIntegrations],
|
|
2528
|
-
(integrations) => integrations.filter((integration) =>
|
|
2529
|
-
var _a;
|
|
2530
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2531
|
-
})
|
|
2550
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2532
2551
|
);
|
|
2533
2552
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2534
2553
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2562,15 +2581,12 @@ var filterProcessors = {
|
|
|
2562
2581
|
var filterAliases = {
|
|
2563
2582
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2564
2583
|
};
|
|
2565
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2572
|
-
};
|
|
2573
|
-
});
|
|
2584
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2585
|
+
scope: filter.scope,
|
|
2586
|
+
attribute: filter.key,
|
|
2587
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2588
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2589
|
+
}));
|
|
2574
2590
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2575
2591
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2576
2592
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2580,14 +2596,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2580
2596
|
});
|
|
2581
2597
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2582
2598
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2583
|
-
return
|
|
2599
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2584
2600
|
}
|
|
2585
2601
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2586
2602
|
});
|
|
2587
2603
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2588
|
-
var _a;
|
|
2589
2604
|
let applicableFilters = [...filters];
|
|
2590
|
-
if (typeof group === "string" && !(
|
|
2605
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2591
2606
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2592
2607
|
}
|
|
2593
2608
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2608,12 +2623,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2608
2623
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2609
2624
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2610
2625
|
if (id && byId[id]) {
|
|
2611
|
-
accu.push(
|
|
2626
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2612
2627
|
}
|
|
2613
2628
|
return accu;
|
|
2614
2629
|
}, []);
|
|
2615
2630
|
};
|
|
2616
|
-
var mergePermissions = (existingPermissions =
|
|
2631
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2617
2632
|
(accu, [key, value]) => {
|
|
2618
2633
|
let values;
|
|
2619
2634
|
if (!accu[key]) {
|
|
@@ -2623,12 +2638,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2623
2638
|
if (Array.isArray(value)) {
|
|
2624
2639
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2625
2640
|
} else {
|
|
2626
|
-
values = mergePermissions(accu[key],
|
|
2641
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2627
2642
|
}
|
|
2628
2643
|
accu[key] = values;
|
|
2629
2644
|
return accu;
|
|
2630
2645
|
},
|
|
2631
|
-
|
|
2646
|
+
{ ...addedPermissions }
|
|
2632
2647
|
);
|
|
2633
2648
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2634
2649
|
(accu, roleId) => {
|
|
@@ -2637,20 +2652,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2637
2652
|
}
|
|
2638
2653
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2639
2654
|
},
|
|
2640
|
-
|
|
2655
|
+
{ ...emptyUiPermissions }
|
|
2641
2656
|
);
|
|
2642
2657
|
var progress = ({ loaded, total }) => {
|
|
2643
2658
|
let uploadProgress4 = loaded / total * 100;
|
|
2644
2659
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2645
2660
|
};
|
|
2646
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2647
|
-
var _a, _b2, _c, _d, _e;
|
|
2648
|
-
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;
|
|
2649
|
-
};
|
|
2661
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2650
2662
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2651
2663
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2652
2664
|
try {
|
|
2653
|
-
if (
|
|
2665
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2654
2666
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2655
2667
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2656
2668
|
}
|
|
@@ -2665,9 +2677,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2665
2677
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2666
2678
|
return accu;
|
|
2667
2679
|
}
|
|
2668
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2680
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2681
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2669
2682
|
[attribute.name]: attribute.value
|
|
2670
|
-
}
|
|
2683
|
+
};
|
|
2671
2684
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2672
2685
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2673
2686
|
}
|
|
@@ -2686,15 +2699,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2686
2699
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2687
2700
|
var getReleaseMappingDefaults = () => ({});
|
|
2688
2701
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2689
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2702
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2690
2703
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2691
2704
|
[getReleaseListState, getReleasesById],
|
|
2692
2705
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2693
2706
|
);
|
|
2694
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2695
|
-
var _a;
|
|
2696
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2697
|
-
});
|
|
2707
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2698
2708
|
|
|
2699
2709
|
// src/usersSlice/selectors.ts
|
|
2700
2710
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2703,10 +2713,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2703
2713
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2704
2714
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2705
2715
|
var getUsersById = (state) => state.users.byId;
|
|
2706
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2707
|
-
var _a;
|
|
2708
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2709
|
-
});
|
|
2716
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2710
2717
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2711
2718
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2712
2719
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2717,22 +2724,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2717
2724
|
[getTooltipsById, getUserSettings],
|
|
2718
2725
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2719
2726
|
(accu, [id, value]) => {
|
|
2720
|
-
accu[id] =
|
|
2727
|
+
accu[id] = { ...accu[id], ...value };
|
|
2721
2728
|
return accu;
|
|
2722
2729
|
},
|
|
2723
|
-
|
|
2730
|
+
{ ...tooltips }
|
|
2724
2731
|
)
|
|
2725
2732
|
);
|
|
2726
2733
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2727
2734
|
[getCurrentUser],
|
|
2728
2735
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2729
2736
|
);
|
|
2730
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2737
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2731
2738
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2732
|
-
interval:
|
|
2733
|
-
intervalUnit:
|
|
2739
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2740
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2734
2741
|
}));
|
|
2735
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2742
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2736
2743
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2737
2744
|
|
|
2738
2745
|
// src/commonSelectors.ts
|
|
@@ -2751,8 +2758,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2751
2758
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2752
2759
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2753
2760
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2754
|
-
|
|
2755
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2761
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2756
2762
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2757
2763
|
return { isAdmin, uiPermissions };
|
|
2758
2764
|
}
|
|
@@ -2821,10 +2827,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2821
2827
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2822
2828
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2823
2829
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2824
|
-
const updateAttribute =
|
|
2830
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2825
2831
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2826
2832
|
const attributes = [
|
|
2827
|
-
...previousFilters.map((item) =>
|
|
2833
|
+
...previousFilters.map((item) => ({
|
|
2834
|
+
...item,
|
|
2828
2835
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2829
2836
|
category: "recently used",
|
|
2830
2837
|
priority: 0
|
|
@@ -2842,14 +2849,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2842
2849
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2843
2850
|
}
|
|
2844
2851
|
);
|
|
2845
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
});
|
|
2852
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2853
|
+
...remainder,
|
|
2854
|
+
...onboarding,
|
|
2855
|
+
complete: onboarding.complete || complete,
|
|
2856
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2857
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2858
|
+
}));
|
|
2853
2859
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2854
2860
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2855
2861
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2870,12 +2876,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2870
2876
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2871
2877
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2872
2878
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2873
|
-
|
|
2874
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2879
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2875
2880
|
const { devices = {} } = deployment;
|
|
2876
2881
|
return {
|
|
2877
2882
|
deployment,
|
|
2878
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2883
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2879
2884
|
};
|
|
2880
2885
|
}
|
|
2881
2886
|
);
|
|
@@ -2890,8 +2895,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2890
2895
|
}, {})
|
|
2891
2896
|
);
|
|
2892
2897
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2893
|
-
|
|
2894
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2898
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2895
2899
|
if (staticOnly) {
|
|
2896
2900
|
return Object.keys(uiPermissions.groups).sort();
|
|
2897
2901
|
}
|
|
@@ -2925,9 +2929,9 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2925
2929
|
if (auditlogEvent) {
|
|
2926
2930
|
const { object = {} } = auditlogEvent;
|
|
2927
2931
|
const { device = {}, id, type } = object;
|
|
2928
|
-
auditlogDevice = type === "device" ?
|
|
2932
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2929
2933
|
}
|
|
2930
|
-
return
|
|
2934
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2931
2935
|
});
|
|
2932
2936
|
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2933
2937
|
if (service_provider) {
|
|
@@ -2979,8 +2983,9 @@ var sessionReducer = (state, action) => {
|
|
|
2979
2983
|
return rootReducer(state, action);
|
|
2980
2984
|
};
|
|
2981
2985
|
var getConfiguredStore = (options = {}) => {
|
|
2982
|
-
const
|
|
2983
|
-
return (0, import_toolkit16.configureStore)(
|
|
2986
|
+
const { preloadedState = {}, ...config } = options;
|
|
2987
|
+
return (0, import_toolkit16.configureStore)({
|
|
2988
|
+
...config,
|
|
2984
2989
|
preloadedState,
|
|
2985
2990
|
reducer: sessionReducer,
|
|
2986
2991
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2993,7 +2998,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2993
2998
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2994
2999
|
}
|
|
2995
3000
|
})
|
|
2996
|
-
})
|
|
3001
|
+
});
|
|
2997
3002
|
};
|
|
2998
3003
|
var store = getConfiguredStore({
|
|
2999
3004
|
preloadedState: {}
|
|
@@ -3013,17 +3018,16 @@ var dateFunctionMap = {
|
|
|
3013
3018
|
setDays: "setDate"
|
|
3014
3019
|
};
|
|
3015
3020
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
3016
|
-
var _a, _b2;
|
|
3017
3021
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
3018
3022
|
const today = /* @__PURE__ */ new Date();
|
|
3019
3023
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
3020
|
-
const setter =
|
|
3021
|
-
const getter =
|
|
3024
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3025
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
3022
3026
|
today[setter](today[getter]() - interval);
|
|
3023
3027
|
let value;
|
|
3024
3028
|
try {
|
|
3025
3029
|
value = today.toISOString();
|
|
3026
|
-
} catch
|
|
3030
|
+
} catch {
|
|
3027
3031
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
3028
3032
|
}
|
|
3029
3033
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3064,37 +3068,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3064
3068
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3065
3069
|
return accu;
|
|
3066
3070
|
},
|
|
3067
|
-
{ latestVersions:
|
|
3071
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3068
3072
|
);
|
|
3069
3073
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3070
3074
|
return Promise.resolve(
|
|
3071
3075
|
dispatch(
|
|
3072
|
-
actions.setVersionInformation(
|
|
3076
|
+
actions.setVersionInformation({
|
|
3077
|
+
...latestVersions,
|
|
3073
3078
|
backend: info,
|
|
3074
3079
|
GUI: info,
|
|
3075
3080
|
latestRelease: {
|
|
3076
3081
|
releaseDate: latestRelease.release_date,
|
|
3077
3082
|
repos: latestRepos
|
|
3078
3083
|
}
|
|
3079
|
-
})
|
|
3084
|
+
})
|
|
3080
3085
|
)
|
|
3081
3086
|
);
|
|
3082
3087
|
});
|
|
3083
3088
|
});
|
|
3084
3089
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3085
3090
|
const currentState = getSearchState(getState());
|
|
3086
|
-
let nextState =
|
|
3087
|
-
|
|
3088
|
-
|
|
3091
|
+
let nextState = {
|
|
3092
|
+
...currentState,
|
|
3093
|
+
...searchState,
|
|
3094
|
+
sort: {
|
|
3095
|
+
...currentState.sort,
|
|
3096
|
+
...searchState.sort
|
|
3097
|
+
}
|
|
3098
|
+
};
|
|
3089
3099
|
let tasks = [];
|
|
3090
|
-
const
|
|
3091
|
-
const
|
|
3100
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3101
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3092
3102
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3093
3103
|
nextState.isSearching = true;
|
|
3094
3104
|
tasks.push(
|
|
3095
3105
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3096
3106
|
const searchResult = results[results.length - 1];
|
|
3097
|
-
return dispatch(actions.setSearchState(
|
|
3107
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3098
3108
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3099
3109
|
);
|
|
3100
3110
|
}
|
|
@@ -3110,19 +3120,20 @@ var import_toolkit18 = require("@reduxjs/toolkit");
|
|
|
3110
3120
|
var import_axios2 = require("axios");
|
|
3111
3121
|
var import_pluralize = __toESM(require_pluralize());
|
|
3112
3122
|
|
|
3113
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3114
|
-
var
|
|
3115
|
-
var
|
|
3116
|
-
var poolPtr = rnds8Pool.length;
|
|
3123
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3124
|
+
var getRandomValues;
|
|
3125
|
+
var rnds8 = new Uint8Array(16);
|
|
3117
3126
|
function rng() {
|
|
3118
|
-
if (
|
|
3119
|
-
|
|
3120
|
-
|
|
3127
|
+
if (!getRandomValues) {
|
|
3128
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3129
|
+
if (!getRandomValues) {
|
|
3130
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3131
|
+
}
|
|
3121
3132
|
}
|
|
3122
|
-
return
|
|
3133
|
+
return getRandomValues(rnds8);
|
|
3123
3134
|
}
|
|
3124
3135
|
|
|
3125
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3136
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3126
3137
|
var byteToHex = [];
|
|
3127
3138
|
for (let i = 0; i < 256; ++i) {
|
|
3128
3139
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3131,13 +3142,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3131
3142
|
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]];
|
|
3132
3143
|
}
|
|
3133
3144
|
|
|
3134
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3135
|
-
var
|
|
3145
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3146
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3136
3147
|
var native_default = {
|
|
3137
|
-
randomUUID
|
|
3148
|
+
randomUUID
|
|
3138
3149
|
};
|
|
3139
3150
|
|
|
3140
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3151
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3141
3152
|
function v4(options, buf, offset) {
|
|
3142
3153
|
if (native_default.randomUUID && !buf && !options) {
|
|
3143
3154
|
return native_default.randomUUID();
|
|
@@ -3179,14 +3190,13 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3179
3190
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3180
3191
|
const state = getGroupsById(getState());
|
|
3181
3192
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3182
|
-
|
|
3183
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3193
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3184
3194
|
accu[id] = group;
|
|
3185
3195
|
}
|
|
3186
3196
|
return accu;
|
|
3187
3197
|
}, {});
|
|
3188
3198
|
const groups = res.data.reduce((accu, group) => {
|
|
3189
|
-
accu[group] =
|
|
3199
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3190
3200
|
return accu;
|
|
3191
3201
|
}, dynamicGroups);
|
|
3192
3202
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3244,7 +3254,7 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3244
3254
|
() => Promise.resolve(
|
|
3245
3255
|
dispatch(
|
|
3246
3256
|
actions3.addGroup({
|
|
3247
|
-
group:
|
|
3257
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3248
3258
|
groupName: group
|
|
3249
3259
|
})
|
|
3250
3260
|
)
|
|
@@ -3272,20 +3282,19 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3272
3282
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3273
3283
|
const state = getGroupsById(getState());
|
|
3274
3284
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3275
|
-
|
|
3276
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3285
|
+
if (!(group.id || group.filters?.length)) {
|
|
3277
3286
|
accu[id] = group;
|
|
3278
3287
|
}
|
|
3279
3288
|
return accu;
|
|
3280
3289
|
}, {});
|
|
3281
3290
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3282
|
-
accu[filter.name] =
|
|
3291
|
+
accu[filter.name] = {
|
|
3283
3292
|
deviceIds: [],
|
|
3284
|
-
total: 0
|
|
3285
|
-
|
|
3293
|
+
total: 0,
|
|
3294
|
+
...state[filter.name],
|
|
3286
3295
|
id: filter.id,
|
|
3287
3296
|
filters: mapTermsToFilters(filter.terms)
|
|
3288
|
-
}
|
|
3297
|
+
};
|
|
3289
3298
|
return accu;
|
|
3290
3299
|
}, staticGroups);
|
|
3291
3300
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3325,10 +3334,9 @@ var removeDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/r
|
|
|
3325
3334
|
);
|
|
3326
3335
|
});
|
|
3327
3336
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3328
|
-
var _a;
|
|
3329
3337
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3330
3338
|
const selectedGroup = groupsState.byId[groupName];
|
|
3331
|
-
const groupFilterLength =
|
|
3339
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3332
3340
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3333
3341
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3334
3342
|
};
|
|
@@ -3351,7 +3359,6 @@ var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3351
3359
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3352
3360
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3353
3361
|
(accu, device) => {
|
|
3354
|
-
var _a, _b2, _c;
|
|
3355
3362
|
const stateDevice = getDeviceById(state, device.id);
|
|
3356
3363
|
const {
|
|
3357
3364
|
attributes: storedAttributes = {},
|
|
@@ -3361,29 +3368,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3361
3368
|
group: storedGroup
|
|
3362
3369
|
} = stateDevice;
|
|
3363
3370
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3364
|
-
device.tags =
|
|
3365
|
-
device.group =
|
|
3366
|
-
device.monitor =
|
|
3367
|
-
device.identity_data =
|
|
3371
|
+
device.tags = { ...storedTags, ...tags };
|
|
3372
|
+
device.group = system.group ?? storedGroup;
|
|
3373
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3374
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3368
3375
|
device.status = status ? status : device.status || identity.status;
|
|
3369
|
-
device.check_in_time_rounded =
|
|
3370
|
-
device.check_in_time_exact =
|
|
3376
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3377
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3371
3378
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3372
3379
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3373
3380
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3374
3381
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3375
|
-
device.attributes = device.attributes ?
|
|
3376
|
-
accu.devicesById[device.id] =
|
|
3382
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3383
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3377
3384
|
accu.ids.push(device.id);
|
|
3378
3385
|
return accu;
|
|
3379
3386
|
},
|
|
3380
3387
|
{ ids, devicesById: {} }
|
|
3381
3388
|
);
|
|
3382
3389
|
var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3383
|
-
const
|
|
3390
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3384
3391
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3385
3392
|
return Promise.resolve(
|
|
3386
|
-
dispatch(getDevicesByStatus2(
|
|
3393
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3387
3394
|
).unwrap().then((results) => {
|
|
3388
3395
|
if (!group) {
|
|
3389
3396
|
return Promise.resolve();
|
|
@@ -3397,7 +3404,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3397
3404
|
dispatch(
|
|
3398
3405
|
actions3.addGroup({
|
|
3399
3406
|
group: {
|
|
3400
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3407
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3401
3408
|
total
|
|
3402
3409
|
},
|
|
3403
3410
|
groupName: group
|
|
@@ -3546,27 +3553,26 @@ var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3546
3553
|
);
|
|
3547
3554
|
var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
|
|
3548
3555
|
`${sliceName3}/setDeviceListState`,
|
|
3549
|
-
(
|
|
3550
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3551
|
-
var _c;
|
|
3556
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3552
3557
|
const currentState = getDeviceListState(getState());
|
|
3553
3558
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3554
|
-
let nextState =
|
|
3559
|
+
let nextState = {
|
|
3560
|
+
...currentState,
|
|
3555
3561
|
setOnly: false,
|
|
3556
|
-
refreshTrigger
|
|
3557
|
-
|
|
3558
|
-
sort:
|
|
3559
|
-
}
|
|
3562
|
+
refreshTrigger,
|
|
3563
|
+
...selectionState,
|
|
3564
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3565
|
+
};
|
|
3560
3566
|
let tasks = [];
|
|
3561
|
-
const
|
|
3562
|
-
const
|
|
3567
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3568
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3563
3569
|
if (!nextState.setOnly && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3564
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3570
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3565
3571
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3566
3572
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3567
3573
|
nextState.isLoading = true;
|
|
3568
3574
|
tasks.push(
|
|
3569
|
-
dispatch(getDevicesByStatus2(
|
|
3575
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3570
3576
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3571
3577
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3572
3578
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3591,8 +3597,8 @@ var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/
|
|
|
3591
3597
|
} = options;
|
|
3592
3598
|
const state = getState();
|
|
3593
3599
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3594
|
-
filters: filterSelection
|
|
3595
|
-
group: group
|
|
3600
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3601
|
+
group: group ?? getSelectedGroup(state),
|
|
3596
3602
|
groups: state.devices.groups,
|
|
3597
3603
|
offlineThreshold: state.app.offlineThreshold,
|
|
3598
3604
|
selectedIssues,
|
|
@@ -3653,7 +3659,7 @@ var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3
|
|
|
3653
3659
|
});
|
|
3654
3660
|
var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3655
3661
|
const state = getState();
|
|
3656
|
-
let options =
|
|
3662
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3657
3663
|
const { page = defaultPage, searchTerm, sortOptions = [] } = options;
|
|
3658
3664
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3659
3665
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -3788,8 +3794,7 @@ var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
3788
3794
|
({ data: auditLogEntries }) => {
|
|
3789
3795
|
const { start, end } = auditLogEntries.reduce(
|
|
3790
3796
|
(accu, item) => {
|
|
3791
|
-
|
|
3792
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
3797
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
3793
3798
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
3794
3799
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
3795
3800
|
}
|
|
@@ -3896,8 +3901,7 @@ var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3896
3901
|
var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
3897
3902
|
`${sliceName3}/getDeviceConfig`,
|
|
3898
3903
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
3899
|
-
|
|
3900
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
3904
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
3901
3905
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
3902
3906
|
}
|
|
3903
3907
|
})
|
|
@@ -3909,15 +3913,14 @@ var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3909
3913
|
var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
3910
3914
|
`${sliceName3}/applyDeviceConfig`,
|
|
3911
3915
|
({ 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 }) => {
|
|
3912
|
-
var _a;
|
|
3913
3916
|
const device = getDeviceById(getState(), deviceId);
|
|
3914
3917
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
3915
3918
|
let tasks = [
|
|
3916
|
-
dispatch(actions3.receivedDevice(
|
|
3919
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
3917
3920
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
3918
3921
|
];
|
|
3919
3922
|
if (isDefault && canManageUsers) {
|
|
3920
|
-
const { previous } =
|
|
3923
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
3921
3924
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
3922
3925
|
}
|
|
3923
3926
|
return Promise.all(tasks);
|
|
@@ -3933,21 +3936,21 @@ var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3933
3936
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
3934
3937
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
3935
3938
|
{ headers }
|
|
3936
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
3939
|
+
).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(setSnackbar2("Device name changed"))]));
|
|
3937
3940
|
})
|
|
3938
3941
|
)
|
|
3939
3942
|
);
|
|
3940
3943
|
var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
3941
3944
|
let providerResult = {};
|
|
3942
3945
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
3943
|
-
providerResult =
|
|
3946
|
+
providerResult = { ...data, twinError: "" };
|
|
3944
3947
|
}).catch((err) => {
|
|
3945
3948
|
providerResult = {
|
|
3946
3949
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
3947
3950
|
};
|
|
3948
3951
|
}).finally(() => {
|
|
3949
3952
|
const device = getDeviceById(getState(), deviceId);
|
|
3950
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
3953
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
3951
3954
|
});
|
|
3952
3955
|
});
|
|
3953
3956
|
var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
@@ -3963,7 +3966,7 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3963
3966
|
const { twinsByIntegration = {} } = device;
|
|
3964
3967
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
3965
3968
|
return Promise.resolve(
|
|
3966
|
-
dispatch(actions3.receivedDevice(
|
|
3969
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
3967
3970
|
);
|
|
3968
3971
|
})
|
|
3969
3972
|
);
|
|
@@ -3984,8 +3987,8 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
3984
3987
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
3985
3988
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
3986
3989
|
const filters = [
|
|
3987
|
-
|
|
3988
|
-
|
|
3990
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
3991
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
3989
3992
|
];
|
|
3990
3993
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
3991
3994
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -3997,11 +4000,12 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
3997
4000
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
3998
4001
|
const state2 = getState();
|
|
3999
4002
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4000
|
-
const device =
|
|
4003
|
+
const device = {
|
|
4004
|
+
...getDeviceById(state2, id),
|
|
4001
4005
|
systemDeviceIds: ids,
|
|
4002
4006
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4003
|
-
}
|
|
4004
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4007
|
+
};
|
|
4008
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4005
4009
|
});
|
|
4006
4010
|
});
|
|
4007
4011
|
var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4009,9 +4013,9 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4009
4013
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4010
4014
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4011
4015
|
const filters = [
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4016
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4017
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4018
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4015
4019
|
];
|
|
4016
4020
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4017
4021
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4058,7 +4062,7 @@ var { page: defaultPage2, perPage: defaultPerPage2 } = DEVICE_LIST_DEFAULTS;
|
|
|
4058
4062
|
var cutoffLength = 75;
|
|
4059
4063
|
var ellipsis = "...";
|
|
4060
4064
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4061
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4065
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4062
4066
|
var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4063
4067
|
const { page = defaultPage2, perPage = defaultPerPage2, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4064
4068
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4076,14 +4080,15 @@ var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4
|
|
|
4076
4080
|
});
|
|
4077
4081
|
var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4078
4082
|
const state = getState();
|
|
4079
|
-
const
|
|
4080
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4083
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4084
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4085
|
+
...remainder,
|
|
4081
4086
|
filters,
|
|
4082
4087
|
group,
|
|
4083
4088
|
offlineThreshold: state.app.offlineThreshold,
|
|
4084
4089
|
selectedIssues: [type],
|
|
4085
4090
|
status
|
|
4086
|
-
})
|
|
4091
|
+
});
|
|
4087
4092
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4088
4093
|
page: 1,
|
|
4089
4094
|
per_page: 1,
|
|
@@ -4135,21 +4140,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4135
4140
|
return steps[progress2];
|
|
4136
4141
|
};
|
|
4137
4142
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4138
|
-
var _a;
|
|
4139
4143
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4140
4144
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4141
4145
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4142
4146
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4143
|
-
let deviceType =
|
|
4147
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4144
4148
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4145
4149
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4146
|
-
return
|
|
4150
|
+
return {
|
|
4151
|
+
...onboardingState,
|
|
4147
4152
|
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)),
|
|
4148
4153
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4149
4154
|
deviceType,
|
|
4150
4155
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4151
4156
|
progress: progress2
|
|
4152
|
-
}
|
|
4157
|
+
};
|
|
4153
4158
|
};
|
|
4154
4159
|
var getOnboardingState2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4155
4160
|
const state = getState();
|
|
@@ -4207,7 +4212,7 @@ var advanceOnboarding = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4207
4212
|
return;
|
|
4208
4213
|
}
|
|
4209
4214
|
const madeProgress = steps[stepIndex + 1];
|
|
4210
|
-
const state =
|
|
4215
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4211
4216
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4212
4217
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4213
4218
|
});
|
|
@@ -4290,8 +4295,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4290
4295
|
({ 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())))
|
|
4291
4296
|
);
|
|
4292
4297
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4293
|
-
const userId =
|
|
4294
|
-
const detail =
|
|
4298
|
+
const userId = userFilter?.id || userFilter;
|
|
4299
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4295
4300
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4296
4301
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4297
4302
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4318,12 +4323,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4318
4323
|
);
|
|
4319
4324
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4320
4325
|
const currentState = getAuditlogState(getState());
|
|
4321
|
-
let nextState =
|
|
4322
|
-
|
|
4323
|
-
|
|
4326
|
+
let nextState = {
|
|
4327
|
+
...currentState,
|
|
4328
|
+
...selectionState,
|
|
4329
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4330
|
+
};
|
|
4324
4331
|
let tasks = [];
|
|
4325
|
-
const
|
|
4326
|
-
const
|
|
4332
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4333
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4327
4334
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4328
4335
|
nextState.isLoading = true;
|
|
4329
4336
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4335,27 +4342,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4335
4342
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4336
4343
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar3("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
4337
4344
|
});
|
|
4338
|
-
var tenantListRetrieval = (config) =>
|
|
4345
|
+
var tenantListRetrieval = async (config) => {
|
|
4339
4346
|
const { page, perPage } = config;
|
|
4340
4347
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4341
|
-
const tenantList =
|
|
4348
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4342
4349
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4343
4350
|
return [tenantList.data, Number(totalCount)];
|
|
4344
|
-
}
|
|
4345
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4351
|
+
};
|
|
4352
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4346
4353
|
const currentState = getTenantsList(getState());
|
|
4347
|
-
const [tenants, pageCount] =
|
|
4348
|
-
dispatch(actions6.setTenantListState(
|
|
4349
|
-
})
|
|
4350
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4354
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4355
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4356
|
+
});
|
|
4357
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4351
4358
|
const currentState = getTenantsList(getState());
|
|
4352
|
-
const nextState =
|
|
4359
|
+
const nextState = {
|
|
4360
|
+
...currentState,
|
|
4361
|
+
...selectionState
|
|
4362
|
+
};
|
|
4353
4363
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4354
|
-
const [tenants, pageCount] =
|
|
4355
|
-
return dispatch(actions6.setTenantListState(
|
|
4364
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4365
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4356
4366
|
}
|
|
4357
|
-
return dispatch(actions6.setTenantListState(
|
|
4358
|
-
})
|
|
4367
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4368
|
+
});
|
|
4359
4369
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4360
4370
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4361
4371
|
const tasks = [Promise.resolve(dispatch(setSnackbar3("Device Limit was changed successfully")))];
|
|
@@ -4398,10 +4408,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4398
4408
|
);
|
|
4399
4409
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4400
4410
|
`${sliceName6}/createIntegration`,
|
|
4401
|
-
(
|
|
4402
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4403
|
-
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(setSnackbar3("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
4404
|
-
}
|
|
4411
|
+
({ 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(setSnackbar3("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
4405
4412
|
);
|
|
4406
4413
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4407
4414
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4422,9 +4429,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4422
4429
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4423
4430
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4424
4431
|
const integrations = data.reduce((accu, item) => {
|
|
4425
|
-
|
|
4426
|
-
const
|
|
4427
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4432
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4433
|
+
const integration = { ...existingIntegration, ...item };
|
|
4428
4434
|
accu.push(integration);
|
|
4429
4435
|
return accu;
|
|
4430
4436
|
}, []);
|
|
@@ -4476,7 +4482,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4476
4482
|
`${sliceName6}/getSsoConfigById`,
|
|
4477
4483
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4478
4484
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4479
|
-
return sso ? Promise.resolve(
|
|
4485
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4480
4486
|
})
|
|
4481
4487
|
);
|
|
4482
4488
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4495,20 +4501,21 @@ var { setSnackbar: setSnackbar4, initUpload: initUpload2, uploadProgress: upload
|
|
|
4495
4501
|
var { page: defaultPage4, perPage: defaultPerPage4 } = DEVICE_LIST_DEFAULTS;
|
|
4496
4502
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4497
4503
|
var flattenRelease = (release, stateRelease) => {
|
|
4498
|
-
|
|
4499
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4504
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4500
4505
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4501
4506
|
(accu, item) => {
|
|
4502
|
-
var _a2;
|
|
4503
4507
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4504
|
-
const stateArtifact =
|
|
4508
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4505
4509
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4506
|
-
accu.artifacts.push(
|
|
4510
|
+
accu.artifacts.push({
|
|
4511
|
+
...stateArtifact,
|
|
4512
|
+
...item
|
|
4513
|
+
});
|
|
4507
4514
|
return accu;
|
|
4508
4515
|
},
|
|
4509
4516
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4510
4517
|
);
|
|
4511
|
-
return
|
|
4518
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4512
4519
|
};
|
|
4513
4520
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4514
4521
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4526,17 +4533,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4526
4533
|
{ release: null, index: -1 }
|
|
4527
4534
|
);
|
|
4528
4535
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4529
|
-
var _a;
|
|
4530
4536
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4531
4537
|
if (!release || index === -1) {
|
|
4532
4538
|
return;
|
|
4533
4539
|
}
|
|
4534
4540
|
const releaseArtifacts = [...release.artifacts];
|
|
4535
4541
|
const artifact = releaseArtifacts[index];
|
|
4536
|
-
const { key, name, version } = (
|
|
4542
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4537
4543
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4538
4544
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4539
|
-
filters: [
|
|
4545
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4540
4546
|
});
|
|
4541
4547
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4542
4548
|
page: 1,
|
|
@@ -4550,10 +4556,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4550
4556
|
}
|
|
4551
4557
|
const installCount = Number(headers[headerNames.total]);
|
|
4552
4558
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4553
|
-
releaseArtifacts2[index2] =
|
|
4554
|
-
release2 =
|
|
4559
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4560
|
+
release2 = {
|
|
4561
|
+
...release2,
|
|
4555
4562
|
artifacts: releaseArtifacts2
|
|
4556
|
-
}
|
|
4563
|
+
};
|
|
4557
4564
|
return dispatch(actions7.receiveRelease(release2));
|
|
4558
4565
|
});
|
|
4559
4566
|
});
|
|
@@ -4565,12 +4572,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4565
4572
|
return dispatch(getReleases());
|
|
4566
4573
|
}
|
|
4567
4574
|
const releaseArtifacts = [...release.artifacts];
|
|
4568
|
-
releaseArtifacts[index] =
|
|
4575
|
+
releaseArtifacts[index] = {
|
|
4576
|
+
...releaseArtifacts[index],
|
|
4569
4577
|
url: response.data.uri
|
|
4570
|
-
}
|
|
4571
|
-
release =
|
|
4578
|
+
};
|
|
4579
|
+
release = {
|
|
4580
|
+
...release,
|
|
4572
4581
|
artifacts: releaseArtifacts
|
|
4573
|
-
}
|
|
4582
|
+
};
|
|
4574
4583
|
return dispatch(actions7.receiveRelease(release));
|
|
4575
4584
|
})
|
|
4576
4585
|
);
|
|
@@ -4695,12 +4704,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4695
4704
|
});
|
|
4696
4705
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4697
4706
|
const currentState = getState().releases.releasesList;
|
|
4698
|
-
let nextState =
|
|
4699
|
-
|
|
4700
|
-
|
|
4707
|
+
let nextState = {
|
|
4708
|
+
...currentState,
|
|
4709
|
+
...selectionState,
|
|
4710
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4711
|
+
};
|
|
4701
4712
|
let tasks = [];
|
|
4702
|
-
const
|
|
4703
|
-
const
|
|
4713
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4714
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4704
4715
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4705
4716
|
nextState.isLoading = true;
|
|
4706
4717
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4719,29 +4730,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4719
4730
|
);
|
|
4720
4731
|
};
|
|
4721
4732
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4722
|
-
let releaseListState =
|
|
4733
|
+
let releaseListState = { ...state.releasesList };
|
|
4723
4734
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4724
4735
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4725
4736
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4726
4737
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4727
4738
|
if (searchOnly) {
|
|
4728
|
-
releaseListState =
|
|
4739
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4729
4740
|
} else {
|
|
4730
|
-
releaseListState =
|
|
4741
|
+
releaseListState = {
|
|
4742
|
+
...releaseListState,
|
|
4731
4743
|
releaseIds,
|
|
4732
4744
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4733
4745
|
total: !isFiltering ? total : state.releasesList.total
|
|
4734
|
-
}
|
|
4746
|
+
};
|
|
4735
4747
|
}
|
|
4736
4748
|
return releaseListState;
|
|
4737
4749
|
};
|
|
4738
4750
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4739
|
-
const config =
|
|
4751
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4740
4752
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4741
4753
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4742
4754
|
const state = getState().releases;
|
|
4743
4755
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4744
|
-
const combinedReleases =
|
|
4756
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4745
4757
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4746
4758
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4747
4759
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4762,7 +4774,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4762
4774
|
`${sliceName7}/updateReleaseInfo`,
|
|
4763
4775
|
({ 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(() => {
|
|
4764
4776
|
return Promise.all([
|
|
4765
|
-
dispatch(actions7.receiveRelease(
|
|
4777
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4766
4778
|
dispatch(setSnackbar4("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4767
4779
|
]);
|
|
4768
4780
|
})
|
|
@@ -4771,7 +4783,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4771
4783
|
`${sliceName7}/setReleaseTags`,
|
|
4772
4784
|
({ 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(() => {
|
|
4773
4785
|
return Promise.all([
|
|
4774
|
-
dispatch(actions7.receiveRelease(
|
|
4786
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4775
4787
|
dispatch(setSnackbar4("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4776
4788
|
]);
|
|
4777
4789
|
})
|
|
@@ -4788,19 +4800,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4788
4800
|
// src/api/users-api.ts
|
|
4789
4801
|
var import_axios4 = __toESM(require("axios"));
|
|
4790
4802
|
var Api2 = {
|
|
4791
|
-
postLogin: (url,
|
|
4792
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4793
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4794
|
-
var _a2;
|
|
4795
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4796
|
-
});
|
|
4797
|
-
},
|
|
4803
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios4.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
4798
4804
|
putVerifyTFA: (url, userData) => {
|
|
4799
4805
|
let body = {};
|
|
4800
4806
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4801
4807
|
body = { token2fa: userData.token2fa };
|
|
4802
4808
|
}
|
|
4803
|
-
return import_axios4.default.put(url, body,
|
|
4809
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4804
4810
|
}
|
|
4805
4811
|
};
|
|
4806
4812
|
var users_api_default = Api2;
|
|
@@ -4828,43 +4834,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4828
4834
|
};
|
|
4829
4835
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4830
4836
|
`${sliceName8}/loginUser`,
|
|
4831
|
-
(
|
|
4832
|
-
|
|
4833
|
-
return
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
Promise.
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
window.
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
);
|
|
4866
|
-
});
|
|
4867
|
-
}
|
|
4837
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
4838
|
+
cleanUp();
|
|
4839
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
4840
|
+
}).then(({ text: response, contentType }) => {
|
|
4841
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
4842
|
+
const { id, kind } = response;
|
|
4843
|
+
const type = kind.split("/")[1];
|
|
4844
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
4845
|
+
window.location.replace(ssoLoginUrl);
|
|
4846
|
+
return;
|
|
4847
|
+
}
|
|
4848
|
+
const token = response;
|
|
4849
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
4850
|
+
return;
|
|
4851
|
+
}
|
|
4852
|
+
let now = /* @__PURE__ */ new Date();
|
|
4853
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
4854
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
4855
|
+
setSessionInfo({ token, expiresAt });
|
|
4856
|
+
cookies5.remove("JWT", { path: "/" });
|
|
4857
|
+
return (
|
|
4858
|
+
// @ts-ignore
|
|
4859
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
4860
|
+
cleanUp();
|
|
4861
|
+
return Promise.reject(dispatch(setSnackbar5(extractErrorMessage(e))));
|
|
4862
|
+
}).then(() => {
|
|
4863
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
4864
|
+
if (window.location.pathname !== "/ui/") {
|
|
4865
|
+
window.location.replace("/ui/");
|
|
4866
|
+
}
|
|
4867
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
4868
|
+
})
|
|
4869
|
+
);
|
|
4870
|
+
})
|
|
4868
4871
|
);
|
|
4869
4872
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4870
4873
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4881,7 +4884,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4881
4884
|
return Promise.reject();
|
|
4882
4885
|
}
|
|
4883
4886
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4884
|
-
setSessionInfo(
|
|
4887
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4885
4888
|
window.location.reload();
|
|
4886
4889
|
});
|
|
4887
4890
|
});
|
|
@@ -4944,13 +4947,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4944
4947
|
);
|
|
4945
4948
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
4946
4949
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
4947
|
-
const userId = currentUserId
|
|
4950
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
4948
4951
|
const storageKey = `${userId}-column-widths`;
|
|
4949
4952
|
let customColumns = [];
|
|
4950
4953
|
if (!columns) {
|
|
4951
4954
|
try {
|
|
4952
4955
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
4953
|
-
} catch
|
|
4956
|
+
} catch {
|
|
4954
4957
|
}
|
|
4955
4958
|
} else {
|
|
4956
4959
|
customColumns = columns;
|
|
@@ -4979,10 +4982,7 @@ var userActions = {
|
|
|
4979
4982
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
4980
4983
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4981
4984
|
`${sliceName8}/createUser`,
|
|
4982
|
-
(
|
|
4983
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
4984
|
-
return general_api_default.post(`${useradmApiUrlv1}/users`, __spreadProps(__spreadValues({}, userData), { send_reset_password: shouldResetPassword })).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch));
|
|
4985
|
-
}
|
|
4985
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
4986
4986
|
);
|
|
4987
4987
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4988
4988
|
`${sliceName8}/removeUser`,
|
|
@@ -4993,15 +4993,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4993
4993
|
);
|
|
4994
4994
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4995
4995
|
`${sliceName8}/editUser`,
|
|
4996
|
-
(
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
()
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
])
|
|
5003
|
-
);
|
|
5004
|
-
}
|
|
4996
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
4997
|
+
() => Promise.all([
|
|
4998
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
4999
|
+
dispatch(setSnackbar5(userActions.edit.successMessage))
|
|
5000
|
+
])
|
|
5001
|
+
)
|
|
5005
5002
|
);
|
|
5006
5003
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5007
5004
|
const { id } = getOrganization(getState());
|
|
@@ -5036,7 +5033,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5036
5033
|
}
|
|
5037
5034
|
return accu;
|
|
5038
5035
|
},
|
|
5039
|
-
|
|
5036
|
+
{ ...emptyUiPermissions }
|
|
5040
5037
|
);
|
|
5041
5038
|
var permissionActionTypes = {
|
|
5042
5039
|
any: mapHttpPermission,
|
|
@@ -5059,20 +5056,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5059
5056
|
}, existingPermissions);
|
|
5060
5057
|
var tryParseCustomPermission = (permission) => {
|
|
5061
5058
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5062
|
-
const result = mergePermissions(
|
|
5059
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5063
5060
|
return { isCustom: true, permission, result };
|
|
5064
5061
|
};
|
|
5065
5062
|
var customPermissionHandler = (accu, permission) => {
|
|
5066
5063
|
let processor = tryParseCustomPermission(permission);
|
|
5067
|
-
return
|
|
5064
|
+
return {
|
|
5065
|
+
...accu,
|
|
5068
5066
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5069
5067
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5070
|
-
}
|
|
5068
|
+
};
|
|
5071
5069
|
};
|
|
5072
5070
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5073
5071
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5074
5072
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5075
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5073
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5076
5074
|
};
|
|
5077
5075
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5078
5076
|
if (Array.isArray(permissions)) {
|
|
@@ -5087,60 +5085,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5087
5085
|
if (!processor) {
|
|
5088
5086
|
return accu;
|
|
5089
5087
|
}
|
|
5090
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5091
|
-
var _a;
|
|
5092
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5093
|
-
});
|
|
5088
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5094
5089
|
if (scope) {
|
|
5095
5090
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5096
|
-
return
|
|
5091
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5097
5092
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5098
5093
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5099
5094
|
}
|
|
5100
|
-
return
|
|
5095
|
+
return {
|
|
5096
|
+
...accu,
|
|
5101
5097
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5102
5098
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5103
|
-
}
|
|
5099
|
+
};
|
|
5104
5100
|
},
|
|
5105
|
-
{ isCustom: false, uiPermissions:
|
|
5101
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5106
5102
|
);
|
|
5107
5103
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5108
5104
|
};
|
|
5109
5105
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5110
5106
|
(accu, role) => {
|
|
5111
|
-
var _a;
|
|
5112
5107
|
let normalizedPermissions;
|
|
5113
5108
|
let isCustom = false;
|
|
5114
5109
|
if (rolesById2[role.name]) {
|
|
5115
|
-
normalizedPermissions =
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5110
|
+
normalizedPermissions = {
|
|
5111
|
+
...rolesById2[role.name].uiPermissions,
|
|
5112
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5113
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5114
|
+
};
|
|
5119
5115
|
} else {
|
|
5120
5116
|
const result = parseRolePermissions(role, permissionSets);
|
|
5121
5117
|
normalizedPermissions = result.uiPermissions;
|
|
5122
5118
|
isCustom = result.isCustom;
|
|
5123
5119
|
}
|
|
5124
|
-
const roleState =
|
|
5125
|
-
accu[role.name] =
|
|
5120
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5121
|
+
accu[role.name] = {
|
|
5122
|
+
...roleState,
|
|
5123
|
+
...role,
|
|
5126
5124
|
description: roleState.description ? roleState.description : role.description,
|
|
5127
5125
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5128
5126
|
isCustom,
|
|
5129
5127
|
name: roleState.name ? roleState.name : role.name,
|
|
5130
5128
|
uiPermissions: normalizedPermissions
|
|
5131
|
-
}
|
|
5129
|
+
};
|
|
5132
5130
|
return accu;
|
|
5133
5131
|
},
|
|
5134
|
-
|
|
5132
|
+
{ ...rolesById2 }
|
|
5135
5133
|
);
|
|
5136
5134
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5137
5135
|
`${sliceName8}/getPermissionSets`,
|
|
5138
5136
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5139
5137
|
const permissionSets = data.reduce(
|
|
5140
5138
|
(accu, permissionSet) => {
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5139
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5140
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5144
5141
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5145
5142
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5146
5143
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5151,11 +5148,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5151
5148
|
}
|
|
5152
5149
|
return collector;
|
|
5153
5150
|
}, accu2),
|
|
5154
|
-
|
|
5151
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5155
5152
|
);
|
|
5156
5153
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5157
|
-
|
|
5158
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5154
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5159
5155
|
accu2.push(key);
|
|
5160
5156
|
}
|
|
5161
5157
|
return accu2;
|
|
@@ -5168,7 +5164,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5168
5164
|
return accu;
|
|
5169
5165
|
},
|
|
5170
5166
|
// @ts-ignore
|
|
5171
|
-
|
|
5167
|
+
{ ...getState().users.permissionSetsById }
|
|
5172
5168
|
);
|
|
5173
5169
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5174
5170
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5201,28 +5197,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5201
5197
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5202
5198
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5203
5199
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5204
|
-
|
|
5205
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5200
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5206
5201
|
type: uiPermissionsByArea[area].scope,
|
|
5207
5202
|
value: []
|
|
5208
5203
|
};
|
|
5209
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5204
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5205
|
+
...permissionSetState,
|
|
5210
5206
|
value: [...permissionSetState.value, item]
|
|
5211
|
-
}
|
|
5207
|
+
};
|
|
5212
5208
|
return itemPermissionAccu;
|
|
5213
5209
|
}, accu);
|
|
5214
5210
|
return accu;
|
|
5215
5211
|
}, {});
|
|
5216
|
-
return Object.entries(permissionSetObject).map((
|
|
5217
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5212
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5218
5213
|
if (value.includes(excessiveAccessSelector)) {
|
|
5219
5214
|
return { name };
|
|
5220
5215
|
}
|
|
5221
|
-
return { name, scope:
|
|
5216
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5222
5217
|
});
|
|
5223
5218
|
};
|
|
5224
5219
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5225
|
-
const role =
|
|
5220
|
+
const role = { ...roleState, ...roleData };
|
|
5226
5221
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5227
5222
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5228
5223
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5258,12 +5253,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5258
5253
|
}, []);
|
|
5259
5254
|
return {
|
|
5260
5255
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5261
|
-
role:
|
|
5256
|
+
role: {
|
|
5257
|
+
...emptyRole,
|
|
5262
5258
|
name,
|
|
5263
5259
|
// @ts-ignore
|
|
5264
5260
|
description: description ? description : roleState.description,
|
|
5265
|
-
uiPermissions:
|
|
5266
|
-
|
|
5261
|
+
uiPermissions: {
|
|
5262
|
+
...emptyUiPermissions,
|
|
5263
|
+
...roleUiPermissions,
|
|
5264
|
+
...maybeUiPermissions
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5267
5267
|
};
|
|
5268
5268
|
};
|
|
5269
5269
|
var roleActions = {
|
|
@@ -5314,13 +5314,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5314
5314
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5315
5315
|
`${sliceName8}/saveGlobalSettings`,
|
|
5316
5316
|
// @ts-ignore
|
|
5317
|
-
(
|
|
5318
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5317
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5319
5318
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5320
5319
|
return;
|
|
5321
5320
|
}
|
|
5322
5321
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5323
|
-
let updatedSettings =
|
|
5322
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5324
5323
|
if (getCurrentUser(getState()).verified) {
|
|
5325
5324
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5326
5325
|
} else {
|
|
@@ -5358,10 +5357,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5358
5357
|
const userSettings = getUserSettings(getState());
|
|
5359
5358
|
const onboardingState = getOnboardingState(getState());
|
|
5360
5359
|
const tooltipState = getTooltipsState(getState());
|
|
5361
|
-
const updatedSettings =
|
|
5362
|
-
|
|
5360
|
+
const updatedSettings = {
|
|
5361
|
+
...userSettings,
|
|
5362
|
+
// @ts-ignore
|
|
5363
|
+
...settings,
|
|
5364
|
+
onboarding: {
|
|
5365
|
+
...onboardingState,
|
|
5366
|
+
// @ts-ignore
|
|
5367
|
+
...settings.onboarding
|
|
5368
|
+
},
|
|
5363
5369
|
tooltips: tooltipState
|
|
5364
|
-
}
|
|
5370
|
+
};
|
|
5365
5371
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5366
5372
|
return Promise.all([
|
|
5367
5373
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5387,9 +5393,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5387
5393
|
`${sliceName8}/getTokens`,
|
|
5388
5394
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5389
5395
|
const user = getCurrentUser(getState());
|
|
5390
|
-
const updatedUser =
|
|
5396
|
+
const updatedUser = {
|
|
5397
|
+
...user,
|
|
5391
5398
|
tokens
|
|
5392
|
-
}
|
|
5399
|
+
};
|
|
5393
5400
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5394
5401
|
})
|
|
5395
5402
|
);
|
|
@@ -5405,8 +5412,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5405
5412
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5406
5413
|
)
|
|
5407
5414
|
);
|
|
5408
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5409
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5415
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5410
5416
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5411
5417
|
if (persist) {
|
|
5412
5418
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5414,14 +5420,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5414
5420
|
return Promise.all(tasks);
|
|
5415
5421
|
});
|
|
5416
5422
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5417
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5423
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5418
5424
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5419
5425
|
});
|
|
5420
5426
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5421
5427
|
`${sliceName8}/submitFeedback`,
|
|
5422
5428
|
// @ts-ignore
|
|
5423
|
-
(
|
|
5424
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5429
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5425
5430
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5426
5431
|
subject: "feedback submission",
|
|
5427
5432
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5442,13 +5447,15 @@ var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
|
5442
5447
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
5443
5448
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers12.startTimeSort).reduce(
|
|
5444
5449
|
(accu, item) => {
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5450
|
+
const filter = item.filter ?? {};
|
|
5451
|
+
let deployment = {
|
|
5452
|
+
...deploymentPrototype,
|
|
5453
|
+
...deploymentsById[item.id],
|
|
5454
|
+
...item,
|
|
5455
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
5449
5456
|
name: decodeURIComponent(item.name)
|
|
5450
|
-
}
|
|
5451
|
-
deployment =
|
|
5457
|
+
};
|
|
5458
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
5452
5459
|
accu.deployments[item.id] = deployment;
|
|
5453
5460
|
accu.deploymentIds.push(item.id);
|
|
5454
5461
|
return accu;
|
|
@@ -5502,11 +5509,12 @@ var createDeployment = (0, import_toolkit24.createAsyncThunk)(`${sliceName2}/cre
|
|
|
5502
5509
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
5503
5510
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
5504
5511
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
5505
|
-
const deployment =
|
|
5512
|
+
const deployment = {
|
|
5513
|
+
...newDeployment,
|
|
5506
5514
|
id: deploymentId,
|
|
5507
5515
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
5508
5516
|
statistics: { status: {} }
|
|
5509
|
-
}
|
|
5517
|
+
};
|
|
5510
5518
|
let tasks = [
|
|
5511
5519
|
dispatch(actions2.createdDeployment(deployment)),
|
|
5512
5520
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -5649,14 +5657,23 @@ var updateDeploymentControlMap = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5649
5657
|
({ 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))))
|
|
5650
5658
|
);
|
|
5651
5659
|
var setDeploymentsState = (0, import_toolkit24.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
5652
|
-
const
|
|
5660
|
+
const { page, perPage, ...selectionState } = selection;
|
|
5653
5661
|
const currentState = getState().deployments.selectionState;
|
|
5654
|
-
let nextState =
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5662
|
+
let nextState = {
|
|
5663
|
+
...currentState,
|
|
5664
|
+
...selectionState,
|
|
5665
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
5666
|
+
accu[item] = {
|
|
5667
|
+
...currentState[item],
|
|
5668
|
+
...selectionState[item]
|
|
5669
|
+
};
|
|
5670
|
+
return accu;
|
|
5671
|
+
}, {}),
|
|
5672
|
+
general: {
|
|
5673
|
+
...currentState.general,
|
|
5674
|
+
...selectionState.general
|
|
5675
|
+
}
|
|
5676
|
+
};
|
|
5660
5677
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
5661
5678
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
5662
5679
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -5686,15 +5703,20 @@ var getDeploymentsConfig = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5686
5703
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
5687
5704
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
5688
5705
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
5689
|
-
const config =
|
|
5706
|
+
const config = {
|
|
5707
|
+
...oldConfig,
|
|
5690
5708
|
hasDelta: Boolean(delta.enabled),
|
|
5691
|
-
binaryDelta:
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5709
|
+
binaryDelta: {
|
|
5710
|
+
...oldConfig.binaryDelta,
|
|
5711
|
+
timeout: timeoutConfig,
|
|
5712
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
5713
|
+
},
|
|
5714
|
+
binaryDeltaLimits: {
|
|
5715
|
+
...oldConfig.binaryDeltaLimits,
|
|
5716
|
+
timeout: timeoutLimit,
|
|
5717
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
5718
|
+
}
|
|
5719
|
+
};
|
|
5698
5720
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
5699
5721
|
})
|
|
5700
5722
|
);
|
|
@@ -5704,7 +5726,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
5704
5726
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers12.isEmpty)(cleanedValue)) {
|
|
5705
5727
|
return accu;
|
|
5706
5728
|
}
|
|
5707
|
-
accu =
|
|
5729
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
5708
5730
|
}
|
|
5709
5731
|
return accu;
|
|
5710
5732
|
}, void 0);
|
|
@@ -5724,26 +5746,14 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit24.createAsyncThunk)(`${slice
|
|
|
5724
5746
|
}
|
|
5725
5747
|
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(() => {
|
|
5726
5748
|
const oldConfig = getState().deployments.config;
|
|
5727
|
-
const newConfig =
|
|
5728
|
-
|
|
5729
|
-
|
|
5749
|
+
const newConfig = {
|
|
5750
|
+
...oldConfig,
|
|
5751
|
+
binaryDelta: {
|
|
5752
|
+
...oldConfig.binaryDelta,
|
|
5753
|
+
...config
|
|
5754
|
+
}
|
|
5755
|
+
};
|
|
5730
5756
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar6("Settings saved successfully"))]);
|
|
5731
5757
|
});
|
|
5732
5758
|
});
|
|
5733
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5734
|
-
0 && (module.exports = {
|
|
5735
|
-
abortDeployment,
|
|
5736
|
-
createDeployment,
|
|
5737
|
-
deriveDeploymentGroup,
|
|
5738
|
-
getDeploymentDevices,
|
|
5739
|
-
getDeploymentsByStatus,
|
|
5740
|
-
getDeploymentsConfig,
|
|
5741
|
-
getDeviceDeployments,
|
|
5742
|
-
getDeviceLog,
|
|
5743
|
-
getSingleDeployment,
|
|
5744
|
-
resetDeviceDeployments,
|
|
5745
|
-
saveDeltaDeploymentsConfig,
|
|
5746
|
-
setDeploymentsState,
|
|
5747
|
-
updateDeploymentControlMap
|
|
5748
|
-
});
|
|
5749
5759
|
//# sourceMappingURL=thunks.js.map
|