@northern.tech/store 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +251 -135
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +102 -51
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +104 -66
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +111 -64
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +649 -552
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +99 -51
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-F37LUTBX.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-F37LUTBX.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-7E7KJHY3.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-7E7KJHY3.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-R2GBNXLV.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-R2GBNXLV.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-ZIYGEXSJ.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-ZIYGEXSJ.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-HRWZJQMH.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-HRWZJQMH.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-DZBVTSIX.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-DZBVTSIX.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-YNVSU3AA.mjs → chunk-DIZJVB6M.mjs} +307 -292
- package/dist/chunk-DIZJVB6M.mjs.map +1 -0
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-IPPIKGIB.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-ZNST5R6O.mjs → chunk-IFWKT27G.mjs} +92 -29
- package/dist/chunk-IFWKT27G.mjs.map +1 -0
- package/dist/{chunk-6667TCAJ.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-6667TCAJ.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-HVHZG2H4.mjs → chunk-K2NZL5V4.mjs} +4 -7
- package/dist/chunk-K2NZL5V4.mjs.map +1 -0
- package/dist/{chunk-RQOE5OOT.mjs → chunk-KJAZNKV2.mjs} +66 -55
- package/dist/chunk-KJAZNKV2.mjs.map +1 -0
- package/dist/{chunk-G32LAKW4.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-G32LAKW4.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-BJSH2G7W.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-BJSH2G7W.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-XYVPYFSM.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-XYVPYFSM.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-N7G6QK2E.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-G3I53JGW.mjs → chunk-QQBUNZHA.mjs} +3 -6
- package/dist/{chunk-G3I53JGW.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-TD45YTYK.mjs → chunk-R7LXL3KJ.mjs} +22 -23
- package/dist/chunk-R7LXL3KJ.mjs.map +1 -0
- package/dist/{chunk-G7LATUT6.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-G7LATUT6.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-IVSYYXTC.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-O6O3D52B.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-O6O3D52B.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-BRHSKNFC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-BRHSKNFC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-RH6ONMG7.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-RH6ONMG7.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-HXPYJ6QN.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-HXPYJ6QN.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.d.mts +18 -19
- package/dist/commonConstants.d.ts +18 -19
- package/dist/commonConstants.js +2 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.d.mts +42 -1
- package/dist/commonSelectors.d.ts +42 -1
- package/dist/commonSelectors.js +149 -129
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +14 -12
- package/dist/constants.d.mts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +92 -147
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +18 -14
- package/dist/deploymentsSlice/constants.js +94 -55
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +128 -75
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +95 -48
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +649 -561
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +94 -54
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +131 -77
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +100 -85
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +649 -597
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +94 -41
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +101 -48
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +333 -238
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +649 -555
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.d.mts +6 -1
- package/dist/organizationSlice/constants.d.ts +6 -1
- package/dist/organizationSlice/constants.js +89 -51
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +6 -4
- package/dist/organizationSlice/index.d.mts +224 -246
- package/dist/organizationSlice/index.d.ts +224 -246
- package/dist/organizationSlice/index.js +113 -59
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +96 -58
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +649 -580
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +98 -60
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +97 -53
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +377 -287
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.d.mts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +150 -202
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +45 -43
- package/dist/store.d.mts +235 -135
- package/dist/store.d.ts +235 -135
- package/dist/store.js +262 -157
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.d.mts +3 -1
- package/dist/storehooks.d.ts +3 -1
- package/dist/storehooks.js +686 -569
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +71 -54
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +649 -710
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.d.mts +192 -17
- package/dist/usersSlice/constants.d.ts +192 -17
- package/dist/usersSlice/constants.js +97 -61
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +6 -4
- package/dist/usersSlice/index.d.mts +1628 -704
- package/dist/usersSlice/index.d.ts +1628 -704
- package/dist/usersSlice/index.js +122 -67
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +101 -62
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +649 -584
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.d.mts +6 -5
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +117 -89
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-HVHZG2H4.mjs.map +0 -1
- package/dist/chunk-IPPIKGIB.mjs +0 -35
- package/dist/chunk-IVSYYXTC.mjs +0 -36
- package/dist/chunk-N7G6QK2E.mjs.map +0 -1
- package/dist/chunk-RQOE5OOT.mjs.map +0 -1
- package/dist/chunk-TD45YTYK.mjs.map +0 -1
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-YNVSU3AA.mjs.map +0 -1
- package/dist/chunk-ZNST5R6O.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
package/dist/appSlice/thunks.js
CHANGED
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -470,7 +420,7 @@ var chartTypes = {
|
|
|
470
420
|
};
|
|
471
421
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
472
422
|
var defaultReportType = "distribution";
|
|
473
|
-
var defaultReports = [
|
|
423
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
474
424
|
var locations = {};
|
|
475
425
|
var PLANS = {
|
|
476
426
|
os: {
|
|
@@ -796,13 +746,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
796
746
|
deployments: [],
|
|
797
747
|
groups: Object.freeze({}),
|
|
798
748
|
releases: Object.freeze({}),
|
|
749
|
+
tenantManagement: [],
|
|
799
750
|
userManagement: []
|
|
800
751
|
});
|
|
801
752
|
var emptyRole = Object.freeze({
|
|
802
753
|
name: void 0,
|
|
803
754
|
description: "",
|
|
804
755
|
permissions: [],
|
|
805
|
-
uiPermissions: Object.freeze(
|
|
756
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
806
757
|
});
|
|
807
758
|
|
|
808
759
|
// src/deploymentsSlice/constants.ts
|
|
@@ -831,11 +782,12 @@ var deploymentStatesToSubstates = {
|
|
|
831
782
|
pending: [deploymentSubstates.pending],
|
|
832
783
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
833
784
|
};
|
|
834
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
785
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
786
|
+
...deploymentStatesToSubstates,
|
|
835
787
|
failures: [deploymentSubstates.failure],
|
|
836
788
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
837
789
|
successes: [deploymentSubstates.success]
|
|
838
|
-
}
|
|
790
|
+
};
|
|
839
791
|
var installationSubstatesMap = {
|
|
840
792
|
download: {
|
|
841
793
|
title: "download",
|
|
@@ -880,8 +832,8 @@ var DEPLOYMENT_STATES = {
|
|
|
880
832
|
var listDefaultsByState = {
|
|
881
833
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
882
834
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
883
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
884
|
-
[DEPLOYMENT_STATES.finished]:
|
|
835
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
836
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
885
837
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
886
838
|
};
|
|
887
839
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1043,6 +995,13 @@ var SSO_TYPES = {
|
|
|
1043
995
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1044
996
|
}
|
|
1045
997
|
};
|
|
998
|
+
var AUDIT_LOGS_TYPES = [
|
|
999
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
1000
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
1001
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
1002
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1003
|
+
];
|
|
1004
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1046
1005
|
var emptyWebhook = {
|
|
1047
1006
|
description: "",
|
|
1048
1007
|
enabled: true,
|
|
@@ -1091,10 +1050,12 @@ var permissionSetIds = {
|
|
|
1091
1050
|
DeployToDevices: "DeployToDevices",
|
|
1092
1051
|
ManageDevices: "ManageDevices",
|
|
1093
1052
|
ManageReleases: "ManageReleases",
|
|
1053
|
+
ManageTenants: "ManageTenants",
|
|
1094
1054
|
ManageUsers: "ManageUsers",
|
|
1095
1055
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1096
1056
|
ReadDevices: "ReadDevices",
|
|
1097
1057
|
ReadReleases: "ReadReleases",
|
|
1058
|
+
ReadTenants: "ReadTenants",
|
|
1098
1059
|
ReadUsers: "ReadUsers",
|
|
1099
1060
|
SuperUser: "SuperUser",
|
|
1100
1061
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1133,6 +1094,7 @@ var uiPermissionsById = {
|
|
|
1133
1094
|
permissionSets: {
|
|
1134
1095
|
groups: permissionSetIds.ManageDevices,
|
|
1135
1096
|
releases: permissionSetIds.ManageReleases,
|
|
1097
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1136
1098
|
userManagement: permissionSetIds.ManageUsers
|
|
1137
1099
|
},
|
|
1138
1100
|
title: "Manage",
|
|
@@ -1146,6 +1108,7 @@ var uiPermissionsById = {
|
|
|
1146
1108
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1147
1109
|
groups: permissionSetIds.ReadDevices,
|
|
1148
1110
|
releases: permissionSetIds.ReadReleases,
|
|
1111
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1149
1112
|
userManagement: permissionSetIds.ReadUsers
|
|
1150
1113
|
},
|
|
1151
1114
|
title: "Read",
|
|
@@ -1170,6 +1133,7 @@ var uiPermissionsByArea = {
|
|
|
1170
1133
|
auditlog: {
|
|
1171
1134
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1172
1135
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1136
|
+
key: "auditlog",
|
|
1173
1137
|
uiPermissions: [uiPermissionsById.read],
|
|
1174
1138
|
title: "System audit log"
|
|
1175
1139
|
},
|
|
@@ -1180,6 +1144,7 @@ var uiPermissionsByArea = {
|
|
|
1180
1144
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1181
1145
|
],
|
|
1182
1146
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1147
|
+
key: "deployments",
|
|
1183
1148
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1184
1149
|
title: "Deployments"
|
|
1185
1150
|
},
|
|
@@ -1195,6 +1160,7 @@ var uiPermissionsByArea = {
|
|
|
1195
1160
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1196
1161
|
],
|
|
1197
1162
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1163
|
+
key: "groups",
|
|
1198
1164
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1199
1165
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1200
1166
|
title: "Group Management"
|
|
@@ -1214,22 +1180,35 @@ var uiPermissionsByArea = {
|
|
|
1214
1180
|
}
|
|
1215
1181
|
],
|
|
1216
1182
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1183
|
+
key: "releases",
|
|
1217
1184
|
scope: "ReleaseTags",
|
|
1218
1185
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1219
1186
|
title: "Release Management"
|
|
1220
1187
|
},
|
|
1188
|
+
tenantManagement: {
|
|
1189
|
+
endpoints: [
|
|
1190
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1191
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1192
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1193
|
+
],
|
|
1194
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1195
|
+
key: "tenantManagement",
|
|
1196
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1197
|
+
title: "Tenant Management"
|
|
1198
|
+
},
|
|
1221
1199
|
userManagement: {
|
|
1222
1200
|
endpoints: [
|
|
1223
1201
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1224
1202
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1225
1203
|
],
|
|
1226
1204
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1205
|
+
key: "userManagement",
|
|
1227
1206
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1228
1207
|
title: "User Management"
|
|
1229
1208
|
}
|
|
1230
1209
|
};
|
|
1231
1210
|
var permissionMapper = (permission) => permission.value;
|
|
1232
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1211
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1233
1212
|
var rolesById = Object.freeze({
|
|
1234
1213
|
[staticRolesByName.admin]: {
|
|
1235
1214
|
name: "Admin",
|
|
@@ -1237,56 +1216,87 @@ var rolesById = Object.freeze({
|
|
|
1237
1216
|
description: "Full access",
|
|
1238
1217
|
permissions: [],
|
|
1239
1218
|
// permissions refers to the values returned from the backend
|
|
1240
|
-
uiPermissions:
|
|
1219
|
+
uiPermissions: {
|
|
1220
|
+
...emptyUiPermissions,
|
|
1241
1221
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1242
1222
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1243
1223
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1244
1224
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1245
1225
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1246
|
-
}
|
|
1226
|
+
}
|
|
1247
1227
|
},
|
|
1248
1228
|
[staticRolesByName.readOnly]: {
|
|
1249
1229
|
name: "Read Access",
|
|
1250
1230
|
value: staticRolesByName.readOnly,
|
|
1251
1231
|
description: "",
|
|
1252
1232
|
permissions: [],
|
|
1253
|
-
uiPermissions:
|
|
1233
|
+
uiPermissions: {
|
|
1234
|
+
...emptyUiPermissions,
|
|
1254
1235
|
deployments: [uiPermissionsById.read.value],
|
|
1255
1236
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1256
1237
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1257
1238
|
userManagement: [uiPermissionsById.read.value]
|
|
1258
|
-
}
|
|
1239
|
+
}
|
|
1259
1240
|
},
|
|
1260
1241
|
[staticRolesByName.ci]: {
|
|
1261
1242
|
name: "Releases Manager",
|
|
1262
1243
|
value: staticRolesByName.ci,
|
|
1263
1244
|
description: "",
|
|
1264
1245
|
permissions: [],
|
|
1265
|
-
uiPermissions:
|
|
1246
|
+
uiPermissions: {
|
|
1247
|
+
...emptyUiPermissions,
|
|
1266
1248
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1267
|
-
}
|
|
1249
|
+
}
|
|
1268
1250
|
},
|
|
1269
1251
|
[staticRolesByName.deploymentsManager]: {
|
|
1270
1252
|
name: "Deployments Manager",
|
|
1271
1253
|
value: staticRolesByName.deploymentsManager,
|
|
1272
1254
|
description: "",
|
|
1273
1255
|
permissions: [],
|
|
1274
|
-
uiPermissions:
|
|
1256
|
+
uiPermissions: {
|
|
1257
|
+
...emptyUiPermissions,
|
|
1275
1258
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1276
1259
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1277
1260
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1278
|
-
}
|
|
1261
|
+
}
|
|
1279
1262
|
},
|
|
1280
1263
|
[staticRolesByName.terminalAccess]: {
|
|
1281
1264
|
name: "Troubleshooting",
|
|
1282
1265
|
value: staticRolesByName.terminalAccess,
|
|
1283
1266
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1284
1267
|
permissions: [],
|
|
1285
|
-
uiPermissions:
|
|
1268
|
+
uiPermissions: {
|
|
1269
|
+
...emptyUiPermissions,
|
|
1286
1270
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1287
|
-
}
|
|
1271
|
+
}
|
|
1288
1272
|
}
|
|
1289
1273
|
});
|
|
1274
|
+
var serviceProviderRolesById = {
|
|
1275
|
+
admin: {
|
|
1276
|
+
name: "Admin",
|
|
1277
|
+
value: staticRolesByName.admin,
|
|
1278
|
+
description: "Full access",
|
|
1279
|
+
permissions: [],
|
|
1280
|
+
uiPermissions: {
|
|
1281
|
+
...emptyUiPermissions,
|
|
1282
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1283
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1284
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
readOnly: {
|
|
1288
|
+
name: "Read access",
|
|
1289
|
+
value: staticRolesByName.admin,
|
|
1290
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1291
|
+
permissions: [],
|
|
1292
|
+
uiPermissions: {
|
|
1293
|
+
...emptyUiPermissions,
|
|
1294
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1295
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1296
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1290
1300
|
var defaultPermissionSets = {
|
|
1291
1301
|
[permissionSetIds.Basic]: {
|
|
1292
1302
|
name: permissionSetIds.Basic,
|
|
@@ -1297,7 +1307,9 @@ var defaultPermissionSets = {
|
|
|
1297
1307
|
},
|
|
1298
1308
|
[permissionSetIds.SuperUser]: {
|
|
1299
1309
|
name: permissionSetIds.SuperUser,
|
|
1300
|
-
result:
|
|
1310
|
+
result: {
|
|
1311
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1312
|
+
}
|
|
1301
1313
|
},
|
|
1302
1314
|
[permissionSetIds.ManageUsers]: {
|
|
1303
1315
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1317,6 +1329,18 @@ var defaultPermissionSets = {
|
|
|
1317
1329
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1318
1330
|
}
|
|
1319
1331
|
},
|
|
1332
|
+
[permissionSetIds.ReadTenants]: {
|
|
1333
|
+
name: permissionSetIds.ReadTenants,
|
|
1334
|
+
result: {
|
|
1335
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
[permissionSetIds.ManageTenants]: {
|
|
1339
|
+
name: permissionSetIds.ManageTenants,
|
|
1340
|
+
result: {
|
|
1341
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1320
1344
|
[permissionSetIds.ReadUsers]: {
|
|
1321
1345
|
name: permissionSetIds.ReadUsers,
|
|
1322
1346
|
result: {
|
|
@@ -1370,11 +1394,12 @@ var defaultPermissionSets = {
|
|
|
1370
1394
|
};
|
|
1371
1395
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1372
1396
|
var OWN_USER_ID = "me";
|
|
1373
|
-
var rolesByName =
|
|
1397
|
+
var rolesByName = {
|
|
1398
|
+
...staticRolesByName,
|
|
1374
1399
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1375
1400
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1376
1401
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1377
|
-
}
|
|
1402
|
+
};
|
|
1378
1403
|
var twoFAStates = {
|
|
1379
1404
|
enabled: "enabled",
|
|
1380
1405
|
disabled: "disabled",
|
|
@@ -1392,18 +1417,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
1392
1417
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
1393
1418
|
var tokenCache = "";
|
|
1394
1419
|
var getSessionInfo = () => {
|
|
1395
|
-
|
|
1396
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
1420
|
+
let sessionInfo = { ...emptySession };
|
|
1397
1421
|
try {
|
|
1398
|
-
sessionInfo = JSON.parse(
|
|
1399
|
-
} catch
|
|
1422
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
1423
|
+
} catch {
|
|
1400
1424
|
}
|
|
1401
1425
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
1402
1426
|
cleanUp();
|
|
1403
|
-
return
|
|
1427
|
+
return { ...emptySession };
|
|
1404
1428
|
}
|
|
1405
1429
|
if (!sessionInfo.token) {
|
|
1406
|
-
let jwtTokenFromCookie =
|
|
1430
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
1407
1431
|
if (jwtTokenFromCookie) {
|
|
1408
1432
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
1409
1433
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -1431,8 +1455,7 @@ var maxSessionAge = 900;
|
|
|
1431
1455
|
|
|
1432
1456
|
// src/api/general-api.ts
|
|
1433
1457
|
var unauthorizedRedirect = (error) => {
|
|
1434
|
-
|
|
1435
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
1458
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
1436
1459
|
cleanUp();
|
|
1437
1460
|
window.location.replace("/ui/");
|
|
1438
1461
|
}
|
|
@@ -1442,7 +1465,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
1442
1465
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
1443
1466
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
1444
1467
|
authenticatedRequest.interceptors.request.use(
|
|
1445
|
-
(config) =>
|
|
1468
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
1446
1469
|
(error) => Promise.reject(error)
|
|
1447
1470
|
);
|
|
1448
1471
|
var Api = {
|
|
@@ -1450,7 +1473,7 @@ var Api = {
|
|
|
1450
1473
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
1451
1474
|
patch: authenticatedRequest.patch,
|
|
1452
1475
|
post: authenticatedRequest.post,
|
|
1453
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
1476
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
1454
1477
|
put: authenticatedRequest.put,
|
|
1455
1478
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
1456
1479
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -1481,10 +1504,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
1481
1504
|
var getSearchedDevices = (0, import_toolkit.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
1482
1505
|
var getVersionInformation = (0, import_toolkit.createSelector)(
|
|
1483
1506
|
[getFullVersionInformation, getFeatures],
|
|
1484
|
-
(
|
|
1485
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
1486
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
1487
|
-
}
|
|
1507
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
1488
1508
|
);
|
|
1489
1509
|
var getIsPreview = (0, import_toolkit.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers.versionCompare)(Integration, "next") > -1);
|
|
1490
1510
|
|
|
@@ -1501,8 +1521,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
1501
1521
|
var getMappedDeploymentSelection = (0, import_toolkit2.createSelector)(
|
|
1502
1522
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
1503
1523
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
1504
|
-
|
|
1505
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
1524
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
1506
1525
|
return selection.reduce((accu, id) => {
|
|
1507
1526
|
if (deploymentsById[id]) {
|
|
1508
1527
|
accu.push(deploymentsById[id]);
|
|
@@ -1546,7 +1565,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
1546
1565
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
1547
1566
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
1548
1567
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
1549
|
-
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
1568
|
+
var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
1569
|
+
...filteringAttributes,
|
|
1550
1570
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
1551
1571
|
}));
|
|
1552
1572
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -1574,10 +1594,7 @@ var getDeviceCountsByStatus = (0, import_toolkit3.createSelector)(
|
|
|
1574
1594
|
return accu;
|
|
1575
1595
|
}, {})
|
|
1576
1596
|
);
|
|
1577
|
-
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
1578
|
-
var _a;
|
|
1579
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
1580
|
-
});
|
|
1597
|
+
var getDeviceById = (0, import_toolkit3.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
1581
1598
|
var getSelectedGroupInfo = (0, import_toolkit3.createSelector)(
|
|
1582
1599
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
1583
1600
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -1594,17 +1611,13 @@ var getLimitMaxed = (0, import_toolkit3.createSelector)(
|
|
|
1594
1611
|
[getAcceptedDevices, getDeviceLimit],
|
|
1595
1612
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
1596
1613
|
);
|
|
1597
|
-
var
|
|
1598
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], (_a) => {
|
|
1599
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
1600
|
-
return groups;
|
|
1601
|
-
});
|
|
1614
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
1602
1615
|
var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById) => {
|
|
1603
1616
|
const groupNames = Object.keys(groupsById).sort();
|
|
1604
1617
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
1605
1618
|
(accu, [groupname, group]) => {
|
|
1606
1619
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
1607
|
-
const groupItem =
|
|
1620
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
1608
1621
|
if (group.filters.length > 0) {
|
|
1609
1622
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
1610
1623
|
accu.dynamic.push(groupItem);
|
|
@@ -1618,7 +1631,7 @@ var getGroups = (0, import_toolkit3.createSelector)([getGroupsById], (groupsById
|
|
|
1618
1631
|
},
|
|
1619
1632
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
1620
1633
|
);
|
|
1621
|
-
return
|
|
1634
|
+
return { groupNames, ...groupedGroups };
|
|
1622
1635
|
});
|
|
1623
1636
|
var getAttributesList = (0, import_toolkit3.createSelector)(
|
|
1624
1637
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -1653,15 +1666,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
1653
1666
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
1654
1667
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
1655
1668
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
1656
|
-
var getTenantsList = (state) => state.organization.
|
|
1669
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
1657
1670
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
1658
1671
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
1659
1672
|
var getDeviceTwinIntegrations = (0, import_toolkit4.createSelector)(
|
|
1660
1673
|
[getExternalIntegrations],
|
|
1661
|
-
(integrations) => integrations.filter((integration) =>
|
|
1662
|
-
var _a;
|
|
1663
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
1664
|
-
})
|
|
1674
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
1665
1675
|
);
|
|
1666
1676
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
1667
1677
|
var getWebhooks = (0, import_toolkit4.createSelector)(
|
|
@@ -1695,15 +1705,12 @@ var filterProcessors = {
|
|
|
1695
1705
|
var filterAliases = {
|
|
1696
1706
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
1697
1707
|
};
|
|
1698
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1705
|
-
};
|
|
1706
|
-
});
|
|
1708
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
1709
|
+
scope: filter.scope,
|
|
1710
|
+
attribute: filter.key,
|
|
1711
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
1712
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
1713
|
+
}));
|
|
1707
1714
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
1708
1715
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
1709
1716
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -1713,14 +1720,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
1713
1720
|
});
|
|
1714
1721
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
1715
1722
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
1716
|
-
return
|
|
1723
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
1717
1724
|
}
|
|
1718
1725
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
1719
1726
|
});
|
|
1720
1727
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
1721
|
-
var _a;
|
|
1722
1728
|
let applicableFilters = [...filters];
|
|
1723
|
-
if (typeof group === "string" && !(
|
|
1729
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
1724
1730
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
1725
1731
|
}
|
|
1726
1732
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -1741,12 +1747,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
1741
1747
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
1742
1748
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
1743
1749
|
if (id && byId[id]) {
|
|
1744
|
-
accu.push(
|
|
1750
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
1745
1751
|
}
|
|
1746
1752
|
return accu;
|
|
1747
1753
|
}, []);
|
|
1748
1754
|
};
|
|
1749
|
-
var mergePermissions = (existingPermissions =
|
|
1755
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
1750
1756
|
(accu, [key, value]) => {
|
|
1751
1757
|
let values;
|
|
1752
1758
|
if (!accu[key]) {
|
|
@@ -1756,12 +1762,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
1756
1762
|
if (Array.isArray(value)) {
|
|
1757
1763
|
values = [...value, ...accu[key]].filter(import_helpers3.duplicateFilter);
|
|
1758
1764
|
} else {
|
|
1759
|
-
values = mergePermissions(accu[key],
|
|
1765
|
+
values = mergePermissions(accu[key], { ...value });
|
|
1760
1766
|
}
|
|
1761
1767
|
accu[key] = values;
|
|
1762
1768
|
return accu;
|
|
1763
1769
|
},
|
|
1764
|
-
|
|
1770
|
+
{ ...addedPermissions }
|
|
1765
1771
|
);
|
|
1766
1772
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
1767
1773
|
(accu, roleId) => {
|
|
@@ -1770,20 +1776,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
1770
1776
|
}
|
|
1771
1777
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
1772
1778
|
},
|
|
1773
|
-
|
|
1779
|
+
{ ...emptyUiPermissions }
|
|
1774
1780
|
);
|
|
1775
1781
|
var progress = ({ loaded, total }) => {
|
|
1776
1782
|
let uploadProgress4 = loaded / total * 100;
|
|
1777
1783
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
1778
1784
|
};
|
|
1779
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
1780
|
-
var _a, _b2, _c, _d, _e;
|
|
1781
|
-
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;
|
|
1782
|
-
};
|
|
1785
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
1783
1786
|
var preformatWithRequestID = (res, failMsg) => {
|
|
1784
1787
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
1785
1788
|
try {
|
|
1786
|
-
if (
|
|
1789
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
1787
1790
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
1788
1791
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
1789
1792
|
}
|
|
@@ -1798,9 +1801,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
1798
1801
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1799
1802
|
return accu;
|
|
1800
1803
|
}
|
|
1801
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
1804
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
1805
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
1802
1806
|
[attribute.name]: attribute.value
|
|
1803
|
-
}
|
|
1807
|
+
};
|
|
1804
1808
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
1805
1809
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
1806
1810
|
}
|
|
@@ -1819,15 +1823,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
1819
1823
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
1820
1824
|
var getReleaseMappingDefaults = () => ({});
|
|
1821
1825
|
var getReleasesList = (0, import_toolkit5.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
1822
|
-
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
1826
|
+
var getReleaseTagsById = (0, import_toolkit5.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
1823
1827
|
var getHasReleases = (0, import_toolkit5.createSelector)(
|
|
1824
1828
|
[getReleaseListState, getReleasesById],
|
|
1825
1829
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
1826
1830
|
);
|
|
1827
|
-
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
1828
|
-
var _a;
|
|
1829
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
1830
|
-
});
|
|
1831
|
+
var getSelectedRelease = (0, import_toolkit5.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
1831
1832
|
|
|
1832
1833
|
// src/usersSlice/selectors.ts
|
|
1833
1834
|
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
@@ -1836,10 +1837,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
1836
1837
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
1837
1838
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
1838
1839
|
var getUsersById = (state) => state.users.byId;
|
|
1839
|
-
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
1840
|
-
var _a;
|
|
1841
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
1842
|
-
});
|
|
1840
|
+
var getCurrentUser = (0, import_toolkit6.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
1843
1841
|
var getUserSettings = (state) => state.users.userSettings;
|
|
1844
1842
|
var getIsDarkMode = (0, import_toolkit6.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
1845
1843
|
var getShowHelptips = (0, import_toolkit6.createSelector)(
|
|
@@ -1850,22 +1848,22 @@ var getTooltipsState = (0, import_toolkit6.createSelector)(
|
|
|
1850
1848
|
[getTooltipsById, getUserSettings],
|
|
1851
1849
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
1852
1850
|
(accu, [id, value]) => {
|
|
1853
|
-
accu[id] =
|
|
1851
|
+
accu[id] = { ...accu[id], ...value };
|
|
1854
1852
|
return accu;
|
|
1855
1853
|
},
|
|
1856
|
-
|
|
1854
|
+
{ ...tooltips }
|
|
1857
1855
|
)
|
|
1858
1856
|
);
|
|
1859
1857
|
var getHas2FA = (0, import_toolkit6.createSelector)(
|
|
1860
1858
|
[getCurrentUser],
|
|
1861
1859
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
1862
1860
|
);
|
|
1863
|
-
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
1861
|
+
var getIdAttribute = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
1864
1862
|
var getOfflineThresholdSettings = (0, import_toolkit6.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
1865
|
-
interval:
|
|
1866
|
-
intervalUnit:
|
|
1863
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
1864
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
1867
1865
|
}));
|
|
1868
|
-
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
1866
|
+
var getRolesList = (0, import_toolkit6.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
1869
1867
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
1870
1868
|
|
|
1871
1869
|
// src/commonSelectors.ts
|
|
@@ -1884,8 +1882,7 @@ var getSearchEndpoint = (0, import_toolkit7.createSelector)(
|
|
|
1884
1882
|
var getUserRoles = (0, import_toolkit7.createSelector)(
|
|
1885
1883
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
1886
1884
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
1887
|
-
|
|
1888
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1885
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
1889
1886
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
1890
1887
|
return { isAdmin, uiPermissions };
|
|
1891
1888
|
}
|
|
@@ -1954,10 +1951,11 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1954
1951
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
1955
1952
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
1956
1953
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1957
|
-
const updateAttribute =
|
|
1954
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
1958
1955
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
1959
1956
|
const attributes = [
|
|
1960
|
-
...previousFilters.map((item) =>
|
|
1957
|
+
...previousFilters.map((item) => ({
|
|
1958
|
+
...item,
|
|
1961
1959
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
1962
1960
|
category: "recently used",
|
|
1963
1961
|
priority: 0
|
|
@@ -1975,14 +1973,13 @@ var getFilterAttributes = (0, import_toolkit7.createSelector)(
|
|
|
1975
1973
|
return (0, import_helpers4.attributeDuplicateFilter)(attributes, "key");
|
|
1976
1974
|
}
|
|
1977
1975
|
);
|
|
1978
|
-
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], (
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
});
|
|
1976
|
+
var getOnboardingState = (0, import_toolkit7.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
1977
|
+
...remainder,
|
|
1978
|
+
...onboarding,
|
|
1979
|
+
complete: onboarding.complete || complete,
|
|
1980
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
1981
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
1982
|
+
}));
|
|
1986
1983
|
var getDemoDeviceAddress = (0, import_toolkit7.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
1987
1984
|
const demoDeviceAddress = `http://${(0, import_helpers4.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
1988
1985
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2003,12 +2000,11 @@ var getDeploymentRelease = (0, import_toolkit7.createSelector)(
|
|
|
2003
2000
|
var getSelectedDeploymentData = (0, import_toolkit7.createSelector)(
|
|
2004
2001
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2005
2002
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2006
|
-
|
|
2007
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2003
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2008
2004
|
const { devices = {} } = deployment;
|
|
2009
2005
|
return {
|
|
2010
2006
|
deployment,
|
|
2011
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2007
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2012
2008
|
};
|
|
2013
2009
|
}
|
|
2014
2010
|
);
|
|
@@ -2023,8 +2019,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit7.createSelector)(
|
|
|
2023
2019
|
}, {})
|
|
2024
2020
|
);
|
|
2025
2021
|
var getGroupNames = (0, import_toolkit7.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2026
|
-
|
|
2027
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2022
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2028
2023
|
if (staticOnly) {
|
|
2029
2024
|
return Object.keys(uiPermissions.groups).sort();
|
|
2030
2025
|
}
|
|
@@ -2058,9 +2053,25 @@ var getAuditlogDevice = (0, import_toolkit7.createSelector)([getAuditLogEntry, g
|
|
|
2058
2053
|
if (auditlogEvent) {
|
|
2059
2054
|
const { object = {} } = auditlogEvent;
|
|
2060
2055
|
const { device = {}, id, type } = object;
|
|
2061
|
-
auditlogDevice = type === "device" ?
|
|
2056
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2062
2057
|
}
|
|
2063
|
-
return
|
|
2058
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2059
|
+
});
|
|
2060
|
+
var getRelevantRoles = (0, import_toolkit7.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2061
|
+
if (service_provider) {
|
|
2062
|
+
return roles.reduce((accu, role) => {
|
|
2063
|
+
if (rolesById[role.id]) {
|
|
2064
|
+
return accu;
|
|
2065
|
+
}
|
|
2066
|
+
accu.push(role);
|
|
2067
|
+
return accu;
|
|
2068
|
+
}, Object.values(serviceProviderRolesById));
|
|
2069
|
+
}
|
|
2070
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2071
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2072
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2073
|
+
return accu;
|
|
2074
|
+
}, roles);
|
|
2064
2075
|
});
|
|
2065
2076
|
|
|
2066
2077
|
// src/appSlice/index.ts
|
|
@@ -2138,7 +2149,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2138
2149
|
initialState,
|
|
2139
2150
|
reducers: {
|
|
2140
2151
|
setFeatures: (state, action) => {
|
|
2141
|
-
state.features =
|
|
2152
|
+
state.features = {
|
|
2153
|
+
...state.features,
|
|
2154
|
+
...action.payload
|
|
2155
|
+
};
|
|
2142
2156
|
},
|
|
2143
2157
|
setSnackbar: (state, { payload }) => {
|
|
2144
2158
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -2163,7 +2177,10 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2163
2177
|
state.hostedAnnouncement = action.payload;
|
|
2164
2178
|
},
|
|
2165
2179
|
setSearchState: (state, action) => {
|
|
2166
|
-
state.searchState =
|
|
2180
|
+
state.searchState = {
|
|
2181
|
+
...state.searchState,
|
|
2182
|
+
...action.payload
|
|
2183
|
+
};
|
|
2167
2184
|
},
|
|
2168
2185
|
setOfflineThreshold: (state, action) => {
|
|
2169
2186
|
state.offlineThreshold = action.payload;
|
|
@@ -2174,20 +2191,23 @@ var appSlice = (0, import_toolkit8.createSlice)({
|
|
|
2174
2191
|
},
|
|
2175
2192
|
uploadProgress: (state, action) => {
|
|
2176
2193
|
const { id, progress: progress2 } = action.payload;
|
|
2177
|
-
state.uploadsById[id] =
|
|
2194
|
+
state.uploadsById[id] = {
|
|
2195
|
+
...state.uploadsById[id],
|
|
2178
2196
|
progress: progress2
|
|
2179
|
-
}
|
|
2197
|
+
};
|
|
2180
2198
|
},
|
|
2181
2199
|
cleanUpUpload: (state, action) => {
|
|
2182
|
-
|
|
2183
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2200
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
2184
2201
|
state.uploadsById = remainder;
|
|
2185
2202
|
},
|
|
2186
2203
|
setVersionInformation: (state, action) => {
|
|
2187
|
-
state.versionInformation =
|
|
2204
|
+
state.versionInformation = {
|
|
2205
|
+
...state.versionInformation,
|
|
2206
|
+
...action.payload
|
|
2207
|
+
};
|
|
2188
2208
|
},
|
|
2189
2209
|
setEnvironmentData: (state, action) => {
|
|
2190
|
-
return
|
|
2210
|
+
return { ...state, ...action.payload };
|
|
2191
2211
|
}
|
|
2192
2212
|
}
|
|
2193
2213
|
});
|
|
@@ -2219,7 +2239,7 @@ var initialState2 = {
|
|
|
2219
2239
|
sourceWindow: -1
|
|
2220
2240
|
},
|
|
2221
2241
|
binaryDeltaLimits: {
|
|
2222
|
-
timeout:
|
|
2242
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
2223
2243
|
sourceWindow: limitDefault,
|
|
2224
2244
|
inputWindow: limitDefault,
|
|
2225
2245
|
duplicatesWindow: limitDefault,
|
|
@@ -2229,10 +2249,10 @@ var initialState2 = {
|
|
|
2229
2249
|
deploymentDeviceLimit: 5e3,
|
|
2230
2250
|
selectedDeviceIds: [],
|
|
2231
2251
|
selectionState: {
|
|
2232
|
-
finished:
|
|
2233
|
-
inprogress:
|
|
2234
|
-
pending:
|
|
2235
|
-
scheduled:
|
|
2252
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
2253
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2254
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
2255
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
2236
2256
|
general: {
|
|
2237
2257
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
2238
2258
|
showCreationDialog: false,
|
|
@@ -2248,40 +2268,55 @@ var deploymentsSlice = (0, import_toolkit9.createSlice)({
|
|
|
2248
2268
|
initialState: initialState2,
|
|
2249
2269
|
reducers: {
|
|
2250
2270
|
createdDeployment: (state, action) => {
|
|
2251
|
-
state.byId[action.payload.id] =
|
|
2271
|
+
state.byId[action.payload.id] = {
|
|
2272
|
+
...deploymentPrototype,
|
|
2273
|
+
...action.payload
|
|
2274
|
+
};
|
|
2252
2275
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
2253
2276
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
2254
2277
|
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;
|
|
2255
2278
|
},
|
|
2256
2279
|
removedDeployment: (state, action) => {
|
|
2257
|
-
|
|
2258
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
2280
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
2259
2281
|
state.byId = remainder;
|
|
2260
2282
|
},
|
|
2261
2283
|
receivedDeployment: (state, action) => {
|
|
2262
|
-
state.byId[action.payload.id] =
|
|
2284
|
+
state.byId[action.payload.id] = {
|
|
2285
|
+
...state.byId[action.payload.id] || {},
|
|
2286
|
+
...action.payload
|
|
2287
|
+
};
|
|
2263
2288
|
},
|
|
2264
2289
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
2265
2290
|
const { id, deviceId, log } = action.payload;
|
|
2266
|
-
const deployment =
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2291
|
+
const deployment = {
|
|
2292
|
+
...deploymentPrototype,
|
|
2293
|
+
...state.byId[id]
|
|
2294
|
+
};
|
|
2295
|
+
state.byId[id] = {
|
|
2296
|
+
...deployment,
|
|
2297
|
+
devices: {
|
|
2298
|
+
...deployment.devices,
|
|
2299
|
+
[deviceId]: {
|
|
2300
|
+
...deployment.devices[deviceId],
|
|
2270
2301
|
log
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2274
2305
|
},
|
|
2275
2306
|
receivedDeploymentDevices: (state, action) => {
|
|
2276
2307
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
2277
|
-
state.byId[id] =
|
|
2308
|
+
state.byId[id] = {
|
|
2309
|
+
...state.byId[id],
|
|
2278
2310
|
devices,
|
|
2279
2311
|
totalDeviceCount
|
|
2280
|
-
}
|
|
2312
|
+
};
|
|
2281
2313
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
2282
2314
|
},
|
|
2283
2315
|
receivedDeployments: (state, action) => {
|
|
2284
|
-
state.byId =
|
|
2316
|
+
state.byId = {
|
|
2317
|
+
...state.byId,
|
|
2318
|
+
...action.payload
|
|
2319
|
+
};
|
|
2285
2320
|
},
|
|
2286
2321
|
receivedDeploymentsForStatus: (state, action) => {
|
|
2287
2322
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -2323,9 +2358,9 @@ var initialState3 = {
|
|
|
2323
2358
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
2324
2359
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
2325
2360
|
},
|
|
2326
|
-
deviceList:
|
|
2327
|
-
deviceIds: []
|
|
2328
|
-
|
|
2361
|
+
deviceList: {
|
|
2362
|
+
deviceIds: [],
|
|
2363
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2329
2364
|
selectedAttributes: [],
|
|
2330
2365
|
selectedIssues: [],
|
|
2331
2366
|
selection: [],
|
|
@@ -2336,7 +2371,7 @@ var initialState3 = {
|
|
|
2336
2371
|
},
|
|
2337
2372
|
state: DEVICE_STATES.accepted,
|
|
2338
2373
|
total: 0
|
|
2339
|
-
}
|
|
2374
|
+
},
|
|
2340
2375
|
filters: [
|
|
2341
2376
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
2342
2377
|
],
|
|
@@ -2371,49 +2406,59 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2371
2406
|
},
|
|
2372
2407
|
addToGroup: (state, action) => {
|
|
2373
2408
|
const { group, deviceIds } = action.payload;
|
|
2374
|
-
const maybeExistingGroup =
|
|
2409
|
+
const maybeExistingGroup = {
|
|
2375
2410
|
filters: [],
|
|
2376
|
-
deviceIds: []
|
|
2377
|
-
|
|
2378
|
-
|
|
2411
|
+
deviceIds: [],
|
|
2412
|
+
...state.groups.byId[group]
|
|
2413
|
+
};
|
|
2414
|
+
state.groups.byId[group] = {
|
|
2415
|
+
...maybeExistingGroup,
|
|
2379
2416
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers5.duplicateFilter),
|
|
2380
2417
|
total: (maybeExistingGroup.total || 0) + 1
|
|
2381
|
-
}
|
|
2418
|
+
};
|
|
2382
2419
|
},
|
|
2383
2420
|
removeFromGroup: (state, action) => {
|
|
2384
2421
|
const { group, deviceIds: removedIds } = action.payload;
|
|
2385
|
-
const
|
|
2386
|
-
const changedGroup =
|
|
2422
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
2423
|
+
const changedGroup = {
|
|
2424
|
+
...maybeExistingGroup,
|
|
2387
2425
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
2388
2426
|
total: Math.max(total - removedIds.length, 0)
|
|
2389
|
-
}
|
|
2427
|
+
};
|
|
2390
2428
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
2391
2429
|
state.groups.byId[group] = changedGroup;
|
|
2392
2430
|
return;
|
|
2393
2431
|
} else if (state.groups.selectedGroup === group) {
|
|
2394
2432
|
state.groups.selectedGroup = void 0;
|
|
2395
2433
|
}
|
|
2396
|
-
const
|
|
2434
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
2397
2435
|
state.groups.byId = remainingById;
|
|
2398
2436
|
},
|
|
2399
2437
|
addGroup: (state, action) => {
|
|
2400
2438
|
const { groupName, group } = action.payload;
|
|
2401
|
-
state.groups.byId[groupName] =
|
|
2439
|
+
state.groups.byId[groupName] = {
|
|
2440
|
+
...state.groups.byId[groupName],
|
|
2441
|
+
...group
|
|
2442
|
+
};
|
|
2402
2443
|
},
|
|
2403
2444
|
selectGroup: (state, { payload: group }) => {
|
|
2404
2445
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
2405
2446
|
state.groups.selectedGroup = group;
|
|
2406
2447
|
},
|
|
2407
2448
|
removeGroup: (state, action) => {
|
|
2408
|
-
|
|
2409
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
2449
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
2410
2450
|
state.groups.byId = remainingById;
|
|
2411
2451
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
2412
2452
|
},
|
|
2413
2453
|
setDeviceListState: (state, action) => {
|
|
2414
|
-
state.deviceList =
|
|
2415
|
-
|
|
2416
|
-
|
|
2454
|
+
state.deviceList = {
|
|
2455
|
+
...state.deviceList,
|
|
2456
|
+
...action.payload,
|
|
2457
|
+
sort: {
|
|
2458
|
+
...state.deviceList.sort,
|
|
2459
|
+
...action.payload.sort
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2417
2462
|
},
|
|
2418
2463
|
setFilterAttributes: (state, action) => {
|
|
2419
2464
|
state.filteringAttributes = action.payload;
|
|
@@ -2422,7 +2467,10 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2422
2467
|
state.filteringAttributesConfig = action.payload;
|
|
2423
2468
|
},
|
|
2424
2469
|
receivedDevices: (state, action) => {
|
|
2425
|
-
state.byId =
|
|
2470
|
+
state.byId = {
|
|
2471
|
+
...state.byId,
|
|
2472
|
+
...action.payload
|
|
2473
|
+
};
|
|
2426
2474
|
},
|
|
2427
2475
|
setDeviceFilters: (state, action) => {
|
|
2428
2476
|
if ((0, import_helpers5.deepCompare)(action.payload, state.filters)) {
|
|
@@ -2453,7 +2501,10 @@ var devicesSlice = (0, import_toolkit10.createSlice)({
|
|
|
2453
2501
|
state.limit = action.payload;
|
|
2454
2502
|
},
|
|
2455
2503
|
receivedDevice: (state, action) => {
|
|
2456
|
-
state.byId[action.payload.id] =
|
|
2504
|
+
state.byId[action.payload.id] = {
|
|
2505
|
+
...state.byId[action.payload.id],
|
|
2506
|
+
...action.payload
|
|
2507
|
+
};
|
|
2457
2508
|
},
|
|
2458
2509
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
2459
2510
|
const { deviceId, authId } = action.payload;
|
|
@@ -2474,15 +2525,17 @@ var import_toolkit11 = require("@reduxjs/toolkit");
|
|
|
2474
2525
|
var sliceName4 = "monitor";
|
|
2475
2526
|
var initialState4 = {
|
|
2476
2527
|
alerts: {
|
|
2477
|
-
alertList:
|
|
2528
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
2478
2529
|
byDeviceId: {}
|
|
2479
2530
|
},
|
|
2480
2531
|
issueCounts: {
|
|
2481
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
2532
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
2482
2533
|
},
|
|
2483
2534
|
settings: {
|
|
2484
2535
|
global: {
|
|
2485
|
-
channels:
|
|
2536
|
+
channels: {
|
|
2537
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
2538
|
+
}
|
|
2486
2539
|
}
|
|
2487
2540
|
}
|
|
2488
2541
|
};
|
|
@@ -2500,14 +2553,14 @@ var monitorSlice = (0, import_toolkit11.createSlice)({
|
|
|
2500
2553
|
},
|
|
2501
2554
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
2502
2555
|
const { deviceId, alerts } = action.payload;
|
|
2503
|
-
state.alerts.byDeviceId[deviceId] =
|
|
2556
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
2504
2557
|
},
|
|
2505
2558
|
receiveDeviceIssueCounts: (state, action) => {
|
|
2506
2559
|
const { issueType, counts } = action.payload;
|
|
2507
2560
|
state.issueCounts.byType[issueType] = counts;
|
|
2508
2561
|
},
|
|
2509
2562
|
setAlertListState: (state, action) => {
|
|
2510
|
-
state.alerts.alertList =
|
|
2563
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
2511
2564
|
}
|
|
2512
2565
|
}
|
|
2513
2566
|
});
|
|
@@ -2531,7 +2584,7 @@ var onboardingSlice = (0, import_toolkit12.createSlice)({
|
|
|
2531
2584
|
initialState: initialState5,
|
|
2532
2585
|
reducers: {
|
|
2533
2586
|
setOnboardingState: (state, action) => {
|
|
2534
|
-
return
|
|
2587
|
+
return { ...state, ...action.payload };
|
|
2535
2588
|
},
|
|
2536
2589
|
setDemoArtifactPort: (state, action) => {
|
|
2537
2590
|
state.demoArtifactPort = action.payload;
|
|
@@ -2569,21 +2622,23 @@ var initialState6 = {
|
|
|
2569
2622
|
brand: ""
|
|
2570
2623
|
},
|
|
2571
2624
|
intentId: null,
|
|
2625
|
+
tenantList: {
|
|
2626
|
+
...TENANT_LIST_DEFAULT,
|
|
2627
|
+
total: 0,
|
|
2628
|
+
tenants: [],
|
|
2629
|
+
selectedTenant: null,
|
|
2630
|
+
sort: {
|
|
2631
|
+
direction: SORTING_OPTIONS.desc,
|
|
2632
|
+
key: "name"
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2572
2635
|
organization: {
|
|
2573
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
2574
|
-
total: 0,
|
|
2575
|
-
tenants: [],
|
|
2576
|
-
selectedTenant: null,
|
|
2577
|
-
sort: {
|
|
2578
|
-
direction: SORTING_OPTIONS.desc,
|
|
2579
|
-
key: "name"
|
|
2580
|
-
}
|
|
2581
|
-
})
|
|
2582
2636
|
// id, name, status, tenant_token, plan
|
|
2583
2637
|
},
|
|
2584
2638
|
auditlog: {
|
|
2585
2639
|
events: [],
|
|
2586
|
-
selectionState:
|
|
2640
|
+
selectionState: {
|
|
2641
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2587
2642
|
detail: void 0,
|
|
2588
2643
|
endDate: void 0,
|
|
2589
2644
|
selectedIssue: void 0,
|
|
@@ -2592,7 +2647,7 @@ var initialState6 = {
|
|
|
2592
2647
|
total: 0,
|
|
2593
2648
|
type: void 0,
|
|
2594
2649
|
user: void 0
|
|
2595
|
-
}
|
|
2650
|
+
}
|
|
2596
2651
|
},
|
|
2597
2652
|
externalDeviceIntegrations: [
|
|
2598
2653
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -2615,7 +2670,10 @@ var organizationSlice = (0, import_toolkit13.createSlice)({
|
|
|
2615
2670
|
state.auditlog.selectionState.total = total;
|
|
2616
2671
|
},
|
|
2617
2672
|
setAuditLogState: (state, action) => {
|
|
2618
|
-
state.auditlog.selectionState =
|
|
2673
|
+
state.auditlog.selectionState = {
|
|
2674
|
+
...state.auditlog.selectionState,
|
|
2675
|
+
...action.payload
|
|
2676
|
+
};
|
|
2619
2677
|
},
|
|
2620
2678
|
receiveCurrentCard: (state, action) => {
|
|
2621
2679
|
state.card = action.payload;
|
|
@@ -2624,12 +2682,10 @@ var organizationSlice = (0, import_toolkit13.createSlice)({
|
|
|
2624
2682
|
state.intentId = action.payload;
|
|
2625
2683
|
},
|
|
2626
2684
|
setOrganization: (state, action) => {
|
|
2627
|
-
state.organization =
|
|
2628
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
2629
|
-
});
|
|
2685
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
2630
2686
|
},
|
|
2631
2687
|
setTenantListState: (state, action) => {
|
|
2632
|
-
state.
|
|
2688
|
+
state.tenantList = action.payload;
|
|
2633
2689
|
},
|
|
2634
2690
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
2635
2691
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2689,7 +2745,8 @@ var initialState7 = {
|
|
|
2689
2745
|
}
|
|
2690
2746
|
*/
|
|
2691
2747
|
},
|
|
2692
|
-
releasesList:
|
|
2748
|
+
releasesList: {
|
|
2749
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2693
2750
|
searchedIds: [],
|
|
2694
2751
|
releaseIds: [],
|
|
2695
2752
|
selection: [],
|
|
@@ -2703,7 +2760,7 @@ var initialState7 = {
|
|
|
2703
2760
|
selectedTags: [],
|
|
2704
2761
|
total: 0,
|
|
2705
2762
|
type: ""
|
|
2706
|
-
}
|
|
2763
|
+
},
|
|
2707
2764
|
tags: [],
|
|
2708
2765
|
updateTypes: [],
|
|
2709
2766
|
/*
|
|
@@ -2729,8 +2786,7 @@ var releaseSlice = (0, import_toolkit14.createSlice)({
|
|
|
2729
2786
|
state.updateTypes = action.payload;
|
|
2730
2787
|
},
|
|
2731
2788
|
removeRelease: (state, action) => {
|
|
2732
|
-
|
|
2733
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2789
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2734
2790
|
state.byId = byId;
|
|
2735
2791
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2736
2792
|
},
|
|
@@ -2763,8 +2819,12 @@ var initialState8 = {
|
|
|
2763
2819
|
previousPhases: [],
|
|
2764
2820
|
retries: 0
|
|
2765
2821
|
},
|
|
2766
|
-
permissionSetsById:
|
|
2767
|
-
|
|
2822
|
+
permissionSetsById: {
|
|
2823
|
+
...defaultPermissionSets
|
|
2824
|
+
},
|
|
2825
|
+
rolesById: {
|
|
2826
|
+
...rolesById
|
|
2827
|
+
},
|
|
2768
2828
|
settingsInitialized: false,
|
|
2769
2829
|
showConnectDeviceDialog: false,
|
|
2770
2830
|
showFeedbackDialog: false,
|
|
@@ -2804,13 +2864,15 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2804
2864
|
state.byId[0] = action.payload;
|
|
2805
2865
|
},
|
|
2806
2866
|
removedUser: (state, action) => {
|
|
2807
|
-
|
|
2808
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2867
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2809
2868
|
state.byId = byId;
|
|
2810
2869
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2811
2870
|
},
|
|
2812
2871
|
updatedUser: (state, action) => {
|
|
2813
|
-
state.byId[action.payload.id] =
|
|
2872
|
+
state.byId[action.payload.id] = {
|
|
2873
|
+
...state.byId[action.payload.id],
|
|
2874
|
+
...action.payload
|
|
2875
|
+
};
|
|
2814
2876
|
},
|
|
2815
2877
|
receivedPermissionSets: (state, action) => {
|
|
2816
2878
|
state.permissionSetsById = action.payload;
|
|
@@ -2819,11 +2881,13 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2819
2881
|
state.rolesById = action.payload;
|
|
2820
2882
|
},
|
|
2821
2883
|
createdRole: (state, action) => {
|
|
2822
|
-
state.rolesById[action.payload.name] =
|
|
2884
|
+
state.rolesById[action.payload.name] = {
|
|
2885
|
+
...state.rolesById[action.payload.name],
|
|
2886
|
+
...action.payload
|
|
2887
|
+
};
|
|
2823
2888
|
},
|
|
2824
2889
|
removedRole: (state, action) => {
|
|
2825
|
-
|
|
2826
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2890
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2827
2891
|
state.rolesById = rolesById2;
|
|
2828
2892
|
},
|
|
2829
2893
|
setCustomColumns: (state, action) => {
|
|
@@ -2831,18 +2895,27 @@ var usersSlice = (0, import_toolkit15.createSlice)({
|
|
|
2831
2895
|
},
|
|
2832
2896
|
setGlobalSettings: (state, action) => {
|
|
2833
2897
|
state.settingsInitialized = true;
|
|
2834
|
-
state.globalSettings =
|
|
2898
|
+
state.globalSettings = {
|
|
2899
|
+
...state.globalSettings,
|
|
2900
|
+
...action.payload
|
|
2901
|
+
};
|
|
2835
2902
|
},
|
|
2836
2903
|
setUserSettings: (state, action) => {
|
|
2837
2904
|
state.userSettingsInitialized = true;
|
|
2838
|
-
state.userSettings =
|
|
2905
|
+
state.userSettings = {
|
|
2906
|
+
...state.userSettings,
|
|
2907
|
+
...action.payload
|
|
2908
|
+
};
|
|
2839
2909
|
},
|
|
2840
2910
|
setTooltipState: (state, action) => {
|
|
2841
2911
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2842
2912
|
state.tooltips.byId[id].readState = readState;
|
|
2843
2913
|
},
|
|
2844
2914
|
setTooltipsState: (state, action) => {
|
|
2845
|
-
state.tooltips.byId =
|
|
2915
|
+
state.tooltips.byId = {
|
|
2916
|
+
...state.tooltips.byId,
|
|
2917
|
+
...action.payload
|
|
2918
|
+
};
|
|
2846
2919
|
},
|
|
2847
2920
|
setShowFeedbackDialog: (state, action) => {
|
|
2848
2921
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2859,7 +2932,16 @@ var actions8 = usersSlice.actions;
|
|
|
2859
2932
|
var usersSlice_default = usersSlice.reducer;
|
|
2860
2933
|
|
|
2861
2934
|
// src/actions.ts
|
|
2862
|
-
var actions_default =
|
|
2935
|
+
var actions_default = {
|
|
2936
|
+
...actions,
|
|
2937
|
+
...actions2,
|
|
2938
|
+
...actions3,
|
|
2939
|
+
...actions4,
|
|
2940
|
+
...actions5,
|
|
2941
|
+
...actions6,
|
|
2942
|
+
...actions7,
|
|
2943
|
+
...actions8
|
|
2944
|
+
};
|
|
2863
2945
|
|
|
2864
2946
|
// src/store.ts
|
|
2865
2947
|
var import_toolkit16 = require("@reduxjs/toolkit");
|
|
@@ -2894,8 +2976,9 @@ var sessionReducer = (state, action) => {
|
|
|
2894
2976
|
return rootReducer(state, action);
|
|
2895
2977
|
};
|
|
2896
2978
|
var getConfiguredStore = (options = {}) => {
|
|
2897
|
-
const
|
|
2898
|
-
return (0, import_toolkit16.configureStore)(
|
|
2979
|
+
const { preloadedState = {}, ...config } = options;
|
|
2980
|
+
return (0, import_toolkit16.configureStore)({
|
|
2981
|
+
...config,
|
|
2899
2982
|
preloadedState,
|
|
2900
2983
|
reducer: sessionReducer,
|
|
2901
2984
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2908,7 +2991,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2908
2991
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2909
2992
|
}
|
|
2910
2993
|
})
|
|
2911
|
-
})
|
|
2994
|
+
});
|
|
2912
2995
|
};
|
|
2913
2996
|
var store = getConfiguredStore({
|
|
2914
2997
|
preloadedState: {}
|
|
@@ -2923,13 +3006,15 @@ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
|
2923
3006
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
2924
3007
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers6.startTimeSort).reduce(
|
|
2925
3008
|
(accu, item) => {
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3009
|
+
const filter = item.filter ?? {};
|
|
3010
|
+
let deployment = {
|
|
3011
|
+
...deploymentPrototype,
|
|
3012
|
+
...deploymentsById[item.id],
|
|
3013
|
+
...item,
|
|
3014
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
2930
3015
|
name: decodeURIComponent(item.name)
|
|
2931
|
-
}
|
|
2932
|
-
deployment =
|
|
3016
|
+
};
|
|
3017
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
2933
3018
|
accu.deployments[item.id] = deployment;
|
|
2934
3019
|
accu.deploymentIds.push(item.id);
|
|
2935
3020
|
return accu;
|
|
@@ -2983,11 +3068,12 @@ var createDeployment = (0, import_toolkit17.createAsyncThunk)(`${sliceName2}/cre
|
|
|
2983
3068
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
2984
3069
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
2985
3070
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
2986
|
-
const deployment =
|
|
3071
|
+
const deployment = {
|
|
3072
|
+
...newDeployment,
|
|
2987
3073
|
id: deploymentId,
|
|
2988
3074
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
2989
3075
|
statistics: { status: {} }
|
|
2990
|
-
}
|
|
3076
|
+
};
|
|
2991
3077
|
let tasks = [
|
|
2992
3078
|
dispatch(actions2.createdDeployment(deployment)),
|
|
2993
3079
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -3130,14 +3216,23 @@ var updateDeploymentControlMap = (0, import_toolkit17.createAsyncThunk)(
|
|
|
3130
3216
|
({ 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))))
|
|
3131
3217
|
);
|
|
3132
3218
|
var setDeploymentsState = (0, import_toolkit17.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
3133
|
-
const
|
|
3219
|
+
const { page, perPage, ...selectionState } = selection;
|
|
3134
3220
|
const currentState = getState().deployments.selectionState;
|
|
3135
|
-
let nextState =
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3221
|
+
let nextState = {
|
|
3222
|
+
...currentState,
|
|
3223
|
+
...selectionState,
|
|
3224
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
3225
|
+
accu[item] = {
|
|
3226
|
+
...currentState[item],
|
|
3227
|
+
...selectionState[item]
|
|
3228
|
+
};
|
|
3229
|
+
return accu;
|
|
3230
|
+
}, {}),
|
|
3231
|
+
general: {
|
|
3232
|
+
...currentState.general,
|
|
3233
|
+
...selectionState.general
|
|
3234
|
+
}
|
|
3235
|
+
};
|
|
3141
3236
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
3142
3237
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
3143
3238
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -3167,15 +3262,20 @@ var getDeploymentsConfig = (0, import_toolkit17.createAsyncThunk)(
|
|
|
3167
3262
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
3168
3263
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
3169
3264
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
3170
|
-
const config =
|
|
3265
|
+
const config = {
|
|
3266
|
+
...oldConfig,
|
|
3171
3267
|
hasDelta: Boolean(delta.enabled),
|
|
3172
|
-
binaryDelta:
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3268
|
+
binaryDelta: {
|
|
3269
|
+
...oldConfig.binaryDelta,
|
|
3270
|
+
timeout: timeoutConfig,
|
|
3271
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
3272
|
+
},
|
|
3273
|
+
binaryDeltaLimits: {
|
|
3274
|
+
...oldConfig.binaryDeltaLimits,
|
|
3275
|
+
timeout: timeoutLimit,
|
|
3276
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
3277
|
+
}
|
|
3278
|
+
};
|
|
3179
3279
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
3180
3280
|
})
|
|
3181
3281
|
);
|
|
@@ -3185,7 +3285,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
3185
3285
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers6.isEmpty)(cleanedValue)) {
|
|
3186
3286
|
return accu;
|
|
3187
3287
|
}
|
|
3188
|
-
accu =
|
|
3288
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
3189
3289
|
}
|
|
3190
3290
|
return accu;
|
|
3191
3291
|
}, void 0);
|
|
@@ -3205,9 +3305,13 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit17.createAsyncThunk)(`${slice
|
|
|
3205
3305
|
}
|
|
3206
3306
|
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(() => {
|
|
3207
3307
|
const oldConfig = getState().deployments.config;
|
|
3208
|
-
const newConfig =
|
|
3209
|
-
|
|
3210
|
-
|
|
3308
|
+
const newConfig = {
|
|
3309
|
+
...oldConfig,
|
|
3310
|
+
binaryDelta: {
|
|
3311
|
+
...oldConfig.binaryDelta,
|
|
3312
|
+
...config
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3211
3315
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar2("Settings saved successfully"))]);
|
|
3212
3316
|
});
|
|
3213
3317
|
});
|
|
@@ -3220,19 +3324,20 @@ var import_toolkit18 = require("@reduxjs/toolkit");
|
|
|
3220
3324
|
var import_axios2 = require("axios");
|
|
3221
3325
|
var import_pluralize = __toESM(require_pluralize());
|
|
3222
3326
|
|
|
3223
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3224
|
-
var
|
|
3225
|
-
var
|
|
3226
|
-
var poolPtr = rnds8Pool.length;
|
|
3327
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3328
|
+
var getRandomValues;
|
|
3329
|
+
var rnds8 = new Uint8Array(16);
|
|
3227
3330
|
function rng() {
|
|
3228
|
-
if (
|
|
3229
|
-
|
|
3230
|
-
|
|
3331
|
+
if (!getRandomValues) {
|
|
3332
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3333
|
+
if (!getRandomValues) {
|
|
3334
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3335
|
+
}
|
|
3231
3336
|
}
|
|
3232
|
-
return
|
|
3337
|
+
return getRandomValues(rnds8);
|
|
3233
3338
|
}
|
|
3234
3339
|
|
|
3235
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3340
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3236
3341
|
var byteToHex = [];
|
|
3237
3342
|
for (let i = 0; i < 256; ++i) {
|
|
3238
3343
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3241,13 +3346,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3241
3346
|
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]];
|
|
3242
3347
|
}
|
|
3243
3348
|
|
|
3244
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3245
|
-
var
|
|
3349
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3350
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3246
3351
|
var native_default = {
|
|
3247
|
-
randomUUID
|
|
3352
|
+
randomUUID
|
|
3248
3353
|
};
|
|
3249
3354
|
|
|
3250
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3355
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3251
3356
|
function v4(options, buf, offset) {
|
|
3252
3357
|
if (native_default.randomUUID && !buf && !options) {
|
|
3253
3358
|
return native_default.randomUUID();
|
|
@@ -3289,14 +3394,13 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3289
3394
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3290
3395
|
const state = getGroupsById(getState());
|
|
3291
3396
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3292
|
-
|
|
3293
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3397
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3294
3398
|
accu[id] = group;
|
|
3295
3399
|
}
|
|
3296
3400
|
return accu;
|
|
3297
3401
|
}, {});
|
|
3298
3402
|
const groups = res.data.reduce((accu, group) => {
|
|
3299
|
-
accu[group] =
|
|
3403
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3300
3404
|
return accu;
|
|
3301
3405
|
}, dynamicGroups);
|
|
3302
3406
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3354,7 +3458,7 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3354
3458
|
() => Promise.resolve(
|
|
3355
3459
|
dispatch(
|
|
3356
3460
|
actions3.addGroup({
|
|
3357
|
-
group:
|
|
3461
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3358
3462
|
groupName: group
|
|
3359
3463
|
})
|
|
3360
3464
|
)
|
|
@@ -3382,20 +3486,19 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3382
3486
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3383
3487
|
const state = getGroupsById(getState());
|
|
3384
3488
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3385
|
-
|
|
3386
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3489
|
+
if (!(group.id || group.filters?.length)) {
|
|
3387
3490
|
accu[id] = group;
|
|
3388
3491
|
}
|
|
3389
3492
|
return accu;
|
|
3390
3493
|
}, {});
|
|
3391
3494
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3392
|
-
accu[filter.name] =
|
|
3495
|
+
accu[filter.name] = {
|
|
3393
3496
|
deviceIds: [],
|
|
3394
|
-
total: 0
|
|
3395
|
-
|
|
3497
|
+
total: 0,
|
|
3498
|
+
...state[filter.name],
|
|
3396
3499
|
id: filter.id,
|
|
3397
3500
|
filters: mapTermsToFilters(filter.terms)
|
|
3398
|
-
}
|
|
3501
|
+
};
|
|
3399
3502
|
return accu;
|
|
3400
3503
|
}, staticGroups);
|
|
3401
3504
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3435,10 +3538,9 @@ var removeDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/r
|
|
|
3435
3538
|
);
|
|
3436
3539
|
});
|
|
3437
3540
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3438
|
-
var _a;
|
|
3439
3541
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3440
3542
|
const selectedGroup = groupsState.byId[groupName];
|
|
3441
|
-
const groupFilterLength =
|
|
3543
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3442
3544
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3443
3545
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3444
3546
|
};
|
|
@@ -3461,7 +3563,6 @@ var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3461
3563
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3462
3564
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3463
3565
|
(accu, device) => {
|
|
3464
|
-
var _a, _b2, _c;
|
|
3465
3566
|
const stateDevice = getDeviceById(state, device.id);
|
|
3466
3567
|
const {
|
|
3467
3568
|
attributes: storedAttributes = {},
|
|
@@ -3471,29 +3572,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3471
3572
|
group: storedGroup
|
|
3472
3573
|
} = stateDevice;
|
|
3473
3574
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3474
|
-
device.tags =
|
|
3475
|
-
device.group =
|
|
3476
|
-
device.monitor =
|
|
3477
|
-
device.identity_data =
|
|
3575
|
+
device.tags = { ...storedTags, ...tags };
|
|
3576
|
+
device.group = system.group ?? storedGroup;
|
|
3577
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3578
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3478
3579
|
device.status = status ? status : device.status || identity.status;
|
|
3479
|
-
device.check_in_time_rounded =
|
|
3480
|
-
device.check_in_time_exact =
|
|
3580
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3581
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3481
3582
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3482
3583
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3483
3584
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3484
3585
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3485
|
-
device.attributes = device.attributes ?
|
|
3486
|
-
accu.devicesById[device.id] =
|
|
3586
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3587
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3487
3588
|
accu.ids.push(device.id);
|
|
3488
3589
|
return accu;
|
|
3489
3590
|
},
|
|
3490
3591
|
{ ids, devicesById: {} }
|
|
3491
3592
|
);
|
|
3492
3593
|
var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3493
|
-
const
|
|
3594
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3494
3595
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3495
3596
|
return Promise.resolve(
|
|
3496
|
-
dispatch(getDevicesByStatus2(
|
|
3597
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3497
3598
|
).unwrap().then((results) => {
|
|
3498
3599
|
if (!group) {
|
|
3499
3600
|
return Promise.resolve();
|
|
@@ -3507,7 +3608,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3507
3608
|
dispatch(
|
|
3508
3609
|
actions3.addGroup({
|
|
3509
3610
|
group: {
|
|
3510
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3611
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3511
3612
|
total
|
|
3512
3613
|
},
|
|
3513
3614
|
groupName: group
|
|
@@ -3656,27 +3757,26 @@ var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3656
3757
|
);
|
|
3657
3758
|
var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
|
|
3658
3759
|
`${sliceName3}/setDeviceListState`,
|
|
3659
|
-
(
|
|
3660
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3661
|
-
var _c;
|
|
3760
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3662
3761
|
const currentState = getDeviceListState(getState());
|
|
3663
3762
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3664
|
-
let nextState =
|
|
3763
|
+
let nextState = {
|
|
3764
|
+
...currentState,
|
|
3665
3765
|
setOnly: false,
|
|
3666
|
-
refreshTrigger
|
|
3667
|
-
|
|
3668
|
-
sort:
|
|
3669
|
-
}
|
|
3766
|
+
refreshTrigger,
|
|
3767
|
+
...selectionState,
|
|
3768
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3769
|
+
};
|
|
3670
3770
|
let tasks = [];
|
|
3671
|
-
const
|
|
3672
|
-
const
|
|
3771
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3772
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3673
3773
|
if (!nextState.setOnly && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3674
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3774
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3675
3775
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3676
3776
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3677
3777
|
nextState.isLoading = true;
|
|
3678
3778
|
tasks.push(
|
|
3679
|
-
dispatch(getDevicesByStatus2(
|
|
3779
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3680
3780
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3681
3781
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3682
3782
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3701,8 +3801,8 @@ var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/
|
|
|
3701
3801
|
} = options;
|
|
3702
3802
|
const state = getState();
|
|
3703
3803
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3704
|
-
filters: filterSelection
|
|
3705
|
-
group: group
|
|
3804
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3805
|
+
group: group ?? getSelectedGroup(state),
|
|
3706
3806
|
groups: state.devices.groups,
|
|
3707
3807
|
offlineThreshold: state.app.offlineThreshold,
|
|
3708
3808
|
selectedIssues,
|
|
@@ -3763,7 +3863,7 @@ var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3
|
|
|
3763
3863
|
});
|
|
3764
3864
|
var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3765
3865
|
const state = getState();
|
|
3766
|
-
let options =
|
|
3866
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3767
3867
|
const { page = defaultPage2, searchTerm, sortOptions = [] } = options;
|
|
3768
3868
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3769
3869
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -3898,8 +3998,7 @@ var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
3898
3998
|
({ data: auditLogEntries }) => {
|
|
3899
3999
|
const { start, end } = auditLogEntries.reduce(
|
|
3900
4000
|
(accu, item) => {
|
|
3901
|
-
|
|
3902
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
4001
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
3903
4002
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
3904
4003
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
3905
4004
|
}
|
|
@@ -4006,8 +4105,7 @@ var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4006
4105
|
var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
4007
4106
|
`${sliceName3}/getDeviceConfig`,
|
|
4008
4107
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
4009
|
-
|
|
4010
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
4108
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
4011
4109
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
4012
4110
|
}
|
|
4013
4111
|
})
|
|
@@ -4019,15 +4117,14 @@ var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4019
4117
|
var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
4020
4118
|
`${sliceName3}/applyDeviceConfig`,
|
|
4021
4119
|
({ 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 }) => {
|
|
4022
|
-
var _a;
|
|
4023
4120
|
const device = getDeviceById(getState(), deviceId);
|
|
4024
4121
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
4025
4122
|
let tasks = [
|
|
4026
|
-
dispatch(actions3.receivedDevice(
|
|
4123
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
4027
4124
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
4028
4125
|
];
|
|
4029
4126
|
if (isDefault && canManageUsers) {
|
|
4030
|
-
const { previous } =
|
|
4127
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
4031
4128
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
4032
4129
|
}
|
|
4033
4130
|
return Promise.all(tasks);
|
|
@@ -4043,21 +4140,21 @@ var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4043
4140
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
4044
4141
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
4045
4142
|
{ headers }
|
|
4046
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
4143
|
+
).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"))]));
|
|
4047
4144
|
})
|
|
4048
4145
|
)
|
|
4049
4146
|
);
|
|
4050
4147
|
var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
4051
4148
|
let providerResult = {};
|
|
4052
4149
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
4053
|
-
providerResult =
|
|
4150
|
+
providerResult = { ...data, twinError: "" };
|
|
4054
4151
|
}).catch((err) => {
|
|
4055
4152
|
providerResult = {
|
|
4056
4153
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
4057
4154
|
};
|
|
4058
4155
|
}).finally(() => {
|
|
4059
4156
|
const device = getDeviceById(getState(), deviceId);
|
|
4060
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
4157
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
4061
4158
|
});
|
|
4062
4159
|
});
|
|
4063
4160
|
var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
@@ -4073,7 +4170,7 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
|
4073
4170
|
const { twinsByIntegration = {} } = device;
|
|
4074
4171
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
4075
4172
|
return Promise.resolve(
|
|
4076
|
-
dispatch(actions3.receivedDevice(
|
|
4173
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
4077
4174
|
);
|
|
4078
4175
|
})
|
|
4079
4176
|
);
|
|
@@ -4094,8 +4191,8 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
4094
4191
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
4095
4192
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
4096
4193
|
const filters = [
|
|
4097
|
-
|
|
4098
|
-
|
|
4194
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
4195
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4099
4196
|
];
|
|
4100
4197
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4101
4198
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4107,11 +4204,12 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
4107
4204
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
4108
4205
|
const state2 = getState();
|
|
4109
4206
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
4110
|
-
const device =
|
|
4207
|
+
const device = {
|
|
4208
|
+
...getDeviceById(state2, id),
|
|
4111
4209
|
systemDeviceIds: ids,
|
|
4112
4210
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
4113
|
-
}
|
|
4114
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4211
|
+
};
|
|
4212
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
4115
4213
|
});
|
|
4116
4214
|
});
|
|
4117
4215
|
var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -4119,9 +4217,9 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
4119
4217
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
4120
4218
|
const { mender_gateway_system_id = "" } = attributes;
|
|
4121
4219
|
const filters = [
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4220
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4221
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4222
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
4125
4223
|
];
|
|
4126
4224
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
4127
4225
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -4168,7 +4266,7 @@ var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
|
|
|
4168
4266
|
var cutoffLength = 75;
|
|
4169
4267
|
var ellipsis = "...";
|
|
4170
4268
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
4171
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4269
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
4172
4270
|
var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
4173
4271
|
const { page = defaultPage3, perPage = defaultPerPage3, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
4174
4272
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -4186,14 +4284,15 @@ var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4
|
|
|
4186
4284
|
});
|
|
4187
4285
|
var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4188
4286
|
const state = getState();
|
|
4189
|
-
const
|
|
4190
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4287
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4288
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4289
|
+
...remainder,
|
|
4191
4290
|
filters,
|
|
4192
4291
|
group,
|
|
4193
4292
|
offlineThreshold: state.app.offlineThreshold,
|
|
4194
4293
|
selectedIssues: [type],
|
|
4195
4294
|
status
|
|
4196
|
-
})
|
|
4295
|
+
});
|
|
4197
4296
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4198
4297
|
page: 1,
|
|
4199
4298
|
per_page: 1,
|
|
@@ -4245,21 +4344,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4245
4344
|
return steps[progress2];
|
|
4246
4345
|
};
|
|
4247
4346
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4248
|
-
var _a;
|
|
4249
4347
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4250
4348
|
const userCookie = cookies2.get(`${userId}-onboarded`);
|
|
4251
4349
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4252
4350
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4253
|
-
let deviceType =
|
|
4351
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4254
4352
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4255
4353
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4256
|
-
return
|
|
4354
|
+
return {
|
|
4355
|
+
...onboardingState,
|
|
4257
4356
|
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)),
|
|
4258
4357
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4259
4358
|
deviceType,
|
|
4260
4359
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4261
4360
|
progress: progress2
|
|
4262
|
-
}
|
|
4361
|
+
};
|
|
4263
4362
|
};
|
|
4264
4363
|
var getOnboardingState2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4265
4364
|
const state = getState();
|
|
@@ -4317,7 +4416,7 @@ var advanceOnboarding = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4317
4416
|
return;
|
|
4318
4417
|
}
|
|
4319
4418
|
const madeProgress = steps[stepIndex + 1];
|
|
4320
|
-
const state =
|
|
4419
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4321
4420
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4322
4421
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4323
4422
|
});
|
|
@@ -4400,8 +4499,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4400
4499
|
({ 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())))
|
|
4401
4500
|
);
|
|
4402
4501
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4403
|
-
const userId =
|
|
4404
|
-
const detail =
|
|
4502
|
+
const userId = userFilter?.id || userFilter;
|
|
4503
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4405
4504
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4406
4505
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4407
4506
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4428,12 +4527,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4428
4527
|
);
|
|
4429
4528
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4430
4529
|
const currentState = getAuditlogState(getState());
|
|
4431
|
-
let nextState =
|
|
4432
|
-
|
|
4433
|
-
|
|
4530
|
+
let nextState = {
|
|
4531
|
+
...currentState,
|
|
4532
|
+
...selectionState,
|
|
4533
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4534
|
+
};
|
|
4434
4535
|
let tasks = [];
|
|
4435
|
-
const
|
|
4436
|
-
const
|
|
4536
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4537
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4437
4538
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4438
4539
|
nextState.isLoading = true;
|
|
4439
4540
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4445,27 +4546,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4445
4546
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4446
4547
|
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));
|
|
4447
4548
|
});
|
|
4448
|
-
var tenantListRetrieval = (config) =>
|
|
4549
|
+
var tenantListRetrieval = async (config) => {
|
|
4449
4550
|
const { page, perPage } = config;
|
|
4450
4551
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4451
|
-
const tenantList =
|
|
4552
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4452
4553
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4453
|
-
return [tenantList.data, totalCount];
|
|
4454
|
-
}
|
|
4455
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4554
|
+
return [tenantList.data, Number(totalCount)];
|
|
4555
|
+
};
|
|
4556
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4456
4557
|
const currentState = getTenantsList(getState());
|
|
4457
|
-
const [tenants, pageCount] =
|
|
4458
|
-
dispatch(actions6.setTenantListState(
|
|
4459
|
-
})
|
|
4460
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4558
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4559
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4560
|
+
});
|
|
4561
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4461
4562
|
const currentState = getTenantsList(getState());
|
|
4462
|
-
const nextState =
|
|
4563
|
+
const nextState = {
|
|
4564
|
+
...currentState,
|
|
4565
|
+
...selectionState
|
|
4566
|
+
};
|
|
4463
4567
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4464
|
-
const [tenants, pageCount] =
|
|
4465
|
-
return dispatch(actions6.setTenantListState(
|
|
4568
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4569
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4466
4570
|
}
|
|
4467
|
-
return dispatch(actions6.setTenantListState(
|
|
4468
|
-
})
|
|
4571
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4572
|
+
});
|
|
4469
4573
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4470
4574
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4471
4575
|
const tasks = [Promise.resolve(dispatch(setSnackbar4("Device Limit was changed successfully")))];
|
|
@@ -4508,10 +4612,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4508
4612
|
);
|
|
4509
4613
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4510
4614
|
`${sliceName6}/createIntegration`,
|
|
4511
|
-
(
|
|
4512
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4513
|
-
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())]));
|
|
4514
|
-
}
|
|
4615
|
+
({ 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())]))
|
|
4515
4616
|
);
|
|
4516
4617
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4517
4618
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4532,9 +4633,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4532
4633
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4533
4634
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4534
4635
|
const integrations = data.reduce((accu, item) => {
|
|
4535
|
-
|
|
4536
|
-
const
|
|
4537
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4636
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4637
|
+
const integration = { ...existingIntegration, ...item };
|
|
4538
4638
|
accu.push(integration);
|
|
4539
4639
|
return accu;
|
|
4540
4640
|
}, []);
|
|
@@ -4586,7 +4686,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4586
4686
|
`${sliceName6}/getSsoConfigById`,
|
|
4587
4687
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4588
4688
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4589
|
-
return sso ? Promise.resolve(
|
|
4689
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4590
4690
|
})
|
|
4591
4691
|
);
|
|
4592
4692
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4605,20 +4705,21 @@ var { setSnackbar: setSnackbar5, initUpload: initUpload2, uploadProgress: upload
|
|
|
4605
4705
|
var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
4606
4706
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4607
4707
|
var flattenRelease = (release, stateRelease) => {
|
|
4608
|
-
|
|
4609
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4708
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4610
4709
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4611
4710
|
(accu, item) => {
|
|
4612
|
-
var _a2;
|
|
4613
4711
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4614
|
-
const stateArtifact =
|
|
4712
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4615
4713
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4616
|
-
accu.artifacts.push(
|
|
4714
|
+
accu.artifacts.push({
|
|
4715
|
+
...stateArtifact,
|
|
4716
|
+
...item
|
|
4717
|
+
});
|
|
4617
4718
|
return accu;
|
|
4618
4719
|
},
|
|
4619
4720
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4620
4721
|
);
|
|
4621
|
-
return
|
|
4722
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4622
4723
|
};
|
|
4623
4724
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4624
4725
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4636,17 +4737,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4636
4737
|
{ release: null, index: -1 }
|
|
4637
4738
|
);
|
|
4638
4739
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4639
|
-
var _a;
|
|
4640
4740
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4641
4741
|
if (!release || index === -1) {
|
|
4642
4742
|
return;
|
|
4643
4743
|
}
|
|
4644
4744
|
const releaseArtifacts = [...release.artifacts];
|
|
4645
4745
|
const artifact = releaseArtifacts[index];
|
|
4646
|
-
const { key, name, version } = (
|
|
4746
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4647
4747
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4648
4748
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4649
|
-
filters: [
|
|
4749
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4650
4750
|
});
|
|
4651
4751
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4652
4752
|
page: 1,
|
|
@@ -4660,10 +4760,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4660
4760
|
}
|
|
4661
4761
|
const installCount = Number(headers[headerNames.total]);
|
|
4662
4762
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4663
|
-
releaseArtifacts2[index2] =
|
|
4664
|
-
release2 =
|
|
4763
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4764
|
+
release2 = {
|
|
4765
|
+
...release2,
|
|
4665
4766
|
artifacts: releaseArtifacts2
|
|
4666
|
-
}
|
|
4767
|
+
};
|
|
4667
4768
|
return dispatch(actions7.receiveRelease(release2));
|
|
4668
4769
|
});
|
|
4669
4770
|
});
|
|
@@ -4675,12 +4776,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4675
4776
|
return dispatch(getReleases());
|
|
4676
4777
|
}
|
|
4677
4778
|
const releaseArtifacts = [...release.artifacts];
|
|
4678
|
-
releaseArtifacts[index] =
|
|
4779
|
+
releaseArtifacts[index] = {
|
|
4780
|
+
...releaseArtifacts[index],
|
|
4679
4781
|
url: response.data.uri
|
|
4680
|
-
}
|
|
4681
|
-
release =
|
|
4782
|
+
};
|
|
4783
|
+
release = {
|
|
4784
|
+
...release,
|
|
4682
4785
|
artifacts: releaseArtifacts
|
|
4683
|
-
}
|
|
4786
|
+
};
|
|
4684
4787
|
return dispatch(actions7.receiveRelease(release));
|
|
4685
4788
|
})
|
|
4686
4789
|
);
|
|
@@ -4805,12 +4908,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4805
4908
|
});
|
|
4806
4909
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4807
4910
|
const currentState = getState().releases.releasesList;
|
|
4808
|
-
let nextState =
|
|
4809
|
-
|
|
4810
|
-
|
|
4911
|
+
let nextState = {
|
|
4912
|
+
...currentState,
|
|
4913
|
+
...selectionState,
|
|
4914
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4915
|
+
};
|
|
4811
4916
|
let tasks = [];
|
|
4812
|
-
const
|
|
4813
|
-
const
|
|
4917
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4918
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4814
4919
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4815
4920
|
nextState.isLoading = true;
|
|
4816
4921
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4829,29 +4934,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4829
4934
|
);
|
|
4830
4935
|
};
|
|
4831
4936
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4832
|
-
let releaseListState =
|
|
4937
|
+
let releaseListState = { ...state.releasesList };
|
|
4833
4938
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4834
4939
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4835
4940
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4836
4941
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4837
4942
|
if (searchOnly) {
|
|
4838
|
-
releaseListState =
|
|
4943
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4839
4944
|
} else {
|
|
4840
|
-
releaseListState =
|
|
4945
|
+
releaseListState = {
|
|
4946
|
+
...releaseListState,
|
|
4841
4947
|
releaseIds,
|
|
4842
4948
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4843
4949
|
total: !isFiltering ? total : state.releasesList.total
|
|
4844
|
-
}
|
|
4950
|
+
};
|
|
4845
4951
|
}
|
|
4846
4952
|
return releaseListState;
|
|
4847
4953
|
};
|
|
4848
4954
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4849
|
-
const config =
|
|
4955
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4850
4956
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4851
4957
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4852
4958
|
const state = getState().releases;
|
|
4853
4959
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4854
|
-
const combinedReleases =
|
|
4960
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4855
4961
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4856
4962
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4857
4963
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4872,7 +4978,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4872
4978
|
`${sliceName7}/updateReleaseInfo`,
|
|
4873
4979
|
({ 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(() => {
|
|
4874
4980
|
return Promise.all([
|
|
4875
|
-
dispatch(actions7.receiveRelease(
|
|
4981
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4876
4982
|
dispatch(setSnackbar5("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4877
4983
|
]);
|
|
4878
4984
|
})
|
|
@@ -4881,7 +4987,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4881
4987
|
`${sliceName7}/setReleaseTags`,
|
|
4882
4988
|
({ 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(() => {
|
|
4883
4989
|
return Promise.all([
|
|
4884
|
-
dispatch(actions7.receiveRelease(
|
|
4990
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4885
4991
|
dispatch(setSnackbar5("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4886
4992
|
]);
|
|
4887
4993
|
})
|
|
@@ -4898,19 +5004,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4898
5004
|
// src/api/users-api.ts
|
|
4899
5005
|
var import_axios4 = __toESM(require("axios"));
|
|
4900
5006
|
var Api2 = {
|
|
4901
|
-
postLogin: (url,
|
|
4902
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4903
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4904
|
-
var _a2;
|
|
4905
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4906
|
-
});
|
|
4907
|
-
},
|
|
5007
|
+
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"] })),
|
|
4908
5008
|
putVerifyTFA: (url, userData) => {
|
|
4909
5009
|
let body = {};
|
|
4910
5010
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4911
5011
|
body = { token2fa: userData.token2fa };
|
|
4912
5012
|
}
|
|
4913
|
-
return import_axios4.default.put(url, body,
|
|
5013
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4914
5014
|
}
|
|
4915
5015
|
};
|
|
4916
5016
|
var users_api_default = Api2;
|
|
@@ -4938,43 +5038,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4938
5038
|
};
|
|
4939
5039
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4940
5040
|
`${sliceName8}/loginUser`,
|
|
4941
|
-
(
|
|
4942
|
-
|
|
4943
|
-
return
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
Promise.
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
window.
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
);
|
|
4976
|
-
});
|
|
4977
|
-
}
|
|
5041
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
5042
|
+
cleanUp();
|
|
5043
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
5044
|
+
}).then(({ text: response, contentType }) => {
|
|
5045
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
5046
|
+
const { id, kind } = response;
|
|
5047
|
+
const type = kind.split("/")[1];
|
|
5048
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
5049
|
+
window.location.replace(ssoLoginUrl);
|
|
5050
|
+
return;
|
|
5051
|
+
}
|
|
5052
|
+
const token = response;
|
|
5053
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
5054
|
+
return;
|
|
5055
|
+
}
|
|
5056
|
+
let now = /* @__PURE__ */ new Date();
|
|
5057
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
5058
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
5059
|
+
setSessionInfo({ token, expiresAt });
|
|
5060
|
+
cookies4.remove("JWT", { path: "/" });
|
|
5061
|
+
return (
|
|
5062
|
+
// @ts-ignore
|
|
5063
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
5064
|
+
cleanUp();
|
|
5065
|
+
return Promise.reject(dispatch(setSnackbar6(extractErrorMessage(e))));
|
|
5066
|
+
}).then(() => {
|
|
5067
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
5068
|
+
if (window.location.pathname !== "/ui/") {
|
|
5069
|
+
window.location.replace("/ui/");
|
|
5070
|
+
}
|
|
5071
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
5072
|
+
})
|
|
5073
|
+
);
|
|
5074
|
+
})
|
|
4978
5075
|
);
|
|
4979
5076
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4980
5077
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4991,7 +5088,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4991
5088
|
return Promise.reject();
|
|
4992
5089
|
}
|
|
4993
5090
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4994
|
-
setSessionInfo(
|
|
5091
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4995
5092
|
window.location.reload();
|
|
4996
5093
|
});
|
|
4997
5094
|
});
|
|
@@ -5054,13 +5151,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5054
5151
|
);
|
|
5055
5152
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
5056
5153
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
5057
|
-
const userId = currentUserId
|
|
5154
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
5058
5155
|
const storageKey = `${userId}-column-widths`;
|
|
5059
5156
|
let customColumns = [];
|
|
5060
5157
|
if (!columns) {
|
|
5061
5158
|
try {
|
|
5062
5159
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
5063
|
-
} catch
|
|
5160
|
+
} catch {
|
|
5064
5161
|
}
|
|
5065
5162
|
} else {
|
|
5066
5163
|
customColumns = columns;
|
|
@@ -5089,10 +5186,7 @@ var userActions = {
|
|
|
5089
5186
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
5090
5187
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5091
5188
|
`${sliceName8}/createUser`,
|
|
5092
|
-
(
|
|
5093
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
5094
|
-
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));
|
|
5095
|
-
}
|
|
5189
|
+
({ 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))
|
|
5096
5190
|
);
|
|
5097
5191
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5098
5192
|
`${sliceName8}/removeUser`,
|
|
@@ -5103,15 +5197,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5103
5197
|
);
|
|
5104
5198
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
5105
5199
|
`${sliceName8}/editUser`,
|
|
5106
|
-
(
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
()
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
])
|
|
5113
|
-
);
|
|
5114
|
-
}
|
|
5200
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
5201
|
+
() => Promise.all([
|
|
5202
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
5203
|
+
dispatch(setSnackbar6(userActions.edit.successMessage))
|
|
5204
|
+
])
|
|
5205
|
+
)
|
|
5115
5206
|
);
|
|
5116
5207
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
5117
5208
|
const { id } = getOrganization(getState());
|
|
@@ -5146,7 +5237,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
5146
5237
|
}
|
|
5147
5238
|
return accu;
|
|
5148
5239
|
},
|
|
5149
|
-
|
|
5240
|
+
{ ...emptyUiPermissions }
|
|
5150
5241
|
);
|
|
5151
5242
|
var permissionActionTypes = {
|
|
5152
5243
|
any: mapHttpPermission,
|
|
@@ -5169,20 +5260,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
5169
5260
|
}, existingPermissions);
|
|
5170
5261
|
var tryParseCustomPermission = (permission) => {
|
|
5171
5262
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
5172
|
-
const result = mergePermissions(
|
|
5263
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
5173
5264
|
return { isCustom: true, permission, result };
|
|
5174
5265
|
};
|
|
5175
5266
|
var customPermissionHandler = (accu, permission) => {
|
|
5176
5267
|
let processor = tryParseCustomPermission(permission);
|
|
5177
|
-
return
|
|
5268
|
+
return {
|
|
5269
|
+
...accu,
|
|
5178
5270
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5179
5271
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5180
|
-
}
|
|
5272
|
+
};
|
|
5181
5273
|
};
|
|
5182
5274
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
5183
5275
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
5184
5276
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
5185
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5277
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
5186
5278
|
};
|
|
5187
5279
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5188
5280
|
if (Array.isArray(permissions)) {
|
|
@@ -5197,60 +5289,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5197
5289
|
if (!processor) {
|
|
5198
5290
|
return accu;
|
|
5199
5291
|
}
|
|
5200
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5201
|
-
var _a;
|
|
5202
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5203
|
-
});
|
|
5292
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5204
5293
|
if (scope) {
|
|
5205
5294
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5206
|
-
return
|
|
5295
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5207
5296
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5208
5297
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5209
5298
|
}
|
|
5210
|
-
return
|
|
5299
|
+
return {
|
|
5300
|
+
...accu,
|
|
5211
5301
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5212
5302
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5213
|
-
}
|
|
5303
|
+
};
|
|
5214
5304
|
},
|
|
5215
|
-
{ isCustom: false, uiPermissions:
|
|
5305
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5216
5306
|
);
|
|
5217
5307
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5218
5308
|
};
|
|
5219
5309
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5220
5310
|
(accu, role) => {
|
|
5221
|
-
var _a;
|
|
5222
5311
|
let normalizedPermissions;
|
|
5223
5312
|
let isCustom = false;
|
|
5224
5313
|
if (rolesById2[role.name]) {
|
|
5225
|
-
normalizedPermissions =
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5314
|
+
normalizedPermissions = {
|
|
5315
|
+
...rolesById2[role.name].uiPermissions,
|
|
5316
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5317
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5318
|
+
};
|
|
5229
5319
|
} else {
|
|
5230
5320
|
const result = parseRolePermissions(role, permissionSets);
|
|
5231
5321
|
normalizedPermissions = result.uiPermissions;
|
|
5232
5322
|
isCustom = result.isCustom;
|
|
5233
5323
|
}
|
|
5234
|
-
const roleState =
|
|
5235
|
-
accu[role.name] =
|
|
5324
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5325
|
+
accu[role.name] = {
|
|
5326
|
+
...roleState,
|
|
5327
|
+
...role,
|
|
5236
5328
|
description: roleState.description ? roleState.description : role.description,
|
|
5237
5329
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5238
5330
|
isCustom,
|
|
5239
5331
|
name: roleState.name ? roleState.name : role.name,
|
|
5240
5332
|
uiPermissions: normalizedPermissions
|
|
5241
|
-
}
|
|
5333
|
+
};
|
|
5242
5334
|
return accu;
|
|
5243
5335
|
},
|
|
5244
|
-
|
|
5336
|
+
{ ...rolesById2 }
|
|
5245
5337
|
);
|
|
5246
5338
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5247
5339
|
`${sliceName8}/getPermissionSets`,
|
|
5248
5340
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5249
5341
|
const permissionSets = data.reduce(
|
|
5250
5342
|
(accu, permissionSet) => {
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5343
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5344
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5254
5345
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5255
5346
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5256
5347
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5261,11 +5352,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5261
5352
|
}
|
|
5262
5353
|
return collector;
|
|
5263
5354
|
}, accu2),
|
|
5264
|
-
|
|
5355
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5265
5356
|
);
|
|
5266
5357
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5267
|
-
|
|
5268
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5358
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5269
5359
|
accu2.push(key);
|
|
5270
5360
|
}
|
|
5271
5361
|
return accu2;
|
|
@@ -5278,7 +5368,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5278
5368
|
return accu;
|
|
5279
5369
|
},
|
|
5280
5370
|
// @ts-ignore
|
|
5281
|
-
|
|
5371
|
+
{ ...getState().users.permissionSetsById }
|
|
5282
5372
|
);
|
|
5283
5373
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5284
5374
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5311,28 +5401,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5311
5401
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5312
5402
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5313
5403
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5314
|
-
|
|
5315
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5404
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5316
5405
|
type: uiPermissionsByArea[area].scope,
|
|
5317
5406
|
value: []
|
|
5318
5407
|
};
|
|
5319
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5408
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5409
|
+
...permissionSetState,
|
|
5320
5410
|
value: [...permissionSetState.value, item]
|
|
5321
|
-
}
|
|
5411
|
+
};
|
|
5322
5412
|
return itemPermissionAccu;
|
|
5323
5413
|
}, accu);
|
|
5324
5414
|
return accu;
|
|
5325
5415
|
}, {});
|
|
5326
|
-
return Object.entries(permissionSetObject).map((
|
|
5327
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5416
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5328
5417
|
if (value.includes(excessiveAccessSelector)) {
|
|
5329
5418
|
return { name };
|
|
5330
5419
|
}
|
|
5331
|
-
return { name, scope:
|
|
5420
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5332
5421
|
});
|
|
5333
5422
|
};
|
|
5334
5423
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5335
|
-
const role =
|
|
5424
|
+
const role = { ...roleState, ...roleData };
|
|
5336
5425
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5337
5426
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5338
5427
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5368,12 +5457,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5368
5457
|
}, []);
|
|
5369
5458
|
return {
|
|
5370
5459
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5371
|
-
role:
|
|
5460
|
+
role: {
|
|
5461
|
+
...emptyRole,
|
|
5372
5462
|
name,
|
|
5373
5463
|
// @ts-ignore
|
|
5374
5464
|
description: description ? description : roleState.description,
|
|
5375
|
-
uiPermissions:
|
|
5376
|
-
|
|
5465
|
+
uiPermissions: {
|
|
5466
|
+
...emptyUiPermissions,
|
|
5467
|
+
...roleUiPermissions,
|
|
5468
|
+
...maybeUiPermissions
|
|
5469
|
+
}
|
|
5470
|
+
}
|
|
5377
5471
|
};
|
|
5378
5472
|
};
|
|
5379
5473
|
var roleActions = {
|
|
@@ -5424,13 +5518,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5424
5518
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5425
5519
|
`${sliceName8}/saveGlobalSettings`,
|
|
5426
5520
|
// @ts-ignore
|
|
5427
|
-
(
|
|
5428
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5521
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5429
5522
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5430
5523
|
return;
|
|
5431
5524
|
}
|
|
5432
5525
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5433
|
-
let updatedSettings =
|
|
5526
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5434
5527
|
if (getCurrentUser(getState()).verified) {
|
|
5435
5528
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5436
5529
|
} else {
|
|
@@ -5468,10 +5561,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5468
5561
|
const userSettings = getUserSettings(getState());
|
|
5469
5562
|
const onboardingState = getOnboardingState(getState());
|
|
5470
5563
|
const tooltipState = getTooltipsState(getState());
|
|
5471
|
-
const updatedSettings =
|
|
5472
|
-
|
|
5564
|
+
const updatedSettings = {
|
|
5565
|
+
...userSettings,
|
|
5566
|
+
// @ts-ignore
|
|
5567
|
+
...settings,
|
|
5568
|
+
onboarding: {
|
|
5569
|
+
...onboardingState,
|
|
5570
|
+
// @ts-ignore
|
|
5571
|
+
...settings.onboarding
|
|
5572
|
+
},
|
|
5473
5573
|
tooltips: tooltipState
|
|
5474
|
-
}
|
|
5574
|
+
};
|
|
5475
5575
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5476
5576
|
return Promise.all([
|
|
5477
5577
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5497,9 +5597,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5497
5597
|
`${sliceName8}/getTokens`,
|
|
5498
5598
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5499
5599
|
const user = getCurrentUser(getState());
|
|
5500
|
-
const updatedUser =
|
|
5600
|
+
const updatedUser = {
|
|
5601
|
+
...user,
|
|
5501
5602
|
tokens
|
|
5502
|
-
}
|
|
5603
|
+
};
|
|
5503
5604
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5504
5605
|
})
|
|
5505
5606
|
);
|
|
@@ -5515,8 +5616,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5515
5616
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5516
5617
|
)
|
|
5517
5618
|
);
|
|
5518
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5519
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5619
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5520
5620
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5521
5621
|
if (persist) {
|
|
5522
5622
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5524,14 +5624,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5524
5624
|
return Promise.all(tasks);
|
|
5525
5625
|
});
|
|
5526
5626
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5527
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5627
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5528
5628
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5529
5629
|
});
|
|
5530
5630
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5531
5631
|
`${sliceName8}/submitFeedback`,
|
|
5532
5632
|
// @ts-ignore
|
|
5533
|
-
(
|
|
5534
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5633
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5535
5634
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5536
5635
|
subject: "feedback submission",
|
|
5537
5636
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5557,17 +5656,16 @@ var dateFunctionMap = {
|
|
|
5557
5656
|
setDays: "setDate"
|
|
5558
5657
|
};
|
|
5559
5658
|
var setOfflineThreshold = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
5560
|
-
var _a, _b2;
|
|
5561
5659
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
5562
5660
|
const today = /* @__PURE__ */ new Date();
|
|
5563
5661
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
5564
|
-
const setter =
|
|
5565
|
-
const getter =
|
|
5662
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
5663
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
5566
5664
|
today[setter](today[getter]() - interval);
|
|
5567
5665
|
let value;
|
|
5568
5666
|
try {
|
|
5569
5667
|
value = today.toISOString();
|
|
5570
|
-
} catch
|
|
5668
|
+
} catch {
|
|
5571
5669
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
5572
5670
|
}
|
|
5573
5671
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -5608,48 +5706,47 @@ var getLatestReleaseInfo = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/
|
|
|
5608
5706
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
5609
5707
|
return accu;
|
|
5610
5708
|
},
|
|
5611
|
-
{ latestVersions:
|
|
5709
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
5612
5710
|
);
|
|
5613
5711
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
5614
5712
|
return Promise.resolve(
|
|
5615
5713
|
dispatch(
|
|
5616
|
-
actions.setVersionInformation(
|
|
5714
|
+
actions.setVersionInformation({
|
|
5715
|
+
...latestVersions,
|
|
5617
5716
|
backend: info,
|
|
5618
5717
|
GUI: info,
|
|
5619
5718
|
latestRelease: {
|
|
5620
5719
|
releaseDate: latestRelease.release_date,
|
|
5621
5720
|
repos: latestRepos
|
|
5622
5721
|
}
|
|
5623
|
-
})
|
|
5722
|
+
})
|
|
5624
5723
|
)
|
|
5625
5724
|
);
|
|
5626
5725
|
});
|
|
5627
5726
|
});
|
|
5628
5727
|
var setSearchState = (0, import_toolkit24.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
5629
5728
|
const currentState = getSearchState(getState());
|
|
5630
|
-
let nextState =
|
|
5631
|
-
|
|
5632
|
-
|
|
5729
|
+
let nextState = {
|
|
5730
|
+
...currentState,
|
|
5731
|
+
...searchState,
|
|
5732
|
+
sort: {
|
|
5733
|
+
...currentState.sort,
|
|
5734
|
+
...searchState.sort
|
|
5735
|
+
}
|
|
5736
|
+
};
|
|
5633
5737
|
let tasks = [];
|
|
5634
|
-
const
|
|
5635
|
-
const
|
|
5738
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
5739
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
5636
5740
|
if (nextRequestState.searchTerm && !(0, import_helpers12.deepCompare)(currentRequestState, nextRequestState)) {
|
|
5637
5741
|
nextState.isSearching = true;
|
|
5638
5742
|
tasks.push(
|
|
5639
5743
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
5640
5744
|
const searchResult = results[results.length - 1];
|
|
5641
|
-
return dispatch(actions.setSearchState(
|
|
5745
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
5642
5746
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
5643
5747
|
);
|
|
5644
5748
|
}
|
|
5645
5749
|
tasks.push(dispatch(actions.setSearchState(nextState)));
|
|
5646
5750
|
return Promise.all(tasks);
|
|
5647
5751
|
});
|
|
5648
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5649
|
-
0 && (module.exports = {
|
|
5650
|
-
getLatestReleaseInfo,
|
|
5651
|
-
setFirstLoginAfterSignup,
|
|
5652
|
-
setOfflineThreshold,
|
|
5653
|
-
setSearchState
|
|
5654
|
-
});
|
|
5655
5752
|
//# sourceMappingURL=thunks.js.map
|