@northern.tech/store 0.1.3 → 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 +251 -135
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +102 -51
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +104 -66
- 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 +111 -64
- 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 +649 -552
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +99 -51
- 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-F37LUTBX.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-F37LUTBX.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-7E7KJHY3.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-7E7KJHY3.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-R2GBNXLV.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-R2GBNXLV.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-ZIYGEXSJ.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-ZIYGEXSJ.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-HRWZJQMH.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-HRWZJQMH.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-DZBVTSIX.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-DZBVTSIX.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-YNVSU3AA.mjs → chunk-DIZJVB6M.mjs} +307 -292
- package/dist/chunk-DIZJVB6M.mjs.map +1 -0
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-IPPIKGIB.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-ZNST5R6O.mjs → chunk-IFWKT27G.mjs} +92 -29
- package/dist/chunk-IFWKT27G.mjs.map +1 -0
- package/dist/{chunk-6667TCAJ.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-6667TCAJ.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-HVHZG2H4.mjs → chunk-K2NZL5V4.mjs} +4 -7
- package/dist/chunk-K2NZL5V4.mjs.map +1 -0
- package/dist/{chunk-RQOE5OOT.mjs → chunk-KJAZNKV2.mjs} +66 -55
- package/dist/chunk-KJAZNKV2.mjs.map +1 -0
- package/dist/{chunk-G32LAKW4.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-G32LAKW4.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-BJSH2G7W.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-BJSH2G7W.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-XYVPYFSM.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-XYVPYFSM.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-N7G6QK2E.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-G3I53JGW.mjs → chunk-QQBUNZHA.mjs} +3 -6
- package/dist/{chunk-G3I53JGW.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-TD45YTYK.mjs → chunk-R7LXL3KJ.mjs} +22 -23
- package/dist/chunk-R7LXL3KJ.mjs.map +1 -0
- package/dist/{chunk-G7LATUT6.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-G7LATUT6.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-IVSYYXTC.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-O6O3D52B.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-O6O3D52B.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-BRHSKNFC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-BRHSKNFC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-RH6ONMG7.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-RH6ONMG7.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-HXPYJ6QN.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-HXPYJ6QN.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.d.mts +18 -19
- package/dist/commonConstants.d.ts +18 -19
- package/dist/commonConstants.js +2 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.d.mts +42 -1
- package/dist/commonSelectors.d.ts +42 -1
- package/dist/commonSelectors.js +149 -129
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +14 -12
- package/dist/constants.d.mts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +92 -147
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +18 -14
- package/dist/deploymentsSlice/constants.js +94 -55
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +128 -75
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +95 -48
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +649 -561
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +94 -54
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +131 -77
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +100 -85
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +649 -597
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +94 -41
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +101 -48
- 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 +333 -238
- 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 +649 -555
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.d.mts +6 -1
- package/dist/organizationSlice/constants.d.ts +6 -1
- package/dist/organizationSlice/constants.js +89 -51
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +6 -4
- package/dist/organizationSlice/index.d.mts +224 -246
- package/dist/organizationSlice/index.d.ts +224 -246
- package/dist/organizationSlice/index.js +113 -59
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +96 -58
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +649 -580
- 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 +98 -60
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +97 -53
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +377 -287
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.d.mts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +150 -202
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +45 -43
- package/dist/store.d.mts +235 -135
- package/dist/store.d.ts +235 -135
- package/dist/store.js +262 -157
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.d.mts +3 -1
- package/dist/storehooks.d.ts +3 -1
- package/dist/storehooks.js +686 -569
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +71 -54
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +649 -710
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.d.mts +192 -17
- package/dist/usersSlice/constants.d.ts +192 -17
- package/dist/usersSlice/constants.js +97 -61
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +6 -4
- package/dist/usersSlice/index.d.mts +1628 -704
- package/dist/usersSlice/index.d.ts +1628 -704
- package/dist/usersSlice/index.js +122 -67
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +101 -62
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +649 -584
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.d.mts +6 -5
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +117 -89
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-HVHZG2H4.mjs.map +0 -1
- package/dist/chunk-IPPIKGIB.mjs +0 -35
- package/dist/chunk-IVSYYXTC.mjs +0 -36
- package/dist/chunk-N7G6QK2E.mjs.map +0 -1
- package/dist/chunk-RQOE5OOT.mjs.map +0 -1
- package/dist/chunk-TD45YTYK.mjs.map +0 -1
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-YNVSU3AA.mjs.map +0 -1
- package/dist/chunk-ZNST5R6O.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 = {};
|
|
@@ -511,7 +461,7 @@ var chartTypes = {
|
|
|
511
461
|
};
|
|
512
462
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
513
463
|
var defaultReportType = "distribution";
|
|
514
|
-
var defaultReports = [
|
|
464
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
515
465
|
var locations = {};
|
|
516
466
|
var PLANS = {
|
|
517
467
|
os: {
|
|
@@ -837,13 +787,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
837
787
|
deployments: [],
|
|
838
788
|
groups: Object.freeze({}),
|
|
839
789
|
releases: Object.freeze({}),
|
|
790
|
+
tenantManagement: [],
|
|
840
791
|
userManagement: []
|
|
841
792
|
});
|
|
842
793
|
var emptyRole = Object.freeze({
|
|
843
794
|
name: void 0,
|
|
844
795
|
description: "",
|
|
845
796
|
permissions: [],
|
|
846
|
-
uiPermissions: Object.freeze(
|
|
797
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
847
798
|
});
|
|
848
799
|
|
|
849
800
|
// src/deploymentsSlice/constants.ts
|
|
@@ -872,11 +823,12 @@ var deploymentStatesToSubstates = {
|
|
|
872
823
|
pending: [deploymentSubstates.pending],
|
|
873
824
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
874
825
|
};
|
|
875
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
826
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
827
|
+
...deploymentStatesToSubstates,
|
|
876
828
|
failures: [deploymentSubstates.failure],
|
|
877
829
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
878
830
|
successes: [deploymentSubstates.success]
|
|
879
|
-
}
|
|
831
|
+
};
|
|
880
832
|
var installationSubstatesMap = {
|
|
881
833
|
download: {
|
|
882
834
|
title: "download",
|
|
@@ -921,8 +873,8 @@ var DEPLOYMENT_STATES = {
|
|
|
921
873
|
var listDefaultsByState = {
|
|
922
874
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
923
875
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
924
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
925
|
-
[DEPLOYMENT_STATES.finished]:
|
|
876
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
877
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
926
878
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
927
879
|
};
|
|
928
880
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1084,6 +1036,13 @@ var SSO_TYPES = {
|
|
|
1084
1036
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1085
1037
|
}
|
|
1086
1038
|
};
|
|
1039
|
+
var AUDIT_LOGS_TYPES = [
|
|
1040
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
1041
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
1042
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
1043
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1044
|
+
];
|
|
1045
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1087
1046
|
var emptyWebhook = {
|
|
1088
1047
|
description: "",
|
|
1089
1048
|
enabled: true,
|
|
@@ -1132,10 +1091,12 @@ var permissionSetIds = {
|
|
|
1132
1091
|
DeployToDevices: "DeployToDevices",
|
|
1133
1092
|
ManageDevices: "ManageDevices",
|
|
1134
1093
|
ManageReleases: "ManageReleases",
|
|
1094
|
+
ManageTenants: "ManageTenants",
|
|
1135
1095
|
ManageUsers: "ManageUsers",
|
|
1136
1096
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1137
1097
|
ReadDevices: "ReadDevices",
|
|
1138
1098
|
ReadReleases: "ReadReleases",
|
|
1099
|
+
ReadTenants: "ReadTenants",
|
|
1139
1100
|
ReadUsers: "ReadUsers",
|
|
1140
1101
|
SuperUser: "SuperUser",
|
|
1141
1102
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1174,6 +1135,7 @@ var uiPermissionsById = {
|
|
|
1174
1135
|
permissionSets: {
|
|
1175
1136
|
groups: permissionSetIds.ManageDevices,
|
|
1176
1137
|
releases: permissionSetIds.ManageReleases,
|
|
1138
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1177
1139
|
userManagement: permissionSetIds.ManageUsers
|
|
1178
1140
|
},
|
|
1179
1141
|
title: "Manage",
|
|
@@ -1187,6 +1149,7 @@ var uiPermissionsById = {
|
|
|
1187
1149
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1188
1150
|
groups: permissionSetIds.ReadDevices,
|
|
1189
1151
|
releases: permissionSetIds.ReadReleases,
|
|
1152
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1190
1153
|
userManagement: permissionSetIds.ReadUsers
|
|
1191
1154
|
},
|
|
1192
1155
|
title: "Read",
|
|
@@ -1211,6 +1174,7 @@ var uiPermissionsByArea = {
|
|
|
1211
1174
|
auditlog: {
|
|
1212
1175
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1213
1176
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1177
|
+
key: "auditlog",
|
|
1214
1178
|
uiPermissions: [uiPermissionsById.read],
|
|
1215
1179
|
title: "System audit log"
|
|
1216
1180
|
},
|
|
@@ -1221,6 +1185,7 @@ var uiPermissionsByArea = {
|
|
|
1221
1185
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1222
1186
|
],
|
|
1223
1187
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1188
|
+
key: "deployments",
|
|
1224
1189
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1225
1190
|
title: "Deployments"
|
|
1226
1191
|
},
|
|
@@ -1236,6 +1201,7 @@ var uiPermissionsByArea = {
|
|
|
1236
1201
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1237
1202
|
],
|
|
1238
1203
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1204
|
+
key: "groups",
|
|
1239
1205
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1240
1206
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1241
1207
|
title: "Group Management"
|
|
@@ -1255,22 +1221,35 @@ var uiPermissionsByArea = {
|
|
|
1255
1221
|
}
|
|
1256
1222
|
],
|
|
1257
1223
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1224
|
+
key: "releases",
|
|
1258
1225
|
scope: "ReleaseTags",
|
|
1259
1226
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1260
1227
|
title: "Release Management"
|
|
1261
1228
|
},
|
|
1229
|
+
tenantManagement: {
|
|
1230
|
+
endpoints: [
|
|
1231
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1232
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1233
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1234
|
+
],
|
|
1235
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1236
|
+
key: "tenantManagement",
|
|
1237
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1238
|
+
title: "Tenant Management"
|
|
1239
|
+
},
|
|
1262
1240
|
userManagement: {
|
|
1263
1241
|
endpoints: [
|
|
1264
1242
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1265
1243
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1266
1244
|
],
|
|
1267
1245
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1246
|
+
key: "userManagement",
|
|
1268
1247
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1269
1248
|
title: "User Management"
|
|
1270
1249
|
}
|
|
1271
1250
|
};
|
|
1272
1251
|
var permissionMapper = (permission) => permission.value;
|
|
1273
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1252
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1274
1253
|
var rolesById = Object.freeze({
|
|
1275
1254
|
[staticRolesByName.admin]: {
|
|
1276
1255
|
name: "Admin",
|
|
@@ -1278,56 +1257,87 @@ var rolesById = Object.freeze({
|
|
|
1278
1257
|
description: "Full access",
|
|
1279
1258
|
permissions: [],
|
|
1280
1259
|
// permissions refers to the values returned from the backend
|
|
1281
|
-
uiPermissions:
|
|
1260
|
+
uiPermissions: {
|
|
1261
|
+
...emptyUiPermissions,
|
|
1282
1262
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1283
1263
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1284
1264
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1285
1265
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1286
1266
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1287
|
-
}
|
|
1267
|
+
}
|
|
1288
1268
|
},
|
|
1289
1269
|
[staticRolesByName.readOnly]: {
|
|
1290
1270
|
name: "Read Access",
|
|
1291
1271
|
value: staticRolesByName.readOnly,
|
|
1292
1272
|
description: "",
|
|
1293
1273
|
permissions: [],
|
|
1294
|
-
uiPermissions:
|
|
1274
|
+
uiPermissions: {
|
|
1275
|
+
...emptyUiPermissions,
|
|
1295
1276
|
deployments: [uiPermissionsById.read.value],
|
|
1296
1277
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1297
1278
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1298
1279
|
userManagement: [uiPermissionsById.read.value]
|
|
1299
|
-
}
|
|
1280
|
+
}
|
|
1300
1281
|
},
|
|
1301
1282
|
[staticRolesByName.ci]: {
|
|
1302
1283
|
name: "Releases Manager",
|
|
1303
1284
|
value: staticRolesByName.ci,
|
|
1304
1285
|
description: "",
|
|
1305
1286
|
permissions: [],
|
|
1306
|
-
uiPermissions:
|
|
1287
|
+
uiPermissions: {
|
|
1288
|
+
...emptyUiPermissions,
|
|
1307
1289
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1308
|
-
}
|
|
1290
|
+
}
|
|
1309
1291
|
},
|
|
1310
1292
|
[staticRolesByName.deploymentsManager]: {
|
|
1311
1293
|
name: "Deployments Manager",
|
|
1312
1294
|
value: staticRolesByName.deploymentsManager,
|
|
1313
1295
|
description: "",
|
|
1314
1296
|
permissions: [],
|
|
1315
|
-
uiPermissions:
|
|
1297
|
+
uiPermissions: {
|
|
1298
|
+
...emptyUiPermissions,
|
|
1316
1299
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1317
1300
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1318
1301
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1319
|
-
}
|
|
1302
|
+
}
|
|
1320
1303
|
},
|
|
1321
1304
|
[staticRolesByName.terminalAccess]: {
|
|
1322
1305
|
name: "Troubleshooting",
|
|
1323
1306
|
value: staticRolesByName.terminalAccess,
|
|
1324
1307
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1325
1308
|
permissions: [],
|
|
1326
|
-
uiPermissions:
|
|
1309
|
+
uiPermissions: {
|
|
1310
|
+
...emptyUiPermissions,
|
|
1327
1311
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1328
|
-
}
|
|
1312
|
+
}
|
|
1329
1313
|
}
|
|
1330
1314
|
});
|
|
1315
|
+
var serviceProviderRolesById = {
|
|
1316
|
+
admin: {
|
|
1317
|
+
name: "Admin",
|
|
1318
|
+
value: staticRolesByName.admin,
|
|
1319
|
+
description: "Full access",
|
|
1320
|
+
permissions: [],
|
|
1321
|
+
uiPermissions: {
|
|
1322
|
+
...emptyUiPermissions,
|
|
1323
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1324
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1325
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
readOnly: {
|
|
1329
|
+
name: "Read access",
|
|
1330
|
+
value: staticRolesByName.admin,
|
|
1331
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1332
|
+
permissions: [],
|
|
1333
|
+
uiPermissions: {
|
|
1334
|
+
...emptyUiPermissions,
|
|
1335
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1336
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1337
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1331
1341
|
var defaultPermissionSets = {
|
|
1332
1342
|
[permissionSetIds.Basic]: {
|
|
1333
1343
|
name: permissionSetIds.Basic,
|
|
@@ -1338,7 +1348,9 @@ var defaultPermissionSets = {
|
|
|
1338
1348
|
},
|
|
1339
1349
|
[permissionSetIds.SuperUser]: {
|
|
1340
1350
|
name: permissionSetIds.SuperUser,
|
|
1341
|
-
result:
|
|
1351
|
+
result: {
|
|
1352
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1353
|
+
}
|
|
1342
1354
|
},
|
|
1343
1355
|
[permissionSetIds.ManageUsers]: {
|
|
1344
1356
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1358,6 +1370,18 @@ var defaultPermissionSets = {
|
|
|
1358
1370
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1359
1371
|
}
|
|
1360
1372
|
},
|
|
1373
|
+
[permissionSetIds.ReadTenants]: {
|
|
1374
|
+
name: permissionSetIds.ReadTenants,
|
|
1375
|
+
result: {
|
|
1376
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
[permissionSetIds.ManageTenants]: {
|
|
1380
|
+
name: permissionSetIds.ManageTenants,
|
|
1381
|
+
result: {
|
|
1382
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1383
|
+
}
|
|
1384
|
+
},
|
|
1361
1385
|
[permissionSetIds.ReadUsers]: {
|
|
1362
1386
|
name: permissionSetIds.ReadUsers,
|
|
1363
1387
|
result: {
|
|
@@ -1411,11 +1435,12 @@ var defaultPermissionSets = {
|
|
|
1411
1435
|
};
|
|
1412
1436
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1413
1437
|
var OWN_USER_ID = "me";
|
|
1414
|
-
var rolesByName =
|
|
1438
|
+
var rolesByName = {
|
|
1439
|
+
...staticRolesByName,
|
|
1415
1440
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1416
1441
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1417
1442
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1418
|
-
}
|
|
1443
|
+
};
|
|
1419
1444
|
var twoFAStates = {
|
|
1420
1445
|
enabled: "enabled",
|
|
1421
1446
|
disabled: "disabled",
|
|
@@ -1503,7 +1528,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1503
1528
|
initialState,
|
|
1504
1529
|
reducers: {
|
|
1505
1530
|
setFeatures: (state, action) => {
|
|
1506
|
-
state.features =
|
|
1531
|
+
state.features = {
|
|
1532
|
+
...state.features,
|
|
1533
|
+
...action.payload
|
|
1534
|
+
};
|
|
1507
1535
|
},
|
|
1508
1536
|
setSnackbar: (state, { payload }) => {
|
|
1509
1537
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1528,7 +1556,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1528
1556
|
state.hostedAnnouncement = action.payload;
|
|
1529
1557
|
},
|
|
1530
1558
|
setSearchState: (state, action) => {
|
|
1531
|
-
state.searchState =
|
|
1559
|
+
state.searchState = {
|
|
1560
|
+
...state.searchState,
|
|
1561
|
+
...action.payload
|
|
1562
|
+
};
|
|
1532
1563
|
},
|
|
1533
1564
|
setOfflineThreshold: (state, action) => {
|
|
1534
1565
|
state.offlineThreshold = action.payload;
|
|
@@ -1539,20 +1570,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1539
1570
|
},
|
|
1540
1571
|
uploadProgress: (state, action) => {
|
|
1541
1572
|
const { id, progress: progress2 } = action.payload;
|
|
1542
|
-
state.uploadsById[id] =
|
|
1573
|
+
state.uploadsById[id] = {
|
|
1574
|
+
...state.uploadsById[id],
|
|
1543
1575
|
progress: progress2
|
|
1544
|
-
}
|
|
1576
|
+
};
|
|
1545
1577
|
},
|
|
1546
1578
|
cleanUpUpload: (state, action) => {
|
|
1547
|
-
|
|
1548
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1579
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1549
1580
|
state.uploadsById = remainder;
|
|
1550
1581
|
},
|
|
1551
1582
|
setVersionInformation: (state, action) => {
|
|
1552
|
-
state.versionInformation =
|
|
1583
|
+
state.versionInformation = {
|
|
1584
|
+
...state.versionInformation,
|
|
1585
|
+
...action.payload
|
|
1586
|
+
};
|
|
1553
1587
|
},
|
|
1554
1588
|
setEnvironmentData: (state, action) => {
|
|
1555
|
-
return
|
|
1589
|
+
return { ...state, ...action.payload };
|
|
1556
1590
|
}
|
|
1557
1591
|
}
|
|
1558
1592
|
});
|
|
@@ -1584,7 +1618,7 @@ var initialState2 = {
|
|
|
1584
1618
|
sourceWindow: -1
|
|
1585
1619
|
},
|
|
1586
1620
|
binaryDeltaLimits: {
|
|
1587
|
-
timeout:
|
|
1621
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1588
1622
|
sourceWindow: limitDefault,
|
|
1589
1623
|
inputWindow: limitDefault,
|
|
1590
1624
|
duplicatesWindow: limitDefault,
|
|
@@ -1594,10 +1628,10 @@ var initialState2 = {
|
|
|
1594
1628
|
deploymentDeviceLimit: 5e3,
|
|
1595
1629
|
selectedDeviceIds: [],
|
|
1596
1630
|
selectionState: {
|
|
1597
|
-
finished:
|
|
1598
|
-
inprogress:
|
|
1599
|
-
pending:
|
|
1600
|
-
scheduled:
|
|
1631
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1632
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1633
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1634
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1601
1635
|
general: {
|
|
1602
1636
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1603
1637
|
showCreationDialog: false,
|
|
@@ -1613,40 +1647,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1613
1647
|
initialState: initialState2,
|
|
1614
1648
|
reducers: {
|
|
1615
1649
|
createdDeployment: (state, action) => {
|
|
1616
|
-
state.byId[action.payload.id] =
|
|
1650
|
+
state.byId[action.payload.id] = {
|
|
1651
|
+
...deploymentPrototype,
|
|
1652
|
+
...action.payload
|
|
1653
|
+
};
|
|
1617
1654
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1618
1655
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1619
1656
|
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;
|
|
1620
1657
|
},
|
|
1621
1658
|
removedDeployment: (state, action) => {
|
|
1622
|
-
|
|
1623
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1659
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1624
1660
|
state.byId = remainder;
|
|
1625
1661
|
},
|
|
1626
1662
|
receivedDeployment: (state, action) => {
|
|
1627
|
-
state.byId[action.payload.id] =
|
|
1663
|
+
state.byId[action.payload.id] = {
|
|
1664
|
+
...state.byId[action.payload.id] || {},
|
|
1665
|
+
...action.payload
|
|
1666
|
+
};
|
|
1628
1667
|
},
|
|
1629
1668
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1630
1669
|
const { id, deviceId, log } = action.payload;
|
|
1631
|
-
const deployment =
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1670
|
+
const deployment = {
|
|
1671
|
+
...deploymentPrototype,
|
|
1672
|
+
...state.byId[id]
|
|
1673
|
+
};
|
|
1674
|
+
state.byId[id] = {
|
|
1675
|
+
...deployment,
|
|
1676
|
+
devices: {
|
|
1677
|
+
...deployment.devices,
|
|
1678
|
+
[deviceId]: {
|
|
1679
|
+
...deployment.devices[deviceId],
|
|
1635
1680
|
log
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1639
1684
|
},
|
|
1640
1685
|
receivedDeploymentDevices: (state, action) => {
|
|
1641
1686
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1642
|
-
state.byId[id] =
|
|
1687
|
+
state.byId[id] = {
|
|
1688
|
+
...state.byId[id],
|
|
1643
1689
|
devices,
|
|
1644
1690
|
totalDeviceCount
|
|
1645
|
-
}
|
|
1691
|
+
};
|
|
1646
1692
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1647
1693
|
},
|
|
1648
1694
|
receivedDeployments: (state, action) => {
|
|
1649
|
-
state.byId =
|
|
1695
|
+
state.byId = {
|
|
1696
|
+
...state.byId,
|
|
1697
|
+
...action.payload
|
|
1698
|
+
};
|
|
1650
1699
|
},
|
|
1651
1700
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1652
1701
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1688,9 +1737,9 @@ var initialState3 = {
|
|
|
1688
1737
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1689
1738
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1690
1739
|
},
|
|
1691
|
-
deviceList:
|
|
1692
|
-
deviceIds: []
|
|
1693
|
-
|
|
1740
|
+
deviceList: {
|
|
1741
|
+
deviceIds: [],
|
|
1742
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1694
1743
|
selectedAttributes: [],
|
|
1695
1744
|
selectedIssues: [],
|
|
1696
1745
|
selection: [],
|
|
@@ -1701,7 +1750,7 @@ var initialState3 = {
|
|
|
1701
1750
|
},
|
|
1702
1751
|
state: DEVICE_STATES.accepted,
|
|
1703
1752
|
total: 0
|
|
1704
|
-
}
|
|
1753
|
+
},
|
|
1705
1754
|
filters: [
|
|
1706
1755
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1707
1756
|
],
|
|
@@ -1736,49 +1785,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1736
1785
|
},
|
|
1737
1786
|
addToGroup: (state, action) => {
|
|
1738
1787
|
const { group, deviceIds } = action.payload;
|
|
1739
|
-
const maybeExistingGroup =
|
|
1788
|
+
const maybeExistingGroup = {
|
|
1740
1789
|
filters: [],
|
|
1741
|
-
deviceIds: []
|
|
1742
|
-
|
|
1743
|
-
|
|
1790
|
+
deviceIds: [],
|
|
1791
|
+
...state.groups.byId[group]
|
|
1792
|
+
};
|
|
1793
|
+
state.groups.byId[group] = {
|
|
1794
|
+
...maybeExistingGroup,
|
|
1744
1795
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1745
1796
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1746
|
-
}
|
|
1797
|
+
};
|
|
1747
1798
|
},
|
|
1748
1799
|
removeFromGroup: (state, action) => {
|
|
1749
1800
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1750
|
-
const
|
|
1751
|
-
const changedGroup =
|
|
1801
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1802
|
+
const changedGroup = {
|
|
1803
|
+
...maybeExistingGroup,
|
|
1752
1804
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1753
1805
|
total: Math.max(total - removedIds.length, 0)
|
|
1754
|
-
}
|
|
1806
|
+
};
|
|
1755
1807
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1756
1808
|
state.groups.byId[group] = changedGroup;
|
|
1757
1809
|
return;
|
|
1758
1810
|
} else if (state.groups.selectedGroup === group) {
|
|
1759
1811
|
state.groups.selectedGroup = void 0;
|
|
1760
1812
|
}
|
|
1761
|
-
const
|
|
1813
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1762
1814
|
state.groups.byId = remainingById;
|
|
1763
1815
|
},
|
|
1764
1816
|
addGroup: (state, action) => {
|
|
1765
1817
|
const { groupName, group } = action.payload;
|
|
1766
|
-
state.groups.byId[groupName] =
|
|
1818
|
+
state.groups.byId[groupName] = {
|
|
1819
|
+
...state.groups.byId[groupName],
|
|
1820
|
+
...group
|
|
1821
|
+
};
|
|
1767
1822
|
},
|
|
1768
1823
|
selectGroup: (state, { payload: group }) => {
|
|
1769
1824
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1770
1825
|
state.groups.selectedGroup = group;
|
|
1771
1826
|
},
|
|
1772
1827
|
removeGroup: (state, action) => {
|
|
1773
|
-
|
|
1774
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1828
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1775
1829
|
state.groups.byId = remainingById;
|
|
1776
1830
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1777
1831
|
},
|
|
1778
1832
|
setDeviceListState: (state, action) => {
|
|
1779
|
-
state.deviceList =
|
|
1780
|
-
|
|
1781
|
-
|
|
1833
|
+
state.deviceList = {
|
|
1834
|
+
...state.deviceList,
|
|
1835
|
+
...action.payload,
|
|
1836
|
+
sort: {
|
|
1837
|
+
...state.deviceList.sort,
|
|
1838
|
+
...action.payload.sort
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1782
1841
|
},
|
|
1783
1842
|
setFilterAttributes: (state, action) => {
|
|
1784
1843
|
state.filteringAttributes = action.payload;
|
|
@@ -1787,7 +1846,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1787
1846
|
state.filteringAttributesConfig = action.payload;
|
|
1788
1847
|
},
|
|
1789
1848
|
receivedDevices: (state, action) => {
|
|
1790
|
-
state.byId =
|
|
1849
|
+
state.byId = {
|
|
1850
|
+
...state.byId,
|
|
1851
|
+
...action.payload
|
|
1852
|
+
};
|
|
1791
1853
|
},
|
|
1792
1854
|
setDeviceFilters: (state, action) => {
|
|
1793
1855
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1818,7 +1880,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1818
1880
|
state.limit = action.payload;
|
|
1819
1881
|
},
|
|
1820
1882
|
receivedDevice: (state, action) => {
|
|
1821
|
-
state.byId[action.payload.id] =
|
|
1883
|
+
state.byId[action.payload.id] = {
|
|
1884
|
+
...state.byId[action.payload.id],
|
|
1885
|
+
...action.payload
|
|
1886
|
+
};
|
|
1822
1887
|
},
|
|
1823
1888
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1824
1889
|
const { deviceId, authId } = action.payload;
|
|
@@ -1839,15 +1904,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1839
1904
|
var sliceName4 = "monitor";
|
|
1840
1905
|
var initialState4 = {
|
|
1841
1906
|
alerts: {
|
|
1842
|
-
alertList:
|
|
1907
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1843
1908
|
byDeviceId: {}
|
|
1844
1909
|
},
|
|
1845
1910
|
issueCounts: {
|
|
1846
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1911
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1847
1912
|
},
|
|
1848
1913
|
settings: {
|
|
1849
1914
|
global: {
|
|
1850
|
-
channels:
|
|
1915
|
+
channels: {
|
|
1916
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1917
|
+
}
|
|
1851
1918
|
}
|
|
1852
1919
|
}
|
|
1853
1920
|
};
|
|
@@ -1865,14 +1932,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1865
1932
|
},
|
|
1866
1933
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1867
1934
|
const { deviceId, alerts } = action.payload;
|
|
1868
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1935
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1869
1936
|
},
|
|
1870
1937
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1871
1938
|
const { issueType, counts } = action.payload;
|
|
1872
1939
|
state.issueCounts.byType[issueType] = counts;
|
|
1873
1940
|
},
|
|
1874
1941
|
setAlertListState: (state, action) => {
|
|
1875
|
-
state.alerts.alertList =
|
|
1942
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1876
1943
|
}
|
|
1877
1944
|
}
|
|
1878
1945
|
});
|
|
@@ -1896,7 +1963,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1896
1963
|
initialState: initialState5,
|
|
1897
1964
|
reducers: {
|
|
1898
1965
|
setOnboardingState: (state, action) => {
|
|
1899
|
-
return
|
|
1966
|
+
return { ...state, ...action.payload };
|
|
1900
1967
|
},
|
|
1901
1968
|
setDemoArtifactPort: (state, action) => {
|
|
1902
1969
|
state.demoArtifactPort = action.payload;
|
|
@@ -1934,21 +2001,23 @@ var initialState6 = {
|
|
|
1934
2001
|
brand: ""
|
|
1935
2002
|
},
|
|
1936
2003
|
intentId: null,
|
|
2004
|
+
tenantList: {
|
|
2005
|
+
...TENANT_LIST_DEFAULT,
|
|
2006
|
+
total: 0,
|
|
2007
|
+
tenants: [],
|
|
2008
|
+
selectedTenant: null,
|
|
2009
|
+
sort: {
|
|
2010
|
+
direction: SORTING_OPTIONS.desc,
|
|
2011
|
+
key: "name"
|
|
2012
|
+
}
|
|
2013
|
+
},
|
|
1937
2014
|
organization: {
|
|
1938
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
1939
|
-
total: 0,
|
|
1940
|
-
tenants: [],
|
|
1941
|
-
selectedTenant: null,
|
|
1942
|
-
sort: {
|
|
1943
|
-
direction: SORTING_OPTIONS.desc,
|
|
1944
|
-
key: "name"
|
|
1945
|
-
}
|
|
1946
|
-
})
|
|
1947
2015
|
// id, name, status, tenant_token, plan
|
|
1948
2016
|
},
|
|
1949
2017
|
auditlog: {
|
|
1950
2018
|
events: [],
|
|
1951
|
-
selectionState:
|
|
2019
|
+
selectionState: {
|
|
2020
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1952
2021
|
detail: void 0,
|
|
1953
2022
|
endDate: void 0,
|
|
1954
2023
|
selectedIssue: void 0,
|
|
@@ -1957,7 +2026,7 @@ var initialState6 = {
|
|
|
1957
2026
|
total: 0,
|
|
1958
2027
|
type: void 0,
|
|
1959
2028
|
user: void 0
|
|
1960
|
-
}
|
|
2029
|
+
}
|
|
1961
2030
|
},
|
|
1962
2031
|
externalDeviceIntegrations: [
|
|
1963
2032
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -1980,7 +2049,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1980
2049
|
state.auditlog.selectionState.total = total;
|
|
1981
2050
|
},
|
|
1982
2051
|
setAuditLogState: (state, action) => {
|
|
1983
|
-
state.auditlog.selectionState =
|
|
2052
|
+
state.auditlog.selectionState = {
|
|
2053
|
+
...state.auditlog.selectionState,
|
|
2054
|
+
...action.payload
|
|
2055
|
+
};
|
|
1984
2056
|
},
|
|
1985
2057
|
receiveCurrentCard: (state, action) => {
|
|
1986
2058
|
state.card = action.payload;
|
|
@@ -1989,12 +2061,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1989
2061
|
state.intentId = action.payload;
|
|
1990
2062
|
},
|
|
1991
2063
|
setOrganization: (state, action) => {
|
|
1992
|
-
state.organization =
|
|
1993
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
1994
|
-
});
|
|
2064
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
1995
2065
|
},
|
|
1996
2066
|
setTenantListState: (state, action) => {
|
|
1997
|
-
state.
|
|
2067
|
+
state.tenantList = action.payload;
|
|
1998
2068
|
},
|
|
1999
2069
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
2000
2070
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2054,7 +2124,8 @@ var initialState7 = {
|
|
|
2054
2124
|
}
|
|
2055
2125
|
*/
|
|
2056
2126
|
},
|
|
2057
|
-
releasesList:
|
|
2127
|
+
releasesList: {
|
|
2128
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2058
2129
|
searchedIds: [],
|
|
2059
2130
|
releaseIds: [],
|
|
2060
2131
|
selection: [],
|
|
@@ -2068,7 +2139,7 @@ var initialState7 = {
|
|
|
2068
2139
|
selectedTags: [],
|
|
2069
2140
|
total: 0,
|
|
2070
2141
|
type: ""
|
|
2071
|
-
}
|
|
2142
|
+
},
|
|
2072
2143
|
tags: [],
|
|
2073
2144
|
updateTypes: [],
|
|
2074
2145
|
/*
|
|
@@ -2094,8 +2165,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2094
2165
|
state.updateTypes = action.payload;
|
|
2095
2166
|
},
|
|
2096
2167
|
removeRelease: (state, action) => {
|
|
2097
|
-
|
|
2098
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2168
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2099
2169
|
state.byId = byId;
|
|
2100
2170
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2101
2171
|
},
|
|
@@ -2128,8 +2198,12 @@ var initialState8 = {
|
|
|
2128
2198
|
previousPhases: [],
|
|
2129
2199
|
retries: 0
|
|
2130
2200
|
},
|
|
2131
|
-
permissionSetsById:
|
|
2132
|
-
|
|
2201
|
+
permissionSetsById: {
|
|
2202
|
+
...defaultPermissionSets
|
|
2203
|
+
},
|
|
2204
|
+
rolesById: {
|
|
2205
|
+
...rolesById
|
|
2206
|
+
},
|
|
2133
2207
|
settingsInitialized: false,
|
|
2134
2208
|
showConnectDeviceDialog: false,
|
|
2135
2209
|
showFeedbackDialog: false,
|
|
@@ -2169,13 +2243,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2169
2243
|
state.byId[0] = action.payload;
|
|
2170
2244
|
},
|
|
2171
2245
|
removedUser: (state, action) => {
|
|
2172
|
-
|
|
2173
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2246
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2174
2247
|
state.byId = byId;
|
|
2175
2248
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2176
2249
|
},
|
|
2177
2250
|
updatedUser: (state, action) => {
|
|
2178
|
-
state.byId[action.payload.id] =
|
|
2251
|
+
state.byId[action.payload.id] = {
|
|
2252
|
+
...state.byId[action.payload.id],
|
|
2253
|
+
...action.payload
|
|
2254
|
+
};
|
|
2179
2255
|
},
|
|
2180
2256
|
receivedPermissionSets: (state, action) => {
|
|
2181
2257
|
state.permissionSetsById = action.payload;
|
|
@@ -2184,11 +2260,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2184
2260
|
state.rolesById = action.payload;
|
|
2185
2261
|
},
|
|
2186
2262
|
createdRole: (state, action) => {
|
|
2187
|
-
state.rolesById[action.payload.name] =
|
|
2263
|
+
state.rolesById[action.payload.name] = {
|
|
2264
|
+
...state.rolesById[action.payload.name],
|
|
2265
|
+
...action.payload
|
|
2266
|
+
};
|
|
2188
2267
|
},
|
|
2189
2268
|
removedRole: (state, action) => {
|
|
2190
|
-
|
|
2191
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2269
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2192
2270
|
state.rolesById = rolesById2;
|
|
2193
2271
|
},
|
|
2194
2272
|
setCustomColumns: (state, action) => {
|
|
@@ -2196,18 +2274,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2196
2274
|
},
|
|
2197
2275
|
setGlobalSettings: (state, action) => {
|
|
2198
2276
|
state.settingsInitialized = true;
|
|
2199
|
-
state.globalSettings =
|
|
2277
|
+
state.globalSettings = {
|
|
2278
|
+
...state.globalSettings,
|
|
2279
|
+
...action.payload
|
|
2280
|
+
};
|
|
2200
2281
|
},
|
|
2201
2282
|
setUserSettings: (state, action) => {
|
|
2202
2283
|
state.userSettingsInitialized = true;
|
|
2203
|
-
state.userSettings =
|
|
2284
|
+
state.userSettings = {
|
|
2285
|
+
...state.userSettings,
|
|
2286
|
+
...action.payload
|
|
2287
|
+
};
|
|
2204
2288
|
},
|
|
2205
2289
|
setTooltipState: (state, action) => {
|
|
2206
2290
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2207
2291
|
state.tooltips.byId[id].readState = readState;
|
|
2208
2292
|
},
|
|
2209
2293
|
setTooltipsState: (state, action) => {
|
|
2210
|
-
state.tooltips.byId =
|
|
2294
|
+
state.tooltips.byId = {
|
|
2295
|
+
...state.tooltips.byId,
|
|
2296
|
+
...action.payload
|
|
2297
|
+
};
|
|
2211
2298
|
},
|
|
2212
2299
|
setShowFeedbackDialog: (state, action) => {
|
|
2213
2300
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2224,7 +2311,16 @@ var actions8 = usersSlice.actions;
|
|
|
2224
2311
|
var usersSlice_default = usersSlice.reducer;
|
|
2225
2312
|
|
|
2226
2313
|
// src/actions.ts
|
|
2227
|
-
var actions_default =
|
|
2314
|
+
var actions_default = {
|
|
2315
|
+
...actions,
|
|
2316
|
+
...actions2,
|
|
2317
|
+
...actions3,
|
|
2318
|
+
...actions4,
|
|
2319
|
+
...actions5,
|
|
2320
|
+
...actions6,
|
|
2321
|
+
...actions7,
|
|
2322
|
+
...actions8
|
|
2323
|
+
};
|
|
2228
2324
|
|
|
2229
2325
|
// src/api/general-api.ts
|
|
2230
2326
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2235,18 +2331,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2235
2331
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2236
2332
|
var tokenCache = "";
|
|
2237
2333
|
var getSessionInfo = () => {
|
|
2238
|
-
|
|
2239
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2334
|
+
let sessionInfo = { ...emptySession };
|
|
2240
2335
|
try {
|
|
2241
|
-
sessionInfo = JSON.parse(
|
|
2242
|
-
} catch
|
|
2336
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2337
|
+
} catch {
|
|
2243
2338
|
}
|
|
2244
2339
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2245
2340
|
cleanUp();
|
|
2246
|
-
return
|
|
2341
|
+
return { ...emptySession };
|
|
2247
2342
|
}
|
|
2248
2343
|
if (!sessionInfo.token) {
|
|
2249
|
-
let jwtTokenFromCookie =
|
|
2344
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2250
2345
|
if (jwtTokenFromCookie) {
|
|
2251
2346
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2252
2347
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2274,8 +2369,7 @@ var maxSessionAge = 900;
|
|
|
2274
2369
|
|
|
2275
2370
|
// src/api/general-api.ts
|
|
2276
2371
|
var unauthorizedRedirect = (error) => {
|
|
2277
|
-
|
|
2278
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2372
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2279
2373
|
cleanUp();
|
|
2280
2374
|
window.location.replace("/ui/");
|
|
2281
2375
|
}
|
|
@@ -2285,7 +2379,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2285
2379
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2286
2380
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2287
2381
|
authenticatedRequest.interceptors.request.use(
|
|
2288
|
-
(config) =>
|
|
2382
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2289
2383
|
(error) => Promise.reject(error)
|
|
2290
2384
|
);
|
|
2291
2385
|
var Api = {
|
|
@@ -2293,7 +2387,7 @@ var Api = {
|
|
|
2293
2387
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2294
2388
|
patch: authenticatedRequest.patch,
|
|
2295
2389
|
post: authenticatedRequest.post,
|
|
2296
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2390
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2297
2391
|
put: authenticatedRequest.put,
|
|
2298
2392
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2299
2393
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2324,10 +2418,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2324
2418
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2325
2419
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2326
2420
|
[getFullVersionInformation, getFeatures],
|
|
2327
|
-
(
|
|
2328
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2329
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2330
|
-
}
|
|
2421
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2331
2422
|
);
|
|
2332
2423
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2333
2424
|
|
|
@@ -2344,8 +2435,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2344
2435
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2345
2436
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2346
2437
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2347
|
-
|
|
2348
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2438
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2349
2439
|
return selection.reduce((accu, id) => {
|
|
2350
2440
|
if (deploymentsById[id]) {
|
|
2351
2441
|
accu.push(deploymentsById[id]);
|
|
@@ -2389,7 +2479,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2389
2479
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2390
2480
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2391
2481
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2392
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2482
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2483
|
+
...filteringAttributes,
|
|
2393
2484
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2394
2485
|
}));
|
|
2395
2486
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2417,10 +2508,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2417
2508
|
return accu;
|
|
2418
2509
|
}, {})
|
|
2419
2510
|
);
|
|
2420
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2421
|
-
var _a;
|
|
2422
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2423
|
-
});
|
|
2511
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2424
2512
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2425
2513
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2426
2514
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2437,17 +2525,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2437
2525
|
[getAcceptedDevices, getDeviceLimit],
|
|
2438
2526
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2439
2527
|
);
|
|
2440
|
-
var
|
|
2441
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2442
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2443
|
-
return groups;
|
|
2444
|
-
});
|
|
2528
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2445
2529
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2446
2530
|
const groupNames = Object.keys(groupsById).sort();
|
|
2447
2531
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2448
2532
|
(accu, [groupname, group]) => {
|
|
2449
2533
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2450
|
-
const groupItem =
|
|
2534
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2451
2535
|
if (group.filters.length > 0) {
|
|
2452
2536
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2453
2537
|
accu.dynamic.push(groupItem);
|
|
@@ -2461,7 +2545,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2461
2545
|
},
|
|
2462
2546
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2463
2547
|
);
|
|
2464
|
-
return
|
|
2548
|
+
return { groupNames, ...groupedGroups };
|
|
2465
2549
|
});
|
|
2466
2550
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2467
2551
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2496,15 +2580,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
2496
2580
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
2497
2581
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
2498
2582
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
2499
|
-
var getTenantsList = (state) => state.organization.
|
|
2583
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
2500
2584
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
2501
2585
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2502
2586
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2503
2587
|
[getExternalIntegrations],
|
|
2504
|
-
(integrations) => integrations.filter((integration) =>
|
|
2505
|
-
var _a;
|
|
2506
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2507
|
-
})
|
|
2588
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2508
2589
|
);
|
|
2509
2590
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2510
2591
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2538,15 +2619,12 @@ var filterProcessors = {
|
|
|
2538
2619
|
var filterAliases = {
|
|
2539
2620
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2540
2621
|
};
|
|
2541
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2548
|
-
};
|
|
2549
|
-
});
|
|
2622
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2623
|
+
scope: filter.scope,
|
|
2624
|
+
attribute: filter.key,
|
|
2625
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2626
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2627
|
+
}));
|
|
2550
2628
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2551
2629
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2552
2630
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2556,14 +2634,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2556
2634
|
});
|
|
2557
2635
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2558
2636
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2559
|
-
return
|
|
2637
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2560
2638
|
}
|
|
2561
2639
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2562
2640
|
});
|
|
2563
2641
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2564
|
-
var _a;
|
|
2565
2642
|
let applicableFilters = [...filters];
|
|
2566
|
-
if (typeof group === "string" && !(
|
|
2643
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2567
2644
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2568
2645
|
}
|
|
2569
2646
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2584,12 +2661,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2584
2661
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2585
2662
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2586
2663
|
if (id && byId[id]) {
|
|
2587
|
-
accu.push(
|
|
2664
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2588
2665
|
}
|
|
2589
2666
|
return accu;
|
|
2590
2667
|
}, []);
|
|
2591
2668
|
};
|
|
2592
|
-
var mergePermissions = (existingPermissions =
|
|
2669
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2593
2670
|
(accu, [key, value]) => {
|
|
2594
2671
|
let values;
|
|
2595
2672
|
if (!accu[key]) {
|
|
@@ -2599,12 +2676,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2599
2676
|
if (Array.isArray(value)) {
|
|
2600
2677
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2601
2678
|
} else {
|
|
2602
|
-
values = mergePermissions(accu[key],
|
|
2679
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2603
2680
|
}
|
|
2604
2681
|
accu[key] = values;
|
|
2605
2682
|
return accu;
|
|
2606
2683
|
},
|
|
2607
|
-
|
|
2684
|
+
{ ...addedPermissions }
|
|
2608
2685
|
);
|
|
2609
2686
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2610
2687
|
(accu, roleId) => {
|
|
@@ -2613,20 +2690,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2613
2690
|
}
|
|
2614
2691
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2615
2692
|
},
|
|
2616
|
-
|
|
2693
|
+
{ ...emptyUiPermissions }
|
|
2617
2694
|
);
|
|
2618
2695
|
var progress = ({ loaded, total }) => {
|
|
2619
2696
|
let uploadProgress4 = loaded / total * 100;
|
|
2620
2697
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2621
2698
|
};
|
|
2622
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2623
|
-
var _a, _b2, _c, _d, _e;
|
|
2624
|
-
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;
|
|
2625
|
-
};
|
|
2699
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2626
2700
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2627
2701
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2628
2702
|
try {
|
|
2629
|
-
if (
|
|
2703
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2630
2704
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2631
2705
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2632
2706
|
}
|
|
@@ -2641,9 +2715,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2641
2715
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2642
2716
|
return accu;
|
|
2643
2717
|
}
|
|
2644
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2718
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2719
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2645
2720
|
[attribute.name]: attribute.value
|
|
2646
|
-
}
|
|
2721
|
+
};
|
|
2647
2722
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2648
2723
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2649
2724
|
}
|
|
@@ -2662,15 +2737,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2662
2737
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2663
2738
|
var getReleaseMappingDefaults = () => ({});
|
|
2664
2739
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2665
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2740
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2666
2741
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2667
2742
|
[getReleaseListState, getReleasesById],
|
|
2668
2743
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2669
2744
|
);
|
|
2670
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2671
|
-
var _a;
|
|
2672
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2673
|
-
});
|
|
2745
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2674
2746
|
|
|
2675
2747
|
// src/usersSlice/selectors.ts
|
|
2676
2748
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2679,10 +2751,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2679
2751
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2680
2752
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2681
2753
|
var getUsersById = (state) => state.users.byId;
|
|
2682
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2683
|
-
var _a;
|
|
2684
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2685
|
-
});
|
|
2754
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2686
2755
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2687
2756
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2688
2757
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2693,22 +2762,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2693
2762
|
[getTooltipsById, getUserSettings],
|
|
2694
2763
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2695
2764
|
(accu, [id, value]) => {
|
|
2696
|
-
accu[id] =
|
|
2765
|
+
accu[id] = { ...accu[id], ...value };
|
|
2697
2766
|
return accu;
|
|
2698
2767
|
},
|
|
2699
|
-
|
|
2768
|
+
{ ...tooltips }
|
|
2700
2769
|
)
|
|
2701
2770
|
);
|
|
2702
2771
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2703
2772
|
[getCurrentUser],
|
|
2704
2773
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2705
2774
|
);
|
|
2706
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2775
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2707
2776
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2708
|
-
interval:
|
|
2709
|
-
intervalUnit:
|
|
2777
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2778
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2710
2779
|
}));
|
|
2711
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2780
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2712
2781
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2713
2782
|
|
|
2714
2783
|
// src/commonSelectors.ts
|
|
@@ -2727,8 +2796,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2727
2796
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2728
2797
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2729
2798
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2730
|
-
|
|
2731
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2799
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2732
2800
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2733
2801
|
return { isAdmin, uiPermissions };
|
|
2734
2802
|
}
|
|
@@ -2797,10 +2865,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2797
2865
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2798
2866
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2799
2867
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2800
|
-
const updateAttribute =
|
|
2868
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2801
2869
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2802
2870
|
const attributes = [
|
|
2803
|
-
...previousFilters.map((item) =>
|
|
2871
|
+
...previousFilters.map((item) => ({
|
|
2872
|
+
...item,
|
|
2804
2873
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2805
2874
|
category: "recently used",
|
|
2806
2875
|
priority: 0
|
|
@@ -2818,14 +2887,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2818
2887
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2819
2888
|
}
|
|
2820
2889
|
);
|
|
2821
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
});
|
|
2890
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2891
|
+
...remainder,
|
|
2892
|
+
...onboarding,
|
|
2893
|
+
complete: onboarding.complete || complete,
|
|
2894
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2895
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2896
|
+
}));
|
|
2829
2897
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2830
2898
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2831
2899
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2846,12 +2914,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2846
2914
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2847
2915
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2848
2916
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2849
|
-
|
|
2850
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2917
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2851
2918
|
const { devices = {} } = deployment;
|
|
2852
2919
|
return {
|
|
2853
2920
|
deployment,
|
|
2854
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2921
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2855
2922
|
};
|
|
2856
2923
|
}
|
|
2857
2924
|
);
|
|
@@ -2866,8 +2933,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2866
2933
|
}, {})
|
|
2867
2934
|
);
|
|
2868
2935
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2869
|
-
|
|
2870
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2936
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2871
2937
|
if (staticOnly) {
|
|
2872
2938
|
return Object.keys(uiPermissions.groups).sort();
|
|
2873
2939
|
}
|
|
@@ -2901,9 +2967,25 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2901
2967
|
if (auditlogEvent) {
|
|
2902
2968
|
const { object = {} } = auditlogEvent;
|
|
2903
2969
|
const { device = {}, id, type } = object;
|
|
2904
|
-
auditlogDevice = type === "device" ?
|
|
2970
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2905
2971
|
}
|
|
2906
|
-
return
|
|
2972
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2973
|
+
});
|
|
2974
|
+
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2975
|
+
if (service_provider) {
|
|
2976
|
+
return roles.reduce((accu, role) => {
|
|
2977
|
+
if (rolesById[role.id]) {
|
|
2978
|
+
return accu;
|
|
2979
|
+
}
|
|
2980
|
+
accu.push(role);
|
|
2981
|
+
return accu;
|
|
2982
|
+
}, Object.values(serviceProviderRolesById));
|
|
2983
|
+
}
|
|
2984
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2985
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2986
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2987
|
+
return accu;
|
|
2988
|
+
}, roles);
|
|
2907
2989
|
});
|
|
2908
2990
|
|
|
2909
2991
|
// src/store.ts
|
|
@@ -2939,8 +3021,9 @@ var sessionReducer = (state, action) => {
|
|
|
2939
3021
|
return rootReducer(state, action);
|
|
2940
3022
|
};
|
|
2941
3023
|
var getConfiguredStore = (options = {}) => {
|
|
2942
|
-
const
|
|
2943
|
-
return (0, import_toolkit16.configureStore)(
|
|
3024
|
+
const { preloadedState = {}, ...config } = options;
|
|
3025
|
+
return (0, import_toolkit16.configureStore)({
|
|
3026
|
+
...config,
|
|
2944
3027
|
preloadedState,
|
|
2945
3028
|
reducer: sessionReducer,
|
|
2946
3029
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2953,7 +3036,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2953
3036
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2954
3037
|
}
|
|
2955
3038
|
})
|
|
2956
|
-
})
|
|
3039
|
+
});
|
|
2957
3040
|
};
|
|
2958
3041
|
var store = getConfiguredStore({
|
|
2959
3042
|
preloadedState: {}
|
|
@@ -2973,17 +3056,16 @@ var dateFunctionMap = {
|
|
|
2973
3056
|
setDays: "setDate"
|
|
2974
3057
|
};
|
|
2975
3058
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2976
|
-
var _a, _b2;
|
|
2977
3059
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2978
3060
|
const today = /* @__PURE__ */ new Date();
|
|
2979
3061
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2980
|
-
const setter =
|
|
2981
|
-
const getter =
|
|
3062
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3063
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2982
3064
|
today[setter](today[getter]() - interval);
|
|
2983
3065
|
let value;
|
|
2984
3066
|
try {
|
|
2985
3067
|
value = today.toISOString();
|
|
2986
|
-
} catch
|
|
3068
|
+
} catch {
|
|
2987
3069
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2988
3070
|
}
|
|
2989
3071
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3024,37 +3106,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3024
3106
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3025
3107
|
return accu;
|
|
3026
3108
|
},
|
|
3027
|
-
{ latestVersions:
|
|
3109
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3028
3110
|
);
|
|
3029
3111
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3030
3112
|
return Promise.resolve(
|
|
3031
3113
|
dispatch(
|
|
3032
|
-
actions.setVersionInformation(
|
|
3114
|
+
actions.setVersionInformation({
|
|
3115
|
+
...latestVersions,
|
|
3033
3116
|
backend: info,
|
|
3034
3117
|
GUI: info,
|
|
3035
3118
|
latestRelease: {
|
|
3036
3119
|
releaseDate: latestRelease.release_date,
|
|
3037
3120
|
repos: latestRepos
|
|
3038
3121
|
}
|
|
3039
|
-
})
|
|
3122
|
+
})
|
|
3040
3123
|
)
|
|
3041
3124
|
);
|
|
3042
3125
|
});
|
|
3043
3126
|
});
|
|
3044
3127
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3045
3128
|
const currentState = getSearchState(getState());
|
|
3046
|
-
let nextState =
|
|
3047
|
-
|
|
3048
|
-
|
|
3129
|
+
let nextState = {
|
|
3130
|
+
...currentState,
|
|
3131
|
+
...searchState,
|
|
3132
|
+
sort: {
|
|
3133
|
+
...currentState.sort,
|
|
3134
|
+
...searchState.sort
|
|
3135
|
+
}
|
|
3136
|
+
};
|
|
3049
3137
|
let tasks = [];
|
|
3050
|
-
const
|
|
3051
|
-
const
|
|
3138
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3139
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3052
3140
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3053
3141
|
nextState.isSearching = true;
|
|
3054
3142
|
tasks.push(
|
|
3055
3143
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3056
3144
|
const searchResult = results[results.length - 1];
|
|
3057
|
-
return dispatch(actions.setSearchState(
|
|
3145
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3058
3146
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3059
3147
|
);
|
|
3060
3148
|
}
|
|
@@ -3071,13 +3159,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3071
3159
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3072
3160
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3073
3161
|
(accu, item) => {
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3162
|
+
const filter = item.filter ?? {};
|
|
3163
|
+
let deployment = {
|
|
3164
|
+
...deploymentPrototype,
|
|
3165
|
+
...deploymentsById[item.id],
|
|
3166
|
+
...item,
|
|
3167
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3078
3168
|
name: decodeURIComponent(item.name)
|
|
3079
|
-
}
|
|
3080
|
-
deployment =
|
|
3169
|
+
};
|
|
3170
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3081
3171
|
accu.deployments[item.id] = deployment;
|
|
3082
3172
|
accu.deploymentIds.push(item.id);
|
|
3083
3173
|
return accu;
|
|
@@ -3131,11 +3221,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3131
3221
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3132
3222
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3133
3223
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3134
|
-
const deployment =
|
|
3224
|
+
const deployment = {
|
|
3225
|
+
...newDeployment,
|
|
3135
3226
|
id: deploymentId,
|
|
3136
3227
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3137
3228
|
statistics: { status: {} }
|
|
3138
|
-
}
|
|
3229
|
+
};
|
|
3139
3230
|
let tasks = [
|
|
3140
3231
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3141
3232
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3278,14 +3369,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3278
3369
|
({ 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))))
|
|
3279
3370
|
);
|
|
3280
3371
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3281
|
-
const
|
|
3372
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3282
3373
|
const currentState = getState().deployments.selectionState;
|
|
3283
|
-
let nextState =
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3374
|
+
let nextState = {
|
|
3375
|
+
...currentState,
|
|
3376
|
+
...selectionState,
|
|
3377
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3378
|
+
accu[item] = {
|
|
3379
|
+
...currentState[item],
|
|
3380
|
+
...selectionState[item]
|
|
3381
|
+
};
|
|
3382
|
+
return accu;
|
|
3383
|
+
}, {}),
|
|
3384
|
+
general: {
|
|
3385
|
+
...currentState.general,
|
|
3386
|
+
...selectionState.general
|
|
3387
|
+
}
|
|
3388
|
+
};
|
|
3289
3389
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3290
3390
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3291
3391
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3315,15 +3415,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3315
3415
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3316
3416
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3317
3417
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3318
|
-
const config =
|
|
3418
|
+
const config = {
|
|
3419
|
+
...oldConfig,
|
|
3319
3420
|
hasDelta: Boolean(delta.enabled),
|
|
3320
|
-
binaryDelta:
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3421
|
+
binaryDelta: {
|
|
3422
|
+
...oldConfig.binaryDelta,
|
|
3423
|
+
timeout: timeoutConfig,
|
|
3424
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3425
|
+
},
|
|
3426
|
+
binaryDeltaLimits: {
|
|
3427
|
+
...oldConfig.binaryDeltaLimits,
|
|
3428
|
+
timeout: timeoutLimit,
|
|
3429
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3430
|
+
}
|
|
3431
|
+
};
|
|
3327
3432
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3328
3433
|
})
|
|
3329
3434
|
);
|
|
@@ -3333,7 +3438,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3333
3438
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3334
3439
|
return accu;
|
|
3335
3440
|
}
|
|
3336
|
-
accu =
|
|
3441
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3337
3442
|
}
|
|
3338
3443
|
return accu;
|
|
3339
3444
|
}, void 0);
|
|
@@ -3353,9 +3458,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3353
3458
|
}
|
|
3354
3459
|
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(() => {
|
|
3355
3460
|
const oldConfig = getState().deployments.config;
|
|
3356
|
-
const newConfig =
|
|
3357
|
-
|
|
3358
|
-
|
|
3461
|
+
const newConfig = {
|
|
3462
|
+
...oldConfig,
|
|
3463
|
+
binaryDelta: {
|
|
3464
|
+
...oldConfig.binaryDelta,
|
|
3465
|
+
...config
|
|
3466
|
+
}
|
|
3467
|
+
};
|
|
3359
3468
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3360
3469
|
});
|
|
3361
3470
|
});
|
|
@@ -3366,7 +3475,7 @@ var { page: defaultPage2, perPage: defaultPerPage2 } = DEVICE_LIST_DEFAULTS;
|
|
|
3366
3475
|
var cutoffLength = 75;
|
|
3367
3476
|
var ellipsis = "...";
|
|
3368
3477
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
3369
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
3478
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
3370
3479
|
var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
3371
3480
|
const { page = defaultPage2, perPage = defaultPerPage2, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
3372
3481
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -3384,14 +3493,15 @@ var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4
|
|
|
3384
3493
|
});
|
|
3385
3494
|
var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
3386
3495
|
const state = getState();
|
|
3387
|
-
const
|
|
3388
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
3496
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
3497
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3498
|
+
...remainder,
|
|
3389
3499
|
filters,
|
|
3390
3500
|
group,
|
|
3391
3501
|
offlineThreshold: state.app.offlineThreshold,
|
|
3392
3502
|
selectedIssues: [type],
|
|
3393
3503
|
status
|
|
3394
|
-
})
|
|
3504
|
+
});
|
|
3395
3505
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
3396
3506
|
page: 1,
|
|
3397
3507
|
per_page: 1,
|
|
@@ -3443,21 +3553,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
3443
3553
|
return steps[progress2];
|
|
3444
3554
|
};
|
|
3445
3555
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
3446
|
-
var _a;
|
|
3447
3556
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
3448
3557
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
3449
3558
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
3450
3559
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
3451
|
-
let deviceType =
|
|
3560
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
3452
3561
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
3453
3562
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
3454
|
-
return
|
|
3563
|
+
return {
|
|
3564
|
+
...onboardingState,
|
|
3455
3565
|
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)),
|
|
3456
3566
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
3457
3567
|
deviceType,
|
|
3458
3568
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
3459
3569
|
progress: progress2
|
|
3460
|
-
}
|
|
3570
|
+
};
|
|
3461
3571
|
};
|
|
3462
3572
|
var getOnboardingState2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
3463
3573
|
const state = getState();
|
|
@@ -3515,7 +3625,7 @@ var advanceOnboarding = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/ad
|
|
|
3515
3625
|
return;
|
|
3516
3626
|
}
|
|
3517
3627
|
const madeProgress = steps[stepIndex + 1];
|
|
3518
|
-
const state =
|
|
3628
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
3519
3629
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
3520
3630
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
3521
3631
|
});
|
|
@@ -3598,8 +3708,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
3598
3708
|
({ 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())))
|
|
3599
3709
|
);
|
|
3600
3710
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
3601
|
-
const userId =
|
|
3602
|
-
const detail =
|
|
3711
|
+
const userId = userFilter?.id || userFilter;
|
|
3712
|
+
const detail = detailFilter?.id || detailFilter;
|
|
3603
3713
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
3604
3714
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
3605
3715
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -3626,12 +3736,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
3626
3736
|
);
|
|
3627
3737
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
3628
3738
|
const currentState = getAuditlogState(getState());
|
|
3629
|
-
let nextState =
|
|
3630
|
-
|
|
3631
|
-
|
|
3739
|
+
let nextState = {
|
|
3740
|
+
...currentState,
|
|
3741
|
+
...selectionState,
|
|
3742
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3743
|
+
};
|
|
3632
3744
|
let tasks = [];
|
|
3633
|
-
const
|
|
3634
|
-
const
|
|
3745
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
3746
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
3635
3747
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
3636
3748
|
nextState.isLoading = true;
|
|
3637
3749
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -3643,27 +3755,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
3643
3755
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
3644
3756
|
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));
|
|
3645
3757
|
});
|
|
3646
|
-
var tenantListRetrieval = (config) =>
|
|
3758
|
+
var tenantListRetrieval = async (config) => {
|
|
3647
3759
|
const { page, perPage } = config;
|
|
3648
3760
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
3649
|
-
const tenantList =
|
|
3761
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
3650
3762
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
3651
|
-
return [tenantList.data, totalCount];
|
|
3652
|
-
}
|
|
3653
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
3763
|
+
return [tenantList.data, Number(totalCount)];
|
|
3764
|
+
};
|
|
3765
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
3654
3766
|
const currentState = getTenantsList(getState());
|
|
3655
|
-
const [tenants, pageCount] =
|
|
3656
|
-
dispatch(actions6.setTenantListState(
|
|
3657
|
-
})
|
|
3658
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
3767
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
3768
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
3769
|
+
});
|
|
3770
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
3659
3771
|
const currentState = getTenantsList(getState());
|
|
3660
|
-
const nextState =
|
|
3772
|
+
const nextState = {
|
|
3773
|
+
...currentState,
|
|
3774
|
+
...selectionState
|
|
3775
|
+
};
|
|
3661
3776
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
3662
|
-
const [tenants, pageCount] =
|
|
3663
|
-
return dispatch(actions6.setTenantListState(
|
|
3777
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
3778
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
3664
3779
|
}
|
|
3665
|
-
return dispatch(actions6.setTenantListState(
|
|
3666
|
-
})
|
|
3780
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
3781
|
+
});
|
|
3667
3782
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
3668
3783
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
3669
3784
|
const tasks = [Promise.resolve(dispatch(setSnackbar3("Device Limit was changed successfully")))];
|
|
@@ -3706,10 +3821,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
3706
3821
|
);
|
|
3707
3822
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
3708
3823
|
`${sliceName6}/createIntegration`,
|
|
3709
|
-
(
|
|
3710
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
3711
|
-
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())]));
|
|
3712
|
-
}
|
|
3824
|
+
({ 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())]))
|
|
3713
3825
|
);
|
|
3714
3826
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
3715
3827
|
`${sliceName6}/changeIntegration`,
|
|
@@ -3730,9 +3842,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
3730
3842
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
3731
3843
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
3732
3844
|
const integrations = data.reduce((accu, item) => {
|
|
3733
|
-
|
|
3734
|
-
const
|
|
3735
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
3845
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
3846
|
+
const integration = { ...existingIntegration, ...item };
|
|
3736
3847
|
accu.push(integration);
|
|
3737
3848
|
return accu;
|
|
3738
3849
|
}, []);
|
|
@@ -3784,7 +3895,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
3784
3895
|
`${sliceName6}/getSsoConfigById`,
|
|
3785
3896
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
3786
3897
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
3787
|
-
return sso ? Promise.resolve(
|
|
3898
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
3788
3899
|
})
|
|
3789
3900
|
);
|
|
3790
3901
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -3800,19 +3911,20 @@ var import_locationutils = require("@northern.tech/utils/locationutils");
|
|
|
3800
3911
|
var import_toolkit22 = require("@reduxjs/toolkit");
|
|
3801
3912
|
var import_axios2 = require("axios");
|
|
3802
3913
|
|
|
3803
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3804
|
-
var
|
|
3805
|
-
var
|
|
3806
|
-
var poolPtr = rnds8Pool.length;
|
|
3914
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3915
|
+
var getRandomValues;
|
|
3916
|
+
var rnds8 = new Uint8Array(16);
|
|
3807
3917
|
function rng() {
|
|
3808
|
-
if (
|
|
3809
|
-
|
|
3810
|
-
|
|
3918
|
+
if (!getRandomValues) {
|
|
3919
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3920
|
+
if (!getRandomValues) {
|
|
3921
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3922
|
+
}
|
|
3811
3923
|
}
|
|
3812
|
-
return
|
|
3924
|
+
return getRandomValues(rnds8);
|
|
3813
3925
|
}
|
|
3814
3926
|
|
|
3815
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3927
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3816
3928
|
var byteToHex = [];
|
|
3817
3929
|
for (let i = 0; i < 256; ++i) {
|
|
3818
3930
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3821,13 +3933,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3821
3933
|
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]];
|
|
3822
3934
|
}
|
|
3823
3935
|
|
|
3824
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3825
|
-
var
|
|
3936
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3937
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3826
3938
|
var native_default = {
|
|
3827
|
-
randomUUID
|
|
3939
|
+
randomUUID
|
|
3828
3940
|
};
|
|
3829
3941
|
|
|
3830
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3942
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3831
3943
|
function v4(options, buf, offset) {
|
|
3832
3944
|
if (native_default.randomUUID && !buf && !options) {
|
|
3833
3945
|
return native_default.randomUUID();
|
|
@@ -3852,20 +3964,21 @@ var { setSnackbar: setSnackbar4, initUpload, uploadProgress: uploadProgress2, cl
|
|
|
3852
3964
|
var { page: defaultPage4, perPage: defaultPerPage4 } = DEVICE_LIST_DEFAULTS;
|
|
3853
3965
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
3854
3966
|
var flattenRelease = (release, stateRelease) => {
|
|
3855
|
-
|
|
3856
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
3967
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
3857
3968
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
3858
3969
|
(accu, item) => {
|
|
3859
|
-
var _a2;
|
|
3860
3970
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
3861
|
-
const stateArtifact =
|
|
3971
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
3862
3972
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
3863
|
-
accu.artifacts.push(
|
|
3973
|
+
accu.artifacts.push({
|
|
3974
|
+
...stateArtifact,
|
|
3975
|
+
...item
|
|
3976
|
+
});
|
|
3864
3977
|
return accu;
|
|
3865
3978
|
},
|
|
3866
3979
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
3867
3980
|
);
|
|
3868
|
-
return
|
|
3981
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
3869
3982
|
};
|
|
3870
3983
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
3871
3984
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -3883,17 +3996,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
3883
3996
|
{ release: null, index: -1 }
|
|
3884
3997
|
);
|
|
3885
3998
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
3886
|
-
var _a;
|
|
3887
3999
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
3888
4000
|
if (!release || index === -1) {
|
|
3889
4001
|
return;
|
|
3890
4002
|
}
|
|
3891
4003
|
const releaseArtifacts = [...release.artifacts];
|
|
3892
4004
|
const artifact = releaseArtifacts[index];
|
|
3893
|
-
const { key, name, version } = (
|
|
4005
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
3894
4006
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
3895
4007
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
3896
|
-
filters: [
|
|
4008
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
3897
4009
|
});
|
|
3898
4010
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
3899
4011
|
page: 1,
|
|
@@ -3907,10 +4019,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
3907
4019
|
}
|
|
3908
4020
|
const installCount = Number(headers[headerNames.total]);
|
|
3909
4021
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
3910
|
-
releaseArtifacts2[index2] =
|
|
3911
|
-
release2 =
|
|
4022
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4023
|
+
release2 = {
|
|
4024
|
+
...release2,
|
|
3912
4025
|
artifacts: releaseArtifacts2
|
|
3913
|
-
}
|
|
4026
|
+
};
|
|
3914
4027
|
return dispatch(actions7.receiveRelease(release2));
|
|
3915
4028
|
});
|
|
3916
4029
|
});
|
|
@@ -3922,12 +4035,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
3922
4035
|
return dispatch(getReleases());
|
|
3923
4036
|
}
|
|
3924
4037
|
const releaseArtifacts = [...release.artifacts];
|
|
3925
|
-
releaseArtifacts[index] =
|
|
4038
|
+
releaseArtifacts[index] = {
|
|
4039
|
+
...releaseArtifacts[index],
|
|
3926
4040
|
url: response.data.uri
|
|
3927
|
-
}
|
|
3928
|
-
release =
|
|
4041
|
+
};
|
|
4042
|
+
release = {
|
|
4043
|
+
...release,
|
|
3929
4044
|
artifacts: releaseArtifacts
|
|
3930
|
-
}
|
|
4045
|
+
};
|
|
3931
4046
|
return dispatch(actions7.receiveRelease(release));
|
|
3932
4047
|
})
|
|
3933
4048
|
);
|
|
@@ -4052,12 +4167,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4052
4167
|
});
|
|
4053
4168
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4054
4169
|
const currentState = getState().releases.releasesList;
|
|
4055
|
-
let nextState =
|
|
4056
|
-
|
|
4057
|
-
|
|
4170
|
+
let nextState = {
|
|
4171
|
+
...currentState,
|
|
4172
|
+
...selectionState,
|
|
4173
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4174
|
+
};
|
|
4058
4175
|
let tasks = [];
|
|
4059
|
-
const
|
|
4060
|
-
const
|
|
4176
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4177
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4061
4178
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4062
4179
|
nextState.isLoading = true;
|
|
4063
4180
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4076,29 +4193,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4076
4193
|
);
|
|
4077
4194
|
};
|
|
4078
4195
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4079
|
-
let releaseListState =
|
|
4196
|
+
let releaseListState = { ...state.releasesList };
|
|
4080
4197
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4081
4198
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4082
4199
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4083
4200
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4084
4201
|
if (searchOnly) {
|
|
4085
|
-
releaseListState =
|
|
4202
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4086
4203
|
} else {
|
|
4087
|
-
releaseListState =
|
|
4204
|
+
releaseListState = {
|
|
4205
|
+
...releaseListState,
|
|
4088
4206
|
releaseIds,
|
|
4089
4207
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4090
4208
|
total: !isFiltering ? total : state.releasesList.total
|
|
4091
|
-
}
|
|
4209
|
+
};
|
|
4092
4210
|
}
|
|
4093
4211
|
return releaseListState;
|
|
4094
4212
|
};
|
|
4095
4213
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4096
|
-
const config =
|
|
4214
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4097
4215
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4098
4216
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4099
4217
|
const state = getState().releases;
|
|
4100
4218
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4101
|
-
const combinedReleases =
|
|
4219
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4102
4220
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4103
4221
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4104
4222
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4119,7 +4237,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4119
4237
|
`${sliceName7}/updateReleaseInfo`,
|
|
4120
4238
|
({ 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(() => {
|
|
4121
4239
|
return Promise.all([
|
|
4122
|
-
dispatch(actions7.receiveRelease(
|
|
4240
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4123
4241
|
dispatch(setSnackbar4("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4124
4242
|
]);
|
|
4125
4243
|
})
|
|
@@ -4128,7 +4246,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4128
4246
|
`${sliceName7}/setReleaseTags`,
|
|
4129
4247
|
({ 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(() => {
|
|
4130
4248
|
return Promise.all([
|
|
4131
|
-
dispatch(actions7.receiveRelease(
|
|
4249
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4132
4250
|
dispatch(setSnackbar4("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4133
4251
|
]);
|
|
4134
4252
|
})
|
|
@@ -4145,19 +4263,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4145
4263
|
// src/api/users-api.ts
|
|
4146
4264
|
var import_axios3 = __toESM(require("axios"));
|
|
4147
4265
|
var Api2 = {
|
|
4148
|
-
postLogin: (url,
|
|
4149
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4150
|
-
return import_axios3.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4151
|
-
var _a2;
|
|
4152
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4153
|
-
});
|
|
4154
|
-
},
|
|
4266
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios3.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
4155
4267
|
putVerifyTFA: (url, userData) => {
|
|
4156
4268
|
let body = {};
|
|
4157
4269
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4158
4270
|
body = { token2fa: userData.token2fa };
|
|
4159
4271
|
}
|
|
4160
|
-
return import_axios3.default.put(url, body,
|
|
4272
|
+
return import_axios3.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4161
4273
|
}
|
|
4162
4274
|
};
|
|
4163
4275
|
var users_api_default = Api2;
|
|
@@ -4185,43 +4297,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4185
4297
|
};
|
|
4186
4298
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4187
4299
|
`${sliceName8}/loginUser`,
|
|
4188
|
-
(
|
|
4189
|
-
|
|
4190
|
-
return
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
Promise.
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
window.
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
);
|
|
4223
|
-
});
|
|
4224
|
-
}
|
|
4300
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
4301
|
+
cleanUp();
|
|
4302
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
4303
|
+
}).then(({ text: response, contentType }) => {
|
|
4304
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
4305
|
+
const { id, kind } = response;
|
|
4306
|
+
const type = kind.split("/")[1];
|
|
4307
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
4308
|
+
window.location.replace(ssoLoginUrl);
|
|
4309
|
+
return;
|
|
4310
|
+
}
|
|
4311
|
+
const token = response;
|
|
4312
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
4313
|
+
return;
|
|
4314
|
+
}
|
|
4315
|
+
let now = /* @__PURE__ */ new Date();
|
|
4316
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
4317
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
4318
|
+
setSessionInfo({ token, expiresAt });
|
|
4319
|
+
cookies5.remove("JWT", { path: "/" });
|
|
4320
|
+
return (
|
|
4321
|
+
// @ts-ignore
|
|
4322
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
4323
|
+
cleanUp();
|
|
4324
|
+
return Promise.reject(dispatch(setSnackbar5(extractErrorMessage(e))));
|
|
4325
|
+
}).then(() => {
|
|
4326
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
4327
|
+
if (window.location.pathname !== "/ui/") {
|
|
4328
|
+
window.location.replace("/ui/");
|
|
4329
|
+
}
|
|
4330
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
4331
|
+
})
|
|
4332
|
+
);
|
|
4333
|
+
})
|
|
4225
4334
|
);
|
|
4226
4335
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4227
4336
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4238,7 +4347,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4238
4347
|
return Promise.reject();
|
|
4239
4348
|
}
|
|
4240
4349
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4241
|
-
setSessionInfo(
|
|
4350
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4242
4351
|
window.location.reload();
|
|
4243
4352
|
});
|
|
4244
4353
|
});
|
|
@@ -4301,13 +4410,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4301
4410
|
);
|
|
4302
4411
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
4303
4412
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
4304
|
-
const userId = currentUserId
|
|
4413
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
4305
4414
|
const storageKey = `${userId}-column-widths`;
|
|
4306
4415
|
let customColumns = [];
|
|
4307
4416
|
if (!columns) {
|
|
4308
4417
|
try {
|
|
4309
4418
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
4310
|
-
} catch
|
|
4419
|
+
} catch {
|
|
4311
4420
|
}
|
|
4312
4421
|
} else {
|
|
4313
4422
|
customColumns = columns;
|
|
@@ -4336,10 +4445,7 @@ var userActions = {
|
|
|
4336
4445
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
4337
4446
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4338
4447
|
`${sliceName8}/createUser`,
|
|
4339
|
-
(
|
|
4340
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
4341
|
-
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));
|
|
4342
|
-
}
|
|
4448
|
+
({ 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))
|
|
4343
4449
|
);
|
|
4344
4450
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4345
4451
|
`${sliceName8}/removeUser`,
|
|
@@ -4350,15 +4456,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4350
4456
|
);
|
|
4351
4457
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4352
4458
|
`${sliceName8}/editUser`,
|
|
4353
|
-
(
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
()
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
])
|
|
4360
|
-
);
|
|
4361
|
-
}
|
|
4459
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
4460
|
+
() => Promise.all([
|
|
4461
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
4462
|
+
dispatch(setSnackbar5(userActions.edit.successMessage))
|
|
4463
|
+
])
|
|
4464
|
+
)
|
|
4362
4465
|
);
|
|
4363
4466
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
4364
4467
|
const { id } = getOrganization(getState());
|
|
@@ -4393,7 +4496,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
4393
4496
|
}
|
|
4394
4497
|
return accu;
|
|
4395
4498
|
},
|
|
4396
|
-
|
|
4499
|
+
{ ...emptyUiPermissions }
|
|
4397
4500
|
);
|
|
4398
4501
|
var permissionActionTypes = {
|
|
4399
4502
|
any: mapHttpPermission,
|
|
@@ -4416,20 +4519,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
4416
4519
|
}, existingPermissions);
|
|
4417
4520
|
var tryParseCustomPermission = (permission) => {
|
|
4418
4521
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
4419
|
-
const result = mergePermissions(
|
|
4522
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
4420
4523
|
return { isCustom: true, permission, result };
|
|
4421
4524
|
};
|
|
4422
4525
|
var customPermissionHandler = (accu, permission) => {
|
|
4423
4526
|
let processor = tryParseCustomPermission(permission);
|
|
4424
|
-
return
|
|
4527
|
+
return {
|
|
4528
|
+
...accu,
|
|
4425
4529
|
isCustom: accu.isCustom || processor.isCustom,
|
|
4426
4530
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
4427
|
-
}
|
|
4531
|
+
};
|
|
4428
4532
|
};
|
|
4429
4533
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
4430
4534
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
4431
4535
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
4432
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
4536
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
4433
4537
|
};
|
|
4434
4538
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
4435
4539
|
if (Array.isArray(permissions)) {
|
|
@@ -4444,60 +4548,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
4444
4548
|
if (!processor) {
|
|
4445
4549
|
return accu;
|
|
4446
4550
|
}
|
|
4447
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
4448
|
-
var _a;
|
|
4449
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
4450
|
-
});
|
|
4551
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
4451
4552
|
if (scope) {
|
|
4452
4553
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
4453
|
-
return
|
|
4554
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
4454
4555
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
4455
4556
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
4456
4557
|
}
|
|
4457
|
-
return
|
|
4558
|
+
return {
|
|
4559
|
+
...accu,
|
|
4458
4560
|
isCustom: accu.isCustom || processor.isCustom,
|
|
4459
4561
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
4460
|
-
}
|
|
4562
|
+
};
|
|
4461
4563
|
},
|
|
4462
|
-
{ isCustom: false, uiPermissions:
|
|
4564
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
4463
4565
|
);
|
|
4464
4566
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
4465
4567
|
};
|
|
4466
4568
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
4467
4569
|
(accu, role) => {
|
|
4468
|
-
var _a;
|
|
4469
4570
|
let normalizedPermissions;
|
|
4470
4571
|
let isCustom = false;
|
|
4471
4572
|
if (rolesById2[role.name]) {
|
|
4472
|
-
normalizedPermissions =
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4573
|
+
normalizedPermissions = {
|
|
4574
|
+
...rolesById2[role.name].uiPermissions,
|
|
4575
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
4576
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
4577
|
+
};
|
|
4476
4578
|
} else {
|
|
4477
4579
|
const result = parseRolePermissions(role, permissionSets);
|
|
4478
4580
|
normalizedPermissions = result.uiPermissions;
|
|
4479
4581
|
isCustom = result.isCustom;
|
|
4480
4582
|
}
|
|
4481
|
-
const roleState =
|
|
4482
|
-
accu[role.name] =
|
|
4583
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
4584
|
+
accu[role.name] = {
|
|
4585
|
+
...roleState,
|
|
4586
|
+
...role,
|
|
4483
4587
|
description: roleState.description ? roleState.description : role.description,
|
|
4484
4588
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
4485
4589
|
isCustom,
|
|
4486
4590
|
name: roleState.name ? roleState.name : role.name,
|
|
4487
4591
|
uiPermissions: normalizedPermissions
|
|
4488
|
-
}
|
|
4592
|
+
};
|
|
4489
4593
|
return accu;
|
|
4490
4594
|
},
|
|
4491
|
-
|
|
4595
|
+
{ ...rolesById2 }
|
|
4492
4596
|
);
|
|
4493
4597
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
4494
4598
|
`${sliceName8}/getPermissionSets`,
|
|
4495
4599
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
4496
4600
|
const permissionSets = data.reduce(
|
|
4497
4601
|
(accu, permissionSet) => {
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
4602
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
4603
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
4501
4604
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
4502
4605
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
4503
4606
|
if (scopedPermissionAreas[area]) {
|
|
@@ -4508,11 +4611,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4508
4611
|
}
|
|
4509
4612
|
return collector;
|
|
4510
4613
|
}, accu2),
|
|
4511
|
-
|
|
4614
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
4512
4615
|
);
|
|
4513
4616
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
4514
|
-
|
|
4515
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
4617
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
4516
4618
|
accu2.push(key);
|
|
4517
4619
|
}
|
|
4518
4620
|
return accu2;
|
|
@@ -4525,7 +4627,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4525
4627
|
return accu;
|
|
4526
4628
|
},
|
|
4527
4629
|
// @ts-ignore
|
|
4528
|
-
|
|
4630
|
+
{ ...getState().users.permissionSetsById }
|
|
4529
4631
|
);
|
|
4530
4632
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
4531
4633
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -4558,28 +4660,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
4558
4660
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
4559
4661
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
4560
4662
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
4561
|
-
|
|
4562
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
4663
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
4563
4664
|
type: uiPermissionsByArea[area].scope,
|
|
4564
4665
|
value: []
|
|
4565
4666
|
};
|
|
4566
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
4667
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
4668
|
+
...permissionSetState,
|
|
4567
4669
|
value: [...permissionSetState.value, item]
|
|
4568
|
-
}
|
|
4670
|
+
};
|
|
4569
4671
|
return itemPermissionAccu;
|
|
4570
4672
|
}, accu);
|
|
4571
4673
|
return accu;
|
|
4572
4674
|
}, {});
|
|
4573
|
-
return Object.entries(permissionSetObject).map((
|
|
4574
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
4675
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
4575
4676
|
if (value.includes(excessiveAccessSelector)) {
|
|
4576
4677
|
return { name };
|
|
4577
4678
|
}
|
|
4578
|
-
return { name, scope:
|
|
4679
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
4579
4680
|
});
|
|
4580
4681
|
};
|
|
4581
4682
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
4582
|
-
const role =
|
|
4683
|
+
const role = { ...roleState, ...roleData };
|
|
4583
4684
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
4584
4685
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
4585
4686
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -4615,12 +4716,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
4615
4716
|
}, []);
|
|
4616
4717
|
return {
|
|
4617
4718
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
4618
|
-
role:
|
|
4719
|
+
role: {
|
|
4720
|
+
...emptyRole,
|
|
4619
4721
|
name,
|
|
4620
4722
|
// @ts-ignore
|
|
4621
4723
|
description: description ? description : roleState.description,
|
|
4622
|
-
uiPermissions:
|
|
4623
|
-
|
|
4724
|
+
uiPermissions: {
|
|
4725
|
+
...emptyUiPermissions,
|
|
4726
|
+
...roleUiPermissions,
|
|
4727
|
+
...maybeUiPermissions
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4624
4730
|
};
|
|
4625
4731
|
};
|
|
4626
4732
|
var roleActions = {
|
|
@@ -4671,13 +4777,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4671
4777
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
4672
4778
|
`${sliceName8}/saveGlobalSettings`,
|
|
4673
4779
|
// @ts-ignore
|
|
4674
|
-
(
|
|
4675
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
4780
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
4676
4781
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
4677
4782
|
return;
|
|
4678
4783
|
}
|
|
4679
4784
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
4680
|
-
let updatedSettings =
|
|
4785
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
4681
4786
|
if (getCurrentUser(getState()).verified) {
|
|
4682
4787
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
4683
4788
|
} else {
|
|
@@ -4715,10 +4820,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
4715
4820
|
const userSettings = getUserSettings(getState());
|
|
4716
4821
|
const onboardingState = getOnboardingState(getState());
|
|
4717
4822
|
const tooltipState = getTooltipsState(getState());
|
|
4718
|
-
const updatedSettings =
|
|
4719
|
-
|
|
4823
|
+
const updatedSettings = {
|
|
4824
|
+
...userSettings,
|
|
4825
|
+
// @ts-ignore
|
|
4826
|
+
...settings,
|
|
4827
|
+
onboarding: {
|
|
4828
|
+
...onboardingState,
|
|
4829
|
+
// @ts-ignore
|
|
4830
|
+
...settings.onboarding
|
|
4831
|
+
},
|
|
4720
4832
|
tooltips: tooltipState
|
|
4721
|
-
}
|
|
4833
|
+
};
|
|
4722
4834
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
4723
4835
|
return Promise.all([
|
|
4724
4836
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -4744,9 +4856,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4744
4856
|
`${sliceName8}/getTokens`,
|
|
4745
4857
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
4746
4858
|
const user = getCurrentUser(getState());
|
|
4747
|
-
const updatedUser =
|
|
4859
|
+
const updatedUser = {
|
|
4860
|
+
...user,
|
|
4748
4861
|
tokens
|
|
4749
|
-
}
|
|
4862
|
+
};
|
|
4750
4863
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
4751
4864
|
})
|
|
4752
4865
|
);
|
|
@@ -4762,8 +4875,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4762
4875
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
4763
4876
|
)
|
|
4764
4877
|
);
|
|
4765
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
4766
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
4878
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
4767
4879
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
4768
4880
|
if (persist) {
|
|
4769
4881
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -4771,14 +4883,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
4771
4883
|
return Promise.all(tasks);
|
|
4772
4884
|
});
|
|
4773
4885
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
4774
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
4886
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
4775
4887
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
4776
4888
|
});
|
|
4777
4889
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
4778
4890
|
`${sliceName8}/submitFeedback`,
|
|
4779
4891
|
// @ts-ignore
|
|
4780
|
-
(
|
|
4781
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
4892
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
4782
4893
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
4783
4894
|
subject: "feedback submission",
|
|
4784
4895
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -4816,14 +4927,13 @@ var getGroups2 = (0, import_toolkit24.createAsyncThunk)(
|
|
|
4816
4927
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
4817
4928
|
const state = getGroupsById(getState());
|
|
4818
4929
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
4819
|
-
|
|
4820
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
4930
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
4821
4931
|
accu[id] = group;
|
|
4822
4932
|
}
|
|
4823
4933
|
return accu;
|
|
4824
4934
|
}, {});
|
|
4825
4935
|
const groups = res.data.reduce((accu, group) => {
|
|
4826
|
-
accu[group] =
|
|
4936
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
4827
4937
|
return accu;
|
|
4828
4938
|
}, dynamicGroups);
|
|
4829
4939
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -4881,7 +4991,7 @@ var addStaticGroup = (0, import_toolkit24.createAsyncThunk)(
|
|
|
4881
4991
|
() => Promise.resolve(
|
|
4882
4992
|
dispatch(
|
|
4883
4993
|
actions3.addGroup({
|
|
4884
|
-
group:
|
|
4994
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
4885
4995
|
groupName: group
|
|
4886
4996
|
})
|
|
4887
4997
|
)
|
|
@@ -4909,20 +5019,19 @@ var getDynamicGroups = (0, import_toolkit24.createAsyncThunk)(
|
|
|
4909
5019
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
4910
5020
|
const state = getGroupsById(getState());
|
|
4911
5021
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
4912
|
-
|
|
4913
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
5022
|
+
if (!(group.id || group.filters?.length)) {
|
|
4914
5023
|
accu[id] = group;
|
|
4915
5024
|
}
|
|
4916
5025
|
return accu;
|
|
4917
5026
|
}, {});
|
|
4918
5027
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
4919
|
-
accu[filter.name] =
|
|
5028
|
+
accu[filter.name] = {
|
|
4920
5029
|
deviceIds: [],
|
|
4921
|
-
total: 0
|
|
4922
|
-
|
|
5030
|
+
total: 0,
|
|
5031
|
+
...state[filter.name],
|
|
4923
5032
|
id: filter.id,
|
|
4924
5033
|
filters: mapTermsToFilters(filter.terms)
|
|
4925
|
-
}
|
|
5034
|
+
};
|
|
4926
5035
|
return accu;
|
|
4927
5036
|
}, staticGroups);
|
|
4928
5037
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -4962,10 +5071,9 @@ var removeDynamicGroup = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/r
|
|
|
4962
5071
|
);
|
|
4963
5072
|
});
|
|
4964
5073
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
4965
|
-
var _a;
|
|
4966
5074
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
4967
5075
|
const selectedGroup = groupsState.byId[groupName];
|
|
4968
|
-
const groupFilterLength =
|
|
5076
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
4969
5077
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
4970
5078
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
4971
5079
|
};
|
|
@@ -4988,7 +5096,6 @@ var selectGroup = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
4988
5096
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
4989
5097
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
4990
5098
|
(accu, device) => {
|
|
4991
|
-
var _a, _b2, _c;
|
|
4992
5099
|
const stateDevice = getDeviceById(state, device.id);
|
|
4993
5100
|
const {
|
|
4994
5101
|
attributes: storedAttributes = {},
|
|
@@ -4998,29 +5105,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
4998
5105
|
group: storedGroup
|
|
4999
5106
|
} = stateDevice;
|
|
5000
5107
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
5001
|
-
device.tags =
|
|
5002
|
-
device.group =
|
|
5003
|
-
device.monitor =
|
|
5004
|
-
device.identity_data =
|
|
5108
|
+
device.tags = { ...storedTags, ...tags };
|
|
5109
|
+
device.group = system.group ?? storedGroup;
|
|
5110
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
5111
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
5005
5112
|
device.status = status ? status : device.status || identity.status;
|
|
5006
|
-
device.check_in_time_rounded =
|
|
5007
|
-
device.check_in_time_exact =
|
|
5113
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
5114
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
5008
5115
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
5009
5116
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
5010
5117
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
5011
5118
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
5012
|
-
device.attributes = device.attributes ?
|
|
5013
|
-
accu.devicesById[device.id] =
|
|
5119
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
5120
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
5014
5121
|
accu.ids.push(device.id);
|
|
5015
5122
|
return accu;
|
|
5016
5123
|
},
|
|
5017
5124
|
{ ids, devicesById: {} }
|
|
5018
5125
|
);
|
|
5019
5126
|
var getGroupDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
5020
|
-
const
|
|
5127
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
5021
5128
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
5022
5129
|
return Promise.resolve(
|
|
5023
|
-
dispatch(getDevicesByStatus2(
|
|
5130
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
5024
5131
|
).unwrap().then((results) => {
|
|
5025
5132
|
if (!group) {
|
|
5026
5133
|
return Promise.resolve();
|
|
@@ -5034,7 +5141,7 @@ var getGroupDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/getG
|
|
|
5034
5141
|
dispatch(
|
|
5035
5142
|
actions3.addGroup({
|
|
5036
5143
|
group: {
|
|
5037
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
5144
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
5038
5145
|
total
|
|
5039
5146
|
},
|
|
5040
5147
|
groupName: group
|
|
@@ -5183,27 +5290,26 @@ var getDeviceLimit2 = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5183
5290
|
);
|
|
5184
5291
|
var setDeviceListState = (0, import_toolkit24.createAsyncThunk)(
|
|
5185
5292
|
`${sliceName3}/setDeviceListState`,
|
|
5186
|
-
(
|
|
5187
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
5188
|
-
var _c;
|
|
5293
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
5189
5294
|
const currentState = getDeviceListState(getState());
|
|
5190
5295
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
5191
|
-
let nextState =
|
|
5296
|
+
let nextState = {
|
|
5297
|
+
...currentState,
|
|
5192
5298
|
setOnly: false,
|
|
5193
|
-
refreshTrigger
|
|
5194
|
-
|
|
5195
|
-
sort:
|
|
5196
|
-
}
|
|
5299
|
+
refreshTrigger,
|
|
5300
|
+
...selectionState,
|
|
5301
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5302
|
+
};
|
|
5197
5303
|
let tasks = [];
|
|
5198
|
-
const
|
|
5199
|
-
const
|
|
5304
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
5305
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
5200
5306
|
if (!nextState.setOnly && !(0, import_helpers12.deepCompare)(currentRequestState, nextRequestState)) {
|
|
5201
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
5307
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
5202
5308
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
5203
5309
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
5204
5310
|
nextState.isLoading = true;
|
|
5205
5311
|
tasks.push(
|
|
5206
|
-
dispatch(getDevicesByStatus2(
|
|
5312
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
5207
5313
|
const { deviceAccu, total } = results[results.length - 1];
|
|
5208
5314
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
5209
5315
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -5228,8 +5334,8 @@ var getDevicesByStatus2 = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/
|
|
|
5228
5334
|
} = options;
|
|
5229
5335
|
const state = getState();
|
|
5230
5336
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
5231
|
-
filters: filterSelection
|
|
5232
|
-
group: group
|
|
5337
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
5338
|
+
group: group ?? getSelectedGroup(state),
|
|
5233
5339
|
groups: state.devices.groups,
|
|
5234
5340
|
offlineThreshold: state.app.offlineThreshold,
|
|
5235
5341
|
selectedIssues,
|
|
@@ -5290,7 +5396,7 @@ var getAllDevicesByStatus = (0, import_toolkit24.createAsyncThunk)(`${sliceName3
|
|
|
5290
5396
|
});
|
|
5291
5397
|
var searchDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
5292
5398
|
const state = getState();
|
|
5293
|
-
let options =
|
|
5399
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
5294
5400
|
const { page = defaultPage5, searchTerm, sortOptions = [] } = options;
|
|
5295
5401
|
const { columnSelection = [] } = getUserSettings(state);
|
|
5296
5402
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -5425,8 +5531,7 @@ var getSessionDetails = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/ge
|
|
|
5425
5531
|
({ data: auditLogEntries }) => {
|
|
5426
5532
|
const { start, end } = auditLogEntries.reduce(
|
|
5427
5533
|
(accu, item) => {
|
|
5428
|
-
|
|
5429
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
5534
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
5430
5535
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
5431
5536
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
5432
5537
|
}
|
|
@@ -5533,8 +5638,7 @@ var decommissionDevice = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5533
5638
|
var getDeviceConfig = (0, import_toolkit24.createAsyncThunk)(
|
|
5534
5639
|
`${sliceName3}/getDeviceConfig`,
|
|
5535
5640
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
5536
|
-
|
|
5537
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
5641
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
5538
5642
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
5539
5643
|
}
|
|
5540
5644
|
})
|
|
@@ -5546,15 +5650,14 @@ var setDeviceConfig = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5546
5650
|
var applyDeviceConfig = (0, import_toolkit24.createAsyncThunk)(
|
|
5547
5651
|
`${sliceName3}/applyDeviceConfig`,
|
|
5548
5652
|
({ 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 }) => {
|
|
5549
|
-
var _a;
|
|
5550
5653
|
const device = getDeviceById(getState(), deviceId);
|
|
5551
5654
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
5552
5655
|
let tasks = [
|
|
5553
|
-
dispatch(actions3.receivedDevice(
|
|
5656
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
5554
5657
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
5555
5658
|
];
|
|
5556
5659
|
if (isDefault && canManageUsers) {
|
|
5557
|
-
const { previous } =
|
|
5660
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
5558
5661
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
5559
5662
|
}
|
|
5560
5663
|
return Promise.all(tasks);
|
|
@@ -5570,21 +5673,21 @@ var setDeviceTags = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5570
5673
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
5571
5674
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
5572
5675
|
{ headers }
|
|
5573
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
5676
|
+
).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(setSnackbar6("Device name changed"))]));
|
|
5574
5677
|
})
|
|
5575
5678
|
)
|
|
5576
5679
|
);
|
|
5577
5680
|
var getDeviceTwin = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
5578
5681
|
let providerResult = {};
|
|
5579
5682
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
5580
|
-
providerResult =
|
|
5683
|
+
providerResult = { ...data, twinError: "" };
|
|
5581
5684
|
}).catch((err) => {
|
|
5582
5685
|
providerResult = {
|
|
5583
5686
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
5584
5687
|
};
|
|
5585
5688
|
}).finally(() => {
|
|
5586
5689
|
const device = getDeviceById(getState(), deviceId);
|
|
5587
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
5690
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
5588
5691
|
});
|
|
5589
5692
|
});
|
|
5590
5693
|
var setDeviceTwin = (0, import_toolkit24.createAsyncThunk)(
|
|
@@ -5600,7 +5703,7 @@ var setDeviceTwin = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5600
5703
|
const { twinsByIntegration = {} } = device;
|
|
5601
5704
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
5602
5705
|
return Promise.resolve(
|
|
5603
|
-
dispatch(actions3.receivedDevice(
|
|
5706
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
5604
5707
|
);
|
|
5605
5708
|
})
|
|
5606
5709
|
);
|
|
@@ -5621,8 +5724,8 @@ var getSystemDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/get
|
|
|
5621
5724
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
5622
5725
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
5623
5726
|
const filters = [
|
|
5624
|
-
|
|
5625
|
-
|
|
5727
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
5728
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
5626
5729
|
];
|
|
5627
5730
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
5628
5731
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -5634,11 +5737,12 @@ var getSystemDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/get
|
|
|
5634
5737
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
5635
5738
|
const state2 = getState();
|
|
5636
5739
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
5637
|
-
const device =
|
|
5740
|
+
const device = {
|
|
5741
|
+
...getDeviceById(state2, id),
|
|
5638
5742
|
systemDeviceIds: ids,
|
|
5639
5743
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
5640
|
-
}
|
|
5641
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
5744
|
+
};
|
|
5745
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
5642
5746
|
});
|
|
5643
5747
|
});
|
|
5644
5748
|
var getGatewayDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -5646,9 +5750,9 @@ var getGatewayDevices = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/ge
|
|
|
5646
5750
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
5647
5751
|
const { mender_gateway_system_id = "" } = attributes;
|
|
5648
5752
|
const filters = [
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5753
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
5754
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
5755
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
5652
5756
|
];
|
|
5653
5757
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
5654
5758
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -5688,56 +5792,4 @@ var getDevicesInBounds = (0, import_toolkit24.createAsyncThunk)(`${sliceName3}/g
|
|
|
5688
5792
|
return Promise.resolve(dispatch(actions3.receivedDevices(devicesById)));
|
|
5689
5793
|
});
|
|
5690
5794
|
});
|
|
5691
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5692
|
-
0 && (module.exports = {
|
|
5693
|
-
addDevicesToGroup,
|
|
5694
|
-
addDynamicGroup,
|
|
5695
|
-
addStaticGroup,
|
|
5696
|
-
applyDeviceConfig,
|
|
5697
|
-
decommissionDevice,
|
|
5698
|
-
deleteAuthset,
|
|
5699
|
-
deriveInactiveDevices,
|
|
5700
|
-
deriveReportsData,
|
|
5701
|
-
deviceFileUpload,
|
|
5702
|
-
ensureVersionString,
|
|
5703
|
-
getAllDeviceCounts,
|
|
5704
|
-
getAllDevicesByStatus,
|
|
5705
|
-
getAllDynamicGroupDevices,
|
|
5706
|
-
getAllGroupDevices,
|
|
5707
|
-
getDeviceAttributes,
|
|
5708
|
-
getDeviceAuth,
|
|
5709
|
-
getDeviceById,
|
|
5710
|
-
getDeviceConfig,
|
|
5711
|
-
getDeviceConnect,
|
|
5712
|
-
getDeviceCount,
|
|
5713
|
-
getDeviceFileDownloadLink,
|
|
5714
|
-
getDeviceInfo,
|
|
5715
|
-
getDeviceLimit,
|
|
5716
|
-
getDeviceTwin,
|
|
5717
|
-
getDevicesByStatus,
|
|
5718
|
-
getDevicesInBounds,
|
|
5719
|
-
getDevicesWithAuth,
|
|
5720
|
-
getDynamicGroups,
|
|
5721
|
-
getGatewayDevices,
|
|
5722
|
-
getGroupDevices,
|
|
5723
|
-
getGroups,
|
|
5724
|
-
getReportingLimits,
|
|
5725
|
-
getReportsData,
|
|
5726
|
-
getReportsDataWithoutBackendSupport,
|
|
5727
|
-
getSessionDetails,
|
|
5728
|
-
getSystemDevices,
|
|
5729
|
-
preauthDevice,
|
|
5730
|
-
removeDevicesFromGroup,
|
|
5731
|
-
removeDynamicGroup,
|
|
5732
|
-
removeStaticGroup,
|
|
5733
|
-
searchDevices,
|
|
5734
|
-
selectGroup,
|
|
5735
|
-
setDeviceConfig,
|
|
5736
|
-
setDeviceListState,
|
|
5737
|
-
setDeviceTags,
|
|
5738
|
-
setDeviceTwin,
|
|
5739
|
-
updateDeviceAuth,
|
|
5740
|
-
updateDevicesAuth,
|
|
5741
|
-
updateDynamicGroup
|
|
5742
|
-
});
|
|
5743
5795
|
//# sourceMappingURL=thunks.js.map
|