@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 = {};
|
|
@@ -467,7 +417,7 @@ var chartTypes = {
|
|
|
467
417
|
};
|
|
468
418
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
469
419
|
var defaultReportType = "distribution";
|
|
470
|
-
var defaultReports = [
|
|
420
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
471
421
|
var locations = {};
|
|
472
422
|
var PLANS = {
|
|
473
423
|
os: {
|
|
@@ -793,13 +743,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
793
743
|
deployments: [],
|
|
794
744
|
groups: Object.freeze({}),
|
|
795
745
|
releases: Object.freeze({}),
|
|
746
|
+
tenantManagement: [],
|
|
796
747
|
userManagement: []
|
|
797
748
|
});
|
|
798
749
|
var emptyRole = Object.freeze({
|
|
799
750
|
name: void 0,
|
|
800
751
|
description: "",
|
|
801
752
|
permissions: [],
|
|
802
|
-
uiPermissions: Object.freeze(
|
|
753
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
803
754
|
});
|
|
804
755
|
|
|
805
756
|
// src/deploymentsSlice/constants.ts
|
|
@@ -828,11 +779,12 @@ var deploymentStatesToSubstates = {
|
|
|
828
779
|
pending: [deploymentSubstates.pending],
|
|
829
780
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
830
781
|
};
|
|
831
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
782
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
783
|
+
...deploymentStatesToSubstates,
|
|
832
784
|
failures: [deploymentSubstates.failure],
|
|
833
785
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
834
786
|
successes: [deploymentSubstates.success]
|
|
835
|
-
}
|
|
787
|
+
};
|
|
836
788
|
var installationSubstatesMap = {
|
|
837
789
|
download: {
|
|
838
790
|
title: "download",
|
|
@@ -877,8 +829,8 @@ var DEPLOYMENT_STATES = {
|
|
|
877
829
|
var listDefaultsByState = {
|
|
878
830
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
879
831
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
880
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
881
|
-
[DEPLOYMENT_STATES.finished]:
|
|
832
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
833
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
882
834
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
883
835
|
};
|
|
884
836
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1040,6 +992,13 @@ var SSO_TYPES = {
|
|
|
1040
992
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1041
993
|
}
|
|
1042
994
|
};
|
|
995
|
+
var AUDIT_LOGS_TYPES = [
|
|
996
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
997
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
998
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
999
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1000
|
+
];
|
|
1001
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1043
1002
|
var emptyWebhook = {
|
|
1044
1003
|
description: "",
|
|
1045
1004
|
enabled: true,
|
|
@@ -1088,10 +1047,12 @@ var permissionSetIds = {
|
|
|
1088
1047
|
DeployToDevices: "DeployToDevices",
|
|
1089
1048
|
ManageDevices: "ManageDevices",
|
|
1090
1049
|
ManageReleases: "ManageReleases",
|
|
1050
|
+
ManageTenants: "ManageTenants",
|
|
1091
1051
|
ManageUsers: "ManageUsers",
|
|
1092
1052
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1093
1053
|
ReadDevices: "ReadDevices",
|
|
1094
1054
|
ReadReleases: "ReadReleases",
|
|
1055
|
+
ReadTenants: "ReadTenants",
|
|
1095
1056
|
ReadUsers: "ReadUsers",
|
|
1096
1057
|
SuperUser: "SuperUser",
|
|
1097
1058
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1130,6 +1091,7 @@ var uiPermissionsById = {
|
|
|
1130
1091
|
permissionSets: {
|
|
1131
1092
|
groups: permissionSetIds.ManageDevices,
|
|
1132
1093
|
releases: permissionSetIds.ManageReleases,
|
|
1094
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1133
1095
|
userManagement: permissionSetIds.ManageUsers
|
|
1134
1096
|
},
|
|
1135
1097
|
title: "Manage",
|
|
@@ -1143,6 +1105,7 @@ var uiPermissionsById = {
|
|
|
1143
1105
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1144
1106
|
groups: permissionSetIds.ReadDevices,
|
|
1145
1107
|
releases: permissionSetIds.ReadReleases,
|
|
1108
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1146
1109
|
userManagement: permissionSetIds.ReadUsers
|
|
1147
1110
|
},
|
|
1148
1111
|
title: "Read",
|
|
@@ -1167,6 +1130,7 @@ var uiPermissionsByArea = {
|
|
|
1167
1130
|
auditlog: {
|
|
1168
1131
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1169
1132
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1133
|
+
key: "auditlog",
|
|
1170
1134
|
uiPermissions: [uiPermissionsById.read],
|
|
1171
1135
|
title: "System audit log"
|
|
1172
1136
|
},
|
|
@@ -1177,6 +1141,7 @@ var uiPermissionsByArea = {
|
|
|
1177
1141
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1178
1142
|
],
|
|
1179
1143
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1144
|
+
key: "deployments",
|
|
1180
1145
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1181
1146
|
title: "Deployments"
|
|
1182
1147
|
},
|
|
@@ -1192,6 +1157,7 @@ var uiPermissionsByArea = {
|
|
|
1192
1157
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1193
1158
|
],
|
|
1194
1159
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1160
|
+
key: "groups",
|
|
1195
1161
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1196
1162
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1197
1163
|
title: "Group Management"
|
|
@@ -1211,22 +1177,35 @@ var uiPermissionsByArea = {
|
|
|
1211
1177
|
}
|
|
1212
1178
|
],
|
|
1213
1179
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1180
|
+
key: "releases",
|
|
1214
1181
|
scope: "ReleaseTags",
|
|
1215
1182
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1216
1183
|
title: "Release Management"
|
|
1217
1184
|
},
|
|
1185
|
+
tenantManagement: {
|
|
1186
|
+
endpoints: [
|
|
1187
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1188
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1189
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1190
|
+
],
|
|
1191
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1192
|
+
key: "tenantManagement",
|
|
1193
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1194
|
+
title: "Tenant Management"
|
|
1195
|
+
},
|
|
1218
1196
|
userManagement: {
|
|
1219
1197
|
endpoints: [
|
|
1220
1198
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1221
1199
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1222
1200
|
],
|
|
1223
1201
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1202
|
+
key: "userManagement",
|
|
1224
1203
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1225
1204
|
title: "User Management"
|
|
1226
1205
|
}
|
|
1227
1206
|
};
|
|
1228
1207
|
var permissionMapper = (permission) => permission.value;
|
|
1229
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1208
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1230
1209
|
var rolesById = Object.freeze({
|
|
1231
1210
|
[staticRolesByName.admin]: {
|
|
1232
1211
|
name: "Admin",
|
|
@@ -1234,56 +1213,87 @@ var rolesById = Object.freeze({
|
|
|
1234
1213
|
description: "Full access",
|
|
1235
1214
|
permissions: [],
|
|
1236
1215
|
// permissions refers to the values returned from the backend
|
|
1237
|
-
uiPermissions:
|
|
1216
|
+
uiPermissions: {
|
|
1217
|
+
...emptyUiPermissions,
|
|
1238
1218
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1239
1219
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1240
1220
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1241
1221
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1242
1222
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1243
|
-
}
|
|
1223
|
+
}
|
|
1244
1224
|
},
|
|
1245
1225
|
[staticRolesByName.readOnly]: {
|
|
1246
1226
|
name: "Read Access",
|
|
1247
1227
|
value: staticRolesByName.readOnly,
|
|
1248
1228
|
description: "",
|
|
1249
1229
|
permissions: [],
|
|
1250
|
-
uiPermissions:
|
|
1230
|
+
uiPermissions: {
|
|
1231
|
+
...emptyUiPermissions,
|
|
1251
1232
|
deployments: [uiPermissionsById.read.value],
|
|
1252
1233
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1253
1234
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1254
1235
|
userManagement: [uiPermissionsById.read.value]
|
|
1255
|
-
}
|
|
1236
|
+
}
|
|
1256
1237
|
},
|
|
1257
1238
|
[staticRolesByName.ci]: {
|
|
1258
1239
|
name: "Releases Manager",
|
|
1259
1240
|
value: staticRolesByName.ci,
|
|
1260
1241
|
description: "",
|
|
1261
1242
|
permissions: [],
|
|
1262
|
-
uiPermissions:
|
|
1243
|
+
uiPermissions: {
|
|
1244
|
+
...emptyUiPermissions,
|
|
1263
1245
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1264
|
-
}
|
|
1246
|
+
}
|
|
1265
1247
|
},
|
|
1266
1248
|
[staticRolesByName.deploymentsManager]: {
|
|
1267
1249
|
name: "Deployments Manager",
|
|
1268
1250
|
value: staticRolesByName.deploymentsManager,
|
|
1269
1251
|
description: "",
|
|
1270
1252
|
permissions: [],
|
|
1271
|
-
uiPermissions:
|
|
1253
|
+
uiPermissions: {
|
|
1254
|
+
...emptyUiPermissions,
|
|
1272
1255
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1273
1256
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1274
1257
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1275
|
-
}
|
|
1258
|
+
}
|
|
1276
1259
|
},
|
|
1277
1260
|
[staticRolesByName.terminalAccess]: {
|
|
1278
1261
|
name: "Troubleshooting",
|
|
1279
1262
|
value: staticRolesByName.terminalAccess,
|
|
1280
1263
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1281
1264
|
permissions: [],
|
|
1282
|
-
uiPermissions:
|
|
1265
|
+
uiPermissions: {
|
|
1266
|
+
...emptyUiPermissions,
|
|
1283
1267
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1284
|
-
}
|
|
1268
|
+
}
|
|
1285
1269
|
}
|
|
1286
1270
|
});
|
|
1271
|
+
var serviceProviderRolesById = {
|
|
1272
|
+
admin: {
|
|
1273
|
+
name: "Admin",
|
|
1274
|
+
value: staticRolesByName.admin,
|
|
1275
|
+
description: "Full access",
|
|
1276
|
+
permissions: [],
|
|
1277
|
+
uiPermissions: {
|
|
1278
|
+
...emptyUiPermissions,
|
|
1279
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1280
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1281
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
readOnly: {
|
|
1285
|
+
name: "Read access",
|
|
1286
|
+
value: staticRolesByName.admin,
|
|
1287
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1288
|
+
permissions: [],
|
|
1289
|
+
uiPermissions: {
|
|
1290
|
+
...emptyUiPermissions,
|
|
1291
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1292
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1293
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1287
1297
|
var defaultPermissionSets = {
|
|
1288
1298
|
[permissionSetIds.Basic]: {
|
|
1289
1299
|
name: permissionSetIds.Basic,
|
|
@@ -1294,7 +1304,9 @@ var defaultPermissionSets = {
|
|
|
1294
1304
|
},
|
|
1295
1305
|
[permissionSetIds.SuperUser]: {
|
|
1296
1306
|
name: permissionSetIds.SuperUser,
|
|
1297
|
-
result:
|
|
1307
|
+
result: {
|
|
1308
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1309
|
+
}
|
|
1298
1310
|
},
|
|
1299
1311
|
[permissionSetIds.ManageUsers]: {
|
|
1300
1312
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1314,6 +1326,18 @@ var defaultPermissionSets = {
|
|
|
1314
1326
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1315
1327
|
}
|
|
1316
1328
|
},
|
|
1329
|
+
[permissionSetIds.ReadTenants]: {
|
|
1330
|
+
name: permissionSetIds.ReadTenants,
|
|
1331
|
+
result: {
|
|
1332
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
[permissionSetIds.ManageTenants]: {
|
|
1336
|
+
name: permissionSetIds.ManageTenants,
|
|
1337
|
+
result: {
|
|
1338
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1317
1341
|
[permissionSetIds.ReadUsers]: {
|
|
1318
1342
|
name: permissionSetIds.ReadUsers,
|
|
1319
1343
|
result: {
|
|
@@ -1367,11 +1391,12 @@ var defaultPermissionSets = {
|
|
|
1367
1391
|
};
|
|
1368
1392
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1369
1393
|
var OWN_USER_ID = "me";
|
|
1370
|
-
var rolesByName =
|
|
1394
|
+
var rolesByName = {
|
|
1395
|
+
...staticRolesByName,
|
|
1371
1396
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1372
1397
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1373
1398
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1374
|
-
}
|
|
1399
|
+
};
|
|
1375
1400
|
var twoFAStates = {
|
|
1376
1401
|
enabled: "enabled",
|
|
1377
1402
|
disabled: "disabled",
|
|
@@ -1398,10 +1423,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
1398
1423
|
var getSearchedDevices = (0, import_toolkit.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
1399
1424
|
var getVersionInformation = (0, import_toolkit.createSelector)(
|
|
1400
1425
|
[getFullVersionInformation, getFeatures],
|
|
1401
|
-
(
|
|
1402
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
1403
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
1404
|
-
}
|
|
1426
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
1405
1427
|
);
|
|
1406
1428
|
var getIsPreview = (0, import_toolkit.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers.versionCompare)(Integration, "next") > -1);
|
|
1407
1429
|
|
|
@@ -1418,8 +1440,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
1418
1440
|
var getMappedDeploymentSelection = (0, import_toolkit2.createSelector)(
|
|
1419
1441
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
1420
1442
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
1421
|
-
|
|
1422
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
1443
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
1423
1444
|
return selection.reduce((accu, id) => {
|
|
1424
1445
|
if (deploymentsById[id]) {
|
|
1425
1446
|
accu.push(deploymentsById[id]);
|
|
@@ -1463,7 +1484,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
1463
1484
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
1464
1485
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
1465
1486
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
1466
|
-
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
1487
|
+
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
1488
|
+
...filteringAttributes,
|
|
1467
1489
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
1468
1490
|
}));
|
|
1469
1491
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -1491,10 +1513,7 @@ var getDeviceCountsByStatus = (0, import_toolkit3.createSelector)(
|
|
|
1491
1513
|
return accu;
|
|
1492
1514
|
}, {})
|
|
1493
1515
|
);
|
|
1494
|
-
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
1495
|
-
var _a;
|
|
1496
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
1497
|
-
});
|
|
1516
|
+
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
1498
1517
|
var getSelectedGroupInfo = (0, import_toolkit3.createSelector)(
|
|
1499
1518
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
1500
1519
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -1511,17 +1530,13 @@ var getLimitMaxed = (0, import_toolkit3.createSelector)(
|
|
|
1511
1530
|
[getAcceptedDevices, getDeviceLimit],
|
|
1512
1531
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
1513
1532
|
);
|
|
1514
|
-
var
|
|
1515
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], (_a) => {
|
|
1516
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
1517
|
-
return groups;
|
|
1518
|
-
});
|
|
1533
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
1519
1534
|
var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById) => {
|
|
1520
1535
|
const groupNames = Object.keys(groupsById).sort();
|
|
1521
1536
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
1522
1537
|
(accu, [groupname, group]) => {
|
|
1523
1538
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
1524
|
-
const groupItem =
|
|
1539
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
1525
1540
|
if (group.filters.length > 0) {
|
|
1526
1541
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
1527
1542
|
accu.dynamic.push(groupItem);
|
|
@@ -1535,7 +1550,7 @@ var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById
|
|
|
1535
1550
|
},
|
|
1536
1551
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
1537
1552
|
);
|
|
1538
|
-
return
|
|
1553
|
+
return { groupNames, ...groupedGroups };
|
|
1539
1554
|
});
|
|
1540
1555
|
var getAttributesList = (0, import_toolkit3.createSelector)(
|
|
1541
1556
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -1570,15 +1585,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
1570
1585
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
1571
1586
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
1572
1587
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
1573
|
-
var getTenantsList = (state) => state.organization.
|
|
1588
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
1574
1589
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
1575
1590
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
1576
1591
|
var getDeviceTwinIntegrations = (0, import_toolkit4.createSelector)(
|
|
1577
1592
|
[getExternalIntegrations],
|
|
1578
|
-
(integrations) => integrations.filter((integration) =>
|
|
1579
|
-
var _a;
|
|
1580
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
1581
|
-
})
|
|
1593
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
1582
1594
|
);
|
|
1583
1595
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
1584
1596
|
var getWebhooks = (0, import_toolkit4.createSelector)(
|
|
@@ -1612,15 +1624,12 @@ var filterProcessors = {
|
|
|
1612
1624
|
var filterAliases = {
|
|
1613
1625
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
1614
1626
|
};
|
|
1615
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1622
|
-
};
|
|
1623
|
-
});
|
|
1627
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
1628
|
+
scope: filter.scope,
|
|
1629
|
+
attribute: filter.key,
|
|
1630
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
1631
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1632
|
+
}));
|
|
1624
1633
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
1625
1634
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
1626
1635
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -1630,14 +1639,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
1630
1639
|
});
|
|
1631
1640
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
1632
1641
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
1633
|
-
return
|
|
1642
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
1634
1643
|
}
|
|
1635
1644
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
1636
1645
|
});
|
|
1637
1646
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
1638
|
-
var _a;
|
|
1639
1647
|
let applicableFilters = [...filters];
|
|
1640
|
-
if (typeof group === "string" && !(
|
|
1648
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
1641
1649
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
1642
1650
|
}
|
|
1643
1651
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -1658,12 +1666,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
1658
1666
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
1659
1667
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
1660
1668
|
if (id && byId[id]) {
|
|
1661
|
-
accu.push(
|
|
1669
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
1662
1670
|
}
|
|
1663
1671
|
return accu;
|
|
1664
1672
|
}, []);
|
|
1665
1673
|
};
|
|
1666
|
-
var mergePermissions = (existingPermissions =
|
|
1674
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
1667
1675
|
(accu, [key, value]) => {
|
|
1668
1676
|
let values;
|
|
1669
1677
|
if (!accu[key]) {
|
|
@@ -1673,12 +1681,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
1673
1681
|
if (Array.isArray(value)) {
|
|
1674
1682
|
values = [...value, ...accu[key]].filter(import_helpers3.duplicateFilter);
|
|
1675
1683
|
} else {
|
|
1676
|
-
values = mergePermissions(accu[key],
|
|
1684
|
+
values = mergePermissions(accu[key], { ...value });
|
|
1677
1685
|
}
|
|
1678
1686
|
accu[key] = values;
|
|
1679
1687
|
return accu;
|
|
1680
1688
|
},
|
|
1681
|
-
|
|
1689
|
+
{ ...addedPermissions }
|
|
1682
1690
|
);
|
|
1683
1691
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
1684
1692
|
(accu, roleId) => {
|
|
@@ -1687,20 +1695,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
1687
1695
|
}
|
|
1688
1696
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
1689
1697
|
},
|
|
1690
|
-
|
|
1698
|
+
{ ...emptyUiPermissions }
|
|
1691
1699
|
);
|
|
1692
1700
|
var progress = ({ loaded, total }) => {
|
|
1693
1701
|
let uploadProgress4 = loaded / total * 100;
|
|
1694
1702
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
1695
1703
|
};
|
|
1696
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
1697
|
-
var _a, _b2, _c, _d, _e;
|
|
1698
|
-
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;
|
|
1699
|
-
};
|
|
1704
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
1700
1705
|
var preformatWithRequestID = (res, failMsg) => {
|
|
1701
1706
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
1702
1707
|
try {
|
|
1703
|
-
if (
|
|
1708
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
1704
1709
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
1705
1710
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
1706
1711
|
}
|
|
@@ -1715,9 +1720,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
1715
1720
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1716
1721
|
return accu;
|
|
1717
1722
|
}
|
|
1718
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
1723
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
1724
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
1719
1725
|
[attribute.name]: attribute.value
|
|
1720
|
-
}
|
|
1726
|
+
};
|
|
1721
1727
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1722
1728
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
1723
1729
|
}
|
|
@@ -1736,15 +1742,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
1736
1742
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
1737
1743
|
var getReleaseMappingDefaults = () => ({});
|
|
1738
1744
|
var getReleasesList = (0, import_toolkit5.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
1739
|
-
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
1745
|
+
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
1740
1746
|
var getHasReleases = (0, import_toolkit5.createSelector)(
|
|
1741
1747
|
[getReleaseListState, getReleasesById],
|
|
1742
1748
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
1743
1749
|
);
|
|
1744
|
-
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
1745
|
-
var _a;
|
|
1746
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
1747
|
-
});
|
|
1750
|
+
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
1748
1751
|
|
|
1749
1752
|
// src/usersSlice/selectors.ts
|
|
1750
1753
|
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
@@ -1753,10 +1756,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
1753
1756
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
1754
1757
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
1755
1758
|
var getUsersById = (state) => state.users.byId;
|
|
1756
|
-
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
1757
|
-
var _a;
|
|
1758
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
1759
|
-
});
|
|
1759
|
+
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
1760
1760
|
var getUserSettings = (state) => state.users.userSettings;
|
|
1761
1761
|
var getIsDarkMode = (0, import_toolkit6.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
1762
1762
|
var getShowHelptips = (0, import_toolkit6.createSelector)(
|
|
@@ -1767,22 +1767,22 @@ var getTooltipsState = (0, import_toolkit6.createSelector)(
|
|
|
1767
1767
|
[getTooltipsById, getUserSettings],
|
|
1768
1768
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
1769
1769
|
(accu, [id, value]) => {
|
|
1770
|
-
accu[id] =
|
|
1770
|
+
accu[id] = { ...accu[id], ...value };
|
|
1771
1771
|
return accu;
|
|
1772
1772
|
},
|
|
1773
|
-
|
|
1773
|
+
{ ...tooltips }
|
|
1774
1774
|
)
|
|
1775
1775
|
);
|
|
1776
1776
|
var getHas2FA = (0, import_toolkit6.createSelector)(
|
|
1777
1777
|
[getCurrentUser],
|
|
1778
1778
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
1779
1779
|
);
|
|
1780
|
-
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
1780
|
+
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
1781
1781
|
var getOfflineThresholdSettings = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
1782
|
-
interval:
|
|
1783
|
-
intervalUnit:
|
|
1782
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
1783
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
1784
1784
|
}));
|
|
1785
|
-
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
1785
|
+
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
1786
1786
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
1787
1787
|
|
|
1788
1788
|
// src/commonSelectors.ts
|
|
@@ -1801,8 +1801,7 @@ var getSearchEndpoint = (0, import_toolkit7.createSelector)(
|
|
|
1801
1801
|
var getUserRoles = (0, import_toolkit7.createSelector)(
|
|
1802
1802
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
1803
1803
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
1804
|
-
|
|
1805
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1804
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1806
1805
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
1807
1806
|
return { isAdmin, uiPermissions };
|
|
1808
1807
|
}
|
|
@@ -1871,10 +1870,11 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1871
1870
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
1872
1871
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
1873
1872
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1874
|
-
const updateAttribute =
|
|
1873
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
1875
1874
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1876
1875
|
const attributes = [
|
|
1877
|
-
...previousFilters.map((item) =>
|
|
1876
|
+
...previousFilters.map((item) => ({
|
|
1877
|
+
...item,
|
|
1878
1878
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
1879
1879
|
category: "recently used",
|
|
1880
1880
|
priority: 0
|
|
@@ -1892,14 +1892,13 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1892
1892
|
return (0, import_helpers4.attributeDuplicateFilter)(attributes, "key");
|
|
1893
1893
|
}
|
|
1894
1894
|
);
|
|
1895
|
-
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], (
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
});
|
|
1895
|
+
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
1896
|
+
...remainder,
|
|
1897
|
+
...onboarding,
|
|
1898
|
+
complete: onboarding.complete || complete,
|
|
1899
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
1900
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
1901
|
+
}));
|
|
1903
1902
|
var getDemoDeviceAddress = (0, import_toolkit7.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
1904
1903
|
const demoDeviceAddress = `http://${(0, import_helpers4.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
1905
1904
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -1920,12 +1919,11 @@ var getDeploymentRelease = (0, import_toolkit7.createSelector)(
|
|
|
1920
1919
|
var getSelectedDeploymentData = (0, import_toolkit7.createSelector)(
|
|
1921
1920
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
1922
1921
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
1923
|
-
|
|
1924
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
1922
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
1925
1923
|
const { devices = {} } = deployment;
|
|
1926
1924
|
return {
|
|
1927
1925
|
deployment,
|
|
1928
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
1926
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
1929
1927
|
};
|
|
1930
1928
|
}
|
|
1931
1929
|
);
|
|
@@ -1940,8 +1938,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit7.createSelector)(
|
|
|
1940
1938
|
}, {})
|
|
1941
1939
|
);
|
|
1942
1940
|
var getGroupNames = (0, import_toolkit7.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
1943
|
-
|
|
1944
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
1941
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
1945
1942
|
if (staticOnly) {
|
|
1946
1943
|
return Object.keys(uiPermissions.groups).sort();
|
|
1947
1944
|
}
|
|
@@ -1975,9 +1972,25 @@ var getAuditlogDevice = (0, import_toolkit7.createSelector)([getAuditLogEntry, g
|
|
|
1975
1972
|
if (auditlogEvent) {
|
|
1976
1973
|
const { object = {} } = auditlogEvent;
|
|
1977
1974
|
const { device = {}, id, type } = object;
|
|
1978
|
-
auditlogDevice = type === "device" ?
|
|
1975
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
1979
1976
|
}
|
|
1980
|
-
return
|
|
1977
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
1978
|
+
});
|
|
1979
|
+
var getRelevantRoles = (0, import_toolkit7.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
1980
|
+
if (service_provider) {
|
|
1981
|
+
return roles.reduce((accu, role) => {
|
|
1982
|
+
if (rolesById[role.id]) {
|
|
1983
|
+
return accu;
|
|
1984
|
+
}
|
|
1985
|
+
accu.push(role);
|
|
1986
|
+
return accu;
|
|
1987
|
+
}, Object.values(serviceProviderRolesById));
|
|
1988
|
+
}
|
|
1989
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
1990
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
1991
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
1992
|
+
return accu;
|
|
1993
|
+
}, roles);
|
|
1981
1994
|
});
|
|
1982
1995
|
|
|
1983
1996
|
// src/api/general-api.ts
|
|
@@ -1989,18 +2002,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
1989
2002
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
1990
2003
|
var tokenCache = "";
|
|
1991
2004
|
var getSessionInfo = () => {
|
|
1992
|
-
|
|
1993
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2005
|
+
let sessionInfo = { ...emptySession };
|
|
1994
2006
|
try {
|
|
1995
|
-
sessionInfo = JSON.parse(
|
|
1996
|
-
} catch
|
|
2007
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2008
|
+
} catch {
|
|
1997
2009
|
}
|
|
1998
2010
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
1999
2011
|
cleanUp();
|
|
2000
|
-
return
|
|
2012
|
+
return { ...emptySession };
|
|
2001
2013
|
}
|
|
2002
2014
|
if (!sessionInfo.token) {
|
|
2003
|
-
let jwtTokenFromCookie =
|
|
2015
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2004
2016
|
if (jwtTokenFromCookie) {
|
|
2005
2017
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2006
2018
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2028,8 +2040,7 @@ var maxSessionAge = 900;
|
|
|
2028
2040
|
|
|
2029
2041
|
// src/api/general-api.ts
|
|
2030
2042
|
var unauthorizedRedirect = (error) => {
|
|
2031
|
-
|
|
2032
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2043
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2033
2044
|
cleanUp();
|
|
2034
2045
|
window.location.replace("/ui/");
|
|
2035
2046
|
}
|
|
@@ -2039,7 +2050,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2039
2050
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2040
2051
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2041
2052
|
authenticatedRequest.interceptors.request.use(
|
|
2042
|
-
(config) =>
|
|
2053
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2043
2054
|
(error) => Promise.reject(error)
|
|
2044
2055
|
);
|
|
2045
2056
|
var Api = {
|
|
@@ -2047,7 +2058,7 @@ var Api = {
|
|
|
2047
2058
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2048
2059
|
patch: authenticatedRequest.patch,
|
|
2049
2060
|
post: authenticatedRequest.post,
|
|
2050
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2061
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2051
2062
|
put: authenticatedRequest.put,
|
|
2052
2063
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2053
2064
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2144,7 +2155,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2144
2155
|
initialState,
|
|
2145
2156
|
reducers: {
|
|
2146
2157
|
setFeatures: (state, action) => {
|
|
2147
|
-
state.features =
|
|
2158
|
+
state.features = {
|
|
2159
|
+
...state.features,
|
|
2160
|
+
...action.payload
|
|
2161
|
+
};
|
|
2148
2162
|
},
|
|
2149
2163
|
setSnackbar: (state, { payload }) => {
|
|
2150
2164
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -2169,7 +2183,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2169
2183
|
state.hostedAnnouncement = action.payload;
|
|
2170
2184
|
},
|
|
2171
2185
|
setSearchState: (state, action) => {
|
|
2172
|
-
state.searchState =
|
|
2186
|
+
state.searchState = {
|
|
2187
|
+
...state.searchState,
|
|
2188
|
+
...action.payload
|
|
2189
|
+
};
|
|
2173
2190
|
},
|
|
2174
2191
|
setOfflineThreshold: (state, action) => {
|
|
2175
2192
|
state.offlineThreshold = action.payload;
|
|
@@ -2180,20 +2197,23 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2180
2197
|
},
|
|
2181
2198
|
uploadProgress: (state, action) => {
|
|
2182
2199
|
const { id, progress: progress2 } = action.payload;
|
|
2183
|
-
state.uploadsById[id] =
|
|
2200
|
+
state.uploadsById[id] = {
|
|
2201
|
+
...state.uploadsById[id],
|
|
2184
2202
|
progress: progress2
|
|
2185
|
-
}
|
|
2203
|
+
};
|
|
2186
2204
|
},
|
|
2187
2205
|
cleanUpUpload: (state, action) => {
|
|
2188
|
-
|
|
2189
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2206
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
2190
2207
|
state.uploadsById = remainder;
|
|
2191
2208
|
},
|
|
2192
2209
|
setVersionInformation: (state, action) => {
|
|
2193
|
-
state.versionInformation =
|
|
2210
|
+
state.versionInformation = {
|
|
2211
|
+
...state.versionInformation,
|
|
2212
|
+
...action.payload
|
|
2213
|
+
};
|
|
2194
2214
|
},
|
|
2195
2215
|
setEnvironmentData: (state, action) => {
|
|
2196
|
-
return
|
|
2216
|
+
return { ...state, ...action.payload };
|
|
2197
2217
|
}
|
|
2198
2218
|
}
|
|
2199
2219
|
});
|
|
@@ -2211,17 +2231,16 @@ var dateFunctionMap = {
|
|
|
2211
2231
|
setDays: "setDate"
|
|
2212
2232
|
};
|
|
2213
2233
|
var setOfflineThreshold = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2214
|
-
var _a, _b2;
|
|
2215
2234
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2216
2235
|
const today = /* @__PURE__ */ new Date();
|
|
2217
2236
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2218
|
-
const setter =
|
|
2219
|
-
const getter =
|
|
2237
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
2238
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2220
2239
|
today[setter](today[getter]() - interval);
|
|
2221
2240
|
let value;
|
|
2222
2241
|
try {
|
|
2223
2242
|
value = today.toISOString();
|
|
2224
|
-
} catch
|
|
2243
|
+
} catch {
|
|
2225
2244
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2226
2245
|
}
|
|
2227
2246
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -2262,37 +2281,43 @@ var getLatestReleaseInfo = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/g
|
|
|
2262
2281
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
2263
2282
|
return accu;
|
|
2264
2283
|
},
|
|
2265
|
-
{ latestVersions:
|
|
2284
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
2266
2285
|
);
|
|
2267
2286
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
2268
2287
|
return Promise.resolve(
|
|
2269
2288
|
dispatch(
|
|
2270
|
-
actions.setVersionInformation(
|
|
2289
|
+
actions.setVersionInformation({
|
|
2290
|
+
...latestVersions,
|
|
2271
2291
|
backend: info,
|
|
2272
2292
|
GUI: info,
|
|
2273
2293
|
latestRelease: {
|
|
2274
2294
|
releaseDate: latestRelease.release_date,
|
|
2275
2295
|
repos: latestRepos
|
|
2276
2296
|
}
|
|
2277
|
-
})
|
|
2297
|
+
})
|
|
2278
2298
|
)
|
|
2279
2299
|
);
|
|
2280
2300
|
});
|
|
2281
2301
|
});
|
|
2282
2302
|
var setSearchState = (0, import_toolkit9.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
2283
2303
|
const currentState = getSearchState(getState());
|
|
2284
|
-
let nextState =
|
|
2285
|
-
|
|
2286
|
-
|
|
2304
|
+
let nextState = {
|
|
2305
|
+
...currentState,
|
|
2306
|
+
...searchState,
|
|
2307
|
+
sort: {
|
|
2308
|
+
...currentState.sort,
|
|
2309
|
+
...searchState.sort
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2287
2312
|
let tasks = [];
|
|
2288
|
-
const
|
|
2289
|
-
const
|
|
2313
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
2314
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
2290
2315
|
if (nextRequestState.searchTerm && !(0, import_helpers5.deepCompare)(currentRequestState, nextRequestState)) {
|
|
2291
2316
|
nextState.isSearching = true;
|
|
2292
2317
|
tasks.push(
|
|
2293
2318
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
2294
2319
|
const searchResult = results[results.length - 1];
|
|
2295
|
-
return dispatch(actions.setSearchState(
|
|
2320
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
2296
2321
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
2297
2322
|
);
|
|
2298
2323
|
}
|
|
@@ -2325,7 +2350,7 @@ var initialState2 = {
|
|
|
2325
2350
|
sourceWindow: -1
|
|
2326
2351
|
},
|
|
2327
2352
|
binaryDeltaLimits: {
|
|
2328
|
-
timeout:
|
|
2353
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
2329
2354
|
sourceWindow: limitDefault,
|
|
2330
2355
|
inputWindow: limitDefault,
|
|
2331
2356
|
duplicatesWindow: limitDefault,
|
|
@@ -2335,10 +2360,10 @@ var initialState2 = {
|
|
|
2335
2360
|
deploymentDeviceLimit: 5e3,
|
|
2336
2361
|
selectedDeviceIds: [],
|
|
2337
2362
|
selectionState: {
|
|
2338
|
-
finished:
|
|
2339
|
-
inprogress:
|
|
2340
|
-
pending:
|
|
2341
|
-
scheduled:
|
|
2363
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
2364
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2365
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2366
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
2342
2367
|
general: {
|
|
2343
2368
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
2344
2369
|
showCreationDialog: false,
|
|
@@ -2354,40 +2379,55 @@ var deploymentsSlice = (0, import_toolkit10.createSlice)({
|
|
|
2354
2379
|
initialState: initialState2,
|
|
2355
2380
|
reducers: {
|
|
2356
2381
|
createdDeployment: (state, action) => {
|
|
2357
|
-
state.byId[action.payload.id] =
|
|
2382
|
+
state.byId[action.payload.id] = {
|
|
2383
|
+
...deploymentPrototype,
|
|
2384
|
+
...action.payload
|
|
2385
|
+
};
|
|
2358
2386
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
2359
2387
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
2360
2388
|
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;
|
|
2361
2389
|
},
|
|
2362
2390
|
removedDeployment: (state, action) => {
|
|
2363
|
-
|
|
2364
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2391
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
2365
2392
|
state.byId = remainder;
|
|
2366
2393
|
},
|
|
2367
2394
|
receivedDeployment: (state, action) => {
|
|
2368
|
-
state.byId[action.payload.id] =
|
|
2395
|
+
state.byId[action.payload.id] = {
|
|
2396
|
+
...state.byId[action.payload.id] || {},
|
|
2397
|
+
...action.payload
|
|
2398
|
+
};
|
|
2369
2399
|
},
|
|
2370
2400
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
2371
2401
|
const { id, deviceId, log } = action.payload;
|
|
2372
|
-
const deployment =
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2402
|
+
const deployment = {
|
|
2403
|
+
...deploymentPrototype,
|
|
2404
|
+
...state.byId[id]
|
|
2405
|
+
};
|
|
2406
|
+
state.byId[id] = {
|
|
2407
|
+
...deployment,
|
|
2408
|
+
devices: {
|
|
2409
|
+
...deployment.devices,
|
|
2410
|
+
[deviceId]: {
|
|
2411
|
+
...deployment.devices[deviceId],
|
|
2376
2412
|
log
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
};
|
|
2380
2416
|
},
|
|
2381
2417
|
receivedDeploymentDevices: (state, action) => {
|
|
2382
2418
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
2383
|
-
state.byId[id] =
|
|
2419
|
+
state.byId[id] = {
|
|
2420
|
+
...state.byId[id],
|
|
2384
2421
|
devices,
|
|
2385
2422
|
totalDeviceCount
|
|
2386
|
-
}
|
|
2423
|
+
};
|
|
2387
2424
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
2388
2425
|
},
|
|
2389
2426
|
receivedDeployments: (state, action) => {
|
|
2390
|
-
state.byId =
|
|
2427
|
+
state.byId = {
|
|
2428
|
+
...state.byId,
|
|
2429
|
+
...action.payload
|
|
2430
|
+
};
|
|
2391
2431
|
},
|
|
2392
2432
|
receivedDeploymentsForStatus: (state, action) => {
|
|
2393
2433
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -2429,9 +2469,9 @@ var initialState3 = {
|
|
|
2429
2469
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
2430
2470
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
2431
2471
|
},
|
|
2432
|
-
deviceList:
|
|
2433
|
-
deviceIds: []
|
|
2434
|
-
|
|
2472
|
+
deviceList: {
|
|
2473
|
+
deviceIds: [],
|
|
2474
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2435
2475
|
selectedAttributes: [],
|
|
2436
2476
|
selectedIssues: [],
|
|
2437
2477
|
selection: [],
|
|
@@ -2442,7 +2482,7 @@ var initialState3 = {
|
|
|
2442
2482
|
},
|
|
2443
2483
|
state: DEVICE_STATES.accepted,
|
|
2444
2484
|
total: 0
|
|
2445
|
-
}
|
|
2485
|
+
},
|
|
2446
2486
|
filters: [
|
|
2447
2487
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
2448
2488
|
],
|
|
@@ -2477,49 +2517,59 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2477
2517
|
},
|
|
2478
2518
|
addToGroup: (state, action) => {
|
|
2479
2519
|
const { group, deviceIds } = action.payload;
|
|
2480
|
-
const maybeExistingGroup =
|
|
2520
|
+
const maybeExistingGroup = {
|
|
2481
2521
|
filters: [],
|
|
2482
|
-
deviceIds: []
|
|
2483
|
-
|
|
2484
|
-
|
|
2522
|
+
deviceIds: [],
|
|
2523
|
+
...state.groups.byId[group]
|
|
2524
|
+
};
|
|
2525
|
+
state.groups.byId[group] = {
|
|
2526
|
+
...maybeExistingGroup,
|
|
2485
2527
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers6.duplicateFilter),
|
|
2486
2528
|
total: (maybeExistingGroup.total || 0) + 1
|
|
2487
|
-
}
|
|
2529
|
+
};
|
|
2488
2530
|
},
|
|
2489
2531
|
removeFromGroup: (state, action) => {
|
|
2490
2532
|
const { group, deviceIds: removedIds } = action.payload;
|
|
2491
|
-
const
|
|
2492
|
-
const changedGroup =
|
|
2533
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
2534
|
+
const changedGroup = {
|
|
2535
|
+
...maybeExistingGroup,
|
|
2493
2536
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
2494
2537
|
total: Math.max(total - removedIds.length, 0)
|
|
2495
|
-
}
|
|
2538
|
+
};
|
|
2496
2539
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
2497
2540
|
state.groups.byId[group] = changedGroup;
|
|
2498
2541
|
return;
|
|
2499
2542
|
} else if (state.groups.selectedGroup === group) {
|
|
2500
2543
|
state.groups.selectedGroup = void 0;
|
|
2501
2544
|
}
|
|
2502
|
-
const
|
|
2545
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
2503
2546
|
state.groups.byId = remainingById;
|
|
2504
2547
|
},
|
|
2505
2548
|
addGroup: (state, action) => {
|
|
2506
2549
|
const { groupName, group } = action.payload;
|
|
2507
|
-
state.groups.byId[groupName] =
|
|
2550
|
+
state.groups.byId[groupName] = {
|
|
2551
|
+
...state.groups.byId[groupName],
|
|
2552
|
+
...group
|
|
2553
|
+
};
|
|
2508
2554
|
},
|
|
2509
2555
|
selectGroup: (state, { payload: group }) => {
|
|
2510
2556
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
2511
2557
|
state.groups.selectedGroup = group;
|
|
2512
2558
|
},
|
|
2513
2559
|
removeGroup: (state, action) => {
|
|
2514
|
-
|
|
2515
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
2560
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
2516
2561
|
state.groups.byId = remainingById;
|
|
2517
2562
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
2518
2563
|
},
|
|
2519
2564
|
setDeviceListState: (state, action) => {
|
|
2520
|
-
state.deviceList =
|
|
2521
|
-
|
|
2522
|
-
|
|
2565
|
+
state.deviceList = {
|
|
2566
|
+
...state.deviceList,
|
|
2567
|
+
...action.payload,
|
|
2568
|
+
sort: {
|
|
2569
|
+
...state.deviceList.sort,
|
|
2570
|
+
...action.payload.sort
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2523
2573
|
},
|
|
2524
2574
|
setFilterAttributes: (state, action) => {
|
|
2525
2575
|
state.filteringAttributes = action.payload;
|
|
@@ -2528,7 +2578,10 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2528
2578
|
state.filteringAttributesConfig = action.payload;
|
|
2529
2579
|
},
|
|
2530
2580
|
receivedDevices: (state, action) => {
|
|
2531
|
-
state.byId =
|
|
2581
|
+
state.byId = {
|
|
2582
|
+
...state.byId,
|
|
2583
|
+
...action.payload
|
|
2584
|
+
};
|
|
2532
2585
|
},
|
|
2533
2586
|
setDeviceFilters: (state, action) => {
|
|
2534
2587
|
if ((0, import_helpers6.deepCompare)(action.payload, state.filters)) {
|
|
@@ -2559,7 +2612,10 @@ var devicesSlice = (0, import_toolkit11.createSlice)({
|
|
|
2559
2612
|
state.limit = action.payload;
|
|
2560
2613
|
},
|
|
2561
2614
|
receivedDevice: (state, action) => {
|
|
2562
|
-
state.byId[action.payload.id] =
|
|
2615
|
+
state.byId[action.payload.id] = {
|
|
2616
|
+
...state.byId[action.payload.id],
|
|
2617
|
+
...action.payload
|
|
2618
|
+
};
|
|
2563
2619
|
},
|
|
2564
2620
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
2565
2621
|
const { deviceId, authId } = action.payload;
|
|
@@ -2580,15 +2636,17 @@ var import_toolkit12 = require("@reduxjs/toolkit");
|
|
|
2580
2636
|
var sliceName4 = "monitor";
|
|
2581
2637
|
var initialState4 = {
|
|
2582
2638
|
alerts: {
|
|
2583
|
-
alertList:
|
|
2639
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
2584
2640
|
byDeviceId: {}
|
|
2585
2641
|
},
|
|
2586
2642
|
issueCounts: {
|
|
2587
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
2643
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
2588
2644
|
},
|
|
2589
2645
|
settings: {
|
|
2590
2646
|
global: {
|
|
2591
|
-
channels:
|
|
2647
|
+
channels: {
|
|
2648
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
2649
|
+
}
|
|
2592
2650
|
}
|
|
2593
2651
|
}
|
|
2594
2652
|
};
|
|
@@ -2606,14 +2664,14 @@ var monitorSlice = (0, import_toolkit12.createSlice)({
|
|
|
2606
2664
|
},
|
|
2607
2665
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
2608
2666
|
const { deviceId, alerts } = action.payload;
|
|
2609
|
-
state.alerts.byDeviceId[deviceId] =
|
|
2667
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
2610
2668
|
},
|
|
2611
2669
|
receiveDeviceIssueCounts: (state, action) => {
|
|
2612
2670
|
const { issueType, counts } = action.payload;
|
|
2613
2671
|
state.issueCounts.byType[issueType] = counts;
|
|
2614
2672
|
},
|
|
2615
2673
|
setAlertListState: (state, action) => {
|
|
2616
|
-
state.alerts.alertList =
|
|
2674
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
2617
2675
|
}
|
|
2618
2676
|
}
|
|
2619
2677
|
});
|
|
@@ -2637,7 +2695,7 @@ var onboardingSlice = (0, import_toolkit13.createSlice)({
|
|
|
2637
2695
|
initialState: initialState5,
|
|
2638
2696
|
reducers: {
|
|
2639
2697
|
setOnboardingState: (state, action) => {
|
|
2640
|
-
return
|
|
2698
|
+
return { ...state, ...action.payload };
|
|
2641
2699
|
},
|
|
2642
2700
|
setDemoArtifactPort: (state, action) => {
|
|
2643
2701
|
state.demoArtifactPort = action.payload;
|
|
@@ -2675,21 +2733,23 @@ var initialState6 = {
|
|
|
2675
2733
|
brand: ""
|
|
2676
2734
|
},
|
|
2677
2735
|
intentId: null,
|
|
2736
|
+
tenantList: {
|
|
2737
|
+
...TENANT_LIST_DEFAULT,
|
|
2738
|
+
total: 0,
|
|
2739
|
+
tenants: [],
|
|
2740
|
+
selectedTenant: null,
|
|
2741
|
+
sort: {
|
|
2742
|
+
direction: SORTING_OPTIONS.desc,
|
|
2743
|
+
key: "name"
|
|
2744
|
+
}
|
|
2745
|
+
},
|
|
2678
2746
|
organization: {
|
|
2679
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
2680
|
-
total: 0,
|
|
2681
|
-
tenants: [],
|
|
2682
|
-
selectedTenant: null,
|
|
2683
|
-
sort: {
|
|
2684
|
-
direction: SORTING_OPTIONS.desc,
|
|
2685
|
-
key: "name"
|
|
2686
|
-
}
|
|
2687
|
-
})
|
|
2688
2747
|
// id, name, status, tenant_token, plan
|
|
2689
2748
|
},
|
|
2690
2749
|
auditlog: {
|
|
2691
2750
|
events: [],
|
|
2692
|
-
selectionState:
|
|
2751
|
+
selectionState: {
|
|
2752
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2693
2753
|
detail: void 0,
|
|
2694
2754
|
endDate: void 0,
|
|
2695
2755
|
selectedIssue: void 0,
|
|
@@ -2698,7 +2758,7 @@ var initialState6 = {
|
|
|
2698
2758
|
total: 0,
|
|
2699
2759
|
type: void 0,
|
|
2700
2760
|
user: void 0
|
|
2701
|
-
}
|
|
2761
|
+
}
|
|
2702
2762
|
},
|
|
2703
2763
|
externalDeviceIntegrations: [
|
|
2704
2764
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2721,7 +2781,10 @@ var organizationSlice = (0, import_toolkit14.createSlice)({
|
|
|
2721
2781
|
state.auditlog.selectionState.total = total;
|
|
2722
2782
|
},
|
|
2723
2783
|
setAuditLogState: (state, action) => {
|
|
2724
|
-
state.auditlog.selectionState =
|
|
2784
|
+
state.auditlog.selectionState = {
|
|
2785
|
+
...state.auditlog.selectionState,
|
|
2786
|
+
...action.payload
|
|
2787
|
+
};
|
|
2725
2788
|
},
|
|
2726
2789
|
receiveCurrentCard: (state, action) => {
|
|
2727
2790
|
state.card = action.payload;
|
|
@@ -2730,12 +2793,10 @@ var organizationSlice = (0, import_toolkit14.createSlice)({
|
|
|
2730
2793
|
state.intentId = action.payload;
|
|
2731
2794
|
},
|
|
2732
2795
|
setOrganization: (state, action) => {
|
|
2733
|
-
state.organization =
|
|
2734
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
2735
|
-
});
|
|
2796
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2736
2797
|
},
|
|
2737
2798
|
setTenantListState: (state, action) => {
|
|
2738
|
-
state.
|
|
2799
|
+
state.tenantList = action.payload;
|
|
2739
2800
|
},
|
|
2740
2801
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
2741
2802
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2795,7 +2856,8 @@ var initialState7 = {
|
|
|
2795
2856
|
}
|
|
2796
2857
|
*/
|
|
2797
2858
|
},
|
|
2798
|
-
releasesList:
|
|
2859
|
+
releasesList: {
|
|
2860
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2799
2861
|
searchedIds: [],
|
|
2800
2862
|
releaseIds: [],
|
|
2801
2863
|
selection: [],
|
|
@@ -2809,7 +2871,7 @@ var initialState7 = {
|
|
|
2809
2871
|
selectedTags: [],
|
|
2810
2872
|
total: 0,
|
|
2811
2873
|
type: ""
|
|
2812
|
-
}
|
|
2874
|
+
},
|
|
2813
2875
|
tags: [],
|
|
2814
2876
|
updateTypes: [],
|
|
2815
2877
|
/*
|
|
@@ -2835,8 +2897,7 @@ var releaseSlice = (0, import_toolkit15.createSlice)({
|
|
|
2835
2897
|
state.updateTypes = action.payload;
|
|
2836
2898
|
},
|
|
2837
2899
|
removeRelease: (state, action) => {
|
|
2838
|
-
|
|
2839
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2900
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2840
2901
|
state.byId = byId;
|
|
2841
2902
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2842
2903
|
},
|
|
@@ -2869,8 +2930,12 @@ var initialState8 = {
|
|
|
2869
2930
|
previousPhases: [],
|
|
2870
2931
|
retries: 0
|
|
2871
2932
|
},
|
|
2872
|
-
permissionSetsById:
|
|
2873
|
-
|
|
2933
|
+
permissionSetsById: {
|
|
2934
|
+
...defaultPermissionSets
|
|
2935
|
+
},
|
|
2936
|
+
rolesById: {
|
|
2937
|
+
...rolesById
|
|
2938
|
+
},
|
|
2874
2939
|
settingsInitialized: false,
|
|
2875
2940
|
showConnectDeviceDialog: false,
|
|
2876
2941
|
showFeedbackDialog: false,
|
|
@@ -2910,13 +2975,15 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
2910
2975
|
state.byId[0] = action.payload;
|
|
2911
2976
|
},
|
|
2912
2977
|
removedUser: (state, action) => {
|
|
2913
|
-
|
|
2914
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2978
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2915
2979
|
state.byId = byId;
|
|
2916
2980
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2917
2981
|
},
|
|
2918
2982
|
updatedUser: (state, action) => {
|
|
2919
|
-
state.byId[action.payload.id] =
|
|
2983
|
+
state.byId[action.payload.id] = {
|
|
2984
|
+
...state.byId[action.payload.id],
|
|
2985
|
+
...action.payload
|
|
2986
|
+
};
|
|
2920
2987
|
},
|
|
2921
2988
|
receivedPermissionSets: (state, action) => {
|
|
2922
2989
|
state.permissionSetsById = action.payload;
|
|
@@ -2925,11 +2992,13 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
2925
2992
|
state.rolesById = action.payload;
|
|
2926
2993
|
},
|
|
2927
2994
|
createdRole: (state, action) => {
|
|
2928
|
-
state.rolesById[action.payload.name] =
|
|
2995
|
+
state.rolesById[action.payload.name] = {
|
|
2996
|
+
...state.rolesById[action.payload.name],
|
|
2997
|
+
...action.payload
|
|
2998
|
+
};
|
|
2929
2999
|
},
|
|
2930
3000
|
removedRole: (state, action) => {
|
|
2931
|
-
|
|
2932
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
3001
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2933
3002
|
state.rolesById = rolesById2;
|
|
2934
3003
|
},
|
|
2935
3004
|
setCustomColumns: (state, action) => {
|
|
@@ -2937,18 +3006,27 @@ var usersSlice = (0, import_toolkit16.createSlice)({
|
|
|
2937
3006
|
},
|
|
2938
3007
|
setGlobalSettings: (state, action) => {
|
|
2939
3008
|
state.settingsInitialized = true;
|
|
2940
|
-
state.globalSettings =
|
|
3009
|
+
state.globalSettings = {
|
|
3010
|
+
...state.globalSettings,
|
|
3011
|
+
...action.payload
|
|
3012
|
+
};
|
|
2941
3013
|
},
|
|
2942
3014
|
setUserSettings: (state, action) => {
|
|
2943
3015
|
state.userSettingsInitialized = true;
|
|
2944
|
-
state.userSettings =
|
|
3016
|
+
state.userSettings = {
|
|
3017
|
+
...state.userSettings,
|
|
3018
|
+
...action.payload
|
|
3019
|
+
};
|
|
2945
3020
|
},
|
|
2946
3021
|
setTooltipState: (state, action) => {
|
|
2947
3022
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2948
3023
|
state.tooltips.byId[id].readState = readState;
|
|
2949
3024
|
},
|
|
2950
3025
|
setTooltipsState: (state, action) => {
|
|
2951
|
-
state.tooltips.byId =
|
|
3026
|
+
state.tooltips.byId = {
|
|
3027
|
+
...state.tooltips.byId,
|
|
3028
|
+
...action.payload
|
|
3029
|
+
};
|
|
2952
3030
|
},
|
|
2953
3031
|
setShowFeedbackDialog: (state, action) => {
|
|
2954
3032
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2965,7 +3043,16 @@ var actions8 = usersSlice.actions;
|
|
|
2965
3043
|
var usersSlice_default = usersSlice.reducer;
|
|
2966
3044
|
|
|
2967
3045
|
// src/actions.ts
|
|
2968
|
-
var actions_default =
|
|
3046
|
+
var actions_default = {
|
|
3047
|
+
...actions,
|
|
3048
|
+
...actions2,
|
|
3049
|
+
...actions3,
|
|
3050
|
+
...actions4,
|
|
3051
|
+
...actions5,
|
|
3052
|
+
...actions6,
|
|
3053
|
+
...actions7,
|
|
3054
|
+
...actions8
|
|
3055
|
+
};
|
|
2969
3056
|
|
|
2970
3057
|
// src/store.ts
|
|
2971
3058
|
var import_toolkit17 = require("@reduxjs/toolkit");
|
|
@@ -3000,8 +3087,9 @@ var sessionReducer = (state, action) => {
|
|
|
3000
3087
|
return rootReducer(state, action);
|
|
3001
3088
|
};
|
|
3002
3089
|
var getConfiguredStore = (options = {}) => {
|
|
3003
|
-
const
|
|
3004
|
-
return (0, import_toolkit17.configureStore)(
|
|
3090
|
+
const { preloadedState = {}, ...config } = options;
|
|
3091
|
+
return (0, import_toolkit17.configureStore)({
|
|
3092
|
+
...config,
|
|
3005
3093
|
preloadedState,
|
|
3006
3094
|
reducer: sessionReducer,
|
|
3007
3095
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -3014,7 +3102,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
3014
3102
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
3015
3103
|
}
|
|
3016
3104
|
})
|
|
3017
|
-
})
|
|
3105
|
+
});
|
|
3018
3106
|
};
|
|
3019
3107
|
var store = getConfiguredStore({
|
|
3020
3108
|
preloadedState: {}
|
|
@@ -3029,13 +3117,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
3029
3117
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
3030
3118
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers7.startTimeSort).reduce(
|
|
3031
3119
|
(accu, item) => {
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3120
|
+
const filter = item.filter ?? {};
|
|
3121
|
+
let deployment = {
|
|
3122
|
+
...deploymentPrototype,
|
|
3123
|
+
...deploymentsById[item.id],
|
|
3124
|
+
...item,
|
|
3125
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
3036
3126
|
name: decodeURIComponent(item.name)
|
|
3037
|
-
}
|
|
3038
|
-
deployment =
|
|
3127
|
+
};
|
|
3128
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
3039
3129
|
accu.deployments[item.id] = deployment;
|
|
3040
3130
|
accu.deploymentIds.push(item.id);
|
|
3041
3131
|
return accu;
|
|
@@ -3089,11 +3179,12 @@ var createDeployment = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/cre
|
|
|
3089
3179
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
3090
3180
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
3091
3181
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
3092
|
-
const deployment =
|
|
3182
|
+
const deployment = {
|
|
3183
|
+
...newDeployment,
|
|
3093
3184
|
id: deploymentId,
|
|
3094
3185
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
3095
3186
|
statistics: { status: {} }
|
|
3096
|
-
}
|
|
3187
|
+
};
|
|
3097
3188
|
let tasks = [
|
|
3098
3189
|
dispatch(actions2.createdDeployment(deployment)),
|
|
3099
3190
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3236,14 +3327,23 @@ var updateDeploymentControlMap = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3236
3327
|
({ 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))))
|
|
3237
3328
|
);
|
|
3238
3329
|
var setDeploymentsState = (0, import_toolkit18.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3239
|
-
const
|
|
3330
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3240
3331
|
const currentState = getState().deployments.selectionState;
|
|
3241
|
-
let nextState =
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3332
|
+
let nextState = {
|
|
3333
|
+
...currentState,
|
|
3334
|
+
...selectionState,
|
|
3335
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3336
|
+
accu[item] = {
|
|
3337
|
+
...currentState[item],
|
|
3338
|
+
...selectionState[item]
|
|
3339
|
+
};
|
|
3340
|
+
return accu;
|
|
3341
|
+
}, {}),
|
|
3342
|
+
general: {
|
|
3343
|
+
...currentState.general,
|
|
3344
|
+
...selectionState.general
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3247
3347
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3248
3348
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3249
3349
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3273,15 +3373,20 @@ var getDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3273
3373
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3274
3374
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3275
3375
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3276
|
-
const config =
|
|
3376
|
+
const config = {
|
|
3377
|
+
...oldConfig,
|
|
3277
3378
|
hasDelta: Boolean(delta.enabled),
|
|
3278
|
-
binaryDelta:
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3379
|
+
binaryDelta: {
|
|
3380
|
+
...oldConfig.binaryDelta,
|
|
3381
|
+
timeout: timeoutConfig,
|
|
3382
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3383
|
+
},
|
|
3384
|
+
binaryDeltaLimits: {
|
|
3385
|
+
...oldConfig.binaryDeltaLimits,
|
|
3386
|
+
timeout: timeoutLimit,
|
|
3387
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3388
|
+
}
|
|
3389
|
+
};
|
|
3285
3390
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3286
3391
|
})
|
|
3287
3392
|
);
|
|
@@ -3291,7 +3396,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3291
3396
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers7.isEmpty)(cleanedValue)) {
|
|
3292
3397
|
return accu;
|
|
3293
3398
|
}
|
|
3294
|
-
accu =
|
|
3399
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3295
3400
|
}
|
|
3296
3401
|
return accu;
|
|
3297
3402
|
}, void 0);
|
|
@@ -3311,9 +3416,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit18.createAsyncThunk)(`${slice
|
|
|
3311
3416
|
}
|
|
3312
3417
|
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(() => {
|
|
3313
3418
|
const oldConfig = getState().deployments.config;
|
|
3314
|
-
const newConfig =
|
|
3315
|
-
|
|
3316
|
-
|
|
3419
|
+
const newConfig = {
|
|
3420
|
+
...oldConfig,
|
|
3421
|
+
binaryDelta: {
|
|
3422
|
+
...oldConfig.binaryDelta,
|
|
3423
|
+
...config
|
|
3424
|
+
}
|
|
3425
|
+
};
|
|
3317
3426
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3318
3427
|
});
|
|
3319
3428
|
});
|
|
@@ -3326,19 +3435,20 @@ var import_toolkit19 = require("@reduxjs/toolkit");
|
|
|
3326
3435
|
var import_axios2 = require("axios");
|
|
3327
3436
|
var import_pluralize = __toESM(require_pluralize());
|
|
3328
3437
|
|
|
3329
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3330
|
-
var
|
|
3331
|
-
var
|
|
3332
|
-
var poolPtr = rnds8Pool.length;
|
|
3438
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3439
|
+
var getRandomValues;
|
|
3440
|
+
var rnds8 = new Uint8Array(16);
|
|
3333
3441
|
function rng() {
|
|
3334
|
-
if (
|
|
3335
|
-
|
|
3336
|
-
|
|
3442
|
+
if (!getRandomValues) {
|
|
3443
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3444
|
+
if (!getRandomValues) {
|
|
3445
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3446
|
+
}
|
|
3337
3447
|
}
|
|
3338
|
-
return
|
|
3448
|
+
return getRandomValues(rnds8);
|
|
3339
3449
|
}
|
|
3340
3450
|
|
|
3341
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3451
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3342
3452
|
var byteToHex = [];
|
|
3343
3453
|
for (let i = 0; i < 256; ++i) {
|
|
3344
3454
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3347,13 +3457,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3347
3457
|
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]];
|
|
3348
3458
|
}
|
|
3349
3459
|
|
|
3350
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3351
|
-
var
|
|
3460
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3461
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3352
3462
|
var native_default = {
|
|
3353
|
-
randomUUID
|
|
3463
|
+
randomUUID
|
|
3354
3464
|
};
|
|
3355
3465
|
|
|
3356
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3466
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3357
3467
|
function v4(options, buf, offset) {
|
|
3358
3468
|
if (native_default.randomUUID && !buf && !options) {
|
|
3359
3469
|
return native_default.randomUUID();
|
|
@@ -3395,14 +3505,13 @@ var getGroups2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3395
3505
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3396
3506
|
const state = getGroupsById(getState());
|
|
3397
3507
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3398
|
-
|
|
3399
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3508
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3400
3509
|
accu[id] = group;
|
|
3401
3510
|
}
|
|
3402
3511
|
return accu;
|
|
3403
3512
|
}, {});
|
|
3404
3513
|
const groups = res.data.reduce((accu, group) => {
|
|
3405
|
-
accu[group] =
|
|
3514
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3406
3515
|
return accu;
|
|
3407
3516
|
}, dynamicGroups);
|
|
3408
3517
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3460,7 +3569,7 @@ var addStaticGroup = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3460
3569
|
() => Promise.resolve(
|
|
3461
3570
|
dispatch(
|
|
3462
3571
|
actions3.addGroup({
|
|
3463
|
-
group:
|
|
3572
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3464
3573
|
groupName: group
|
|
3465
3574
|
})
|
|
3466
3575
|
)
|
|
@@ -3488,20 +3597,19 @@ var getDynamicGroups = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3488
3597
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3489
3598
|
const state = getGroupsById(getState());
|
|
3490
3599
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3491
|
-
|
|
3492
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3600
|
+
if (!(group.id || group.filters?.length)) {
|
|
3493
3601
|
accu[id] = group;
|
|
3494
3602
|
}
|
|
3495
3603
|
return accu;
|
|
3496
3604
|
}, {});
|
|
3497
3605
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3498
|
-
accu[filter.name] =
|
|
3606
|
+
accu[filter.name] = {
|
|
3499
3607
|
deviceIds: [],
|
|
3500
|
-
total: 0
|
|
3501
|
-
|
|
3608
|
+
total: 0,
|
|
3609
|
+
...state[filter.name],
|
|
3502
3610
|
id: filter.id,
|
|
3503
3611
|
filters: mapTermsToFilters(filter.terms)
|
|
3504
|
-
}
|
|
3612
|
+
};
|
|
3505
3613
|
return accu;
|
|
3506
3614
|
}, staticGroups);
|
|
3507
3615
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3541,10 +3649,9 @@ var removeDynamicGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/r
|
|
|
3541
3649
|
);
|
|
3542
3650
|
});
|
|
3543
3651
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3544
|
-
var _a;
|
|
3545
3652
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3546
3653
|
const selectedGroup = groupsState.byId[groupName];
|
|
3547
|
-
const groupFilterLength =
|
|
3654
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3548
3655
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3549
3656
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3550
3657
|
};
|
|
@@ -3567,7 +3674,6 @@ var selectGroup = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3567
3674
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3568
3675
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3569
3676
|
(accu, device) => {
|
|
3570
|
-
var _a, _b2, _c;
|
|
3571
3677
|
const stateDevice = getDeviceById(state, device.id);
|
|
3572
3678
|
const {
|
|
3573
3679
|
attributes: storedAttributes = {},
|
|
@@ -3577,29 +3683,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3577
3683
|
group: storedGroup
|
|
3578
3684
|
} = stateDevice;
|
|
3579
3685
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3580
|
-
device.tags =
|
|
3581
|
-
device.group =
|
|
3582
|
-
device.monitor =
|
|
3583
|
-
device.identity_data =
|
|
3686
|
+
device.tags = { ...storedTags, ...tags };
|
|
3687
|
+
device.group = system.group ?? storedGroup;
|
|
3688
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3689
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3584
3690
|
device.status = status ? status : device.status || identity.status;
|
|
3585
|
-
device.check_in_time_rounded =
|
|
3586
|
-
device.check_in_time_exact =
|
|
3691
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3692
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3587
3693
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3588
3694
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3589
3695
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3590
3696
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3591
|
-
device.attributes = device.attributes ?
|
|
3592
|
-
accu.devicesById[device.id] =
|
|
3697
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3698
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3593
3699
|
accu.ids.push(device.id);
|
|
3594
3700
|
return accu;
|
|
3595
3701
|
},
|
|
3596
3702
|
{ ids, devicesById: {} }
|
|
3597
3703
|
);
|
|
3598
3704
|
var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3599
|
-
const
|
|
3705
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3600
3706
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3601
3707
|
return Promise.resolve(
|
|
3602
|
-
dispatch(getDevicesByStatus2(
|
|
3708
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3603
3709
|
).unwrap().then((results) => {
|
|
3604
3710
|
if (!group) {
|
|
3605
3711
|
return Promise.resolve();
|
|
@@ -3613,7 +3719,7 @@ var getGroupDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3613
3719
|
dispatch(
|
|
3614
3720
|
actions3.addGroup({
|
|
3615
3721
|
group: {
|
|
3616
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3722
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3617
3723
|
total
|
|
3618
3724
|
},
|
|
3619
3725
|
groupName: group
|
|
@@ -3762,27 +3868,26 @@ var getDeviceLimit2 = (0, import_toolkit19.createAsyncThunk)(
|
|
|
3762
3868
|
);
|
|
3763
3869
|
var setDeviceListState = (0, import_toolkit19.createAsyncThunk)(
|
|
3764
3870
|
`${sliceName3}/setDeviceListState`,
|
|
3765
|
-
(
|
|
3766
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3767
|
-
var _c;
|
|
3871
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3768
3872
|
const currentState = getDeviceListState(getState());
|
|
3769
3873
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3770
|
-
let nextState =
|
|
3874
|
+
let nextState = {
|
|
3875
|
+
...currentState,
|
|
3771
3876
|
setOnly: false,
|
|
3772
|
-
refreshTrigger
|
|
3773
|
-
|
|
3774
|
-
sort:
|
|
3775
|
-
}
|
|
3877
|
+
refreshTrigger,
|
|
3878
|
+
...selectionState,
|
|
3879
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3880
|
+
};
|
|
3776
3881
|
let tasks = [];
|
|
3777
|
-
const
|
|
3778
|
-
const
|
|
3882
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3883
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3779
3884
|
if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3780
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3885
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3781
3886
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3782
3887
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3783
3888
|
nextState.isLoading = true;
|
|
3784
3889
|
tasks.push(
|
|
3785
|
-
dispatch(getDevicesByStatus2(
|
|
3890
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3786
3891
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3787
3892
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3788
3893
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3807,8 +3912,8 @@ var getDevicesByStatus2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/
|
|
|
3807
3912
|
} = options;
|
|
3808
3913
|
const state = getState();
|
|
3809
3914
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3810
|
-
filters: filterSelection
|
|
3811
|
-
group: group
|
|
3915
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3916
|
+
group: group ?? getSelectedGroup(state),
|
|
3812
3917
|
groups: state.devices.groups,
|
|
3813
3918
|
offlineThreshold: state.app.offlineThreshold,
|
|
3814
3919
|
selectedIssues,
|
|
@@ -3869,7 +3974,7 @@ var getAllDevicesByStatus = (0, import_toolkit19.createAsyncThunk)(`${sliceName3
|
|
|
3869
3974
|
});
|
|
3870
3975
|
var searchDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3871
3976
|
const state = getState();
|
|
3872
|
-
let options =
|
|
3977
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3873
3978
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3874
3979
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3875
3980
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -4004,8 +4109,7 @@ var getSessionDetails = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4004
4109
|
({ data: auditLogEntries }) => {
|
|
4005
4110
|
const { start, end } = auditLogEntries.reduce(
|
|
4006
4111
|
(accu, item) => {
|
|
4007
|
-
|
|
4008
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4112
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
4009
4113
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
4010
4114
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
4011
4115
|
}
|
|
@@ -4112,8 +4216,7 @@ var decommissionDevice = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4112
4216
|
var getDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4113
4217
|
`${sliceName3}/getDeviceConfig`,
|
|
4114
4218
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4115
|
-
|
|
4116
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4219
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4117
4220
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4118
4221
|
}
|
|
4119
4222
|
})
|
|
@@ -4125,15 +4228,14 @@ var setDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4125
4228
|
var applyDeviceConfig = (0, import_toolkit19.createAsyncThunk)(
|
|
4126
4229
|
`${sliceName3}/applyDeviceConfig`,
|
|
4127
4230
|
({ 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 }) => {
|
|
4128
|
-
var _a;
|
|
4129
4231
|
const device = getDeviceById(getState(), deviceId);
|
|
4130
4232
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4131
4233
|
let tasks = [
|
|
4132
|
-
dispatch(actions3.receivedDevice(
|
|
4234
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4133
4235
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4134
4236
|
];
|
|
4135
4237
|
if (isDefault && canManageUsers) {
|
|
4136
|
-
const { previous } =
|
|
4238
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4137
4239
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4138
4240
|
}
|
|
4139
4241
|
return Promise.all(tasks);
|
|
@@ -4149,21 +4251,21 @@ var setDeviceTags = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4149
4251
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4150
4252
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4151
4253
|
{ headers }
|
|
4152
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4254
|
+
).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"))]));
|
|
4153
4255
|
})
|
|
4154
4256
|
)
|
|
4155
4257
|
);
|
|
4156
4258
|
var getDeviceTwin = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4157
4259
|
let providerResult = {};
|
|
4158
4260
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4159
|
-
providerResult =
|
|
4261
|
+
providerResult = { ...data, twinError: "" };
|
|
4160
4262
|
}).catch((err) => {
|
|
4161
4263
|
providerResult = {
|
|
4162
4264
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4163
4265
|
};
|
|
4164
4266
|
}).finally(() => {
|
|
4165
4267
|
const device = getDeviceById(getState(), deviceId);
|
|
4166
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4268
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4167
4269
|
});
|
|
4168
4270
|
});
|
|
4169
4271
|
var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
@@ -4179,7 +4281,7 @@ var setDeviceTwin = (0, import_toolkit19.createAsyncThunk)(
|
|
|
4179
4281
|
const { twinsByIntegration = {} } = device;
|
|
4180
4282
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4181
4283
|
return Promise.resolve(
|
|
4182
|
-
dispatch(actions3.receivedDevice(
|
|
4284
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4183
4285
|
);
|
|
4184
4286
|
})
|
|
4185
4287
|
);
|
|
@@ -4200,8 +4302,8 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4200
4302
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4201
4303
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4202
4304
|
const filters = [
|
|
4203
|
-
|
|
4204
|
-
|
|
4305
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4306
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4205
4307
|
];
|
|
4206
4308
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4207
4309
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4213,11 +4315,12 @@ var getSystemDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/get
|
|
|
4213
4315
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4214
4316
|
const state2 = getState();
|
|
4215
4317
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4216
|
-
const device =
|
|
4318
|
+
const device = {
|
|
4319
|
+
...getDeviceById(state2, id),
|
|
4217
4320
|
systemDeviceIds: ids,
|
|
4218
4321
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4219
|
-
}
|
|
4220
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4322
|
+
};
|
|
4323
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4221
4324
|
});
|
|
4222
4325
|
});
|
|
4223
4326
|
var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4225,9 +4328,9 @@ var getGatewayDevices = (0, import_toolkit19.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4225
4328
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4226
4329
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4227
4330
|
const filters = [
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4331
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4332
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4333
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4231
4334
|
];
|
|
4232
4335
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4233
4336
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4274,7 +4377,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4274
4377
|
var cutoffLength = 75;
|
|
4275
4378
|
var ellipsis = "...";
|
|
4276
4379
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4277
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4380
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4278
4381
|
var getDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4279
4382
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4280
4383
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4292,14 +4395,15 @@ var getLatestDeviceAlerts = (0, import_toolkit20.createAsyncThunk)(`${sliceName4
|
|
|
4292
4395
|
});
|
|
4293
4396
|
var getIssueCountsByType2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4294
4397
|
const state = getState();
|
|
4295
|
-
const
|
|
4296
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4398
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4399
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4400
|
+
...remainder,
|
|
4297
4401
|
filters,
|
|
4298
4402
|
group,
|
|
4299
4403
|
offlineThreshold: state.app.offlineThreshold,
|
|
4300
4404
|
selectedIssues: [type],
|
|
4301
4405
|
status
|
|
4302
|
-
})
|
|
4406
|
+
});
|
|
4303
4407
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4304
4408
|
page: 1,
|
|
4305
4409
|
per_page: 1,
|
|
@@ -4408,8 +4512,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4408
4512
|
({ 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())))
|
|
4409
4513
|
);
|
|
4410
4514
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4411
|
-
const userId =
|
|
4412
|
-
const detail =
|
|
4515
|
+
const userId = userFilter?.id || userFilter;
|
|
4516
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4413
4517
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4414
4518
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4415
4519
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4436,12 +4540,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4436
4540
|
);
|
|
4437
4541
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4438
4542
|
const currentState = getAuditlogState(getState());
|
|
4439
|
-
let nextState =
|
|
4440
|
-
|
|
4441
|
-
|
|
4543
|
+
let nextState = {
|
|
4544
|
+
...currentState,
|
|
4545
|
+
...selectionState,
|
|
4546
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4547
|
+
};
|
|
4442
4548
|
let tasks = [];
|
|
4443
|
-
const
|
|
4444
|
-
const
|
|
4549
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4550
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4445
4551
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4446
4552
|
nextState.isLoading = true;
|
|
4447
4553
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4453,27 +4559,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4453
4559
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4454
4560
|
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));
|
|
4455
4561
|
});
|
|
4456
|
-
var tenantListRetrieval = (config) =>
|
|
4562
|
+
var tenantListRetrieval = async (config) => {
|
|
4457
4563
|
const { page, perPage } = config;
|
|
4458
4564
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4459
|
-
const tenantList =
|
|
4565
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4460
4566
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4461
|
-
return [tenantList.data, totalCount];
|
|
4462
|
-
}
|
|
4463
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4567
|
+
return [tenantList.data, Number(totalCount)];
|
|
4568
|
+
};
|
|
4569
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4464
4570
|
const currentState = getTenantsList(getState());
|
|
4465
|
-
const [tenants, pageCount] =
|
|
4466
|
-
dispatch(actions6.setTenantListState(
|
|
4467
|
-
})
|
|
4468
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4571
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4572
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4573
|
+
});
|
|
4574
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4469
4575
|
const currentState = getTenantsList(getState());
|
|
4470
|
-
const nextState =
|
|
4576
|
+
const nextState = {
|
|
4577
|
+
...currentState,
|
|
4578
|
+
...selectionState
|
|
4579
|
+
};
|
|
4471
4580
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4472
|
-
const [tenants, pageCount] =
|
|
4473
|
-
return dispatch(actions6.setTenantListState(
|
|
4581
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4582
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4474
4583
|
}
|
|
4475
|
-
return dispatch(actions6.setTenantListState(
|
|
4476
|
-
})
|
|
4584
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4585
|
+
});
|
|
4477
4586
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4478
4587
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4479
4588
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4516,10 +4625,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4516
4625
|
);
|
|
4517
4626
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4518
4627
|
`${sliceName6}/createIntegration`,
|
|
4519
|
-
(
|
|
4520
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4521
|
-
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())]));
|
|
4522
|
-
}
|
|
4628
|
+
({ 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())]))
|
|
4523
4629
|
);
|
|
4524
4630
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4525
4631
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4540,9 +4646,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4540
4646
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4541
4647
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4542
4648
|
const integrations = data.reduce((accu, item) => {
|
|
4543
|
-
|
|
4544
|
-
const
|
|
4545
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4649
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4650
|
+
const integration = { ...existingIntegration, ...item };
|
|
4546
4651
|
accu.push(integration);
|
|
4547
4652
|
return accu;
|
|
4548
4653
|
}, []);
|
|
@@ -4594,7 +4699,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4594
4699
|
`${sliceName6}/getSsoConfigById`,
|
|
4595
4700
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4596
4701
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4597
|
-
return sso ? Promise.resolve(
|
|
4702
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4598
4703
|
})
|
|
4599
4704
|
);
|
|
4600
4705
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4613,20 +4718,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4613
4718
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4614
4719
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4615
4720
|
var flattenRelease = (release, stateRelease) => {
|
|
4616
|
-
|
|
4617
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4721
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4618
4722
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4619
4723
|
(accu, item) => {
|
|
4620
|
-
var _a2;
|
|
4621
4724
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4622
|
-
const stateArtifact =
|
|
4725
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4623
4726
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4624
|
-
accu.artifacts.push(
|
|
4727
|
+
accu.artifacts.push({
|
|
4728
|
+
...stateArtifact,
|
|
4729
|
+
...item
|
|
4730
|
+
});
|
|
4625
4731
|
return accu;
|
|
4626
4732
|
},
|
|
4627
4733
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4628
4734
|
);
|
|
4629
|
-
return
|
|
4735
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4630
4736
|
};
|
|
4631
4737
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4632
4738
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4644,17 +4750,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4644
4750
|
{ release: null, index: -1 }
|
|
4645
4751
|
);
|
|
4646
4752
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4647
|
-
var _a;
|
|
4648
4753
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4649
4754
|
if (!release || index === -1) {
|
|
4650
4755
|
return;
|
|
4651
4756
|
}
|
|
4652
4757
|
const releaseArtifacts = [...release.artifacts];
|
|
4653
4758
|
const artifact = releaseArtifacts[index];
|
|
4654
|
-
const { key, name, version } = (
|
|
4759
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4655
4760
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4656
4761
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4657
|
-
filters: [
|
|
4762
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4658
4763
|
});
|
|
4659
4764
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4660
4765
|
page: 1,
|
|
@@ -4668,10 +4773,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4668
4773
|
}
|
|
4669
4774
|
const installCount = Number(headers[headerNames.total]);
|
|
4670
4775
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4671
|
-
releaseArtifacts2[index2] =
|
|
4672
|
-
release2 =
|
|
4776
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4777
|
+
release2 = {
|
|
4778
|
+
...release2,
|
|
4673
4779
|
artifacts: releaseArtifacts2
|
|
4674
|
-
}
|
|
4780
|
+
};
|
|
4675
4781
|
return dispatch(actions7.receiveRelease(release2));
|
|
4676
4782
|
});
|
|
4677
4783
|
});
|
|
@@ -4683,12 +4789,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4683
4789
|
return dispatch(getReleases());
|
|
4684
4790
|
}
|
|
4685
4791
|
const releaseArtifacts = [...release.artifacts];
|
|
4686
|
-
releaseArtifacts[index] =
|
|
4792
|
+
releaseArtifacts[index] = {
|
|
4793
|
+
...releaseArtifacts[index],
|
|
4687
4794
|
url: response.data.uri
|
|
4688
|
-
}
|
|
4689
|
-
release =
|
|
4795
|
+
};
|
|
4796
|
+
release = {
|
|
4797
|
+
...release,
|
|
4690
4798
|
artifacts: releaseArtifacts
|
|
4691
|
-
}
|
|
4799
|
+
};
|
|
4692
4800
|
return dispatch(actions7.receiveRelease(release));
|
|
4693
4801
|
})
|
|
4694
4802
|
);
|
|
@@ -4813,12 +4921,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4813
4921
|
});
|
|
4814
4922
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4815
4923
|
const currentState = getState().releases.releasesList;
|
|
4816
|
-
let nextState =
|
|
4817
|
-
|
|
4818
|
-
|
|
4924
|
+
let nextState = {
|
|
4925
|
+
...currentState,
|
|
4926
|
+
...selectionState,
|
|
4927
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4928
|
+
};
|
|
4819
4929
|
let tasks = [];
|
|
4820
|
-
const
|
|
4821
|
-
const
|
|
4930
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4931
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4822
4932
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4823
4933
|
nextState.isLoading = true;
|
|
4824
4934
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4837,29 +4947,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4837
4947
|
);
|
|
4838
4948
|
};
|
|
4839
4949
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4840
|
-
let releaseListState =
|
|
4950
|
+
let releaseListState = { ...state.releasesList };
|
|
4841
4951
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4842
4952
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4843
4953
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4844
4954
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4845
4955
|
if (searchOnly) {
|
|
4846
|
-
releaseListState =
|
|
4956
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4847
4957
|
} else {
|
|
4848
|
-
releaseListState =
|
|
4958
|
+
releaseListState = {
|
|
4959
|
+
...releaseListState,
|
|
4849
4960
|
releaseIds,
|
|
4850
4961
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4851
4962
|
total: !isFiltering ? total : state.releasesList.total
|
|
4852
|
-
}
|
|
4963
|
+
};
|
|
4853
4964
|
}
|
|
4854
4965
|
return releaseListState;
|
|
4855
4966
|
};
|
|
4856
4967
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4857
|
-
const config =
|
|
4968
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4858
4969
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4859
4970
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4860
4971
|
const state = getState().releases;
|
|
4861
4972
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4862
|
-
const combinedReleases =
|
|
4973
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4863
4974
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4864
4975
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4865
4976
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4880,7 +4991,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4880
4991
|
`${sliceName7}/updateReleaseInfo`,
|
|
4881
4992
|
({ 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(() => {
|
|
4882
4993
|
return Promise.all([
|
|
4883
|
-
dispatch(actions7.receiveRelease(
|
|
4994
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4884
4995
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4885
4996
|
]);
|
|
4886
4997
|
})
|
|
@@ -4889,7 +5000,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4889
5000
|
`${sliceName7}/setReleaseTags`,
|
|
4890
5001
|
({ 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(() => {
|
|
4891
5002
|
return Promise.all([
|
|
4892
|
-
dispatch(actions7.receiveRelease(
|
|
5003
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4893
5004
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4894
5005
|
]);
|
|
4895
5006
|
})
|
|
@@ -4906,19 +5017,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4906
5017
|
// src/api/users-api.ts
|
|
4907
5018
|
var import_axios4 = __toESM(require("axios"));
|
|
4908
5019
|
var Api2 = {
|
|
4909
|
-
postLogin: (url,
|
|
4910
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4911
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4912
|
-
var _a2;
|
|
4913
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4914
|
-
});
|
|
4915
|
-
},
|
|
5020
|
+
postLogin: (url, { email: username, password, ...body }) => import_axios4.default.post(url, body, { ...commonRequestConfig, auth: { username, password } }).then((res) => ({ text: res.data, code: res.status, contentType: res.headers?.["content-type"] })),
|
|
4916
5021
|
putVerifyTFA: (url, userData) => {
|
|
4917
5022
|
let body = {};
|
|
4918
5023
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4919
5024
|
body = { token2fa: userData.token2fa };
|
|
4920
5025
|
}
|
|
4921
|
-
return import_axios4.default.put(url, body,
|
|
5026
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4922
5027
|
}
|
|
4923
5028
|
};
|
|
4924
5029
|
var users_api_default = Api2;
|
|
@@ -4946,43 +5051,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4946
5051
|
};
|
|
4947
5052
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4948
5053
|
`${sliceName8}/loginUser`,
|
|
4949
|
-
(
|
|
4950
|
-
|
|
4951
|
-
return
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
Promise.
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
window.
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
);
|
|
4984
|
-
});
|
|
4985
|
-
}
|
|
5054
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5055
|
+
cleanUp();
|
|
5056
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5057
|
+
}).then(({ text: response, contentType }) => {
|
|
5058
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5059
|
+
const { id, kind } = response;
|
|
5060
|
+
const type = kind.split("/")[1];
|
|
5061
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5062
|
+
window.location.replace(ssoLoginUrl);
|
|
5063
|
+
return;
|
|
5064
|
+
}
|
|
5065
|
+
const token = response;
|
|
5066
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5067
|
+
return;
|
|
5068
|
+
}
|
|
5069
|
+
let now = /* @__PURE__ */ new Date();
|
|
5070
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5071
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5072
|
+
setSessionInfo({ token, expiresAt });
|
|
5073
|
+
cookies4.remove("JWT", { path: "/" });
|
|
5074
|
+
return (
|
|
5075
|
+
// @ts-ignore
|
|
5076
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5077
|
+
cleanUp();
|
|
5078
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5079
|
+
}).then(() => {
|
|
5080
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5081
|
+
if (window.location.pathname !== "/ui/") {
|
|
5082
|
+
window.location.replace("/ui/");
|
|
5083
|
+
}
|
|
5084
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5085
|
+
})
|
|
5086
|
+
);
|
|
5087
|
+
})
|
|
4986
5088
|
);
|
|
4987
5089
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4988
5090
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4999,7 +5101,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4999
5101
|
return Promise.reject();
|
|
5000
5102
|
}
|
|
5001
5103
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
5002
|
-
setSessionInfo(
|
|
5104
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
5003
5105
|
window.location.reload();
|
|
5004
5106
|
});
|
|
5005
5107
|
});
|
|
@@ -5062,13 +5164,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5062
5164
|
);
|
|
5063
5165
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5064
5166
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5065
|
-
const userId = currentUserId
|
|
5167
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5066
5168
|
const storageKey = `${userId}-column-widths`;
|
|
5067
5169
|
let customColumns = [];
|
|
5068
5170
|
if (!columns) {
|
|
5069
5171
|
try {
|
|
5070
5172
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5071
|
-
} catch
|
|
5173
|
+
} catch {
|
|
5072
5174
|
}
|
|
5073
5175
|
} else {
|
|
5074
5176
|
customColumns = columns;
|
|
@@ -5097,10 +5199,7 @@ var userActions = {
|
|
|
5097
5199
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5098
5200
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5099
5201
|
`${sliceName8}/createUser`,
|
|
5100
|
-
(
|
|
5101
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5102
|
-
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));
|
|
5103
|
-
}
|
|
5202
|
+
({ 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))
|
|
5104
5203
|
);
|
|
5105
5204
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5106
5205
|
`${sliceName8}/removeUser`,
|
|
@@ -5111,15 +5210,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5111
5210
|
);
|
|
5112
5211
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5113
5212
|
`${sliceName8}/editUser`,
|
|
5114
|
-
(
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
()
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
])
|
|
5121
|
-
);
|
|
5122
|
-
}
|
|
5213
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5214
|
+
() => Promise.all([
|
|
5215
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5216
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5217
|
+
])
|
|
5218
|
+
)
|
|
5123
5219
|
);
|
|
5124
5220
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5125
5221
|
const { id } = getOrganization(getState());
|
|
@@ -5154,7 +5250,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5154
5250
|
}
|
|
5155
5251
|
return accu;
|
|
5156
5252
|
},
|
|
5157
|
-
|
|
5253
|
+
{ ...emptyUiPermissions }
|
|
5158
5254
|
);
|
|
5159
5255
|
var permissionActionTypes = {
|
|
5160
5256
|
any: mapHttpPermission,
|
|
@@ -5177,20 +5273,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5177
5273
|
}, existingPermissions);
|
|
5178
5274
|
var tryParseCustomPermission = (permission) => {
|
|
5179
5275
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5180
|
-
const result = mergePermissions(
|
|
5276
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5181
5277
|
return { isCustom: true, permission, result };
|
|
5182
5278
|
};
|
|
5183
5279
|
var customPermissionHandler = (accu, permission) => {
|
|
5184
5280
|
let processor = tryParseCustomPermission(permission);
|
|
5185
|
-
return
|
|
5281
|
+
return {
|
|
5282
|
+
...accu,
|
|
5186
5283
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5187
5284
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5188
|
-
}
|
|
5285
|
+
};
|
|
5189
5286
|
};
|
|
5190
5287
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5191
5288
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5192
5289
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5193
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5290
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5194
5291
|
};
|
|
5195
5292
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5196
5293
|
if (Array.isArray(permissions)) {
|
|
@@ -5205,60 +5302,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5205
5302
|
if (!processor) {
|
|
5206
5303
|
return accu;
|
|
5207
5304
|
}
|
|
5208
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5209
|
-
var _a;
|
|
5210
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5211
|
-
});
|
|
5305
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5212
5306
|
if (scope) {
|
|
5213
5307
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5214
|
-
return
|
|
5308
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5215
5309
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5216
5310
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5217
5311
|
}
|
|
5218
|
-
return
|
|
5312
|
+
return {
|
|
5313
|
+
...accu,
|
|
5219
5314
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5220
5315
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5221
|
-
}
|
|
5316
|
+
};
|
|
5222
5317
|
},
|
|
5223
|
-
{ isCustom: false, uiPermissions:
|
|
5318
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5224
5319
|
);
|
|
5225
5320
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5226
5321
|
};
|
|
5227
5322
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5228
5323
|
(accu, role) => {
|
|
5229
|
-
var _a;
|
|
5230
5324
|
let normalizedPermissions;
|
|
5231
5325
|
let isCustom = false;
|
|
5232
5326
|
if (rolesById2[role.name]) {
|
|
5233
|
-
normalizedPermissions =
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5327
|
+
normalizedPermissions = {
|
|
5328
|
+
...rolesById2[role.name].uiPermissions,
|
|
5329
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5330
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5331
|
+
};
|
|
5237
5332
|
} else {
|
|
5238
5333
|
const result = parseRolePermissions(role, permissionSets);
|
|
5239
5334
|
normalizedPermissions = result.uiPermissions;
|
|
5240
5335
|
isCustom = result.isCustom;
|
|
5241
5336
|
}
|
|
5242
|
-
const roleState =
|
|
5243
|
-
accu[role.name] =
|
|
5337
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5338
|
+
accu[role.name] = {
|
|
5339
|
+
...roleState,
|
|
5340
|
+
...role,
|
|
5244
5341
|
description: roleState.description ? roleState.description : role.description,
|
|
5245
5342
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5246
5343
|
isCustom,
|
|
5247
5344
|
name: roleState.name ? roleState.name : role.name,
|
|
5248
5345
|
uiPermissions: normalizedPermissions
|
|
5249
|
-
}
|
|
5346
|
+
};
|
|
5250
5347
|
return accu;
|
|
5251
5348
|
},
|
|
5252
|
-
|
|
5349
|
+
{ ...rolesById2 }
|
|
5253
5350
|
);
|
|
5254
5351
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5255
5352
|
`${sliceName8}/getPermissionSets`,
|
|
5256
5353
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5257
5354
|
const permissionSets = data.reduce(
|
|
5258
5355
|
(accu, permissionSet) => {
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5356
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5357
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5262
5358
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5263
5359
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5264
5360
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5269,11 +5365,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5269
5365
|
}
|
|
5270
5366
|
return collector;
|
|
5271
5367
|
}, accu2),
|
|
5272
|
-
|
|
5368
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5273
5369
|
);
|
|
5274
5370
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5275
|
-
|
|
5276
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5371
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5277
5372
|
accu2.push(key);
|
|
5278
5373
|
}
|
|
5279
5374
|
return accu2;
|
|
@@ -5286,7 +5381,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5286
5381
|
return accu;
|
|
5287
5382
|
},
|
|
5288
5383
|
// @ts-ignore
|
|
5289
|
-
|
|
5384
|
+
{ ...getState().users.permissionSetsById }
|
|
5290
5385
|
);
|
|
5291
5386
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5292
5387
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5319,28 +5414,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5319
5414
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5320
5415
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5321
5416
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5322
|
-
|
|
5323
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5417
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5324
5418
|
type: uiPermissionsByArea[area].scope,
|
|
5325
5419
|
value: []
|
|
5326
5420
|
};
|
|
5327
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5421
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5422
|
+
...permissionSetState,
|
|
5328
5423
|
value: [...permissionSetState.value, item]
|
|
5329
|
-
}
|
|
5424
|
+
};
|
|
5330
5425
|
return itemPermissionAccu;
|
|
5331
5426
|
}, accu);
|
|
5332
5427
|
return accu;
|
|
5333
5428
|
}, {});
|
|
5334
|
-
return Object.entries(permissionSetObject).map((
|
|
5335
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5429
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5336
5430
|
if (value.includes(excessiveAccessSelector)) {
|
|
5337
5431
|
return { name };
|
|
5338
5432
|
}
|
|
5339
|
-
return { name, scope:
|
|
5433
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5340
5434
|
});
|
|
5341
5435
|
};
|
|
5342
5436
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5343
|
-
const role =
|
|
5437
|
+
const role = { ...roleState, ...roleData };
|
|
5344
5438
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5345
5439
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5346
5440
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5376,12 +5470,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5376
5470
|
}, []);
|
|
5377
5471
|
return {
|
|
5378
5472
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5379
|
-
role:
|
|
5473
|
+
role: {
|
|
5474
|
+
...emptyRole,
|
|
5380
5475
|
name,
|
|
5381
5476
|
// @ts-ignore
|
|
5382
5477
|
description: description ? description : roleState.description,
|
|
5383
|
-
uiPermissions:
|
|
5384
|
-
|
|
5478
|
+
uiPermissions: {
|
|
5479
|
+
...emptyUiPermissions,
|
|
5480
|
+
...roleUiPermissions,
|
|
5481
|
+
...maybeUiPermissions
|
|
5482
|
+
}
|
|
5483
|
+
}
|
|
5385
5484
|
};
|
|
5386
5485
|
};
|
|
5387
5486
|
var roleActions = {
|
|
@@ -5432,13 +5531,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5432
5531
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5433
5532
|
`${sliceName8}/saveGlobalSettings`,
|
|
5434
5533
|
// @ts-ignore
|
|
5435
|
-
(
|
|
5436
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5534
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5437
5535
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5438
5536
|
return;
|
|
5439
5537
|
}
|
|
5440
5538
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5441
|
-
let updatedSettings =
|
|
5539
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5442
5540
|
if (getCurrentUser(getState()).verified) {
|
|
5443
5541
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5444
5542
|
} else {
|
|
@@ -5476,10 +5574,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5476
5574
|
const userSettings = getUserSettings(getState());
|
|
5477
5575
|
const onboardingState = getOnboardingState(getState());
|
|
5478
5576
|
const tooltipState = getTooltipsState(getState());
|
|
5479
|
-
const updatedSettings =
|
|
5480
|
-
|
|
5577
|
+
const updatedSettings = {
|
|
5578
|
+
...userSettings,
|
|
5579
|
+
// @ts-ignore
|
|
5580
|
+
...settings,
|
|
5581
|
+
onboarding: {
|
|
5582
|
+
...onboardingState,
|
|
5583
|
+
// @ts-ignore
|
|
5584
|
+
...settings.onboarding
|
|
5585
|
+
},
|
|
5481
5586
|
tooltips: tooltipState
|
|
5482
|
-
}
|
|
5587
|
+
};
|
|
5483
5588
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5484
5589
|
return Promise.all([
|
|
5485
5590
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5505,9 +5610,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5505
5610
|
`${sliceName8}/getTokens`,
|
|
5506
5611
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5507
5612
|
const user = getCurrentUser(getState());
|
|
5508
|
-
const updatedUser =
|
|
5613
|
+
const updatedUser = {
|
|
5614
|
+
...user,
|
|
5509
5615
|
tokens
|
|
5510
|
-
}
|
|
5616
|
+
};
|
|
5511
5617
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5512
5618
|
})
|
|
5513
5619
|
);
|
|
@@ -5523,8 +5629,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5523
5629
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5524
5630
|
)
|
|
5525
5631
|
);
|
|
5526
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5527
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5632
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5528
5633
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5529
5634
|
if (persist) {
|
|
5530
5635
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5532,14 +5637,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5532
5637
|
return Promise.all(tasks);
|
|
5533
5638
|
});
|
|
5534
5639
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5535
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5640
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5536
5641
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5537
5642
|
});
|
|
5538
5643
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5539
5644
|
`${sliceName8}/submitFeedback`,
|
|
5540
5645
|
// @ts-ignore
|
|
5541
|
-
(
|
|
5542
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5646
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5543
5647
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5544
5648
|
subject: "feedback submission",
|
|
5545
5649
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5572,21 +5676,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
5572
5676
|
return steps[progress2];
|
|
5573
5677
|
};
|
|
5574
5678
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
5575
|
-
var _a;
|
|
5576
5679
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
5577
5680
|
const userCookie = cookies5.get(`${userId}-onboarded`);
|
|
5578
5681
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
5579
5682
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
5580
|
-
let deviceType =
|
|
5683
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
5581
5684
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
5582
5685
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
5583
|
-
return
|
|
5686
|
+
return {
|
|
5687
|
+
...onboardingState,
|
|
5584
5688
|
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)),
|
|
5585
5689
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
5586
5690
|
deviceType,
|
|
5587
5691
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
5588
5692
|
progress: progress2
|
|
5589
|
-
}
|
|
5693
|
+
};
|
|
5590
5694
|
};
|
|
5591
5695
|
var getOnboardingState2 = (0, import_toolkit24.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
5592
5696
|
const state = getState();
|
|
@@ -5644,18 +5748,8 @@ var advanceOnboarding = (0, import_toolkit24.createAsyncThunk)(`${sliceName5}/ad
|
|
|
5644
5748
|
return;
|
|
5645
5749
|
}
|
|
5646
5750
|
const madeProgress = steps[stepIndex + 1];
|
|
5647
|
-
const state =
|
|
5751
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
5648
5752
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
5649
5753
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
5650
5754
|
});
|
|
5651
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5652
|
-
0 && (module.exports = {
|
|
5653
|
-
advanceOnboarding,
|
|
5654
|
-
applyOnboardingFallbacks,
|
|
5655
|
-
getOnboardingState,
|
|
5656
|
-
setOnboardingApproach,
|
|
5657
|
-
setOnboardingCanceled,
|
|
5658
|
-
setOnboardingComplete,
|
|
5659
|
-
setOnboardingDeviceType
|
|
5660
|
-
});
|
|
5661
5755
|
//# sourceMappingURL=thunks.js.map
|