@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 = {};
|
|
@@ -492,7 +442,7 @@ var chartTypes = {
|
|
|
492
442
|
};
|
|
493
443
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
494
444
|
var defaultReportType = "distribution";
|
|
495
|
-
var defaultReports = [
|
|
445
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
496
446
|
var locations = {};
|
|
497
447
|
var PLANS = {
|
|
498
448
|
os: {
|
|
@@ -818,13 +768,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
818
768
|
deployments: [],
|
|
819
769
|
groups: Object.freeze({}),
|
|
820
770
|
releases: Object.freeze({}),
|
|
771
|
+
tenantManagement: [],
|
|
821
772
|
userManagement: []
|
|
822
773
|
});
|
|
823
774
|
var emptyRole = Object.freeze({
|
|
824
775
|
name: void 0,
|
|
825
776
|
description: "",
|
|
826
777
|
permissions: [],
|
|
827
|
-
uiPermissions: Object.freeze(
|
|
778
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
828
779
|
});
|
|
829
780
|
|
|
830
781
|
// src/deploymentsSlice/constants.ts
|
|
@@ -853,11 +804,12 @@ var deploymentStatesToSubstates = {
|
|
|
853
804
|
pending: [deploymentSubstates.pending],
|
|
854
805
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
855
806
|
};
|
|
856
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
807
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
808
|
+
...deploymentStatesToSubstates,
|
|
857
809
|
failures: [deploymentSubstates.failure],
|
|
858
810
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
859
811
|
successes: [deploymentSubstates.success]
|
|
860
|
-
}
|
|
812
|
+
};
|
|
861
813
|
var installationSubstatesMap = {
|
|
862
814
|
download: {
|
|
863
815
|
title: "download",
|
|
@@ -902,8 +854,8 @@ var DEPLOYMENT_STATES = {
|
|
|
902
854
|
var listDefaultsByState = {
|
|
903
855
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
904
856
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
905
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
906
|
-
[DEPLOYMENT_STATES.finished]:
|
|
857
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
858
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
907
859
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
908
860
|
};
|
|
909
861
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1065,6 +1017,13 @@ var SSO_TYPES = {
|
|
|
1065
1017
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1066
1018
|
}
|
|
1067
1019
|
};
|
|
1020
|
+
var AUDIT_LOGS_TYPES = [
|
|
1021
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
1022
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
1023
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
1024
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1025
|
+
];
|
|
1026
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1068
1027
|
var emptyWebhook = {
|
|
1069
1028
|
description: "",
|
|
1070
1029
|
enabled: true,
|
|
@@ -1113,10 +1072,12 @@ var permissionSetIds = {
|
|
|
1113
1072
|
DeployToDevices: "DeployToDevices",
|
|
1114
1073
|
ManageDevices: "ManageDevices",
|
|
1115
1074
|
ManageReleases: "ManageReleases",
|
|
1075
|
+
ManageTenants: "ManageTenants",
|
|
1116
1076
|
ManageUsers: "ManageUsers",
|
|
1117
1077
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1118
1078
|
ReadDevices: "ReadDevices",
|
|
1119
1079
|
ReadReleases: "ReadReleases",
|
|
1080
|
+
ReadTenants: "ReadTenants",
|
|
1120
1081
|
ReadUsers: "ReadUsers",
|
|
1121
1082
|
SuperUser: "SuperUser",
|
|
1122
1083
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1155,6 +1116,7 @@ var uiPermissionsById = {
|
|
|
1155
1116
|
permissionSets: {
|
|
1156
1117
|
groups: permissionSetIds.ManageDevices,
|
|
1157
1118
|
releases: permissionSetIds.ManageReleases,
|
|
1119
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1158
1120
|
userManagement: permissionSetIds.ManageUsers
|
|
1159
1121
|
},
|
|
1160
1122
|
title: "Manage",
|
|
@@ -1168,6 +1130,7 @@ var uiPermissionsById = {
|
|
|
1168
1130
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1169
1131
|
groups: permissionSetIds.ReadDevices,
|
|
1170
1132
|
releases: permissionSetIds.ReadReleases,
|
|
1133
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1171
1134
|
userManagement: permissionSetIds.ReadUsers
|
|
1172
1135
|
},
|
|
1173
1136
|
title: "Read",
|
|
@@ -1192,6 +1155,7 @@ var uiPermissionsByArea = {
|
|
|
1192
1155
|
auditlog: {
|
|
1193
1156
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1194
1157
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1158
|
+
key: "auditlog",
|
|
1195
1159
|
uiPermissions: [uiPermissionsById.read],
|
|
1196
1160
|
title: "System audit log"
|
|
1197
1161
|
},
|
|
@@ -1202,6 +1166,7 @@ var uiPermissionsByArea = {
|
|
|
1202
1166
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1203
1167
|
],
|
|
1204
1168
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1169
|
+
key: "deployments",
|
|
1205
1170
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1206
1171
|
title: "Deployments"
|
|
1207
1172
|
},
|
|
@@ -1217,6 +1182,7 @@ var uiPermissionsByArea = {
|
|
|
1217
1182
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1218
1183
|
],
|
|
1219
1184
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1185
|
+
key: "groups",
|
|
1220
1186
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1221
1187
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1222
1188
|
title: "Group Management"
|
|
@@ -1236,22 +1202,35 @@ var uiPermissionsByArea = {
|
|
|
1236
1202
|
}
|
|
1237
1203
|
],
|
|
1238
1204
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1205
|
+
key: "releases",
|
|
1239
1206
|
scope: "ReleaseTags",
|
|
1240
1207
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1241
1208
|
title: "Release Management"
|
|
1242
1209
|
},
|
|
1210
|
+
tenantManagement: {
|
|
1211
|
+
endpoints: [
|
|
1212
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1213
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1214
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1215
|
+
],
|
|
1216
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1217
|
+
key: "tenantManagement",
|
|
1218
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1219
|
+
title: "Tenant Management"
|
|
1220
|
+
},
|
|
1243
1221
|
userManagement: {
|
|
1244
1222
|
endpoints: [
|
|
1245
1223
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1246
1224
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1247
1225
|
],
|
|
1248
1226
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1227
|
+
key: "userManagement",
|
|
1249
1228
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1250
1229
|
title: "User Management"
|
|
1251
1230
|
}
|
|
1252
1231
|
};
|
|
1253
1232
|
var permissionMapper = (permission) => permission.value;
|
|
1254
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1233
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1255
1234
|
var rolesById = Object.freeze({
|
|
1256
1235
|
[staticRolesByName.admin]: {
|
|
1257
1236
|
name: "Admin",
|
|
@@ -1259,56 +1238,87 @@ var rolesById = Object.freeze({
|
|
|
1259
1238
|
description: "Full access",
|
|
1260
1239
|
permissions: [],
|
|
1261
1240
|
// permissions refers to the values returned from the backend
|
|
1262
|
-
uiPermissions:
|
|
1241
|
+
uiPermissions: {
|
|
1242
|
+
...emptyUiPermissions,
|
|
1263
1243
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1264
1244
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1265
1245
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1266
1246
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1267
1247
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1268
|
-
}
|
|
1248
|
+
}
|
|
1269
1249
|
},
|
|
1270
1250
|
[staticRolesByName.readOnly]: {
|
|
1271
1251
|
name: "Read Access",
|
|
1272
1252
|
value: staticRolesByName.readOnly,
|
|
1273
1253
|
description: "",
|
|
1274
1254
|
permissions: [],
|
|
1275
|
-
uiPermissions:
|
|
1255
|
+
uiPermissions: {
|
|
1256
|
+
...emptyUiPermissions,
|
|
1276
1257
|
deployments: [uiPermissionsById.read.value],
|
|
1277
1258
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1278
1259
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1279
1260
|
userManagement: [uiPermissionsById.read.value]
|
|
1280
|
-
}
|
|
1261
|
+
}
|
|
1281
1262
|
},
|
|
1282
1263
|
[staticRolesByName.ci]: {
|
|
1283
1264
|
name: "Releases Manager",
|
|
1284
1265
|
value: staticRolesByName.ci,
|
|
1285
1266
|
description: "",
|
|
1286
1267
|
permissions: [],
|
|
1287
|
-
uiPermissions:
|
|
1268
|
+
uiPermissions: {
|
|
1269
|
+
...emptyUiPermissions,
|
|
1288
1270
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1289
|
-
}
|
|
1271
|
+
}
|
|
1290
1272
|
},
|
|
1291
1273
|
[staticRolesByName.deploymentsManager]: {
|
|
1292
1274
|
name: "Deployments Manager",
|
|
1293
1275
|
value: staticRolesByName.deploymentsManager,
|
|
1294
1276
|
description: "",
|
|
1295
1277
|
permissions: [],
|
|
1296
|
-
uiPermissions:
|
|
1278
|
+
uiPermissions: {
|
|
1279
|
+
...emptyUiPermissions,
|
|
1297
1280
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1298
1281
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1299
1282
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1300
|
-
}
|
|
1283
|
+
}
|
|
1301
1284
|
},
|
|
1302
1285
|
[staticRolesByName.terminalAccess]: {
|
|
1303
1286
|
name: "Troubleshooting",
|
|
1304
1287
|
value: staticRolesByName.terminalAccess,
|
|
1305
1288
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1306
1289
|
permissions: [],
|
|
1307
|
-
uiPermissions:
|
|
1290
|
+
uiPermissions: {
|
|
1291
|
+
...emptyUiPermissions,
|
|
1308
1292
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1309
|
-
}
|
|
1293
|
+
}
|
|
1310
1294
|
}
|
|
1311
1295
|
});
|
|
1296
|
+
var serviceProviderRolesById = {
|
|
1297
|
+
admin: {
|
|
1298
|
+
name: "Admin",
|
|
1299
|
+
value: staticRolesByName.admin,
|
|
1300
|
+
description: "Full access",
|
|
1301
|
+
permissions: [],
|
|
1302
|
+
uiPermissions: {
|
|
1303
|
+
...emptyUiPermissions,
|
|
1304
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1305
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1306
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
readOnly: {
|
|
1310
|
+
name: "Read access",
|
|
1311
|
+
value: staticRolesByName.admin,
|
|
1312
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1313
|
+
permissions: [],
|
|
1314
|
+
uiPermissions: {
|
|
1315
|
+
...emptyUiPermissions,
|
|
1316
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1317
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1318
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1312
1322
|
var defaultPermissionSets = {
|
|
1313
1323
|
[permissionSetIds.Basic]: {
|
|
1314
1324
|
name: permissionSetIds.Basic,
|
|
@@ -1319,7 +1329,9 @@ var defaultPermissionSets = {
|
|
|
1319
1329
|
},
|
|
1320
1330
|
[permissionSetIds.SuperUser]: {
|
|
1321
1331
|
name: permissionSetIds.SuperUser,
|
|
1322
|
-
result:
|
|
1332
|
+
result: {
|
|
1333
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1334
|
+
}
|
|
1323
1335
|
},
|
|
1324
1336
|
[permissionSetIds.ManageUsers]: {
|
|
1325
1337
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1339,6 +1351,18 @@ var defaultPermissionSets = {
|
|
|
1339
1351
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1340
1352
|
}
|
|
1341
1353
|
},
|
|
1354
|
+
[permissionSetIds.ReadTenants]: {
|
|
1355
|
+
name: permissionSetIds.ReadTenants,
|
|
1356
|
+
result: {
|
|
1357
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
[permissionSetIds.ManageTenants]: {
|
|
1361
|
+
name: permissionSetIds.ManageTenants,
|
|
1362
|
+
result: {
|
|
1363
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1342
1366
|
[permissionSetIds.ReadUsers]: {
|
|
1343
1367
|
name: permissionSetIds.ReadUsers,
|
|
1344
1368
|
result: {
|
|
@@ -1392,11 +1416,12 @@ var defaultPermissionSets = {
|
|
|
1392
1416
|
};
|
|
1393
1417
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1394
1418
|
var OWN_USER_ID = "me";
|
|
1395
|
-
var rolesByName =
|
|
1419
|
+
var rolesByName = {
|
|
1420
|
+
...staticRolesByName,
|
|
1396
1421
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1397
1422
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1398
1423
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1399
|
-
}
|
|
1424
|
+
};
|
|
1400
1425
|
var twoFAStates = {
|
|
1401
1426
|
enabled: "enabled",
|
|
1402
1427
|
disabled: "disabled",
|
|
@@ -1484,7 +1509,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1484
1509
|
initialState,
|
|
1485
1510
|
reducers: {
|
|
1486
1511
|
setFeatures: (state, action) => {
|
|
1487
|
-
state.features =
|
|
1512
|
+
state.features = {
|
|
1513
|
+
...state.features,
|
|
1514
|
+
...action.payload
|
|
1515
|
+
};
|
|
1488
1516
|
},
|
|
1489
1517
|
setSnackbar: (state, { payload }) => {
|
|
1490
1518
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1509,7 +1537,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1509
1537
|
state.hostedAnnouncement = action.payload;
|
|
1510
1538
|
},
|
|
1511
1539
|
setSearchState: (state, action) => {
|
|
1512
|
-
state.searchState =
|
|
1540
|
+
state.searchState = {
|
|
1541
|
+
...state.searchState,
|
|
1542
|
+
...action.payload
|
|
1543
|
+
};
|
|
1513
1544
|
},
|
|
1514
1545
|
setOfflineThreshold: (state, action) => {
|
|
1515
1546
|
state.offlineThreshold = action.payload;
|
|
@@ -1520,20 +1551,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1520
1551
|
},
|
|
1521
1552
|
uploadProgress: (state, action) => {
|
|
1522
1553
|
const { id, progress: progress2 } = action.payload;
|
|
1523
|
-
state.uploadsById[id] =
|
|
1554
|
+
state.uploadsById[id] = {
|
|
1555
|
+
...state.uploadsById[id],
|
|
1524
1556
|
progress: progress2
|
|
1525
|
-
}
|
|
1557
|
+
};
|
|
1526
1558
|
},
|
|
1527
1559
|
cleanUpUpload: (state, action) => {
|
|
1528
|
-
|
|
1529
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1560
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1530
1561
|
state.uploadsById = remainder;
|
|
1531
1562
|
},
|
|
1532
1563
|
setVersionInformation: (state, action) => {
|
|
1533
|
-
state.versionInformation =
|
|
1564
|
+
state.versionInformation = {
|
|
1565
|
+
...state.versionInformation,
|
|
1566
|
+
...action.payload
|
|
1567
|
+
};
|
|
1534
1568
|
},
|
|
1535
1569
|
setEnvironmentData: (state, action) => {
|
|
1536
|
-
return
|
|
1570
|
+
return { ...state, ...action.payload };
|
|
1537
1571
|
}
|
|
1538
1572
|
}
|
|
1539
1573
|
});
|
|
@@ -1565,7 +1599,7 @@ var initialState2 = {
|
|
|
1565
1599
|
sourceWindow: -1
|
|
1566
1600
|
},
|
|
1567
1601
|
binaryDeltaLimits: {
|
|
1568
|
-
timeout:
|
|
1602
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1569
1603
|
sourceWindow: limitDefault,
|
|
1570
1604
|
inputWindow: limitDefault,
|
|
1571
1605
|
duplicatesWindow: limitDefault,
|
|
@@ -1575,10 +1609,10 @@ var initialState2 = {
|
|
|
1575
1609
|
deploymentDeviceLimit: 5e3,
|
|
1576
1610
|
selectedDeviceIds: [],
|
|
1577
1611
|
selectionState: {
|
|
1578
|
-
finished:
|
|
1579
|
-
inprogress:
|
|
1580
|
-
pending:
|
|
1581
|
-
scheduled:
|
|
1612
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1613
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1614
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1615
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1582
1616
|
general: {
|
|
1583
1617
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1584
1618
|
showCreationDialog: false,
|
|
@@ -1594,40 +1628,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1594
1628
|
initialState: initialState2,
|
|
1595
1629
|
reducers: {
|
|
1596
1630
|
createdDeployment: (state, action) => {
|
|
1597
|
-
state.byId[action.payload.id] =
|
|
1631
|
+
state.byId[action.payload.id] = {
|
|
1632
|
+
...deploymentPrototype,
|
|
1633
|
+
...action.payload
|
|
1634
|
+
};
|
|
1598
1635
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1599
1636
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1600
1637
|
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;
|
|
1601
1638
|
},
|
|
1602
1639
|
removedDeployment: (state, action) => {
|
|
1603
|
-
|
|
1604
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1640
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1605
1641
|
state.byId = remainder;
|
|
1606
1642
|
},
|
|
1607
1643
|
receivedDeployment: (state, action) => {
|
|
1608
|
-
state.byId[action.payload.id] =
|
|
1644
|
+
state.byId[action.payload.id] = {
|
|
1645
|
+
...state.byId[action.payload.id] || {},
|
|
1646
|
+
...action.payload
|
|
1647
|
+
};
|
|
1609
1648
|
},
|
|
1610
1649
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1611
1650
|
const { id, deviceId, log } = action.payload;
|
|
1612
|
-
const deployment =
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1651
|
+
const deployment = {
|
|
1652
|
+
...deploymentPrototype,
|
|
1653
|
+
...state.byId[id]
|
|
1654
|
+
};
|
|
1655
|
+
state.byId[id] = {
|
|
1656
|
+
...deployment,
|
|
1657
|
+
devices: {
|
|
1658
|
+
...deployment.devices,
|
|
1659
|
+
[deviceId]: {
|
|
1660
|
+
...deployment.devices[deviceId],
|
|
1616
1661
|
log
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1620
1665
|
},
|
|
1621
1666
|
receivedDeploymentDevices: (state, action) => {
|
|
1622
1667
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1623
|
-
state.byId[id] =
|
|
1668
|
+
state.byId[id] = {
|
|
1669
|
+
...state.byId[id],
|
|
1624
1670
|
devices,
|
|
1625
1671
|
totalDeviceCount
|
|
1626
|
-
}
|
|
1672
|
+
};
|
|
1627
1673
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1628
1674
|
},
|
|
1629
1675
|
receivedDeployments: (state, action) => {
|
|
1630
|
-
state.byId =
|
|
1676
|
+
state.byId = {
|
|
1677
|
+
...state.byId,
|
|
1678
|
+
...action.payload
|
|
1679
|
+
};
|
|
1631
1680
|
},
|
|
1632
1681
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1633
1682
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1669,9 +1718,9 @@ var initialState3 = {
|
|
|
1669
1718
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1670
1719
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1671
1720
|
},
|
|
1672
|
-
deviceList:
|
|
1673
|
-
deviceIds: []
|
|
1674
|
-
|
|
1721
|
+
deviceList: {
|
|
1722
|
+
deviceIds: [],
|
|
1723
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1675
1724
|
selectedAttributes: [],
|
|
1676
1725
|
selectedIssues: [],
|
|
1677
1726
|
selection: [],
|
|
@@ -1682,7 +1731,7 @@ var initialState3 = {
|
|
|
1682
1731
|
},
|
|
1683
1732
|
state: DEVICE_STATES.accepted,
|
|
1684
1733
|
total: 0
|
|
1685
|
-
}
|
|
1734
|
+
},
|
|
1686
1735
|
filters: [
|
|
1687
1736
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1688
1737
|
],
|
|
@@ -1717,49 +1766,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1717
1766
|
},
|
|
1718
1767
|
addToGroup: (state, action) => {
|
|
1719
1768
|
const { group, deviceIds } = action.payload;
|
|
1720
|
-
const maybeExistingGroup =
|
|
1769
|
+
const maybeExistingGroup = {
|
|
1721
1770
|
filters: [],
|
|
1722
|
-
deviceIds: []
|
|
1723
|
-
|
|
1724
|
-
|
|
1771
|
+
deviceIds: [],
|
|
1772
|
+
...state.groups.byId[group]
|
|
1773
|
+
};
|
|
1774
|
+
state.groups.byId[group] = {
|
|
1775
|
+
...maybeExistingGroup,
|
|
1725
1776
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1726
1777
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1727
|
-
}
|
|
1778
|
+
};
|
|
1728
1779
|
},
|
|
1729
1780
|
removeFromGroup: (state, action) => {
|
|
1730
1781
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1731
|
-
const
|
|
1732
|
-
const changedGroup =
|
|
1782
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1783
|
+
const changedGroup = {
|
|
1784
|
+
...maybeExistingGroup,
|
|
1733
1785
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1734
1786
|
total: Math.max(total - removedIds.length, 0)
|
|
1735
|
-
}
|
|
1787
|
+
};
|
|
1736
1788
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1737
1789
|
state.groups.byId[group] = changedGroup;
|
|
1738
1790
|
return;
|
|
1739
1791
|
} else if (state.groups.selectedGroup === group) {
|
|
1740
1792
|
state.groups.selectedGroup = void 0;
|
|
1741
1793
|
}
|
|
1742
|
-
const
|
|
1794
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1743
1795
|
state.groups.byId = remainingById;
|
|
1744
1796
|
},
|
|
1745
1797
|
addGroup: (state, action) => {
|
|
1746
1798
|
const { groupName, group } = action.payload;
|
|
1747
|
-
state.groups.byId[groupName] =
|
|
1799
|
+
state.groups.byId[groupName] = {
|
|
1800
|
+
...state.groups.byId[groupName],
|
|
1801
|
+
...group
|
|
1802
|
+
};
|
|
1748
1803
|
},
|
|
1749
1804
|
selectGroup: (state, { payload: group }) => {
|
|
1750
1805
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1751
1806
|
state.groups.selectedGroup = group;
|
|
1752
1807
|
},
|
|
1753
1808
|
removeGroup: (state, action) => {
|
|
1754
|
-
|
|
1755
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1809
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1756
1810
|
state.groups.byId = remainingById;
|
|
1757
1811
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1758
1812
|
},
|
|
1759
1813
|
setDeviceListState: (state, action) => {
|
|
1760
|
-
state.deviceList =
|
|
1761
|
-
|
|
1762
|
-
|
|
1814
|
+
state.deviceList = {
|
|
1815
|
+
...state.deviceList,
|
|
1816
|
+
...action.payload,
|
|
1817
|
+
sort: {
|
|
1818
|
+
...state.deviceList.sort,
|
|
1819
|
+
...action.payload.sort
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1763
1822
|
},
|
|
1764
1823
|
setFilterAttributes: (state, action) => {
|
|
1765
1824
|
state.filteringAttributes = action.payload;
|
|
@@ -1768,7 +1827,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1768
1827
|
state.filteringAttributesConfig = action.payload;
|
|
1769
1828
|
},
|
|
1770
1829
|
receivedDevices: (state, action) => {
|
|
1771
|
-
state.byId =
|
|
1830
|
+
state.byId = {
|
|
1831
|
+
...state.byId,
|
|
1832
|
+
...action.payload
|
|
1833
|
+
};
|
|
1772
1834
|
},
|
|
1773
1835
|
setDeviceFilters: (state, action) => {
|
|
1774
1836
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1799,7 +1861,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1799
1861
|
state.limit = action.payload;
|
|
1800
1862
|
},
|
|
1801
1863
|
receivedDevice: (state, action) => {
|
|
1802
|
-
state.byId[action.payload.id] =
|
|
1864
|
+
state.byId[action.payload.id] = {
|
|
1865
|
+
...state.byId[action.payload.id],
|
|
1866
|
+
...action.payload
|
|
1867
|
+
};
|
|
1803
1868
|
},
|
|
1804
1869
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1805
1870
|
const { deviceId, authId } = action.payload;
|
|
@@ -1820,15 +1885,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1820
1885
|
var sliceName4 = "monitor";
|
|
1821
1886
|
var initialState4 = {
|
|
1822
1887
|
alerts: {
|
|
1823
|
-
alertList:
|
|
1888
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1824
1889
|
byDeviceId: {}
|
|
1825
1890
|
},
|
|
1826
1891
|
issueCounts: {
|
|
1827
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1892
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1828
1893
|
},
|
|
1829
1894
|
settings: {
|
|
1830
1895
|
global: {
|
|
1831
|
-
channels:
|
|
1896
|
+
channels: {
|
|
1897
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1898
|
+
}
|
|
1832
1899
|
}
|
|
1833
1900
|
}
|
|
1834
1901
|
};
|
|
@@ -1846,14 +1913,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1846
1913
|
},
|
|
1847
1914
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1848
1915
|
const { deviceId, alerts } = action.payload;
|
|
1849
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1916
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1850
1917
|
},
|
|
1851
1918
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1852
1919
|
const { issueType, counts } = action.payload;
|
|
1853
1920
|
state.issueCounts.byType[issueType] = counts;
|
|
1854
1921
|
},
|
|
1855
1922
|
setAlertListState: (state, action) => {
|
|
1856
|
-
state.alerts.alertList =
|
|
1923
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1857
1924
|
}
|
|
1858
1925
|
}
|
|
1859
1926
|
});
|
|
@@ -1877,7 +1944,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1877
1944
|
initialState: initialState5,
|
|
1878
1945
|
reducers: {
|
|
1879
1946
|
setOnboardingState: (state, action) => {
|
|
1880
|
-
return
|
|
1947
|
+
return { ...state, ...action.payload };
|
|
1881
1948
|
},
|
|
1882
1949
|
setDemoArtifactPort: (state, action) => {
|
|
1883
1950
|
state.demoArtifactPort = action.payload;
|
|
@@ -1915,21 +1982,23 @@ var initialState6 = {
|
|
|
1915
1982
|
brand: ""
|
|
1916
1983
|
},
|
|
1917
1984
|
intentId: null,
|
|
1985
|
+
tenantList: {
|
|
1986
|
+
...TENANT_LIST_DEFAULT,
|
|
1987
|
+
total: 0,
|
|
1988
|
+
tenants: [],
|
|
1989
|
+
selectedTenant: null,
|
|
1990
|
+
sort: {
|
|
1991
|
+
direction: SORTING_OPTIONS.desc,
|
|
1992
|
+
key: "name"
|
|
1993
|
+
}
|
|
1994
|
+
},
|
|
1918
1995
|
organization: {
|
|
1919
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
1920
|
-
total: 0,
|
|
1921
|
-
tenants: [],
|
|
1922
|
-
selectedTenant: null,
|
|
1923
|
-
sort: {
|
|
1924
|
-
direction: SORTING_OPTIONS.desc,
|
|
1925
|
-
key: "name"
|
|
1926
|
-
}
|
|
1927
|
-
})
|
|
1928
1996
|
// id, name, status, tenant_token, plan
|
|
1929
1997
|
},
|
|
1930
1998
|
auditlog: {
|
|
1931
1999
|
events: [],
|
|
1932
|
-
selectionState:
|
|
2000
|
+
selectionState: {
|
|
2001
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1933
2002
|
detail: void 0,
|
|
1934
2003
|
endDate: void 0,
|
|
1935
2004
|
selectedIssue: void 0,
|
|
@@ -1938,7 +2007,7 @@ var initialState6 = {
|
|
|
1938
2007
|
total: 0,
|
|
1939
2008
|
type: void 0,
|
|
1940
2009
|
user: void 0
|
|
1941
|
-
}
|
|
2010
|
+
}
|
|
1942
2011
|
},
|
|
1943
2012
|
externalDeviceIntegrations: [
|
|
1944
2013
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -1961,7 +2030,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1961
2030
|
state.auditlog.selectionState.total = total;
|
|
1962
2031
|
},
|
|
1963
2032
|
setAuditLogState: (state, action) => {
|
|
1964
|
-
state.auditlog.selectionState =
|
|
2033
|
+
state.auditlog.selectionState = {
|
|
2034
|
+
...state.auditlog.selectionState,
|
|
2035
|
+
...action.payload
|
|
2036
|
+
};
|
|
1965
2037
|
},
|
|
1966
2038
|
receiveCurrentCard: (state, action) => {
|
|
1967
2039
|
state.card = action.payload;
|
|
@@ -1970,12 +2042,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1970
2042
|
state.intentId = action.payload;
|
|
1971
2043
|
},
|
|
1972
2044
|
setOrganization: (state, action) => {
|
|
1973
|
-
state.organization =
|
|
1974
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
1975
|
-
});
|
|
2045
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
1976
2046
|
},
|
|
1977
2047
|
setTenantListState: (state, action) => {
|
|
1978
|
-
state.
|
|
2048
|
+
state.tenantList = action.payload;
|
|
1979
2049
|
},
|
|
1980
2050
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
1981
2051
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2035,7 +2105,8 @@ var initialState7 = {
|
|
|
2035
2105
|
}
|
|
2036
2106
|
*/
|
|
2037
2107
|
},
|
|
2038
|
-
releasesList:
|
|
2108
|
+
releasesList: {
|
|
2109
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2039
2110
|
searchedIds: [],
|
|
2040
2111
|
releaseIds: [],
|
|
2041
2112
|
selection: [],
|
|
@@ -2049,7 +2120,7 @@ var initialState7 = {
|
|
|
2049
2120
|
selectedTags: [],
|
|
2050
2121
|
total: 0,
|
|
2051
2122
|
type: ""
|
|
2052
|
-
}
|
|
2123
|
+
},
|
|
2053
2124
|
tags: [],
|
|
2054
2125
|
updateTypes: [],
|
|
2055
2126
|
/*
|
|
@@ -2075,8 +2146,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2075
2146
|
state.updateTypes = action.payload;
|
|
2076
2147
|
},
|
|
2077
2148
|
removeRelease: (state, action) => {
|
|
2078
|
-
|
|
2079
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2149
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2080
2150
|
state.byId = byId;
|
|
2081
2151
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2082
2152
|
},
|
|
@@ -2109,8 +2179,12 @@ var initialState8 = {
|
|
|
2109
2179
|
previousPhases: [],
|
|
2110
2180
|
retries: 0
|
|
2111
2181
|
},
|
|
2112
|
-
permissionSetsById:
|
|
2113
|
-
|
|
2182
|
+
permissionSetsById: {
|
|
2183
|
+
...defaultPermissionSets
|
|
2184
|
+
},
|
|
2185
|
+
rolesById: {
|
|
2186
|
+
...rolesById
|
|
2187
|
+
},
|
|
2114
2188
|
settingsInitialized: false,
|
|
2115
2189
|
showConnectDeviceDialog: false,
|
|
2116
2190
|
showFeedbackDialog: false,
|
|
@@ -2150,13 +2224,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2150
2224
|
state.byId[0] = action.payload;
|
|
2151
2225
|
},
|
|
2152
2226
|
removedUser: (state, action) => {
|
|
2153
|
-
|
|
2154
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2227
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2155
2228
|
state.byId = byId;
|
|
2156
2229
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2157
2230
|
},
|
|
2158
2231
|
updatedUser: (state, action) => {
|
|
2159
|
-
state.byId[action.payload.id] =
|
|
2232
|
+
state.byId[action.payload.id] = {
|
|
2233
|
+
...state.byId[action.payload.id],
|
|
2234
|
+
...action.payload
|
|
2235
|
+
};
|
|
2160
2236
|
},
|
|
2161
2237
|
receivedPermissionSets: (state, action) => {
|
|
2162
2238
|
state.permissionSetsById = action.payload;
|
|
@@ -2165,11 +2241,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2165
2241
|
state.rolesById = action.payload;
|
|
2166
2242
|
},
|
|
2167
2243
|
createdRole: (state, action) => {
|
|
2168
|
-
state.rolesById[action.payload.name] =
|
|
2244
|
+
state.rolesById[action.payload.name] = {
|
|
2245
|
+
...state.rolesById[action.payload.name],
|
|
2246
|
+
...action.payload
|
|
2247
|
+
};
|
|
2169
2248
|
},
|
|
2170
2249
|
removedRole: (state, action) => {
|
|
2171
|
-
|
|
2172
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2250
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2173
2251
|
state.rolesById = rolesById2;
|
|
2174
2252
|
},
|
|
2175
2253
|
setCustomColumns: (state, action) => {
|
|
@@ -2177,18 +2255,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2177
2255
|
},
|
|
2178
2256
|
setGlobalSettings: (state, action) => {
|
|
2179
2257
|
state.settingsInitialized = true;
|
|
2180
|
-
state.globalSettings =
|
|
2258
|
+
state.globalSettings = {
|
|
2259
|
+
...state.globalSettings,
|
|
2260
|
+
...action.payload
|
|
2261
|
+
};
|
|
2181
2262
|
},
|
|
2182
2263
|
setUserSettings: (state, action) => {
|
|
2183
2264
|
state.userSettingsInitialized = true;
|
|
2184
|
-
state.userSettings =
|
|
2265
|
+
state.userSettings = {
|
|
2266
|
+
...state.userSettings,
|
|
2267
|
+
...action.payload
|
|
2268
|
+
};
|
|
2185
2269
|
},
|
|
2186
2270
|
setTooltipState: (state, action) => {
|
|
2187
2271
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2188
2272
|
state.tooltips.byId[id].readState = readState;
|
|
2189
2273
|
},
|
|
2190
2274
|
setTooltipsState: (state, action) => {
|
|
2191
|
-
state.tooltips.byId =
|
|
2275
|
+
state.tooltips.byId = {
|
|
2276
|
+
...state.tooltips.byId,
|
|
2277
|
+
...action.payload
|
|
2278
|
+
};
|
|
2192
2279
|
},
|
|
2193
2280
|
setShowFeedbackDialog: (state, action) => {
|
|
2194
2281
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2205,7 +2292,16 @@ var actions8 = usersSlice.actions;
|
|
|
2205
2292
|
var usersSlice_default = usersSlice.reducer;
|
|
2206
2293
|
|
|
2207
2294
|
// src/actions.ts
|
|
2208
|
-
var actions_default =
|
|
2295
|
+
var actions_default = {
|
|
2296
|
+
...actions,
|
|
2297
|
+
...actions2,
|
|
2298
|
+
...actions3,
|
|
2299
|
+
...actions4,
|
|
2300
|
+
...actions5,
|
|
2301
|
+
...actions6,
|
|
2302
|
+
...actions7,
|
|
2303
|
+
...actions8
|
|
2304
|
+
};
|
|
2209
2305
|
|
|
2210
2306
|
// src/api/general-api.ts
|
|
2211
2307
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2216,18 +2312,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2216
2312
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2217
2313
|
var tokenCache = "";
|
|
2218
2314
|
var getSessionInfo = () => {
|
|
2219
|
-
|
|
2220
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2315
|
+
let sessionInfo = { ...emptySession };
|
|
2221
2316
|
try {
|
|
2222
|
-
sessionInfo = JSON.parse(
|
|
2223
|
-
} catch
|
|
2317
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2318
|
+
} catch {
|
|
2224
2319
|
}
|
|
2225
2320
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2226
2321
|
cleanUp();
|
|
2227
|
-
return
|
|
2322
|
+
return { ...emptySession };
|
|
2228
2323
|
}
|
|
2229
2324
|
if (!sessionInfo.token) {
|
|
2230
|
-
let jwtTokenFromCookie =
|
|
2325
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2231
2326
|
if (jwtTokenFromCookie) {
|
|
2232
2327
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2233
2328
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2255,8 +2350,7 @@ var maxSessionAge = 900;
|
|
|
2255
2350
|
|
|
2256
2351
|
// src/api/general-api.ts
|
|
2257
2352
|
var unauthorizedRedirect = (error) => {
|
|
2258
|
-
|
|
2259
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2353
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2260
2354
|
cleanUp();
|
|
2261
2355
|
window.location.replace("/ui/");
|
|
2262
2356
|
}
|
|
@@ -2266,7 +2360,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2266
2360
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2267
2361
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2268
2362
|
authenticatedRequest.interceptors.request.use(
|
|
2269
|
-
(config) =>
|
|
2363
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2270
2364
|
(error) => Promise.reject(error)
|
|
2271
2365
|
);
|
|
2272
2366
|
var Api = {
|
|
@@ -2274,7 +2368,7 @@ var Api = {
|
|
|
2274
2368
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2275
2369
|
patch: authenticatedRequest.patch,
|
|
2276
2370
|
post: authenticatedRequest.post,
|
|
2277
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2371
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2278
2372
|
put: authenticatedRequest.put,
|
|
2279
2373
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2280
2374
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2305,10 +2399,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2305
2399
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2306
2400
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2307
2401
|
[getFullVersionInformation, getFeatures],
|
|
2308
|
-
(
|
|
2309
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2310
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2311
|
-
}
|
|
2402
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2312
2403
|
);
|
|
2313
2404
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2314
2405
|
|
|
@@ -2325,8 +2416,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2325
2416
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2326
2417
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2327
2418
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2328
|
-
|
|
2329
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2419
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2330
2420
|
return selection.reduce((accu, id) => {
|
|
2331
2421
|
if (deploymentsById[id]) {
|
|
2332
2422
|
accu.push(deploymentsById[id]);
|
|
@@ -2370,7 +2460,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2370
2460
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2371
2461
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2372
2462
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2373
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2463
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2464
|
+
...filteringAttributes,
|
|
2374
2465
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2375
2466
|
}));
|
|
2376
2467
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2398,10 +2489,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2398
2489
|
return accu;
|
|
2399
2490
|
}, {})
|
|
2400
2491
|
);
|
|
2401
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2402
|
-
var _a;
|
|
2403
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2404
|
-
});
|
|
2492
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2405
2493
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2406
2494
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2407
2495
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2418,17 +2506,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2418
2506
|
[getAcceptedDevices, getDeviceLimit],
|
|
2419
2507
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2420
2508
|
);
|
|
2421
|
-
var
|
|
2422
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2423
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2424
|
-
return groups;
|
|
2425
|
-
});
|
|
2509
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2426
2510
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2427
2511
|
const groupNames = Object.keys(groupsById).sort();
|
|
2428
2512
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2429
2513
|
(accu, [groupname, group]) => {
|
|
2430
2514
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2431
|
-
const groupItem =
|
|
2515
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2432
2516
|
if (group.filters.length > 0) {
|
|
2433
2517
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2434
2518
|
accu.dynamic.push(groupItem);
|
|
@@ -2442,7 +2526,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2442
2526
|
},
|
|
2443
2527
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2444
2528
|
);
|
|
2445
|
-
return
|
|
2529
|
+
return { groupNames, ...groupedGroups };
|
|
2446
2530
|
});
|
|
2447
2531
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2448
2532
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2477,15 +2561,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
2477
2561
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
2478
2562
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
2479
2563
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
2480
|
-
var getTenantsList = (state) => state.organization.
|
|
2564
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
2481
2565
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
2482
2566
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2483
2567
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2484
2568
|
[getExternalIntegrations],
|
|
2485
|
-
(integrations) => integrations.filter((integration) =>
|
|
2486
|
-
var _a;
|
|
2487
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2488
|
-
})
|
|
2569
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2489
2570
|
);
|
|
2490
2571
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2491
2572
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2519,15 +2600,12 @@ var filterProcessors = {
|
|
|
2519
2600
|
var filterAliases = {
|
|
2520
2601
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2521
2602
|
};
|
|
2522
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2529
|
-
};
|
|
2530
|
-
});
|
|
2603
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2604
|
+
scope: filter.scope,
|
|
2605
|
+
attribute: filter.key,
|
|
2606
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2607
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2608
|
+
}));
|
|
2531
2609
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2532
2610
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2533
2611
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2537,14 +2615,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2537
2615
|
});
|
|
2538
2616
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2539
2617
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2540
|
-
return
|
|
2618
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2541
2619
|
}
|
|
2542
2620
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2543
2621
|
});
|
|
2544
2622
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2545
|
-
var _a;
|
|
2546
2623
|
let applicableFilters = [...filters];
|
|
2547
|
-
if (typeof group === "string" && !(
|
|
2624
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2548
2625
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2549
2626
|
}
|
|
2550
2627
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2565,12 +2642,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2565
2642
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2566
2643
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2567
2644
|
if (id && byId[id]) {
|
|
2568
|
-
accu.push(
|
|
2645
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2569
2646
|
}
|
|
2570
2647
|
return accu;
|
|
2571
2648
|
}, []);
|
|
2572
2649
|
};
|
|
2573
|
-
var mergePermissions = (existingPermissions =
|
|
2650
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2574
2651
|
(accu, [key, value]) => {
|
|
2575
2652
|
let values;
|
|
2576
2653
|
if (!accu[key]) {
|
|
@@ -2580,12 +2657,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2580
2657
|
if (Array.isArray(value)) {
|
|
2581
2658
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2582
2659
|
} else {
|
|
2583
|
-
values = mergePermissions(accu[key],
|
|
2660
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2584
2661
|
}
|
|
2585
2662
|
accu[key] = values;
|
|
2586
2663
|
return accu;
|
|
2587
2664
|
},
|
|
2588
|
-
|
|
2665
|
+
{ ...addedPermissions }
|
|
2589
2666
|
);
|
|
2590
2667
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2591
2668
|
(accu, roleId) => {
|
|
@@ -2594,20 +2671,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2594
2671
|
}
|
|
2595
2672
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2596
2673
|
},
|
|
2597
|
-
|
|
2674
|
+
{ ...emptyUiPermissions }
|
|
2598
2675
|
);
|
|
2599
2676
|
var progress = ({ loaded, total }) => {
|
|
2600
2677
|
let uploadProgress4 = loaded / total * 100;
|
|
2601
2678
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2602
2679
|
};
|
|
2603
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2604
|
-
var _a, _b2, _c, _d, _e;
|
|
2605
|
-
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;
|
|
2606
|
-
};
|
|
2680
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2607
2681
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2608
2682
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2609
2683
|
try {
|
|
2610
|
-
if (
|
|
2684
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2611
2685
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2612
2686
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2613
2687
|
}
|
|
@@ -2622,9 +2696,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2622
2696
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2623
2697
|
return accu;
|
|
2624
2698
|
}
|
|
2625
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2699
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2700
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2626
2701
|
[attribute.name]: attribute.value
|
|
2627
|
-
}
|
|
2702
|
+
};
|
|
2628
2703
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2629
2704
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2630
2705
|
}
|
|
@@ -2643,15 +2718,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2643
2718
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2644
2719
|
var getReleaseMappingDefaults = () => ({});
|
|
2645
2720
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2646
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2721
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2647
2722
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2648
2723
|
[getReleaseListState, getReleasesById],
|
|
2649
2724
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2650
2725
|
);
|
|
2651
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2652
|
-
var _a;
|
|
2653
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2654
|
-
});
|
|
2726
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2655
2727
|
|
|
2656
2728
|
// src/usersSlice/selectors.ts
|
|
2657
2729
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2660,10 +2732,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2660
2732
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2661
2733
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2662
2734
|
var getUsersById = (state) => state.users.byId;
|
|
2663
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2664
|
-
var _a;
|
|
2665
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2666
|
-
});
|
|
2735
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2667
2736
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2668
2737
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2669
2738
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2674,22 +2743,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2674
2743
|
[getTooltipsById, getUserSettings],
|
|
2675
2744
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2676
2745
|
(accu, [id, value]) => {
|
|
2677
|
-
accu[id] =
|
|
2746
|
+
accu[id] = { ...accu[id], ...value };
|
|
2678
2747
|
return accu;
|
|
2679
2748
|
},
|
|
2680
|
-
|
|
2749
|
+
{ ...tooltips }
|
|
2681
2750
|
)
|
|
2682
2751
|
);
|
|
2683
2752
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2684
2753
|
[getCurrentUser],
|
|
2685
2754
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2686
2755
|
);
|
|
2687
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2756
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2688
2757
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2689
|
-
interval:
|
|
2690
|
-
intervalUnit:
|
|
2758
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2759
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2691
2760
|
}));
|
|
2692
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2761
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2693
2762
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2694
2763
|
|
|
2695
2764
|
// src/commonSelectors.ts
|
|
@@ -2708,8 +2777,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2708
2777
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2709
2778
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2710
2779
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2711
|
-
|
|
2712
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2780
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2713
2781
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2714
2782
|
return { isAdmin, uiPermissions };
|
|
2715
2783
|
}
|
|
@@ -2778,10 +2846,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2778
2846
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2779
2847
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2780
2848
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2781
|
-
const updateAttribute =
|
|
2849
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2782
2850
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2783
2851
|
const attributes = [
|
|
2784
|
-
...previousFilters.map((item) =>
|
|
2852
|
+
...previousFilters.map((item) => ({
|
|
2853
|
+
...item,
|
|
2785
2854
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2786
2855
|
category: "recently used",
|
|
2787
2856
|
priority: 0
|
|
@@ -2799,14 +2868,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2799
2868
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2800
2869
|
}
|
|
2801
2870
|
);
|
|
2802
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
});
|
|
2871
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2872
|
+
...remainder,
|
|
2873
|
+
...onboarding,
|
|
2874
|
+
complete: onboarding.complete || complete,
|
|
2875
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2876
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2877
|
+
}));
|
|
2810
2878
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2811
2879
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2812
2880
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2827,12 +2895,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2827
2895
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2828
2896
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2829
2897
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2830
|
-
|
|
2831
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2898
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2832
2899
|
const { devices = {} } = deployment;
|
|
2833
2900
|
return {
|
|
2834
2901
|
deployment,
|
|
2835
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2902
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2836
2903
|
};
|
|
2837
2904
|
}
|
|
2838
2905
|
);
|
|
@@ -2847,8 +2914,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2847
2914
|
}, {})
|
|
2848
2915
|
);
|
|
2849
2916
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2850
|
-
|
|
2851
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2917
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2852
2918
|
if (staticOnly) {
|
|
2853
2919
|
return Object.keys(uiPermissions.groups).sort();
|
|
2854
2920
|
}
|
|
@@ -2882,9 +2948,25 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2882
2948
|
if (auditlogEvent) {
|
|
2883
2949
|
const { object = {} } = auditlogEvent;
|
|
2884
2950
|
const { device = {}, id, type } = object;
|
|
2885
|
-
auditlogDevice = type === "device" ?
|
|
2951
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2886
2952
|
}
|
|
2887
|
-
return
|
|
2953
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2954
|
+
});
|
|
2955
|
+
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2956
|
+
if (service_provider) {
|
|
2957
|
+
return roles.reduce((accu, role) => {
|
|
2958
|
+
if (rolesById[role.id]) {
|
|
2959
|
+
return accu;
|
|
2960
|
+
}
|
|
2961
|
+
accu.push(role);
|
|
2962
|
+
return accu;
|
|
2963
|
+
}, Object.values(serviceProviderRolesById));
|
|
2964
|
+
}
|
|
2965
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2966
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2967
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2968
|
+
return accu;
|
|
2969
|
+
}, roles);
|
|
2888
2970
|
});
|
|
2889
2971
|
|
|
2890
2972
|
// src/store.ts
|
|
@@ -2920,8 +3002,9 @@ var sessionReducer = (state, action) => {
|
|
|
2920
3002
|
return rootReducer(state, action);
|
|
2921
3003
|
};
|
|
2922
3004
|
var getConfiguredStore = (options = {}) => {
|
|
2923
|
-
const
|
|
2924
|
-
return (0, import_toolkit16.configureStore)(
|
|
3005
|
+
const { preloadedState = {}, ...config } = options;
|
|
3006
|
+
return (0, import_toolkit16.configureStore)({
|
|
3007
|
+
...config,
|
|
2925
3008
|
preloadedState,
|
|
2926
3009
|
reducer: sessionReducer,
|
|
2927
3010
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2934,7 +3017,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2934
3017
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2935
3018
|
}
|
|
2936
3019
|
})
|
|
2937
|
-
})
|
|
3020
|
+
});
|
|
2938
3021
|
};
|
|
2939
3022
|
var store = getConfiguredStore({
|
|
2940
3023
|
preloadedState: {}
|
|
@@ -2954,17 +3037,16 @@ var dateFunctionMap = {
|
|
|
2954
3037
|
setDays: "setDate"
|
|
2955
3038
|
};
|
|
2956
3039
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2957
|
-
var _a, _b2;
|
|
2958
3040
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2959
3041
|
const today = /* @__PURE__ */ new Date();
|
|
2960
3042
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2961
|
-
const setter =
|
|
2962
|
-
const getter =
|
|
3043
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3044
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2963
3045
|
today[setter](today[getter]() - interval);
|
|
2964
3046
|
let value;
|
|
2965
3047
|
try {
|
|
2966
3048
|
value = today.toISOString();
|
|
2967
|
-
} catch
|
|
3049
|
+
} catch {
|
|
2968
3050
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2969
3051
|
}
|
|
2970
3052
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3005,37 +3087,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3005
3087
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3006
3088
|
return accu;
|
|
3007
3089
|
},
|
|
3008
|
-
{ latestVersions:
|
|
3090
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3009
3091
|
);
|
|
3010
3092
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3011
3093
|
return Promise.resolve(
|
|
3012
3094
|
dispatch(
|
|
3013
|
-
actions.setVersionInformation(
|
|
3095
|
+
actions.setVersionInformation({
|
|
3096
|
+
...latestVersions,
|
|
3014
3097
|
backend: info,
|
|
3015
3098
|
GUI: info,
|
|
3016
3099
|
latestRelease: {
|
|
3017
3100
|
releaseDate: latestRelease.release_date,
|
|
3018
3101
|
repos: latestRepos
|
|
3019
3102
|
}
|
|
3020
|
-
})
|
|
3103
|
+
})
|
|
3021
3104
|
)
|
|
3022
3105
|
);
|
|
3023
3106
|
});
|
|
3024
3107
|
});
|
|
3025
3108
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3026
3109
|
const currentState = getSearchState(getState());
|
|
3027
|
-
let nextState =
|
|
3028
|
-
|
|
3029
|
-
|
|
3110
|
+
let nextState = {
|
|
3111
|
+
...currentState,
|
|
3112
|
+
...searchState,
|
|
3113
|
+
sort: {
|
|
3114
|
+
...currentState.sort,
|
|
3115
|
+
...searchState.sort
|
|
3116
|
+
}
|
|
3117
|
+
};
|
|
3030
3118
|
let tasks = [];
|
|
3031
|
-
const
|
|
3032
|
-
const
|
|
3119
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3120
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3033
3121
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3034
3122
|
nextState.isSearching = true;
|
|
3035
3123
|
tasks.push(
|
|
3036
3124
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3037
3125
|
const searchResult = results[results.length - 1];
|
|
3038
|
-
return dispatch(actions.setSearchState(
|
|
3126
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3039
3127
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3040
3128
|
);
|
|
3041
3129
|
}
|
|
@@ -3052,13 +3140,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3052
3140
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3053
3141
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3054
3142
|
(accu, item) => {
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3143
|
+
const filter = item.filter ?? {};
|
|
3144
|
+
let deployment = {
|
|
3145
|
+
...deploymentPrototype,
|
|
3146
|
+
...deploymentsById[item.id],
|
|
3147
|
+
...item,
|
|
3148
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3059
3149
|
name: decodeURIComponent(item.name)
|
|
3060
|
-
}
|
|
3061
|
-
deployment =
|
|
3150
|
+
};
|
|
3151
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3062
3152
|
accu.deployments[item.id] = deployment;
|
|
3063
3153
|
accu.deploymentIds.push(item.id);
|
|
3064
3154
|
return accu;
|
|
@@ -3112,11 +3202,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3112
3202
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3113
3203
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3114
3204
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3115
|
-
const deployment =
|
|
3205
|
+
const deployment = {
|
|
3206
|
+
...newDeployment,
|
|
3116
3207
|
id: deploymentId,
|
|
3117
3208
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3118
3209
|
statistics: { status: {} }
|
|
3119
|
-
}
|
|
3210
|
+
};
|
|
3120
3211
|
let tasks = [
|
|
3121
3212
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3122
3213
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3259,14 +3350,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3259
3350
|
({ 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))))
|
|
3260
3351
|
);
|
|
3261
3352
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3262
|
-
const
|
|
3353
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3263
3354
|
const currentState = getState().deployments.selectionState;
|
|
3264
|
-
let nextState =
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3355
|
+
let nextState = {
|
|
3356
|
+
...currentState,
|
|
3357
|
+
...selectionState,
|
|
3358
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3359
|
+
accu[item] = {
|
|
3360
|
+
...currentState[item],
|
|
3361
|
+
...selectionState[item]
|
|
3362
|
+
};
|
|
3363
|
+
return accu;
|
|
3364
|
+
}, {}),
|
|
3365
|
+
general: {
|
|
3366
|
+
...currentState.general,
|
|
3367
|
+
...selectionState.general
|
|
3368
|
+
}
|
|
3369
|
+
};
|
|
3270
3370
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3271
3371
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3272
3372
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3296,15 +3396,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3296
3396
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3297
3397
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3298
3398
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3299
|
-
const config =
|
|
3399
|
+
const config = {
|
|
3400
|
+
...oldConfig,
|
|
3300
3401
|
hasDelta: Boolean(delta.enabled),
|
|
3301
|
-
binaryDelta:
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3402
|
+
binaryDelta: {
|
|
3403
|
+
...oldConfig.binaryDelta,
|
|
3404
|
+
timeout: timeoutConfig,
|
|
3405
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3406
|
+
},
|
|
3407
|
+
binaryDeltaLimits: {
|
|
3408
|
+
...oldConfig.binaryDeltaLimits,
|
|
3409
|
+
timeout: timeoutLimit,
|
|
3410
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3411
|
+
}
|
|
3412
|
+
};
|
|
3308
3413
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3309
3414
|
})
|
|
3310
3415
|
);
|
|
@@ -3314,7 +3419,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3314
3419
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3315
3420
|
return accu;
|
|
3316
3421
|
}
|
|
3317
|
-
accu =
|
|
3422
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3318
3423
|
}
|
|
3319
3424
|
return accu;
|
|
3320
3425
|
}, void 0);
|
|
@@ -3334,9 +3439,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3334
3439
|
}
|
|
3335
3440
|
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(() => {
|
|
3336
3441
|
const oldConfig = getState().deployments.config;
|
|
3337
|
-
const newConfig =
|
|
3338
|
-
|
|
3339
|
-
|
|
3442
|
+
const newConfig = {
|
|
3443
|
+
...oldConfig,
|
|
3444
|
+
binaryDelta: {
|
|
3445
|
+
...oldConfig.binaryDelta,
|
|
3446
|
+
...config
|
|
3447
|
+
}
|
|
3448
|
+
};
|
|
3340
3449
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3341
3450
|
});
|
|
3342
3451
|
});
|
|
@@ -3349,19 +3458,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3349
3458
|
var import_axios2 = require("axios");
|
|
3350
3459
|
var import_pluralize = __toESM(require_pluralize());
|
|
3351
3460
|
|
|
3352
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3353
|
-
var
|
|
3354
|
-
var
|
|
3355
|
-
var poolPtr = rnds8Pool.length;
|
|
3461
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3462
|
+
var getRandomValues;
|
|
3463
|
+
var rnds8 = new Uint8Array(16);
|
|
3356
3464
|
function rng() {
|
|
3357
|
-
if (
|
|
3358
|
-
|
|
3359
|
-
|
|
3465
|
+
if (!getRandomValues) {
|
|
3466
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3467
|
+
if (!getRandomValues) {
|
|
3468
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3469
|
+
}
|
|
3360
3470
|
}
|
|
3361
|
-
return
|
|
3471
|
+
return getRandomValues(rnds8);
|
|
3362
3472
|
}
|
|
3363
3473
|
|
|
3364
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3474
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3365
3475
|
var byteToHex = [];
|
|
3366
3476
|
for (let i = 0; i < 256; ++i) {
|
|
3367
3477
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3370,13 +3480,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3370
3480
|
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]];
|
|
3371
3481
|
}
|
|
3372
3482
|
|
|
3373
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3374
|
-
var
|
|
3483
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3484
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3375
3485
|
var native_default = {
|
|
3376
|
-
randomUUID
|
|
3486
|
+
randomUUID
|
|
3377
3487
|
};
|
|
3378
3488
|
|
|
3379
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3489
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3380
3490
|
function v4(options, buf, offset) {
|
|
3381
3491
|
if (native_default.randomUUID && !buf && !options) {
|
|
3382
3492
|
return native_default.randomUUID();
|
|
@@ -3418,14 +3528,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3418
3528
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3419
3529
|
const state = getGroupsById(getState());
|
|
3420
3530
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3421
|
-
|
|
3422
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3531
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3423
3532
|
accu[id] = group;
|
|
3424
3533
|
}
|
|
3425
3534
|
return accu;
|
|
3426
3535
|
}, {});
|
|
3427
3536
|
const groups = res.data.reduce((accu, group) => {
|
|
3428
|
-
accu[group] =
|
|
3537
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3429
3538
|
return accu;
|
|
3430
3539
|
}, dynamicGroups);
|
|
3431
3540
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3483,7 +3592,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3483
3592
|
() => Promise.resolve(
|
|
3484
3593
|
dispatch(
|
|
3485
3594
|
actions3.addGroup({
|
|
3486
|
-
group:
|
|
3595
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3487
3596
|
groupName: group
|
|
3488
3597
|
})
|
|
3489
3598
|
)
|
|
@@ -3511,20 +3620,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3511
3620
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3512
3621
|
const state = getGroupsById(getState());
|
|
3513
3622
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3514
|
-
|
|
3515
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3623
|
+
if (!(group.id || group.filters?.length)) {
|
|
3516
3624
|
accu[id] = group;
|
|
3517
3625
|
}
|
|
3518
3626
|
return accu;
|
|
3519
3627
|
}, {});
|
|
3520
3628
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3521
|
-
accu[filter.name] =
|
|
3629
|
+
accu[filter.name] = {
|
|
3522
3630
|
deviceIds: [],
|
|
3523
|
-
total: 0
|
|
3524
|
-
|
|
3631
|
+
total: 0,
|
|
3632
|
+
...state[filter.name],
|
|
3525
3633
|
id: filter.id,
|
|
3526
3634
|
filters: mapTermsToFilters(filter.terms)
|
|
3527
|
-
}
|
|
3635
|
+
};
|
|
3528
3636
|
return accu;
|
|
3529
3637
|
}, staticGroups);
|
|
3530
3638
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3564,10 +3672,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3564
3672
|
);
|
|
3565
3673
|
});
|
|
3566
3674
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3567
|
-
var _a;
|
|
3568
3675
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3569
3676
|
const selectedGroup = groupsState.byId[groupName];
|
|
3570
|
-
const groupFilterLength =
|
|
3677
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3571
3678
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3572
3679
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3573
3680
|
};
|
|
@@ -3590,7 +3697,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3590
3697
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3591
3698
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3592
3699
|
(accu, device) => {
|
|
3593
|
-
var _a, _b2, _c;
|
|
3594
3700
|
const stateDevice = getDeviceById(state, device.id);
|
|
3595
3701
|
const {
|
|
3596
3702
|
attributes: storedAttributes = {},
|
|
@@ -3600,29 +3706,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3600
3706
|
group: storedGroup
|
|
3601
3707
|
} = stateDevice;
|
|
3602
3708
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3603
|
-
device.tags =
|
|
3604
|
-
device.group =
|
|
3605
|
-
device.monitor =
|
|
3606
|
-
device.identity_data =
|
|
3709
|
+
device.tags = { ...storedTags, ...tags };
|
|
3710
|
+
device.group = system.group ?? storedGroup;
|
|
3711
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3712
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3607
3713
|
device.status = status ? status : device.status || identity.status;
|
|
3608
|
-
device.check_in_time_rounded =
|
|
3609
|
-
device.check_in_time_exact =
|
|
3714
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3715
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3610
3716
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3611
3717
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3612
3718
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3613
3719
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3614
|
-
device.attributes = device.attributes ?
|
|
3615
|
-
accu.devicesById[device.id] =
|
|
3720
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3721
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3616
3722
|
accu.ids.push(device.id);
|
|
3617
3723
|
return accu;
|
|
3618
3724
|
},
|
|
3619
3725
|
{ ids, devicesById: {} }
|
|
3620
3726
|
);
|
|
3621
3727
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3622
|
-
const
|
|
3728
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3623
3729
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3624
3730
|
return Promise.resolve(
|
|
3625
|
-
dispatch(getDevicesByStatus2(
|
|
3731
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3626
3732
|
).unwrap().then((results) => {
|
|
3627
3733
|
if (!group) {
|
|
3628
3734
|
return Promise.resolve();
|
|
@@ -3636,7 +3742,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3636
3742
|
dispatch(
|
|
3637
3743
|
actions3.addGroup({
|
|
3638
3744
|
group: {
|
|
3639
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3745
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3640
3746
|
total
|
|
3641
3747
|
},
|
|
3642
3748
|
groupName: group
|
|
@@ -3785,27 +3891,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3785
3891
|
);
|
|
3786
3892
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3787
3893
|
`${sliceName3}/setDeviceListState`,
|
|
3788
|
-
(
|
|
3789
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3790
|
-
var _c;
|
|
3894
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3791
3895
|
const currentState = getDeviceListState(getState());
|
|
3792
3896
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3793
|
-
let nextState =
|
|
3897
|
+
let nextState = {
|
|
3898
|
+
...currentState,
|
|
3794
3899
|
setOnly: false,
|
|
3795
|
-
refreshTrigger
|
|
3796
|
-
|
|
3797
|
-
sort:
|
|
3798
|
-
}
|
|
3900
|
+
refreshTrigger,
|
|
3901
|
+
...selectionState,
|
|
3902
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3903
|
+
};
|
|
3799
3904
|
let tasks = [];
|
|
3800
|
-
const
|
|
3801
|
-
const
|
|
3905
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3906
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3802
3907
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3803
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3908
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3804
3909
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3805
3910
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3806
3911
|
nextState.isLoading = true;
|
|
3807
3912
|
tasks.push(
|
|
3808
|
-
dispatch(getDevicesByStatus2(
|
|
3913
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3809
3914
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3810
3915
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3811
3916
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3830,8 +3935,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3830
3935
|
} = options;
|
|
3831
3936
|
const state = getState();
|
|
3832
3937
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3833
|
-
filters: filterSelection
|
|
3834
|
-
group: group
|
|
3938
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3939
|
+
group: group ?? getSelectedGroup(state),
|
|
3835
3940
|
groups: state.devices.groups,
|
|
3836
3941
|
offlineThreshold: state.app.offlineThreshold,
|
|
3837
3942
|
selectedIssues,
|
|
@@ -3892,7 +3997,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3892
3997
|
});
|
|
3893
3998
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3894
3999
|
const state = getState();
|
|
3895
|
-
let options =
|
|
4000
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3896
4001
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3897
4002
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3898
4003
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4027,8 +4132,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4027
4132
|
({ data: auditLogEntries }) => {
|
|
4028
4133
|
const { start, end } = auditLogEntries.reduce(
|
|
4029
4134
|
(accu, item) => {
|
|
4030
|
-
|
|
4031
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4135
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4032
4136
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4033
4137
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4034
4138
|
}
|
|
@@ -4135,8 +4239,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4135
4239
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4136
4240
|
`${sliceName3}/getDeviceConfig`,
|
|
4137
4241
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4138
|
-
|
|
4139
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4242
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4140
4243
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4141
4244
|
}
|
|
4142
4245
|
})
|
|
@@ -4148,15 +4251,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4148
4251
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4149
4252
|
`${sliceName3}/applyDeviceConfig`,
|
|
4150
4253
|
({ 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 }) => {
|
|
4151
|
-
var _a;
|
|
4152
4254
|
const device = getDeviceById(getState(), deviceId);
|
|
4153
4255
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4154
4256
|
let tasks = [
|
|
4155
|
-
dispatch(actions3.receivedDevice(
|
|
4257
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4156
4258
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4157
4259
|
];
|
|
4158
4260
|
if (isDefault && canManageUsers) {
|
|
4159
|
-
const { previous } =
|
|
4261
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4160
4262
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4161
4263
|
}
|
|
4162
4264
|
return Promise.all(tasks);
|
|
@@ -4172,21 +4274,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4172
4274
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4173
4275
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4174
4276
|
{ headers }
|
|
4175
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4277
|
+
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice({ ...device, id: deviceId, tags })), dispatch(setSnackbar3("Device name changed"))]));
|
|
4176
4278
|
})
|
|
4177
4279
|
)
|
|
4178
4280
|
);
|
|
4179
4281
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4180
4282
|
let providerResult = {};
|
|
4181
4283
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4182
|
-
providerResult =
|
|
4284
|
+
providerResult = { ...data, twinError: "" };
|
|
4183
4285
|
}).catch((err) => {
|
|
4184
4286
|
providerResult = {
|
|
4185
4287
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4186
4288
|
};
|
|
4187
4289
|
}).finally(() => {
|
|
4188
4290
|
const device = getDeviceById(getState(), deviceId);
|
|
4189
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4291
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4190
4292
|
});
|
|
4191
4293
|
});
|
|
4192
4294
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4202,7 +4304,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4202
4304
|
const { twinsByIntegration = {} } = device;
|
|
4203
4305
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4204
4306
|
return Promise.resolve(
|
|
4205
|
-
dispatch(actions3.receivedDevice(
|
|
4307
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4206
4308
|
);
|
|
4207
4309
|
})
|
|
4208
4310
|
);
|
|
@@ -4223,8 +4325,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4223
4325
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4224
4326
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4225
4327
|
const filters = [
|
|
4226
|
-
|
|
4227
|
-
|
|
4328
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4329
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4228
4330
|
];
|
|
4229
4331
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4230
4332
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4236,11 +4338,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4236
4338
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4237
4339
|
const state2 = getState();
|
|
4238
4340
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4239
|
-
const device =
|
|
4341
|
+
const device = {
|
|
4342
|
+
...getDeviceById(state2, id),
|
|
4240
4343
|
systemDeviceIds: ids,
|
|
4241
4344
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4242
|
-
}
|
|
4243
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4345
|
+
};
|
|
4346
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4244
4347
|
});
|
|
4245
4348
|
});
|
|
4246
4349
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4248,9 +4351,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4248
4351
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4249
4352
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4250
4353
|
const filters = [
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4354
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4355
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4356
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4254
4357
|
];
|
|
4255
4358
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4256
4359
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4297,7 +4400,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4297
4400
|
var cutoffLength = 75;
|
|
4298
4401
|
var ellipsis = "...";
|
|
4299
4402
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4300
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4403
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4301
4404
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4302
4405
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4303
4406
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4315,14 +4418,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4315
4418
|
});
|
|
4316
4419
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4317
4420
|
const state = getState();
|
|
4318
|
-
const
|
|
4319
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4421
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4422
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4423
|
+
...remainder,
|
|
4320
4424
|
filters,
|
|
4321
4425
|
group,
|
|
4322
4426
|
offlineThreshold: state.app.offlineThreshold,
|
|
4323
4427
|
selectedIssues: [type],
|
|
4324
4428
|
status
|
|
4325
|
-
})
|
|
4429
|
+
});
|
|
4326
4430
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4327
4431
|
page: 1,
|
|
4328
4432
|
per_page: 1,
|
|
@@ -4374,21 +4478,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4374
4478
|
return steps[progress2];
|
|
4375
4479
|
};
|
|
4376
4480
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4377
|
-
var _a;
|
|
4378
4481
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4379
4482
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4380
4483
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4381
4484
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4382
|
-
let deviceType =
|
|
4485
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4383
4486
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4384
4487
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4385
|
-
return
|
|
4488
|
+
return {
|
|
4489
|
+
...onboardingState,
|
|
4386
4490
|
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)),
|
|
4387
4491
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4388
4492
|
deviceType,
|
|
4389
4493
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4390
4494
|
progress: progress2
|
|
4391
|
-
}
|
|
4495
|
+
};
|
|
4392
4496
|
};
|
|
4393
4497
|
var getOnboardingState2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4394
4498
|
const state = getState();
|
|
@@ -4446,7 +4550,7 @@ var advanceOnboarding = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4446
4550
|
return;
|
|
4447
4551
|
}
|
|
4448
4552
|
const madeProgress = steps[stepIndex + 1];
|
|
4449
|
-
const state =
|
|
4553
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4450
4554
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4451
4555
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4452
4556
|
});
|
|
@@ -4460,20 +4564,21 @@ var { setSnackbar: setSnackbar4, initUpload: initUpload2, uploadProgress: upload
|
|
|
4460
4564
|
var { page: defaultPage4, perPage: defaultPerPage4 } = DEVICE_LIST_DEFAULTS;
|
|
4461
4565
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4462
4566
|
var flattenRelease = (release, stateRelease) => {
|
|
4463
|
-
|
|
4464
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4567
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4465
4568
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4466
4569
|
(accu, item) => {
|
|
4467
|
-
var _a2;
|
|
4468
4570
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4469
|
-
const stateArtifact =
|
|
4571
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4470
4572
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4471
|
-
accu.artifacts.push(
|
|
4573
|
+
accu.artifacts.push({
|
|
4574
|
+
...stateArtifact,
|
|
4575
|
+
...item
|
|
4576
|
+
});
|
|
4472
4577
|
return accu;
|
|
4473
4578
|
},
|
|
4474
4579
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4475
4580
|
);
|
|
4476
|
-
return
|
|
4581
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4477
4582
|
};
|
|
4478
4583
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4479
4584
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4491,17 +4596,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4491
4596
|
{ release: null, index: -1 }
|
|
4492
4597
|
);
|
|
4493
4598
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4494
|
-
var _a;
|
|
4495
4599
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4496
4600
|
if (!release || index === -1) {
|
|
4497
4601
|
return;
|
|
4498
4602
|
}
|
|
4499
4603
|
const releaseArtifacts = [...release.artifacts];
|
|
4500
4604
|
const artifact = releaseArtifacts[index];
|
|
4501
|
-
const { key, name, version } = (
|
|
4605
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4502
4606
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4503
4607
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4504
|
-
filters: [
|
|
4608
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4505
4609
|
});
|
|
4506
4610
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4507
4611
|
page: 1,
|
|
@@ -4515,10 +4619,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4515
4619
|
}
|
|
4516
4620
|
const installCount = Number(headers[headerNames.total]);
|
|
4517
4621
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4518
|
-
releaseArtifacts2[index2] =
|
|
4519
|
-
release2 =
|
|
4622
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4623
|
+
release2 = {
|
|
4624
|
+
...release2,
|
|
4520
4625
|
artifacts: releaseArtifacts2
|
|
4521
|
-
}
|
|
4626
|
+
};
|
|
4522
4627
|
return dispatch(actions7.receiveRelease(release2));
|
|
4523
4628
|
});
|
|
4524
4629
|
});
|
|
@@ -4530,12 +4635,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4530
4635
|
return dispatch(getReleases());
|
|
4531
4636
|
}
|
|
4532
4637
|
const releaseArtifacts = [...release.artifacts];
|
|
4533
|
-
releaseArtifacts[index] =
|
|
4638
|
+
releaseArtifacts[index] = {
|
|
4639
|
+
...releaseArtifacts[index],
|
|
4534
4640
|
url: response.data.uri
|
|
4535
|
-
}
|
|
4536
|
-
release =
|
|
4641
|
+
};
|
|
4642
|
+
release = {
|
|
4643
|
+
...release,
|
|
4537
4644
|
artifacts: releaseArtifacts
|
|
4538
|
-
}
|
|
4645
|
+
};
|
|
4539
4646
|
return dispatch(actions7.receiveRelease(release));
|
|
4540
4647
|
})
|
|
4541
4648
|
);
|
|
@@ -4660,12 +4767,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4660
4767
|
});
|
|
4661
4768
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4662
4769
|
const currentState = getState().releases.releasesList;
|
|
4663
|
-
let nextState =
|
|
4664
|
-
|
|
4665
|
-
|
|
4770
|
+
let nextState = {
|
|
4771
|
+
...currentState,
|
|
4772
|
+
...selectionState,
|
|
4773
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4774
|
+
};
|
|
4666
4775
|
let tasks = [];
|
|
4667
|
-
const
|
|
4668
|
-
const
|
|
4776
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4777
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4669
4778
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4670
4779
|
nextState.isLoading = true;
|
|
4671
4780
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4684,29 +4793,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4684
4793
|
);
|
|
4685
4794
|
};
|
|
4686
4795
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4687
|
-
let releaseListState =
|
|
4796
|
+
let releaseListState = { ...state.releasesList };
|
|
4688
4797
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4689
4798
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4690
4799
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4691
4800
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4692
4801
|
if (searchOnly) {
|
|
4693
|
-
releaseListState =
|
|
4802
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4694
4803
|
} else {
|
|
4695
|
-
releaseListState =
|
|
4804
|
+
releaseListState = {
|
|
4805
|
+
...releaseListState,
|
|
4696
4806
|
releaseIds,
|
|
4697
4807
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4698
4808
|
total: !isFiltering ? total : state.releasesList.total
|
|
4699
|
-
}
|
|
4809
|
+
};
|
|
4700
4810
|
}
|
|
4701
4811
|
return releaseListState;
|
|
4702
4812
|
};
|
|
4703
4813
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4704
|
-
const config =
|
|
4814
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4705
4815
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4706
4816
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4707
4817
|
const state = getState().releases;
|
|
4708
4818
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4709
|
-
const combinedReleases =
|
|
4819
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4710
4820
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4711
4821
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4712
4822
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4727,7 +4837,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4727
4837
|
`${sliceName7}/updateReleaseInfo`,
|
|
4728
4838
|
({ 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(() => {
|
|
4729
4839
|
return Promise.all([
|
|
4730
|
-
dispatch(actions7.receiveRelease(
|
|
4840
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4731
4841
|
dispatch(setSnackbar4("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4732
4842
|
]);
|
|
4733
4843
|
})
|
|
@@ -4736,7 +4846,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4736
4846
|
`${sliceName7}/setReleaseTags`,
|
|
4737
4847
|
({ 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(() => {
|
|
4738
4848
|
return Promise.all([
|
|
4739
|
-
dispatch(actions7.receiveRelease(
|
|
4849
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4740
4850
|
dispatch(setSnackbar4("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4741
4851
|
]);
|
|
4742
4852
|
})
|
|
@@ -4753,19 +4863,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4753
4863
|
// src/api/users-api.ts
|
|
4754
4864
|
var import_axios4 = __toESM(require("axios"));
|
|
4755
4865
|
var Api2 = {
|
|
4756
|
-
postLogin: (url,
|
|
4757
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4758
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4759
|
-
var _a2;
|
|
4760
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4761
|
-
});
|
|
4762
|
-
},
|
|
4866
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios4.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
4763
4867
|
putVerifyTFA: (url, userData) => {
|
|
4764
4868
|
let body = {};
|
|
4765
4869
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4766
4870
|
body = { token2fa: userData.token2fa };
|
|
4767
4871
|
}
|
|
4768
|
-
return import_axios4.default.put(url, body,
|
|
4872
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4769
4873
|
}
|
|
4770
4874
|
};
|
|
4771
4875
|
var users_api_default = Api2;
|
|
@@ -4793,43 +4897,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4793
4897
|
};
|
|
4794
4898
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4795
4899
|
`${sliceName8}/loginUser`,
|
|
4796
|
-
(
|
|
4797
|
-
|
|
4798
|
-
return
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
Promise.
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
window.
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
);
|
|
4831
|
-
});
|
|
4832
|
-
}
|
|
4900
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
4901
|
+
cleanUp();
|
|
4902
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
4903
|
+
}).then(({ text: response, contentType }) => {
|
|
4904
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
4905
|
+
const { id, kind } = response;
|
|
4906
|
+
const type = kind.split("/")[1];
|
|
4907
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
4908
|
+
window.location.replace(ssoLoginUrl);
|
|
4909
|
+
return;
|
|
4910
|
+
}
|
|
4911
|
+
const token = response;
|
|
4912
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
4913
|
+
return;
|
|
4914
|
+
}
|
|
4915
|
+
let now = /* @__PURE__ */ new Date();
|
|
4916
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
4917
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
4918
|
+
setSessionInfo({ token, expiresAt });
|
|
4919
|
+
cookies4.remove("JWT", { path: "/" });
|
|
4920
|
+
return (
|
|
4921
|
+
// @ts-ignore
|
|
4922
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
4923
|
+
cleanUp();
|
|
4924
|
+
return Promise.reject(dispatch(setSnackbar5(extractErrorMessage(e))));
|
|
4925
|
+
}).then(() => {
|
|
4926
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
4927
|
+
if (window.location.pathname !== "/ui/") {
|
|
4928
|
+
window.location.replace("/ui/");
|
|
4929
|
+
}
|
|
4930
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
4931
|
+
})
|
|
4932
|
+
);
|
|
4933
|
+
})
|
|
4833
4934
|
);
|
|
4834
4935
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4835
4936
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4846,7 +4947,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4846
4947
|
return Promise.reject();
|
|
4847
4948
|
}
|
|
4848
4949
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4849
|
-
setSessionInfo(
|
|
4950
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4850
4951
|
window.location.reload();
|
|
4851
4952
|
});
|
|
4852
4953
|
});
|
|
@@ -4909,13 +5010,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4909
5010
|
);
|
|
4910
5011
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
4911
5012
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
4912
|
-
const userId = currentUserId
|
|
5013
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
4913
5014
|
const storageKey = `${userId}-column-widths`;
|
|
4914
5015
|
let customColumns = [];
|
|
4915
5016
|
if (!columns) {
|
|
4916
5017
|
try {
|
|
4917
5018
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
4918
|
-
} catch
|
|
5019
|
+
} catch {
|
|
4919
5020
|
}
|
|
4920
5021
|
} else {
|
|
4921
5022
|
customColumns = columns;
|
|
@@ -4944,10 +5045,7 @@ var userActions = {
|
|
|
4944
5045
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
4945
5046
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4946
5047
|
`${sliceName8}/createUser`,
|
|
4947
|
-
(
|
|
4948
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
4949
|
-
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));
|
|
4950
|
-
}
|
|
5048
|
+
({ 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))
|
|
4951
5049
|
);
|
|
4952
5050
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4953
5051
|
`${sliceName8}/removeUser`,
|
|
@@ -4958,15 +5056,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4958
5056
|
);
|
|
4959
5057
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4960
5058
|
`${sliceName8}/editUser`,
|
|
4961
|
-
(
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
()
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
])
|
|
4968
|
-
);
|
|
4969
|
-
}
|
|
5059
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5060
|
+
() => Promise.all([
|
|
5061
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5062
|
+
dispatch(setSnackbar5(userActions.edit.successMessage))
|
|
5063
|
+
])
|
|
5064
|
+
)
|
|
4970
5065
|
);
|
|
4971
5066
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
4972
5067
|
const { id } = getOrganization(getState());
|
|
@@ -5001,7 +5096,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5001
5096
|
}
|
|
5002
5097
|
return accu;
|
|
5003
5098
|
},
|
|
5004
|
-
|
|
5099
|
+
{ ...emptyUiPermissions }
|
|
5005
5100
|
);
|
|
5006
5101
|
var permissionActionTypes = {
|
|
5007
5102
|
any: mapHttpPermission,
|
|
@@ -5024,20 +5119,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5024
5119
|
}, existingPermissions);
|
|
5025
5120
|
var tryParseCustomPermission = (permission) => {
|
|
5026
5121
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5027
|
-
const result = mergePermissions(
|
|
5122
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5028
5123
|
return { isCustom: true, permission, result };
|
|
5029
5124
|
};
|
|
5030
5125
|
var customPermissionHandler = (accu, permission) => {
|
|
5031
5126
|
let processor = tryParseCustomPermission(permission);
|
|
5032
|
-
return
|
|
5127
|
+
return {
|
|
5128
|
+
...accu,
|
|
5033
5129
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5034
5130
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5035
|
-
}
|
|
5131
|
+
};
|
|
5036
5132
|
};
|
|
5037
5133
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5038
5134
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5039
5135
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5040
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5136
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5041
5137
|
};
|
|
5042
5138
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5043
5139
|
if (Array.isArray(permissions)) {
|
|
@@ -5052,60 +5148,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5052
5148
|
if (!processor) {
|
|
5053
5149
|
return accu;
|
|
5054
5150
|
}
|
|
5055
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5056
|
-
var _a;
|
|
5057
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5058
|
-
});
|
|
5151
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5059
5152
|
if (scope) {
|
|
5060
5153
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5061
|
-
return
|
|
5154
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5062
5155
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5063
5156
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5064
5157
|
}
|
|
5065
|
-
return
|
|
5158
|
+
return {
|
|
5159
|
+
...accu,
|
|
5066
5160
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5067
5161
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5068
|
-
}
|
|
5162
|
+
};
|
|
5069
5163
|
},
|
|
5070
|
-
{ isCustom: false, uiPermissions:
|
|
5164
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5071
5165
|
);
|
|
5072
5166
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5073
5167
|
};
|
|
5074
5168
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5075
5169
|
(accu, role) => {
|
|
5076
|
-
var _a;
|
|
5077
5170
|
let normalizedPermissions;
|
|
5078
5171
|
let isCustom = false;
|
|
5079
5172
|
if (rolesById2[role.name]) {
|
|
5080
|
-
normalizedPermissions =
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5173
|
+
normalizedPermissions = {
|
|
5174
|
+
...rolesById2[role.name].uiPermissions,
|
|
5175
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5176
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5177
|
+
};
|
|
5084
5178
|
} else {
|
|
5085
5179
|
const result = parseRolePermissions(role, permissionSets);
|
|
5086
5180
|
normalizedPermissions = result.uiPermissions;
|
|
5087
5181
|
isCustom = result.isCustom;
|
|
5088
5182
|
}
|
|
5089
|
-
const roleState =
|
|
5090
|
-
accu[role.name] =
|
|
5183
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5184
|
+
accu[role.name] = {
|
|
5185
|
+
...roleState,
|
|
5186
|
+
...role,
|
|
5091
5187
|
description: roleState.description ? roleState.description : role.description,
|
|
5092
5188
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5093
5189
|
isCustom,
|
|
5094
5190
|
name: roleState.name ? roleState.name : role.name,
|
|
5095
5191
|
uiPermissions: normalizedPermissions
|
|
5096
|
-
}
|
|
5192
|
+
};
|
|
5097
5193
|
return accu;
|
|
5098
5194
|
},
|
|
5099
|
-
|
|
5195
|
+
{ ...rolesById2 }
|
|
5100
5196
|
);
|
|
5101
5197
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5102
5198
|
`${sliceName8}/getPermissionSets`,
|
|
5103
5199
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5104
5200
|
const permissionSets = data.reduce(
|
|
5105
5201
|
(accu, permissionSet) => {
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5202
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5203
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5109
5204
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5110
5205
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5111
5206
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5116,11 +5211,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5116
5211
|
}
|
|
5117
5212
|
return collector;
|
|
5118
5213
|
}, accu2),
|
|
5119
|
-
|
|
5214
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5120
5215
|
);
|
|
5121
5216
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5122
|
-
|
|
5123
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5217
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5124
5218
|
accu2.push(key);
|
|
5125
5219
|
}
|
|
5126
5220
|
return accu2;
|
|
@@ -5133,7 +5227,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5133
5227
|
return accu;
|
|
5134
5228
|
},
|
|
5135
5229
|
// @ts-ignore
|
|
5136
|
-
|
|
5230
|
+
{ ...getState().users.permissionSetsById }
|
|
5137
5231
|
);
|
|
5138
5232
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5139
5233
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5166,28 +5260,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5166
5260
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5167
5261
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5168
5262
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5169
|
-
|
|
5170
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5263
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5171
5264
|
type: uiPermissionsByArea[area].scope,
|
|
5172
5265
|
value: []
|
|
5173
5266
|
};
|
|
5174
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5267
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5268
|
+
...permissionSetState,
|
|
5175
5269
|
value: [...permissionSetState.value, item]
|
|
5176
|
-
}
|
|
5270
|
+
};
|
|
5177
5271
|
return itemPermissionAccu;
|
|
5178
5272
|
}, accu);
|
|
5179
5273
|
return accu;
|
|
5180
5274
|
}, {});
|
|
5181
|
-
return Object.entries(permissionSetObject).map((
|
|
5182
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5275
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5183
5276
|
if (value.includes(excessiveAccessSelector)) {
|
|
5184
5277
|
return { name };
|
|
5185
5278
|
}
|
|
5186
|
-
return { name, scope:
|
|
5279
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5187
5280
|
});
|
|
5188
5281
|
};
|
|
5189
5282
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5190
|
-
const role =
|
|
5283
|
+
const role = { ...roleState, ...roleData };
|
|
5191
5284
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5192
5285
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5193
5286
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5223,12 +5316,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5223
5316
|
}, []);
|
|
5224
5317
|
return {
|
|
5225
5318
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5226
|
-
role:
|
|
5319
|
+
role: {
|
|
5320
|
+
...emptyRole,
|
|
5227
5321
|
name,
|
|
5228
5322
|
// @ts-ignore
|
|
5229
5323
|
description: description ? description : roleState.description,
|
|
5230
|
-
uiPermissions:
|
|
5231
|
-
|
|
5324
|
+
uiPermissions: {
|
|
5325
|
+
...emptyUiPermissions,
|
|
5326
|
+
...roleUiPermissions,
|
|
5327
|
+
...maybeUiPermissions
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5232
5330
|
};
|
|
5233
5331
|
};
|
|
5234
5332
|
var roleActions = {
|
|
@@ -5279,13 +5377,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5279
5377
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5280
5378
|
`${sliceName8}/saveGlobalSettings`,
|
|
5281
5379
|
// @ts-ignore
|
|
5282
|
-
(
|
|
5283
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5380
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5284
5381
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5285
5382
|
return;
|
|
5286
5383
|
}
|
|
5287
5384
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5288
|
-
let updatedSettings =
|
|
5385
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5289
5386
|
if (getCurrentUser(getState()).verified) {
|
|
5290
5387
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5291
5388
|
} else {
|
|
@@ -5323,10 +5420,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5323
5420
|
const userSettings = getUserSettings(getState());
|
|
5324
5421
|
const onboardingState = getOnboardingState(getState());
|
|
5325
5422
|
const tooltipState = getTooltipsState(getState());
|
|
5326
|
-
const updatedSettings =
|
|
5327
|
-
|
|
5423
|
+
const updatedSettings = {
|
|
5424
|
+
...userSettings,
|
|
5425
|
+
// @ts-ignore
|
|
5426
|
+
...settings,
|
|
5427
|
+
onboarding: {
|
|
5428
|
+
...onboardingState,
|
|
5429
|
+
// @ts-ignore
|
|
5430
|
+
...settings.onboarding
|
|
5431
|
+
},
|
|
5328
5432
|
tooltips: tooltipState
|
|
5329
|
-
}
|
|
5433
|
+
};
|
|
5330
5434
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5331
5435
|
return Promise.all([
|
|
5332
5436
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5352,9 +5456,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5352
5456
|
`${sliceName8}/getTokens`,
|
|
5353
5457
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5354
5458
|
const user = getCurrentUser(getState());
|
|
5355
|
-
const updatedUser =
|
|
5459
|
+
const updatedUser = {
|
|
5460
|
+
...user,
|
|
5356
5461
|
tokens
|
|
5357
|
-
}
|
|
5462
|
+
};
|
|
5358
5463
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5359
5464
|
})
|
|
5360
5465
|
);
|
|
@@ -5370,8 +5475,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5370
5475
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5371
5476
|
)
|
|
5372
5477
|
);
|
|
5373
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5374
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5478
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5375
5479
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5376
5480
|
if (persist) {
|
|
5377
5481
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5379,14 +5483,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5379
5483
|
return Promise.all(tasks);
|
|
5380
5484
|
});
|
|
5381
5485
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5382
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5486
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5383
5487
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5384
5488
|
});
|
|
5385
5489
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5386
5490
|
`${sliceName8}/submitFeedback`,
|
|
5387
5491
|
// @ts-ignore
|
|
5388
|
-
(
|
|
5389
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5492
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5390
5493
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5391
5494
|
subject: "feedback submission",
|
|
5392
5495
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5476,8 +5579,8 @@ var completeUpgrade = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5476
5579
|
({ 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())))
|
|
5477
5580
|
);
|
|
5478
5581
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
5479
|
-
const userId =
|
|
5480
|
-
const detail =
|
|
5582
|
+
const userId = userFilter?.id || userFilter;
|
|
5583
|
+
const detail = detailFilter?.id || detailFilter;
|
|
5481
5584
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
5482
5585
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
5483
5586
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -5504,12 +5607,14 @@ var getAuditLogsCsvLink = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5504
5607
|
);
|
|
5505
5608
|
var setAuditlogsState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
5506
5609
|
const currentState = getAuditlogState(getState());
|
|
5507
|
-
let nextState =
|
|
5508
|
-
|
|
5509
|
-
|
|
5610
|
+
let nextState = {
|
|
5611
|
+
...currentState,
|
|
5612
|
+
...selectionState,
|
|
5613
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5614
|
+
};
|
|
5510
5615
|
let tasks = [];
|
|
5511
|
-
const
|
|
5512
|
-
const
|
|
5616
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
5617
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
5513
5618
|
if (!(0, import_helpers12.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
5514
5619
|
nextState.isLoading = true;
|
|
5515
5620
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -5521,27 +5626,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
5521
5626
|
var addTenant = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
5522
5627
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar6("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
5523
5628
|
});
|
|
5524
|
-
var tenantListRetrieval = (config) =>
|
|
5629
|
+
var tenantListRetrieval = async (config) => {
|
|
5525
5630
|
const { page, perPage } = config;
|
|
5526
5631
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
5527
|
-
const tenantList =
|
|
5632
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
5528
5633
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
5529
|
-
return [tenantList.data, totalCount];
|
|
5530
|
-
}
|
|
5531
|
-
var getTenants = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
5634
|
+
return [tenantList.data, Number(totalCount)];
|
|
5635
|
+
};
|
|
5636
|
+
var getTenants = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
5532
5637
|
const currentState = getTenantsList(getState());
|
|
5533
|
-
const [tenants, pageCount] =
|
|
5534
|
-
dispatch(actions6.setTenantListState(
|
|
5535
|
-
})
|
|
5536
|
-
var setTenantsListState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
5638
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
5639
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
5640
|
+
});
|
|
5641
|
+
var setTenantsListState = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
5537
5642
|
const currentState = getTenantsList(getState());
|
|
5538
|
-
const nextState =
|
|
5643
|
+
const nextState = {
|
|
5644
|
+
...currentState,
|
|
5645
|
+
...selectionState
|
|
5646
|
+
};
|
|
5539
5647
|
if (!(0, import_helpers12.deepCompare)(currentState, selectionState)) {
|
|
5540
|
-
const [tenants, pageCount] =
|
|
5541
|
-
return dispatch(actions6.setTenantListState(
|
|
5648
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
5649
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
5542
5650
|
}
|
|
5543
|
-
return dispatch(actions6.setTenantListState(
|
|
5544
|
-
})
|
|
5651
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
5652
|
+
});
|
|
5545
5653
|
var editTenantDeviceLimit = (0, import_toolkit24.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
5546
5654
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
5547
5655
|
const tasks = [Promise.resolve(dispatch(setSnackbar6("Device Limit was changed successfully")))];
|
|
@@ -5584,10 +5692,7 @@ var downloadLicenseReport = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5584
5692
|
);
|
|
5585
5693
|
var createIntegration = (0, import_toolkit24.createAsyncThunk)(
|
|
5586
5694
|
`${sliceName6}/createIntegration`,
|
|
5587
|
-
(
|
|
5588
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
5589
|
-
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(setSnackbar6("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
5590
|
-
}
|
|
5695
|
+
({ 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(setSnackbar6("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
5591
5696
|
);
|
|
5592
5697
|
var changeIntegration = (0, import_toolkit24.createAsyncThunk)(
|
|
5593
5698
|
`${sliceName6}/changeIntegration`,
|
|
@@ -5608,9 +5713,8 @@ var getIntegrations = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5608
5713
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
5609
5714
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
5610
5715
|
const integrations = data.reduce((accu, item) => {
|
|
5611
|
-
|
|
5612
|
-
const
|
|
5613
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
5716
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
5717
|
+
const integration = { ...existingIntegration, ...item };
|
|
5614
5718
|
accu.push(integration);
|
|
5615
5719
|
return accu;
|
|
5616
5720
|
}, []);
|
|
@@ -5662,7 +5766,7 @@ var getSsoConfigById = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5662
5766
|
`${sliceName6}/getSsoConfigById`,
|
|
5663
5767
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
5664
5768
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
5665
|
-
return sso ? Promise.resolve(
|
|
5769
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
5666
5770
|
})
|
|
5667
5771
|
);
|
|
5668
5772
|
var getSsoConfigs = (0, import_toolkit24.createAsyncThunk)(
|
|
@@ -5671,39 +5775,4 @@ var getSsoConfigs = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5671
5775
|
({ data }) => Promise.all(data.map((config) => dispatch(getSsoConfigById(config)).unwrap())).then((configs) => dispatch(actions6.receiveSsoConfigs(configs))).catch((err) => commonErrorHandler(err, err, dispatch, ""))
|
|
5672
5776
|
)
|
|
5673
5777
|
);
|
|
5674
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5675
|
-
0 && (module.exports = {
|
|
5676
|
-
addTenant,
|
|
5677
|
-
cancelRequest,
|
|
5678
|
-
cancelUpgrade,
|
|
5679
|
-
changeIntegration,
|
|
5680
|
-
changeSsoConfig,
|
|
5681
|
-
completeUpgrade,
|
|
5682
|
-
confirmCardUpdate,
|
|
5683
|
-
createIntegration,
|
|
5684
|
-
createOrganizationTrial,
|
|
5685
|
-
deleteIntegration,
|
|
5686
|
-
deleteSsoConfig,
|
|
5687
|
-
downloadLicenseReport,
|
|
5688
|
-
editTenantDeviceLimit,
|
|
5689
|
-
getAuditLogs,
|
|
5690
|
-
getAuditLogsCsvLink,
|
|
5691
|
-
getCurrentCard,
|
|
5692
|
-
getIntegrations,
|
|
5693
|
-
getSsoConfigById,
|
|
5694
|
-
getSsoConfigs,
|
|
5695
|
-
getTargetLocation,
|
|
5696
|
-
getTenants,
|
|
5697
|
-
getUserOrganization,
|
|
5698
|
-
getWebhookEvents,
|
|
5699
|
-
removeTenant,
|
|
5700
|
-
requestPlanChange,
|
|
5701
|
-
sendSupportMessage,
|
|
5702
|
-
setAuditlogsState,
|
|
5703
|
-
setTenantsListState,
|
|
5704
|
-
startCardUpdate,
|
|
5705
|
-
startUpgrade,
|
|
5706
|
-
storeSsoConfig,
|
|
5707
|
-
tenantDataDivergedMessage
|
|
5708
|
-
});
|
|
5709
5778
|
//# sourceMappingURL=thunks.js.map
|