@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
|
@@ -2,12 +2,7 @@ import {
|
|
|
2
2
|
READ_STATES,
|
|
3
3
|
defaultPermissionSets,
|
|
4
4
|
rolesById
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
__objRest,
|
|
8
|
-
__restKey,
|
|
9
|
-
__spreadValues
|
|
10
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
5
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
11
6
|
|
|
12
7
|
// src/usersSlice/index.ts
|
|
13
8
|
import { createSlice } from "@reduxjs/toolkit";
|
|
@@ -27,8 +22,12 @@ var initialState = {
|
|
|
27
22
|
previousPhases: [],
|
|
28
23
|
retries: 0
|
|
29
24
|
},
|
|
30
|
-
permissionSetsById:
|
|
31
|
-
|
|
25
|
+
permissionSetsById: {
|
|
26
|
+
...defaultPermissionSets
|
|
27
|
+
},
|
|
28
|
+
rolesById: {
|
|
29
|
+
...rolesById
|
|
30
|
+
},
|
|
32
31
|
settingsInitialized: false,
|
|
33
32
|
showConnectDeviceDialog: false,
|
|
34
33
|
showFeedbackDialog: false,
|
|
@@ -68,13 +67,15 @@ var usersSlice = createSlice({
|
|
|
68
67
|
state.byId[0] = action.payload;
|
|
69
68
|
},
|
|
70
69
|
removedUser: (state, action) => {
|
|
71
|
-
|
|
72
|
-
const _b = state.byId, { [_a = action.payload]: removedUser } = _b, byId = __objRest(_b, [__restKey(_a)]);
|
|
70
|
+
const { [action.payload]: removedUser, ...byId } = state.byId;
|
|
73
71
|
state.byId = byId;
|
|
74
72
|
state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
|
|
75
73
|
},
|
|
76
74
|
updatedUser: (state, action) => {
|
|
77
|
-
state.byId[action.payload.id] =
|
|
75
|
+
state.byId[action.payload.id] = {
|
|
76
|
+
...state.byId[action.payload.id],
|
|
77
|
+
...action.payload
|
|
78
|
+
};
|
|
78
79
|
},
|
|
79
80
|
receivedPermissionSets: (state, action) => {
|
|
80
81
|
state.permissionSetsById = action.payload;
|
|
@@ -83,11 +84,13 @@ var usersSlice = createSlice({
|
|
|
83
84
|
state.rolesById = action.payload;
|
|
84
85
|
},
|
|
85
86
|
createdRole: (state, action) => {
|
|
86
|
-
state.rolesById[action.payload.name] =
|
|
87
|
+
state.rolesById[action.payload.name] = {
|
|
88
|
+
...state.rolesById[action.payload.name],
|
|
89
|
+
...action.payload
|
|
90
|
+
};
|
|
87
91
|
},
|
|
88
92
|
removedRole: (state, action) => {
|
|
89
|
-
|
|
90
|
-
const _b = state.rolesById, { [_a = action.payload]: toBeRemoved } = _b, rolesById2 = __objRest(_b, [__restKey(_a)]);
|
|
93
|
+
const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
|
|
91
94
|
state.rolesById = rolesById2;
|
|
92
95
|
},
|
|
93
96
|
setCustomColumns: (state, action) => {
|
|
@@ -95,18 +98,27 @@ var usersSlice = createSlice({
|
|
|
95
98
|
},
|
|
96
99
|
setGlobalSettings: (state, action) => {
|
|
97
100
|
state.settingsInitialized = true;
|
|
98
|
-
state.globalSettings =
|
|
101
|
+
state.globalSettings = {
|
|
102
|
+
...state.globalSettings,
|
|
103
|
+
...action.payload
|
|
104
|
+
};
|
|
99
105
|
},
|
|
100
106
|
setUserSettings: (state, action) => {
|
|
101
107
|
state.userSettingsInitialized = true;
|
|
102
|
-
state.userSettings =
|
|
108
|
+
state.userSettings = {
|
|
109
|
+
...state.userSettings,
|
|
110
|
+
...action.payload
|
|
111
|
+
};
|
|
103
112
|
},
|
|
104
113
|
setTooltipState: (state, action) => {
|
|
105
114
|
const { id, readState = READ_STATES.read } = action.payload;
|
|
106
115
|
state.tooltips.byId[id].readState = readState;
|
|
107
116
|
},
|
|
108
117
|
setTooltipsState: (state, action) => {
|
|
109
|
-
state.tooltips.byId =
|
|
118
|
+
state.tooltips.byId = {
|
|
119
|
+
...state.tooltips.byId,
|
|
120
|
+
...action.payload
|
|
121
|
+
};
|
|
110
122
|
},
|
|
111
123
|
setShowFeedbackDialog: (state, action) => {
|
|
112
124
|
state.showFeedbackDialog = action.payload;
|
|
@@ -129,4 +141,4 @@ export {
|
|
|
129
141
|
actions,
|
|
130
142
|
usersSlice_default
|
|
131
143
|
};
|
|
132
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-KZSTW27Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/usersSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { READ_STATES, defaultPermissionSets, rolesById } from './constants';\n\nexport const sliceName = 'users';\n\nexport const initialState = {\n activationCode: undefined,\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {}\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action) => {\n state.byId = action.payload;\n },\n receivedActivationCode: (state, action) => {\n state.activationCode = action.payload;\n },\n receivedUser: (state, action) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n createdUser: (state, action) => {\n // the new user gets a 0 as id, since this will be overwritten by the retrieved userlist anyway + there is no way to know the id before\n state.byId[0] = action.payload;\n },\n removedUser: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action) => {\n state.rolesById = action.payload;\n },\n createdRole: (state, action) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id].readState = readState;\n },\n setTooltipsState: (state, action) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/usersSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport { READ_STATES, defaultPermissionSets, rolesById } from './constants';\n\nexport const sliceName = 'users';\n\nexport const initialState = {\n activationCode: undefined,\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {}\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action) => {\n state.byId = action.payload;\n },\n receivedActivationCode: (state, action) => {\n state.activationCode = action.payload;\n },\n receivedUser: (state, action) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n createdUser: (state, action) => {\n // the new user gets a 0 as id, since this will be overwritten by the retrieved userlist anyway + there is no way to know the id before\n state.byId[0] = action.payload;\n },\n removedUser: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action) => {\n state.rolesById = action.payload;\n },\n createdRole: (state, action) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id].readState = readState;\n },\n setTooltipsState: (state, action) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":"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","names":["rolesById"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
__require,
|
|
35
|
+
__commonJS,
|
|
36
|
+
__toESM
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=chunk-LZOMFHX3.mjs.map
|
|
@@ -1,47 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
2
|
actions_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-H5UCKQWK.mjs";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
appSlice_default
|
|
6
|
+
} from "./chunk-3ORTTLIB.mjs";
|
|
7
7
|
import {
|
|
8
8
|
actions,
|
|
9
9
|
organizationSlice_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-R7LXL3KJ.mjs";
|
|
11
|
+
import {
|
|
12
|
+
usersSlice_default
|
|
13
|
+
} from "./chunk-KZSTW27Q.mjs";
|
|
11
14
|
import {
|
|
12
15
|
releasesSlice_default
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4SDUITD4.mjs";
|
|
14
17
|
import {
|
|
15
18
|
monitorSlice_default
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZE7R2XXE.mjs";
|
|
20
|
+
import {
|
|
21
|
+
devicesSlice_default
|
|
22
|
+
} from "./chunk-AZRVRNXT.mjs";
|
|
17
23
|
import {
|
|
18
24
|
onboardingSlice_default
|
|
19
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-B42NUKMZ.mjs";
|
|
20
26
|
import {
|
|
21
27
|
deploymentsSlice_default
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
devicesSlice_default
|
|
25
|
-
} from "./chunk-HRWZJQMH.mjs";
|
|
26
|
-
import {
|
|
27
|
-
appSlice_default
|
|
28
|
-
} from "./chunk-F37LUTBX.mjs";
|
|
28
|
+
} from "./chunk-JA27QXVB.mjs";
|
|
29
29
|
import {
|
|
30
30
|
getToken
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZK4W5T53.mjs";
|
|
32
32
|
import {
|
|
33
33
|
extractErrorMessage,
|
|
34
34
|
preformatWithRequestID
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-KPPU6OWF.mjs";
|
|
36
36
|
import {
|
|
37
37
|
USER_LOGOUT,
|
|
38
38
|
settingsKeys
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
__objRest,
|
|
42
|
-
__spreadProps,
|
|
43
|
-
__spreadValues
|
|
44
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
39
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
45
40
|
|
|
46
41
|
// src/store.ts
|
|
47
42
|
import { combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
@@ -76,8 +71,9 @@ var sessionReducer = (state, action) => {
|
|
|
76
71
|
return rootReducer(state, action);
|
|
77
72
|
};
|
|
78
73
|
var getConfiguredStore = (options = {}) => {
|
|
79
|
-
const
|
|
80
|
-
return configureStore(
|
|
74
|
+
const { preloadedState = {}, ...config } = options;
|
|
75
|
+
return configureStore({
|
|
76
|
+
...config,
|
|
81
77
|
preloadedState,
|
|
82
78
|
reducer: sessionReducer,
|
|
83
79
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
@@ -90,7 +86,7 @@ var getConfiguredStore = (options = {}) => {
|
|
|
90
86
|
ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
|
|
91
87
|
}
|
|
92
88
|
})
|
|
93
|
-
})
|
|
89
|
+
});
|
|
94
90
|
};
|
|
95
91
|
var store = getConfiguredStore({
|
|
96
92
|
preloadedState: {}
|
|
@@ -103,4 +99,4 @@ export {
|
|
|
103
99
|
getConfiguredStore,
|
|
104
100
|
store
|
|
105
101
|
};
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-NJNSCJEY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { combineReducers, configureStore } from '@reduxjs/toolkit';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice from './usersSlice';\nimport { extractErrorMessage, preformatWithRequestID } from './utils';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nconst resetEnvironment = () => {\n keys.map(key => window.sessionStorage.removeItem(key));\n};\n\nresetEnvironment();\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\nexport const sessionReducer = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n\nexport const getConfiguredStore = (options = {}) => {\n const { preloadedState = {}, ...config } = options;\n return configureStore({\n ...config,\n preloadedState,\n reducer: sessionReducer,\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],\n ignoredActionPaths: ['uploads', 'snackbar', /payload\\..*$/],\n ignoredPaths: ['app.uploadsById', 'app.snackbar', 'organization.externalDeviceIntegrations']\n }\n })\n });\n};\nexport const store = getConfiguredStore({\n preloadedState: {}\n});\nexport type AppDispatch = typeof store.dispatch;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// @ts-nocheck\nimport { combineReducers, configureStore } from '@reduxjs/toolkit';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice from './usersSlice';\nimport { extractErrorMessage, preformatWithRequestID } from './utils';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nconst resetEnvironment = () => {\n keys.map(key => window.sessionStorage.removeItem(key));\n};\n\nresetEnvironment();\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\nexport const sessionReducer = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n\nexport const getConfiguredStore = (options = {}) => {\n const { preloadedState = {}, ...config } = options;\n return configureStore({\n ...config,\n preloadedState,\n reducer: sessionReducer,\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],\n ignoredActionPaths: ['uploads', 'snackbar', /payload\\..*$/],\n ignoredPaths: ['app.uploadsById', 'app.snackbar', 'organization.externalDeviceIntegrations']\n }\n })\n });\n};\nexport const store = getConfiguredStore({\n preloadedState: {}\n});\nexport type AppDispatch = typeof store.dispatch;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAS,iBAAiB,sBAAsB;AAehD,IAAM,EAAE,aAAa,eAAe,IAAI;AAGxC,IAAM,OAAO,CAAC,4BAA4B,aAAa,WAAW;AAClE,IAAM,mBAAmB,MAAM;AAC7B,OAAK,IAAI,SAAO,OAAO,eAAe,WAAW,GAAG,CAAC;AACvD;AAEA,iBAAiB;AAEV,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB,CAAC,KAAK,cAAc,UAAU,UAAU,qBAAqB,UAAU;AACvG,QAAM,SAAS,oBAAoB,KAAK,QAAQ;AAChD,MAAI,sBAAsB,SAAS,GAAG;AACpC,aAAS,YAAY,EAAE,SAAS,uBAAuB,IAAI,UAAU,GAAG,YAAY,IAAI,MAAM,EAAE,GAAG,QAAQ,oBAAoB,CAAC,CAAC;AAAA,EACnI;AACA,SAAO,QAAQ,OAAO,GAAG;AAC3B;AAEA,IAAM,cAAc,gBAAgB;AAAA,EAClC,KAAK;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AACT,CAAC;AAEM,IAAM,iBAAiB,CAAC,OAAO,WAAW;AAC/C,MAAI,OAAO,SAAS,aAAa;AAC/B,YAAQ;AAAA,EACV;AACA,SAAO,YAAY,OAAO,MAAM;AAClC;AAEO,IAAM,qBAAqB,CAAC,UAAU,CAAC,MAAM;AAClD,QAAM,EAAE,iBAAiB,CAAC,GAAG,GAAG,OAAO,IAAI;AAC3C,SAAO,eAAe;AAAA,IACpB,GAAG;AAAA,IACH;AAAA,IACA,SAAS;AAAA,IACT,YAAY,0BACV,qBAAqB;AAAA,MACnB,gBAAgB;AAAA,QACd,cAAc,CAAC,iBAAiB;AAAA,MAClC;AAAA,MACA,mBAAmB;AAAA,QACjB,gBAAgB,CAAC,QAAoB,kCAAkC,MAAM,YAAY,MAAM,eAAe,IAAI;AAAA,QAClH,oBAAoB,CAAC,WAAW,YAAY,cAAc;AAAA,QAC1D,cAAc,CAAC,mBAAmB,gBAAgB,yCAAyC;AAAA,MAC7F;AAAA,IACF,CAAC;AAAA,EACL,CAAC;AACH;AACO,IAAM,QAAQ,mBAAmB;AAAA,EACtC,gBAAgB,CAAC;AACnB,CAAC;","names":[]}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
general_api_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-65YIOCCD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getSearchEndpoint
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KJAZNKV2.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getReleasesById
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XC5UXEIB.mjs";
|
|
10
10
|
import {
|
|
11
11
|
commonErrorFallback,
|
|
12
12
|
commonErrorHandler
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NJNSCJEY.mjs";
|
|
14
14
|
import {
|
|
15
15
|
actions_default
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-H5UCKQWK.mjs";
|
|
17
17
|
import {
|
|
18
18
|
actions,
|
|
19
19
|
sliceName
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4SDUITD4.mjs";
|
|
21
21
|
import {
|
|
22
22
|
convertDeviceListStateToFilters,
|
|
23
23
|
progress
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-KPPU6OWF.mjs";
|
|
25
25
|
import {
|
|
26
26
|
deploymentsApiUrl,
|
|
27
27
|
deploymentsApiUrlV2,
|
|
28
28
|
emptyFilter
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-IFWKT27G.mjs";
|
|
30
|
+
import {
|
|
31
|
+
headerNames
|
|
32
|
+
} from "./chunk-5VNQCCAQ.mjs";
|
|
30
33
|
import {
|
|
31
34
|
ARTIFACT_GENERATION_TYPE
|
|
32
35
|
} from "./chunk-G4FGNSV3.mjs";
|
|
33
|
-
import {
|
|
34
|
-
headerNames
|
|
35
|
-
} from "./chunk-BOSBROA3.mjs";
|
|
36
36
|
import {
|
|
37
37
|
DEVICE_LIST_DEFAULTS,
|
|
38
38
|
SORTING_OPTIONS,
|
|
39
39
|
TIMEOUTS
|
|
40
|
-
} from "./chunk-
|
|
41
|
-
import {
|
|
42
|
-
__objRest,
|
|
43
|
-
__spreadProps,
|
|
44
|
-
__spreadValues
|
|
45
|
-
} from "./chunk-XWBD7VOK.mjs";
|
|
40
|
+
} from "./chunk-QQBUNZHA.mjs";
|
|
46
41
|
|
|
47
42
|
// src/releasesSlice/thunks.ts
|
|
48
43
|
import { customSort, deepCompare, duplicateFilter, extractSoftwareItem } from "@northern.tech/utils/helpers";
|
|
@@ -50,19 +45,20 @@ import { formatReleases } from "@northern.tech/utils/locationutils";
|
|
|
50
45
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
|
51
46
|
import { isCancel } from "axios";
|
|
52
47
|
|
|
53
|
-
// ../../node_modules/uuid/dist/esm-
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
var poolPtr = rnds8Pool.length;
|
|
48
|
+
// ../../node_modules/uuid/dist/esm-browser/rng.js
|
|
49
|
+
var getRandomValues;
|
|
50
|
+
var rnds8 = new Uint8Array(16);
|
|
57
51
|
function rng() {
|
|
58
|
-
if (
|
|
59
|
-
crypto.
|
|
60
|
-
|
|
52
|
+
if (!getRandomValues) {
|
|
53
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
54
|
+
if (!getRandomValues) {
|
|
55
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
56
|
+
}
|
|
61
57
|
}
|
|
62
|
-
return
|
|
58
|
+
return getRandomValues(rnds8);
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
// ../../node_modules/uuid/dist/esm-
|
|
61
|
+
// ../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
66
62
|
var byteToHex = [];
|
|
67
63
|
for (let i = 0; i < 256; ++i) {
|
|
68
64
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -71,13 +67,13 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
71
67
|
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]];
|
|
72
68
|
}
|
|
73
69
|
|
|
74
|
-
// ../../node_modules/uuid/dist/esm-
|
|
75
|
-
|
|
70
|
+
// ../../node_modules/uuid/dist/esm-browser/native.js
|
|
71
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
76
72
|
var native_default = {
|
|
77
|
-
randomUUID
|
|
73
|
+
randomUUID
|
|
78
74
|
};
|
|
79
75
|
|
|
80
|
-
// ../../node_modules/uuid/dist/esm-
|
|
76
|
+
// ../../node_modules/uuid/dist/esm-browser/v4.js
|
|
81
77
|
function v4(options, buf, offset) {
|
|
82
78
|
if (native_default.randomUUID && !buf && !options) {
|
|
83
79
|
return native_default.randomUUID();
|
|
@@ -102,20 +98,21 @@ var { setSnackbar, initUpload, uploadProgress, cleanUpUpload } = actions_default
|
|
|
102
98
|
var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
|
|
103
99
|
var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
|
|
104
100
|
var flattenRelease = (release, stateRelease) => {
|
|
105
|
-
|
|
106
|
-
const updatedArtifacts = ((_a = release.artifacts) == null ? void 0 : _a.sort(customSort(1, "modified"))) || [];
|
|
101
|
+
const updatedArtifacts = release.artifacts?.sort(customSort(1, "modified")) || [];
|
|
107
102
|
const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
|
|
108
103
|
(accu, item) => {
|
|
109
|
-
var _a2;
|
|
110
104
|
accu.deviceTypes.push(...item.device_types_compatible);
|
|
111
|
-
const stateArtifact =
|
|
105
|
+
const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
|
|
112
106
|
accu.modified = accu.modified ? accu.modified : item.modified;
|
|
113
|
-
accu.artifacts.push(
|
|
107
|
+
accu.artifacts.push({
|
|
108
|
+
...stateArtifact,
|
|
109
|
+
...item
|
|
110
|
+
});
|
|
114
111
|
return accu;
|
|
115
112
|
},
|
|
116
113
|
{ artifacts: [], deviceTypes: [], modified: void 0 }
|
|
117
114
|
);
|
|
118
|
-
return
|
|
115
|
+
return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(duplicateFilter), modified };
|
|
119
116
|
};
|
|
120
117
|
var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
|
|
121
118
|
const stateRelease = stateReleasesById[release.name] || {};
|
|
@@ -133,17 +130,16 @@ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduc
|
|
|
133
130
|
{ release: null, index: -1 }
|
|
134
131
|
);
|
|
135
132
|
var getArtifactInstallCount = createAsyncThunk(`${sliceName}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
|
|
136
|
-
var _a;
|
|
137
133
|
let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
|
|
138
134
|
if (!release || index === -1) {
|
|
139
135
|
return;
|
|
140
136
|
}
|
|
141
137
|
const releaseArtifacts = [...release.artifacts];
|
|
142
138
|
const artifact = releaseArtifacts[index];
|
|
143
|
-
const { key, name, version } =
|
|
139
|
+
const { key, name, version } = extractSoftwareItem(artifact.artifact_provides) ?? {};
|
|
144
140
|
const attribute = `${key}${name ? `.${name}` : ""}.version`;
|
|
145
141
|
const { filterTerms } = convertDeviceListStateToFilters({
|
|
146
|
-
filters: [
|
|
142
|
+
filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
|
|
147
143
|
});
|
|
148
144
|
return general_api_default.post(getSearchEndpoint(getState()), {
|
|
149
145
|
page: 1,
|
|
@@ -157,10 +153,11 @@ var getArtifactInstallCount = createAsyncThunk(`${sliceName}/getArtifactInstallC
|
|
|
157
153
|
}
|
|
158
154
|
const installCount = Number(headers[headerNames.total]);
|
|
159
155
|
const releaseArtifacts2 = [...release2.artifacts];
|
|
160
|
-
releaseArtifacts2[index2] =
|
|
161
|
-
release2 =
|
|
156
|
+
releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
|
|
157
|
+
release2 = {
|
|
158
|
+
...release2,
|
|
162
159
|
artifacts: releaseArtifacts2
|
|
163
|
-
}
|
|
160
|
+
};
|
|
164
161
|
return dispatch(actions.receiveRelease(release2));
|
|
165
162
|
});
|
|
166
163
|
});
|
|
@@ -172,12 +169,14 @@ var getArtifactUrl = createAsyncThunk(
|
|
|
172
169
|
return dispatch(getReleases());
|
|
173
170
|
}
|
|
174
171
|
const releaseArtifacts = [...release.artifacts];
|
|
175
|
-
releaseArtifacts[index] =
|
|
172
|
+
releaseArtifacts[index] = {
|
|
173
|
+
...releaseArtifacts[index],
|
|
176
174
|
url: response.data.uri
|
|
177
|
-
}
|
|
178
|
-
release =
|
|
175
|
+
};
|
|
176
|
+
release = {
|
|
177
|
+
...release,
|
|
179
178
|
artifacts: releaseArtifacts
|
|
180
|
-
}
|
|
179
|
+
};
|
|
181
180
|
return dispatch(actions.receiveRelease(release));
|
|
182
181
|
})
|
|
183
182
|
);
|
|
@@ -302,12 +301,14 @@ var selectRelease = createAsyncThunk(`${sliceName}/selectRelease`, (release, { d
|
|
|
302
301
|
});
|
|
303
302
|
var setReleasesListState = createAsyncThunk(`${sliceName}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
|
|
304
303
|
const currentState = getState().releases.releasesList;
|
|
305
|
-
let nextState =
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
let nextState = {
|
|
305
|
+
...currentState,
|
|
306
|
+
...selectionState,
|
|
307
|
+
sort: { ...currentState.sort, ...selectionState.sort }
|
|
308
|
+
};
|
|
308
309
|
let tasks = [];
|
|
309
|
-
const
|
|
310
|
-
const
|
|
310
|
+
const { isLoading: currentLoading, ...currentRequestState } = currentState;
|
|
311
|
+
const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
|
|
311
312
|
if (!deepCompare(currentRequestState, selectionRequestState)) {
|
|
312
313
|
nextState.isLoading = true;
|
|
313
314
|
tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
|
|
@@ -326,29 +327,30 @@ var releaseListRetrieval = (config) => {
|
|
|
326
327
|
);
|
|
327
328
|
};
|
|
328
329
|
var deductSearchState = (receivedReleases, config, total, state) => {
|
|
329
|
-
let releaseListState =
|
|
330
|
+
let releaseListState = { ...state.releasesList };
|
|
330
331
|
const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
|
|
331
332
|
const flattenedReleases = Object.values(receivedReleases).sort(customSort(sort.direction === SORTING_OPTIONS.desc, sort.key));
|
|
332
333
|
const releaseIds = flattenedReleases.map((item) => item.name);
|
|
333
334
|
const isFiltering = !!(selectedTags.length || type || searchTerm);
|
|
334
335
|
if (searchOnly) {
|
|
335
|
-
releaseListState =
|
|
336
|
+
releaseListState = { ...releaseListState, searchedIds: releaseIds };
|
|
336
337
|
} else {
|
|
337
|
-
releaseListState =
|
|
338
|
+
releaseListState = {
|
|
339
|
+
...releaseListState,
|
|
338
340
|
releaseIds,
|
|
339
341
|
searchTotal: isFiltering ? total : state.releasesList.searchTotal,
|
|
340
342
|
total: !isFiltering ? total : state.releasesList.total
|
|
341
|
-
}
|
|
343
|
+
};
|
|
342
344
|
}
|
|
343
345
|
return releaseListState;
|
|
344
346
|
};
|
|
345
347
|
var getReleases = createAsyncThunk(`${sliceName}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
|
|
346
|
-
const config =
|
|
348
|
+
const config = { ...getState().releases.releasesList, ...passedConfig };
|
|
347
349
|
return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
|
|
348
350
|
const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
|
|
349
351
|
const state = getState().releases;
|
|
350
352
|
const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
|
|
351
|
-
const combinedReleases =
|
|
353
|
+
const combinedReleases = { ...state.byId, ...flatReleases };
|
|
352
354
|
let tasks = [dispatch(actions.receiveReleases(combinedReleases))];
|
|
353
355
|
const releaseListState = deductSearchState(receivedReleases, config, total, state);
|
|
354
356
|
tasks.push(dispatch(actions.setReleaseListState(releaseListState)));
|
|
@@ -369,7 +371,7 @@ var updateReleaseInfo = createAsyncThunk(
|
|
|
369
371
|
`${sliceName}/updateReleaseInfo`,
|
|
370
372
|
({ 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(() => {
|
|
371
373
|
return Promise.all([
|
|
372
|
-
dispatch(actions.receiveRelease(
|
|
374
|
+
dispatch(actions.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
|
|
373
375
|
dispatch(setSnackbar("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
374
376
|
]);
|
|
375
377
|
})
|
|
@@ -378,7 +380,7 @@ var setReleaseTags = createAsyncThunk(
|
|
|
378
380
|
`${sliceName}/setReleaseTags`,
|
|
379
381
|
({ 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(() => {
|
|
380
382
|
return Promise.all([
|
|
381
|
-
dispatch(actions.receiveRelease(
|
|
383
|
+
dispatch(actions.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
|
|
382
384
|
dispatch(setSnackbar("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
|
|
383
385
|
]);
|
|
384
386
|
})
|
|
@@ -411,4 +413,4 @@ export {
|
|
|
411
413
|
getExistingReleaseTags,
|
|
412
414
|
getUpdateTypes
|
|
413
415
|
};
|
|
414
|
-
//# sourceMappingURL=chunk-
|
|
416
|
+
//# sourceMappingURL=chunk-O6TYYKSD.mjs.map
|