@northern.tech/store 0.30.1 → 0.30.2
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/deploymentsSlice/thunks.d.cts +9 -9
- package/dist/deploymentsSlice/thunks.d.ts +9 -9
- package/dist/store.d.cts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/storehooks.d.cts +12 -12
- package/dist/storehooks.d.ts +12 -12
- package/dist/thunks.cjs +51 -9
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.js +52 -10
- package/dist/thunks.js.map +1 -1
- package/dist/usersSlice/thunks.d.cts +75 -75
- package/dist/usersSlice/thunks.d.ts +75 -75
- package/dist/{utils-DNnSR4S_.d.ts → utils-CO_CpGFP.d.ts} +3 -2
- package/dist/{utils-B4I595rf.d.cts → utils-CpPfqW0Q.d.cts} +3 -2
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/thunks.js
CHANGED
|
@@ -14,7 +14,7 @@ import { getFeatures, getHostedAnnouncement, getSearchState } from "./appSlice/s
|
|
|
14
14
|
import { getDeploymentsById, getDeploymentsByStatus as getDeploymentsByStatus$1 } from "./deploymentsSlice/selectors.js";
|
|
15
15
|
import { getAcceptedDevices, getDeviceById as getDeviceById$1, getDeviceCountsByStatus, getDeviceFilters, getDeviceListState, getDeviceReports, getDevicesById, getGroupsById, getSelectedGroup } from "./devicesSlice/selectors.js";
|
|
16
16
|
import { getAuditlogState, getDeviceTwinIntegrations, getOrganization, getSpLimits, getTenantsList } from "./organizationSlice/selectors.js";
|
|
17
|
-
import { convertDeviceListStateToFilters, convertToBackendSPLimits, extractErrorMessage as extractErrorMessage$1, filtersFilter, getComparisonCompatibleVersion, mapDeviceAttributes, mapFiltersToTerms, mapTermsToFilters, mergePermissions, parseSubscriptionPreview, progress } from "./utils.js";
|
|
17
|
+
import { convertDeviceListStateToFilters, convertToBackendSPLimits, extractErrorMessage as extractErrorMessage$1, filtersFilter, getComparisonCompatibleVersion, mapDeviceAttributes, mapFiltersToTerms, mapTermsToFilters, mergePermissions, parseSubscriptionPreview, progress, stripUndefined } from "./utils.js";
|
|
18
18
|
import { getCurrentUser, getGlobalSettings as getGlobalSettings$1, getIdAttribute, getOfflineThresholdSettings, getRolesById, getSelectedDeviceAttribute, getTooltipsState, getUserSettings as getUserSettings$1, getUsersById } from "./usersSlice/selectors.js";
|
|
19
19
|
import { getDeviceReportsForUser, getOnboardingState as getOnboardingState$1, getTenantCapabilities, getUserCapabilities } from "./commonSelectors.js";
|
|
20
20
|
import { commonErrorFallback, commonErrorHandler, createAppAsyncThunk } from "./store.js";
|
|
@@ -220,12 +220,45 @@ const trackDeploymentCreation = (totalDeploymentCount, hasDeployments, trial_exp
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
+
const cleanPhases = (phases) => phases?.map(({ batch_size, batch_size_devices, start_ts }) => stripUndefined({
|
|
224
|
+
batch_size,
|
|
225
|
+
batch_size_devices,
|
|
226
|
+
start_ts
|
|
227
|
+
}));
|
|
223
228
|
const MAX_PREVIOUS_PHASES_COUNT = 5;
|
|
224
229
|
const createDeployment = createAppAsyncThunk(`${sliceName$1}/createDeployment`, ({ newDeployment, hasNewRetryDefault = false }, { dispatch, getState }) => {
|
|
225
230
|
let request;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
const { name, artifact_name, retries, update_control_map, autogenerate_delta } = newDeployment;
|
|
232
|
+
const common = stripUndefined({
|
|
233
|
+
name,
|
|
234
|
+
artifact_name,
|
|
235
|
+
phases: cleanPhases(newDeployment.phases),
|
|
236
|
+
retries,
|
|
237
|
+
update_control_map,
|
|
238
|
+
autogenerate_delta
|
|
239
|
+
});
|
|
240
|
+
if ("filter_id" in newDeployment && newDeployment.filter_id) {
|
|
241
|
+
const { filter_id, max_devices } = newDeployment;
|
|
242
|
+
request = Api.post(`${deploymentsApiUrlV2}/deployments`, stripUndefined({
|
|
243
|
+
...common,
|
|
244
|
+
filter_id,
|
|
245
|
+
max_devices
|
|
246
|
+
}));
|
|
247
|
+
} else if ("group" in newDeployment && newDeployment.group) {
|
|
248
|
+
const { force_installation, group } = newDeployment;
|
|
249
|
+
request = Api.post(`${deploymentsApiUrl}/deployments/group/${group}`, stripUndefined({
|
|
250
|
+
...common,
|
|
251
|
+
force_installation
|
|
252
|
+
}));
|
|
253
|
+
} else {
|
|
254
|
+
const { devices, all_devices, force_installation } = newDeployment;
|
|
255
|
+
request = Api.post(`${deploymentsApiUrl}/deployments`, stripUndefined({
|
|
256
|
+
...common,
|
|
257
|
+
devices,
|
|
258
|
+
all_devices,
|
|
259
|
+
force_installation
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
229
262
|
const totalDeploymentCount = Object.values(getDeploymentsByStatus$1(getState())).reduce((accu, item) => accu + item.total, 0);
|
|
230
263
|
const { hasDeployments } = getGlobalSettings$1(getState());
|
|
231
264
|
const { trial_expiration } = getOrganization(getState());
|
|
@@ -1610,10 +1643,11 @@ const getTargetLocation = (key) => {
|
|
|
1610
1643
|
};
|
|
1611
1644
|
const devLocations = ["localhost", "docker.mender.io"];
|
|
1612
1645
|
const createOrganizationTrial = createAppAsyncThunk(`${sliceName$4}/createOrganizationTrial`, async (data, { dispatch }) => {
|
|
1613
|
-
const {
|
|
1646
|
+
const { location, tos: _tos, ...trialPayload } = data;
|
|
1647
|
+
const { key } = locations[location];
|
|
1614
1648
|
const targetLocation = getTargetLocation(key);
|
|
1615
1649
|
const target = `${targetLocation}${tenantadmApiUrlv2}/tenants/trial`;
|
|
1616
|
-
const { headers } = await Api.postUnauthorized(target,
|
|
1650
|
+
const { headers } = await Api.postUnauthorized(target, trialPayload).catch((err) => {
|
|
1617
1651
|
if (err.response?.status >= 400 && err.response?.status < 500) dispatch(setSnackbar$1({
|
|
1618
1652
|
message: err.response.data.error,
|
|
1619
1653
|
autoHideDuration: TIMEOUTS.fiveSeconds
|
|
@@ -2033,10 +2067,18 @@ const removeUser = createAppAsyncThunk(`${sliceName$5}/removeUser`, (userId, { d
|
|
|
2033
2067
|
dispatch(getUserList()),
|
|
2034
2068
|
dispatch(setSnackbar(userActions.remove.successMessage))
|
|
2035
2069
|
])).catch((err) => userActionErrorHandler(err, "remove", dispatch)));
|
|
2036
|
-
const editUser = createAppAsyncThunk(`${sliceName$5}/editUser`, ({ id,
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2070
|
+
const editUser = createAppAsyncThunk(`${sliceName$5}/editUser`, ({ id, email, password, current_password, roles }, { dispatch, getState }) => {
|
|
2071
|
+
const userData = stripUndefined({
|
|
2072
|
+
email,
|
|
2073
|
+
password,
|
|
2074
|
+
current_password,
|
|
2075
|
+
roles
|
|
2076
|
+
});
|
|
2077
|
+
return Api.put(`${useradmApiUrl}/users/${id}`, userData).then(() => Promise.all([dispatch(actions$5.updatedUser({
|
|
2078
|
+
...userData,
|
|
2079
|
+
id: id === "me" ? getCurrentUser(getState()).id : id
|
|
2080
|
+
})), dispatch(setSnackbar(userActions.edit.successMessage))])).catch((err) => userActionErrorHandler(err, "edit", dispatch));
|
|
2081
|
+
});
|
|
2040
2082
|
const checkEmailExists = createAppAsyncThunk(`${sliceName$5}/checkEmailExists`, async (email) => {
|
|
2041
2083
|
return (await Api.get(`${useradmApiUrl}/users/exists?email=${encodeURIComponent(email)}`)).data.exists;
|
|
2042
2084
|
});
|