@northern.tech/store 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.js +251 -135
- package/dist/actions.js.map +1 -1
- package/dist/actions.mjs +13 -13
- package/dist/api/general-api.js +102 -51
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/general-api.mjs +6 -6
- package/dist/api/users-api.js +104 -66
- package/dist/api/users-api.js.map +1 -1
- package/dist/api/users-api.mjs +7 -7
- package/dist/appSlice/constants.js +1 -39
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/constants.mjs +2 -2
- package/dist/appSlice/index.js +111 -64
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/index.mjs +5 -5
- package/dist/appSlice/selectors.js +1 -43
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/selectors.mjs +2 -2
- package/dist/appSlice/thunks.js +649 -552
- package/dist/appSlice/thunks.js.map +1 -1
- package/dist/appSlice/thunks.mjs +28 -28
- package/dist/auth.js +99 -51
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +5 -5
- package/dist/{chunk-C2YZYTJ6.mjs → chunk-2Z3RFYW4.mjs} +2 -11
- package/dist/{chunk-C2YZYTJ6.mjs.map → chunk-2Z3RFYW4.mjs.map} +1 -1
- package/dist/{chunk-F37LUTBX.mjs → chunk-3ORTTLIB.mjs} +19 -16
- package/dist/{chunk-F37LUTBX.mjs.map → chunk-3ORTTLIB.mjs.map} +1 -1
- package/dist/{chunk-7E7KJHY3.mjs → chunk-4SDUITD4.mjs} +6 -12
- package/dist/{chunk-7E7KJHY3.mjs.map → chunk-4SDUITD4.mjs.map} +1 -1
- package/dist/{chunk-BOSBROA3.mjs → chunk-5VNQCCAQ.mjs} +2 -7
- package/dist/{chunk-BOSBROA3.mjs.map → chunk-5VNQCCAQ.mjs.map} +1 -1
- package/dist/{chunk-R2GBNXLV.mjs → chunk-65YIOCCD.mjs} +6 -11
- package/dist/{chunk-R2GBNXLV.mjs.map → chunk-65YIOCCD.mjs.map} +1 -1
- package/dist/{chunk-ZIYGEXSJ.mjs → chunk-6CSGHZ3E.mjs} +9 -21
- package/dist/{chunk-ZIYGEXSJ.mjs.map → chunk-6CSGHZ3E.mjs.map} +1 -1
- package/dist/{chunk-HRWZJQMH.mjs → chunk-AZRVRNXT.mjs} +40 -30
- package/dist/{chunk-HRWZJQMH.mjs.map → chunk-AZRVRNXT.mjs.map} +1 -1
- package/dist/{chunk-M4U5R7A4.mjs → chunk-B42NUKMZ.mjs} +2 -6
- package/dist/{chunk-M4U5R7A4.mjs.map → chunk-B42NUKMZ.mjs.map} +1 -1
- package/dist/{chunk-DZBVTSIX.mjs → chunk-CHUCIHMY.mjs} +3 -4
- package/dist/{chunk-DZBVTSIX.mjs.map → chunk-CHUCIHMY.mjs.map} +1 -1
- package/dist/{chunk-YNVSU3AA.mjs → chunk-DIZJVB6M.mjs} +307 -292
- package/dist/chunk-DIZJVB6M.mjs.map +1 -0
- package/dist/chunk-H5UCKQWK.mjs +41 -0
- package/dist/{chunk-IPPIKGIB.mjs.map → chunk-H5UCKQWK.mjs.map} +1 -1
- package/dist/{chunk-ZNST5R6O.mjs → chunk-IFWKT27G.mjs} +92 -29
- package/dist/chunk-IFWKT27G.mjs.map +1 -0
- package/dist/{chunk-6667TCAJ.mjs → chunk-JA27QXVB.mjs} +37 -28
- package/dist/{chunk-6667TCAJ.mjs.map → chunk-JA27QXVB.mjs.map} +1 -1
- package/dist/{chunk-HVHZG2H4.mjs → chunk-K2NZL5V4.mjs} +4 -7
- package/dist/chunk-K2NZL5V4.mjs.map +1 -0
- package/dist/{chunk-RQOE5OOT.mjs → chunk-KJAZNKV2.mjs} +66 -55
- package/dist/chunk-KJAZNKV2.mjs.map +1 -0
- package/dist/{chunk-G32LAKW4.mjs → chunk-KPPU6OWF.mjs} +27 -39
- package/dist/{chunk-G32LAKW4.mjs.map → chunk-KPPU6OWF.mjs.map} +1 -1
- package/dist/{chunk-BJSH2G7W.mjs → chunk-KZSTW27Q.mjs} +30 -18
- package/dist/{chunk-BJSH2G7W.mjs.map → chunk-KZSTW27Q.mjs.map} +1 -1
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/{chunk-XYVPYFSM.mjs → chunk-NJNSCJEY.mjs} +22 -26
- package/dist/{chunk-XYVPYFSM.mjs.map → chunk-NJNSCJEY.mjs.map} +1 -1
- package/dist/{chunk-N7G6QK2E.mjs → chunk-O6TYYKSD.mjs} +62 -60
- package/dist/chunk-O6TYYKSD.mjs.map +1 -0
- package/dist/{chunk-G3I53JGW.mjs → chunk-QQBUNZHA.mjs} +3 -6
- package/dist/{chunk-G3I53JGW.mjs.map → chunk-QQBUNZHA.mjs.map} +1 -1
- package/dist/{chunk-TD45YTYK.mjs → chunk-R7LXL3KJ.mjs} +22 -23
- package/dist/chunk-R7LXL3KJ.mjs.map +1 -0
- package/dist/{chunk-G7LATUT6.mjs → chunk-WCUGLHYM.mjs} +16 -20
- package/dist/{chunk-G7LATUT6.mjs.map → chunk-WCUGLHYM.mjs.map} +1 -1
- package/dist/chunk-WYHJFSMQ.mjs +25 -0
- package/dist/{chunk-IVSYYXTC.mjs.map → chunk-WYHJFSMQ.mjs.map} +1 -1
- package/dist/{chunk-O6O3D52B.mjs → chunk-XC5UXEIB.mjs} +4 -11
- package/dist/{chunk-O6O3D52B.mjs.map → chunk-XC5UXEIB.mjs.map} +1 -1
- package/dist/{chunk-BRHSKNFC.mjs → chunk-XD7INCM4.mjs} +11 -17
- package/dist/{chunk-BRHSKNFC.mjs.map → chunk-XD7INCM4.mjs.map} +1 -1
- package/dist/{chunk-RH6ONMG7.mjs → chunk-ZE7R2XXE.mjs} +10 -12
- package/dist/{chunk-RH6ONMG7.mjs.map → chunk-ZE7R2XXE.mjs.map} +1 -1
- package/dist/{chunk-HXPYJ6QN.mjs → chunk-ZK4W5T53.mjs} +7 -11
- package/dist/{chunk-HXPYJ6QN.mjs.map → chunk-ZK4W5T53.mjs.map} +1 -1
- package/dist/commonConstants.d.mts +18 -19
- package/dist/commonConstants.d.ts +18 -19
- package/dist/commonConstants.js +2 -35
- package/dist/commonConstants.js.map +1 -1
- package/dist/commonConstants.mjs +2 -2
- package/dist/commonSelectors.d.mts +42 -1
- package/dist/commonSelectors.d.ts +42 -1
- package/dist/commonSelectors.js +149 -129
- package/dist/commonSelectors.js.map +1 -1
- package/dist/commonSelectors.mjs +14 -12
- package/dist/constants.d.mts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +92 -147
- package/dist/constants.js.map +1 -1
- package/dist/constants.mjs +18 -14
- package/dist/deploymentsSlice/constants.js +94 -55
- package/dist/deploymentsSlice/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.mjs +4 -4
- package/dist/deploymentsSlice/index.js +128 -75
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/index.mjs +5 -5
- package/dist/deploymentsSlice/selectors.js +95 -48
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/selectors.mjs +5 -5
- package/dist/deploymentsSlice/thunks.js +649 -561
- package/dist/deploymentsSlice/thunks.js.map +1 -1
- package/dist/deploymentsSlice/thunks.mjs +28 -28
- package/dist/devicesSlice/constants.js +94 -54
- package/dist/devicesSlice/constants.js.map +1 -1
- package/dist/devicesSlice/constants.mjs +4 -4
- package/dist/devicesSlice/index.js +131 -77
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/index.mjs +5 -5
- package/dist/devicesSlice/selectors.js +100 -85
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/selectors.mjs +5 -5
- package/dist/devicesSlice/thunks.js +649 -597
- package/dist/devicesSlice/thunks.js.map +1 -1
- package/dist/devicesSlice/thunks.mjs +28 -28
- package/dist/monitorSlice/constants.js +94 -41
- package/dist/monitorSlice/constants.js.map +1 -1
- package/dist/monitorSlice/constants.mjs +4 -4
- package/dist/monitorSlice/index.js +101 -48
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/index.mjs +5 -5
- package/dist/monitorSlice/selectors.js +0 -4
- package/dist/monitorSlice/selectors.mjs +1 -1
- package/dist/monitorSlice/thunks.js +333 -238
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/monitorSlice/thunks.mjs +25 -25
- package/dist/onboardingSlice/constants.js +0 -5
- package/dist/onboardingSlice/constants.mjs +1 -1
- package/dist/onboardingSlice/index.js +1 -22
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/index.mjs +2 -2
- package/dist/onboardingSlice/selectors.js +0 -4
- package/dist/onboardingSlice/selectors.mjs +1 -1
- package/dist/onboardingSlice/thunks.js +649 -555
- package/dist/onboardingSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/thunks.mjs +28 -28
- package/dist/organizationSlice/constants.d.mts +6 -1
- package/dist/organizationSlice/constants.d.ts +6 -1
- package/dist/organizationSlice/constants.js +89 -51
- package/dist/organizationSlice/constants.js.map +1 -1
- package/dist/organizationSlice/constants.mjs +6 -4
- package/dist/organizationSlice/index.d.mts +224 -246
- package/dist/organizationSlice/index.d.ts +224 -246
- package/dist/organizationSlice/index.js +113 -59
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/index.mjs +5 -5
- package/dist/organizationSlice/selectors.js +96 -58
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/selectors.mjs +5 -5
- package/dist/organizationSlice/thunks.js +649 -580
- package/dist/organizationSlice/thunks.js.map +1 -1
- package/dist/organizationSlice/thunks.mjs +28 -28
- package/dist/releasesSlice/constants.js +0 -7
- package/dist/releasesSlice/constants.mjs +1 -1
- package/dist/releasesSlice/index.js +98 -60
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/index.mjs +5 -5
- package/dist/releasesSlice/selectors.js +97 -53
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/selectors.mjs +6 -6
- package/dist/releasesSlice/thunks.js +377 -287
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/releasesSlice/thunks.mjs +25 -25
- package/dist/selectors.d.mts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +150 -202
- package/dist/selectors.js.map +1 -1
- package/dist/selectors.mjs +45 -43
- package/dist/store.d.mts +235 -135
- package/dist/store.d.ts +235 -135
- package/dist/store.js +262 -157
- package/dist/store.js.map +1 -1
- package/dist/store.mjs +16 -16
- package/dist/storehooks.d.mts +3 -1
- package/dist/storehooks.d.ts +3 -1
- package/dist/storehooks.js +686 -569
- package/dist/storehooks.js.map +1 -1
- package/dist/storehooks.mjs +71 -54
- package/dist/storehooks.mjs.map +1 -1
- package/dist/thunks.js +649 -710
- package/dist/thunks.js.map +1 -1
- package/dist/thunks.mjs +28 -28
- package/dist/usersSlice/constants.d.mts +192 -17
- package/dist/usersSlice/constants.d.ts +192 -17
- package/dist/usersSlice/constants.js +97 -61
- package/dist/usersSlice/constants.js.map +1 -1
- package/dist/usersSlice/constants.mjs +6 -4
- package/dist/usersSlice/index.d.mts +1628 -704
- package/dist/usersSlice/index.d.ts +1628 -704
- package/dist/usersSlice/index.js +122 -67
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/index.mjs +5 -5
- package/dist/usersSlice/selectors.js +101 -62
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/selectors.mjs +6 -6
- package/dist/usersSlice/thunks.js +649 -584
- package/dist/usersSlice/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.mjs +28 -28
- package/dist/utils.d.mts +6 -5
- package/dist/utils.d.ts +6 -5
- package/dist/utils.js +117 -89
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +5 -5
- package/package.json +66 -1
- package/dist/chunk-HVHZG2H4.mjs.map +0 -1
- package/dist/chunk-IPPIKGIB.mjs +0 -35
- package/dist/chunk-IVSYYXTC.mjs +0 -36
- package/dist/chunk-N7G6QK2E.mjs.map +0 -1
- package/dist/chunk-RQOE5OOT.mjs.map +0 -1
- package/dist/chunk-TD45YTYK.mjs.map +0 -1
- package/dist/chunk-XWBD7VOK.mjs +0 -93
- package/dist/chunk-YNVSU3AA.mjs.map +0 -1
- package/dist/chunk-ZNST5R6O.mjs.map +0 -1
- /package/dist/{chunk-XWBD7VOK.mjs.map → chunk-LZOMFHX3.mjs.map} +0 -0
|
@@ -1,40 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
26
|
-
var __objRest = (source, exclude) => {
|
|
27
|
-
var target = {};
|
|
28
|
-
for (var prop in source)
|
|
29
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
if (source != null && __getOwnPropSymbols)
|
|
32
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
33
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
34
|
-
target[prop] = source[prop];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
};
|
|
38
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
39
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
10
|
};
|
|
@@ -59,33 +29,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
59
29
|
mod
|
|
60
30
|
));
|
|
61
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
|
-
var __async = (__this, __arguments, generator) => {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
var fulfilled = (value) => {
|
|
65
|
-
try {
|
|
66
|
-
step(generator.next(value));
|
|
67
|
-
} catch (e) {
|
|
68
|
-
reject(e);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var rejected = (value) => {
|
|
72
|
-
try {
|
|
73
|
-
step(generator.throw(value));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
79
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
32
|
|
|
83
33
|
// ../../node_modules/pluralize/pluralize.js
|
|
84
34
|
var require_pluralize = __commonJS({
|
|
85
|
-
"../../node_modules/pluralize/pluralize.js"(
|
|
35
|
+
"../../node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
86
36
|
"use strict";
|
|
87
37
|
(function(root, pluralize2) {
|
|
88
|
-
if (typeof require === "function" && typeof
|
|
38
|
+
if (typeof require === "function" && typeof exports === "object" && typeof module2 === "object") {
|
|
89
39
|
module2.exports = pluralize2();
|
|
90
40
|
} else if (typeof define === "function" && define.amd) {
|
|
91
41
|
define(function() {
|
|
@@ -94,7 +44,7 @@ var require_pluralize = __commonJS({
|
|
|
94
44
|
} else {
|
|
95
45
|
root.pluralize = pluralize2();
|
|
96
46
|
}
|
|
97
|
-
})(
|
|
47
|
+
})(exports, function() {
|
|
98
48
|
var pluralRules = [];
|
|
99
49
|
var singularRules = [];
|
|
100
50
|
var uncountables = {};
|
|
@@ -473,7 +423,7 @@ var chartTypes = {
|
|
|
473
423
|
};
|
|
474
424
|
var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
|
|
475
425
|
var defaultReportType = "distribution";
|
|
476
|
-
var defaultReports = [
|
|
426
|
+
var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
|
|
477
427
|
var locations = {};
|
|
478
428
|
var PLANS = {
|
|
479
429
|
os: {
|
|
@@ -799,13 +749,14 @@ var emptyUiPermissions = Object.freeze({
|
|
|
799
749
|
deployments: [],
|
|
800
750
|
groups: Object.freeze({}),
|
|
801
751
|
releases: Object.freeze({}),
|
|
752
|
+
tenantManagement: [],
|
|
802
753
|
userManagement: []
|
|
803
754
|
});
|
|
804
755
|
var emptyRole = Object.freeze({
|
|
805
756
|
name: void 0,
|
|
806
757
|
description: "",
|
|
807
758
|
permissions: [],
|
|
808
|
-
uiPermissions: Object.freeze(
|
|
759
|
+
uiPermissions: Object.freeze({ ...emptyUiPermissions })
|
|
809
760
|
});
|
|
810
761
|
|
|
811
762
|
// src/deploymentsSlice/constants.ts
|
|
@@ -834,11 +785,12 @@ var deploymentStatesToSubstates = {
|
|
|
834
785
|
pending: [deploymentSubstates.pending],
|
|
835
786
|
successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
|
|
836
787
|
};
|
|
837
|
-
var deploymentStatesToSubstatesWithSkipped =
|
|
788
|
+
var deploymentStatesToSubstatesWithSkipped = {
|
|
789
|
+
...deploymentStatesToSubstates,
|
|
838
790
|
failures: [deploymentSubstates.failure],
|
|
839
791
|
skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
|
|
840
792
|
successes: [deploymentSubstates.success]
|
|
841
|
-
}
|
|
793
|
+
};
|
|
842
794
|
var installationSubstatesMap = {
|
|
843
795
|
download: {
|
|
844
796
|
title: "download",
|
|
@@ -883,8 +835,8 @@ var DEPLOYMENT_STATES = {
|
|
|
883
835
|
var listDefaultsByState = {
|
|
884
836
|
[DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
|
|
885
837
|
[DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
|
|
886
|
-
[DEPLOYMENT_STATES.scheduled]:
|
|
887
|
-
[DEPLOYMENT_STATES.finished]:
|
|
838
|
+
[DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
|
|
839
|
+
[DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
|
|
888
840
|
sort: { direction: SORTING_OPTIONS.desc }
|
|
889
841
|
};
|
|
890
842
|
var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
|
|
@@ -1046,6 +998,13 @@ var SSO_TYPES = {
|
|
|
1046
998
|
configDetails: [{ key: "startURL", label: "Start Url", getValue: getOidcStartUrl }]
|
|
1047
999
|
}
|
|
1048
1000
|
};
|
|
1001
|
+
var AUDIT_LOGS_TYPES = [
|
|
1002
|
+
{ title: "Artifact", queryParameter: "object_type", value: "artifact" },
|
|
1003
|
+
{ title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
|
|
1004
|
+
{ title: "Device", queryParameter: "object_id", value: "device" },
|
|
1005
|
+
{ title: "User", queryParameter: "object_id", value: "user" }
|
|
1006
|
+
];
|
|
1007
|
+
var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
|
|
1049
1008
|
var emptyWebhook = {
|
|
1050
1009
|
description: "",
|
|
1051
1010
|
enabled: true,
|
|
@@ -1094,10 +1053,12 @@ var permissionSetIds = {
|
|
|
1094
1053
|
DeployToDevices: "DeployToDevices",
|
|
1095
1054
|
ManageDevices: "ManageDevices",
|
|
1096
1055
|
ManageReleases: "ManageReleases",
|
|
1056
|
+
ManageTenants: "ManageTenants",
|
|
1097
1057
|
ManageUsers: "ManageUsers",
|
|
1098
1058
|
ReadAuditLogs: "ReadAuditLogs",
|
|
1099
1059
|
ReadDevices: "ReadDevices",
|
|
1100
1060
|
ReadReleases: "ReadReleases",
|
|
1061
|
+
ReadTenants: "ReadTenants",
|
|
1101
1062
|
ReadUsers: "ReadUsers",
|
|
1102
1063
|
SuperUser: "SuperUser",
|
|
1103
1064
|
UploadArtifacts: "UploadArtifacts"
|
|
@@ -1136,6 +1097,7 @@ var uiPermissionsById = {
|
|
|
1136
1097
|
permissionSets: {
|
|
1137
1098
|
groups: permissionSetIds.ManageDevices,
|
|
1138
1099
|
releases: permissionSetIds.ManageReleases,
|
|
1100
|
+
tenantManagement: permissionSetIds.ManageTenants,
|
|
1139
1101
|
userManagement: permissionSetIds.ManageUsers
|
|
1140
1102
|
},
|
|
1141
1103
|
title: "Manage",
|
|
@@ -1149,6 +1111,7 @@ var uiPermissionsById = {
|
|
|
1149
1111
|
auditlog: permissionSetIds.ReadAuditLogs,
|
|
1150
1112
|
groups: permissionSetIds.ReadDevices,
|
|
1151
1113
|
releases: permissionSetIds.ReadReleases,
|
|
1114
|
+
tenantManagement: permissionSetIds.ReadTenants,
|
|
1152
1115
|
userManagement: permissionSetIds.ReadUsers
|
|
1153
1116
|
},
|
|
1154
1117
|
title: "Read",
|
|
@@ -1173,6 +1136,7 @@ var uiPermissionsByArea = {
|
|
|
1173
1136
|
auditlog: {
|
|
1174
1137
|
endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
|
|
1175
1138
|
explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
|
|
1139
|
+
key: "auditlog",
|
|
1176
1140
|
uiPermissions: [uiPermissionsById.read],
|
|
1177
1141
|
title: "System audit log"
|
|
1178
1142
|
},
|
|
@@ -1183,6 +1147,7 @@ var uiPermissionsByArea = {
|
|
|
1183
1147
|
{ path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
|
|
1184
1148
|
],
|
|
1185
1149
|
explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
|
|
1150
|
+
key: "deployments",
|
|
1186
1151
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
|
|
1187
1152
|
title: "Deployments"
|
|
1188
1153
|
},
|
|
@@ -1198,6 +1163,7 @@ var uiPermissionsByArea = {
|
|
|
1198
1163
|
{ path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
|
|
1199
1164
|
],
|
|
1200
1165
|
explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
|
|
1166
|
+
key: "groups",
|
|
1201
1167
|
scope: scopedPermissionAreas.groups.scopeType,
|
|
1202
1168
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
|
|
1203
1169
|
title: "Group Management"
|
|
@@ -1217,22 +1183,35 @@ var uiPermissionsByArea = {
|
|
|
1217
1183
|
}
|
|
1218
1184
|
],
|
|
1219
1185
|
explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
|
|
1186
|
+
key: "releases",
|
|
1220
1187
|
scope: "ReleaseTags",
|
|
1221
1188
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
|
|
1222
1189
|
title: "Release Management"
|
|
1223
1190
|
},
|
|
1191
|
+
tenantManagement: {
|
|
1192
|
+
endpoints: [
|
|
1193
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1194
|
+
{ path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
|
|
1195
|
+
{ path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
|
|
1196
|
+
],
|
|
1197
|
+
explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
|
|
1198
|
+
key: "tenantManagement",
|
|
1199
|
+
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1200
|
+
title: "Tenant Management"
|
|
1201
|
+
},
|
|
1224
1202
|
userManagement: {
|
|
1225
1203
|
endpoints: [
|
|
1226
1204
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
|
|
1227
1205
|
{ path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
|
|
1228
1206
|
],
|
|
1229
1207
|
explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
|
|
1208
|
+
key: "userManagement",
|
|
1230
1209
|
uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
|
|
1231
1210
|
title: "User Management"
|
|
1232
1211
|
}
|
|
1233
1212
|
};
|
|
1234
1213
|
var permissionMapper = (permission) => permission.value;
|
|
1235
|
-
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ?
|
|
1214
|
+
var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
|
|
1236
1215
|
var rolesById = Object.freeze({
|
|
1237
1216
|
[staticRolesByName.admin]: {
|
|
1238
1217
|
name: "Admin",
|
|
@@ -1240,56 +1219,87 @@ var rolesById = Object.freeze({
|
|
|
1240
1219
|
description: "Full access",
|
|
1241
1220
|
permissions: [],
|
|
1242
1221
|
// permissions refers to the values returned from the backend
|
|
1243
|
-
uiPermissions:
|
|
1222
|
+
uiPermissions: {
|
|
1223
|
+
...emptyUiPermissions,
|
|
1244
1224
|
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1245
1225
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1246
1226
|
groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
|
|
1247
1227
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
|
|
1248
1228
|
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
|
|
1249
|
-
}
|
|
1229
|
+
}
|
|
1250
1230
|
},
|
|
1251
1231
|
[staticRolesByName.readOnly]: {
|
|
1252
1232
|
name: "Read Access",
|
|
1253
1233
|
value: staticRolesByName.readOnly,
|
|
1254
1234
|
description: "",
|
|
1255
1235
|
permissions: [],
|
|
1256
|
-
uiPermissions:
|
|
1236
|
+
uiPermissions: {
|
|
1237
|
+
...emptyUiPermissions,
|
|
1257
1238
|
deployments: [uiPermissionsById.read.value],
|
|
1258
1239
|
groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
|
|
1259
1240
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
|
|
1260
1241
|
userManagement: [uiPermissionsById.read.value]
|
|
1261
|
-
}
|
|
1242
|
+
}
|
|
1262
1243
|
},
|
|
1263
1244
|
[staticRolesByName.ci]: {
|
|
1264
1245
|
name: "Releases Manager",
|
|
1265
1246
|
value: staticRolesByName.ci,
|
|
1266
1247
|
description: "",
|
|
1267
1248
|
permissions: [],
|
|
1268
|
-
uiPermissions:
|
|
1249
|
+
uiPermissions: {
|
|
1250
|
+
...emptyUiPermissions,
|
|
1269
1251
|
releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
|
|
1270
|
-
}
|
|
1252
|
+
}
|
|
1271
1253
|
},
|
|
1272
1254
|
[staticRolesByName.deploymentsManager]: {
|
|
1273
1255
|
name: "Deployments Manager",
|
|
1274
1256
|
value: staticRolesByName.deploymentsManager,
|
|
1275
1257
|
description: "",
|
|
1276
1258
|
permissions: [],
|
|
1277
|
-
uiPermissions:
|
|
1259
|
+
uiPermissions: {
|
|
1260
|
+
...emptyUiPermissions,
|
|
1278
1261
|
deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
|
|
1279
1262
|
groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
|
|
1280
1263
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1281
|
-
}
|
|
1264
|
+
}
|
|
1282
1265
|
},
|
|
1283
1266
|
[staticRolesByName.terminalAccess]: {
|
|
1284
1267
|
name: "Troubleshooting",
|
|
1285
1268
|
value: staticRolesByName.terminalAccess,
|
|
1286
1269
|
description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
|
|
1287
1270
|
permissions: [],
|
|
1288
|
-
uiPermissions:
|
|
1271
|
+
uiPermissions: {
|
|
1272
|
+
...emptyUiPermissions,
|
|
1289
1273
|
groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
|
|
1290
|
-
}
|
|
1274
|
+
}
|
|
1291
1275
|
}
|
|
1292
1276
|
});
|
|
1277
|
+
var serviceProviderRolesById = {
|
|
1278
|
+
admin: {
|
|
1279
|
+
name: "Admin",
|
|
1280
|
+
value: staticRolesByName.admin,
|
|
1281
|
+
description: "Full access",
|
|
1282
|
+
permissions: [],
|
|
1283
|
+
uiPermissions: {
|
|
1284
|
+
...emptyUiPermissions,
|
|
1285
|
+
auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
|
|
1286
|
+
userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
|
|
1287
|
+
tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
readOnly: {
|
|
1291
|
+
name: "Read access",
|
|
1292
|
+
value: staticRolesByName.admin,
|
|
1293
|
+
description: "This role can see all linked organizations but cannot make any changes",
|
|
1294
|
+
permissions: [],
|
|
1295
|
+
uiPermissions: {
|
|
1296
|
+
...emptyUiPermissions,
|
|
1297
|
+
auditlog: [uiPermissionsById.read.value],
|
|
1298
|
+
userManagement: [uiPermissionsById.read.value],
|
|
1299
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1293
1303
|
var defaultPermissionSets = {
|
|
1294
1304
|
[permissionSetIds.Basic]: {
|
|
1295
1305
|
name: permissionSetIds.Basic,
|
|
@@ -1300,7 +1310,9 @@ var defaultPermissionSets = {
|
|
|
1300
1310
|
},
|
|
1301
1311
|
[permissionSetIds.SuperUser]: {
|
|
1302
1312
|
name: permissionSetIds.SuperUser,
|
|
1303
|
-
result:
|
|
1313
|
+
result: {
|
|
1314
|
+
...rolesById[staticRolesByName.admin].uiPermissions
|
|
1315
|
+
}
|
|
1304
1316
|
},
|
|
1305
1317
|
[permissionSetIds.ManageUsers]: {
|
|
1306
1318
|
name: permissionSetIds.ManageUsers,
|
|
@@ -1320,6 +1332,18 @@ var defaultPermissionSets = {
|
|
|
1320
1332
|
releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
|
|
1321
1333
|
}
|
|
1322
1334
|
},
|
|
1335
|
+
[permissionSetIds.ReadTenants]: {
|
|
1336
|
+
name: permissionSetIds.ReadTenants,
|
|
1337
|
+
result: {
|
|
1338
|
+
tenantManagement: [uiPermissionsById.read.value]
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
[permissionSetIds.ManageTenants]: {
|
|
1342
|
+
name: permissionSetIds.ManageTenants,
|
|
1343
|
+
result: {
|
|
1344
|
+
tenantManagement: [uiPermissionsById.manage.value]
|
|
1345
|
+
}
|
|
1346
|
+
},
|
|
1323
1347
|
[permissionSetIds.ReadUsers]: {
|
|
1324
1348
|
name: permissionSetIds.ReadUsers,
|
|
1325
1349
|
result: {
|
|
@@ -1373,11 +1397,12 @@ var defaultPermissionSets = {
|
|
|
1373
1397
|
};
|
|
1374
1398
|
var USER_LOGOUT = "USER_LOGOUT";
|
|
1375
1399
|
var OWN_USER_ID = "me";
|
|
1376
|
-
var rolesByName =
|
|
1400
|
+
var rolesByName = {
|
|
1401
|
+
...staticRolesByName,
|
|
1377
1402
|
deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1378
1403
|
groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
|
|
1379
1404
|
userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
|
|
1380
|
-
}
|
|
1405
|
+
};
|
|
1381
1406
|
var twoFAStates = {
|
|
1382
1407
|
enabled: "enabled",
|
|
1383
1408
|
disabled: "disabled",
|
|
@@ -1465,7 +1490,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1465
1490
|
initialState,
|
|
1466
1491
|
reducers: {
|
|
1467
1492
|
setFeatures: (state, action) => {
|
|
1468
|
-
state.features =
|
|
1493
|
+
state.features = {
|
|
1494
|
+
...state.features,
|
|
1495
|
+
...action.payload
|
|
1496
|
+
};
|
|
1469
1497
|
},
|
|
1470
1498
|
setSnackbar: (state, { payload }) => {
|
|
1471
1499
|
let { message, autoHideDuration, action, children, onClick, onClose } = payload;
|
|
@@ -1490,7 +1518,10 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1490
1518
|
state.hostedAnnouncement = action.payload;
|
|
1491
1519
|
},
|
|
1492
1520
|
setSearchState: (state, action) => {
|
|
1493
|
-
state.searchState =
|
|
1521
|
+
state.searchState = {
|
|
1522
|
+
...state.searchState,
|
|
1523
|
+
...action.payload
|
|
1524
|
+
};
|
|
1494
1525
|
},
|
|
1495
1526
|
setOfflineThreshold: (state, action) => {
|
|
1496
1527
|
state.offlineThreshold = action.payload;
|
|
@@ -1501,20 +1532,23 @@ var appSlice = (0, import_toolkit.createSlice)({
|
|
|
1501
1532
|
},
|
|
1502
1533
|
uploadProgress: (state, action) => {
|
|
1503
1534
|
const { id, progress: progress2 } = action.payload;
|
|
1504
|
-
state.uploadsById[id] =
|
|
1535
|
+
state.uploadsById[id] = {
|
|
1536
|
+
...state.uploadsById[id],
|
|
1505
1537
|
progress: progress2
|
|
1506
|
-
}
|
|
1538
|
+
};
|
|
1507
1539
|
},
|
|
1508
1540
|
cleanUpUpload: (state, action) => {
|
|
1509
|
-
|
|
1510
|
-
const _b2 = state.uploadsById, { [_a = action.payload]: current } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1541
|
+
const { [action.payload]: current, ...remainder } = state.uploadsById;
|
|
1511
1542
|
state.uploadsById = remainder;
|
|
1512
1543
|
},
|
|
1513
1544
|
setVersionInformation: (state, action) => {
|
|
1514
|
-
state.versionInformation =
|
|
1545
|
+
state.versionInformation = {
|
|
1546
|
+
...state.versionInformation,
|
|
1547
|
+
...action.payload
|
|
1548
|
+
};
|
|
1515
1549
|
},
|
|
1516
1550
|
setEnvironmentData: (state, action) => {
|
|
1517
|
-
return
|
|
1551
|
+
return { ...state, ...action.payload };
|
|
1518
1552
|
}
|
|
1519
1553
|
}
|
|
1520
1554
|
});
|
|
@@ -1546,7 +1580,7 @@ var initialState2 = {
|
|
|
1546
1580
|
sourceWindow: -1
|
|
1547
1581
|
},
|
|
1548
1582
|
binaryDeltaLimits: {
|
|
1549
|
-
timeout:
|
|
1583
|
+
timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
|
|
1550
1584
|
sourceWindow: limitDefault,
|
|
1551
1585
|
inputWindow: limitDefault,
|
|
1552
1586
|
duplicatesWindow: limitDefault,
|
|
@@ -1556,10 +1590,10 @@ var initialState2 = {
|
|
|
1556
1590
|
deploymentDeviceLimit: 5e3,
|
|
1557
1591
|
selectedDeviceIds: [],
|
|
1558
1592
|
selectionState: {
|
|
1559
|
-
finished:
|
|
1560
|
-
inprogress:
|
|
1561
|
-
pending:
|
|
1562
|
-
scheduled:
|
|
1593
|
+
finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
|
|
1594
|
+
inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1595
|
+
pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
|
|
1596
|
+
scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
|
|
1563
1597
|
general: {
|
|
1564
1598
|
state: DEPLOYMENT_ROUTES.active.key,
|
|
1565
1599
|
showCreationDialog: false,
|
|
@@ -1575,40 +1609,55 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
|
|
|
1575
1609
|
initialState: initialState2,
|
|
1576
1610
|
reducers: {
|
|
1577
1611
|
createdDeployment: (state, action) => {
|
|
1578
|
-
state.byId[action.payload.id] =
|
|
1612
|
+
state.byId[action.payload.id] = {
|
|
1613
|
+
...deploymentPrototype,
|
|
1614
|
+
...action.payload
|
|
1615
|
+
};
|
|
1579
1616
|
state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
|
|
1580
1617
|
state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
|
|
1581
1618
|
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;
|
|
1582
1619
|
},
|
|
1583
1620
|
removedDeployment: (state, action) => {
|
|
1584
|
-
|
|
1585
|
-
const _b2 = state.byId, { [_a = action.payload]: removedDeployment } = _b2, remainder = __objRest(_b2, [__restKey(_a)]);
|
|
1621
|
+
const { [action.payload]: removedDeployment, ...remainder } = state.byId;
|
|
1586
1622
|
state.byId = remainder;
|
|
1587
1623
|
},
|
|
1588
1624
|
receivedDeployment: (state, action) => {
|
|
1589
|
-
state.byId[action.payload.id] =
|
|
1625
|
+
state.byId[action.payload.id] = {
|
|
1626
|
+
...state.byId[action.payload.id] || {},
|
|
1627
|
+
...action.payload
|
|
1628
|
+
};
|
|
1590
1629
|
},
|
|
1591
1630
|
receivedDeploymentDeviceLog: (state, action) => {
|
|
1592
1631
|
const { id, deviceId, log } = action.payload;
|
|
1593
|
-
const deployment =
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1632
|
+
const deployment = {
|
|
1633
|
+
...deploymentPrototype,
|
|
1634
|
+
...state.byId[id]
|
|
1635
|
+
};
|
|
1636
|
+
state.byId[id] = {
|
|
1637
|
+
...deployment,
|
|
1638
|
+
devices: {
|
|
1639
|
+
...deployment.devices,
|
|
1640
|
+
[deviceId]: {
|
|
1641
|
+
...deployment.devices[deviceId],
|
|
1597
1642
|
log
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1601
1646
|
},
|
|
1602
1647
|
receivedDeploymentDevices: (state, action) => {
|
|
1603
1648
|
const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
|
|
1604
|
-
state.byId[id] =
|
|
1649
|
+
state.byId[id] = {
|
|
1650
|
+
...state.byId[id],
|
|
1605
1651
|
devices,
|
|
1606
1652
|
totalDeviceCount
|
|
1607
|
-
}
|
|
1653
|
+
};
|
|
1608
1654
|
state.selectedDeviceIds = selectedDeviceIds;
|
|
1609
1655
|
},
|
|
1610
1656
|
receivedDeployments: (state, action) => {
|
|
1611
|
-
state.byId =
|
|
1657
|
+
state.byId = {
|
|
1658
|
+
...state.byId,
|
|
1659
|
+
...action.payload
|
|
1660
|
+
};
|
|
1612
1661
|
},
|
|
1613
1662
|
receivedDeploymentsForStatus: (state, action) => {
|
|
1614
1663
|
const { status, deploymentIds, total } = action.payload;
|
|
@@ -1650,9 +1699,9 @@ var initialState3 = {
|
|
|
1650
1699
|
[DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
|
|
1651
1700
|
[DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
|
|
1652
1701
|
},
|
|
1653
|
-
deviceList:
|
|
1654
|
-
deviceIds: []
|
|
1655
|
-
|
|
1702
|
+
deviceList: {
|
|
1703
|
+
deviceIds: [],
|
|
1704
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1656
1705
|
selectedAttributes: [],
|
|
1657
1706
|
selectedIssues: [],
|
|
1658
1707
|
selection: [],
|
|
@@ -1663,7 +1712,7 @@ var initialState3 = {
|
|
|
1663
1712
|
},
|
|
1664
1713
|
state: DEVICE_STATES.accepted,
|
|
1665
1714
|
total: 0
|
|
1666
|
-
}
|
|
1715
|
+
},
|
|
1667
1716
|
filters: [
|
|
1668
1717
|
// { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
|
|
1669
1718
|
],
|
|
@@ -1698,49 +1747,59 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1698
1747
|
},
|
|
1699
1748
|
addToGroup: (state, action) => {
|
|
1700
1749
|
const { group, deviceIds } = action.payload;
|
|
1701
|
-
const maybeExistingGroup =
|
|
1750
|
+
const maybeExistingGroup = {
|
|
1702
1751
|
filters: [],
|
|
1703
|
-
deviceIds: []
|
|
1704
|
-
|
|
1705
|
-
|
|
1752
|
+
deviceIds: [],
|
|
1753
|
+
...state.groups.byId[group]
|
|
1754
|
+
};
|
|
1755
|
+
state.groups.byId[group] = {
|
|
1756
|
+
...maybeExistingGroup,
|
|
1706
1757
|
deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
|
|
1707
1758
|
total: (maybeExistingGroup.total || 0) + 1
|
|
1708
|
-
}
|
|
1759
|
+
};
|
|
1709
1760
|
},
|
|
1710
1761
|
removeFromGroup: (state, action) => {
|
|
1711
1762
|
const { group, deviceIds: removedIds } = action.payload;
|
|
1712
|
-
const
|
|
1713
|
-
const changedGroup =
|
|
1763
|
+
const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
|
|
1764
|
+
const changedGroup = {
|
|
1765
|
+
...maybeExistingGroup,
|
|
1714
1766
|
deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
|
|
1715
1767
|
total: Math.max(total - removedIds.length, 0)
|
|
1716
|
-
}
|
|
1768
|
+
};
|
|
1717
1769
|
if (changedGroup.total || changedGroup.deviceIds.length) {
|
|
1718
1770
|
state.groups.byId[group] = changedGroup;
|
|
1719
1771
|
return;
|
|
1720
1772
|
} else if (state.groups.selectedGroup === group) {
|
|
1721
1773
|
state.groups.selectedGroup = void 0;
|
|
1722
1774
|
}
|
|
1723
|
-
const
|
|
1775
|
+
const { [group]: removal, ...remainingById } = state.groups.byId;
|
|
1724
1776
|
state.groups.byId = remainingById;
|
|
1725
1777
|
},
|
|
1726
1778
|
addGroup: (state, action) => {
|
|
1727
1779
|
const { groupName, group } = action.payload;
|
|
1728
|
-
state.groups.byId[groupName] =
|
|
1780
|
+
state.groups.byId[groupName] = {
|
|
1781
|
+
...state.groups.byId[groupName],
|
|
1782
|
+
...group
|
|
1783
|
+
};
|
|
1729
1784
|
},
|
|
1730
1785
|
selectGroup: (state, { payload: group }) => {
|
|
1731
1786
|
state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
|
|
1732
1787
|
state.groups.selectedGroup = group;
|
|
1733
1788
|
},
|
|
1734
1789
|
removeGroup: (state, action) => {
|
|
1735
|
-
|
|
1736
|
-
const _b2 = state.groups.byId, { [_a = action.payload]: removal } = _b2, remainingById = __objRest(_b2, [__restKey(_a)]);
|
|
1790
|
+
const { [action.payload]: removal, ...remainingById } = state.groups.byId;
|
|
1737
1791
|
state.groups.byId = remainingById;
|
|
1738
1792
|
state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
|
|
1739
1793
|
},
|
|
1740
1794
|
setDeviceListState: (state, action) => {
|
|
1741
|
-
state.deviceList =
|
|
1742
|
-
|
|
1743
|
-
|
|
1795
|
+
state.deviceList = {
|
|
1796
|
+
...state.deviceList,
|
|
1797
|
+
...action.payload,
|
|
1798
|
+
sort: {
|
|
1799
|
+
...state.deviceList.sort,
|
|
1800
|
+
...action.payload.sort
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1744
1803
|
},
|
|
1745
1804
|
setFilterAttributes: (state, action) => {
|
|
1746
1805
|
state.filteringAttributes = action.payload;
|
|
@@ -1749,7 +1808,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1749
1808
|
state.filteringAttributesConfig = action.payload;
|
|
1750
1809
|
},
|
|
1751
1810
|
receivedDevices: (state, action) => {
|
|
1752
|
-
state.byId =
|
|
1811
|
+
state.byId = {
|
|
1812
|
+
...state.byId,
|
|
1813
|
+
...action.payload
|
|
1814
|
+
};
|
|
1753
1815
|
},
|
|
1754
1816
|
setDeviceFilters: (state, action) => {
|
|
1755
1817
|
if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
|
|
@@ -1780,7 +1842,10 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
|
|
|
1780
1842
|
state.limit = action.payload;
|
|
1781
1843
|
},
|
|
1782
1844
|
receivedDevice: (state, action) => {
|
|
1783
|
-
state.byId[action.payload.id] =
|
|
1845
|
+
state.byId[action.payload.id] = {
|
|
1846
|
+
...state.byId[action.payload.id],
|
|
1847
|
+
...action.payload
|
|
1848
|
+
};
|
|
1784
1849
|
},
|
|
1785
1850
|
maybeUpdateDevicesByStatus: (state, action) => {
|
|
1786
1851
|
const { deviceId, authId } = action.payload;
|
|
@@ -1801,15 +1866,17 @@ var import_toolkit4 = require("@reduxjs/toolkit");
|
|
|
1801
1866
|
var sliceName4 = "monitor";
|
|
1802
1867
|
var initialState4 = {
|
|
1803
1868
|
alerts: {
|
|
1804
|
-
alertList:
|
|
1869
|
+
alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
|
|
1805
1870
|
byDeviceId: {}
|
|
1806
1871
|
},
|
|
1807
1872
|
issueCounts: {
|
|
1808
|
-
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) =>
|
|
1873
|
+
byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
|
|
1809
1874
|
},
|
|
1810
1875
|
settings: {
|
|
1811
1876
|
global: {
|
|
1812
|
-
channels:
|
|
1877
|
+
channels: {
|
|
1878
|
+
...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
|
|
1879
|
+
}
|
|
1813
1880
|
}
|
|
1814
1881
|
}
|
|
1815
1882
|
};
|
|
@@ -1827,14 +1894,14 @@ var monitorSlice = (0, import_toolkit4.createSlice)({
|
|
|
1827
1894
|
},
|
|
1828
1895
|
receiveLatestDeviceAlerts: (state, action) => {
|
|
1829
1896
|
const { deviceId, alerts } = action.payload;
|
|
1830
|
-
state.alerts.byDeviceId[deviceId] =
|
|
1897
|
+
state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
|
|
1831
1898
|
},
|
|
1832
1899
|
receiveDeviceIssueCounts: (state, action) => {
|
|
1833
1900
|
const { issueType, counts } = action.payload;
|
|
1834
1901
|
state.issueCounts.byType[issueType] = counts;
|
|
1835
1902
|
},
|
|
1836
1903
|
setAlertListState: (state, action) => {
|
|
1837
|
-
state.alerts.alertList =
|
|
1904
|
+
state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
|
|
1838
1905
|
}
|
|
1839
1906
|
}
|
|
1840
1907
|
});
|
|
@@ -1858,7 +1925,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
|
|
|
1858
1925
|
initialState: initialState5,
|
|
1859
1926
|
reducers: {
|
|
1860
1927
|
setOnboardingState: (state, action) => {
|
|
1861
|
-
return
|
|
1928
|
+
return { ...state, ...action.payload };
|
|
1862
1929
|
},
|
|
1863
1930
|
setDemoArtifactPort: (state, action) => {
|
|
1864
1931
|
state.demoArtifactPort = action.payload;
|
|
@@ -1896,21 +1963,23 @@ var initialState6 = {
|
|
|
1896
1963
|
brand: ""
|
|
1897
1964
|
},
|
|
1898
1965
|
intentId: null,
|
|
1966
|
+
tenantList: {
|
|
1967
|
+
...TENANT_LIST_DEFAULT,
|
|
1968
|
+
total: 0,
|
|
1969
|
+
tenants: [],
|
|
1970
|
+
selectedTenant: null,
|
|
1971
|
+
sort: {
|
|
1972
|
+
direction: SORTING_OPTIONS.desc,
|
|
1973
|
+
key: "name"
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1899
1976
|
organization: {
|
|
1900
|
-
tenantList: __spreadProps(__spreadValues({}, TENANT_LIST_DEFAULT), {
|
|
1901
|
-
total: 0,
|
|
1902
|
-
tenants: [],
|
|
1903
|
-
selectedTenant: null,
|
|
1904
|
-
sort: {
|
|
1905
|
-
direction: SORTING_OPTIONS.desc,
|
|
1906
|
-
key: "name"
|
|
1907
|
-
}
|
|
1908
|
-
})
|
|
1909
1977
|
// id, name, status, tenant_token, plan
|
|
1910
1978
|
},
|
|
1911
1979
|
auditlog: {
|
|
1912
1980
|
events: [],
|
|
1913
|
-
selectionState:
|
|
1981
|
+
selectionState: {
|
|
1982
|
+
...DEVICE_LIST_DEFAULTS,
|
|
1914
1983
|
detail: void 0,
|
|
1915
1984
|
endDate: void 0,
|
|
1916
1985
|
selectedIssue: void 0,
|
|
@@ -1919,7 +1988,7 @@ var initialState6 = {
|
|
|
1919
1988
|
total: 0,
|
|
1920
1989
|
type: void 0,
|
|
1921
1990
|
user: void 0
|
|
1922
|
-
}
|
|
1991
|
+
}
|
|
1923
1992
|
},
|
|
1924
1993
|
externalDeviceIntegrations: [
|
|
1925
1994
|
// { <connection_string|x509|...>, id, provider }
|
|
@@ -1942,7 +2011,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1942
2011
|
state.auditlog.selectionState.total = total;
|
|
1943
2012
|
},
|
|
1944
2013
|
setAuditLogState: (state, action) => {
|
|
1945
|
-
state.auditlog.selectionState =
|
|
2014
|
+
state.auditlog.selectionState = {
|
|
2015
|
+
...state.auditlog.selectionState,
|
|
2016
|
+
...action.payload
|
|
2017
|
+
};
|
|
1946
2018
|
},
|
|
1947
2019
|
receiveCurrentCard: (state, action) => {
|
|
1948
2020
|
state.card = action.payload;
|
|
@@ -1951,12 +2023,10 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1951
2023
|
state.intentId = action.payload;
|
|
1952
2024
|
},
|
|
1953
2025
|
setOrganization: (state, action) => {
|
|
1954
|
-
state.organization =
|
|
1955
|
-
tenantList: __spreadValues(__spreadValues({}, state.organization.tenantList), action.payload.tenantList)
|
|
1956
|
-
});
|
|
2026
|
+
state.organization = { ...state.organization, ...action.payload };
|
|
1957
2027
|
},
|
|
1958
2028
|
setTenantListState: (state, action) => {
|
|
1959
|
-
state.
|
|
2029
|
+
state.tenantList = action.payload;
|
|
1960
2030
|
},
|
|
1961
2031
|
receiveExternalDeviceIntegrations: (state, action) => {
|
|
1962
2032
|
state.externalDeviceIntegrations = action.payload;
|
|
@@ -2016,7 +2086,8 @@ var initialState7 = {
|
|
|
2016
2086
|
}
|
|
2017
2087
|
*/
|
|
2018
2088
|
},
|
|
2019
|
-
releasesList:
|
|
2089
|
+
releasesList: {
|
|
2090
|
+
...DEVICE_LIST_DEFAULTS,
|
|
2020
2091
|
searchedIds: [],
|
|
2021
2092
|
releaseIds: [],
|
|
2022
2093
|
selection: [],
|
|
@@ -2030,7 +2101,7 @@ var initialState7 = {
|
|
|
2030
2101
|
selectedTags: [],
|
|
2031
2102
|
total: 0,
|
|
2032
2103
|
type: ""
|
|
2033
|
-
}
|
|
2104
|
+
},
|
|
2034
2105
|
tags: [],
|
|
2035
2106
|
updateTypes: [],
|
|
2036
2107
|
/*
|
|
@@ -2056,8 +2127,7 @@ var releaseSlice = (0, import_toolkit7.createSlice)({
|
|
|
2056
2127
|
state.updateTypes = action.payload;
|
|
2057
2128
|
},
|
|
2058
2129
|
removeRelease: (state, action) => {
|
|
2059
|
-
|
|
2060
|
-
const _b2 = state.byId, { [_a = action.payload]: toBeRemoved } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2130
|
+
const { [action.payload]: toBeRemoved, ...byId } = state.byId;
|
|
2061
2131
|
state.byId = byId;
|
|
2062
2132
|
state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
|
|
2063
2133
|
},
|
|
@@ -2090,8 +2160,12 @@ var initialState8 = {
|
|
|
2090
2160
|
previousPhases: [],
|
|
2091
2161
|
retries: 0
|
|
2092
2162
|
},
|
|
2093
|
-
permissionSetsById:
|
|
2094
|
-
|
|
2163
|
+
permissionSetsById: {
|
|
2164
|
+
...defaultPermissionSets
|
|
2165
|
+
},
|
|
2166
|
+
rolesById: {
|
|
2167
|
+
...rolesById
|
|
2168
|
+
},
|
|
2095
2169
|
settingsInitialized: false,
|
|
2096
2170
|
showConnectDeviceDialog: false,
|
|
2097
2171
|
showFeedbackDialog: false,
|
|
@@ -2131,13 +2205,15 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2131
2205
|
state.byId[0] = action.payload;
|
|
2132
2206
|
},
|
|
2133
2207
|
removedUser: (state, action) => {
|
|
2134
|
-
|
|
2135
|
-
const _b2 = state.byId, { [_a = action.payload]: removedUser } = _b2, byId = __objRest(_b2, [__restKey(_a)]);
|
|
2208
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
2136
2209
|
state.byId = byId;
|
|
2137
2210
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
2138
2211
|
},
|
|
2139
2212
|
updatedUser: (state, action) => {
|
|
2140
|
-
state.byId[action.payload.id] =
|
|
2213
|
+
state.byId[action.payload.id] = {
|
|
2214
|
+
...state.byId[action.payload.id],
|
|
2215
|
+
...action.payload
|
|
2216
|
+
};
|
|
2141
2217
|
},
|
|
2142
2218
|
receivedPermissionSets: (state, action) => {
|
|
2143
2219
|
state.permissionSetsById = action.payload;
|
|
@@ -2146,11 +2222,13 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2146
2222
|
state.rolesById = action.payload;
|
|
2147
2223
|
},
|
|
2148
2224
|
createdRole: (state, action) => {
|
|
2149
|
-
state.rolesById[action.payload.name] =
|
|
2225
|
+
state.rolesById[action.payload.name] = {
|
|
2226
|
+
...state.rolesById[action.payload.name],
|
|
2227
|
+
...action.payload
|
|
2228
|
+
};
|
|
2150
2229
|
},
|
|
2151
2230
|
removedRole: (state, action) => {
|
|
2152
|
-
|
|
2153
|
-
const _b2 = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b2, rolesById2 = __objRest(_b2, [__restKey(_a)]);
|
|
2231
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
2154
2232
|
state.rolesById = rolesById2;
|
|
2155
2233
|
},
|
|
2156
2234
|
setCustomColumns: (state, action) => {
|
|
@@ -2158,18 +2236,27 @@ var usersSlice = (0, import_toolkit8.createSlice)({
|
|
|
2158
2236
|
},
|
|
2159
2237
|
setGlobalSettings: (state, action) => {
|
|
2160
2238
|
state.settingsInitialized = true;
|
|
2161
|
-
state.globalSettings =
|
|
2239
|
+
state.globalSettings = {
|
|
2240
|
+
...state.globalSettings,
|
|
2241
|
+
...action.payload
|
|
2242
|
+
};
|
|
2162
2243
|
},
|
|
2163
2244
|
setUserSettings: (state, action) => {
|
|
2164
2245
|
state.userSettingsInitialized = true;
|
|
2165
|
-
state.userSettings =
|
|
2246
|
+
state.userSettings = {
|
|
2247
|
+
...state.userSettings,
|
|
2248
|
+
...action.payload
|
|
2249
|
+
};
|
|
2166
2250
|
},
|
|
2167
2251
|
setTooltipState: (state, action) => {
|
|
2168
2252
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
2169
2253
|
state.tooltips.byId[id].readState = readState;
|
|
2170
2254
|
},
|
|
2171
2255
|
setTooltipsState: (state, action) => {
|
|
2172
|
-
state.tooltips.byId =
|
|
2256
|
+
state.tooltips.byId = {
|
|
2257
|
+
...state.tooltips.byId,
|
|
2258
|
+
...action.payload
|
|
2259
|
+
};
|
|
2173
2260
|
},
|
|
2174
2261
|
setShowFeedbackDialog: (state, action) => {
|
|
2175
2262
|
state.showFeedbackDialog = action.payload;
|
|
@@ -2186,7 +2273,16 @@ var actions8 = usersSlice.actions;
|
|
|
2186
2273
|
var usersSlice_default = usersSlice.reducer;
|
|
2187
2274
|
|
|
2188
2275
|
// src/actions.ts
|
|
2189
|
-
var actions_default =
|
|
2276
|
+
var actions_default = {
|
|
2277
|
+
...actions,
|
|
2278
|
+
...actions2,
|
|
2279
|
+
...actions3,
|
|
2280
|
+
...actions4,
|
|
2281
|
+
...actions5,
|
|
2282
|
+
...actions6,
|
|
2283
|
+
...actions7,
|
|
2284
|
+
...actions8
|
|
2285
|
+
};
|
|
2190
2286
|
|
|
2191
2287
|
// src/api/general-api.ts
|
|
2192
2288
|
var import_axios = __toESM(require("axios"));
|
|
@@ -2197,18 +2293,17 @@ var cookies = new import_universal_cookie.default();
|
|
|
2197
2293
|
var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
|
|
2198
2294
|
var tokenCache = "";
|
|
2199
2295
|
var getSessionInfo = () => {
|
|
2200
|
-
|
|
2201
|
-
let sessionInfo = __spreadValues({}, emptySession);
|
|
2296
|
+
let sessionInfo = { ...emptySession };
|
|
2202
2297
|
try {
|
|
2203
|
-
sessionInfo = JSON.parse(
|
|
2204
|
-
} catch
|
|
2298
|
+
sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
|
|
2299
|
+
} catch {
|
|
2205
2300
|
}
|
|
2206
2301
|
if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
2207
2302
|
cleanUp();
|
|
2208
|
-
return
|
|
2303
|
+
return { ...emptySession };
|
|
2209
2304
|
}
|
|
2210
2305
|
if (!sessionInfo.token) {
|
|
2211
|
-
let jwtTokenFromCookie =
|
|
2306
|
+
let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
|
|
2212
2307
|
if (jwtTokenFromCookie) {
|
|
2213
2308
|
setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
|
|
2214
2309
|
sessionInfo.token = jwtTokenFromCookie;
|
|
@@ -2236,8 +2331,7 @@ var maxSessionAge = 900;
|
|
|
2236
2331
|
|
|
2237
2332
|
// src/api/general-api.ts
|
|
2238
2333
|
var unauthorizedRedirect = (error) => {
|
|
2239
|
-
|
|
2240
|
-
if (!(0, import_axios.isCancel)(error) && ((_a = error.response) == null ? void 0 : _a.status) === 401 && getToken()) {
|
|
2334
|
+
if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
|
|
2241
2335
|
cleanUp();
|
|
2242
2336
|
window.location.replace("/ui/");
|
|
2243
2337
|
}
|
|
@@ -2247,7 +2341,7 @@ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Conten
|
|
|
2247
2341
|
var authenticatedRequest = import_axios.default.create(commonRequestConfig);
|
|
2248
2342
|
authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
|
|
2249
2343
|
authenticatedRequest.interceptors.request.use(
|
|
2250
|
-
(config) =>
|
|
2344
|
+
(config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
|
|
2251
2345
|
(error) => Promise.reject(error)
|
|
2252
2346
|
);
|
|
2253
2347
|
var Api = {
|
|
@@ -2255,7 +2349,7 @@ var Api = {
|
|
|
2255
2349
|
delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
|
|
2256
2350
|
patch: authenticatedRequest.patch,
|
|
2257
2351
|
post: authenticatedRequest.post,
|
|
2258
|
-
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data,
|
|
2352
|
+
postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
|
|
2259
2353
|
put: authenticatedRequest.put,
|
|
2260
2354
|
upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
|
|
2261
2355
|
headers: { "Content-Type": "multipart/form-data" },
|
|
@@ -2286,10 +2380,7 @@ var getSearchState = (state) => state.app.searchState;
|
|
|
2286
2380
|
var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
|
|
2287
2381
|
var getVersionInformation = (0, import_toolkit9.createSelector)(
|
|
2288
2382
|
[getFullVersionInformation, getFeatures],
|
|
2289
|
-
(
|
|
2290
|
-
var _b2 = _a, { Integration } = _b2, remainder = __objRest(_b2, ["Integration"]);
|
|
2291
|
-
return isHosted && Integration !== "next" ? remainder : __spreadProps(__spreadValues({}, remainder), { Integration });
|
|
2292
|
-
}
|
|
2383
|
+
({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
|
|
2293
2384
|
);
|
|
2294
2385
|
var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
|
|
2295
2386
|
|
|
@@ -2306,8 +2397,7 @@ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
|
|
|
2306
2397
|
var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
|
|
2307
2398
|
[getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
|
|
2308
2399
|
(selectionState, deploymentsState, deploymentsById) => {
|
|
2309
|
-
|
|
2310
|
-
const { selection = [] } = (_a = selectionState[deploymentsState]) != null ? _a : {};
|
|
2400
|
+
const { selection = [] } = selectionState[deploymentsState] ?? {};
|
|
2311
2401
|
return selection.reduce((accu, id) => {
|
|
2312
2402
|
if (deploymentsById[id]) {
|
|
2313
2403
|
accu.push(deploymentsById[id]);
|
|
@@ -2351,7 +2441,8 @@ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
|
|
|
2351
2441
|
var getFilteringAttributes = (state) => state.devices.filteringAttributes;
|
|
2352
2442
|
var getDeviceFilters = (state) => state.devices.filters || [];
|
|
2353
2443
|
var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
|
|
2354
|
-
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) =>
|
|
2444
|
+
var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
|
|
2445
|
+
...filteringAttributes,
|
|
2355
2446
|
identityAttributes: [...filteringAttributes.identityAttributes, "id"]
|
|
2356
2447
|
}));
|
|
2357
2448
|
var getDeviceLimit = (state) => state.devices.limit;
|
|
@@ -2379,10 +2470,7 @@ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
|
|
|
2379
2470
|
return accu;
|
|
2380
2471
|
}, {})
|
|
2381
2472
|
);
|
|
2382
|
-
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => {
|
|
2383
|
-
var _a;
|
|
2384
|
-
return (_a = devicesById[deviceId]) != null ? _a : {};
|
|
2385
|
-
});
|
|
2473
|
+
var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
|
|
2386
2474
|
var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
|
|
2387
2475
|
[getAcceptedDevices, getGroupsById, getSelectedGroup],
|
|
2388
2476
|
({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
|
|
@@ -2399,17 +2487,13 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
|
|
|
2399
2487
|
[getAcceptedDevices, getDeviceLimit],
|
|
2400
2488
|
({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
|
|
2401
2489
|
);
|
|
2402
|
-
var
|
|
2403
|
-
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], (_a) => {
|
|
2404
|
-
var _c = _a, { [_b = UNGROUPED_GROUP.id]: ungrouped } = _c, groups = __objRest(_c, [__restKey(_b)]);
|
|
2405
|
-
return groups;
|
|
2406
|
-
});
|
|
2490
|
+
var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
|
|
2407
2491
|
var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
|
|
2408
2492
|
const groupNames = Object.keys(groupsById).sort();
|
|
2409
2493
|
const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
|
|
2410
2494
|
(accu, [groupname, group]) => {
|
|
2411
2495
|
const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
|
|
2412
|
-
const groupItem =
|
|
2496
|
+
const groupItem = { ...group, groupId: name, name: groupname };
|
|
2413
2497
|
if (group.filters.length > 0) {
|
|
2414
2498
|
if (groupname !== UNGROUPED_GROUP.id) {
|
|
2415
2499
|
accu.dynamic.push(groupItem);
|
|
@@ -2423,7 +2507,7 @@ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsByI
|
|
|
2423
2507
|
},
|
|
2424
2508
|
{ dynamic: [], static: [], ungrouped: [] }
|
|
2425
2509
|
);
|
|
2426
|
-
return
|
|
2510
|
+
return { groupNames, ...groupedGroups };
|
|
2427
2511
|
});
|
|
2428
2512
|
var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
2429
2513
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
@@ -2458,15 +2542,12 @@ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegr
|
|
|
2458
2542
|
var getAuditlogState = (state) => state.organization.auditlog.selectionState;
|
|
2459
2543
|
var getAuditLog = (state) => state.organization.auditlog.events;
|
|
2460
2544
|
var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
|
|
2461
|
-
var getTenantsList = (state) => state.organization.
|
|
2545
|
+
var getTenantsList = (state) => state.organization.tenantList;
|
|
2462
2546
|
var getWebhookEvents = (state) => state.organization.webhooks.events;
|
|
2463
2547
|
var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
|
|
2464
2548
|
var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
|
|
2465
2549
|
[getExternalIntegrations],
|
|
2466
|
-
(integrations) => integrations.filter((integration) =>
|
|
2467
|
-
var _a;
|
|
2468
|
-
return integration.id && ((_a = EXTERNAL_PROVIDER[integration.provider]) == null ? void 0 : _a.deviceTwin);
|
|
2469
|
-
})
|
|
2550
|
+
(integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
|
|
2470
2551
|
);
|
|
2471
2552
|
var getIsServiceProvider = (state) => state.organization.organization.service_provider;
|
|
2472
2553
|
var getWebhooks = (0, import_toolkit12.createSelector)(
|
|
@@ -2500,15 +2581,12 @@ var filterProcessors = {
|
|
|
2500
2581
|
var filterAliases = {
|
|
2501
2582
|
$nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
|
|
2502
2583
|
};
|
|
2503
|
-
var mapFiltersToTerms = (filters) => filters.map((filter) => {
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2510
|
-
};
|
|
2511
|
-
});
|
|
2584
|
+
var mapFiltersToTerms = (filters) => filters.map((filter) => ({
|
|
2585
|
+
scope: filter.scope,
|
|
2586
|
+
attribute: filter.key,
|
|
2587
|
+
type: filterAliases[filter.operator]?.alias || filter.operator,
|
|
2588
|
+
value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
|
|
2589
|
+
}));
|
|
2512
2590
|
var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
2513
2591
|
const aliasedFilter = Object.entries(filterAliases).find(
|
|
2514
2592
|
(aliasDefinition) => aliasDefinition[1].alias === term.type && aliasDefinition[1].value === term.value
|
|
@@ -2518,14 +2596,13 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
|
|
|
2518
2596
|
});
|
|
2519
2597
|
var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
|
|
2520
2598
|
if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
|
|
2521
|
-
return
|
|
2599
|
+
return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
|
|
2522
2600
|
}
|
|
2523
2601
|
return DEVICE_ISSUE_OPTIONS[item].filterRule;
|
|
2524
2602
|
});
|
|
2525
2603
|
var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
|
|
2526
|
-
var _a;
|
|
2527
2604
|
let applicableFilters = [...filters];
|
|
2528
|
-
if (typeof group === "string" && !(
|
|
2605
|
+
if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
|
|
2529
2606
|
applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
|
|
2530
2607
|
}
|
|
2531
2608
|
const nonMonitorFilters = applicableFilters.filter(
|
|
@@ -2546,12 +2623,12 @@ var filtersFilter = (item, index, array) => {
|
|
|
2546
2623
|
var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
|
|
2547
2624
|
return ids.slice(0, cutOffSize).reduce((accu, id) => {
|
|
2548
2625
|
if (id && byId[id]) {
|
|
2549
|
-
accu.push(
|
|
2626
|
+
accu.push({ ...defaultObject, ...byId[id] });
|
|
2550
2627
|
}
|
|
2551
2628
|
return accu;
|
|
2552
2629
|
}, []);
|
|
2553
2630
|
};
|
|
2554
|
-
var mergePermissions = (existingPermissions =
|
|
2631
|
+
var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
|
|
2555
2632
|
(accu, [key, value]) => {
|
|
2556
2633
|
let values;
|
|
2557
2634
|
if (!accu[key]) {
|
|
@@ -2561,12 +2638,12 @@ var mergePermissions = (existingPermissions = __spreadValues({}, emptyUiPermissi
|
|
|
2561
2638
|
if (Array.isArray(value)) {
|
|
2562
2639
|
values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
|
|
2563
2640
|
} else {
|
|
2564
|
-
values = mergePermissions(accu[key],
|
|
2641
|
+
values = mergePermissions(accu[key], { ...value });
|
|
2565
2642
|
}
|
|
2566
2643
|
accu[key] = values;
|
|
2567
2644
|
return accu;
|
|
2568
2645
|
},
|
|
2569
|
-
|
|
2646
|
+
{ ...addedPermissions }
|
|
2570
2647
|
);
|
|
2571
2648
|
var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
2572
2649
|
(accu, roleId) => {
|
|
@@ -2575,20 +2652,17 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
|
|
|
2575
2652
|
}
|
|
2576
2653
|
return mergePermissions(accu, roles[roleId].uiPermissions);
|
|
2577
2654
|
},
|
|
2578
|
-
|
|
2655
|
+
{ ...emptyUiPermissions }
|
|
2579
2656
|
);
|
|
2580
2657
|
var progress = ({ loaded, total }) => {
|
|
2581
2658
|
let uploadProgress4 = loaded / total * 100;
|
|
2582
2659
|
return uploadProgress4 = uploadProgress4 < 50 ? Math.ceil(uploadProgress4) : Math.round(uploadProgress4);
|
|
2583
2660
|
};
|
|
2584
|
-
var extractErrorMessage = (err, fallback = "") =>
|
|
2585
|
-
var _a, _b2, _c, _d, _e;
|
|
2586
|
-
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;
|
|
2587
|
-
};
|
|
2661
|
+
var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
|
|
2588
2662
|
var preformatWithRequestID = (res, failMsg) => {
|
|
2589
2663
|
if (failMsg.length > 100) failMsg = `${failMsg.substring(0, 220)}...`;
|
|
2590
2664
|
try {
|
|
2591
|
-
if (
|
|
2665
|
+
if (res?.data && Object.keys(res.data).includes("request_id")) {
|
|
2592
2666
|
let shortRequestUUID = res.data["request_id"].substring(0, 8);
|
|
2593
2667
|
return `${failMsg} [Request ID: ${shortRequestUUID}]`;
|
|
2594
2668
|
}
|
|
@@ -2603,9 +2677,10 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2603
2677
|
if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2604
2678
|
return accu;
|
|
2605
2679
|
}
|
|
2606
|
-
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] =
|
|
2680
|
+
accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
|
|
2681
|
+
...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
|
|
2607
2682
|
[attribute.name]: attribute.value
|
|
2608
|
-
}
|
|
2683
|
+
};
|
|
2609
2684
|
if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
|
|
2610
2685
|
accu.inventory.device_type = [].concat(attribute.value);
|
|
2611
2686
|
}
|
|
@@ -2624,15 +2699,12 @@ var getReleaseListState = (state) => state.releases.releasesList;
|
|
|
2624
2699
|
var getListedReleases = (state) => state.releases.releasesList.releaseIds;
|
|
2625
2700
|
var getReleaseMappingDefaults = () => ({});
|
|
2626
2701
|
var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
|
|
2627
|
-
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) =>
|
|
2702
|
+
var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
|
|
2628
2703
|
var getHasReleases = (0, import_toolkit13.createSelector)(
|
|
2629
2704
|
[getReleaseListState, getReleasesById],
|
|
2630
2705
|
({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
|
|
2631
2706
|
);
|
|
2632
|
-
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => {
|
|
2633
|
-
var _a;
|
|
2634
|
-
return (_a = byId[id]) != null ? _a : {};
|
|
2635
|
-
});
|
|
2707
|
+
var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
|
|
2636
2708
|
|
|
2637
2709
|
// src/usersSlice/selectors.ts
|
|
2638
2710
|
var import_toolkit14 = require("@reduxjs/toolkit");
|
|
@@ -2641,10 +2713,7 @@ var getTooltipsById = (state) => state.users.tooltips.byId;
|
|
|
2641
2713
|
var getGlobalSettings = (state) => state.users.globalSettings;
|
|
2642
2714
|
var getCurrentUserId = (state) => state.users.currentUser;
|
|
2643
2715
|
var getUsersById = (state) => state.users.byId;
|
|
2644
|
-
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => {
|
|
2645
|
-
var _a;
|
|
2646
|
-
return (_a = usersById[userId]) != null ? _a : {};
|
|
2647
|
-
});
|
|
2716
|
+
var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
|
|
2648
2717
|
var getUserSettings = (state) => state.users.userSettings;
|
|
2649
2718
|
var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
|
|
2650
2719
|
var getShowHelptips = (0, import_toolkit14.createSelector)(
|
|
@@ -2655,22 +2724,22 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
|
|
|
2655
2724
|
[getTooltipsById, getUserSettings],
|
|
2656
2725
|
(byId, { tooltips = {} }) => Object.entries(byId).reduce(
|
|
2657
2726
|
(accu, [id, value]) => {
|
|
2658
|
-
accu[id] =
|
|
2727
|
+
accu[id] = { ...accu[id], ...value };
|
|
2659
2728
|
return accu;
|
|
2660
2729
|
},
|
|
2661
|
-
|
|
2730
|
+
{ ...tooltips }
|
|
2662
2731
|
)
|
|
2663
2732
|
);
|
|
2664
2733
|
var getHas2FA = (0, import_toolkit14.createSelector)(
|
|
2665
2734
|
[getCurrentUser],
|
|
2666
2735
|
(currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
|
|
2667
2736
|
);
|
|
2668
|
-
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute =
|
|
2737
|
+
var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
|
|
2669
2738
|
var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
|
|
2670
|
-
interval:
|
|
2671
|
-
intervalUnit:
|
|
2739
|
+
interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
|
|
2740
|
+
intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
|
|
2672
2741
|
}));
|
|
2673
|
-
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) =>
|
|
2742
|
+
var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
|
|
2674
2743
|
var getCurrentSession = (state) => state.users.currentSession;
|
|
2675
2744
|
|
|
2676
2745
|
// src/commonSelectors.ts
|
|
@@ -2689,8 +2758,7 @@ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
|
|
|
2689
2758
|
var getUserRoles = (0, import_toolkit15.createSelector)(
|
|
2690
2759
|
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
|
|
2691
2760
|
(currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
|
|
2692
|
-
|
|
2693
|
-
const isAdmin = ((_a = currentUser.roles) == null ? void 0 : _a.length) ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2761
|
+
const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
|
|
2694
2762
|
const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
|
|
2695
2763
|
return { isAdmin, uiPermissions };
|
|
2696
2764
|
}
|
|
@@ -2759,10 +2827,11 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2759
2827
|
const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
|
|
2760
2828
|
const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
|
|
2761
2829
|
const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2762
|
-
const updateAttribute =
|
|
2830
|
+
const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
|
|
2763
2831
|
const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
|
|
2764
2832
|
const attributes = [
|
|
2765
|
-
...previousFilters.map((item) =>
|
|
2833
|
+
...previousFilters.map((item) => ({
|
|
2834
|
+
...item,
|
|
2766
2835
|
value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
|
|
2767
2836
|
category: "recently used",
|
|
2768
2837
|
priority: 0
|
|
@@ -2780,14 +2849,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
|
|
|
2780
2849
|
return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
|
|
2781
2850
|
}
|
|
2782
2851
|
);
|
|
2783
|
-
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], (
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
});
|
|
2852
|
+
var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
|
|
2853
|
+
...remainder,
|
|
2854
|
+
...onboarding,
|
|
2855
|
+
complete: onboarding.complete || complete,
|
|
2856
|
+
progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
|
|
2857
|
+
showTips: !onboarding.showTips ? onboarding.showTips : showTips
|
|
2858
|
+
}));
|
|
2791
2859
|
var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
|
|
2792
2860
|
const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
|
|
2793
2861
|
return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
|
|
@@ -2808,12 +2876,11 @@ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
|
|
|
2808
2876
|
var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
|
|
2809
2877
|
[getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
|
|
2810
2878
|
(deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
|
|
2811
|
-
|
|
2812
|
-
const deployment = (_a = deploymentsById[selectedId]) != null ? _a : {};
|
|
2879
|
+
const deployment = deploymentsById[selectedId] ?? {};
|
|
2813
2880
|
const { devices = {} } = deployment;
|
|
2814
2881
|
return {
|
|
2815
2882
|
deployment,
|
|
2816
|
-
selectedDevices: selectedDeviceIds.map((deviceId) =>
|
|
2883
|
+
selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
|
|
2817
2884
|
};
|
|
2818
2885
|
}
|
|
2819
2886
|
);
|
|
@@ -2828,8 +2895,7 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
|
|
|
2828
2895
|
}, {})
|
|
2829
2896
|
);
|
|
2830
2897
|
var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
|
|
2831
|
-
|
|
2832
|
-
const _b2 = groupsById, { [_a = UNGROUPED_GROUP.id]: ungrouped } = _b2, groups = __objRest(_b2, [__restKey(_a)]);
|
|
2898
|
+
const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
|
|
2833
2899
|
if (staticOnly) {
|
|
2834
2900
|
return Object.keys(uiPermissions.groups).sort();
|
|
2835
2901
|
}
|
|
@@ -2863,9 +2929,25 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
|
|
|
2863
2929
|
if (auditlogEvent) {
|
|
2864
2930
|
const { object = {} } = auditlogEvent;
|
|
2865
2931
|
const { device = {}, id, type } = object;
|
|
2866
|
-
auditlogDevice = type === "device" ?
|
|
2932
|
+
auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
|
|
2867
2933
|
}
|
|
2868
|
-
return
|
|
2934
|
+
return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
|
|
2935
|
+
});
|
|
2936
|
+
var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
|
|
2937
|
+
if (service_provider) {
|
|
2938
|
+
return roles.reduce((accu, role) => {
|
|
2939
|
+
if (rolesById[role.id]) {
|
|
2940
|
+
return accu;
|
|
2941
|
+
}
|
|
2942
|
+
accu.push(role);
|
|
2943
|
+
return accu;
|
|
2944
|
+
}, Object.values(serviceProviderRolesById));
|
|
2945
|
+
}
|
|
2946
|
+
return Object.keys(rolesById).reverse().reduce((accu, key) => {
|
|
2947
|
+
const index = accu.findIndex(({ id }) => id === key);
|
|
2948
|
+
accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
|
|
2949
|
+
return accu;
|
|
2950
|
+
}, roles);
|
|
2869
2951
|
});
|
|
2870
2952
|
|
|
2871
2953
|
// src/store.ts
|
|
@@ -2901,8 +2983,9 @@ var sessionReducer = (state, action) => {
|
|
|
2901
2983
|
return rootReducer(state, action);
|
|
2902
2984
|
};
|
|
2903
2985
|
var getConfiguredStore = (options = {}) => {
|
|
2904
|
-
const
|
|
2905
|
-
return (0, import_toolkit16.configureStore)(
|
|
2986
|
+
const { preloadedState = {}, ...config } = options;
|
|
2987
|
+
return (0, import_toolkit16.configureStore)({
|
|
2988
|
+
...config,
|
|
2906
2989
|
preloadedState,
|
|
2907
2990
|
reducer: sessionReducer,
|
|
2908
2991
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -2915,7 +2998,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
2915
2998
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
2916
2999
|
}
|
|
2917
3000
|
})
|
|
2918
|
-
})
|
|
3001
|
+
});
|
|
2919
3002
|
};
|
|
2920
3003
|
var store = getConfiguredStore({
|
|
2921
3004
|
preloadedState: {}
|
|
@@ -2935,17 +3018,16 @@ var dateFunctionMap = {
|
|
|
2935
3018
|
setDays: "setDate"
|
|
2936
3019
|
};
|
|
2937
3020
|
var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
|
|
2938
|
-
var _a, _b2;
|
|
2939
3021
|
const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
|
|
2940
3022
|
const today = /* @__PURE__ */ new Date();
|
|
2941
3023
|
const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
|
|
2942
|
-
const setter =
|
|
2943
|
-
const getter =
|
|
3024
|
+
const setter = dateFunctionMap[`set${intervalName}`] ?? `set${intervalName}`;
|
|
3025
|
+
const getter = dateFunctionMap[`get${intervalName}`] ?? `get${intervalName}`;
|
|
2944
3026
|
today[setter](today[getter]() - interval);
|
|
2945
3027
|
let value;
|
|
2946
3028
|
try {
|
|
2947
3029
|
value = today.toISOString();
|
|
2948
|
-
} catch
|
|
3030
|
+
} catch {
|
|
2949
3031
|
return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
|
|
2950
3032
|
}
|
|
2951
3033
|
return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
|
|
@@ -2986,37 +3068,43 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
|
|
|
2986
3068
|
accu.latestRepos[item.name] = getComparisonCompatibleVersion(item.version);
|
|
2987
3069
|
return accu;
|
|
2988
3070
|
},
|
|
2989
|
-
{ latestVersions:
|
|
3071
|
+
{ latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
|
|
2990
3072
|
);
|
|
2991
3073
|
const info = deductSaasState(latestRelease, guiTags, saas);
|
|
2992
3074
|
return Promise.resolve(
|
|
2993
3075
|
dispatch(
|
|
2994
|
-
actions.setVersionInformation(
|
|
3076
|
+
actions.setVersionInformation({
|
|
3077
|
+
...latestVersions,
|
|
2995
3078
|
backend: info,
|
|
2996
3079
|
GUI: info,
|
|
2997
3080
|
latestRelease: {
|
|
2998
3081
|
releaseDate: latestRelease.release_date,
|
|
2999
3082
|
repos: latestRepos
|
|
3000
3083
|
}
|
|
3001
|
-
})
|
|
3084
|
+
})
|
|
3002
3085
|
)
|
|
3003
3086
|
);
|
|
3004
3087
|
});
|
|
3005
3088
|
});
|
|
3006
3089
|
var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
|
|
3007
3090
|
const currentState = getSearchState(getState());
|
|
3008
|
-
let nextState =
|
|
3009
|
-
|
|
3010
|
-
|
|
3091
|
+
let nextState = {
|
|
3092
|
+
...currentState,
|
|
3093
|
+
...searchState,
|
|
3094
|
+
sort: {
|
|
3095
|
+
...currentState.sort,
|
|
3096
|
+
...searchState.sort
|
|
3097
|
+
}
|
|
3098
|
+
};
|
|
3011
3099
|
let tasks = [];
|
|
3012
|
-
const
|
|
3013
|
-
const
|
|
3100
|
+
const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
|
|
3101
|
+
const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
|
|
3014
3102
|
if (nextRequestState.searchTerm && !(0, import_helpers6.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3015
3103
|
nextState.isSearching = true;
|
|
3016
3104
|
tasks.push(
|
|
3017
3105
|
dispatch(searchDevices(nextState)).unwrap().then((results) => {
|
|
3018
3106
|
const searchResult = results[results.length - 1];
|
|
3019
|
-
return dispatch(actions.setSearchState(
|
|
3107
|
+
return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
|
|
3020
3108
|
}).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
|
|
3021
3109
|
);
|
|
3022
3110
|
}
|
|
@@ -3032,19 +3120,20 @@ var import_toolkit18 = require("@reduxjs/toolkit");
|
|
|
3032
3120
|
var import_axios2 = require("axios");
|
|
3033
3121
|
var import_pluralize = __toESM(require_pluralize());
|
|
3034
3122
|
|
|
3035
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3036
|
-
var
|
|
3037
|
-
var
|
|
3038
|
-
var poolPtr = rnds8Pool.length;
|
|
3123
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
3124
|
+
var getRandomValues;
|
|
3125
|
+
var rnds8 = new Uint8Array(16);
|
|
3039
3126
|
function rng() {
|
|
3040
|
-
if (
|
|
3041
|
-
|
|
3042
|
-
|
|
3127
|
+
if (!getRandomValues) {
|
|
3128
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
3129
|
+
if (!getRandomValues) {
|
|
3130
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
3131
|
+
}
|
|
3043
3132
|
}
|
|
3044
|
-
return
|
|
3133
|
+
return getRandomValues(rnds8);
|
|
3045
3134
|
}
|
|
3046
3135
|
|
|
3047
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3136
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
3048
3137
|
var byteToHex = [];
|
|
3049
3138
|
for (let i = 0; i < 256; ++i) {
|
|
3050
3139
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -3053,13 +3142,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
3053
3142
|
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]];
|
|
3054
3143
|
}
|
|
3055
3144
|
|
|
3056
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3057
|
-
var
|
|
3145
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
3146
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
3058
3147
|
var native_default = {
|
|
3059
|
-
randomUUID
|
|
3148
|
+
randomUUID
|
|
3060
3149
|
};
|
|
3061
3150
|
|
|
3062
|
-
// ../../node_modules/uuid/dist/esm-
|
|
3151
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
3063
3152
|
function v4(options, buf, offset) {
|
|
3064
3153
|
if (native_default.randomUUID && !buf && !options) {
|
|
3065
3154
|
return native_default.randomUUID();
|
|
@@ -3101,14 +3190,13 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3101
3190
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
|
|
3102
3191
|
const state = getGroupsById(getState());
|
|
3103
3192
|
const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3104
|
-
|
|
3105
|
-
if (group.id || ((_a = group.filters) == null ? void 0 : _a.length) && id !== UNGROUPED_GROUP.id) {
|
|
3193
|
+
if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
|
|
3106
3194
|
accu[id] = group;
|
|
3107
3195
|
}
|
|
3108
3196
|
return accu;
|
|
3109
3197
|
}, {});
|
|
3110
3198
|
const groups = res.data.reduce((accu, group) => {
|
|
3111
|
-
accu[group] =
|
|
3199
|
+
accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
|
|
3112
3200
|
return accu;
|
|
3113
3201
|
}, dynamicGroups);
|
|
3114
3202
|
const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
|
|
@@ -3166,7 +3254,7 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3166
3254
|
() => Promise.resolve(
|
|
3167
3255
|
dispatch(
|
|
3168
3256
|
actions3.addGroup({
|
|
3169
|
-
group:
|
|
3257
|
+
group: { deviceIds: [], total: 0, filters: [], ...getState().devices.groups.byId[group] },
|
|
3170
3258
|
groupName: group
|
|
3171
3259
|
})
|
|
3172
3260
|
)
|
|
@@ -3194,20 +3282,19 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3194
3282
|
(_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
|
|
3195
3283
|
const state = getGroupsById(getState());
|
|
3196
3284
|
const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
|
|
3197
|
-
|
|
3198
|
-
if (!(group.id || ((_a = group.filters) == null ? void 0 : _a.length))) {
|
|
3285
|
+
if (!(group.id || group.filters?.length)) {
|
|
3199
3286
|
accu[id] = group;
|
|
3200
3287
|
}
|
|
3201
3288
|
return accu;
|
|
3202
3289
|
}, {});
|
|
3203
3290
|
const groups = (filters || []).reduce((accu, filter) => {
|
|
3204
|
-
accu[filter.name] =
|
|
3291
|
+
accu[filter.name] = {
|
|
3205
3292
|
deviceIds: [],
|
|
3206
|
-
total: 0
|
|
3207
|
-
|
|
3293
|
+
total: 0,
|
|
3294
|
+
...state[filter.name],
|
|
3208
3295
|
id: filter.id,
|
|
3209
3296
|
filters: mapTermsToFilters(filter.terms)
|
|
3210
|
-
}
|
|
3297
|
+
};
|
|
3211
3298
|
return accu;
|
|
3212
3299
|
}, staticGroups);
|
|
3213
3300
|
return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
|
|
@@ -3247,10 +3334,9 @@ var removeDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/r
|
|
|
3247
3334
|
);
|
|
3248
3335
|
});
|
|
3249
3336
|
var getGroupFilters = (group, groupsState, filters = []) => {
|
|
3250
|
-
var _a;
|
|
3251
3337
|
const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
|
|
3252
3338
|
const selectedGroup = groupsState.byId[groupName];
|
|
3253
|
-
const groupFilterLength =
|
|
3339
|
+
const groupFilterLength = selectedGroup?.filters?.length || 0;
|
|
3254
3340
|
const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
|
|
3255
3341
|
return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
|
|
3256
3342
|
};
|
|
@@ -3273,7 +3359,6 @@ var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGr
|
|
|
3273
3359
|
var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
|
|
3274
3360
|
var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
3275
3361
|
(accu, device) => {
|
|
3276
|
-
var _a, _b2, _c;
|
|
3277
3362
|
const stateDevice = getDeviceById(state, device.id);
|
|
3278
3363
|
const {
|
|
3279
3364
|
attributes: storedAttributes = {},
|
|
@@ -3283,29 +3368,29 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
|
|
|
3283
3368
|
group: storedGroup
|
|
3284
3369
|
} = stateDevice;
|
|
3285
3370
|
const { identity, inventory, monitor, system = {}, tags } = mapDeviceAttributes(device.attributes);
|
|
3286
|
-
device.tags =
|
|
3287
|
-
device.group =
|
|
3288
|
-
device.monitor =
|
|
3289
|
-
device.identity_data =
|
|
3371
|
+
device.tags = { ...storedTags, ...tags };
|
|
3372
|
+
device.group = system.group ?? storedGroup;
|
|
3373
|
+
device.monitor = { ...storedMonitor, ...monitor };
|
|
3374
|
+
device.identity_data = { ...storedIdentity, ...identity, ...device.identity_data ? device.identity_data : {} };
|
|
3290
3375
|
device.status = status ? status : device.status || identity.status;
|
|
3291
|
-
device.check_in_time_rounded =
|
|
3292
|
-
device.check_in_time_exact =
|
|
3376
|
+
device.check_in_time_rounded = system.check_in_time ?? stateDevice.check_in_time_rounded;
|
|
3377
|
+
device.check_in_time_exact = device.check_in_time ?? stateDevice.check_in_time_exact;
|
|
3293
3378
|
device.created_ts = getEarliestTs(getEarliestTs(system.created_ts, device.created_ts), stateDevice.created_ts);
|
|
3294
3379
|
device.updated_ts = device.attributes ? device.updated_ts : stateDevice.updated_ts;
|
|
3295
3380
|
device.isNew = new Date(device.created_ts) > new Date(state.app.newThreshold);
|
|
3296
3381
|
device.isOffline = new Date(device.check_in_time_rounded) < new Date(state.app.offlineThreshold) || device.check_in_time_rounded === void 0;
|
|
3297
|
-
device.attributes = device.attributes ?
|
|
3298
|
-
accu.devicesById[device.id] =
|
|
3382
|
+
device.attributes = device.attributes ? { ...storedAttributes, ...inventory } : storedAttributes;
|
|
3383
|
+
accu.devicesById[device.id] = { ...stateDevice, ...device };
|
|
3299
3384
|
accu.ids.push(device.id);
|
|
3300
3385
|
return accu;
|
|
3301
3386
|
},
|
|
3302
3387
|
{ ids, devicesById: {} }
|
|
3303
3388
|
);
|
|
3304
3389
|
var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
|
|
3305
|
-
const
|
|
3390
|
+
const { group, shouldIncludeAllStates, ...remainder } = options;
|
|
3306
3391
|
const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
|
|
3307
3392
|
return Promise.resolve(
|
|
3308
|
-
dispatch(getDevicesByStatus2(
|
|
3393
|
+
dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
|
|
3309
3394
|
).unwrap().then((results) => {
|
|
3310
3395
|
if (!group) {
|
|
3311
3396
|
return Promise.resolve();
|
|
@@ -3319,7 +3404,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
|
|
|
3319
3404
|
dispatch(
|
|
3320
3405
|
actions3.addGroup({
|
|
3321
3406
|
group: {
|
|
3322
|
-
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length >
|
|
3407
|
+
deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
|
|
3323
3408
|
total
|
|
3324
3409
|
},
|
|
3325
3410
|
groupName: group
|
|
@@ -3468,27 +3553,26 @@ var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3468
3553
|
);
|
|
3469
3554
|
var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
|
|
3470
3555
|
`${sliceName3}/setDeviceListState`,
|
|
3471
|
-
(
|
|
3472
|
-
var _b2 = _a, { shouldSelectDevices = true, forceRefresh, fetchAuth = true } = _b2, selectionState = __objRest(_b2, ["shouldSelectDevices", "forceRefresh", "fetchAuth"]);
|
|
3473
|
-
var _c;
|
|
3556
|
+
({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
|
|
3474
3557
|
const currentState = getDeviceListState(getState());
|
|
3475
3558
|
const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
|
|
3476
|
-
let nextState =
|
|
3559
|
+
let nextState = {
|
|
3560
|
+
...currentState,
|
|
3477
3561
|
setOnly: false,
|
|
3478
|
-
refreshTrigger
|
|
3479
|
-
|
|
3480
|
-
sort:
|
|
3481
|
-
}
|
|
3562
|
+
refreshTrigger,
|
|
3563
|
+
...selectionState,
|
|
3564
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
3565
|
+
};
|
|
3482
3566
|
let tasks = [];
|
|
3483
|
-
const
|
|
3484
|
-
const
|
|
3567
|
+
const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
|
|
3568
|
+
const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
|
|
3485
3569
|
if (!nextState.setOnly && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
|
|
3486
|
-
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } =
|
|
3570
|
+
const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
|
|
3487
3571
|
const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
|
|
3488
3572
|
const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
|
|
3489
3573
|
nextState.isLoading = true;
|
|
3490
3574
|
tasks.push(
|
|
3491
|
-
dispatch(getDevicesByStatus2(
|
|
3575
|
+
dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
|
|
3492
3576
|
const { deviceAccu, total } = results[results.length - 1];
|
|
3493
3577
|
const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
|
|
3494
3578
|
return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
|
|
@@ -3513,8 +3597,8 @@ var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/
|
|
|
3513
3597
|
} = options;
|
|
3514
3598
|
const state = getState();
|
|
3515
3599
|
const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
3516
|
-
filters: filterSelection
|
|
3517
|
-
group: group
|
|
3600
|
+
filters: filterSelection ?? getDeviceFilters(state),
|
|
3601
|
+
group: group ?? getSelectedGroup(state),
|
|
3518
3602
|
groups: state.devices.groups,
|
|
3519
3603
|
offlineThreshold: state.app.offlineThreshold,
|
|
3520
3604
|
selectedIssues,
|
|
@@ -3575,7 +3659,7 @@ var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3
|
|
|
3575
3659
|
});
|
|
3576
3660
|
var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
|
|
3577
3661
|
const state = getState();
|
|
3578
|
-
let options =
|
|
3662
|
+
let options = { ...state.app.searchState, ...passedOptions };
|
|
3579
3663
|
const { page = defaultPage, searchTerm, sortOptions = [] } = options;
|
|
3580
3664
|
const { columnSelection = [] } = getUserSettings(state);
|
|
3581
3665
|
const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
|
|
@@ -3710,8 +3794,7 @@ var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
3710
3794
|
({ data: auditLogEntries }) => {
|
|
3711
3795
|
const { start, end } = auditLogEntries.reduce(
|
|
3712
3796
|
(accu, item) => {
|
|
3713
|
-
|
|
3714
|
-
if ((_b2 = (_a = item.meta) == null ? void 0 : _a.session_id) == null ? void 0 : _b2.includes(sessionId)) {
|
|
3797
|
+
if (item.meta?.session_id?.includes(sessionId)) {
|
|
3715
3798
|
accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
|
|
3716
3799
|
accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
|
|
3717
3800
|
}
|
|
@@ -3818,8 +3901,7 @@ var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3818
3901
|
var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
3819
3902
|
`${sliceName3}/getDeviceConfig`,
|
|
3820
3903
|
(deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
|
|
3821
|
-
|
|
3822
|
-
if (((_b2 = (_a = err.response) == null ? void 0 : _a.data) == null ? void 0 : _b2.error.status_code) !== 404) {
|
|
3904
|
+
if (err.response?.data?.error.status_code !== 404) {
|
|
3823
3905
|
return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
|
|
3824
3906
|
}
|
|
3825
3907
|
})
|
|
@@ -3831,15 +3913,14 @@ var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3831
3913
|
var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
|
|
3832
3914
|
`${sliceName3}/applyDeviceConfig`,
|
|
3833
3915
|
({ 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 }) => {
|
|
3834
|
-
var _a;
|
|
3835
3916
|
const device = getDeviceById(getState(), deviceId);
|
|
3836
3917
|
const { canManageUsers } = getUserCapabilities(getState());
|
|
3837
3918
|
let tasks = [
|
|
3838
|
-
dispatch(actions3.receivedDevice(
|
|
3919
|
+
dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
|
|
3839
3920
|
new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
|
|
3840
3921
|
];
|
|
3841
3922
|
if (isDefault && canManageUsers) {
|
|
3842
|
-
const { previous } =
|
|
3923
|
+
const { previous } = getGlobalSettings(getState()).defaultDeviceConfig ?? {};
|
|
3843
3924
|
tasks.push(dispatch(saveGlobalSettings({ defaultDeviceConfig: { current: config, previous } })));
|
|
3844
3925
|
}
|
|
3845
3926
|
return Promise.all(tasks);
|
|
@@ -3855,21 +3936,21 @@ var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3855
3936
|
`${inventoryApiUrl}/devices/${deviceId}/tags`,
|
|
3856
3937
|
Object.entries(tags).map(([name, value]) => ({ name, value })),
|
|
3857
3938
|
{ headers }
|
|
3858
|
-
).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice(
|
|
3939
|
+
).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(setSnackbar2("Device name changed"))]));
|
|
3859
3940
|
})
|
|
3860
3941
|
)
|
|
3861
3942
|
);
|
|
3862
3943
|
var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
|
|
3863
3944
|
let providerResult = {};
|
|
3864
3945
|
return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
|
|
3865
|
-
providerResult =
|
|
3946
|
+
providerResult = { ...data, twinError: "" };
|
|
3866
3947
|
}).catch((err) => {
|
|
3867
3948
|
providerResult = {
|
|
3868
3949
|
twinError: `There was an error getting the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}. ${err}`
|
|
3869
3950
|
};
|
|
3870
3951
|
}).finally(() => {
|
|
3871
3952
|
const device = getDeviceById(getState(), deviceId);
|
|
3872
|
-
Promise.resolve(dispatch(actions3.receivedDevice(
|
|
3953
|
+
Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
|
|
3873
3954
|
});
|
|
3874
3955
|
});
|
|
3875
3956
|
var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
@@ -3885,7 +3966,7 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
|
|
|
3885
3966
|
const { twinsByIntegration = {} } = device;
|
|
3886
3967
|
const { [integration.id]: currentState = {} } = twinsByIntegration;
|
|
3887
3968
|
return Promise.resolve(
|
|
3888
|
-
dispatch(actions3.receivedDevice(
|
|
3969
|
+
dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
|
|
3889
3970
|
);
|
|
3890
3971
|
})
|
|
3891
3972
|
);
|
|
@@ -3906,8 +3987,8 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
3906
3987
|
const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
|
|
3907
3988
|
const { mender_gateway_system_id = "" } = deviceAttributes;
|
|
3908
3989
|
const filters = [
|
|
3909
|
-
|
|
3910
|
-
|
|
3990
|
+
{ ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
|
|
3991
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
3911
3992
|
];
|
|
3912
3993
|
const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
|
|
3913
3994
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -3919,11 +4000,12 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
|
|
|
3919
4000
|
}).catch((err) => commonErrorHandler(err, `There was an error getting system devices device ${id}.`, dispatch, "Please check your connection.")).then(({ data, headers }) => {
|
|
3920
4001
|
const state2 = getState();
|
|
3921
4002
|
const { devicesById, ids } = reduceReceivedDevices(data, [], state2);
|
|
3922
|
-
const device =
|
|
4003
|
+
const device = {
|
|
4004
|
+
...getDeviceById(state2, id),
|
|
3923
4005
|
systemDeviceIds: ids,
|
|
3924
4006
|
systemDeviceTotal: Number(headers[headerNames.total])
|
|
3925
|
-
}
|
|
3926
|
-
return Promise.resolve(dispatch(actions3.receivedDevices(
|
|
4007
|
+
};
|
|
4008
|
+
return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
|
|
3927
4009
|
});
|
|
3928
4010
|
});
|
|
3929
4011
|
var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
|
|
@@ -3931,9 +4013,9 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
|
|
|
3931
4013
|
const { attributes = {} } = getDeviceById(state, deviceId);
|
|
3932
4014
|
const { mender_gateway_system_id = "" } = attributes;
|
|
3933
4015
|
const filters = [
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
4016
|
+
{ ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
|
|
4017
|
+
{ ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
|
|
4018
|
+
{ ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
|
|
3937
4019
|
];
|
|
3938
4020
|
const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({ filters, state });
|
|
3939
4021
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
@@ -3980,7 +4062,7 @@ var { page: defaultPage2, perPage: defaultPerPage2 } = DEVICE_LIST_DEFAULTS;
|
|
|
3980
4062
|
var cutoffLength = 75;
|
|
3981
4063
|
var ellipsis = "...";
|
|
3982
4064
|
var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
|
|
3983
|
-
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) =>
|
|
4065
|
+
var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
|
|
3984
4066
|
var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
|
|
3985
4067
|
const { page = defaultPage2, perPage = defaultPerPage2, issuedBefore, issuedAfter, sortAscending = false } = config;
|
|
3986
4068
|
const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
|
|
@@ -3998,14 +4080,15 @@ var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4
|
|
|
3998
4080
|
});
|
|
3999
4081
|
var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
|
|
4000
4082
|
const state = getState();
|
|
4001
|
-
const
|
|
4002
|
-
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters(
|
|
4083
|
+
const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
|
|
4084
|
+
const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
|
|
4085
|
+
...remainder,
|
|
4003
4086
|
filters,
|
|
4004
4087
|
group,
|
|
4005
4088
|
offlineThreshold: state.app.offlineThreshold,
|
|
4006
4089
|
selectedIssues: [type],
|
|
4007
4090
|
status
|
|
4008
|
-
})
|
|
4091
|
+
});
|
|
4009
4092
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4010
4093
|
page: 1,
|
|
4011
4094
|
per_page: 1,
|
|
@@ -4057,21 +4140,21 @@ var determineProgress = (acceptedDevices, pendingDevices, releases, pastDeployme
|
|
|
4057
4140
|
return steps[progress2];
|
|
4058
4141
|
};
|
|
4059
4142
|
var deductOnboardingState = ({ devicesById, devicesByStatus, onboardingState, pastDeployments, releases, userCapabilities, userId }) => {
|
|
4060
|
-
var _a;
|
|
4061
4143
|
const { canDeploy, canManageDevices, canReadDeployments, canReadDevices, canReadReleases, canUploadReleases } = userCapabilities;
|
|
4062
4144
|
const userCookie = cookies3.get(`${userId}-onboarded`);
|
|
4063
4145
|
const acceptedDevices = devicesByStatus[DEVICE_STATES.accepted].deviceIds;
|
|
4064
4146
|
const pendingDevices = devicesByStatus[DEVICE_STATES.pending].deviceIds;
|
|
4065
|
-
let deviceType =
|
|
4147
|
+
let deviceType = onboardingState.deviceType ?? [];
|
|
4066
4148
|
deviceType = !deviceType.length && acceptedDevices.length && devicesById[acceptedDevices[0]].hasOwnProperty("attributes") ? devicesById[acceptedDevices[0]].attributes.device_type : deviceType;
|
|
4067
4149
|
const progress2 = applyOnboardingFallbacks(onboardingState.progress || determineProgress(acceptedDevices, pendingDevices, releases, pastDeployments));
|
|
4068
|
-
return
|
|
4150
|
+
return {
|
|
4151
|
+
...onboardingState,
|
|
4069
4152
|
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)),
|
|
4070
4153
|
showTips: onboardingState.showTips != null ? onboardingState.showTips : true,
|
|
4071
4154
|
deviceType,
|
|
4072
4155
|
approach: onboardingState.approach || (deviceType.some((type) => type.startsWith("qemu")) ? "virtual" : "physical"),
|
|
4073
4156
|
progress: progress2
|
|
4074
|
-
}
|
|
4157
|
+
};
|
|
4075
4158
|
};
|
|
4076
4159
|
var getOnboardingState2 = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/getOnboardingState`, (_, { dispatch, getState }) => {
|
|
4077
4160
|
const state = getState();
|
|
@@ -4129,7 +4212,7 @@ var advanceOnboarding = (0, import_toolkit20.createAsyncThunk)(`${sliceName5}/ad
|
|
|
4129
4212
|
return;
|
|
4130
4213
|
}
|
|
4131
4214
|
const madeProgress = steps[stepIndex + 1];
|
|
4132
|
-
const state =
|
|
4215
|
+
const state = { ...getOnboardingState(getState()), progress: madeProgress };
|
|
4133
4216
|
state.complete = stepIndex + 1 >= steps.findIndex((step) => step === onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE) ? true : state.complete;
|
|
4134
4217
|
return Promise.all([dispatch(actions5.setOnboardingProgress(madeProgress)), dispatch(saveUserSettings({ onboarding: state }))]);
|
|
4135
4218
|
});
|
|
@@ -4212,8 +4295,8 @@ var completeUpgrade = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4212
4295
|
({ 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())))
|
|
4213
4296
|
);
|
|
4214
4297
|
var prepareAuditlogQuery = ({ startDate, endDate, user: userFilter, type, detail: detailFilter, sort = {} }) => {
|
|
4215
|
-
const userId =
|
|
4216
|
-
const detail =
|
|
4298
|
+
const userId = userFilter?.id || userFilter;
|
|
4299
|
+
const detail = detailFilter?.id || detailFilter;
|
|
4217
4300
|
const createdAfter = startDate ? `&created_after=${Math.round(Date.parse(startDate) / 1e3)}` : "";
|
|
4218
4301
|
const createdBefore = endDate ? `&created_before=${Math.round(Date.parse(endDate) / 1e3)}` : "";
|
|
4219
4302
|
const typeSearch = type ? `&object_type=${type.value}`.toLowerCase() : "";
|
|
@@ -4240,12 +4323,14 @@ var getAuditLogsCsvLink = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4240
4323
|
);
|
|
4241
4324
|
var setAuditlogsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setAuditlogsState`, (selectionState, { dispatch, getState }) => {
|
|
4242
4325
|
const currentState = getAuditlogState(getState());
|
|
4243
|
-
let nextState =
|
|
4244
|
-
|
|
4245
|
-
|
|
4326
|
+
let nextState = {
|
|
4327
|
+
...currentState,
|
|
4328
|
+
...selectionState,
|
|
4329
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4330
|
+
};
|
|
4246
4331
|
let tasks = [];
|
|
4247
|
-
const
|
|
4248
|
-
const
|
|
4332
|
+
const { isLoading: currentLoading, selectedIssue: currentIssue, ...currentRequestState } = currentState;
|
|
4333
|
+
const { isLoading: selectionLoading, selectedIssue: selectionIssue, ...selectionRequestState } = nextState;
|
|
4249
4334
|
if (!(0, import_helpers9.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4250
4335
|
nextState.isLoading = true;
|
|
4251
4336
|
tasks.push(dispatch(getAuditLogs(nextState)).finally(() => dispatch(actions6.setAuditLogState({ isLoading: false }))));
|
|
@@ -4257,27 +4342,30 @@ var tenantDataDivergedMessage = "The system detected there is a change in your p
|
|
|
4257
4342
|
var addTenant = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/createTenant`, (selectionState, { dispatch }) => {
|
|
4258
4343
|
return general_api_default.post(`${tenantadmApiUrlv2}/tenants`, selectionState).then(() => Promise.all([dispatch(getTenants()), dispatch(setSnackbar3("Tenant was created successfully."))])).catch((err) => commonErrorHandler(err, "There was an error creating tenant", dispatch, commonErrorFallback));
|
|
4259
4344
|
});
|
|
4260
|
-
var tenantListRetrieval = (config) =>
|
|
4345
|
+
var tenantListRetrieval = async (config) => {
|
|
4261
4346
|
const { page, perPage } = config;
|
|
4262
4347
|
const params = new URLSearchParams({ page, per_page: perPage }).toString();
|
|
4263
|
-
const tenantList =
|
|
4348
|
+
const tenantList = await general_api_default.get(`${tenantadmApiUrlv2}/tenants?${params}`);
|
|
4264
4349
|
const totalCount = tenantList.headers[headerNames.total] || TENANT_LIST_DEFAULT.perPage;
|
|
4265
|
-
return [tenantList.data, totalCount];
|
|
4266
|
-
}
|
|
4267
|
-
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`,
|
|
4350
|
+
return [tenantList.data, Number(totalCount)];
|
|
4351
|
+
};
|
|
4352
|
+
var getTenants = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/getTenants`, async (_, { dispatch, getState }) => {
|
|
4268
4353
|
const currentState = getTenantsList(getState());
|
|
4269
|
-
const [tenants, pageCount] =
|
|
4270
|
-
dispatch(actions6.setTenantListState(
|
|
4271
|
-
})
|
|
4272
|
-
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`,
|
|
4354
|
+
const [tenants, pageCount] = await tenantListRetrieval(currentState);
|
|
4355
|
+
dispatch(actions6.setTenantListState({ ...currentState, total: pageCount, tenants }));
|
|
4356
|
+
});
|
|
4357
|
+
var setTenantsListState = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/setTenantsListState`, async (selectionState, { dispatch, getState }) => {
|
|
4273
4358
|
const currentState = getTenantsList(getState());
|
|
4274
|
-
const nextState =
|
|
4359
|
+
const nextState = {
|
|
4360
|
+
...currentState,
|
|
4361
|
+
...selectionState
|
|
4362
|
+
};
|
|
4275
4363
|
if (!(0, import_helpers9.deepCompare)(currentState, selectionState)) {
|
|
4276
|
-
const [tenants, pageCount] =
|
|
4277
|
-
return dispatch(actions6.setTenantListState(
|
|
4364
|
+
const [tenants, pageCount] = await tenantListRetrieval(nextState);
|
|
4365
|
+
return dispatch(actions6.setTenantListState({ ...nextState, tenants, total: pageCount }));
|
|
4278
4366
|
}
|
|
4279
|
-
return dispatch(actions6.setTenantListState(
|
|
4280
|
-
})
|
|
4367
|
+
return dispatch(actions6.setTenantListState({ ...nextState }));
|
|
4368
|
+
});
|
|
4281
4369
|
var editTenantDeviceLimit = (0, import_toolkit21.createAsyncThunk)(`${sliceName6}/editDeviceLimit`, ({ newLimit, id, name }, { dispatch }) => {
|
|
4282
4370
|
return general_api_default.put(`${tenantadmApiUrlv2}/tenants/${id}/child`, { device_limit: newLimit, name }).catch((err) => commonErrorHandler(err, `Device Limit cannot be changed`, dispatch)).then(() => {
|
|
4283
4371
|
const tasks = [Promise.resolve(dispatch(setSnackbar3("Device Limit was changed successfully")))];
|
|
@@ -4320,10 +4408,7 @@ var downloadLicenseReport = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4320
4408
|
);
|
|
4321
4409
|
var createIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4322
4410
|
`${sliceName6}/createIntegration`,
|
|
4323
|
-
(
|
|
4324
|
-
var _b2 = _a, { id } = _b2, integration = __objRest(_b2, ["id"]);
|
|
4325
|
-
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(setSnackbar3("The integration was set up successfully")), dispatch(getIntegrations())]));
|
|
4326
|
-
}
|
|
4411
|
+
({ 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(setSnackbar3("The integration was set up successfully")), dispatch(getIntegrations())]))
|
|
4327
4412
|
);
|
|
4328
4413
|
var changeIntegration = (0, import_toolkit21.createAsyncThunk)(
|
|
4329
4414
|
`${sliceName6}/changeIntegration`,
|
|
@@ -4344,9 +4429,8 @@ var getIntegrations = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4344
4429
|
(_, { dispatch, getState }) => general_api_default.get(`${iotManagerBaseURL}/integrations`).catch((err) => commonErrorHandler(err, "There was an error retrieving the integration", dispatch, commonErrorFallback)).then(({ data }) => {
|
|
4345
4430
|
const existingIntegrations = getState().organization.externalDeviceIntegrations;
|
|
4346
4431
|
const integrations = data.reduce((accu, item) => {
|
|
4347
|
-
|
|
4348
|
-
const
|
|
4349
|
-
const integration = __spreadValues(__spreadValues({}, existingIntegration), item);
|
|
4432
|
+
const existingIntegration = existingIntegrations.find((integration2) => item.id === integration2.id) ?? {};
|
|
4433
|
+
const integration = { ...existingIntegration, ...item };
|
|
4350
4434
|
accu.push(integration);
|
|
4351
4435
|
return accu;
|
|
4352
4436
|
}, []);
|
|
@@ -4398,7 +4482,7 @@ var getSsoConfigById = (0, import_toolkit21.createAsyncThunk)(
|
|
|
4398
4482
|
`${sliceName6}/getSsoConfigById`,
|
|
4399
4483
|
(config, { dispatch }) => general_api_default.get(`${ssoIdpApiUrlv1}/${config.id}`).catch((err) => dispatch(ssoConfigActionErrorHandler(err, "read"))).then(({ data, headers }) => {
|
|
4400
4484
|
const sso = Object.values(SSO_TYPES).find(({ contentType }) => contentType === headers["content-type"]);
|
|
4401
|
-
return sso ? Promise.resolve(
|
|
4485
|
+
return sso ? Promise.resolve({ ...config, config: data, type: sso.id }) : Promise.reject("Unsupported SSO config content type.");
|
|
4402
4486
|
})
|
|
4403
4487
|
);
|
|
4404
4488
|
var getSsoConfigs = (0, import_toolkit21.createAsyncThunk)(
|
|
@@ -4417,20 +4501,21 @@ var { setSnackbar: setSnackbar4, initUpload: initUpload2, uploadProgress: upload
|
|
|
4417
4501
|
var { page: defaultPage4, perPage: defaultPerPage4 } = DEVICE_LIST_DEFAULTS;
|
|
4418
4502
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
4419
4503
|
var flattenRelease = (release, stateRelease) => {
|
|
4420
|
-
|
|
4421
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort((0, import_helpers10.customSort)(1, "modified"))) || [];
|
|
4504
|
+
const updatedArtifacts = release.artifacts?.sort((0, import_helpers10.customSort)(1, "modified")) || [];
|
|
4422
4505
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
4423
4506
|
(accu, item) => {
|
|
4424
|
-
var _a2;
|
|
4425
4507
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
4426
|
-
const stateArtifact =
|
|
4508
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
4427
4509
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
4428
|
-
accu.artifacts.push(
|
|
4510
|
+
accu.artifacts.push({
|
|
4511
|
+
...stateArtifact,
|
|
4512
|
+
...item
|
|
4513
|
+
});
|
|
4429
4514
|
return accu;
|
|
4430
4515
|
},
|
|
4431
4516
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
4432
4517
|
);
|
|
4433
|
-
return
|
|
4518
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers10.duplicateFilter), modified };
|
|
4434
4519
|
};
|
|
4435
4520
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
4436
4521
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -4448,17 +4533,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
4448
4533
|
{ release: null, index: -1 }
|
|
4449
4534
|
);
|
|
4450
4535
|
var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
4451
|
-
var _a;
|
|
4452
4536
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
4453
4537
|
if (!release || index === -1) {
|
|
4454
4538
|
return;
|
|
4455
4539
|
}
|
|
4456
4540
|
const releaseArtifacts = [...release.artifacts];
|
|
4457
4541
|
const artifact = releaseArtifacts[index];
|
|
4458
|
-
const { key, name, version } = (
|
|
4542
|
+
const { key, name, version } = (0, import_helpers10.extractSoftwareItem)(artifact.artifact_provides) ?? {};
|
|
4459
4543
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
4460
4544
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
4461
|
-
filters: [
|
|
4545
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
4462
4546
|
});
|
|
4463
4547
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
4464
4548
|
page: 1,
|
|
@@ -4472,10 +4556,11 @@ var getArtifactInstallCount = (0, import_toolkit22.createAsyncThunk)(`${sliceNam
|
|
|
4472
4556
|
}
|
|
4473
4557
|
const installCount = Number(headers[headerNames.total]);
|
|
4474
4558
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
4475
|
-
releaseArtifacts2[index2] =
|
|
4476
|
-
release2 =
|
|
4559
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
4560
|
+
release2 = {
|
|
4561
|
+
...release2,
|
|
4477
4562
|
artifacts: releaseArtifacts2
|
|
4478
|
-
}
|
|
4563
|
+
};
|
|
4479
4564
|
return dispatch(actions7.receiveRelease(release2));
|
|
4480
4565
|
});
|
|
4481
4566
|
});
|
|
@@ -4487,12 +4572,14 @@ var getArtifactUrl = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4487
4572
|
return dispatch(getReleases());
|
|
4488
4573
|
}
|
|
4489
4574
|
const releaseArtifacts = [...release.artifacts];
|
|
4490
|
-
releaseArtifacts[index] =
|
|
4575
|
+
releaseArtifacts[index] = {
|
|
4576
|
+
...releaseArtifacts[index],
|
|
4491
4577
|
url: response.data.uri
|
|
4492
|
-
}
|
|
4493
|
-
release =
|
|
4578
|
+
};
|
|
4579
|
+
release = {
|
|
4580
|
+
...release,
|
|
4494
4581
|
artifacts: releaseArtifacts
|
|
4495
|
-
}
|
|
4582
|
+
};
|
|
4496
4583
|
return dispatch(actions7.receiveRelease(release));
|
|
4497
4584
|
})
|
|
4498
4585
|
);
|
|
@@ -4617,12 +4704,14 @@ var selectRelease = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/select
|
|
|
4617
4704
|
});
|
|
4618
4705
|
var setReleasesListState = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
4619
4706
|
const currentState = getState().releases.releasesList;
|
|
4620
|
-
let nextState =
|
|
4621
|
-
|
|
4622
|
-
|
|
4707
|
+
let nextState = {
|
|
4708
|
+
...currentState,
|
|
4709
|
+
...selectionState,
|
|
4710
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
4711
|
+
};
|
|
4623
4712
|
let tasks = [];
|
|
4624
|
-
const
|
|
4625
|
-
const
|
|
4713
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
4714
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
4626
4715
|
if (!(0, import_helpers10.deepCompare)(currentRequestState, selectionRequestState)) {
|
|
4627
4716
|
nextState.isLoading = true;
|
|
4628
4717
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -4641,29 +4730,30 @@ var releaseListRetrieval = (config) => {
|
|
|
4641
4730
|
);
|
|
4642
4731
|
};
|
|
4643
4732
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
4644
|
-
let releaseListState =
|
|
4733
|
+
let releaseListState = { ...state.releasesList };
|
|
4645
4734
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
4646
4735
|
const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers10.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
4647
4736
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
4648
4737
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
4649
4738
|
if (searchOnly) {
|
|
4650
|
-
releaseListState =
|
|
4739
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
4651
4740
|
} else {
|
|
4652
|
-
releaseListState =
|
|
4741
|
+
releaseListState = {
|
|
4742
|
+
...releaseListState,
|
|
4653
4743
|
releaseIds,
|
|
4654
4744
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
4655
4745
|
total: !isFiltering ? total : state.releasesList.total
|
|
4656
|
-
}
|
|
4746
|
+
};
|
|
4657
4747
|
}
|
|
4658
4748
|
return releaseListState;
|
|
4659
4749
|
};
|
|
4660
4750
|
var getReleases = (0, import_toolkit22.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
4661
|
-
const config =
|
|
4751
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
4662
4752
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
4663
4753
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
4664
4754
|
const state = getState().releases;
|
|
4665
4755
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
4666
|
-
const combinedReleases =
|
|
4756
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
4667
4757
|
let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
|
|
4668
4758
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
4669
4759
|
tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
|
|
@@ -4684,7 +4774,7 @@ var updateReleaseInfo = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4684
4774
|
`${sliceName7}/updateReleaseInfo`,
|
|
4685
4775
|
({ 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(() => {
|
|
4686
4776
|
return Promise.all([
|
|
4687
|
-
dispatch(actions7.receiveRelease(
|
|
4777
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
4688
4778
|
dispatch(setSnackbar4("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4689
4779
|
]);
|
|
4690
4780
|
})
|
|
@@ -4693,7 +4783,7 @@ var setReleaseTags = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4693
4783
|
`${sliceName7}/setReleaseTags`,
|
|
4694
4784
|
({ 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(() => {
|
|
4695
4785
|
return Promise.all([
|
|
4696
|
-
dispatch(actions7.receiveRelease(
|
|
4786
|
+
dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
4697
4787
|
dispatch(setSnackbar4("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
4698
4788
|
]);
|
|
4699
4789
|
})
|
|
@@ -4710,19 +4800,13 @@ var getUpdateTypes = (0, import_toolkit22.createAsyncThunk)(
|
|
|
4710
4800
|
// src/api/users-api.ts
|
|
4711
4801
|
var import_axios4 = __toESM(require("axios"));
|
|
4712
4802
|
var Api2 = {
|
|
4713
|
-
postLogin: (url,
|
|
4714
|
-
var _b2 = _a, { email: username, password } = _b2, body = __objRest(_b2, ["email", "password"]);
|
|
4715
|
-
return import_axios4.default.post(url, body, __spreadProps(__spreadValues({}, commonRequestConfig), { auth: { username, password } })).then((res) => {
|
|
4716
|
-
var _a2;
|
|
4717
|
-
return { text: res.data, code: res.status, contentType: (_a2 = res.headers) == null ? void 0 : _a2["content-type"] };
|
|
4718
|
-
});
|
|
4719
|
-
},
|
|
4803
|
+
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"] })),
|
|
4720
4804
|
putVerifyTFA: (url, userData) => {
|
|
4721
4805
|
let body = {};
|
|
4722
4806
|
if (userData.hasOwnProperty("token2fa")) {
|
|
4723
4807
|
body = { token2fa: userData.token2fa };
|
|
4724
4808
|
}
|
|
4725
|
-
return import_axios4.default.put(url, body,
|
|
4809
|
+
return import_axios4.default.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });
|
|
4726
4810
|
}
|
|
4727
4811
|
};
|
|
4728
4812
|
var users_api_default = Api2;
|
|
@@ -4750,43 +4834,40 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
|
|
|
4750
4834
|
};
|
|
4751
4835
|
var loginUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4752
4836
|
`${sliceName8}/loginUser`,
|
|
4753
|
-
(
|
|
4754
|
-
|
|
4755
|
-
return
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
Promise.
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
window.
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
);
|
|
4788
|
-
});
|
|
4789
|
-
}
|
|
4837
|
+
({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
|
|
4838
|
+
cleanUp();
|
|
4839
|
+
return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
|
|
4840
|
+
}).then(({ text: response, contentType }) => {
|
|
4841
|
+
if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
|
|
4842
|
+
const { id, kind } = response;
|
|
4843
|
+
const type = kind.split("/")[1];
|
|
4844
|
+
const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
|
|
4845
|
+
window.location.replace(ssoLoginUrl);
|
|
4846
|
+
return;
|
|
4847
|
+
}
|
|
4848
|
+
const token = response;
|
|
4849
|
+
if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
|
|
4850
|
+
return;
|
|
4851
|
+
}
|
|
4852
|
+
let now = /* @__PURE__ */ new Date();
|
|
4853
|
+
now.setSeconds(now.getSeconds() + maxSessionAge);
|
|
4854
|
+
const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
|
|
4855
|
+
setSessionInfo({ token, expiresAt });
|
|
4856
|
+
cookies5.remove("JWT", { path: "/" });
|
|
4857
|
+
return (
|
|
4858
|
+
// @ts-ignore
|
|
4859
|
+
Promise.resolve(dispatch(getUser(OWN_USER_ID))).unwrap().catch((e) => {
|
|
4860
|
+
cleanUp();
|
|
4861
|
+
return Promise.reject(dispatch(setSnackbar5(extractErrorMessage(e))));
|
|
4862
|
+
}).then(() => {
|
|
4863
|
+
window.sessionStorage.removeItem("pendings-redirect");
|
|
4864
|
+
if (window.location.pathname !== "/ui/") {
|
|
4865
|
+
window.location.replace("/ui/");
|
|
4866
|
+
}
|
|
4867
|
+
return Promise.resolve(dispatch(actions8.successfullyLoggedIn({ expiresAt, token })));
|
|
4868
|
+
})
|
|
4869
|
+
);
|
|
4870
|
+
})
|
|
4790
4871
|
);
|
|
4791
4872
|
var logoutUser = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
|
|
4792
4873
|
if (Object.keys(getState().app.uploadsById).length) {
|
|
@@ -4803,7 +4884,7 @@ var switchUserOrganization = (0, import_toolkit23.createAsyncThunk)(`${sliceName
|
|
|
4803
4884
|
return Promise.reject();
|
|
4804
4885
|
}
|
|
4805
4886
|
return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
|
|
4806
|
-
setSessionInfo(
|
|
4887
|
+
setSessionInfo({ ...getSessionInfo(), token });
|
|
4807
4888
|
window.location.reload();
|
|
4808
4889
|
});
|
|
4809
4890
|
});
|
|
@@ -4866,13 +4947,13 @@ var getUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4866
4947
|
);
|
|
4867
4948
|
var initializeSelf = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
|
|
4868
4949
|
var updateUserColumnSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
|
|
4869
|
-
const userId = currentUserId
|
|
4950
|
+
const userId = currentUserId ?? getCurrentUser(getState()).id;
|
|
4870
4951
|
const storageKey = `${userId}-column-widths`;
|
|
4871
4952
|
let customColumns = [];
|
|
4872
4953
|
if (!columns) {
|
|
4873
4954
|
try {
|
|
4874
4955
|
customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
|
|
4875
|
-
} catch
|
|
4956
|
+
} catch {
|
|
4876
4957
|
}
|
|
4877
4958
|
} else {
|
|
4878
4959
|
customColumns = columns;
|
|
@@ -4901,10 +4982,7 @@ var userActions = {
|
|
|
4901
4982
|
var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
|
|
4902
4983
|
var createUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4903
4984
|
`${sliceName8}/createUser`,
|
|
4904
|
-
(
|
|
4905
|
-
var _b2 = _a, { shouldResetPassword } = _b2, userData = __objRest(_b2, ["shouldResetPassword"]);
|
|
4906
|
-
return general_api_default.post(`${useradmApiUrlv1}/users`, __spreadProps(__spreadValues({}, userData), { send_reset_password: shouldResetPassword })).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch));
|
|
4907
|
-
}
|
|
4985
|
+
({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar5(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
|
|
4908
4986
|
);
|
|
4909
4987
|
var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4910
4988
|
`${sliceName8}/removeUser`,
|
|
@@ -4915,15 +4993,12 @@ var removeUser = (0, import_toolkit23.createAsyncThunk)(
|
|
|
4915
4993
|
);
|
|
4916
4994
|
var editUser = (0, import_toolkit23.createAsyncThunk)(
|
|
4917
4995
|
`${sliceName8}/editUser`,
|
|
4918
|
-
(
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
()
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
])
|
|
4925
|
-
);
|
|
4926
|
-
}
|
|
4996
|
+
({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
|
|
4997
|
+
() => Promise.all([
|
|
4998
|
+
dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
|
|
4999
|
+
dispatch(setSnackbar5(userActions.edit.successMessage))
|
|
5000
|
+
])
|
|
5001
|
+
)
|
|
4927
5002
|
);
|
|
4928
5003
|
var addUserToCurrentTenant = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
|
|
4929
5004
|
const { id } = getOrganization(getState());
|
|
@@ -4958,7 +5033,7 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
|
|
|
4958
5033
|
}
|
|
4959
5034
|
return accu;
|
|
4960
5035
|
},
|
|
4961
|
-
|
|
5036
|
+
{ ...emptyUiPermissions }
|
|
4962
5037
|
);
|
|
4963
5038
|
var permissionActionTypes = {
|
|
4964
5039
|
any: mapHttpPermission,
|
|
@@ -4981,20 +5056,21 @@ var combinePermissions = (existingPermissions, additionalPermissions = {}) => Ob
|
|
|
4981
5056
|
}, existingPermissions);
|
|
4982
5057
|
var tryParseCustomPermission = (permission) => {
|
|
4983
5058
|
const uiPermissions = permissionActionTypes[permission.action](permission.object);
|
|
4984
|
-
const result = mergePermissions(
|
|
5059
|
+
const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
|
|
4985
5060
|
return { isCustom: true, permission, result };
|
|
4986
5061
|
};
|
|
4987
5062
|
var customPermissionHandler = (accu, permission) => {
|
|
4988
5063
|
let processor = tryParseCustomPermission(permission);
|
|
4989
|
-
return
|
|
5064
|
+
return {
|
|
5065
|
+
...accu,
|
|
4990
5066
|
isCustom: accu.isCustom || processor.isCustom,
|
|
4991
5067
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
4992
|
-
}
|
|
5068
|
+
};
|
|
4993
5069
|
};
|
|
4994
5070
|
var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
|
|
4995
5071
|
const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
|
|
4996
5072
|
const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
|
|
4997
|
-
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) =>
|
|
5073
|
+
return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
|
|
4998
5074
|
};
|
|
4999
5075
|
var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).reduce((accu, permissions) => {
|
|
5000
5076
|
if (Array.isArray(permissions)) {
|
|
@@ -5009,60 +5085,59 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
|
|
|
5009
5085
|
if (!processor) {
|
|
5010
5086
|
return accu;
|
|
5011
5087
|
}
|
|
5012
|
-
const scope = Object.keys(scopedPermissionAreas).find((scope2) =>
|
|
5013
|
-
var _a;
|
|
5014
|
-
return uiPermissionsByArea[scope2].scope === ((_a = permissionSet.scope) == null ? void 0 : _a.type);
|
|
5015
|
-
});
|
|
5088
|
+
const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
|
|
5016
5089
|
if (scope) {
|
|
5017
5090
|
const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
|
|
5018
|
-
return
|
|
5091
|
+
return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
|
|
5019
5092
|
} else if (isEmptyPermissionSet(processor.result)) {
|
|
5020
5093
|
return processor.permissions.reduce(customPermissionHandler, accu);
|
|
5021
5094
|
}
|
|
5022
|
-
return
|
|
5095
|
+
return {
|
|
5096
|
+
...accu,
|
|
5023
5097
|
isCustom: accu.isCustom || processor.isCustom,
|
|
5024
5098
|
uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
|
|
5025
|
-
}
|
|
5099
|
+
};
|
|
5026
5100
|
},
|
|
5027
|
-
{ isCustom: false, uiPermissions:
|
|
5101
|
+
{ isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
|
|
5028
5102
|
);
|
|
5029
5103
|
return permissions.reduce(customPermissionHandler, preliminaryResult);
|
|
5030
5104
|
};
|
|
5031
5105
|
var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
|
|
5032
5106
|
(accu, role) => {
|
|
5033
|
-
var _a;
|
|
5034
5107
|
let normalizedPermissions;
|
|
5035
5108
|
let isCustom = false;
|
|
5036
5109
|
if (rolesById2[role.name]) {
|
|
5037
|
-
normalizedPermissions =
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5110
|
+
normalizedPermissions = {
|
|
5111
|
+
...rolesById2[role.name].uiPermissions,
|
|
5112
|
+
groups: { ...rolesById2[role.name].uiPermissions.groups },
|
|
5113
|
+
releases: { ...rolesById2[role.name].uiPermissions.releases }
|
|
5114
|
+
};
|
|
5041
5115
|
} else {
|
|
5042
5116
|
const result = parseRolePermissions(role, permissionSets);
|
|
5043
5117
|
normalizedPermissions = result.uiPermissions;
|
|
5044
5118
|
isCustom = result.isCustom;
|
|
5045
5119
|
}
|
|
5046
|
-
const roleState =
|
|
5047
|
-
accu[role.name] =
|
|
5120
|
+
const roleState = accu[role.name] ?? { ...emptyRole };
|
|
5121
|
+
accu[role.name] = {
|
|
5122
|
+
...roleState,
|
|
5123
|
+
...role,
|
|
5048
5124
|
description: roleState.description ? roleState.description : role.description,
|
|
5049
5125
|
editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
|
|
5050
5126
|
isCustom,
|
|
5051
5127
|
name: roleState.name ? roleState.name : role.name,
|
|
5052
5128
|
uiPermissions: normalizedPermissions
|
|
5053
|
-
}
|
|
5129
|
+
};
|
|
5054
5130
|
return accu;
|
|
5055
5131
|
},
|
|
5056
|
-
|
|
5132
|
+
{ ...rolesById2 }
|
|
5057
5133
|
);
|
|
5058
5134
|
var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
5059
5135
|
`${sliceName8}/getPermissionSets`,
|
|
5060
5136
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
|
|
5061
5137
|
const permissionSets = data.reduce(
|
|
5062
5138
|
(accu, permissionSet) => {
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
let permissionSetObject = __spreadValues(__spreadValues({}, permissionSetState), permissionSet);
|
|
5139
|
+
const permissionSetState = accu[permissionSet.name] ?? {};
|
|
5140
|
+
let permissionSetObject = { ...permissionSetState, ...permissionSet };
|
|
5066
5141
|
permissionSetObject.result = Object.values(uiPermissionsById).reduce(
|
|
5067
5142
|
(accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
|
|
5068
5143
|
if (scopedPermissionAreas[area]) {
|
|
@@ -5073,11 +5148,10 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5073
5148
|
}
|
|
5074
5149
|
return collector;
|
|
5075
5150
|
}, accu2),
|
|
5076
|
-
|
|
5151
|
+
{ ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
|
|
5077
5152
|
);
|
|
5078
5153
|
const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
|
|
5079
|
-
|
|
5080
|
-
if (((_a2 = permissionSetObject.supported_scope_types) == null ? void 0 : _a2.includes(key)) || ((_b3 = permissionSetObject.supported_scope_types) == null ? void 0 : _b3.includes(scopeType))) {
|
|
5154
|
+
if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
|
|
5081
5155
|
accu2.push(key);
|
|
5082
5156
|
}
|
|
5083
5157
|
return accu2;
|
|
@@ -5090,7 +5164,7 @@ var getPermissionSets = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5090
5164
|
return accu;
|
|
5091
5165
|
},
|
|
5092
5166
|
// @ts-ignore
|
|
5093
|
-
|
|
5167
|
+
{ ...getState().users.permissionSetsById }
|
|
5094
5168
|
);
|
|
5095
5169
|
return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
|
|
5096
5170
|
}).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
|
|
@@ -5123,28 +5197,27 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
|
|
|
5123
5197
|
const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
|
|
5124
5198
|
const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
|
|
5125
5199
|
accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
|
|
5126
|
-
|
|
5127
|
-
const permissionSetState = (_a = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]]) != null ? _a : {
|
|
5200
|
+
const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
|
|
5128
5201
|
type: uiPermissionsByArea[area].scope,
|
|
5129
5202
|
value: []
|
|
5130
5203
|
};
|
|
5131
|
-
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] =
|
|
5204
|
+
itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
|
|
5205
|
+
...permissionSetState,
|
|
5132
5206
|
value: [...permissionSetState.value, item]
|
|
5133
|
-
}
|
|
5207
|
+
};
|
|
5134
5208
|
return itemPermissionAccu;
|
|
5135
5209
|
}, accu);
|
|
5136
5210
|
return accu;
|
|
5137
5211
|
}, {});
|
|
5138
|
-
return Object.entries(permissionSetObject).map((
|
|
5139
|
-
var [name, _b2] = _a, _c = _b2, { value } = _c, scope = __objRest(_c, ["value"]);
|
|
5212
|
+
return Object.entries(permissionSetObject).map(([name, { value, ...scope }]) => {
|
|
5140
5213
|
if (value.includes(excessiveAccessSelector)) {
|
|
5141
5214
|
return { name };
|
|
5142
5215
|
}
|
|
5143
|
-
return { name, scope:
|
|
5216
|
+
return { name, scope: { ...scope, value: value.filter(import_helpers11.duplicateFilter) } };
|
|
5144
5217
|
});
|
|
5145
5218
|
};
|
|
5146
5219
|
var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
5147
|
-
const role =
|
|
5220
|
+
const role = { ...roleState, ...roleData };
|
|
5148
5221
|
const { description = "", name, uiPermissions = emptyUiPermissions } = role;
|
|
5149
5222
|
const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
|
|
5150
5223
|
(accu, [key, emptyPermissions]) => {
|
|
@@ -5180,12 +5253,17 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
|
|
|
5180
5253
|
}, []);
|
|
5181
5254
|
return {
|
|
5182
5255
|
permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
|
|
5183
|
-
role:
|
|
5256
|
+
role: {
|
|
5257
|
+
...emptyRole,
|
|
5184
5258
|
name,
|
|
5185
5259
|
// @ts-ignore
|
|
5186
5260
|
description: description ? description : roleState.description,
|
|
5187
|
-
uiPermissions:
|
|
5188
|
-
|
|
5261
|
+
uiPermissions: {
|
|
5262
|
+
...emptyUiPermissions,
|
|
5263
|
+
...roleUiPermissions,
|
|
5264
|
+
...maybeUiPermissions
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5189
5267
|
};
|
|
5190
5268
|
};
|
|
5191
5269
|
var roleActions = {
|
|
@@ -5236,13 +5314,12 @@ var getGlobalSettings2 = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5236
5314
|
var saveGlobalSettings = (0, import_toolkit23.createAsyncThunk)(
|
|
5237
5315
|
`${sliceName8}/saveGlobalSettings`,
|
|
5238
5316
|
// @ts-ignore
|
|
5239
|
-
(
|
|
5240
|
-
var _b2 = _a, { beOptimistic = false, notify = false } = _b2, settings = __objRest(_b2, ["beOptimistic", "notify"]);
|
|
5317
|
+
({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
|
|
5241
5318
|
if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
|
|
5242
5319
|
return;
|
|
5243
5320
|
}
|
|
5244
5321
|
return dispatch(getGlobalSettings2()).unwrap().then((result) => {
|
|
5245
|
-
let updatedSettings =
|
|
5322
|
+
let updatedSettings = { ...getState().users.globalSettings, ...settings };
|
|
5246
5323
|
if (getCurrentUser(getState()).verified) {
|
|
5247
5324
|
updatedSettings["2fa"] = twoFAStates.enabled;
|
|
5248
5325
|
} else {
|
|
@@ -5280,10 +5357,17 @@ var saveUserSettings = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/sav
|
|
|
5280
5357
|
const userSettings = getUserSettings(getState());
|
|
5281
5358
|
const onboardingState = getOnboardingState(getState());
|
|
5282
5359
|
const tooltipState = getTooltipsState(getState());
|
|
5283
|
-
const updatedSettings =
|
|
5284
|
-
|
|
5360
|
+
const updatedSettings = {
|
|
5361
|
+
...userSettings,
|
|
5362
|
+
// @ts-ignore
|
|
5363
|
+
...settings,
|
|
5364
|
+
onboarding: {
|
|
5365
|
+
...onboardingState,
|
|
5366
|
+
// @ts-ignore
|
|
5367
|
+
...settings.onboarding
|
|
5368
|
+
},
|
|
5285
5369
|
tooltips: tooltipState
|
|
5286
|
-
}
|
|
5370
|
+
};
|
|
5287
5371
|
const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
|
|
5288
5372
|
return Promise.all([
|
|
5289
5373
|
Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
|
|
@@ -5309,9 +5393,10 @@ var getTokens = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5309
5393
|
`${sliceName8}/getTokens`,
|
|
5310
5394
|
(_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
|
|
5311
5395
|
const user = getCurrentUser(getState());
|
|
5312
|
-
const updatedUser =
|
|
5396
|
+
const updatedUser = {
|
|
5397
|
+
...user,
|
|
5313
5398
|
tokens
|
|
5314
|
-
}
|
|
5399
|
+
};
|
|
5315
5400
|
return Promise.resolve(dispatch(actions8.updatedUser(updatedUser)));
|
|
5316
5401
|
})
|
|
5317
5402
|
);
|
|
@@ -5327,8 +5412,7 @@ var revokeToken = (0, import_toolkit23.createAsyncThunk)(
|
|
|
5327
5412
|
general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
|
|
5328
5413
|
)
|
|
5329
5414
|
);
|
|
5330
|
-
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, (
|
|
5331
|
-
var _b2 = _a, { persist } = _b2, remainder = __objRest(_b2, ["persist"]);
|
|
5415
|
+
var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
|
|
5332
5416
|
let tasks = [dispatch(actions8.setTooltipState(remainder))];
|
|
5333
5417
|
if (persist) {
|
|
5334
5418
|
tasks.push(dispatch(saveUserSettings()));
|
|
@@ -5336,14 +5420,13 @@ var setTooltipReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/
|
|
|
5336
5420
|
return Promise.all(tasks);
|
|
5337
5421
|
});
|
|
5338
5422
|
var setAllTooltipsReadState = (0, import_toolkit23.createAsyncThunk)(`${sliceName8}/toggleHelptips`, ({ readState = READ_STATES.read, tooltips }, { dispatch }) => {
|
|
5339
|
-
const updatedTips = tooltips.reduce((accu, id) =>
|
|
5423
|
+
const updatedTips = tooltips.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
|
|
5340
5424
|
return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
|
|
5341
5425
|
});
|
|
5342
5426
|
var submitFeedback = (0, import_toolkit23.createAsyncThunk)(
|
|
5343
5427
|
`${sliceName8}/submitFeedback`,
|
|
5344
5428
|
// @ts-ignore
|
|
5345
|
-
(
|
|
5346
|
-
var _b2 = _a, { satisfaction, feedback } = _b2, meta = __objRest(_b2, ["satisfaction", "feedback"]);
|
|
5429
|
+
({ satisfaction, feedback, ...meta }, { dispatch }) => {
|
|
5347
5430
|
return general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
|
|
5348
5431
|
subject: "feedback submission",
|
|
5349
5432
|
body: JSON.stringify({ feedback, satisfaction, meta })
|
|
@@ -5364,13 +5447,15 @@ var { page: defaultPage5, perPage: defaultPerPage5 } = DEVICE_LIST_DEFAULTS;
|
|
|
5364
5447
|
var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter.name;
|
|
5365
5448
|
var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers12.startTimeSort).reduce(
|
|
5366
5449
|
(accu, item) => {
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5450
|
+
const filter = item.filter ?? {};
|
|
5451
|
+
let deployment = {
|
|
5452
|
+
...deploymentPrototype,
|
|
5453
|
+
...deploymentsById[item.id],
|
|
5454
|
+
...item,
|
|
5455
|
+
filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
|
|
5371
5456
|
name: decodeURIComponent(item.name)
|
|
5372
|
-
}
|
|
5373
|
-
deployment =
|
|
5457
|
+
};
|
|
5458
|
+
deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
|
|
5374
5459
|
accu.deployments[item.id] = deployment;
|
|
5375
5460
|
accu.deploymentIds.push(item.id);
|
|
5376
5461
|
return accu;
|
|
@@ -5424,11 +5509,12 @@ var createDeployment = (0, import_toolkit24.createAsyncThunk)(`${sliceName2}/cre
|
|
|
5424
5509
|
return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
|
|
5425
5510
|
const lastslashindex = data.headers.location.lastIndexOf("/");
|
|
5426
5511
|
const deploymentId = data.headers.location.substring(lastslashindex + 1);
|
|
5427
|
-
const deployment =
|
|
5512
|
+
const deployment = {
|
|
5513
|
+
...newDeployment,
|
|
5428
5514
|
id: deploymentId,
|
|
5429
5515
|
devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
|
|
5430
5516
|
statistics: { status: {} }
|
|
5431
|
-
}
|
|
5517
|
+
};
|
|
5432
5518
|
let tasks = [
|
|
5433
5519
|
dispatch(actions2.createdDeployment(deployment)),
|
|
5434
5520
|
dispatch(getSingleDeployment(deploymentId)),
|
|
@@ -5571,14 +5657,23 @@ var updateDeploymentControlMap = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5571
5657
|
({ 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))))
|
|
5572
5658
|
);
|
|
5573
5659
|
var setDeploymentsState = (0, import_toolkit24.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
|
|
5574
|
-
const
|
|
5660
|
+
const { page, perPage, ...selectionState } = selection;
|
|
5575
5661
|
const currentState = getState().deployments.selectionState;
|
|
5576
|
-
let nextState =
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5662
|
+
let nextState = {
|
|
5663
|
+
...currentState,
|
|
5664
|
+
...selectionState,
|
|
5665
|
+
...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
|
|
5666
|
+
accu[item] = {
|
|
5667
|
+
...currentState[item],
|
|
5668
|
+
...selectionState[item]
|
|
5669
|
+
};
|
|
5670
|
+
return accu;
|
|
5671
|
+
}, {}),
|
|
5672
|
+
general: {
|
|
5673
|
+
...currentState.general,
|
|
5674
|
+
...selectionState.general
|
|
5675
|
+
}
|
|
5676
|
+
};
|
|
5582
5677
|
let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
|
|
5583
5678
|
if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
|
|
5584
5679
|
tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
|
|
@@ -5608,15 +5703,20 @@ var getDeploymentsConfig = (0, import_toolkit24.createAsyncThunk)(
|
|
|
5608
5703
|
const { binary_delta = {}, binary_delta_limits = {} } = delta;
|
|
5609
5704
|
const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
|
|
5610
5705
|
const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
|
|
5611
|
-
const config =
|
|
5706
|
+
const config = {
|
|
5707
|
+
...oldConfig,
|
|
5612
5708
|
hasDelta: Boolean(delta.enabled),
|
|
5613
|
-
binaryDelta:
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5709
|
+
binaryDelta: {
|
|
5710
|
+
...oldConfig.binaryDelta,
|
|
5711
|
+
timeout: timeoutConfig,
|
|
5712
|
+
...mapExternalDeltaConfig(xdelta_args)
|
|
5713
|
+
},
|
|
5714
|
+
binaryDeltaLimits: {
|
|
5715
|
+
...oldConfig.binaryDeltaLimits,
|
|
5716
|
+
timeout: timeoutLimit,
|
|
5717
|
+
...mapExternalDeltaConfig(xdelta_args_limits)
|
|
5718
|
+
}
|
|
5719
|
+
};
|
|
5620
5720
|
return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
|
|
5621
5721
|
})
|
|
5622
5722
|
);
|
|
@@ -5626,7 +5726,7 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
|
|
|
5626
5726
|
if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers12.isEmpty)(cleanedValue)) {
|
|
5627
5727
|
return accu;
|
|
5628
5728
|
}
|
|
5629
|
-
accu =
|
|
5729
|
+
accu = { ...accu ?? {}, [key]: cleanedValue };
|
|
5630
5730
|
}
|
|
5631
5731
|
return accu;
|
|
5632
5732
|
}, void 0);
|
|
@@ -5646,26 +5746,14 @@ var saveDeltaDeploymentsConfig = (0, import_toolkit24.createAsyncThunk)(`${slice
|
|
|
5646
5746
|
}
|
|
5647
5747
|
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(() => {
|
|
5648
5748
|
const oldConfig = getState().deployments.config;
|
|
5649
|
-
const newConfig =
|
|
5650
|
-
|
|
5651
|
-
|
|
5749
|
+
const newConfig = {
|
|
5750
|
+
...oldConfig,
|
|
5751
|
+
binaryDelta: {
|
|
5752
|
+
...oldConfig.binaryDelta,
|
|
5753
|
+
...config
|
|
5754
|
+
}
|
|
5755
|
+
};
|
|
5652
5756
|
return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar6("Settings saved successfully"))]);
|
|
5653
5757
|
});
|
|
5654
5758
|
});
|
|
5655
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
5656
|
-
0 && (module.exports = {
|
|
5657
|
-
abortDeployment,
|
|
5658
|
-
createDeployment,
|
|
5659
|
-
deriveDeploymentGroup,
|
|
5660
|
-
getDeploymentDevices,
|
|
5661
|
-
getDeploymentsByStatus,
|
|
5662
|
-
getDeploymentsConfig,
|
|
5663
|
-
getDeviceDeployments,
|
|
5664
|
-
getDeviceLog,
|
|
5665
|
-
getSingleDeployment,
|
|
5666
|
-
resetDeviceDeployments,
|
|
5667
|
-
saveDeltaDeploymentsConfig,
|
|
5668
|
-
setDeploymentsState,
|
|
5669
|
-
updateDeploymentControlMap
|
|
5670
|
-
});
|
|
5671
5759
|
//# sourceMappingURL=thunks.js.map
|