@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
package/dist/storehooks.js
CHANGED
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -467,7 +417,7 @@ var chartTypes = {
|
|
|
467
417
|
};
|
|
468
418
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
469
419
|
var defaultReportType = "distribution";
|
|
470
|
-
var defaultReports = [
|
|
420
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
471
421
|
var locations = {};
|
|
472
422
|
var PLANS = {
|
|
473
423
|
os: {
|
|
@@ -793,13 +743,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
793
743
|
deployments: [],
|
|
794
744
|
groups: Object.freeze({}),
|
|
795
745
|
releases: Object.freeze({}),
|
|
746
|
+
tenantManagement: [],
|
|
796
747
|
userManagement: []
|
|
797
748
|
});
|
|
798
749
|
var emptyRole = Object.freeze({
|
|
799
750
|
name: void 0,
|
|
800
751
|
description: "",
|
|
801
752
|
permissions: [],
|
|
802
|
-
uiPermissions: Object.freeze(
|
|
753
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
803
754
|
});
|
|
804
755
|
|
|
805
756
|
// src/deploymentsSlice/constants.ts
|
|
@@ -828,11 +779,12 @@ var deploymentStatesToSubstates = {
|
|
|
828
779
|
pending: [deploymentSubstates.pending],
|
|
829
780
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
830
781
|
};
|
|
831
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
782
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
783
|
+
...deploymentStatesToSubstates,
|
|
832
784
|
failures: [deploymentSubstates.failure],
|
|
833
785
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
834
786
|
successes: [deploymentSubstates.success]
|
|
835
|
-
}
|
|
787
|
+
};
|
|
836
788
|
var installationSubstatesMap = {
|
|
837
789
|
download: {
|
|
838
790
|
title: "download",
|
|
@@ -877,8 +829,8 @@ var DEPLOYMENT_STATES = {
|
|
|
877
829
|
var listDefaultsByState = {
|
|
878
830
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
879
831
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
880
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
881
|
-
[DEPLOYMENT_STATES.finished]:
|
|
832
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
833
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
882
834
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
883
835
|
};
|
|
884
836
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1040,6 +992,13 @@ var SSO_TYPES = {
|
|
|
1040
992
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1041
993
|
}
|
|
1042
994
|
};
|
|
995
|
+
var AUDIT_LOGS_TYPES = [
|
|
996
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
997
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
998
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
999
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1000
|
+
];
|
|
1001
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1043
1002
|
var emptyWebhook = {
|
|
1044
1003
|
description: "",
|
|
1045
1004
|
enabled: true,
|
|
@@ -1088,10 +1047,12 @@ var permissionSetIds = {
|
|
|
1088
1047
|
DeployToDevices: "DeployToDevices",
|
|
1089
1048
|
ManageDevices: "ManageDevices",
|
|
1090
1049
|
ManageReleases: "ManageReleases",
|
|
1050
|
+
ManageTenants: "ManageTenants",
|
|
1091
1051
|
ManageUsers: "ManageUsers",
|
|
1092
1052
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1093
1053
|
ReadDevices: "ReadDevices",
|
|
1094
1054
|
ReadReleases: "ReadReleases",
|
|
1055
|
+
ReadTenants: "ReadTenants",
|
|
1095
1056
|
ReadUsers: "ReadUsers",
|
|
1096
1057
|
SuperUser: "SuperUser",
|
|
1097
1058
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1130,6 +1091,7 @@ var uiPermissionsById = {
|
|
|
1130
1091
|
permissionSets: {
|
|
1131
1092
|
groups: permissionSetIds.ManageDevices,
|
|
1132
1093
|
releases: permissionSetIds.ManageReleases,
|
|
1094
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1133
1095
|
userManagement: permissionSetIds.ManageUsers
|
|
1134
1096
|
},
|
|
1135
1097
|
title: "Manage",
|
|
@@ -1143,6 +1105,7 @@ var uiPermissionsById = {
|
|
|
1143
1105
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1144
1106
|
groups: permissionSetIds.ReadDevices,
|
|
1145
1107
|
releases: permissionSetIds.ReadReleases,
|
|
1108
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1146
1109
|
userManagement: permissionSetIds.ReadUsers
|
|
1147
1110
|
},
|
|
1148
1111
|
title: "Read",
|
|
@@ -1167,6 +1130,7 @@ var uiPermissionsByArea = {
|
|
|
1167
1130
|
auditlog: {
|
|
1168
1131
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1169
1132
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1133
|
+
key: "auditlog",
|
|
1170
1134
|
uiPermissions: [uiPermissionsById.read],
|
|
1171
1135
|
title: "System audit log"
|
|
1172
1136
|
},
|
|
@@ -1177,6 +1141,7 @@ var uiPermissionsByArea = {
|
|
|
1177
1141
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1178
1142
|
],
|
|
1179
1143
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1144
|
+
key: "deployments",
|
|
1180
1145
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1181
1146
|
title: "Deployments"
|
|
1182
1147
|
},
|
|
@@ -1192,6 +1157,7 @@ var uiPermissionsByArea = {
|
|
|
1192
1157
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1193
1158
|
],
|
|
1194
1159
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1160
|
+
key: "groups",
|
|
1195
1161
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1196
1162
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1197
1163
|
title: "Group Management"
|
|
@@ -1211,22 +1177,35 @@ var uiPermissionsByArea = {
|
|
|
1211
1177
|
}
|
|
1212
1178
|
],
|
|
1213
1179
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1180
|
+
key: "releases",
|
|
1214
1181
|
scope: "ReleaseTags",
|
|
1215
1182
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1216
1183
|
title: "Release Management"
|
|
1217
1184
|
},
|
|
1185
|
+
tenantManagement: {
|
|
1186
|
+
endpoints: [
|
|
1187
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1188
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1189
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1190
|
+
],
|
|
1191
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1192
|
+
key: "tenantManagement",
|
|
1193
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1194
|
+
title: "Tenant Management"
|
|
1195
|
+
},
|
|
1218
1196
|
userManagement: {
|
|
1219
1197
|
endpoints: [
|
|
1220
1198
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1221
1199
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1222
1200
|
],
|
|
1223
1201
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1202
|
+
key: "userManagement",
|
|
1224
1203
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1225
1204
|
title: "User Management"
|
|
1226
1205
|
}
|
|
1227
1206
|
};
|
|
1228
1207
|
var permissionMapper = (permission) => permission.value;
|
|
1229
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1208
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1230
1209
|
var rolesById = Object.freeze({
|
|
1231
1210
|
[staticRolesByName.admin]: {
|
|
1232
1211
|
name: "Admin",
|
|
@@ -1234,56 +1213,87 @@ var rolesById = Object.freeze({
|
|
|
1234
1213
|
description: "Full access",
|
|
1235
1214
|
permissions: [],
|
|
1236
1215
|
// permissions refers to the values returned from the backend
|
|
1237
|
-
uiPermissions:
|
|
1216
|
+
uiPermissions: {
|
|
1217
|
+
...emptyUiPermissions,
|
|
1238
1218
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1239
1219
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1240
1220
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1241
1221
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1242
1222
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1243
|
-
}
|
|
1223
|
+
}
|
|
1244
1224
|
},
|
|
1245
1225
|
[staticRolesByName.readOnly]: {
|
|
1246
1226
|
name: "Read Access",
|
|
1247
1227
|
value: staticRolesByName.readOnly,
|
|
1248
1228
|
description: "",
|
|
1249
1229
|
permissions: [],
|
|
1250
|
-
uiPermissions:
|
|
1230
|
+
uiPermissions: {
|
|
1231
|
+
...emptyUiPermissions,
|
|
1251
1232
|
deployments: [uiPermissionsById.read.value],
|
|
1252
1233
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1253
1234
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1254
1235
|
userManagement: [uiPermissionsById.read.value]
|
|
1255
|
-
}
|
|
1236
|
+
}
|
|
1256
1237
|
},
|
|
1257
1238
|
[staticRolesByName.ci]: {
|
|
1258
1239
|
name: "Releases Manager",
|
|
1259
1240
|
value: staticRolesByName.ci,
|
|
1260
1241
|
description: "",
|
|
1261
1242
|
permissions: [],
|
|
1262
|
-
uiPermissions:
|
|
1243
|
+
uiPermissions: {
|
|
1244
|
+
...emptyUiPermissions,
|
|
1263
1245
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1264
|
-
}
|
|
1246
|
+
}
|
|
1265
1247
|
},
|
|
1266
1248
|
[staticRolesByName.deploymentsManager]: {
|
|
1267
1249
|
name: "Deployments Manager",
|
|
1268
1250
|
value: staticRolesByName.deploymentsManager,
|
|
1269
1251
|
description: "",
|
|
1270
1252
|
permissions: [],
|
|
1271
|
-
uiPermissions:
|
|
1253
|
+
uiPermissions: {
|
|
1254
|
+
...emptyUiPermissions,
|
|
1272
1255
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1273
1256
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1274
1257
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1275
|
-
}
|
|
1258
|
+
}
|
|
1276
1259
|
},
|
|
1277
1260
|
[staticRolesByName.terminalAccess]: {
|
|
1278
1261
|
name: "Troubleshooting",
|
|
1279
1262
|
value: staticRolesByName.terminalAccess,
|
|
1280
1263
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1281
1264
|
permissions: [],
|
|
1282
|
-
uiPermissions:
|
|
1265
|
+
uiPermissions: {
|
|
1266
|
+
...emptyUiPermissions,
|
|
1283
1267
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1284
|
-
}
|
|
1268
|
+
}
|
|
1285
1269
|
}
|
|
1286
1270
|
});
|
|
1271
|
+
var serviceProviderRolesById = {
|
|
1272
|
+
admin: {
|
|
1273
|
+
name: "Admin",
|
|
1274
|
+
value: staticRolesByName.admin,
|
|
1275
|
+
description: "Full access",
|
|
1276
|
+
permissions: [],
|
|
1277
|
+
uiPermissions: {
|
|
1278
|
+
...emptyUiPermissions,
|
|
1279
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1280
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1281
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
readOnly: {
|
|
1285
|
+
name: "Read access",
|
|
1286
|
+
value: staticRolesByName.admin,
|
|
1287
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1288
|
+
permissions: [],
|
|
1289
|
+
uiPermissions: {
|
|
1290
|
+
...emptyUiPermissions,
|
|
1291
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1292
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1293
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1287
1297
|
var defaultPermissionSets = {
|
|
1288
1298
|
[permissionSetIds.Basic]: {
|
|
1289
1299
|
name: permissionSetIds.Basic,
|
|
@@ -1294,7 +1304,9 @@ var defaultPermissionSets = {
|
|
|
1294
1304
|
},
|
|
1295
1305
|
[permissionSetIds.SuperUser]: {
|
|
1296
1306
|
name: permissionSetIds.SuperUser,
|
|
1297
|
-
result:
|
|
1307
|
+
result: {
|
|
1308
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1309
|
+
}
|
|
1298
1310
|
},
|
|
1299
1311
|
[permissionSetIds.ManageUsers]: {
|
|
1300
1312
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1314,6 +1326,18 @@ var defaultPermissionSets = {
|
|
|
1314
1326
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1315
1327
|
}
|
|
1316
1328
|
},
|
|
1329
|
+
[permissionSetIds.ReadTenants]: {
|
|
1330
|
+
name: permissionSetIds.ReadTenants,
|
|
1331
|
+
result: {
|
|
1332
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
[permissionSetIds.ManageTenants]: {
|
|
1336
|
+
name: permissionSetIds.ManageTenants,
|
|
1337
|
+
result: {
|
|
1338
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1317
1341
|
[permissionSetIds.ReadUsers]: {
|
|
1318
1342
|
name: permissionSetIds.ReadUsers,
|
|
1319
1343
|
result: {
|
|
@@ -1367,11 +1391,12 @@ var defaultPermissionSets = {
|
|
|
1367
1391
|
};
|
|
1368
1392
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1369
1393
|
var OWN_USER_ID = "me";
|
|
1370
|
-
var rolesByName =
|
|
1394
|
+
var rolesByName = {
|
|
1395
|
+
...staticRolesByName,
|
|
1371
1396
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1372
1397
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1373
1398
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1374
|
-
}
|
|
1399
|
+
};
|
|
1375
1400
|
var twoFAStates = {
|
|
1376
1401
|
enabled: "enabled",
|
|
1377
1402
|
disabled: "disabled",
|
|
@@ -1459,7 +1484,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1459
1484
|
initialState,
|
|
1460
1485
|
reducers: {
|
|
1461
1486
|
setFeatures: (state, action) => {
|
|
1462
|
-
state.features =
|
|
1487
|
+
state.features = {
|
|
1488
|
+
...state.features,
|
|
1489
|
+
...action.payload
|
|
1490
|
+
};
|
|
1463
1491
|
},
|
|
1464
1492
|
setSnackbar: (state, { payload }) => {
|
|
1465
1493
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1484,7 +1512,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1484
1512
|
state.hostedAnnouncement = action.payload;
|
|
1485
1513
|
},
|
|
1486
1514
|
setSearchState: (state, action) => {
|
|
1487
|
-
state.searchState =
|
|
1515
|
+
state.searchState = {
|
|
1516
|
+
...state.searchState,
|
|
1517
|
+
...action.payload
|
|
1518
|
+
};
|
|
1488
1519
|
},
|
|
1489
1520
|
setOfflineThreshold: (state, action) => {
|
|
1490
1521
|
state.offlineThreshold = action.payload;
|
|
@@ -1495,20 +1526,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1495
1526
|
},
|
|
1496
1527
|
uploadProgress: (state, action) => {
|
|
1497
1528
|
const { id, progress: progress2 } = action.payload;
|
|
1498
|
-
state.uploadsById[id] =
|
|
1529
|
+
state.uploadsById[id] = {
|
|
1530
|
+
...state.uploadsById[id],
|
|
1499
1531
|
progress: progress2
|
|
1500
|
-
}
|
|
1532
|
+
};
|
|
1501
1533
|
},
|
|
1502
1534
|
cleanUpUpload: (state, action) => {
|
|
1503
|
-
|
|
1504
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1535
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1505
1536
|
state.uploadsById = remainder;
|
|
1506
1537
|
},
|
|
1507
1538
|
setVersionInformation: (state, action) => {
|
|
1508
|
-
state.versionInformation =
|
|
1539
|
+
state.versionInformation = {
|
|
1540
|
+
...state.versionInformation,
|
|
1541
|
+
...action.payload
|
|
1542
|
+
};
|
|
1509
1543
|
},
|
|
1510
1544
|
setEnvironmentData: (state, action) => {
|
|
1511
|
-
return
|
|
1545
|
+
return { ...state, ...action.payload };
|
|
1512
1546
|
}
|
|
1513
1547
|
}
|
|
1514
1548
|
});
|
|
@@ -1540,7 +1574,7 @@ var initialState2 = {
|
|
|
1540
1574
|
sourceWindow: -1
|
|
1541
1575
|
},
|
|
1542
1576
|
binaryDeltaLimits: {
|
|
1543
|
-
timeout:
|
|
1577
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1544
1578
|
sourceWindow: limitDefault,
|
|
1545
1579
|
inputWindow: limitDefault,
|
|
1546
1580
|
duplicatesWindow: limitDefault,
|
|
@@ -1550,10 +1584,10 @@ var initialState2 = {
|
|
|
1550
1584
|
deploymentDeviceLimit: 5e3,
|
|
1551
1585
|
selectedDeviceIds: [],
|
|
1552
1586
|
selectionState: {
|
|
1553
|
-
finished:
|
|
1554
|
-
inprogress:
|
|
1555
|
-
pending:
|
|
1556
|
-
scheduled:
|
|
1587
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1588
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1589
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1590
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1557
1591
|
general: {
|
|
1558
1592
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1559
1593
|
showCreationDialog: false,
|
|
@@ -1569,40 +1603,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1569
1603
|
initialState: initialState2,
|
|
1570
1604
|
reducers: {
|
|
1571
1605
|
createdDeployment: (state, action) => {
|
|
1572
|
-
state.byId[action.payload.id] =
|
|
1606
|
+
state.byId[action.payload.id] = {
|
|
1607
|
+
...deploymentPrototype,
|
|
1608
|
+
...action.payload
|
|
1609
|
+
};
|
|
1573
1610
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1574
1611
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1575
1612
|
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;
|
|
1576
1613
|
},
|
|
1577
1614
|
removedDeployment: (state, action) => {
|
|
1578
|
-
|
|
1579
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1615
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1580
1616
|
state.byId = remainder;
|
|
1581
1617
|
},
|
|
1582
1618
|
receivedDeployment: (state, action) => {
|
|
1583
|
-
state.byId[action.payload.id] =
|
|
1619
|
+
state.byId[action.payload.id] = {
|
|
1620
|
+
...state.byId[action.payload.id] || {},
|
|
1621
|
+
...action.payload
|
|
1622
|
+
};
|
|
1584
1623
|
},
|
|
1585
1624
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1586
1625
|
const { id, deviceId, log } = action.payload;
|
|
1587
|
-
const deployment =
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1626
|
+
const deployment = {
|
|
1627
|
+
...deploymentPrototype,
|
|
1628
|
+
...state.byId[id]
|
|
1629
|
+
};
|
|
1630
|
+
state.byId[id] = {
|
|
1631
|
+
...deployment,
|
|
1632
|
+
devices: {
|
|
1633
|
+
...deployment.devices,
|
|
1634
|
+
[deviceId]: {
|
|
1635
|
+
...deployment.devices[deviceId],
|
|
1591
1636
|
log
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1595
1640
|
},
|
|
1596
1641
|
receivedDeploymentDevices: (state, action) => {
|
|
1597
1642
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1598
|
-
state.byId[id] =
|
|
1643
|
+
state.byId[id] = {
|
|
1644
|
+
...state.byId[id],
|
|
1599
1645
|
devices,
|
|
1600
1646
|
totalDeviceCount
|
|
1601
|
-
}
|
|
1647
|
+
};
|
|
1602
1648
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1603
1649
|
},
|
|
1604
1650
|
receivedDeployments: (state, action) => {
|
|
1605
|
-
state.byId =
|
|
1651
|
+
state.byId = {
|
|
1652
|
+
...state.byId,
|
|
1653
|
+
...action.payload
|
|
1654
|
+
};
|
|
1606
1655
|
},
|
|
1607
1656
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1608
1657
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1644,9 +1693,9 @@ var initialState3 = {
|
|
|
1644
1693
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1645
1694
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1646
1695
|
},
|
|
1647
|
-
deviceList:
|
|
1648
|
-
deviceIds: []
|
|
1649
|
-
|
|
1696
|
+
deviceList: {
|
|
1697
|
+
deviceIds: [],
|
|
1698
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1650
1699
|
selectedAttributes: [],
|
|
1651
1700
|
selectedIssues: [],
|
|
1652
1701
|
selection: [],
|
|
@@ -1657,7 +1706,7 @@ var initialState3 = {
|
|
|
1657
1706
|
},
|
|
1658
1707
|
state: DEVICE_STATES.accepted,
|
|
1659
1708
|
total: 0
|
|
1660
|
-
}
|
|
1709
|
+
},
|
|
1661
1710
|
filters: [
|
|
1662
1711
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1663
1712
|
],
|
|
@@ -1692,49 +1741,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1692
1741
|
},
|
|
1693
1742
|
addToGroup: (state, action) => {
|
|
1694
1743
|
const { group, deviceIds } = action.payload;
|
|
1695
|
-
const maybeExistingGroup =
|
|
1744
|
+
const maybeExistingGroup = {
|
|
1696
1745
|
filters: [],
|
|
1697
|
-
deviceIds: []
|
|
1698
|
-
|
|
1699
|
-
|
|
1746
|
+
deviceIds: [],
|
|
1747
|
+
...state.groups.byId[group]
|
|
1748
|
+
};
|
|
1749
|
+
state.groups.byId[group] = {
|
|
1750
|
+
...maybeExistingGroup,
|
|
1700
1751
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1701
1752
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1702
|
-
}
|
|
1753
|
+
};
|
|
1703
1754
|
},
|
|
1704
1755
|
removeFromGroup: (state, action) => {
|
|
1705
1756
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1706
|
-
const
|
|
1707
|
-
const changedGroup =
|
|
1757
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1758
|
+
const changedGroup = {
|
|
1759
|
+
...maybeExistingGroup,
|
|
1708
1760
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1709
1761
|
total: Math.max(total - removedIds.length, 0)
|
|
1710
|
-
}
|
|
1762
|
+
};
|
|
1711
1763
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1712
1764
|
state.groups.byId[group] = changedGroup;
|
|
1713
1765
|
return;
|
|
1714
1766
|
} else if (state.groups.selectedGroup === group) {
|
|
1715
1767
|
state.groups.selectedGroup = void 0;
|
|
1716
1768
|
}
|
|
1717
|
-
const
|
|
1769
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1718
1770
|
state.groups.byId = remainingById;
|
|
1719
1771
|
},
|
|
1720
1772
|
addGroup: (state, action) => {
|
|
1721
1773
|
const { groupName, group } = action.payload;
|
|
1722
|
-
state.groups.byId[groupName] =
|
|
1774
|
+
state.groups.byId[groupName] = {
|
|
1775
|
+
...state.groups.byId[groupName],
|
|
1776
|
+
...group
|
|
1777
|
+
};
|
|
1723
1778
|
},
|
|
1724
1779
|
selectGroup: (state, { payload: group }) => {
|
|
1725
1780
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1726
1781
|
state.groups.selectedGroup = group;
|
|
1727
1782
|
},
|
|
1728
1783
|
removeGroup: (state, action) => {
|
|
1729
|
-
|
|
1730
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1784
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1731
1785
|
state.groups.byId = remainingById;
|
|
1732
1786
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1733
1787
|
},
|
|
1734
1788
|
setDeviceListState: (state, action) => {
|
|
1735
|
-
state.deviceList =
|
|
1736
|
-
|
|
1737
|
-
|
|
1789
|
+
state.deviceList = {
|
|
1790
|
+
...state.deviceList,
|
|
1791
|
+
...action.payload,
|
|
1792
|
+
sort: {
|
|
1793
|
+
...state.deviceList.sort,
|
|
1794
|
+
...action.payload.sort
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1738
1797
|
},
|
|
1739
1798
|
setFilterAttributes: (state, action) => {
|
|
1740
1799
|
state.filteringAttributes = action.payload;
|
|
@@ -1743,7 +1802,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1743
1802
|
state.filteringAttributesConfig = action.payload;
|
|
1744
1803
|
},
|
|
1745
1804
|
receivedDevices: (state, action) => {
|
|
1746
|
-
state.byId =
|
|
1805
|
+
state.byId = {
|
|
1806
|
+
...state.byId,
|
|
1807
|
+
...action.payload
|
|
1808
|
+
};
|
|
1747
1809
|
},
|
|
1748
1810
|
setDeviceFilters: (state, action) => {
|
|
1749
1811
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1774,7 +1836,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1774
1836
|
state.limit = action.payload;
|
|
1775
1837
|
},
|
|
1776
1838
|
receivedDevice: (state, action) => {
|
|
1777
|
-
state.byId[action.payload.id] =
|
|
1839
|
+
state.byId[action.payload.id] = {
|
|
1840
|
+
...state.byId[action.payload.id],
|
|
1841
|
+
...action.payload
|
|
1842
|
+
};
|
|
1778
1843
|
},
|
|
1779
1844
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1780
1845
|
const { deviceId, authId } = action.payload;
|
|
@@ -1795,15 +1860,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1795
1860
|
var sliceName4 = "monitor";
|
|
1796
1861
|
var initialState4 = {
|
|
1797
1862
|
alerts: {
|
|
1798
|
-
alertList:
|
|
1863
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1799
1864
|
byDeviceId: {}
|
|
1800
1865
|
},
|
|
1801
1866
|
issueCounts: {
|
|
1802
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1867
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1803
1868
|
},
|
|
1804
1869
|
settings: {
|
|
1805
1870
|
global: {
|
|
1806
|
-
channels:
|
|
1871
|
+
channels: {
|
|
1872
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1873
|
+
}
|
|
1807
1874
|
}
|
|
1808
1875
|
}
|
|
1809
1876
|
};
|
|
@@ -1821,14 +1888,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1821
1888
|
},
|
|
1822
1889
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1823
1890
|
const { deviceId, alerts } = action.payload;
|
|
1824
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1891
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1825
1892
|
},
|
|
1826
1893
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1827
1894
|
const { issueType, counts } = action.payload;
|
|
1828
1895
|
state.issueCounts.byType[issueType] = counts;
|
|
1829
1896
|
},
|
|
1830
1897
|
setAlertListState: (state, action) => {
|
|
1831
|
-
state.alerts.alertList =
|
|
1898
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1832
1899
|
}
|
|
1833
1900
|
}
|
|
1834
1901
|
});
|
|
@@ -1852,7 +1919,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1852
1919
|
initialState: initialState5,
|
|
1853
1920
|
reducers: {
|
|
1854
1921
|
setOnboardingState: (state, action) => {
|
|
1855
|
-
return
|
|
1922
|
+
return { ...state, ...action.payload };
|
|
1856
1923
|
},
|
|
1857
1924
|
setDemoArtifactPort: (state, action) => {
|
|
1858
1925
|
state.demoArtifactPort = action.payload;
|
|
@@ -1890,21 +1957,23 @@ var initialState6 = {
|
|
|
1890
1957
|
brand: ""
|
|
1891
1958
|
},
|
|
1892
1959
|
intentId: null,
|
|
1960
|
+
tenantList: {
|
|
1961
|
+
...TENANT_LIST_DEFAULT,
|
|
1962
|
+
total: 0,
|
|
1963
|
+
tenants: [],
|
|
1964
|
+
selectedTenant: null,
|
|
1965
|
+
sort: {
|
|
1966
|
+
direction: SORTING_OPTIONS.desc,
|
|
1967
|
+
key: "name"
|
|
1968
|
+
}
|
|
1969
|
+
},
|
|
1893
1970
|
organization: {
|
|
1894
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
1895
|
-
total: 0,
|
|
1896
|
-
tenants: [],
|
|
1897
|
-
selectedTenant: null,
|
|
1898
|
-
sort: {
|
|
1899
|
-
direction: SORTING_OPTIONS.desc,
|
|
1900
|
-
key: "name"
|
|
1901
|
-
}
|
|
1902
|
-
})
|
|
1903
1971
|
// id, name, status, tenant_token, plan
|
|
1904
1972
|
},
|
|
1905
1973
|
auditlog: {
|
|
1906
1974
|
events: [],
|
|
1907
|
-
selectionState:
|
|
1975
|
+
selectionState: {
|
|
1976
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1908
1977
|
detail: void 0,
|
|
1909
1978
|
endDate: void 0,
|
|
1910
1979
|
selectedIssue: void 0,
|
|
@@ -1913,7 +1982,7 @@ var initialState6 = {
|
|
|
1913
1982
|
total: 0,
|
|
1914
1983
|
type: void 0,
|
|
1915
1984
|
user: void 0
|
|
1916
|
-
}
|
|
1985
|
+
}
|
|
1917
1986
|
},
|
|
1918
1987
|
externalDeviceIntegrations: [
|
|
1919
1988
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -1936,7 +2005,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1936
2005
|
state.auditlog.selectionState.total = total;
|
|
1937
2006
|
},
|
|
1938
2007
|
setAuditLogState: (state, action) => {
|
|
1939
|
-
state.auditlog.selectionState =
|
|
2008
|
+
state.auditlog.selectionState = {
|
|
2009
|
+
...state.auditlog.selectionState,
|
|
2010
|
+
...action.payload
|
|
2011
|
+
};
|
|
1940
2012
|
},
|
|
1941
2013
|
receiveCurrentCard: (state, action) => {
|
|
1942
2014
|
state.card = action.payload;
|
|
@@ -1945,12 +2017,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1945
2017
|
state.intentId = action.payload;
|
|
1946
2018
|
},
|
|
1947
2019
|
setOrganization: (state, action) => {
|
|
1948
|
-
state.organization =
|
|
1949
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
1950
|
-
});
|
|
2020
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
1951
2021
|
},
|
|
1952
2022
|
setTenantListState: (state, action) => {
|
|
1953
|
-
state.
|
|
2023
|
+
state.tenantList = action.payload;
|
|
1954
2024
|
},
|
|
1955
2025
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
1956
2026
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2010,7 +2080,8 @@ var initialState7 = {
|
|
|
2010
2080
|
}
|
|
2011
2081
|
*/
|
|
2012
2082
|
},
|
|
2013
|
-
releasesList:
|
|
2083
|
+
releasesList: {
|
|
2084
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2014
2085
|
searchedIds: [],
|
|
2015
2086
|
releaseIds: [],
|
|
2016
2087
|
selection: [],
|
|
@@ -2024,7 +2095,7 @@ var initialState7 = {
|
|
|
2024
2095
|
selectedTags: [],
|
|
2025
2096
|
total: 0,
|
|
2026
2097
|
type: ""
|
|
2027
|
-
}
|
|
2098
|
+
},
|
|
2028
2099
|
tags: [],
|
|
2029
2100
|
updateTypes: [],
|
|
2030
2101
|
/*
|
|
@@ -2050,8 +2121,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2050
2121
|
state.updateTypes = action.payload;
|
|
2051
2122
|
},
|
|
2052
2123
|
removeRelease: (state, action) => {
|
|
2053
|
-
|
|
2054
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2124
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2055
2125
|
state.byId = byId;
|
|
2056
2126
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2057
2127
|
},
|
|
@@ -2084,8 +2154,12 @@ var initialState8 = {
|
|
|
2084
2154
|
previousPhases: [],
|
|
2085
2155
|
retries: 0
|
|
2086
2156
|
},
|
|
2087
|
-
permissionSetsById:
|
|
2088
|
-
|
|
2157
|
+
permissionSetsById: {
|
|
2158
|
+
...defaultPermissionSets
|
|
2159
|
+
},
|
|
2160
|
+
rolesById: {
|
|
2161
|
+
...rolesById
|
|
2162
|
+
},
|
|
2089
2163
|
settingsInitialized: false,
|
|
2090
2164
|
showConnectDeviceDialog: false,
|
|
2091
2165
|
showFeedbackDialog: false,
|
|
@@ -2125,13 +2199,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2125
2199
|
state.byId[0] = action.payload;
|
|
2126
2200
|
},
|
|
2127
2201
|
removedUser: (state, action) => {
|
|
2128
|
-
|
|
2129
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2202
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2130
2203
|
state.byId = byId;
|
|
2131
2204
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2132
2205
|
},
|
|
2133
2206
|
updatedUser: (state, action) => {
|
|
2134
|
-
state.byId[action.payload.id] =
|
|
2207
|
+
state.byId[action.payload.id] = {
|
|
2208
|
+
...state.byId[action.payload.id],
|
|
2209
|
+
...action.payload
|
|
2210
|
+
};
|
|
2135
2211
|
},
|
|
2136
2212
|
receivedPermissionSets: (state, action) => {
|
|
2137
2213
|
state.permissionSetsById = action.payload;
|
|
@@ -2140,11 +2216,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2140
2216
|
state.rolesById = action.payload;
|
|
2141
2217
|
},
|
|
2142
2218
|
createdRole: (state, action) => {
|
|
2143
|
-
state.rolesById[action.payload.name] =
|
|
2219
|
+
state.rolesById[action.payload.name] = {
|
|
2220
|
+
...state.rolesById[action.payload.name],
|
|
2221
|
+
...action.payload
|
|
2222
|
+
};
|
|
2144
2223
|
},
|
|
2145
2224
|
removedRole: (state, action) => {
|
|
2146
|
-
|
|
2147
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2225
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2148
2226
|
state.rolesById = rolesById2;
|
|
2149
2227
|
},
|
|
2150
2228
|
setCustomColumns: (state, action) => {
|
|
@@ -2152,18 +2230,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2152
2230
|
},
|
|
2153
2231
|
setGlobalSettings: (state, action) => {
|
|
2154
2232
|
state.settingsInitialized = true;
|
|
2155
|
-
state.globalSettings =
|
|
2233
|
+
state.globalSettings = {
|
|
2234
|
+
...state.globalSettings,
|
|
2235
|
+
...action.payload
|
|
2236
|
+
};
|
|
2156
2237
|
},
|
|
2157
2238
|
setUserSettings: (state, action) => {
|
|
2158
2239
|
state.userSettingsInitialized = true;
|
|
2159
|
-
state.userSettings =
|
|
2240
|
+
state.userSettings = {
|
|
2241
|
+
...state.userSettings,
|
|
2242
|
+
...action.payload
|
|
2243
|
+
};
|
|
2160
2244
|
},
|
|
2161
2245
|
setTooltipState: (state, action) => {
|
|
2162
2246
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2163
2247
|
state.tooltips.byId[id].readState = readState;
|
|
2164
2248
|
},
|
|
2165
2249
|
setTooltipsState: (state, action) => {
|
|
2166
|
-
state.tooltips.byId =
|
|
2250
|
+
state.tooltips.byId = {
|
|
2251
|
+
...state.tooltips.byId,
|
|
2252
|
+
...action.payload
|
|
2253
|
+
};
|
|
2167
2254
|
},
|
|
2168
2255
|
setShowFeedbackDialog: (state, action) => {
|
|
2169
2256
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2180,7 +2267,16 @@ var actions8 = usersSlice.actions;
|
|
|
2180
2267
|
var usersSlice_default = usersSlice.reducer;
|
|
2181
2268
|
|
|
2182
2269
|
// src/actions.ts
|
|
2183
|
-
var actions_default =
|
|
2270
|
+
var actions_default = {
|
|
2271
|
+
...actions,
|
|
2272
|
+
...actions2,
|
|
2273
|
+
...actions3,
|
|
2274
|
+
...actions4,
|
|
2275
|
+
...actions5,
|
|
2276
|
+
...actions6,
|
|
2277
|
+
...actions7,
|
|
2278
|
+
...actions8
|
|
2279
|
+
};
|
|
2184
2280
|
|
|
2185
2281
|
// src/auth.ts
|
|
2186
2282
|
var import_universal_cookie = __toESM(require("universal-cookie"));
|
|
@@ -2188,18 +2284,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2188
2284
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2189
2285
|
var tokenCache = "";
|
|
2190
2286
|
var getSessionInfo = () => {
|
|
2191
|
-
|
|
2192
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2287
|
+
let sessionInfo = { ...emptySession };
|
|
2193
2288
|
try {
|
|
2194
|
-
sessionInfo = JSON.parse(
|
|
2195
|
-
} catch
|
|
2289
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2290
|
+
} catch {
|
|
2196
2291
|
}
|
|
2197
2292
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2198
2293
|
cleanUp();
|
|
2199
|
-
return
|
|
2294
|
+
return { ...emptySession };
|
|
2200
2295
|
}
|
|
2201
2296
|
if (!sessionInfo.token) {
|
|
2202
|
-
let jwtTokenFromCookie =
|
|
2297
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2203
2298
|
if (jwtTokenFromCookie) {
|
|
2204
2299
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2205
2300
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2239,10 +2334,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2239
2334
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2240
2335
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2241
2336
|
[getFullVersionInformation, getFeatures],
|
|
2242
|
-
(
|
|
2243
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2244
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2245
|
-
}
|
|
2337
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2246
2338
|
);
|
|
2247
2339
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2248
2340
|
|
|
@@ -2259,8 +2351,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2259
2351
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2260
2352
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2261
2353
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2262
|
-
|
|
2263
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2354
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2264
2355
|
return selection.reduce((accu, id) => {
|
|
2265
2356
|
if (deploymentsById[id]) {
|
|
2266
2357
|
accu.push(deploymentsById[id]);
|
|
@@ -2304,7 +2395,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2304
2395
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2305
2396
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2306
2397
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2307
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2398
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2399
|
+
...filteringAttributes,
|
|
2308
2400
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2309
2401
|
}));
|
|
2310
2402
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2332,10 +2424,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2332
2424
|
return accu;
|
|
2333
2425
|
}, {})
|
|
2334
2426
|
);
|
|
2335
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2336
|
-
var _a;
|
|
2337
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2338
|
-
});
|
|
2427
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2339
2428
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2340
2429
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2341
2430
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2352,17 +2441,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2352
2441
|
[getAcceptedDevices, getDeviceLimit],
|
|
2353
2442
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2354
2443
|
);
|
|
2355
|
-
var
|
|
2356
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2357
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2358
|
-
return groups;
|
|
2359
|
-
});
|
|
2444
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2360
2445
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2361
2446
|
const groupNames = Object.keys(groupsById).sort();
|
|
2362
2447
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2363
2448
|
(accu, [groupname, group]) => {
|
|
2364
2449
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2365
|
-
const groupItem =
|
|
2450
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2366
2451
|
if (group.filters.length > 0) {
|
|
2367
2452
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2368
2453
|
accu.dynamic.push(groupItem);
|
|
@@ -2376,7 +2461,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2376
2461
|
},
|
|
2377
2462
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2378
2463
|
);
|
|
2379
|
-
return
|
|
2464
|
+
return { groupNames, ...groupedGroups };
|
|
2380
2465
|
});
|
|
2381
2466
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2382
2467
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2411,15 +2496,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
2411
2496
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
2412
2497
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
2413
2498
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
2414
|
-
var getTenantsList = (state) => state.organization.
|
|
2499
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
2415
2500
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
2416
2501
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2417
2502
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2418
2503
|
[getExternalIntegrations],
|
|
2419
|
-
(integrations) => integrations.filter((integration) =>
|
|
2420
|
-
var _a;
|
|
2421
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2422
|
-
})
|
|
2504
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2423
2505
|
);
|
|
2424
2506
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2425
2507
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2453,15 +2535,12 @@ var filterProcessors = {
|
|
|
2453
2535
|
var filterAliases = {
|
|
2454
2536
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2455
2537
|
};
|
|
2456
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2463
|
-
};
|
|
2464
|
-
});
|
|
2538
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2539
|
+
scope: filter.scope,
|
|
2540
|
+
attribute: filter.key,
|
|
2541
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2542
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2543
|
+
}));
|
|
2465
2544
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2466
2545
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2467
2546
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2471,14 +2550,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2471
2550
|
});
|
|
2472
2551
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2473
2552
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2474
|
-
return
|
|
2553
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2475
2554
|
}
|
|
2476
2555
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2477
2556
|
});
|
|
2478
2557
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2479
|
-
var _a;
|
|
2480
2558
|
let applicableFilters = [...filters];
|
|
2481
|
-
if (typeof group === "string" && !(
|
|
2559
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2482
2560
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2483
2561
|
}
|
|
2484
2562
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2499,12 +2577,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2499
2577
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2500
2578
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2501
2579
|
if (id && byId[id]) {
|
|
2502
|
-
accu.push(
|
|
2580
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2503
2581
|
}
|
|
2504
2582
|
return accu;
|
|
2505
2583
|
}, []);
|
|
2506
2584
|
};
|
|
2507
|
-
var mergePermissions = (existingPermissions =
|
|
2585
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2508
2586
|
(accu, [key, value]) => {
|
|
2509
2587
|
let values;
|
|
2510
2588
|
if (!accu[key]) {
|
|
@@ -2514,12 +2592,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2514
2592
|
if (Array.isArray(value)) {
|
|
2515
2593
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2516
2594
|
} else {
|
|
2517
|
-
values = mergePermissions(accu[key],
|
|
2595
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2518
2596
|
}
|
|
2519
2597
|
accu[key] = values;
|
|
2520
2598
|
return accu;
|
|
2521
2599
|
},
|
|
2522
|
-
|
|
2600
|
+
{ ...addedPermissions }
|
|
2523
2601
|
);
|
|
2524
2602
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2525
2603
|
(accu, roleId) => {
|
|
@@ -2528,20 +2606,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2528
2606
|
}
|
|
2529
2607
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2530
2608
|
},
|
|
2531
|
-
|
|
2609
|
+
{ ...emptyUiPermissions }
|
|
2532
2610
|
);
|
|
2533
2611
|
var progress = ({ loaded, total }) => {
|
|
2534
2612
|
let uploadProgress4 = loaded / total * 100;
|
|
2535
2613
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2536
2614
|
};
|
|
2537
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2538
|
-
var _a, _b2, _c, _d, _e;
|
|
2539
|
-
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;
|
|
2540
|
-
};
|
|
2615
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2541
2616
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2542
2617
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2543
2618
|
try {
|
|
2544
|
-
if (
|
|
2619
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2545
2620
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2546
2621
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2547
2622
|
}
|
|
@@ -2575,9 +2650,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2575
2650
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2576
2651
|
return accu;
|
|
2577
2652
|
}
|
|
2578
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2653
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2654
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2579
2655
|
[attribute.name]: attribute.value
|
|
2580
|
-
}
|
|
2656
|
+
};
|
|
2581
2657
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2582
2658
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2583
2659
|
}
|
|
@@ -2596,15 +2672,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2596
2672
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2597
2673
|
var getReleaseMappingDefaults = () => ({});
|
|
2598
2674
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2599
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2675
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2600
2676
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2601
2677
|
[getReleaseListState, getReleasesById],
|
|
2602
2678
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2603
2679
|
);
|
|
2604
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2605
|
-
var _a;
|
|
2606
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2607
|
-
});
|
|
2680
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2608
2681
|
|
|
2609
2682
|
// src/usersSlice/selectors.ts
|
|
2610
2683
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2613,10 +2686,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2613
2686
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2614
2687
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2615
2688
|
var getUsersById = (state) => state.users.byId;
|
|
2616
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2617
|
-
var _a;
|
|
2618
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2619
|
-
});
|
|
2689
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2620
2690
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2621
2691
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2622
2692
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2627,22 +2697,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2627
2697
|
[getTooltipsById, getUserSettings],
|
|
2628
2698
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2629
2699
|
(accu, [id, value]) => {
|
|
2630
|
-
accu[id] =
|
|
2700
|
+
accu[id] = { ...accu[id], ...value };
|
|
2631
2701
|
return accu;
|
|
2632
2702
|
},
|
|
2633
|
-
|
|
2703
|
+
{ ...tooltips }
|
|
2634
2704
|
)
|
|
2635
2705
|
);
|
|
2636
2706
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2637
2707
|
[getCurrentUser],
|
|
2638
2708
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2639
2709
|
);
|
|
2640
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2710
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2641
2711
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2642
|
-
interval:
|
|
2643
|
-
intervalUnit:
|
|
2712
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2713
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2644
2714
|
}));
|
|
2645
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2715
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2646
2716
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2647
2717
|
|
|
2648
2718
|
// src/commonSelectors.ts
|
|
@@ -2661,8 +2731,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2661
2731
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2662
2732
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2663
2733
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2664
|
-
|
|
2665
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2734
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2666
2735
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2667
2736
|
return { isAdmin, uiPermissions };
|
|
2668
2737
|
}
|
|
@@ -2731,10 +2800,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2731
2800
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2732
2801
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2733
2802
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2734
|
-
const updateAttribute =
|
|
2803
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2735
2804
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2736
2805
|
const attributes = [
|
|
2737
|
-
...previousFilters.map((item) =>
|
|
2806
|
+
...previousFilters.map((item) => ({
|
|
2807
|
+
...item,
|
|
2738
2808
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2739
2809
|
category: "recently used",
|
|
2740
2810
|
priority: 0
|
|
@@ -2752,14 +2822,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2752
2822
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2753
2823
|
}
|
|
2754
2824
|
);
|
|
2755
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
});
|
|
2825
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2826
|
+
...remainder,
|
|
2827
|
+
...onboarding,
|
|
2828
|
+
complete: onboarding.complete || complete,
|
|
2829
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2830
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2831
|
+
}));
|
|
2763
2832
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2764
2833
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2765
2834
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2780,12 +2849,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2780
2849
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2781
2850
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2782
2851
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2783
|
-
|
|
2784
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2852
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2785
2853
|
const { devices = {} } = deployment;
|
|
2786
2854
|
return {
|
|
2787
2855
|
deployment,
|
|
2788
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2856
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2789
2857
|
};
|
|
2790
2858
|
}
|
|
2791
2859
|
);
|
|
@@ -2800,8 +2868,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2800
2868
|
}, {})
|
|
2801
2869
|
);
|
|
2802
2870
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2803
|
-
|
|
2804
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2871
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2805
2872
|
if (staticOnly) {
|
|
2806
2873
|
return Object.keys(uiPermissions.groups).sort();
|
|
2807
2874
|
}
|
|
@@ -2835,16 +2902,31 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2835
2902
|
if (auditlogEvent) {
|
|
2836
2903
|
const { object = {} } = auditlogEvent;
|
|
2837
2904
|
const { device = {}, id, type } = object;
|
|
2838
|
-
auditlogDevice = type === "device" ?
|
|
2905
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2906
|
+
}
|
|
2907
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2908
|
+
});
|
|
2909
|
+
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2910
|
+
if (service_provider) {
|
|
2911
|
+
return roles.reduce((accu, role) => {
|
|
2912
|
+
if (rolesById[role.id]) {
|
|
2913
|
+
return accu;
|
|
2914
|
+
}
|
|
2915
|
+
accu.push(role);
|
|
2916
|
+
return accu;
|
|
2917
|
+
}, Object.values(serviceProviderRolesById));
|
|
2839
2918
|
}
|
|
2840
|
-
return
|
|
2919
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2920
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2921
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2922
|
+
return accu;
|
|
2923
|
+
}, roles);
|
|
2841
2924
|
});
|
|
2842
2925
|
|
|
2843
2926
|
// src/api/general-api.ts
|
|
2844
2927
|
var import_axios = __toESM(require("axios"));
|
|
2845
2928
|
var unauthorizedRedirect = (error) => {
|
|
2846
|
-
|
|
2847
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2929
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2848
2930
|
cleanUp();
|
|
2849
2931
|
window.location.replace("/ui/");
|
|
2850
2932
|
}
|
|
@@ -2854,7 +2936,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2854
2936
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2855
2937
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2856
2938
|
authenticatedRequest.interceptors.request.use(
|
|
2857
|
-
(config) =>
|
|
2939
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2858
2940
|
(error) => Promise.reject(error)
|
|
2859
2941
|
);
|
|
2860
2942
|
var Api = {
|
|
@@ -2862,7 +2944,7 @@ var Api = {
|
|
|
2862
2944
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2863
2945
|
patch: authenticatedRequest.patch,
|
|
2864
2946
|
post: authenticatedRequest.post,
|
|
2865
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2947
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2866
2948
|
put: authenticatedRequest.put,
|
|
2867
2949
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2868
2950
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2893,17 +2975,16 @@ var dateFunctionMap = {
|
|
|
2893
2975
|
setDays: "setDate"
|
|
2894
2976
|
};
|
|
2895
2977
|
var setOfflineThreshold = (0, import_toolkit16.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2896
|
-
var _a, _b2;
|
|
2897
2978
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2898
2979
|
const today = /* @__PURE__ */ new Date();
|
|
2899
2980
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2900
|
-
const setter =
|
|
2901
|
-
const getter =
|
|
2981
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
2982
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2902
2983
|
today[setter](today[getter]() - interval);
|
|
2903
2984
|
let value;
|
|
2904
2985
|
try {
|
|
2905
2986
|
value = today.toISOString();
|
|
2906
|
-
} catch
|
|
2987
|
+
} catch {
|
|
2907
2988
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2908
2989
|
}
|
|
2909
2990
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -2944,37 +3025,43 @@ var getLatestReleaseInfo = (0, import_toolkit16.createAsyncThunk)(`${sliceName}/
|
|
|
2944
3025
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
2945
3026
|
return accu;
|
|
2946
3027
|
},
|
|
2947
|
-
{ latestVersions:
|
|
3028
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
2948
3029
|
);
|
|
2949
3030
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
2950
3031
|
return Promise.resolve(
|
|
2951
3032
|
dispatch(
|
|
2952
|
-
actions.setVersionInformation(
|
|
3033
|
+
actions.setVersionInformation({
|
|
3034
|
+
...latestVersions,
|
|
2953
3035
|
backend: info,
|
|
2954
3036
|
GUI: info,
|
|
2955
3037
|
latestRelease: {
|
|
2956
3038
|
releaseDate: latestRelease.release_date,
|
|
2957
3039
|
repos: latestRepos
|
|
2958
3040
|
}
|
|
2959
|
-
})
|
|
3041
|
+
})
|
|
2960
3042
|
)
|
|
2961
3043
|
);
|
|
2962
3044
|
});
|
|
2963
3045
|
});
|
|
2964
3046
|
var setSearchState = (0, import_toolkit16.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
2965
3047
|
const currentState = getSearchState(getState());
|
|
2966
|
-
let nextState =
|
|
2967
|
-
|
|
2968
|
-
|
|
3048
|
+
let nextState = {
|
|
3049
|
+
...currentState,
|
|
3050
|
+
...searchState,
|
|
3051
|
+
sort: {
|
|
3052
|
+
...currentState.sort,
|
|
3053
|
+
...searchState.sort
|
|
3054
|
+
}
|
|
3055
|
+
};
|
|
2969
3056
|
let tasks = [];
|
|
2970
|
-
const
|
|
2971
|
-
const
|
|
3057
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3058
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
2972
3059
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
2973
3060
|
nextState.isSearching = true;
|
|
2974
3061
|
tasks.push(
|
|
2975
3062
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
2976
3063
|
const searchResult = results[results.length - 1];
|
|
2977
|
-
return dispatch(actions.setSearchState(
|
|
3064
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
2978
3065
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
2979
3066
|
);
|
|
2980
3067
|
}
|
|
@@ -3015,8 +3102,9 @@ var sessionReducer = (state, action) => {
|
|
|
3015
3102
|
return rootReducer(state, action);
|
|
3016
3103
|
};
|
|
3017
3104
|
var getConfiguredStore = (options = {}) => {
|
|
3018
|
-
const
|
|
3019
|
-
return (0, import_toolkit17.configureStore)(
|
|
3105
|
+
const { preloadedState = {}, ...config } = options;
|
|
3106
|
+
return (0, import_toolkit17.configureStore)({
|
|
3107
|
+
...config,
|
|
3020
3108
|
preloadedState,
|
|
3021
3109
|
reducer: sessionReducer,
|
|
3022
3110
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -3029,7 +3117,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
3029
3117
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
3030
3118
|
}
|
|
3031
3119
|
})
|
|
3032
|
-
})
|
|
3120
|
+
});
|
|
3033
3121
|
};
|
|
3034
3122
|
var store = getConfiguredStore({
|
|
3035
3123
|
preloadedState: {}
|
|
@@ -3044,13 +3132,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3044
3132
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3045
3133
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3046
3134
|
(accu, item) => {
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3135
|
+
const filter = item.filter ?? {};
|
|
3136
|
+
let deployment = {
|
|
3137
|
+
...deploymentPrototype,
|
|
3138
|
+
...deploymentsById[item.id],
|
|
3139
|
+
...item,
|
|
3140
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3051
3141
|
name: decodeURIComponent(item.name)
|
|
3052
|
-
}
|
|
3053
|
-
deployment =
|
|
3142
|
+
};
|
|
3143
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3054
3144
|
accu.deployments[item.id] = deployment;
|
|
3055
3145
|
accu.deploymentIds.push(item.id);
|
|
3056
3146
|
return accu;
|
|
@@ -3104,11 +3194,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3104
3194
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3105
3195
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3106
3196
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3107
|
-
const deployment =
|
|
3197
|
+
const deployment = {
|
|
3198
|
+
...newDeployment,
|
|
3108
3199
|
id: deploymentId,
|
|
3109
3200
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3110
3201
|
statistics: { status: {} }
|
|
3111
|
-
}
|
|
3202
|
+
};
|
|
3112
3203
|
let tasks = [
|
|
3113
3204
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3114
3205
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3251,14 +3342,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3251
3342
|
({ 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))))
|
|
3252
3343
|
);
|
|
3253
3344
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3254
|
-
const
|
|
3345
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3255
3346
|
const currentState = getState().deployments.selectionState;
|
|
3256
|
-
let nextState =
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3347
|
+
let nextState = {
|
|
3348
|
+
...currentState,
|
|
3349
|
+
...selectionState,
|
|
3350
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3351
|
+
accu[item] = {
|
|
3352
|
+
...currentState[item],
|
|
3353
|
+
...selectionState[item]
|
|
3354
|
+
};
|
|
3355
|
+
return accu;
|
|
3356
|
+
}, {}),
|
|
3357
|
+
general: {
|
|
3358
|
+
...currentState.general,
|
|
3359
|
+
...selectionState.general
|
|
3360
|
+
}
|
|
3361
|
+
};
|
|
3262
3362
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3263
3363
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3264
3364
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3288,15 +3388,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3288
3388
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3289
3389
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3290
3390
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3291
|
-
const config =
|
|
3391
|
+
const config = {
|
|
3392
|
+
...oldConfig,
|
|
3292
3393
|
hasDelta: Boolean(delta.enabled),
|
|
3293
|
-
binaryDelta:
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3394
|
+
binaryDelta: {
|
|
3395
|
+
...oldConfig.binaryDelta,
|
|
3396
|
+
timeout: timeoutConfig,
|
|
3397
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3398
|
+
},
|
|
3399
|
+
binaryDeltaLimits: {
|
|
3400
|
+
...oldConfig.binaryDeltaLimits,
|
|
3401
|
+
timeout: timeoutLimit,
|
|
3402
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3403
|
+
}
|
|
3404
|
+
};
|
|
3300
3405
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3301
3406
|
})
|
|
3302
3407
|
);
|
|
@@ -3306,7 +3411,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3306
3411
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3307
3412
|
return accu;
|
|
3308
3413
|
}
|
|
3309
|
-
accu =
|
|
3414
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3310
3415
|
}
|
|
3311
3416
|
return accu;
|
|
3312
3417
|
}, void 0);
|
|
@@ -3326,9 +3431,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3326
3431
|
}
|
|
3327
3432
|
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(() => {
|
|
3328
3433
|
const oldConfig = getState().deployments.config;
|
|
3329
|
-
const newConfig =
|
|
3330
|
-
|
|
3331
|
-
|
|
3434
|
+
const newConfig = {
|
|
3435
|
+
...oldConfig,
|
|
3436
|
+
binaryDelta: {
|
|
3437
|
+
...oldConfig.binaryDelta,
|
|
3438
|
+
...config
|
|
3439
|
+
}
|
|
3440
|
+
};
|
|
3332
3441
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3333
3442
|
});
|
|
3334
3443
|
});
|
|
@@ -3341,19 +3450,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3341
3450
|
var import_axios2 = require("axios");
|
|
3342
3451
|
var import_pluralize = __toESM(require_pluralize());
|
|
3343
3452
|
|
|
3344
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3345
|
-
var
|
|
3346
|
-
var
|
|
3347
|
-
var poolPtr = rnds8Pool.length;
|
|
3453
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3454
|
+
var getRandomValues;
|
|
3455
|
+
var rnds8 = new Uint8Array(16);
|
|
3348
3456
|
function rng() {
|
|
3349
|
-
if (
|
|
3350
|
-
|
|
3351
|
-
|
|
3457
|
+
if (!getRandomValues) {
|
|
3458
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3459
|
+
if (!getRandomValues) {
|
|
3460
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3461
|
+
}
|
|
3352
3462
|
}
|
|
3353
|
-
return
|
|
3463
|
+
return getRandomValues(rnds8);
|
|
3354
3464
|
}
|
|
3355
3465
|
|
|
3356
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3466
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3357
3467
|
var byteToHex = [];
|
|
3358
3468
|
for (let i = 0; i < 256; ++i) {
|
|
3359
3469
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3362,13 +3472,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3362
3472
|
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]];
|
|
3363
3473
|
}
|
|
3364
3474
|
|
|
3365
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3366
|
-
var
|
|
3475
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3476
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3367
3477
|
var native_default = {
|
|
3368
|
-
randomUUID
|
|
3478
|
+
randomUUID
|
|
3369
3479
|
};
|
|
3370
3480
|
|
|
3371
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3481
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3372
3482
|
function v4(options, buf, offset) {
|
|
3373
3483
|
if (native_default.randomUUID && !buf && !options) {
|
|
3374
3484
|
return native_default.randomUUID();
|
|
@@ -3410,14 +3520,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3410
3520
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3411
3521
|
const state = getGroupsById(getState());
|
|
3412
3522
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3413
|
-
|
|
3414
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3523
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3415
3524
|
accu[id] = group;
|
|
3416
3525
|
}
|
|
3417
3526
|
return accu;
|
|
3418
3527
|
}, {});
|
|
3419
3528
|
const groups = res.data.reduce((accu, group) => {
|
|
3420
|
-
accu[group] =
|
|
3529
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3421
3530
|
return accu;
|
|
3422
3531
|
}, dynamicGroups);
|
|
3423
3532
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3475,7 +3584,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3475
3584
|
() => Promise.resolve(
|
|
3476
3585
|
dispatch(
|
|
3477
3586
|
actions3.addGroup({
|
|
3478
|
-
group:
|
|
3587
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3479
3588
|
groupName: group
|
|
3480
3589
|
})
|
|
3481
3590
|
)
|
|
@@ -3503,20 +3612,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3503
3612
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3504
3613
|
const state = getGroupsById(getState());
|
|
3505
3614
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3506
|
-
|
|
3507
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3615
|
+
if (!(group.id || group.filters?.length)) {
|
|
3508
3616
|
accu[id] = group;
|
|
3509
3617
|
}
|
|
3510
3618
|
return accu;
|
|
3511
3619
|
}, {});
|
|
3512
3620
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3513
|
-
accu[filter.name] =
|
|
3621
|
+
accu[filter.name] = {
|
|
3514
3622
|
deviceIds: [],
|
|
3515
|
-
total: 0
|
|
3516
|
-
|
|
3623
|
+
total: 0,
|
|
3624
|
+
...state[filter.name],
|
|
3517
3625
|
id: filter.id,
|
|
3518
3626
|
filters: mapTermsToFilters(filter.terms)
|
|
3519
|
-
}
|
|
3627
|
+
};
|
|
3520
3628
|
return accu;
|
|
3521
3629
|
}, staticGroups);
|
|
3522
3630
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3556,10 +3664,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3556
3664
|
);
|
|
3557
3665
|
});
|
|
3558
3666
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3559
|
-
var _a;
|
|
3560
3667
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3561
3668
|
const selectedGroup = groupsState.byId[groupName];
|
|
3562
|
-
const groupFilterLength =
|
|
3669
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3563
3670
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3564
3671
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3565
3672
|
};
|
|
@@ -3582,7 +3689,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3582
3689
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3583
3690
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3584
3691
|
(accu, device) => {
|
|
3585
|
-
var _a, _b2, _c;
|
|
3586
3692
|
const stateDevice = getDeviceById(state, device.id);
|
|
3587
3693
|
const {
|
|
3588
3694
|
attributes: storedAttributes = {},
|
|
@@ -3592,29 +3698,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3592
3698
|
group: storedGroup
|
|
3593
3699
|
} = stateDevice;
|
|
3594
3700
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3595
|
-
device.tags =
|
|
3596
|
-
device.group =
|
|
3597
|
-
device.monitor =
|
|
3598
|
-
device.identity_data =
|
|
3701
|
+
device.tags = { ...storedTags, ...tags };
|
|
3702
|
+
device.group = system.group ?? storedGroup;
|
|
3703
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3704
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3599
3705
|
device.status = status ? status : device.status || identity.status;
|
|
3600
|
-
device.check_in_time_rounded =
|
|
3601
|
-
device.check_in_time_exact =
|
|
3706
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3707
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3602
3708
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3603
3709
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3604
3710
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3605
3711
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3606
|
-
device.attributes = device.attributes ?
|
|
3607
|
-
accu.devicesById[device.id] =
|
|
3712
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3713
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3608
3714
|
accu.ids.push(device.id);
|
|
3609
3715
|
return accu;
|
|
3610
3716
|
},
|
|
3611
3717
|
{ ids, devicesById: {} }
|
|
3612
3718
|
);
|
|
3613
3719
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3614
|
-
const
|
|
3720
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3615
3721
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3616
3722
|
return Promise.resolve(
|
|
3617
|
-
dispatch(getDevicesByStatus2(
|
|
3723
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3618
3724
|
).unwrap().then((results) => {
|
|
3619
3725
|
if (!group) {
|
|
3620
3726
|
return Promise.resolve();
|
|
@@ -3628,7 +3734,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3628
3734
|
dispatch(
|
|
3629
3735
|
actions3.addGroup({
|
|
3630
3736
|
group: {
|
|
3631
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3737
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3632
3738
|
total
|
|
3633
3739
|
},
|
|
3634
3740
|
groupName: group
|
|
@@ -3777,27 +3883,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3777
3883
|
);
|
|
3778
3884
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3779
3885
|
`${sliceName3}/setDeviceListState`,
|
|
3780
|
-
(
|
|
3781
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3782
|
-
var _c;
|
|
3886
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3783
3887
|
const currentState = getDeviceListState(getState());
|
|
3784
3888
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3785
|
-
let nextState =
|
|
3889
|
+
let nextState = {
|
|
3890
|
+
...currentState,
|
|
3786
3891
|
setOnly: false,
|
|
3787
|
-
refreshTrigger
|
|
3788
|
-
|
|
3789
|
-
sort:
|
|
3790
|
-
}
|
|
3892
|
+
refreshTrigger,
|
|
3893
|
+
...selectionState,
|
|
3894
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3895
|
+
};
|
|
3791
3896
|
let tasks = [];
|
|
3792
|
-
const
|
|
3793
|
-
const
|
|
3897
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3898
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3794
3899
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3795
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3900
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3796
3901
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3797
3902
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3798
3903
|
nextState.isLoading = true;
|
|
3799
3904
|
tasks.push(
|
|
3800
|
-
dispatch(getDevicesByStatus2(
|
|
3905
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3801
3906
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3802
3907
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3803
3908
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3822,8 +3927,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3822
3927
|
} = options;
|
|
3823
3928
|
const state = getState();
|
|
3824
3929
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3825
|
-
filters: filterSelection
|
|
3826
|
-
group: group
|
|
3930
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3931
|
+
group: group ?? getSelectedGroup(state),
|
|
3827
3932
|
groups: state.devices.groups,
|
|
3828
3933
|
offlineThreshold: state.app.offlineThreshold,
|
|
3829
3934
|
selectedIssues,
|
|
@@ -3884,7 +3989,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3884
3989
|
});
|
|
3885
3990
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3886
3991
|
const state = getState();
|
|
3887
|
-
let options =
|
|
3992
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3888
3993
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3889
3994
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3890
3995
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4019,8 +4124,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4019
4124
|
({ data: auditLogEntries }) => {
|
|
4020
4125
|
const { start, end } = auditLogEntries.reduce(
|
|
4021
4126
|
(accu, item) => {
|
|
4022
|
-
|
|
4023
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4127
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4024
4128
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4025
4129
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4026
4130
|
}
|
|
@@ -4127,8 +4231,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4127
4231
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4128
4232
|
`${sliceName3}/getDeviceConfig`,
|
|
4129
4233
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4130
|
-
|
|
4131
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4234
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4132
4235
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4133
4236
|
}
|
|
4134
4237
|
})
|
|
@@ -4140,15 +4243,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4140
4243
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4141
4244
|
`${sliceName3}/applyDeviceConfig`,
|
|
4142
4245
|
({ 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 }) => {
|
|
4143
|
-
var _a;
|
|
4144
4246
|
const device = getDeviceById(getState(), deviceId);
|
|
4145
4247
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4146
4248
|
let tasks = [
|
|
4147
|
-
dispatch(actions3.receivedDevice(
|
|
4249
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4148
4250
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4149
4251
|
];
|
|
4150
4252
|
if (isDefault && canManageUsers) {
|
|
4151
|
-
const { previous } =
|
|
4253
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4152
4254
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4153
4255
|
}
|
|
4154
4256
|
return Promise.all(tasks);
|
|
@@ -4164,21 +4266,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4164
4266
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4165
4267
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4166
4268
|
{ headers }
|
|
4167
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4269
|
+
).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"))]));
|
|
4168
4270
|
})
|
|
4169
4271
|
)
|
|
4170
4272
|
);
|
|
4171
4273
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4172
4274
|
let providerResult = {};
|
|
4173
4275
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4174
|
-
providerResult =
|
|
4276
|
+
providerResult = { ...data, twinError: "" };
|
|
4175
4277
|
}).catch((err) => {
|
|
4176
4278
|
providerResult = {
|
|
4177
4279
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4178
4280
|
};
|
|
4179
4281
|
}).finally(() => {
|
|
4180
4282
|
const device = getDeviceById(getState(), deviceId);
|
|
4181
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4283
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4182
4284
|
});
|
|
4183
4285
|
});
|
|
4184
4286
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4194,7 +4296,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4194
4296
|
const { twinsByIntegration = {} } = device;
|
|
4195
4297
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4196
4298
|
return Promise.resolve(
|
|
4197
|
-
dispatch(actions3.receivedDevice(
|
|
4299
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4198
4300
|
);
|
|
4199
4301
|
})
|
|
4200
4302
|
);
|
|
@@ -4215,8 +4317,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4215
4317
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4216
4318
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4217
4319
|
const filters = [
|
|
4218
|
-
|
|
4219
|
-
|
|
4320
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4321
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4220
4322
|
];
|
|
4221
4323
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4222
4324
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4228,11 +4330,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4228
4330
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4229
4331
|
const state2 = getState();
|
|
4230
4332
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4231
|
-
const device =
|
|
4333
|
+
const device = {
|
|
4334
|
+
...getDeviceById(state2, id),
|
|
4232
4335
|
systemDeviceIds: ids,
|
|
4233
4336
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4234
|
-
}
|
|
4235
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4337
|
+
};
|
|
4338
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4236
4339
|
});
|
|
4237
4340
|
});
|
|
4238
4341
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4240,9 +4343,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4240
4343
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4241
4344
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4242
4345
|
const filters = [
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4346
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4347
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4348
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4246
4349
|
];
|
|
4247
4350
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4248
4351
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4289,7 +4392,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4289
4392
|
var cutoffLength = 75;
|
|
4290
4393
|
var ellipsis = "...";
|
|
4291
4394
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4292
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4395
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4293
4396
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4294
4397
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4295
4398
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4307,14 +4410,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4307
4410
|
});
|
|
4308
4411
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4309
4412
|
const state = getState();
|
|
4310
|
-
const
|
|
4311
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4413
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4414
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4415
|
+
...remainder,
|
|
4312
4416
|
filters,
|
|
4313
4417
|
group,
|
|
4314
4418
|
offlineThreshold: state.app.offlineThreshold,
|
|
4315
4419
|
selectedIssues: [type],
|
|
4316
4420
|
status
|
|
4317
|
-
})
|
|
4421
|
+
});
|
|
4318
4422
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4319
4423
|
page: 1,
|
|
4320
4424
|
per_page: 1,
|
|
@@ -4366,21 +4470,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4366
4470
|
return steps[progress2];
|
|
4367
4471
|
};
|
|
4368
4472
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4369
|
-
var _a;
|
|
4370
4473
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4371
4474
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4372
4475
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4373
4476
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4374
|
-
let deviceType =
|
|
4477
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4375
4478
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4376
4479
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4377
|
-
return
|
|
4480
|
+
return {
|
|
4481
|
+
...onboardingState,
|
|
4378
4482
|
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)),
|
|
4379
4483
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4380
4484
|
deviceType,
|
|
4381
4485
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4382
4486
|
progress: progress2
|
|
4383
|
-
}
|
|
4487
|
+
};
|
|
4384
4488
|
};
|
|
4385
4489
|
var getOnboardingState2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4386
4490
|
const state = getState();
|
|
@@ -4438,7 +4542,7 @@ var advanceOnboarding = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4438
4542
|
return;
|
|
4439
4543
|
}
|
|
4440
4544
|
const madeProgress = steps[stepIndex + 1];
|
|
4441
|
-
const state =
|
|
4545
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4442
4546
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4443
4547
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4444
4548
|
});
|
|
@@ -4521,8 +4625,8 @@ var completeUpgrade = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4521
4625
|
({ 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())))
|
|
4522
4626
|
);
|
|
4523
4627
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4524
|
-
const userId =
|
|
4525
|
-
const detail =
|
|
4628
|
+
const userId = userFilter?.id || userFilter;
|
|
4629
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4526
4630
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4527
4631
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4528
4632
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4549,12 +4653,14 @@ var getAuditLogsCsvLink = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4549
4653
|
);
|
|
4550
4654
|
var setAuditlogsState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4551
4655
|
const currentState = getAuditlogState(getState());
|
|
4552
|
-
let nextState =
|
|
4553
|
-
|
|
4554
|
-
|
|
4656
|
+
let nextState = {
|
|
4657
|
+
...currentState,
|
|
4658
|
+
...selectionState,
|
|
4659
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4660
|
+
};
|
|
4555
4661
|
let tasks = [];
|
|
4556
|
-
const
|
|
4557
|
-
const
|
|
4662
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4663
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4558
4664
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4559
4665
|
nextState.isLoading = true;
|
|
4560
4666
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4566,27 +4672,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4566
4672
|
var addTenant = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4567
4673
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar4("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
4568
4674
|
});
|
|
4569
|
-
var tenantListRetrieval = (config) =>
|
|
4675
|
+
var tenantListRetrieval = async (config) => {
|
|
4570
4676
|
const { page, perPage } = config;
|
|
4571
4677
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4572
|
-
const tenantList =
|
|
4678
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4573
4679
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4574
|
-
return [tenantList.data, totalCount];
|
|
4575
|
-
}
|
|
4576
|
-
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4680
|
+
return [tenantList.data, Number(totalCount)];
|
|
4681
|
+
};
|
|
4682
|
+
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4577
4683
|
const currentState = getTenantsList(getState());
|
|
4578
|
-
const [tenants, pageCount] =
|
|
4579
|
-
dispatch(actions6.setTenantListState(
|
|
4580
|
-
})
|
|
4581
|
-
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4684
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4685
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4686
|
+
});
|
|
4687
|
+
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4582
4688
|
const currentState = getTenantsList(getState());
|
|
4583
|
-
const nextState =
|
|
4689
|
+
const nextState = {
|
|
4690
|
+
...currentState,
|
|
4691
|
+
...selectionState
|
|
4692
|
+
};
|
|
4584
4693
|
if (!(0, import_helpers10.deepCompare)(currentState, selectionState)) {
|
|
4585
|
-
const [tenants, pageCount] =
|
|
4586
|
-
return dispatch(actions6.setTenantListState(
|
|
4694
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4695
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4587
4696
|
}
|
|
4588
|
-
return dispatch(actions6.setTenantListState(
|
|
4589
|
-
})
|
|
4697
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4698
|
+
});
|
|
4590
4699
|
var editTenantDeviceLimit = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4591
4700
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4592
4701
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4629,10 +4738,7 @@ var downloadLicenseReport = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4629
4738
|
);
|
|
4630
4739
|
var createIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4631
4740
|
`${sliceName6}/createIntegration`,
|
|
4632
|
-
(
|
|
4633
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4634
|
-
return general_api_default.post(`${iotManagerBaseURL}/integrations`, integration).catch((err) => commonErrorHandler(err, "There was an error creating the integration", dispatch, commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar4("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
4635
|
-
}
|
|
4741
|
+
({ id, ...integration }, { dispatch }) => general_api_default.post(`${iotManagerBaseURL}/integrations`, integration).catch((err) => commonErrorHandler(err, "There was an error creating the integration", dispatch, commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar4("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
4636
4742
|
);
|
|
4637
4743
|
var changeIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4638
4744
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4653,9 +4759,8 @@ var getIntegrations = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4653
4759
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4654
4760
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4655
4761
|
const integrations = data.reduce((accu, item) => {
|
|
4656
|
-
|
|
4657
|
-
const
|
|
4658
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4762
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4763
|
+
const integration = { ...existingIntegration, ...item };
|
|
4659
4764
|
accu.push(integration);
|
|
4660
4765
|
return accu;
|
|
4661
4766
|
}, []);
|
|
@@ -4707,7 +4812,7 @@ var getSsoConfigById = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4707
4812
|
`${sliceName6}/getSsoConfigById`,
|
|
4708
4813
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4709
4814
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4710
|
-
return sso ? Promise.resolve(
|
|
4815
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4711
4816
|
})
|
|
4712
4817
|
);
|
|
4713
4818
|
var getSsoConfigs = (0, import_toolkit22.createAsyncThunk)(
|
|
@@ -4726,20 +4831,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4726
4831
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4727
4832
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4728
4833
|
var flattenRelease = (release, stateRelease) => {
|
|
4729
|
-
|
|
4730
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers11.customSort)(1, "modified"))) || [];
|
|
4834
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers11.customSort)(1, "modified")) || [];
|
|
4731
4835
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4732
4836
|
(accu, item) => {
|
|
4733
|
-
var _a2;
|
|
4734
4837
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4735
|
-
const stateArtifact =
|
|
4838
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4736
4839
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4737
|
-
accu.artifacts.push(
|
|
4840
|
+
accu.artifacts.push({
|
|
4841
|
+
...stateArtifact,
|
|
4842
|
+
...item
|
|
4843
|
+
});
|
|
4738
4844
|
return accu;
|
|
4739
4845
|
},
|
|
4740
4846
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4741
4847
|
);
|
|
4742
|
-
return
|
|
4848
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers11.duplicateFilter), modified };
|
|
4743
4849
|
};
|
|
4744
4850
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4745
4851
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4757,17 +4863,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4757
4863
|
{ release: null, index: -1 }
|
|
4758
4864
|
);
|
|
4759
4865
|
var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4760
|
-
var _a;
|
|
4761
4866
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4762
4867
|
if (!release || index === -1) {
|
|
4763
4868
|
return;
|
|
4764
4869
|
}
|
|
4765
4870
|
const releaseArtifacts = [...release.artifacts];
|
|
4766
4871
|
const artifact = releaseArtifacts[index];
|
|
4767
|
-
const { key, name, version } = (
|
|
4872
|
+
const { key, name, version } = (0, import_helpers11.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4768
4873
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4769
4874
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4770
|
-
filters: [
|
|
4875
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4771
4876
|
});
|
|
4772
4877
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4773
4878
|
page: 1,
|
|
@@ -4781,10 +4886,11 @@ var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceNam
|
|
|
4781
4886
|
}
|
|
4782
4887
|
const installCount = Number(headers[headerNames.total]);
|
|
4783
4888
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4784
|
-
releaseArtifacts2[index2] =
|
|
4785
|
-
release2 =
|
|
4889
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4890
|
+
release2 = {
|
|
4891
|
+
...release2,
|
|
4786
4892
|
artifacts: releaseArtifacts2
|
|
4787
|
-
}
|
|
4893
|
+
};
|
|
4788
4894
|
return dispatch(actions7.receiveRelease(release2));
|
|
4789
4895
|
});
|
|
4790
4896
|
});
|
|
@@ -4796,12 +4902,14 @@ var getArtifactUrl = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4796
4902
|
return dispatch(getReleases());
|
|
4797
4903
|
}
|
|
4798
4904
|
const releaseArtifacts = [...release.artifacts];
|
|
4799
|
-
releaseArtifacts[index] =
|
|
4905
|
+
releaseArtifacts[index] = {
|
|
4906
|
+
...releaseArtifacts[index],
|
|
4800
4907
|
url: response.data.uri
|
|
4801
|
-
}
|
|
4802
|
-
release =
|
|
4908
|
+
};
|
|
4909
|
+
release = {
|
|
4910
|
+
...release,
|
|
4803
4911
|
artifacts: releaseArtifacts
|
|
4804
|
-
}
|
|
4912
|
+
};
|
|
4805
4913
|
return dispatch(actions7.receiveRelease(release));
|
|
4806
4914
|
})
|
|
4807
4915
|
);
|
|
@@ -4926,12 +5034,14 @@ var selectRelease = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/select
|
|
|
4926
5034
|
});
|
|
4927
5035
|
var setReleasesListState = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4928
5036
|
const currentState = getState().releases.releasesList;
|
|
4929
|
-
let nextState =
|
|
4930
|
-
|
|
4931
|
-
|
|
5037
|
+
let nextState = {
|
|
5038
|
+
...currentState,
|
|
5039
|
+
...selectionState,
|
|
5040
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5041
|
+
};
|
|
4932
5042
|
let tasks = [];
|
|
4933
|
-
const
|
|
4934
|
-
const
|
|
5043
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
5044
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4935
5045
|
if (!(0, import_helpers11.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4936
5046
|
nextState.isLoading = true;
|
|
4937
5047
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4950,29 +5060,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4950
5060
|
);
|
|
4951
5061
|
};
|
|
4952
5062
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4953
|
-
let releaseListState =
|
|
5063
|
+
let releaseListState = { ...state.releasesList };
|
|
4954
5064
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4955
5065
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers11.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4956
5066
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4957
5067
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4958
5068
|
if (searchOnly) {
|
|
4959
|
-
releaseListState =
|
|
5069
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4960
5070
|
} else {
|
|
4961
|
-
releaseListState =
|
|
5071
|
+
releaseListState = {
|
|
5072
|
+
...releaseListState,
|
|
4962
5073
|
releaseIds,
|
|
4963
5074
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4964
5075
|
total: !isFiltering ? total : state.releasesList.total
|
|
4965
|
-
}
|
|
5076
|
+
};
|
|
4966
5077
|
}
|
|
4967
5078
|
return releaseListState;
|
|
4968
5079
|
};
|
|
4969
5080
|
var getReleases = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4970
|
-
const config =
|
|
5081
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4971
5082
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4972
5083
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4973
5084
|
const state = getState().releases;
|
|
4974
5085
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4975
|
-
const combinedReleases =
|
|
5086
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4976
5087
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4977
5088
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4978
5089
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4993,7 +5104,7 @@ var updateReleaseInfo = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4993
5104
|
`${sliceName7}/updateReleaseInfo`,
|
|
4994
5105
|
({ 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(() => {
|
|
4995
5106
|
return Promise.all([
|
|
4996
|
-
dispatch(actions7.receiveRelease(
|
|
5107
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4997
5108
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4998
5109
|
]);
|
|
4999
5110
|
})
|
|
@@ -5002,7 +5113,7 @@ var setReleaseTags = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5002
5113
|
`${sliceName7}/setReleaseTags`,
|
|
5003
5114
|
({ 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(() => {
|
|
5004
5115
|
return Promise.all([
|
|
5005
|
-
dispatch(actions7.receiveRelease(
|
|
5116
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
5006
5117
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
5007
5118
|
]);
|
|
5008
5119
|
})
|
|
@@ -5019,19 +5130,13 @@ var getUpdateTypes = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5019
5130
|
// src/api/users-api.ts
|
|
5020
5131
|
var import_axios4 = __toESM(require("axios"));
|
|
5021
5132
|
var Api2 = {
|
|
5022
|
-
postLogin: (url,
|
|
5023
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
5024
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
5025
|
-
var _a2;
|
|
5026
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
5027
|
-
});
|
|
5028
|
-
},
|
|
5133
|
+
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"] })),
|
|
5029
5134
|
putVerifyTFA: (url, userData) => {
|
|
5030
5135
|
let body = {};
|
|
5031
5136
|
if (userData.hasOwnProperty("token2fa")) {
|
|
5032
5137
|
body = { token2fa: userData.token2fa };
|
|
5033
5138
|
}
|
|
5034
|
-
return import_axios4.default.put(url, body,
|
|
5139
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
5035
5140
|
}
|
|
5036
5141
|
};
|
|
5037
5142
|
var users_api_default = Api2;
|
|
@@ -5059,43 +5164,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
5059
5164
|
};
|
|
5060
5165
|
var loginUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5061
5166
|
`${sliceName8}/loginUser`,
|
|
5062
|
-
(
|
|
5063
|
-
|
|
5064
|
-
return
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
Promise.
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
window.
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
);
|
|
5097
|
-
});
|
|
5098
|
-
}
|
|
5167
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5168
|
+
cleanUp();
|
|
5169
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5170
|
+
}).then(({ text: response, contentType }) => {
|
|
5171
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5172
|
+
const { id, kind } = response;
|
|
5173
|
+
const type = kind.split("/")[1];
|
|
5174
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5175
|
+
window.location.replace(ssoLoginUrl);
|
|
5176
|
+
return;
|
|
5177
|
+
}
|
|
5178
|
+
const token = response;
|
|
5179
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5180
|
+
return;
|
|
5181
|
+
}
|
|
5182
|
+
let now = /* @__PURE__ */ new Date();
|
|
5183
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5184
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5185
|
+
setSessionInfo({ token, expiresAt });
|
|
5186
|
+
cookies5.remove("JWT", { path: "/" });
|
|
5187
|
+
return (
|
|
5188
|
+
// @ts-ignore
|
|
5189
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5190
|
+
cleanUp();
|
|
5191
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5192
|
+
}).then(() => {
|
|
5193
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5194
|
+
if (window.location.pathname !== "/ui/") {
|
|
5195
|
+
window.location.replace("/ui/");
|
|
5196
|
+
}
|
|
5197
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5198
|
+
})
|
|
5199
|
+
);
|
|
5200
|
+
})
|
|
5099
5201
|
);
|
|
5100
5202
|
var logoutUser = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
5101
5203
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -5112,7 +5214,7 @@ var switchUserOrganization = (0, import_toolkit24.createAsyncThunk)(`${sliceName
|
|
|
5112
5214
|
return Promise.reject();
|
|
5113
5215
|
}
|
|
5114
5216
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5115
|
-
setSessionInfo(
|
|
5217
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5116
5218
|
window.location.reload();
|
|
5117
5219
|
});
|
|
5118
5220
|
});
|
|
@@ -5175,13 +5277,13 @@ var getUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5175
5277
|
);
|
|
5176
5278
|
var initializeSelf = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5177
5279
|
var updateUserColumnSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5178
|
-
const userId = currentUserId
|
|
5280
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5179
5281
|
const storageKey = `${userId}-column-widths`;
|
|
5180
5282
|
let customColumns = [];
|
|
5181
5283
|
if (!columns) {
|
|
5182
5284
|
try {
|
|
5183
5285
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5184
|
-
} catch
|
|
5286
|
+
} catch {
|
|
5185
5287
|
}
|
|
5186
5288
|
} else {
|
|
5187
5289
|
customColumns = columns;
|
|
@@ -5210,10 +5312,7 @@ var userActions = {
|
|
|
5210
5312
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5211
5313
|
var createUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5212
5314
|
`${sliceName8}/createUser`,
|
|
5213
|
-
(
|
|
5214
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5215
|
-
return general_api_default.post(`${useradmApiUrlv1}/users`, __spreadProps(__spreadValues({}, userData), { send_reset_password: shouldResetPassword })).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar6(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch));
|
|
5216
|
-
}
|
|
5315
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar6(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
5217
5316
|
);
|
|
5218
5317
|
var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5219
5318
|
`${sliceName8}/removeUser`,
|
|
@@ -5224,15 +5323,12 @@ var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5224
5323
|
);
|
|
5225
5324
|
var editUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5226
5325
|
`${sliceName8}/editUser`,
|
|
5227
|
-
(
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
()
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
])
|
|
5234
|
-
);
|
|
5235
|
-
}
|
|
5326
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5327
|
+
() => Promise.all([
|
|
5328
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5329
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5330
|
+
])
|
|
5331
|
+
)
|
|
5236
5332
|
);
|
|
5237
5333
|
var addUserToCurrentTenant = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5238
5334
|
const { id } = getOrganization(getState());
|
|
@@ -5267,7 +5363,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5267
5363
|
}
|
|
5268
5364
|
return accu;
|
|
5269
5365
|
},
|
|
5270
|
-
|
|
5366
|
+
{ ...emptyUiPermissions }
|
|
5271
5367
|
);
|
|
5272
5368
|
var permissionActionTypes = {
|
|
5273
5369
|
any: mapHttpPermission,
|
|
@@ -5290,20 +5386,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5290
5386
|
}, existingPermissions);
|
|
5291
5387
|
var tryParseCustomPermission = (permission) => {
|
|
5292
5388
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5293
|
-
const result = mergePermissions(
|
|
5389
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5294
5390
|
return { isCustom: true, permission, result };
|
|
5295
5391
|
};
|
|
5296
5392
|
var customPermissionHandler = (accu, permission) => {
|
|
5297
5393
|
let processor = tryParseCustomPermission(permission);
|
|
5298
|
-
return
|
|
5394
|
+
return {
|
|
5395
|
+
...accu,
|
|
5299
5396
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5300
5397
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5301
|
-
}
|
|
5398
|
+
};
|
|
5302
5399
|
};
|
|
5303
5400
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5304
5401
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5305
5402
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5306
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5403
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5307
5404
|
};
|
|
5308
5405
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5309
5406
|
if (Array.isArray(permissions)) {
|
|
@@ -5318,60 +5415,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5318
5415
|
if (!processor) {
|
|
5319
5416
|
return accu;
|
|
5320
5417
|
}
|
|
5321
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5322
|
-
var _a;
|
|
5323
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5324
|
-
});
|
|
5418
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5325
5419
|
if (scope) {
|
|
5326
5420
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5327
|
-
return
|
|
5421
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5328
5422
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5329
5423
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5330
5424
|
}
|
|
5331
|
-
return
|
|
5425
|
+
return {
|
|
5426
|
+
...accu,
|
|
5332
5427
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5333
5428
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5334
|
-
}
|
|
5429
|
+
};
|
|
5335
5430
|
},
|
|
5336
|
-
{ isCustom: false, uiPermissions:
|
|
5431
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5337
5432
|
);
|
|
5338
5433
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5339
5434
|
};
|
|
5340
5435
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5341
5436
|
(accu, role) => {
|
|
5342
|
-
var _a;
|
|
5343
5437
|
let normalizedPermissions;
|
|
5344
5438
|
let isCustom = false;
|
|
5345
5439
|
if (rolesById2[role.name]) {
|
|
5346
|
-
normalizedPermissions =
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5440
|
+
normalizedPermissions = {
|
|
5441
|
+
...rolesById2[role.name].uiPermissions,
|
|
5442
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5443
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5444
|
+
};
|
|
5350
5445
|
} else {
|
|
5351
5446
|
const result = parseRolePermissions(role, permissionSets);
|
|
5352
5447
|
normalizedPermissions = result.uiPermissions;
|
|
5353
5448
|
isCustom = result.isCustom;
|
|
5354
5449
|
}
|
|
5355
|
-
const roleState =
|
|
5356
|
-
accu[role.name] =
|
|
5450
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5451
|
+
accu[role.name] = {
|
|
5452
|
+
...roleState,
|
|
5453
|
+
...role,
|
|
5357
5454
|
description: roleState.description ? roleState.description : role.description,
|
|
5358
5455
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5359
5456
|
isCustom,
|
|
5360
5457
|
name: roleState.name ? roleState.name : role.name,
|
|
5361
5458
|
uiPermissions: normalizedPermissions
|
|
5362
|
-
}
|
|
5459
|
+
};
|
|
5363
5460
|
return accu;
|
|
5364
5461
|
},
|
|
5365
|
-
|
|
5462
|
+
{ ...rolesById2 }
|
|
5366
5463
|
);
|
|
5367
5464
|
var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
5368
5465
|
`${sliceName8}/getPermissionSets`,
|
|
5369
5466
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5370
5467
|
const permissionSets = data.reduce(
|
|
5371
5468
|
(accu, permissionSet) => {
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5469
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5470
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5375
5471
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5376
5472
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5377
5473
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5382,11 +5478,10 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5382
5478
|
}
|
|
5383
5479
|
return collector;
|
|
5384
5480
|
}, accu2),
|
|
5385
|
-
|
|
5481
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5386
5482
|
);
|
|
5387
5483
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5388
|
-
|
|
5389
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5484
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5390
5485
|
accu2.push(key);
|
|
5391
5486
|
}
|
|
5392
5487
|
return accu2;
|
|
@@ -5399,7 +5494,7 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5399
5494
|
return accu;
|
|
5400
5495
|
},
|
|
5401
5496
|
// @ts-ignore
|
|
5402
|
-
|
|
5497
|
+
{ ...getState().users.permissionSetsById }
|
|
5403
5498
|
);
|
|
5404
5499
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5405
5500
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5432,28 +5527,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5432
5527
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5433
5528
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5434
5529
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5435
|
-
|
|
5436
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5530
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5437
5531
|
type: uiPermissionsByArea[area].scope,
|
|
5438
5532
|
value: []
|
|
5439
5533
|
};
|
|
5440
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5534
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5535
|
+
...permissionSetState,
|
|
5441
5536
|
value: [...permissionSetState.value, item]
|
|
5442
|
-
}
|
|
5537
|
+
};
|
|
5443
5538
|
return itemPermissionAccu;
|
|
5444
5539
|
}, accu);
|
|
5445
5540
|
return accu;
|
|
5446
5541
|
}, {});
|
|
5447
|
-
return Object.entries(permissionSetObject).map((
|
|
5448
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5542
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5449
5543
|
if (value.includes(excessiveAccessSelector)) {
|
|
5450
5544
|
return { name };
|
|
5451
5545
|
}
|
|
5452
|
-
return { name, scope:
|
|
5546
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers12.duplicateFilter) } };
|
|
5453
5547
|
});
|
|
5454
5548
|
};
|
|
5455
5549
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5456
|
-
const role =
|
|
5550
|
+
const role = { ...roleState, ...roleData };
|
|
5457
5551
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5458
5552
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5459
5553
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5489,12 +5583,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5489
5583
|
}, []);
|
|
5490
5584
|
return {
|
|
5491
5585
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5492
|
-
role:
|
|
5586
|
+
role: {
|
|
5587
|
+
...emptyRole,
|
|
5493
5588
|
name,
|
|
5494
5589
|
// @ts-ignore
|
|
5495
5590
|
description: description ? description : roleState.description,
|
|
5496
|
-
uiPermissions:
|
|
5497
|
-
|
|
5591
|
+
uiPermissions: {
|
|
5592
|
+
...emptyUiPermissions,
|
|
5593
|
+
...roleUiPermissions,
|
|
5594
|
+
...maybeUiPermissions
|
|
5595
|
+
}
|
|
5596
|
+
}
|
|
5498
5597
|
};
|
|
5499
5598
|
};
|
|
5500
5599
|
var roleActions = {
|
|
@@ -5545,13 +5644,12 @@ var getGlobalSettings2 = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5545
5644
|
var saveGlobalSettings = (0, import_toolkit24.createAsyncThunk)(
|
|
5546
5645
|
`${sliceName8}/saveGlobalSettings`,
|
|
5547
5646
|
// @ts-ignore
|
|
5548
|
-
(
|
|
5549
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5647
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5550
5648
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5551
5649
|
return;
|
|
5552
5650
|
}
|
|
5553
5651
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5554
|
-
let updatedSettings =
|
|
5652
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5555
5653
|
if (getCurrentUser(getState()).verified) {
|
|
5556
5654
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5557
5655
|
} else {
|
|
@@ -5589,10 +5687,17 @@ var saveUserSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5589
5687
|
const userSettings = getUserSettings(getState());
|
|
5590
5688
|
const onboardingState = getOnboardingState(getState());
|
|
5591
5689
|
const tooltipState = getTooltipsState(getState());
|
|
5592
|
-
const updatedSettings =
|
|
5593
|
-
|
|
5690
|
+
const updatedSettings = {
|
|
5691
|
+
...userSettings,
|
|
5692
|
+
// @ts-ignore
|
|
5693
|
+
...settings,
|
|
5694
|
+
onboarding: {
|
|
5695
|
+
...onboardingState,
|
|
5696
|
+
// @ts-ignore
|
|
5697
|
+
...settings.onboarding
|
|
5698
|
+
},
|
|
5594
5699
|
tooltips: tooltipState
|
|
5595
|
-
}
|
|
5700
|
+
};
|
|
5596
5701
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5597
5702
|
return Promise.all([
|
|
5598
5703
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5618,9 +5723,10 @@ var getTokens = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5618
5723
|
`${sliceName8}/getTokens`,
|
|
5619
5724
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5620
5725
|
const user = getCurrentUser(getState());
|
|
5621
|
-
const updatedUser =
|
|
5726
|
+
const updatedUser = {
|
|
5727
|
+
...user,
|
|
5622
5728
|
tokens
|
|
5623
|
-
}
|
|
5729
|
+
};
|
|
5624
5730
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5625
5731
|
})
|
|
5626
5732
|
);
|
|
@@ -5636,8 +5742,7 @@ var revokeToken = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5636
5742
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5637
5743
|
)
|
|
5638
5744
|
);
|
|
5639
|
-
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5640
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5745
|
+
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5641
5746
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5642
5747
|
if (persist) {
|
|
5643
5748
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5645,14 +5750,13 @@ var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/
|
|
|
5645
5750
|
return Promise.all(tasks);
|
|
5646
5751
|
});
|
|
5647
5752
|
var setAllTooltipsReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5648
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5753
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5649
5754
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5650
5755
|
});
|
|
5651
5756
|
var submitFeedback = (0, import_toolkit24.createAsyncThunk)(
|
|
5652
5757
|
`${sliceName8}/submitFeedback`,
|
|
5653
5758
|
// @ts-ignore
|
|
5654
|
-
(
|
|
5655
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5759
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5656
5760
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5657
5761
|
subject: "feedback submission",
|
|
5658
5762
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5681,9 +5785,8 @@ var featureFlags = [
|
|
|
5681
5785
|
];
|
|
5682
5786
|
var environmentDatas = ["feedbackProbability", "hostAddress", "hostedAnnouncement", "recaptchaSiteKey", "stripeAPIKey", "trackerCode"];
|
|
5683
5787
|
var parseEnvironmentInfo = () => (dispatch, getState) => {
|
|
5684
|
-
var _a;
|
|
5685
5788
|
const state = getState();
|
|
5686
|
-
let onboardingComplete = state.onboarding.complete || !!JSON.parse(
|
|
5789
|
+
let onboardingComplete = state.onboarding.complete || !!JSON.parse(window.localStorage.getItem("onboardingComplete") ?? "false");
|
|
5687
5790
|
let demoArtifactPort = 85;
|
|
5688
5791
|
let environmentData = {};
|
|
5689
5792
|
let environmentFeatures = {};
|
|
@@ -5702,11 +5805,12 @@ var parseEnvironmentInfo = () => (dispatch, getState) => {
|
|
|
5702
5805
|
} = mender_environment;
|
|
5703
5806
|
onboardingComplete = stringToBoolean(features.isEnterprise) || stringToBoolean(disableOnboarding) || onboardingComplete;
|
|
5704
5807
|
demoArtifactPort = port || demoArtifactPort;
|
|
5705
|
-
environmentData = environmentDatas.reduce((accu, flag) =>
|
|
5706
|
-
environmentFeatures =
|
|
5808
|
+
environmentData = environmentDatas.reduce((accu, flag) => ({ ...accu, [flag]: mender_environment[flag] || state.app[flag] }), {});
|
|
5809
|
+
environmentFeatures = {
|
|
5810
|
+
...featureFlags.reduce((accu, flag) => ({ ...accu, [flag]: stringToBoolean(features[flag]) }), {}),
|
|
5707
5811
|
isHosted: features.isHosted || window.location.hostname.includes("hosted.mender.io"),
|
|
5708
5812
|
isDemoMode: stringToBoolean(isDemoMode || features.isDemoMode)
|
|
5709
|
-
}
|
|
5813
|
+
};
|
|
5710
5814
|
versionInfo = {
|
|
5711
5815
|
docs: isNaN(integrationVersion.charAt(0)) ? "" : integrationVersion.split(".").slice(0, 2).join("."),
|
|
5712
5816
|
remainder: {
|
|
@@ -5742,6 +5846,7 @@ var maybeAddOnboardingTasks = ({ devicesByStatus, dispatch, onboardingState, tas
|
|
|
5742
5846
|
};
|
|
5743
5847
|
var useAppInit = (userId) => {
|
|
5744
5848
|
const dispatch = (0, import_react_redux.useDispatch)();
|
|
5849
|
+
const [coreInitDone, setCoreInitDone] = (0, import_react3.useState)(false);
|
|
5745
5850
|
const isEnterprise = (0, import_react_redux.useSelector)(getIsEnterprise);
|
|
5746
5851
|
const { hasMultitenancy, isHosted } = (0, import_react_redux.useSelector)(getFeatures);
|
|
5747
5852
|
const devicesByStatus = (0, import_react_redux.useSelector)(getDevicesByStatus);
|
|
@@ -5751,12 +5856,27 @@ var useAppInit = (userId) => {
|
|
|
5751
5856
|
const { interval, intervalUnit } = (0, import_react_redux.useSelector)(getOfflineThresholdSettings);
|
|
5752
5857
|
const { id_attribute } = (0, import_react_redux.useSelector)(getGlobalSettings);
|
|
5753
5858
|
const { identityAttributes } = (0, import_react_redux.useSelector)(getSortedFilteringAttributes);
|
|
5754
|
-
const
|
|
5755
|
-
const
|
|
5859
|
+
const isServiceProvider = (0, import_react_redux.useSelector)(getIsServiceProvider);
|
|
5860
|
+
const coreInitRunning = (0, import_react3.useRef)(false);
|
|
5861
|
+
const fullInitRunning = (0, import_react3.useRef)(false);
|
|
5862
|
+
const retrieveCoreData = (0, import_react3.useCallback)(() => {
|
|
5756
5863
|
let tasks = [
|
|
5757
5864
|
dispatch(parseEnvironmentInfo()),
|
|
5758
5865
|
dispatch(getUserSettings2()),
|
|
5759
5866
|
dispatch(getGlobalSettings2()),
|
|
5867
|
+
dispatch(setFirstLoginAfterSignup2(stringToBoolean(cookies6.get("firstLoginAfterSignup"))))
|
|
5868
|
+
];
|
|
5869
|
+
const multitenancy = hasMultitenancy || isHosted || isEnterprise;
|
|
5870
|
+
if (multitenancy) {
|
|
5871
|
+
tasks.push(dispatch(getUserOrganization()));
|
|
5872
|
+
}
|
|
5873
|
+
return Promise.all(tasks);
|
|
5874
|
+
}, [dispatch, hasMultitenancy, isHosted, isEnterprise]);
|
|
5875
|
+
const retrieveAppData = (0, import_react3.useCallback)(() => {
|
|
5876
|
+
if (isServiceProvider) {
|
|
5877
|
+
return Promise.resolve(dispatch(getRoles()));
|
|
5878
|
+
}
|
|
5879
|
+
return Promise.all([
|
|
5760
5880
|
dispatch(getDeviceAttributes()),
|
|
5761
5881
|
dispatch(getDeploymentsByStatus2({ status: DEPLOYMENT_STATES.finished, shouldSelect: false })),
|
|
5762
5882
|
dispatch(getDeploymentsByStatus2({ status: DEPLOYMENT_STATES.inprogress })),
|
|
@@ -5769,15 +5889,9 @@ var useAppInit = (userId) => {
|
|
|
5769
5889
|
dispatch(getIntegrations()),
|
|
5770
5890
|
dispatch(getReleases()),
|
|
5771
5891
|
dispatch(getDeviceLimit2()),
|
|
5772
|
-
dispatch(getRoles())
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
const multitenancy = hasMultitenancy || isHosted || isEnterprise;
|
|
5776
|
-
if (multitenancy) {
|
|
5777
|
-
tasks.push(dispatch(getUserOrganization()));
|
|
5778
|
-
}
|
|
5779
|
-
return Promise.all(tasks);
|
|
5780
|
-
}, [dispatch, hasMultitenancy, isHosted, isEnterprise]);
|
|
5892
|
+
dispatch(getRoles())
|
|
5893
|
+
]);
|
|
5894
|
+
}, [dispatch, isServiceProvider]);
|
|
5781
5895
|
const interpretAppData = (0, import_react3.useCallback)(() => {
|
|
5782
5896
|
let settings = {};
|
|
5783
5897
|
if (cookies6.get("_ga") && typeof hasTrackingEnabled === "undefined") {
|
|
@@ -5829,16 +5943,19 @@ var useAppInit = (userId) => {
|
|
|
5829
5943
|
[dispatch, retrieveAppData, interpretAppData]
|
|
5830
5944
|
);
|
|
5831
5945
|
(0, import_react3.useEffect)(() => {
|
|
5832
|
-
if (!userId ||
|
|
5946
|
+
if (!userId || coreInitRunning.current) {
|
|
5833
5947
|
return;
|
|
5834
5948
|
}
|
|
5835
|
-
|
|
5949
|
+
coreInitRunning.current = true;
|
|
5950
|
+
retrieveCoreData().then(() => setCoreInitDone(true));
|
|
5951
|
+
}, [userId, retrieveCoreData]);
|
|
5952
|
+
(0, import_react3.useEffect)(() => {
|
|
5953
|
+
if (fullInitRunning.current || !coreInitDone) {
|
|
5954
|
+
return;
|
|
5955
|
+
}
|
|
5956
|
+
fullInitRunning.current = true;
|
|
5836
5957
|
initializeAppData();
|
|
5837
|
-
}, [
|
|
5958
|
+
}, [initializeAppData, coreInitDone]);
|
|
5959
|
+
return { coreInitDone };
|
|
5838
5960
|
};
|
|
5839
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5840
|
-
0 && (module.exports = {
|
|
5841
|
-
parseEnvironmentInfo,
|
|
5842
|
-
useAppInit
|
|
5843
|
-
});
|
|
5844
5961
|
//# sourceMappingURL=storehooks.js.map
|