@dexteel/mesf-core 6.2.1 → 6.2.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +8 -0
- package/dist/index.esm.js +64 -27
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [6.2.2](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.2.1...mesf-core-v6.2.2) (2025-10-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Create User:** enhance user creation process with password and profile management ([7e54340](https://github.com/dexteel/mesf-core-frontend/commit/7e54340c53a19276fcd11f536033bc7f3b24ae20))
|
|
9
|
+
* **Edit User:** streamline user update process and improve profile ID handling ([182ed68](https://github.com/dexteel/mesf-core-frontend/commit/182ed6814473176c3cd741a9e58133a4d9d4e3ad))
|
|
10
|
+
|
|
3
11
|
## [6.2.1](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.2.0...mesf-core-v6.2.1) (2025-10-28)
|
|
4
12
|
|
|
5
13
|
|
package/dist/index.esm.js
CHANGED
|
@@ -8355,7 +8355,31 @@ var CreateUser = function (_a) {
|
|
|
8355
8355
|
};
|
|
8356
8356
|
var UserName = watch("UserName");
|
|
8357
8357
|
var createUser = useMutation({
|
|
8358
|
-
mutationFn:
|
|
8358
|
+
mutationFn: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8359
|
+
var userId, passwordResult;
|
|
8360
|
+
return __generator(this, function (_a) {
|
|
8361
|
+
switch (_a.label) {
|
|
8362
|
+
case 0: return [4 /*yield*/, upsertUser(data)];
|
|
8363
|
+
case 1:
|
|
8364
|
+
userId = _a.sent();
|
|
8365
|
+
return [4 /*yield*/, setPassword(userId, data.UserName)];
|
|
8366
|
+
case 2:
|
|
8367
|
+
passwordResult = _a.sent();
|
|
8368
|
+
if (!passwordResult.ok) {
|
|
8369
|
+
throw new Error(passwordResult.message || "Error setting password");
|
|
8370
|
+
}
|
|
8371
|
+
if (!(data.ProfilesId && Array.isArray(data.ProfilesId))) return [3 /*break*/, 4];
|
|
8372
|
+
return [4 /*yield*/, setProfilesToUser({
|
|
8373
|
+
UserId: userId,
|
|
8374
|
+
profileIds: data.ProfilesId,
|
|
8375
|
+
})];
|
|
8376
|
+
case 3:
|
|
8377
|
+
_a.sent();
|
|
8378
|
+
_a.label = 4;
|
|
8379
|
+
case 4: return [2 /*return*/, userId];
|
|
8380
|
+
}
|
|
8381
|
+
});
|
|
8382
|
+
}); },
|
|
8359
8383
|
onSuccess: function () {
|
|
8360
8384
|
setOpen(true);
|
|
8361
8385
|
onHide(true);
|
|
@@ -8821,38 +8845,45 @@ var EditUser = function (_a) {
|
|
|
8821
8845
|
}
|
|
8822
8846
|
setOpen(false);
|
|
8823
8847
|
};
|
|
8824
|
-
var setProfiles = useMutation({
|
|
8825
|
-
mutationFn: setProfilesToUser,
|
|
8826
|
-
onError: function (error) {
|
|
8827
|
-
setError(error.message);
|
|
8828
|
-
},
|
|
8829
|
-
});
|
|
8830
8848
|
var editUser = useMutation({
|
|
8831
|
-
mutationFn:
|
|
8832
|
-
|
|
8833
|
-
var currentLoggedUserId, selectedArea;
|
|
8849
|
+
mutationFn: function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8850
|
+
var userUpdatedId, validProfileIds;
|
|
8834
8851
|
return __generator(this, function (_a) {
|
|
8835
8852
|
switch (_a.label) {
|
|
8836
|
-
case 0: return [4 /*yield*/,
|
|
8837
|
-
UserId: userUpdatedId,
|
|
8838
|
-
profileIds: profilesIds,
|
|
8839
|
-
})];
|
|
8853
|
+
case 0: return [4 /*yield*/, upsertUser(data)];
|
|
8840
8854
|
case 1:
|
|
8855
|
+
userUpdatedId = _a.sent();
|
|
8856
|
+
validProfileIds = Array.isArray(profilesIds)
|
|
8857
|
+
? profilesIds.filter(function (id) { return !isNaN(id) && id > 0; })
|
|
8858
|
+
: [];
|
|
8859
|
+
// Step 3: Set the profiles for the user
|
|
8860
|
+
return [4 /*yield*/, setProfilesToUser({
|
|
8861
|
+
UserId: userUpdatedId,
|
|
8862
|
+
profileIds: validProfileIds,
|
|
8863
|
+
})];
|
|
8864
|
+
case 2:
|
|
8865
|
+
// Step 3: Set the profiles for the user
|
|
8841
8866
|
_a.sent();
|
|
8842
|
-
|
|
8843
|
-
if (currentLoggedUserId === userUpdatedId && defaultAssetId) {
|
|
8844
|
-
selectedArea = areasList.find(function (area) { return (area === null || area === void 0 ? void 0 : area.AssetId) === defaultAssetId; });
|
|
8845
|
-
if (selectedArea) {
|
|
8846
|
-
setDefaultAreaId(defaultAssetId);
|
|
8847
|
-
setDefaultAreaName(selectedArea.AssetName);
|
|
8848
|
-
}
|
|
8849
|
-
}
|
|
8850
|
-
onHide(true);
|
|
8851
|
-
setOpen(true);
|
|
8852
|
-
return [2 /*return*/];
|
|
8867
|
+
return [2 /*return*/, userUpdatedId];
|
|
8853
8868
|
}
|
|
8854
8869
|
});
|
|
8855
8870
|
}); },
|
|
8871
|
+
onSuccess: function (userUpdatedId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8872
|
+
var currentLoggedUserId, selectedArea;
|
|
8873
|
+
return __generator(this, function (_a) {
|
|
8874
|
+
currentLoggedUserId = getUserId();
|
|
8875
|
+
if (currentLoggedUserId === userUpdatedId && defaultAssetId) {
|
|
8876
|
+
selectedArea = areasList.find(function (area) { return (area === null || area === void 0 ? void 0 : area.AssetId) === defaultAssetId; });
|
|
8877
|
+
if (selectedArea) {
|
|
8878
|
+
setDefaultAreaId(defaultAssetId);
|
|
8879
|
+
setDefaultAreaName(selectedArea.AssetName);
|
|
8880
|
+
}
|
|
8881
|
+
}
|
|
8882
|
+
onHide(true);
|
|
8883
|
+
setOpen(true);
|
|
8884
|
+
return [2 /*return*/];
|
|
8885
|
+
});
|
|
8886
|
+
}); },
|
|
8856
8887
|
onError: function (error) {
|
|
8857
8888
|
setError(error.message);
|
|
8858
8889
|
},
|
|
@@ -8879,7 +8910,13 @@ var EditUser = function (_a) {
|
|
|
8879
8910
|
if (isSuccess) {
|
|
8880
8911
|
var userSelected = rows ? rows[0] : null;
|
|
8881
8912
|
if (userSelected) {
|
|
8882
|
-
var
|
|
8913
|
+
var profilesIdsString = ((_a = userSelected.ProfilesId) === null || _a === void 0 ? void 0 : _a.toString()) || "";
|
|
8914
|
+
var profilesIds_1 = profilesIdsString
|
|
8915
|
+
.split(",")
|
|
8916
|
+
.map(function (pId) { return pId.trim(); })
|
|
8917
|
+
.filter(function (pId) { return pId !== ""; })
|
|
8918
|
+
.map(function (pId) { return parseInt(pId); })
|
|
8919
|
+
.filter(function (pId) { return !isNaN(pId); });
|
|
8883
8920
|
setValue("UserId", userSelected.UserId);
|
|
8884
8921
|
setValue("UserName", userSelected.UserName);
|
|
8885
8922
|
setValue("FirstName", userSelected.FirstName);
|
|
@@ -8888,7 +8925,7 @@ var EditUser = function (_a) {
|
|
|
8888
8925
|
setValue("IsActive", userSelected.IsActive);
|
|
8889
8926
|
setValue("LastLogin", userSelected.LastLogin);
|
|
8890
8927
|
setValue("DefaultAssetId", userSelected.DefaultAssetId);
|
|
8891
|
-
setValue("ProfilesId", profilesIds_1
|
|
8928
|
+
setValue("ProfilesId", profilesIds_1);
|
|
8892
8929
|
}
|
|
8893
8930
|
}
|
|
8894
8931
|
}
|