@northern.tech/store 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +251 -135
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +102 -51
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +104 -66
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +111 -64
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +649 -552
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +99 -51
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-F37LUTBX.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-F37LUTBX.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-7E7KJHY3.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-7E7KJHY3.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-R2GBNXLV.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-R2GBNXLV.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-ZIYGEXSJ.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-ZIYGEXSJ.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-HRWZJQMH.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-HRWZJQMH.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-DZBVTSIX.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-DZBVTSIX.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-YNVSU3AA.mjs → chunk-DIZJVB6M.mjs} +307 -292
- package/dist/chunk-DIZJVB6M.mjs.map +1 -0
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-IPPIKGIB.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-ZNST5R6O.mjs → chunk-IFWKT27G.mjs} +92 -29
- package/dist/chunk-IFWKT27G.mjs.map +1 -0
- package/dist/{chunk-6667TCAJ.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-6667TCAJ.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-HVHZG2H4.mjs → chunk-K2NZL5V4.mjs} +4 -7
- package/dist/chunk-K2NZL5V4.mjs.map +1 -0
- package/dist/{chunk-RQOE5OOT.mjs → chunk-KJAZNKV2.mjs} +66 -55
- package/dist/chunk-KJAZNKV2.mjs.map +1 -0
- package/dist/{chunk-G32LAKW4.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-G32LAKW4.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-BJSH2G7W.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-BJSH2G7W.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-XYVPYFSM.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-XYVPYFSM.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-N7G6QK2E.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-G3I53JGW.mjs → chunk-QQBUNZHA.mjs} +3 -6
- package/dist/{chunk-G3I53JGW.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-TD45YTYK.mjs → chunk-R7LXL3KJ.mjs} +22 -23
- package/dist/chunk-R7LXL3KJ.mjs.map +1 -0
- package/dist/{chunk-G7LATUT6.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-G7LATUT6.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-IVSYYXTC.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-O6O3D52B.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-O6O3D52B.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-BRHSKNFC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-BRHSKNFC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-RH6ONMG7.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-RH6ONMG7.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-HXPYJ6QN.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-HXPYJ6QN.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.d.mts +18 -19
- package/dist/commonConstants.d.ts +18 -19
- package/dist/commonConstants.js +2 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.d.mts +42 -1
- package/dist/commonSelectors.d.ts +42 -1
- package/dist/commonSelectors.js +149 -129
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +14 -12
- package/dist/constants.d.mts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +92 -147
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +18 -14
- package/dist/deploymentsSlice/constants.js +94 -55
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +128 -75
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +95 -48
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +649 -561
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +94 -54
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +131 -77
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +100 -85
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +649 -597
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +94 -41
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +101 -48
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +333 -238
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +649 -555
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.d.mts +6 -1
- package/dist/organizationSlice/constants.d.ts +6 -1
- package/dist/organizationSlice/constants.js +89 -51
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +6 -4
- package/dist/organizationSlice/index.d.mts +224 -246
- package/dist/organizationSlice/index.d.ts +224 -246
- package/dist/organizationSlice/index.js +113 -59
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +96 -58
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +649 -580
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +98 -60
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +97 -53
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +377 -287
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.d.mts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +150 -202
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +45 -43
- package/dist/store.d.mts +235 -135
- package/dist/store.d.ts +235 -135
- package/dist/store.js +262 -157
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.d.mts +3 -1
- package/dist/storehooks.d.ts +3 -1
- package/dist/storehooks.js +686 -569
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +71 -54
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +649 -710
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.d.mts +192 -17
- package/dist/usersSlice/constants.d.ts +192 -17
- package/dist/usersSlice/constants.js +97 -61
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +6 -4
- package/dist/usersSlice/index.d.mts +1628 -704
- package/dist/usersSlice/index.d.ts +1628 -704
- package/dist/usersSlice/index.js +122 -67
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +101 -62
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +649 -584
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.d.mts +6 -5
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +117 -89
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-HVHZG2H4.mjs.map +0 -1
- package/dist/chunk-IPPIKGIB.mjs +0 -35
- package/dist/chunk-IVSYYXTC.mjs +0 -36
- package/dist/chunk-N7G6QK2E.mjs.map +0 -1
- package/dist/chunk-RQOE5OOT.mjs.map +0 -1
- package/dist/chunk-TD45YTYK.mjs.map +0 -1
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-YNVSU3AA.mjs.map +0 -1
- package/dist/chunk-ZNST5R6O.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -496,7 +446,7 @@ var chartTypes = {
|
|
|
496
446
|
};
|
|
497
447
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
498
448
|
var defaultReportType = "distribution";
|
|
499
|
-
var defaultReports = [
|
|
449
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
500
450
|
var locations = {};
|
|
501
451
|
var PLANS = {
|
|
502
452
|
os: {
|
|
@@ -822,13 +772,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
822
772
|
deployments: [],
|
|
823
773
|
groups: Object.freeze({}),
|
|
824
774
|
releases: Object.freeze({}),
|
|
775
|
+
tenantManagement: [],
|
|
825
776
|
userManagement: []
|
|
826
777
|
});
|
|
827
778
|
var emptyRole = Object.freeze({
|
|
828
779
|
name: void 0,
|
|
829
780
|
description: "",
|
|
830
781
|
permissions: [],
|
|
831
|
-
uiPermissions: Object.freeze(
|
|
782
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
832
783
|
});
|
|
833
784
|
|
|
834
785
|
// src/deploymentsSlice/constants.ts
|
|
@@ -857,11 +808,12 @@ var deploymentStatesToSubstates = {
|
|
|
857
808
|
pending: [deploymentSubstates.pending],
|
|
858
809
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
859
810
|
};
|
|
860
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
811
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
812
|
+
...deploymentStatesToSubstates,
|
|
861
813
|
failures: [deploymentSubstates.failure],
|
|
862
814
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
863
815
|
successes: [deploymentSubstates.success]
|
|
864
|
-
}
|
|
816
|
+
};
|
|
865
817
|
var installationSubstatesMap = {
|
|
866
818
|
download: {
|
|
867
819
|
title: "download",
|
|
@@ -906,8 +858,8 @@ var DEPLOYMENT_STATES = {
|
|
|
906
858
|
var listDefaultsByState = {
|
|
907
859
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
908
860
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
909
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
910
|
-
[DEPLOYMENT_STATES.finished]:
|
|
861
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
862
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
911
863
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
912
864
|
};
|
|
913
865
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1069,6 +1021,13 @@ var SSO_TYPES = {
|
|
|
1069
1021
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1070
1022
|
}
|
|
1071
1023
|
};
|
|
1024
|
+
var AUDIT_LOGS_TYPES = [
|
|
1025
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
1026
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
1027
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
1028
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1029
|
+
];
|
|
1030
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1072
1031
|
var emptyWebhook = {
|
|
1073
1032
|
description: "",
|
|
1074
1033
|
enabled: true,
|
|
@@ -1117,10 +1076,12 @@ var permissionSetIds = {
|
|
|
1117
1076
|
DeployToDevices: "DeployToDevices",
|
|
1118
1077
|
ManageDevices: "ManageDevices",
|
|
1119
1078
|
ManageReleases: "ManageReleases",
|
|
1079
|
+
ManageTenants: "ManageTenants",
|
|
1120
1080
|
ManageUsers: "ManageUsers",
|
|
1121
1081
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1122
1082
|
ReadDevices: "ReadDevices",
|
|
1123
1083
|
ReadReleases: "ReadReleases",
|
|
1084
|
+
ReadTenants: "ReadTenants",
|
|
1124
1085
|
ReadUsers: "ReadUsers",
|
|
1125
1086
|
SuperUser: "SuperUser",
|
|
1126
1087
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1159,6 +1120,7 @@ var uiPermissionsById = {
|
|
|
1159
1120
|
permissionSets: {
|
|
1160
1121
|
groups: permissionSetIds.ManageDevices,
|
|
1161
1122
|
releases: permissionSetIds.ManageReleases,
|
|
1123
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1162
1124
|
userManagement: permissionSetIds.ManageUsers
|
|
1163
1125
|
},
|
|
1164
1126
|
title: "Manage",
|
|
@@ -1172,6 +1134,7 @@ var uiPermissionsById = {
|
|
|
1172
1134
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1173
1135
|
groups: permissionSetIds.ReadDevices,
|
|
1174
1136
|
releases: permissionSetIds.ReadReleases,
|
|
1137
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1175
1138
|
userManagement: permissionSetIds.ReadUsers
|
|
1176
1139
|
},
|
|
1177
1140
|
title: "Read",
|
|
@@ -1196,6 +1159,7 @@ var uiPermissionsByArea = {
|
|
|
1196
1159
|
auditlog: {
|
|
1197
1160
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1198
1161
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1162
|
+
key: "auditlog",
|
|
1199
1163
|
uiPermissions: [uiPermissionsById.read],
|
|
1200
1164
|
title: "System audit log"
|
|
1201
1165
|
},
|
|
@@ -1206,6 +1170,7 @@ var uiPermissionsByArea = {
|
|
|
1206
1170
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1207
1171
|
],
|
|
1208
1172
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1173
|
+
key: "deployments",
|
|
1209
1174
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1210
1175
|
title: "Deployments"
|
|
1211
1176
|
},
|
|
@@ -1221,6 +1186,7 @@ var uiPermissionsByArea = {
|
|
|
1221
1186
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1222
1187
|
],
|
|
1223
1188
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1189
|
+
key: "groups",
|
|
1224
1190
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1225
1191
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1226
1192
|
title: "Group Management"
|
|
@@ -1240,22 +1206,35 @@ var uiPermissionsByArea = {
|
|
|
1240
1206
|
}
|
|
1241
1207
|
],
|
|
1242
1208
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1209
|
+
key: "releases",
|
|
1243
1210
|
scope: "ReleaseTags",
|
|
1244
1211
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1245
1212
|
title: "Release Management"
|
|
1246
1213
|
},
|
|
1214
|
+
tenantManagement: {
|
|
1215
|
+
endpoints: [
|
|
1216
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1217
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1218
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1219
|
+
],
|
|
1220
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1221
|
+
key: "tenantManagement",
|
|
1222
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1223
|
+
title: "Tenant Management"
|
|
1224
|
+
},
|
|
1247
1225
|
userManagement: {
|
|
1248
1226
|
endpoints: [
|
|
1249
1227
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1250
1228
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1251
1229
|
],
|
|
1252
1230
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1231
|
+
key: "userManagement",
|
|
1253
1232
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1254
1233
|
title: "User Management"
|
|
1255
1234
|
}
|
|
1256
1235
|
};
|
|
1257
1236
|
var permissionMapper = (permission) => permission.value;
|
|
1258
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1237
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1259
1238
|
var rolesById = Object.freeze({
|
|
1260
1239
|
[staticRolesByName.admin]: {
|
|
1261
1240
|
name: "Admin",
|
|
@@ -1263,56 +1242,87 @@ var rolesById = Object.freeze({
|
|
|
1263
1242
|
description: "Full access",
|
|
1264
1243
|
permissions: [],
|
|
1265
1244
|
// permissions refers to the values returned from the backend
|
|
1266
|
-
uiPermissions:
|
|
1245
|
+
uiPermissions: {
|
|
1246
|
+
...emptyUiPermissions,
|
|
1267
1247
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1268
1248
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1269
1249
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1270
1250
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1271
1251
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1272
|
-
}
|
|
1252
|
+
}
|
|
1273
1253
|
},
|
|
1274
1254
|
[staticRolesByName.readOnly]: {
|
|
1275
1255
|
name: "Read Access",
|
|
1276
1256
|
value: staticRolesByName.readOnly,
|
|
1277
1257
|
description: "",
|
|
1278
1258
|
permissions: [],
|
|
1279
|
-
uiPermissions:
|
|
1259
|
+
uiPermissions: {
|
|
1260
|
+
...emptyUiPermissions,
|
|
1280
1261
|
deployments: [uiPermissionsById.read.value],
|
|
1281
1262
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1282
1263
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1283
1264
|
userManagement: [uiPermissionsById.read.value]
|
|
1284
|
-
}
|
|
1265
|
+
}
|
|
1285
1266
|
},
|
|
1286
1267
|
[staticRolesByName.ci]: {
|
|
1287
1268
|
name: "Releases Manager",
|
|
1288
1269
|
value: staticRolesByName.ci,
|
|
1289
1270
|
description: "",
|
|
1290
1271
|
permissions: [],
|
|
1291
|
-
uiPermissions:
|
|
1272
|
+
uiPermissions: {
|
|
1273
|
+
...emptyUiPermissions,
|
|
1292
1274
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1293
|
-
}
|
|
1275
|
+
}
|
|
1294
1276
|
},
|
|
1295
1277
|
[staticRolesByName.deploymentsManager]: {
|
|
1296
1278
|
name: "Deployments Manager",
|
|
1297
1279
|
value: staticRolesByName.deploymentsManager,
|
|
1298
1280
|
description: "",
|
|
1299
1281
|
permissions: [],
|
|
1300
|
-
uiPermissions:
|
|
1282
|
+
uiPermissions: {
|
|
1283
|
+
...emptyUiPermissions,
|
|
1301
1284
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1302
1285
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1303
1286
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1304
|
-
}
|
|
1287
|
+
}
|
|
1305
1288
|
},
|
|
1306
1289
|
[staticRolesByName.terminalAccess]: {
|
|
1307
1290
|
name: "Troubleshooting",
|
|
1308
1291
|
value: staticRolesByName.terminalAccess,
|
|
1309
1292
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1310
1293
|
permissions: [],
|
|
1311
|
-
uiPermissions:
|
|
1294
|
+
uiPermissions: {
|
|
1295
|
+
...emptyUiPermissions,
|
|
1312
1296
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1313
|
-
}
|
|
1297
|
+
}
|
|
1314
1298
|
}
|
|
1315
1299
|
});
|
|
1300
|
+
var serviceProviderRolesById = {
|
|
1301
|
+
admin: {
|
|
1302
|
+
name: "Admin",
|
|
1303
|
+
value: staticRolesByName.admin,
|
|
1304
|
+
description: "Full access",
|
|
1305
|
+
permissions: [],
|
|
1306
|
+
uiPermissions: {
|
|
1307
|
+
...emptyUiPermissions,
|
|
1308
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1309
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1310
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
readOnly: {
|
|
1314
|
+
name: "Read access",
|
|
1315
|
+
value: staticRolesByName.admin,
|
|
1316
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1317
|
+
permissions: [],
|
|
1318
|
+
uiPermissions: {
|
|
1319
|
+
...emptyUiPermissions,
|
|
1320
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1321
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1322
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1316
1326
|
var defaultPermissionSets = {
|
|
1317
1327
|
[permissionSetIds.Basic]: {
|
|
1318
1328
|
name: permissionSetIds.Basic,
|
|
@@ -1323,7 +1333,9 @@ var defaultPermissionSets = {
|
|
|
1323
1333
|
},
|
|
1324
1334
|
[permissionSetIds.SuperUser]: {
|
|
1325
1335
|
name: permissionSetIds.SuperUser,
|
|
1326
|
-
result:
|
|
1336
|
+
result: {
|
|
1337
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1338
|
+
}
|
|
1327
1339
|
},
|
|
1328
1340
|
[permissionSetIds.ManageUsers]: {
|
|
1329
1341
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1343,6 +1355,18 @@ var defaultPermissionSets = {
|
|
|
1343
1355
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1344
1356
|
}
|
|
1345
1357
|
},
|
|
1358
|
+
[permissionSetIds.ReadTenants]: {
|
|
1359
|
+
name: permissionSetIds.ReadTenants,
|
|
1360
|
+
result: {
|
|
1361
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1362
|
+
}
|
|
1363
|
+
},
|
|
1364
|
+
[permissionSetIds.ManageTenants]: {
|
|
1365
|
+
name: permissionSetIds.ManageTenants,
|
|
1366
|
+
result: {
|
|
1367
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1346
1370
|
[permissionSetIds.ReadUsers]: {
|
|
1347
1371
|
name: permissionSetIds.ReadUsers,
|
|
1348
1372
|
result: {
|
|
@@ -1396,11 +1420,12 @@ var defaultPermissionSets = {
|
|
|
1396
1420
|
};
|
|
1397
1421
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1398
1422
|
var OWN_USER_ID = "me";
|
|
1399
|
-
var rolesByName =
|
|
1423
|
+
var rolesByName = {
|
|
1424
|
+
...staticRolesByName,
|
|
1400
1425
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1401
1426
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1402
1427
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1403
|
-
}
|
|
1428
|
+
};
|
|
1404
1429
|
var twoFAStates = {
|
|
1405
1430
|
enabled: "enabled",
|
|
1406
1431
|
disabled: "disabled",
|
|
@@ -1488,7 +1513,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1488
1513
|
initialState,
|
|
1489
1514
|
reducers: {
|
|
1490
1515
|
setFeatures: (state, action) => {
|
|
1491
|
-
state.features =
|
|
1516
|
+
state.features = {
|
|
1517
|
+
...state.features,
|
|
1518
|
+
...action.payload
|
|
1519
|
+
};
|
|
1492
1520
|
},
|
|
1493
1521
|
setSnackbar: (state, { payload }) => {
|
|
1494
1522
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1513,7 +1541,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1513
1541
|
state.hostedAnnouncement = action.payload;
|
|
1514
1542
|
},
|
|
1515
1543
|
setSearchState: (state, action) => {
|
|
1516
|
-
state.searchState =
|
|
1544
|
+
state.searchState = {
|
|
1545
|
+
...state.searchState,
|
|
1546
|
+
...action.payload
|
|
1547
|
+
};
|
|
1517
1548
|
},
|
|
1518
1549
|
setOfflineThreshold: (state, action) => {
|
|
1519
1550
|
state.offlineThreshold = action.payload;
|
|
@@ -1524,20 +1555,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1524
1555
|
},
|
|
1525
1556
|
uploadProgress: (state, action) => {
|
|
1526
1557
|
const { id, progress: progress2 } = action.payload;
|
|
1527
|
-
state.uploadsById[id] =
|
|
1558
|
+
state.uploadsById[id] = {
|
|
1559
|
+
...state.uploadsById[id],
|
|
1528
1560
|
progress: progress2
|
|
1529
|
-
}
|
|
1561
|
+
};
|
|
1530
1562
|
},
|
|
1531
1563
|
cleanUpUpload: (state, action) => {
|
|
1532
|
-
|
|
1533
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1564
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1534
1565
|
state.uploadsById = remainder;
|
|
1535
1566
|
},
|
|
1536
1567
|
setVersionInformation: (state, action) => {
|
|
1537
|
-
state.versionInformation =
|
|
1568
|
+
state.versionInformation = {
|
|
1569
|
+
...state.versionInformation,
|
|
1570
|
+
...action.payload
|
|
1571
|
+
};
|
|
1538
1572
|
},
|
|
1539
1573
|
setEnvironmentData: (state, action) => {
|
|
1540
|
-
return
|
|
1574
|
+
return { ...state, ...action.payload };
|
|
1541
1575
|
}
|
|
1542
1576
|
}
|
|
1543
1577
|
});
|
|
@@ -1569,7 +1603,7 @@ var initialState2 = {
|
|
|
1569
1603
|
sourceWindow: -1
|
|
1570
1604
|
},
|
|
1571
1605
|
binaryDeltaLimits: {
|
|
1572
|
-
timeout:
|
|
1606
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1573
1607
|
sourceWindow: limitDefault,
|
|
1574
1608
|
inputWindow: limitDefault,
|
|
1575
1609
|
duplicatesWindow: limitDefault,
|
|
@@ -1579,10 +1613,10 @@ var initialState2 = {
|
|
|
1579
1613
|
deploymentDeviceLimit: 5e3,
|
|
1580
1614
|
selectedDeviceIds: [],
|
|
1581
1615
|
selectionState: {
|
|
1582
|
-
finished:
|
|
1583
|
-
inprogress:
|
|
1584
|
-
pending:
|
|
1585
|
-
scheduled:
|
|
1616
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1617
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1618
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1619
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1586
1620
|
general: {
|
|
1587
1621
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1588
1622
|
showCreationDialog: false,
|
|
@@ -1598,40 +1632,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1598
1632
|
initialState: initialState2,
|
|
1599
1633
|
reducers: {
|
|
1600
1634
|
createdDeployment: (state, action) => {
|
|
1601
|
-
state.byId[action.payload.id] =
|
|
1635
|
+
state.byId[action.payload.id] = {
|
|
1636
|
+
...deploymentPrototype,
|
|
1637
|
+
...action.payload
|
|
1638
|
+
};
|
|
1602
1639
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1603
1640
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1604
1641
|
state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection], state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1;
|
|
1605
1642
|
},
|
|
1606
1643
|
removedDeployment: (state, action) => {
|
|
1607
|
-
|
|
1608
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1644
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1609
1645
|
state.byId = remainder;
|
|
1610
1646
|
},
|
|
1611
1647
|
receivedDeployment: (state, action) => {
|
|
1612
|
-
state.byId[action.payload.id] =
|
|
1648
|
+
state.byId[action.payload.id] = {
|
|
1649
|
+
...state.byId[action.payload.id] || {},
|
|
1650
|
+
...action.payload
|
|
1651
|
+
};
|
|
1613
1652
|
},
|
|
1614
1653
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1615
1654
|
const { id, deviceId, log } = action.payload;
|
|
1616
|
-
const deployment =
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1655
|
+
const deployment = {
|
|
1656
|
+
...deploymentPrototype,
|
|
1657
|
+
...state.byId[id]
|
|
1658
|
+
};
|
|
1659
|
+
state.byId[id] = {
|
|
1660
|
+
...deployment,
|
|
1661
|
+
devices: {
|
|
1662
|
+
...deployment.devices,
|
|
1663
|
+
[deviceId]: {
|
|
1664
|
+
...deployment.devices[deviceId],
|
|
1620
1665
|
log
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
};
|
|
1624
1669
|
},
|
|
1625
1670
|
receivedDeploymentDevices: (state, action) => {
|
|
1626
1671
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1627
|
-
state.byId[id] =
|
|
1672
|
+
state.byId[id] = {
|
|
1673
|
+
...state.byId[id],
|
|
1628
1674
|
devices,
|
|
1629
1675
|
totalDeviceCount
|
|
1630
|
-
}
|
|
1676
|
+
};
|
|
1631
1677
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1632
1678
|
},
|
|
1633
1679
|
receivedDeployments: (state, action) => {
|
|
1634
|
-
state.byId =
|
|
1680
|
+
state.byId = {
|
|
1681
|
+
...state.byId,
|
|
1682
|
+
...action.payload
|
|
1683
|
+
};
|
|
1635
1684
|
},
|
|
1636
1685
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1637
1686
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1673,9 +1722,9 @@ var initialState3 = {
|
|
|
1673
1722
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1674
1723
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1675
1724
|
},
|
|
1676
|
-
deviceList:
|
|
1677
|
-
deviceIds: []
|
|
1678
|
-
|
|
1725
|
+
deviceList: {
|
|
1726
|
+
deviceIds: [],
|
|
1727
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1679
1728
|
selectedAttributes: [],
|
|
1680
1729
|
selectedIssues: [],
|
|
1681
1730
|
selection: [],
|
|
@@ -1686,7 +1735,7 @@ var initialState3 = {
|
|
|
1686
1735
|
},
|
|
1687
1736
|
state: DEVICE_STATES.accepted,
|
|
1688
1737
|
total: 0
|
|
1689
|
-
}
|
|
1738
|
+
},
|
|
1690
1739
|
filters: [
|
|
1691
1740
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1692
1741
|
],
|
|
@@ -1721,49 +1770,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1721
1770
|
},
|
|
1722
1771
|
addToGroup: (state, action) => {
|
|
1723
1772
|
const { group, deviceIds } = action.payload;
|
|
1724
|
-
const maybeExistingGroup =
|
|
1773
|
+
const maybeExistingGroup = {
|
|
1725
1774
|
filters: [],
|
|
1726
|
-
deviceIds: []
|
|
1727
|
-
|
|
1728
|
-
|
|
1775
|
+
deviceIds: [],
|
|
1776
|
+
...state.groups.byId[group]
|
|
1777
|
+
};
|
|
1778
|
+
state.groups.byId[group] = {
|
|
1779
|
+
...maybeExistingGroup,
|
|
1729
1780
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1730
1781
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1731
|
-
}
|
|
1782
|
+
};
|
|
1732
1783
|
},
|
|
1733
1784
|
removeFromGroup: (state, action) => {
|
|
1734
1785
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1735
|
-
const
|
|
1736
|
-
const changedGroup =
|
|
1786
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1787
|
+
const changedGroup = {
|
|
1788
|
+
...maybeExistingGroup,
|
|
1737
1789
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1738
1790
|
total: Math.max(total - removedIds.length, 0)
|
|
1739
|
-
}
|
|
1791
|
+
};
|
|
1740
1792
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1741
1793
|
state.groups.byId[group] = changedGroup;
|
|
1742
1794
|
return;
|
|
1743
1795
|
} else if (state.groups.selectedGroup === group) {
|
|
1744
1796
|
state.groups.selectedGroup = void 0;
|
|
1745
1797
|
}
|
|
1746
|
-
const
|
|
1798
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1747
1799
|
state.groups.byId = remainingById;
|
|
1748
1800
|
},
|
|
1749
1801
|
addGroup: (state, action) => {
|
|
1750
1802
|
const { groupName, group } = action.payload;
|
|
1751
|
-
state.groups.byId[groupName] =
|
|
1803
|
+
state.groups.byId[groupName] = {
|
|
1804
|
+
...state.groups.byId[groupName],
|
|
1805
|
+
...group
|
|
1806
|
+
};
|
|
1752
1807
|
},
|
|
1753
1808
|
selectGroup: (state, { payload: group }) => {
|
|
1754
1809
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1755
1810
|
state.groups.selectedGroup = group;
|
|
1756
1811
|
},
|
|
1757
1812
|
removeGroup: (state, action) => {
|
|
1758
|
-
|
|
1759
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1813
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1760
1814
|
state.groups.byId = remainingById;
|
|
1761
1815
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1762
1816
|
},
|
|
1763
1817
|
setDeviceListState: (state, action) => {
|
|
1764
|
-
state.deviceList =
|
|
1765
|
-
|
|
1766
|
-
|
|
1818
|
+
state.deviceList = {
|
|
1819
|
+
...state.deviceList,
|
|
1820
|
+
...action.payload,
|
|
1821
|
+
sort: {
|
|
1822
|
+
...state.deviceList.sort,
|
|
1823
|
+
...action.payload.sort
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1767
1826
|
},
|
|
1768
1827
|
setFilterAttributes: (state, action) => {
|
|
1769
1828
|
state.filteringAttributes = action.payload;
|
|
@@ -1772,7 +1831,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1772
1831
|
state.filteringAttributesConfig = action.payload;
|
|
1773
1832
|
},
|
|
1774
1833
|
receivedDevices: (state, action) => {
|
|
1775
|
-
state.byId =
|
|
1834
|
+
state.byId = {
|
|
1835
|
+
...state.byId,
|
|
1836
|
+
...action.payload
|
|
1837
|
+
};
|
|
1776
1838
|
},
|
|
1777
1839
|
setDeviceFilters: (state, action) => {
|
|
1778
1840
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1803,7 +1865,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1803
1865
|
state.limit = action.payload;
|
|
1804
1866
|
},
|
|
1805
1867
|
receivedDevice: (state, action) => {
|
|
1806
|
-
state.byId[action.payload.id] =
|
|
1868
|
+
state.byId[action.payload.id] = {
|
|
1869
|
+
...state.byId[action.payload.id],
|
|
1870
|
+
...action.payload
|
|
1871
|
+
};
|
|
1807
1872
|
},
|
|
1808
1873
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1809
1874
|
const { deviceId, authId } = action.payload;
|
|
@@ -1824,15 +1889,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1824
1889
|
var sliceName4 = "monitor";
|
|
1825
1890
|
var initialState4 = {
|
|
1826
1891
|
alerts: {
|
|
1827
|
-
alertList:
|
|
1892
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1828
1893
|
byDeviceId: {}
|
|
1829
1894
|
},
|
|
1830
1895
|
issueCounts: {
|
|
1831
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1896
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1832
1897
|
},
|
|
1833
1898
|
settings: {
|
|
1834
1899
|
global: {
|
|
1835
|
-
channels:
|
|
1900
|
+
channels: {
|
|
1901
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1902
|
+
}
|
|
1836
1903
|
}
|
|
1837
1904
|
}
|
|
1838
1905
|
};
|
|
@@ -1850,14 +1917,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1850
1917
|
},
|
|
1851
1918
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1852
1919
|
const { deviceId, alerts } = action.payload;
|
|
1853
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1920
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1854
1921
|
},
|
|
1855
1922
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1856
1923
|
const { issueType, counts } = action.payload;
|
|
1857
1924
|
state.issueCounts.byType[issueType] = counts;
|
|
1858
1925
|
},
|
|
1859
1926
|
setAlertListState: (state, action) => {
|
|
1860
|
-
state.alerts.alertList =
|
|
1927
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1861
1928
|
}
|
|
1862
1929
|
}
|
|
1863
1930
|
});
|
|
@@ -1881,7 +1948,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1881
1948
|
initialState: initialState5,
|
|
1882
1949
|
reducers: {
|
|
1883
1950
|
setOnboardingState: (state, action) => {
|
|
1884
|
-
return
|
|
1951
|
+
return { ...state, ...action.payload };
|
|
1885
1952
|
},
|
|
1886
1953
|
setDemoArtifactPort: (state, action) => {
|
|
1887
1954
|
state.demoArtifactPort = action.payload;
|
|
@@ -1919,21 +1986,23 @@ var initialState6 = {
|
|
|
1919
1986
|
brand: ""
|
|
1920
1987
|
},
|
|
1921
1988
|
intentId: null,
|
|
1989
|
+
tenantList: {
|
|
1990
|
+
...TENANT_LIST_DEFAULT,
|
|
1991
|
+
total: 0,
|
|
1992
|
+
tenants: [],
|
|
1993
|
+
selectedTenant: null,
|
|
1994
|
+
sort: {
|
|
1995
|
+
direction: SORTING_OPTIONS.desc,
|
|
1996
|
+
key: "name"
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1922
1999
|
organization: {
|
|
1923
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
1924
|
-
total: 0,
|
|
1925
|
-
tenants: [],
|
|
1926
|
-
selectedTenant: null,
|
|
1927
|
-
sort: {
|
|
1928
|
-
direction: SORTING_OPTIONS.desc,
|
|
1929
|
-
key: "name"
|
|
1930
|
-
}
|
|
1931
|
-
})
|
|
1932
2000
|
// id, name, status, tenant_token, plan
|
|
1933
2001
|
},
|
|
1934
2002
|
auditlog: {
|
|
1935
2003
|
events: [],
|
|
1936
|
-
selectionState:
|
|
2004
|
+
selectionState: {
|
|
2005
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1937
2006
|
detail: void 0,
|
|
1938
2007
|
endDate: void 0,
|
|
1939
2008
|
selectedIssue: void 0,
|
|
@@ -1942,7 +2011,7 @@ var initialState6 = {
|
|
|
1942
2011
|
total: 0,
|
|
1943
2012
|
type: void 0,
|
|
1944
2013
|
user: void 0
|
|
1945
|
-
}
|
|
2014
|
+
}
|
|
1946
2015
|
},
|
|
1947
2016
|
externalDeviceIntegrations: [
|
|
1948
2017
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -1965,7 +2034,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1965
2034
|
state.auditlog.selectionState.total = total;
|
|
1966
2035
|
},
|
|
1967
2036
|
setAuditLogState: (state, action) => {
|
|
1968
|
-
state.auditlog.selectionState =
|
|
2037
|
+
state.auditlog.selectionState = {
|
|
2038
|
+
...state.auditlog.selectionState,
|
|
2039
|
+
...action.payload
|
|
2040
|
+
};
|
|
1969
2041
|
},
|
|
1970
2042
|
receiveCurrentCard: (state, action) => {
|
|
1971
2043
|
state.card = action.payload;
|
|
@@ -1974,12 +2046,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1974
2046
|
state.intentId = action.payload;
|
|
1975
2047
|
},
|
|
1976
2048
|
setOrganization: (state, action) => {
|
|
1977
|
-
state.organization =
|
|
1978
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
1979
|
-
});
|
|
2049
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
1980
2050
|
},
|
|
1981
2051
|
setTenantListState: (state, action) => {
|
|
1982
|
-
state.
|
|
2052
|
+
state.tenantList = action.payload;
|
|
1983
2053
|
},
|
|
1984
2054
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
1985
2055
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2039,7 +2109,8 @@ var initialState7 = {
|
|
|
2039
2109
|
}
|
|
2040
2110
|
*/
|
|
2041
2111
|
},
|
|
2042
|
-
releasesList:
|
|
2112
|
+
releasesList: {
|
|
2113
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2043
2114
|
searchedIds: [],
|
|
2044
2115
|
releaseIds: [],
|
|
2045
2116
|
selection: [],
|
|
@@ -2053,7 +2124,7 @@ var initialState7 = {
|
|
|
2053
2124
|
selectedTags: [],
|
|
2054
2125
|
total: 0,
|
|
2055
2126
|
type: ""
|
|
2056
|
-
}
|
|
2127
|
+
},
|
|
2057
2128
|
tags: [],
|
|
2058
2129
|
updateTypes: [],
|
|
2059
2130
|
/*
|
|
@@ -2079,8 +2150,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2079
2150
|
state.updateTypes = action.payload;
|
|
2080
2151
|
},
|
|
2081
2152
|
removeRelease: (state, action) => {
|
|
2082
|
-
|
|
2083
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2153
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2084
2154
|
state.byId = byId;
|
|
2085
2155
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2086
2156
|
},
|
|
@@ -2113,8 +2183,12 @@ var initialState8 = {
|
|
|
2113
2183
|
previousPhases: [],
|
|
2114
2184
|
retries: 0
|
|
2115
2185
|
},
|
|
2116
|
-
permissionSetsById:
|
|
2117
|
-
|
|
2186
|
+
permissionSetsById: {
|
|
2187
|
+
...defaultPermissionSets
|
|
2188
|
+
},
|
|
2189
|
+
rolesById: {
|
|
2190
|
+
...rolesById
|
|
2191
|
+
},
|
|
2118
2192
|
settingsInitialized: false,
|
|
2119
2193
|
showConnectDeviceDialog: false,
|
|
2120
2194
|
showFeedbackDialog: false,
|
|
@@ -2154,13 +2228,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2154
2228
|
state.byId[0] = action.payload;
|
|
2155
2229
|
},
|
|
2156
2230
|
removedUser: (state, action) => {
|
|
2157
|
-
|
|
2158
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2231
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2159
2232
|
state.byId = byId;
|
|
2160
2233
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2161
2234
|
},
|
|
2162
2235
|
updatedUser: (state, action) => {
|
|
2163
|
-
state.byId[action.payload.id] =
|
|
2236
|
+
state.byId[action.payload.id] = {
|
|
2237
|
+
...state.byId[action.payload.id],
|
|
2238
|
+
...action.payload
|
|
2239
|
+
};
|
|
2164
2240
|
},
|
|
2165
2241
|
receivedPermissionSets: (state, action) => {
|
|
2166
2242
|
state.permissionSetsById = action.payload;
|
|
@@ -2169,11 +2245,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2169
2245
|
state.rolesById = action.payload;
|
|
2170
2246
|
},
|
|
2171
2247
|
createdRole: (state, action) => {
|
|
2172
|
-
state.rolesById[action.payload.name] =
|
|
2248
|
+
state.rolesById[action.payload.name] = {
|
|
2249
|
+
...state.rolesById[action.payload.name],
|
|
2250
|
+
...action.payload
|
|
2251
|
+
};
|
|
2173
2252
|
},
|
|
2174
2253
|
removedRole: (state, action) => {
|
|
2175
|
-
|
|
2176
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2254
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2177
2255
|
state.rolesById = rolesById2;
|
|
2178
2256
|
},
|
|
2179
2257
|
setCustomColumns: (state, action) => {
|
|
@@ -2181,18 +2259,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2181
2259
|
},
|
|
2182
2260
|
setGlobalSettings: (state, action) => {
|
|
2183
2261
|
state.settingsInitialized = true;
|
|
2184
|
-
state.globalSettings =
|
|
2262
|
+
state.globalSettings = {
|
|
2263
|
+
...state.globalSettings,
|
|
2264
|
+
...action.payload
|
|
2265
|
+
};
|
|
2185
2266
|
},
|
|
2186
2267
|
setUserSettings: (state, action) => {
|
|
2187
2268
|
state.userSettingsInitialized = true;
|
|
2188
|
-
state.userSettings =
|
|
2269
|
+
state.userSettings = {
|
|
2270
|
+
...state.userSettings,
|
|
2271
|
+
...action.payload
|
|
2272
|
+
};
|
|
2189
2273
|
},
|
|
2190
2274
|
setTooltipState: (state, action) => {
|
|
2191
2275
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2192
2276
|
state.tooltips.byId[id].readState = readState;
|
|
2193
2277
|
},
|
|
2194
2278
|
setTooltipsState: (state, action) => {
|
|
2195
|
-
state.tooltips.byId =
|
|
2279
|
+
state.tooltips.byId = {
|
|
2280
|
+
...state.tooltips.byId,
|
|
2281
|
+
...action.payload
|
|
2282
|
+
};
|
|
2196
2283
|
},
|
|
2197
2284
|
setShowFeedbackDialog: (state, action) => {
|
|
2198
2285
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2209,7 +2296,16 @@ var actions8 = usersSlice.actions;
|
|
|
2209
2296
|
var usersSlice_default = usersSlice.reducer;
|
|
2210
2297
|
|
|
2211
2298
|
// src/actions.ts
|
|
2212
|
-
var actions_default =
|
|
2299
|
+
var actions_default = {
|
|
2300
|
+
...actions,
|
|
2301
|
+
...actions2,
|
|
2302
|
+
...actions3,
|
|
2303
|
+
...actions4,
|
|
2304
|
+
...actions5,
|
|
2305
|
+
...actions6,
|
|
2306
|
+
...actions7,
|
|
2307
|
+
...actions8
|
|
2308
|
+
};
|
|
2213
2309
|
|
|
2214
2310
|
// src/api/general-api.ts
|
|
2215
2311
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2220,18 +2316,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2220
2316
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2221
2317
|
var tokenCache = "";
|
|
2222
2318
|
var getSessionInfo = () => {
|
|
2223
|
-
|
|
2224
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2319
|
+
let sessionInfo = { ...emptySession };
|
|
2225
2320
|
try {
|
|
2226
|
-
sessionInfo = JSON.parse(
|
|
2227
|
-
} catch
|
|
2321
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2322
|
+
} catch {
|
|
2228
2323
|
}
|
|
2229
2324
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2230
2325
|
cleanUp();
|
|
2231
|
-
return
|
|
2326
|
+
return { ...emptySession };
|
|
2232
2327
|
}
|
|
2233
2328
|
if (!sessionInfo.token) {
|
|
2234
|
-
let jwtTokenFromCookie =
|
|
2329
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2235
2330
|
if (jwtTokenFromCookie) {
|
|
2236
2331
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2237
2332
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2259,8 +2354,7 @@ var maxSessionAge = 900;
|
|
|
2259
2354
|
|
|
2260
2355
|
// src/api/general-api.ts
|
|
2261
2356
|
var unauthorizedRedirect = (error) => {
|
|
2262
|
-
|
|
2263
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2357
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2264
2358
|
cleanUp();
|
|
2265
2359
|
window.location.replace("/ui/");
|
|
2266
2360
|
}
|
|
@@ -2270,7 +2364,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2270
2364
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2271
2365
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2272
2366
|
authenticatedRequest.interceptors.request.use(
|
|
2273
|
-
(config) =>
|
|
2367
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2274
2368
|
(error) => Promise.reject(error)
|
|
2275
2369
|
);
|
|
2276
2370
|
var Api = {
|
|
@@ -2278,7 +2372,7 @@ var Api = {
|
|
|
2278
2372
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2279
2373
|
patch: authenticatedRequest.patch,
|
|
2280
2374
|
post: authenticatedRequest.post,
|
|
2281
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2375
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2282
2376
|
put: authenticatedRequest.put,
|
|
2283
2377
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2284
2378
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2298,19 +2392,13 @@ var general_api_default = Api;
|
|
|
2298
2392
|
// src/api/users-api.ts
|
|
2299
2393
|
var import_axios2 = __toESM(require("axios"));
|
|
2300
2394
|
var Api2 = {
|
|
2301
|
-
postLogin: (url,
|
|
2302
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
2303
|
-
return import_axios2.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
2304
|
-
var _a2;
|
|
2305
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
2306
|
-
});
|
|
2307
|
-
},
|
|
2395
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios2.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
2308
2396
|
putVerifyTFA: (url, userData) => {
|
|
2309
2397
|
let body = {};
|
|
2310
2398
|
if (userData.hasOwnProperty("token2fa")) {
|
|
2311
2399
|
body = { token2fa: userData.token2fa };
|
|
2312
2400
|
}
|
|
2313
|
-
return import_axios2.default.put(url, body,
|
|
2401
|
+
return import_axios2.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
2314
2402
|
}
|
|
2315
2403
|
};
|
|
2316
2404
|
var users_api_default = Api2;
|
|
@@ -2329,10 +2417,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2329
2417
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2330
2418
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2331
2419
|
[getFullVersionInformation, getFeatures],
|
|
2332
|
-
(
|
|
2333
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2334
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2335
|
-
}
|
|
2420
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2336
2421
|
);
|
|
2337
2422
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2338
2423
|
|
|
@@ -2349,8 +2434,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2349
2434
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2350
2435
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2351
2436
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2352
|
-
|
|
2353
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2437
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2354
2438
|
return selection.reduce((accu, id) => {
|
|
2355
2439
|
if (deploymentsById[id]) {
|
|
2356
2440
|
accu.push(deploymentsById[id]);
|
|
@@ -2394,7 +2478,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2394
2478
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2395
2479
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2396
2480
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2397
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2481
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2482
|
+
...filteringAttributes,
|
|
2398
2483
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2399
2484
|
}));
|
|
2400
2485
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2422,10 +2507,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2422
2507
|
return accu;
|
|
2423
2508
|
}, {})
|
|
2424
2509
|
);
|
|
2425
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2426
|
-
var _a;
|
|
2427
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2428
|
-
});
|
|
2510
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2429
2511
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2430
2512
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2431
2513
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2442,17 +2524,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2442
2524
|
[getAcceptedDevices, getDeviceLimit],
|
|
2443
2525
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2444
2526
|
);
|
|
2445
|
-
var
|
|
2446
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2447
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2448
|
-
return groups;
|
|
2449
|
-
});
|
|
2527
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2450
2528
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2451
2529
|
const groupNames = Object.keys(groupsById).sort();
|
|
2452
2530
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2453
2531
|
(accu, [groupname, group]) => {
|
|
2454
2532
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2455
|
-
const groupItem =
|
|
2533
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2456
2534
|
if (group.filters.length > 0) {
|
|
2457
2535
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2458
2536
|
accu.dynamic.push(groupItem);
|
|
@@ -2466,7 +2544,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2466
2544
|
},
|
|
2467
2545
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2468
2546
|
);
|
|
2469
|
-
return
|
|
2547
|
+
return { groupNames, ...groupedGroups };
|
|
2470
2548
|
});
|
|
2471
2549
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2472
2550
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2501,15 +2579,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
2501
2579
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
2502
2580
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
2503
2581
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
2504
|
-
var getTenantsList = (state) => state.organization.
|
|
2582
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
2505
2583
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
2506
2584
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2507
2585
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2508
2586
|
[getExternalIntegrations],
|
|
2509
|
-
(integrations) => integrations.filter((integration) =>
|
|
2510
|
-
var _a;
|
|
2511
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2512
|
-
})
|
|
2587
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2513
2588
|
);
|
|
2514
2589
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2515
2590
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2543,15 +2618,12 @@ var filterProcessors = {
|
|
|
2543
2618
|
var filterAliases = {
|
|
2544
2619
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2545
2620
|
};
|
|
2546
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2553
|
-
};
|
|
2554
|
-
});
|
|
2621
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2622
|
+
scope: filter.scope,
|
|
2623
|
+
attribute: filter.key,
|
|
2624
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2625
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2626
|
+
}));
|
|
2555
2627
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2556
2628
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2557
2629
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2561,14 +2633,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2561
2633
|
});
|
|
2562
2634
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2563
2635
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2564
|
-
return
|
|
2636
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2565
2637
|
}
|
|
2566
2638
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2567
2639
|
});
|
|
2568
2640
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2569
|
-
var _a;
|
|
2570
2641
|
let applicableFilters = [...filters];
|
|
2571
|
-
if (typeof group === "string" && !(
|
|
2642
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2572
2643
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2573
2644
|
}
|
|
2574
2645
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2589,12 +2660,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2589
2660
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2590
2661
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2591
2662
|
if (id && byId[id]) {
|
|
2592
|
-
accu.push(
|
|
2663
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2593
2664
|
}
|
|
2594
2665
|
return accu;
|
|
2595
2666
|
}, []);
|
|
2596
2667
|
};
|
|
2597
|
-
var mergePermissions = (existingPermissions =
|
|
2668
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2598
2669
|
(accu, [key, value]) => {
|
|
2599
2670
|
let values;
|
|
2600
2671
|
if (!accu[key]) {
|
|
@@ -2604,12 +2675,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2604
2675
|
if (Array.isArray(value)) {
|
|
2605
2676
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2606
2677
|
} else {
|
|
2607
|
-
values = mergePermissions(accu[key],
|
|
2678
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2608
2679
|
}
|
|
2609
2680
|
accu[key] = values;
|
|
2610
2681
|
return accu;
|
|
2611
2682
|
},
|
|
2612
|
-
|
|
2683
|
+
{ ...addedPermissions }
|
|
2613
2684
|
);
|
|
2614
2685
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2615
2686
|
(accu, roleId) => {
|
|
@@ -2618,20 +2689,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2618
2689
|
}
|
|
2619
2690
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2620
2691
|
},
|
|
2621
|
-
|
|
2692
|
+
{ ...emptyUiPermissions }
|
|
2622
2693
|
);
|
|
2623
2694
|
var progress = ({ loaded, total }) => {
|
|
2624
2695
|
let uploadProgress4 = loaded / total * 100;
|
|
2625
2696
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2626
2697
|
};
|
|
2627
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2628
|
-
var _a, _b2, _c, _d, _e;
|
|
2629
|
-
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;
|
|
2630
|
-
};
|
|
2698
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2631
2699
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2632
2700
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2633
2701
|
try {
|
|
2634
|
-
if (
|
|
2702
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2635
2703
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2636
2704
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2637
2705
|
}
|
|
@@ -2646,9 +2714,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2646
2714
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2647
2715
|
return accu;
|
|
2648
2716
|
}
|
|
2649
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2717
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2718
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2650
2719
|
[attribute.name]: attribute.value
|
|
2651
|
-
}
|
|
2720
|
+
};
|
|
2652
2721
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2653
2722
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2654
2723
|
}
|
|
@@ -2667,15 +2736,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2667
2736
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2668
2737
|
var getReleaseMappingDefaults = () => ({});
|
|
2669
2738
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2670
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2739
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2671
2740
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2672
2741
|
[getReleaseListState, getReleasesById],
|
|
2673
2742
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2674
2743
|
);
|
|
2675
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2676
|
-
var _a;
|
|
2677
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2678
|
-
});
|
|
2744
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2679
2745
|
|
|
2680
2746
|
// src/usersSlice/selectors.ts
|
|
2681
2747
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2684,10 +2750,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2684
2750
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2685
2751
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2686
2752
|
var getUsersById = (state) => state.users.byId;
|
|
2687
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2688
|
-
var _a;
|
|
2689
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2690
|
-
});
|
|
2753
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2691
2754
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2692
2755
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2693
2756
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2698,22 +2761,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2698
2761
|
[getTooltipsById, getUserSettings],
|
|
2699
2762
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2700
2763
|
(accu, [id, value]) => {
|
|
2701
|
-
accu[id] =
|
|
2764
|
+
accu[id] = { ...accu[id], ...value };
|
|
2702
2765
|
return accu;
|
|
2703
2766
|
},
|
|
2704
|
-
|
|
2767
|
+
{ ...tooltips }
|
|
2705
2768
|
)
|
|
2706
2769
|
);
|
|
2707
2770
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2708
2771
|
[getCurrentUser],
|
|
2709
2772
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2710
2773
|
);
|
|
2711
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2774
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2712
2775
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2713
|
-
interval:
|
|
2714
|
-
intervalUnit:
|
|
2776
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2777
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2715
2778
|
}));
|
|
2716
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2779
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2717
2780
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2718
2781
|
|
|
2719
2782
|
// src/commonSelectors.ts
|
|
@@ -2732,8 +2795,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2732
2795
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2733
2796
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2734
2797
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2735
|
-
|
|
2736
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2798
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2737
2799
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2738
2800
|
return { isAdmin, uiPermissions };
|
|
2739
2801
|
}
|
|
@@ -2802,10 +2864,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2802
2864
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2803
2865
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2804
2866
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2805
|
-
const updateAttribute =
|
|
2867
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2806
2868
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2807
2869
|
const attributes = [
|
|
2808
|
-
...previousFilters.map((item) =>
|
|
2870
|
+
...previousFilters.map((item) => ({
|
|
2871
|
+
...item,
|
|
2809
2872
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2810
2873
|
category: "recently used",
|
|
2811
2874
|
priority: 0
|
|
@@ -2823,14 +2886,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2823
2886
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2824
2887
|
}
|
|
2825
2888
|
);
|
|
2826
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
});
|
|
2889
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2890
|
+
...remainder,
|
|
2891
|
+
...onboarding,
|
|
2892
|
+
complete: onboarding.complete || complete,
|
|
2893
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2894
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2895
|
+
}));
|
|
2834
2896
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2835
2897
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2836
2898
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2851,12 +2913,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2851
2913
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2852
2914
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2853
2915
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2854
|
-
|
|
2855
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2916
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2856
2917
|
const { devices = {} } = deployment;
|
|
2857
2918
|
return {
|
|
2858
2919
|
deployment,
|
|
2859
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2920
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2860
2921
|
};
|
|
2861
2922
|
}
|
|
2862
2923
|
);
|
|
@@ -2871,8 +2932,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2871
2932
|
}, {})
|
|
2872
2933
|
);
|
|
2873
2934
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2874
|
-
|
|
2875
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2935
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2876
2936
|
if (staticOnly) {
|
|
2877
2937
|
return Object.keys(uiPermissions.groups).sort();
|
|
2878
2938
|
}
|
|
@@ -2906,9 +2966,25 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2906
2966
|
if (auditlogEvent) {
|
|
2907
2967
|
const { object = {} } = auditlogEvent;
|
|
2908
2968
|
const { device = {}, id, type } = object;
|
|
2909
|
-
auditlogDevice = type === "device" ?
|
|
2969
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2910
2970
|
}
|
|
2911
|
-
return
|
|
2971
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2972
|
+
});
|
|
2973
|
+
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2974
|
+
if (service_provider) {
|
|
2975
|
+
return roles.reduce((accu, role) => {
|
|
2976
|
+
if (rolesById[role.id]) {
|
|
2977
|
+
return accu;
|
|
2978
|
+
}
|
|
2979
|
+
accu.push(role);
|
|
2980
|
+
return accu;
|
|
2981
|
+
}, Object.values(serviceProviderRolesById));
|
|
2982
|
+
}
|
|
2983
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2984
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2985
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2986
|
+
return accu;
|
|
2987
|
+
}, roles);
|
|
2912
2988
|
});
|
|
2913
2989
|
|
|
2914
2990
|
// src/store.ts
|
|
@@ -2944,8 +3020,9 @@ var sessionReducer = (state, action) => {
|
|
|
2944
3020
|
return rootReducer(state, action);
|
|
2945
3021
|
};
|
|
2946
3022
|
var getConfiguredStore = (options = {}) => {
|
|
2947
|
-
const
|
|
2948
|
-
return (0, import_toolkit16.configureStore)(
|
|
3023
|
+
const { preloadedState = {}, ...config } = options;
|
|
3024
|
+
return (0, import_toolkit16.configureStore)({
|
|
3025
|
+
...config,
|
|
2949
3026
|
preloadedState,
|
|
2950
3027
|
reducer: sessionReducer,
|
|
2951
3028
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2958,7 +3035,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2958
3035
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2959
3036
|
}
|
|
2960
3037
|
})
|
|
2961
|
-
})
|
|
3038
|
+
});
|
|
2962
3039
|
};
|
|
2963
3040
|
var store = getConfiguredStore({
|
|
2964
3041
|
preloadedState: {}
|
|
@@ -2978,17 +3055,16 @@ var dateFunctionMap = {
|
|
|
2978
3055
|
setDays: "setDate"
|
|
2979
3056
|
};
|
|
2980
3057
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2981
|
-
var _a, _b2;
|
|
2982
3058
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2983
3059
|
const today = /* @__PURE__ */ new Date();
|
|
2984
3060
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2985
|
-
const setter =
|
|
2986
|
-
const getter =
|
|
3061
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3062
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2987
3063
|
today[setter](today[getter]() - interval);
|
|
2988
3064
|
let value;
|
|
2989
3065
|
try {
|
|
2990
3066
|
value = today.toISOString();
|
|
2991
|
-
} catch
|
|
3067
|
+
} catch {
|
|
2992
3068
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2993
3069
|
}
|
|
2994
3070
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -3029,37 +3105,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
3029
3105
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
3030
3106
|
return accu;
|
|
3031
3107
|
},
|
|
3032
|
-
{ latestVersions:
|
|
3108
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
3033
3109
|
);
|
|
3034
3110
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
3035
3111
|
return Promise.resolve(
|
|
3036
3112
|
dispatch(
|
|
3037
|
-
actions.setVersionInformation(
|
|
3113
|
+
actions.setVersionInformation({
|
|
3114
|
+
...latestVersions,
|
|
3038
3115
|
backend: info,
|
|
3039
3116
|
GUI: info,
|
|
3040
3117
|
latestRelease: {
|
|
3041
3118
|
releaseDate: latestRelease.release_date,
|
|
3042
3119
|
repos: latestRepos
|
|
3043
3120
|
}
|
|
3044
|
-
})
|
|
3121
|
+
})
|
|
3045
3122
|
)
|
|
3046
3123
|
);
|
|
3047
3124
|
});
|
|
3048
3125
|
});
|
|
3049
3126
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3050
3127
|
const currentState = getSearchState(getState());
|
|
3051
|
-
let nextState =
|
|
3052
|
-
|
|
3053
|
-
|
|
3128
|
+
let nextState = {
|
|
3129
|
+
...currentState,
|
|
3130
|
+
...searchState,
|
|
3131
|
+
sort: {
|
|
3132
|
+
...currentState.sort,
|
|
3133
|
+
...searchState.sort
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3054
3136
|
let tasks = [];
|
|
3055
|
-
const
|
|
3056
|
-
const
|
|
3137
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3138
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3057
3139
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3058
3140
|
nextState.isSearching = true;
|
|
3059
3141
|
tasks.push(
|
|
3060
3142
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3061
3143
|
const searchResult = results[results.length - 1];
|
|
3062
|
-
return dispatch(actions.setSearchState(
|
|
3144
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3063
3145
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3064
3146
|
);
|
|
3065
3147
|
}
|
|
@@ -3076,13 +3158,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3076
3158
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3077
3159
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3078
3160
|
(accu, item) => {
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3161
|
+
const filter = item.filter ?? {};
|
|
3162
|
+
let deployment = {
|
|
3163
|
+
...deploymentPrototype,
|
|
3164
|
+
...deploymentsById[item.id],
|
|
3165
|
+
...item,
|
|
3166
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3083
3167
|
name: decodeURIComponent(item.name)
|
|
3084
|
-
}
|
|
3085
|
-
deployment =
|
|
3168
|
+
};
|
|
3169
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3086
3170
|
accu.deployments[item.id] = deployment;
|
|
3087
3171
|
accu.deploymentIds.push(item.id);
|
|
3088
3172
|
return accu;
|
|
@@ -3136,11 +3220,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3136
3220
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3137
3221
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3138
3222
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3139
|
-
const deployment =
|
|
3223
|
+
const deployment = {
|
|
3224
|
+
...newDeployment,
|
|
3140
3225
|
id: deploymentId,
|
|
3141
3226
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3142
3227
|
statistics: { status: {} }
|
|
3143
|
-
}
|
|
3228
|
+
};
|
|
3144
3229
|
let tasks = [
|
|
3145
3230
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3146
3231
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3283,14 +3368,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3283
3368
|
({ deploymentId, updateControlMap }, { dispatch }) => general_api_default.patch(`${deploymentsApiUrl}/deployments/${deploymentId}`, { update_control_map: updateControlMap }).catch((err) => commonErrorHandler(err, "There was an error while updating the deployment status:", dispatch)).then(() => Promise.resolve(dispatch(getSingleDeployment(deploymentId))))
|
|
3284
3369
|
);
|
|
3285
3370
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3286
|
-
const
|
|
3371
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3287
3372
|
const currentState = getState().deployments.selectionState;
|
|
3288
|
-
let nextState =
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3373
|
+
let nextState = {
|
|
3374
|
+
...currentState,
|
|
3375
|
+
...selectionState,
|
|
3376
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3377
|
+
accu[item] = {
|
|
3378
|
+
...currentState[item],
|
|
3379
|
+
...selectionState[item]
|
|
3380
|
+
};
|
|
3381
|
+
return accu;
|
|
3382
|
+
}, {}),
|
|
3383
|
+
general: {
|
|
3384
|
+
...currentState.general,
|
|
3385
|
+
...selectionState.general
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3294
3388
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3295
3389
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3296
3390
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3320,15 +3414,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3320
3414
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3321
3415
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3322
3416
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3323
|
-
const config =
|
|
3417
|
+
const config = {
|
|
3418
|
+
...oldConfig,
|
|
3324
3419
|
hasDelta: Boolean(delta.enabled),
|
|
3325
|
-
binaryDelta:
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3420
|
+
binaryDelta: {
|
|
3421
|
+
...oldConfig.binaryDelta,
|
|
3422
|
+
timeout: timeoutConfig,
|
|
3423
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3424
|
+
},
|
|
3425
|
+
binaryDeltaLimits: {
|
|
3426
|
+
...oldConfig.binaryDeltaLimits,
|
|
3427
|
+
timeout: timeoutLimit,
|
|
3428
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3429
|
+
}
|
|
3430
|
+
};
|
|
3332
3431
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3333
3432
|
})
|
|
3334
3433
|
);
|
|
@@ -3338,7 +3437,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3338
3437
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3339
3438
|
return accu;
|
|
3340
3439
|
}
|
|
3341
|
-
accu =
|
|
3440
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3342
3441
|
}
|
|
3343
3442
|
return accu;
|
|
3344
3443
|
}, void 0);
|
|
@@ -3358,9 +3457,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3358
3457
|
}
|
|
3359
3458
|
return general_api_default.put(`${deploymentsApiUrl}/config/binary_delta`, result).catch((err) => commonErrorHandler(err, "There was a problem storing your delta artifact generation configuration.", dispatch)).then(() => {
|
|
3360
3459
|
const oldConfig = getState().deployments.config;
|
|
3361
|
-
const newConfig =
|
|
3362
|
-
|
|
3363
|
-
|
|
3460
|
+
const newConfig = {
|
|
3461
|
+
...oldConfig,
|
|
3462
|
+
binaryDelta: {
|
|
3463
|
+
...oldConfig.binaryDelta,
|
|
3464
|
+
...config
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3364
3467
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3365
3468
|
});
|
|
3366
3469
|
});
|
|
@@ -3373,19 +3476,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3373
3476
|
var import_axios3 = require("axios");
|
|
3374
3477
|
var import_pluralize = __toESM(require_pluralize());
|
|
3375
3478
|
|
|
3376
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3377
|
-
var
|
|
3378
|
-
var
|
|
3379
|
-
var poolPtr = rnds8Pool.length;
|
|
3479
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3480
|
+
var getRandomValues;
|
|
3481
|
+
var rnds8 = new Uint8Array(16);
|
|
3380
3482
|
function rng() {
|
|
3381
|
-
if (
|
|
3382
|
-
|
|
3383
|
-
|
|
3483
|
+
if (!getRandomValues) {
|
|
3484
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3485
|
+
if (!getRandomValues) {
|
|
3486
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3487
|
+
}
|
|
3384
3488
|
}
|
|
3385
|
-
return
|
|
3489
|
+
return getRandomValues(rnds8);
|
|
3386
3490
|
}
|
|
3387
3491
|
|
|
3388
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3492
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3389
3493
|
var byteToHex = [];
|
|
3390
3494
|
for (let i = 0; i < 256; ++i) {
|
|
3391
3495
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3394,13 +3498,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3394
3498
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
3395
3499
|
}
|
|
3396
3500
|
|
|
3397
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3398
|
-
var
|
|
3501
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3502
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3399
3503
|
var native_default = {
|
|
3400
|
-
randomUUID
|
|
3504
|
+
randomUUID
|
|
3401
3505
|
};
|
|
3402
3506
|
|
|
3403
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3507
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3404
3508
|
function v4(options, buf, offset) {
|
|
3405
3509
|
if (native_default.randomUUID && !buf && !options) {
|
|
3406
3510
|
return native_default.randomUUID();
|
|
@@ -3442,14 +3546,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3442
3546
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3443
3547
|
const state = getGroupsById(getState());
|
|
3444
3548
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3445
|
-
|
|
3446
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3549
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3447
3550
|
accu[id] = group;
|
|
3448
3551
|
}
|
|
3449
3552
|
return accu;
|
|
3450
3553
|
}, {});
|
|
3451
3554
|
const groups = res.data.reduce((accu, group) => {
|
|
3452
|
-
accu[group] =
|
|
3555
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3453
3556
|
return accu;
|
|
3454
3557
|
}, dynamicGroups);
|
|
3455
3558
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3507,7 +3610,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3507
3610
|
() => Promise.resolve(
|
|
3508
3611
|
dispatch(
|
|
3509
3612
|
actions3.addGroup({
|
|
3510
|
-
group:
|
|
3613
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3511
3614
|
groupName: group
|
|
3512
3615
|
})
|
|
3513
3616
|
)
|
|
@@ -3535,20 +3638,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3535
3638
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3536
3639
|
const state = getGroupsById(getState());
|
|
3537
3640
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3538
|
-
|
|
3539
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3641
|
+
if (!(group.id || group.filters?.length)) {
|
|
3540
3642
|
accu[id] = group;
|
|
3541
3643
|
}
|
|
3542
3644
|
return accu;
|
|
3543
3645
|
}, {});
|
|
3544
3646
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3545
|
-
accu[filter.name] =
|
|
3647
|
+
accu[filter.name] = {
|
|
3546
3648
|
deviceIds: [],
|
|
3547
|
-
total: 0
|
|
3548
|
-
|
|
3649
|
+
total: 0,
|
|
3650
|
+
...state[filter.name],
|
|
3549
3651
|
id: filter.id,
|
|
3550
3652
|
filters: mapTermsToFilters(filter.terms)
|
|
3551
|
-
}
|
|
3653
|
+
};
|
|
3552
3654
|
return accu;
|
|
3553
3655
|
}, staticGroups);
|
|
3554
3656
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3588,10 +3690,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3588
3690
|
);
|
|
3589
3691
|
});
|
|
3590
3692
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3591
|
-
var _a;
|
|
3592
3693
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3593
3694
|
const selectedGroup = groupsState.byId[groupName];
|
|
3594
|
-
const groupFilterLength =
|
|
3695
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3595
3696
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3596
3697
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3597
3698
|
};
|
|
@@ -3614,7 +3715,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3614
3715
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3615
3716
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3616
3717
|
(accu, device) => {
|
|
3617
|
-
var _a, _b2, _c;
|
|
3618
3718
|
const stateDevice = getDeviceById(state, device.id);
|
|
3619
3719
|
const {
|
|
3620
3720
|
attributes: storedAttributes = {},
|
|
@@ -3624,29 +3724,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3624
3724
|
group: storedGroup
|
|
3625
3725
|
} = stateDevice;
|
|
3626
3726
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3627
|
-
device.tags =
|
|
3628
|
-
device.group =
|
|
3629
|
-
device.monitor =
|
|
3630
|
-
device.identity_data =
|
|
3727
|
+
device.tags = { ...storedTags, ...tags };
|
|
3728
|
+
device.group = system.group ?? storedGroup;
|
|
3729
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3730
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3631
3731
|
device.status = status ? status : device.status || identity.status;
|
|
3632
|
-
device.check_in_time_rounded =
|
|
3633
|
-
device.check_in_time_exact =
|
|
3732
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3733
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3634
3734
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3635
3735
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3636
3736
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3637
3737
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3638
|
-
device.attributes = device.attributes ?
|
|
3639
|
-
accu.devicesById[device.id] =
|
|
3738
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3739
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3640
3740
|
accu.ids.push(device.id);
|
|
3641
3741
|
return accu;
|
|
3642
3742
|
},
|
|
3643
3743
|
{ ids, devicesById: {} }
|
|
3644
3744
|
);
|
|
3645
3745
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3646
|
-
const
|
|
3746
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3647
3747
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3648
3748
|
return Promise.resolve(
|
|
3649
|
-
dispatch(getDevicesByStatus2(
|
|
3749
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3650
3750
|
).unwrap().then((results) => {
|
|
3651
3751
|
if (!group) {
|
|
3652
3752
|
return Promise.resolve();
|
|
@@ -3660,7 +3760,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3660
3760
|
dispatch(
|
|
3661
3761
|
actions3.addGroup({
|
|
3662
3762
|
group: {
|
|
3663
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3763
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3664
3764
|
total
|
|
3665
3765
|
},
|
|
3666
3766
|
groupName: group
|
|
@@ -3809,27 +3909,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3809
3909
|
);
|
|
3810
3910
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3811
3911
|
`${sliceName3}/setDeviceListState`,
|
|
3812
|
-
(
|
|
3813
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3814
|
-
var _c;
|
|
3912
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3815
3913
|
const currentState = getDeviceListState(getState());
|
|
3816
3914
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3817
|
-
let nextState =
|
|
3915
|
+
let nextState = {
|
|
3916
|
+
...currentState,
|
|
3818
3917
|
setOnly: false,
|
|
3819
|
-
refreshTrigger
|
|
3820
|
-
|
|
3821
|
-
sort:
|
|
3822
|
-
}
|
|
3918
|
+
refreshTrigger,
|
|
3919
|
+
...selectionState,
|
|
3920
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3921
|
+
};
|
|
3823
3922
|
let tasks = [];
|
|
3824
|
-
const
|
|
3825
|
-
const
|
|
3923
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3924
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3826
3925
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3827
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3926
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3828
3927
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3829
3928
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3830
3929
|
nextState.isLoading = true;
|
|
3831
3930
|
tasks.push(
|
|
3832
|
-
dispatch(getDevicesByStatus2(
|
|
3931
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3833
3932
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3834
3933
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3835
3934
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3854,8 +3953,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3854
3953
|
} = options;
|
|
3855
3954
|
const state = getState();
|
|
3856
3955
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3857
|
-
filters: filterSelection
|
|
3858
|
-
group: group
|
|
3956
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3957
|
+
group: group ?? getSelectedGroup(state),
|
|
3859
3958
|
groups: state.devices.groups,
|
|
3860
3959
|
offlineThreshold: state.app.offlineThreshold,
|
|
3861
3960
|
selectedIssues,
|
|
@@ -3916,7 +4015,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3916
4015
|
});
|
|
3917
4016
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3918
4017
|
const state = getState();
|
|
3919
|
-
let options =
|
|
4018
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3920
4019
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3921
4020
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3922
4021
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4051,8 +4150,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4051
4150
|
({ data: auditLogEntries }) => {
|
|
4052
4151
|
const { start, end } = auditLogEntries.reduce(
|
|
4053
4152
|
(accu, item) => {
|
|
4054
|
-
|
|
4055
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4153
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4056
4154
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4057
4155
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4058
4156
|
}
|
|
@@ -4159,8 +4257,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4159
4257
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4160
4258
|
`${sliceName3}/getDeviceConfig`,
|
|
4161
4259
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4162
|
-
|
|
4163
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4260
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4164
4261
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4165
4262
|
}
|
|
4166
4263
|
})
|
|
@@ -4172,15 +4269,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4172
4269
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4173
4270
|
`${sliceName3}/applyDeviceConfig`,
|
|
4174
4271
|
({ deviceId, configDeploymentConfiguration, isDefault, config }, { dispatch, getState }) => general_api_default.post(`${deviceConfig}/${deviceId}/deploy`, configDeploymentConfiguration).catch((err) => commonErrorHandler(err, `There was an error deploying the configuration to device ${deviceId}.`, dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4175
|
-
var _a;
|
|
4176
4272
|
const device = getDeviceById(getState(), deviceId);
|
|
4177
4273
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4178
4274
|
let tasks = [
|
|
4179
|
-
dispatch(actions3.receivedDevice(
|
|
4275
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4180
4276
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4181
4277
|
];
|
|
4182
4278
|
if (isDefault && canManageUsers) {
|
|
4183
|
-
const { previous } =
|
|
4279
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4184
4280
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4185
4281
|
}
|
|
4186
4282
|
return Promise.all(tasks);
|
|
@@ -4196,21 +4292,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4196
4292
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4197
4293
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4198
4294
|
{ headers }
|
|
4199
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4295
|
+
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice({ ...device, id: deviceId, tags })), dispatch(setSnackbar3("Device name changed"))]));
|
|
4200
4296
|
})
|
|
4201
4297
|
)
|
|
4202
4298
|
);
|
|
4203
4299
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4204
4300
|
let providerResult = {};
|
|
4205
4301
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4206
|
-
providerResult =
|
|
4302
|
+
providerResult = { ...data, twinError: "" };
|
|
4207
4303
|
}).catch((err) => {
|
|
4208
4304
|
providerResult = {
|
|
4209
4305
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4210
4306
|
};
|
|
4211
4307
|
}).finally(() => {
|
|
4212
4308
|
const device = getDeviceById(getState(), deviceId);
|
|
4213
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4309
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4214
4310
|
});
|
|
4215
4311
|
});
|
|
4216
4312
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4226,7 +4322,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4226
4322
|
const { twinsByIntegration = {} } = device;
|
|
4227
4323
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4228
4324
|
return Promise.resolve(
|
|
4229
|
-
dispatch(actions3.receivedDevice(
|
|
4325
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4230
4326
|
);
|
|
4231
4327
|
})
|
|
4232
4328
|
);
|
|
@@ -4247,8 +4343,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4247
4343
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4248
4344
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4249
4345
|
const filters = [
|
|
4250
|
-
|
|
4251
|
-
|
|
4346
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4347
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4252
4348
|
];
|
|
4253
4349
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4254
4350
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4260,11 +4356,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4260
4356
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4261
4357
|
const state2 = getState();
|
|
4262
4358
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4263
|
-
const device =
|
|
4359
|
+
const device = {
|
|
4360
|
+
...getDeviceById(state2, id),
|
|
4264
4361
|
systemDeviceIds: ids,
|
|
4265
4362
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4266
|
-
}
|
|
4267
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4363
|
+
};
|
|
4364
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4268
4365
|
});
|
|
4269
4366
|
});
|
|
4270
4367
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4272,9 +4369,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4272
4369
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4273
4370
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4274
4371
|
const filters = [
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4372
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4373
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4374
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4278
4375
|
];
|
|
4279
4376
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4280
4377
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4321,7 +4418,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4321
4418
|
var cutoffLength = 75;
|
|
4322
4419
|
var ellipsis = "...";
|
|
4323
4420
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4324
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4421
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4325
4422
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4326
4423
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4327
4424
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4339,14 +4436,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4339
4436
|
});
|
|
4340
4437
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4341
4438
|
const state = getState();
|
|
4342
|
-
const
|
|
4343
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4439
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4440
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4441
|
+
...remainder,
|
|
4344
4442
|
filters,
|
|
4345
4443
|
group,
|
|
4346
4444
|
offlineThreshold: state.app.offlineThreshold,
|
|
4347
4445
|
selectedIssues: [type],
|
|
4348
4446
|
status
|
|
4349
|
-
})
|
|
4447
|
+
});
|
|
4350
4448
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4351
4449
|
page: 1,
|
|
4352
4450
|
per_page: 1,
|
|
@@ -4398,21 +4496,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4398
4496
|
return steps[progress2];
|
|
4399
4497
|
};
|
|
4400
4498
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4401
|
-
var _a;
|
|
4402
4499
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4403
4500
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4404
4501
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4405
4502
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4406
|
-
let deviceType =
|
|
4503
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4407
4504
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4408
4505
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4409
|
-
return
|
|
4506
|
+
return {
|
|
4507
|
+
...onboardingState,
|
|
4410
4508
|
complete: !!(Boolean(userCookie) || onboardingState.complete || acceptedDevices.length > 1 && pendingDevices.length > 0 && releases.length > 1 && pastDeployments.length > 1 || acceptedDevices.length >= 1 && releases.length >= 2 && pastDeployments.length > 2 || acceptedDevices.length >= 1 && pendingDevices.length > 0 && releases.length >= 2 && pastDeployments.length >= 2 || orderedOnboardingSteps.findIndex((step) => step === progress2) >= orderedOnboardingSteps.length - 1 || onboardingState.disable || ![canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases].every((i) => i)),
|
|
4411
4509
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4412
4510
|
deviceType,
|
|
4413
4511
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4414
4512
|
progress: progress2
|
|
4415
|
-
}
|
|
4513
|
+
};
|
|
4416
4514
|
};
|
|
4417
4515
|
var getOnboardingState2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4418
4516
|
const state = getState();
|
|
@@ -4470,7 +4568,7 @@ var advanceOnboarding = (0, import_toolkit21.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4470
4568
|
return;
|
|
4471
4569
|
}
|
|
4472
4570
|
const madeProgress = steps[stepIndex + 1];
|
|
4473
|
-
const state =
|
|
4571
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4474
4572
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4475
4573
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4476
4574
|
});
|
|
@@ -4553,8 +4651,8 @@ var completeUpgrade = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4553
4651
|
({ tenantId, plan }, { dispatch }) => general_api_default.post(`${tenantadmApiUrlv2}/tenants/${tenantId}/upgrade/complete`, { plan }).catch((err) => commonErrorHandler(err, `There was an error upgrading your account:`, dispatch)).then(() => Promise.resolve(dispatch(getUserOrganization())))
|
|
4554
4652
|
);
|
|
4555
4653
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4556
|
-
const userId =
|
|
4557
|
-
const detail =
|
|
4654
|
+
const userId = userFilter?.id || userFilter;
|
|
4655
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4558
4656
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4559
4657
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4560
4658
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4581,12 +4679,14 @@ var getAuditLogsCsvLink = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4581
4679
|
);
|
|
4582
4680
|
var setAuditlogsState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4583
4681
|
const currentState = getAuditlogState(getState());
|
|
4584
|
-
let nextState =
|
|
4585
|
-
|
|
4586
|
-
|
|
4682
|
+
let nextState = {
|
|
4683
|
+
...currentState,
|
|
4684
|
+
...selectionState,
|
|
4685
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4686
|
+
};
|
|
4587
4687
|
let tasks = [];
|
|
4588
|
-
const
|
|
4589
|
-
const
|
|
4688
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4689
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4590
4690
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4591
4691
|
nextState.isLoading = true;
|
|
4592
4692
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4598,27 +4698,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4598
4698
|
var addTenant = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4599
4699
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar4("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
4600
4700
|
});
|
|
4601
|
-
var tenantListRetrieval = (config) =>
|
|
4701
|
+
var tenantListRetrieval = async (config) => {
|
|
4602
4702
|
const { page, perPage } = config;
|
|
4603
4703
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4604
|
-
const tenantList =
|
|
4704
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4605
4705
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4606
|
-
return [tenantList.data, totalCount];
|
|
4607
|
-
}
|
|
4608
|
-
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4706
|
+
return [tenantList.data, Number(totalCount)];
|
|
4707
|
+
};
|
|
4708
|
+
var getTenants = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4609
4709
|
const currentState = getTenantsList(getState());
|
|
4610
|
-
const [tenants, pageCount] =
|
|
4611
|
-
dispatch(actions6.setTenantListState(
|
|
4612
|
-
})
|
|
4613
|
-
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4710
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4711
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4712
|
+
});
|
|
4713
|
+
var setTenantsListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4614
4714
|
const currentState = getTenantsList(getState());
|
|
4615
|
-
const nextState =
|
|
4715
|
+
const nextState = {
|
|
4716
|
+
...currentState,
|
|
4717
|
+
...selectionState
|
|
4718
|
+
};
|
|
4616
4719
|
if (!(0, import_helpers10.deepCompare)(currentState, selectionState)) {
|
|
4617
|
-
const [tenants, pageCount] =
|
|
4618
|
-
return dispatch(actions6.setTenantListState(
|
|
4720
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4721
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4619
4722
|
}
|
|
4620
|
-
return dispatch(actions6.setTenantListState(
|
|
4621
|
-
})
|
|
4723
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4724
|
+
});
|
|
4622
4725
|
var editTenantDeviceLimit = (0, import_toolkit22.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4623
4726
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4624
4727
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4661,10 +4764,7 @@ var downloadLicenseReport = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4661
4764
|
);
|
|
4662
4765
|
var createIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4663
4766
|
`${sliceName6}/createIntegration`,
|
|
4664
|
-
(
|
|
4665
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4666
|
-
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())]));
|
|
4667
|
-
}
|
|
4767
|
+
({ id, ...integration }, { dispatch }) => general_api_default.post(`${iotManagerBaseURL}/integrations`, integration).catch((err) => commonErrorHandler(err, "There was an error creating the integration", dispatch, commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar4("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
4668
4768
|
);
|
|
4669
4769
|
var changeIntegration = (0, import_toolkit22.createAsyncThunk)(
|
|
4670
4770
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4685,9 +4785,8 @@ var getIntegrations = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4685
4785
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4686
4786
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4687
4787
|
const integrations = data.reduce((accu, item) => {
|
|
4688
|
-
|
|
4689
|
-
const
|
|
4690
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4788
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4789
|
+
const integration = { ...existingIntegration, ...item };
|
|
4691
4790
|
accu.push(integration);
|
|
4692
4791
|
return accu;
|
|
4693
4792
|
}, []);
|
|
@@ -4739,7 +4838,7 @@ var getSsoConfigById = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4739
4838
|
`${sliceName6}/getSsoConfigById`,
|
|
4740
4839
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4741
4840
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4742
|
-
return sso ? Promise.resolve(
|
|
4841
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4743
4842
|
})
|
|
4744
4843
|
);
|
|
4745
4844
|
var getSsoConfigs = (0, import_toolkit22.createAsyncThunk)(
|
|
@@ -4758,20 +4857,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4758
4857
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4759
4858
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4760
4859
|
var flattenRelease = (release, stateRelease) => {
|
|
4761
|
-
|
|
4762
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers11.customSort)(1, "modified"))) || [];
|
|
4860
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers11.customSort)(1, "modified")) || [];
|
|
4763
4861
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4764
4862
|
(accu, item) => {
|
|
4765
|
-
var _a2;
|
|
4766
4863
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4767
|
-
const stateArtifact =
|
|
4864
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4768
4865
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4769
|
-
accu.artifacts.push(
|
|
4866
|
+
accu.artifacts.push({
|
|
4867
|
+
...stateArtifact,
|
|
4868
|
+
...item
|
|
4869
|
+
});
|
|
4770
4870
|
return accu;
|
|
4771
4871
|
},
|
|
4772
4872
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4773
4873
|
);
|
|
4774
|
-
return
|
|
4874
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers11.duplicateFilter), modified };
|
|
4775
4875
|
};
|
|
4776
4876
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4777
4877
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4789,17 +4889,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4789
4889
|
{ release: null, index: -1 }
|
|
4790
4890
|
);
|
|
4791
4891
|
var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4792
|
-
var _a;
|
|
4793
4892
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4794
4893
|
if (!release || index === -1) {
|
|
4795
4894
|
return;
|
|
4796
4895
|
}
|
|
4797
4896
|
const releaseArtifacts = [...release.artifacts];
|
|
4798
4897
|
const artifact = releaseArtifacts[index];
|
|
4799
|
-
const { key, name, version } = (
|
|
4898
|
+
const { key, name, version } = (0, import_helpers11.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4800
4899
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4801
4900
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4802
|
-
filters: [
|
|
4901
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4803
4902
|
});
|
|
4804
4903
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4805
4904
|
page: 1,
|
|
@@ -4813,10 +4912,11 @@ var getArtifactInstallCount = (0, import_toolkit23.createAsyncThunk)(`${sliceNam
|
|
|
4813
4912
|
}
|
|
4814
4913
|
const installCount = Number(headers[headerNames.total]);
|
|
4815
4914
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4816
|
-
releaseArtifacts2[index2] =
|
|
4817
|
-
release2 =
|
|
4915
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4916
|
+
release2 = {
|
|
4917
|
+
...release2,
|
|
4818
4918
|
artifacts: releaseArtifacts2
|
|
4819
|
-
}
|
|
4919
|
+
};
|
|
4820
4920
|
return dispatch(actions7.receiveRelease(release2));
|
|
4821
4921
|
});
|
|
4822
4922
|
});
|
|
@@ -4828,12 +4928,14 @@ var getArtifactUrl = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4828
4928
|
return dispatch(getReleases());
|
|
4829
4929
|
}
|
|
4830
4930
|
const releaseArtifacts = [...release.artifacts];
|
|
4831
|
-
releaseArtifacts[index] =
|
|
4931
|
+
releaseArtifacts[index] = {
|
|
4932
|
+
...releaseArtifacts[index],
|
|
4832
4933
|
url: response.data.uri
|
|
4833
|
-
}
|
|
4834
|
-
release =
|
|
4934
|
+
};
|
|
4935
|
+
release = {
|
|
4936
|
+
...release,
|
|
4835
4937
|
artifacts: releaseArtifacts
|
|
4836
|
-
}
|
|
4938
|
+
};
|
|
4837
4939
|
return dispatch(actions7.receiveRelease(release));
|
|
4838
4940
|
})
|
|
4839
4941
|
);
|
|
@@ -4958,12 +5060,14 @@ var selectRelease = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/select
|
|
|
4958
5060
|
});
|
|
4959
5061
|
var setReleasesListState = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4960
5062
|
const currentState = getState().releases.releasesList;
|
|
4961
|
-
let nextState =
|
|
4962
|
-
|
|
4963
|
-
|
|
5063
|
+
let nextState = {
|
|
5064
|
+
...currentState,
|
|
5065
|
+
...selectionState,
|
|
5066
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
5067
|
+
};
|
|
4964
5068
|
let tasks = [];
|
|
4965
|
-
const
|
|
4966
|
-
const
|
|
5069
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
5070
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4967
5071
|
if (!(0, import_helpers11.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4968
5072
|
nextState.isLoading = true;
|
|
4969
5073
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4982,29 +5086,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4982
5086
|
);
|
|
4983
5087
|
};
|
|
4984
5088
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4985
|
-
let releaseListState =
|
|
5089
|
+
let releaseListState = { ...state.releasesList };
|
|
4986
5090
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4987
5091
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers11.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4988
5092
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4989
5093
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4990
5094
|
if (searchOnly) {
|
|
4991
|
-
releaseListState =
|
|
5095
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4992
5096
|
} else {
|
|
4993
|
-
releaseListState =
|
|
5097
|
+
releaseListState = {
|
|
5098
|
+
...releaseListState,
|
|
4994
5099
|
releaseIds,
|
|
4995
5100
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4996
5101
|
total: !isFiltering ? total : state.releasesList.total
|
|
4997
|
-
}
|
|
5102
|
+
};
|
|
4998
5103
|
}
|
|
4999
5104
|
return releaseListState;
|
|
5000
5105
|
};
|
|
5001
5106
|
var getReleases = (0, import_toolkit23.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
5002
|
-
const config =
|
|
5107
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
5003
5108
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
5004
5109
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
5005
5110
|
const state = getState().releases;
|
|
5006
5111
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
5007
|
-
const combinedReleases =
|
|
5112
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
5008
5113
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
5009
5114
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
5010
5115
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -5025,7 +5130,7 @@ var updateReleaseInfo = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5025
5130
|
`${sliceName7}/updateReleaseInfo`,
|
|
5026
5131
|
({ name, info }, { dispatch, getState }) => general_api_default.patch(`${deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(() => {
|
|
5027
5132
|
return Promise.all([
|
|
5028
|
-
dispatch(actions7.receiveRelease(
|
|
5133
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
5029
5134
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
5030
5135
|
]);
|
|
5031
5136
|
})
|
|
@@ -5034,7 +5139,7 @@ var setReleaseTags = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5034
5139
|
`${sliceName7}/setReleaseTags`,
|
|
5035
5140
|
({ name, tags = [] }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(() => {
|
|
5036
5141
|
return Promise.all([
|
|
5037
|
-
dispatch(actions7.receiveRelease(
|
|
5142
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
5038
5143
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
5039
5144
|
]);
|
|
5040
5145
|
})
|
|
@@ -5071,43 +5176,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
5071
5176
|
};
|
|
5072
5177
|
var loginUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5073
5178
|
`${sliceName8}/loginUser`,
|
|
5074
|
-
(
|
|
5075
|
-
|
|
5076
|
-
return
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
Promise.
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
window.
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
);
|
|
5109
|
-
});
|
|
5110
|
-
}
|
|
5179
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5180
|
+
cleanUp();
|
|
5181
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5182
|
+
}).then(({ text: response, contentType }) => {
|
|
5183
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5184
|
+
const { id, kind } = response;
|
|
5185
|
+
const type = kind.split("/")[1];
|
|
5186
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5187
|
+
window.location.replace(ssoLoginUrl);
|
|
5188
|
+
return;
|
|
5189
|
+
}
|
|
5190
|
+
const token = response;
|
|
5191
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5192
|
+
return;
|
|
5193
|
+
}
|
|
5194
|
+
let now = /* @__PURE__ */ new Date();
|
|
5195
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5196
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5197
|
+
setSessionInfo({ token, expiresAt });
|
|
5198
|
+
cookies5.remove("JWT", { path: "/" });
|
|
5199
|
+
return (
|
|
5200
|
+
// @ts-ignore
|
|
5201
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5202
|
+
cleanUp();
|
|
5203
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5204
|
+
}).then(() => {
|
|
5205
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5206
|
+
if (window.location.pathname !== "/ui/") {
|
|
5207
|
+
window.location.replace("/ui/");
|
|
5208
|
+
}
|
|
5209
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5210
|
+
})
|
|
5211
|
+
);
|
|
5212
|
+
})
|
|
5111
5213
|
);
|
|
5112
5214
|
var logoutUser = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
5113
5215
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -5124,7 +5226,7 @@ var switchUserOrganization = (0, import_toolkit24.createAsyncThunk)(`${sliceName
|
|
|
5124
5226
|
return Promise.reject();
|
|
5125
5227
|
}
|
|
5126
5228
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5127
|
-
setSessionInfo(
|
|
5229
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5128
5230
|
window.location.reload();
|
|
5129
5231
|
});
|
|
5130
5232
|
});
|
|
@@ -5187,13 +5289,13 @@ var getUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5187
5289
|
);
|
|
5188
5290
|
var initializeSelf = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5189
5291
|
var updateUserColumnSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5190
|
-
const userId = currentUserId
|
|
5292
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5191
5293
|
const storageKey = `${userId}-column-widths`;
|
|
5192
5294
|
let customColumns = [];
|
|
5193
5295
|
if (!columns) {
|
|
5194
5296
|
try {
|
|
5195
5297
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5196
|
-
} catch
|
|
5298
|
+
} catch {
|
|
5197
5299
|
}
|
|
5198
5300
|
} else {
|
|
5199
5301
|
customColumns = columns;
|
|
@@ -5222,10 +5324,7 @@ var userActions = {
|
|
|
5222
5324
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5223
5325
|
var createUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5224
5326
|
`${sliceName8}/createUser`,
|
|
5225
|
-
(
|
|
5226
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5227
|
-
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));
|
|
5228
|
-
}
|
|
5327
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar6(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
5229
5328
|
);
|
|
5230
5329
|
var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5231
5330
|
`${sliceName8}/removeUser`,
|
|
@@ -5236,15 +5335,12 @@ var removeUser = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5236
5335
|
);
|
|
5237
5336
|
var editUser = (0, import_toolkit24.createAsyncThunk)(
|
|
5238
5337
|
`${sliceName8}/editUser`,
|
|
5239
|
-
(
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
()
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
])
|
|
5246
|
-
);
|
|
5247
|
-
}
|
|
5338
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5339
|
+
() => Promise.all([
|
|
5340
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5341
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5342
|
+
])
|
|
5343
|
+
)
|
|
5248
5344
|
);
|
|
5249
5345
|
var addUserToCurrentTenant = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5250
5346
|
const { id } = getOrganization(getState());
|
|
@@ -5279,7 +5375,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5279
5375
|
}
|
|
5280
5376
|
return accu;
|
|
5281
5377
|
},
|
|
5282
|
-
|
|
5378
|
+
{ ...emptyUiPermissions }
|
|
5283
5379
|
);
|
|
5284
5380
|
var permissionActionTypes = {
|
|
5285
5381
|
any: mapHttpPermission,
|
|
@@ -5302,20 +5398,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5302
5398
|
}, existingPermissions);
|
|
5303
5399
|
var tryParseCustomPermission = (permission) => {
|
|
5304
5400
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5305
|
-
const result = mergePermissions(
|
|
5401
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5306
5402
|
return { isCustom: true, permission, result };
|
|
5307
5403
|
};
|
|
5308
5404
|
var customPermissionHandler = (accu, permission) => {
|
|
5309
5405
|
let processor = tryParseCustomPermission(permission);
|
|
5310
|
-
return
|
|
5406
|
+
return {
|
|
5407
|
+
...accu,
|
|
5311
5408
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5312
5409
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5313
|
-
}
|
|
5410
|
+
};
|
|
5314
5411
|
};
|
|
5315
5412
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5316
5413
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5317
5414
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5318
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5415
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5319
5416
|
};
|
|
5320
5417
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5321
5418
|
if (Array.isArray(permissions)) {
|
|
@@ -5330,60 +5427,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5330
5427
|
if (!processor) {
|
|
5331
5428
|
return accu;
|
|
5332
5429
|
}
|
|
5333
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5334
|
-
var _a;
|
|
5335
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5336
|
-
});
|
|
5430
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5337
5431
|
if (scope) {
|
|
5338
5432
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5339
|
-
return
|
|
5433
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5340
5434
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5341
5435
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5342
5436
|
}
|
|
5343
|
-
return
|
|
5437
|
+
return {
|
|
5438
|
+
...accu,
|
|
5344
5439
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5345
5440
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5346
|
-
}
|
|
5441
|
+
};
|
|
5347
5442
|
},
|
|
5348
|
-
{ isCustom: false, uiPermissions:
|
|
5443
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5349
5444
|
);
|
|
5350
5445
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5351
5446
|
};
|
|
5352
5447
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5353
5448
|
(accu, role) => {
|
|
5354
|
-
var _a;
|
|
5355
5449
|
let normalizedPermissions;
|
|
5356
5450
|
let isCustom = false;
|
|
5357
5451
|
if (rolesById2[role.name]) {
|
|
5358
|
-
normalizedPermissions =
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5452
|
+
normalizedPermissions = {
|
|
5453
|
+
...rolesById2[role.name].uiPermissions,
|
|
5454
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5455
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5456
|
+
};
|
|
5362
5457
|
} else {
|
|
5363
5458
|
const result = parseRolePermissions(role, permissionSets);
|
|
5364
5459
|
normalizedPermissions = result.uiPermissions;
|
|
5365
5460
|
isCustom = result.isCustom;
|
|
5366
5461
|
}
|
|
5367
|
-
const roleState =
|
|
5368
|
-
accu[role.name] =
|
|
5462
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5463
|
+
accu[role.name] = {
|
|
5464
|
+
...roleState,
|
|
5465
|
+
...role,
|
|
5369
5466
|
description: roleState.description ? roleState.description : role.description,
|
|
5370
5467
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5371
5468
|
isCustom,
|
|
5372
5469
|
name: roleState.name ? roleState.name : role.name,
|
|
5373
5470
|
uiPermissions: normalizedPermissions
|
|
5374
|
-
}
|
|
5471
|
+
};
|
|
5375
5472
|
return accu;
|
|
5376
5473
|
},
|
|
5377
|
-
|
|
5474
|
+
{ ...rolesById2 }
|
|
5378
5475
|
);
|
|
5379
5476
|
var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
5380
5477
|
`${sliceName8}/getPermissionSets`,
|
|
5381
5478
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5382
5479
|
const permissionSets = data.reduce(
|
|
5383
5480
|
(accu, permissionSet) => {
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5481
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5482
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5387
5483
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5388
5484
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5389
5485
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5394,11 +5490,10 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5394
5490
|
}
|
|
5395
5491
|
return collector;
|
|
5396
5492
|
}, accu2),
|
|
5397
|
-
|
|
5493
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5398
5494
|
);
|
|
5399
5495
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5400
|
-
|
|
5401
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5496
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5402
5497
|
accu2.push(key);
|
|
5403
5498
|
}
|
|
5404
5499
|
return accu2;
|
|
@@ -5411,7 +5506,7 @@ var getPermissionSets = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5411
5506
|
return accu;
|
|
5412
5507
|
},
|
|
5413
5508
|
// @ts-ignore
|
|
5414
|
-
|
|
5509
|
+
{ ...getState().users.permissionSetsById }
|
|
5415
5510
|
);
|
|
5416
5511
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5417
5512
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5444,28 +5539,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5444
5539
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5445
5540
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5446
5541
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5447
|
-
|
|
5448
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5542
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5449
5543
|
type: uiPermissionsByArea[area].scope,
|
|
5450
5544
|
value: []
|
|
5451
5545
|
};
|
|
5452
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5546
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5547
|
+
...permissionSetState,
|
|
5453
5548
|
value: [...permissionSetState.value, item]
|
|
5454
|
-
}
|
|
5549
|
+
};
|
|
5455
5550
|
return itemPermissionAccu;
|
|
5456
5551
|
}, accu);
|
|
5457
5552
|
return accu;
|
|
5458
5553
|
}, {});
|
|
5459
|
-
return Object.entries(permissionSetObject).map((
|
|
5460
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5554
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5461
5555
|
if (value.includes(excessiveAccessSelector)) {
|
|
5462
5556
|
return { name };
|
|
5463
5557
|
}
|
|
5464
|
-
return { name, scope:
|
|
5558
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers12.duplicateFilter) } };
|
|
5465
5559
|
});
|
|
5466
5560
|
};
|
|
5467
5561
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5468
|
-
const role =
|
|
5562
|
+
const role = { ...roleState, ...roleData };
|
|
5469
5563
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5470
5564
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5471
5565
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5501,12 +5595,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5501
5595
|
}, []);
|
|
5502
5596
|
return {
|
|
5503
5597
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5504
|
-
role:
|
|
5598
|
+
role: {
|
|
5599
|
+
...emptyRole,
|
|
5505
5600
|
name,
|
|
5506
5601
|
// @ts-ignore
|
|
5507
5602
|
description: description ? description : roleState.description,
|
|
5508
|
-
uiPermissions:
|
|
5509
|
-
|
|
5603
|
+
uiPermissions: {
|
|
5604
|
+
...emptyUiPermissions,
|
|
5605
|
+
...roleUiPermissions,
|
|
5606
|
+
...maybeUiPermissions
|
|
5607
|
+
}
|
|
5608
|
+
}
|
|
5510
5609
|
};
|
|
5511
5610
|
};
|
|
5512
5611
|
var roleActions = {
|
|
@@ -5557,13 +5656,12 @@ var getGlobalSettings2 = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5557
5656
|
var saveGlobalSettings = (0, import_toolkit24.createAsyncThunk)(
|
|
5558
5657
|
`${sliceName8}/saveGlobalSettings`,
|
|
5559
5658
|
// @ts-ignore
|
|
5560
|
-
(
|
|
5561
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5659
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5562
5660
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5563
5661
|
return;
|
|
5564
5662
|
}
|
|
5565
5663
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5566
|
-
let updatedSettings =
|
|
5664
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5567
5665
|
if (getCurrentUser(getState()).verified) {
|
|
5568
5666
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5569
5667
|
} else {
|
|
@@ -5601,10 +5699,17 @@ var saveUserSettings = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5601
5699
|
const userSettings = getUserSettings(getState());
|
|
5602
5700
|
const onboardingState = getOnboardingState(getState());
|
|
5603
5701
|
const tooltipState = getTooltipsState(getState());
|
|
5604
|
-
const updatedSettings =
|
|
5605
|
-
|
|
5702
|
+
const updatedSettings = {
|
|
5703
|
+
...userSettings,
|
|
5704
|
+
// @ts-ignore
|
|
5705
|
+
...settings,
|
|
5706
|
+
onboarding: {
|
|
5707
|
+
...onboardingState,
|
|
5708
|
+
// @ts-ignore
|
|
5709
|
+
...settings.onboarding
|
|
5710
|
+
},
|
|
5606
5711
|
tooltips: tooltipState
|
|
5607
|
-
}
|
|
5712
|
+
};
|
|
5608
5713
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5609
5714
|
return Promise.all([
|
|
5610
5715
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5630,9 +5735,10 @@ var getTokens = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5630
5735
|
`${sliceName8}/getTokens`,
|
|
5631
5736
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5632
5737
|
const user = getCurrentUser(getState());
|
|
5633
|
-
const updatedUser =
|
|
5738
|
+
const updatedUser = {
|
|
5739
|
+
...user,
|
|
5634
5740
|
tokens
|
|
5635
|
-
}
|
|
5741
|
+
};
|
|
5636
5742
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5637
5743
|
})
|
|
5638
5744
|
);
|
|
@@ -5648,8 +5754,7 @@ var revokeToken = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5648
5754
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5649
5755
|
)
|
|
5650
5756
|
);
|
|
5651
|
-
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5652
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5757
|
+
var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5653
5758
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5654
5759
|
if (persist) {
|
|
5655
5760
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5657,14 +5762,13 @@ var setTooltipReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/
|
|
|
5657
5762
|
return Promise.all(tasks);
|
|
5658
5763
|
});
|
|
5659
5764
|
var setAllTooltipsReadState = (0, import_toolkit24.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5660
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5765
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5661
5766
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5662
5767
|
});
|
|
5663
5768
|
var submitFeedback = (0, import_toolkit24.createAsyncThunk)(
|
|
5664
5769
|
`${sliceName8}/submitFeedback`,
|
|
5665
5770
|
// @ts-ignore
|
|
5666
|
-
(
|
|
5667
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5771
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5668
5772
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5669
5773
|
subject: "feedback submission",
|
|
5670
5774
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5675,43 +5779,4 @@ var submitFeedback = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5675
5779
|
});
|
|
5676
5780
|
}
|
|
5677
5781
|
);
|
|
5678
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5679
|
-
0 && (module.exports = {
|
|
5680
|
-
addUserToCurrentTenant,
|
|
5681
|
-
createRole,
|
|
5682
|
-
createUser,
|
|
5683
|
-
disableUser2fa,
|
|
5684
|
-
editRole,
|
|
5685
|
-
editUser,
|
|
5686
|
-
enableUser2fa,
|
|
5687
|
-
generateToken,
|
|
5688
|
-
get2FAQRCode,
|
|
5689
|
-
getGlobalSettings,
|
|
5690
|
-
getPermissionSets,
|
|
5691
|
-
getRoles,
|
|
5692
|
-
getTokens,
|
|
5693
|
-
getUser,
|
|
5694
|
-
getUserList,
|
|
5695
|
-
getUserSettings,
|
|
5696
|
-
initializeSelf,
|
|
5697
|
-
loginUser,
|
|
5698
|
-
logoutUser,
|
|
5699
|
-
normalizeRbacRoles,
|
|
5700
|
-
passwordResetComplete,
|
|
5701
|
-
passwordResetStart,
|
|
5702
|
-
removeRole,
|
|
5703
|
-
removeUser,
|
|
5704
|
-
revokeToken,
|
|
5705
|
-
saveGlobalSettings,
|
|
5706
|
-
saveUserSettings,
|
|
5707
|
-
setAllTooltipsReadState,
|
|
5708
|
-
setHideAnnouncement,
|
|
5709
|
-
setTooltipReadState,
|
|
5710
|
-
submitFeedback,
|
|
5711
|
-
switchUserOrganization,
|
|
5712
|
-
updateUserColumnSettings,
|
|
5713
|
-
verify2FA,
|
|
5714
|
-
verifyEmailComplete,
|
|
5715
|
-
verifyEmailStart
|
|
5716
|
-
});
|
|
5717
5782
|
//# sourceMappingURL=thunks.js.map
|