@dexteel/mesf-core 7.13.2 → 7.14.0
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 +20 -0
- package/dist/configuration/pages/job/repositories/JobsRepository.d.ts +1 -1
- package/dist/configuration/pages/log/LogsPage.d.ts +0 -8
- package/dist/configuration/pages/log/models/Tag.d.ts +1 -0
- package/dist/configuration/pages/log/repositories/LogsRepository.d.ts +1 -1
- package/dist/configuration/pages/log/repositories/TagsRepository.d.ts +2 -2
- package/dist/configuration/pages/profiles/repositories/ProfilesRepository.d.ts +5 -3
- package/dist/configuration/pages/realtime/repositories/config-repository.d.ts +1 -1
- package/dist/configuration/pages/shifCrew/repositories/ShiftsCrewsRepository.d.ts +1 -1
- package/dist/configuration/pages/users/repositories/UsersRepository.d.ts +4 -4
- package/dist/controls/asset-filter/repositories/AssetRepository.d.ts +1 -1
- package/dist/controls/shift-navigator/component/shift-navigator.control.d.ts +2 -1
- package/dist/controls/shift-selector/repositories/ShiftRepository.d.ts +3 -1
- package/dist/index.esm.js +150 -132
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/logbook/entry/repository/LogbookRepository.d.ts +4 -2
- package/dist/pages/logbook/report/repository/LogbookRepository.d.ts +2 -2
- package/dist/pages/section-logbook/entry/repository/LogbookRepository.d.ts +6 -5
- package/dist/pages/section-logbook/report/repository/LogbookRepository.d.ts +2 -3
- package/dist/pages/section-logbook/shared/repository/SectionRepository.d.ts +2 -3
- package/dist/pages/trendings-v2/components/chart/repository/TrendingRepositoryV2.d.ts +7 -3
- package/dist/repositorie/MESF-frontend-Repositorie.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1141,9 +1141,9 @@ class MESApiService {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
1143
|
|
|
1144
|
-
const getUsers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1144
|
+
const getUsers = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1145
1145
|
const apiService = new MESApiService();
|
|
1146
|
-
const resp = yield apiService.callV2("[SEC].[GetUsers]", []);
|
|
1146
|
+
const resp = yield apiService.callV2("[SEC].[GetUsers]", [], signal);
|
|
1147
1147
|
if (resp.ok) {
|
|
1148
1148
|
return get(resp, "data.tables[0].rows", []);
|
|
1149
1149
|
}
|
|
@@ -1151,13 +1151,13 @@ const getUsers = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
1151
1151
|
throw new Error(resp.message || "Error fetching users");
|
|
1152
1152
|
}
|
|
1153
1153
|
});
|
|
1154
|
-
const getDataUser = (
|
|
1154
|
+
const getDataUser = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1155
1155
|
const apiService = new MESApiService();
|
|
1156
1156
|
const parameters = [
|
|
1157
|
-
{ name: "UserId", value: userId },
|
|
1157
|
+
{ name: "UserId", value: params.userId },
|
|
1158
1158
|
{ name: "UserName", value: null },
|
|
1159
1159
|
];
|
|
1160
|
-
const resp = yield apiService.callV2("[SEC].[GetUser]", parameters);
|
|
1160
|
+
const resp = yield apiService.callV2("[SEC].[GetUser]", parameters, signal);
|
|
1161
1161
|
if (resp.ok) {
|
|
1162
1162
|
return get(resp, "data.tables[0].rows", []);
|
|
1163
1163
|
}
|
|
@@ -1205,9 +1205,9 @@ const upsertUser = (user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
1205
1205
|
throw new Error(resp.message || "Error when upsert user data");
|
|
1206
1206
|
}
|
|
1207
1207
|
});
|
|
1208
|
-
const getAuthTypes = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1208
|
+
const getAuthTypes = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1209
1209
|
const apiService = new MESApiService();
|
|
1210
|
-
const resp = yield apiService.callV2("[SEC].[GetAuthTypes]", []);
|
|
1210
|
+
const resp = yield apiService.callV2("[SEC].[GetAuthTypes]", [], signal);
|
|
1211
1211
|
if (resp.ok) {
|
|
1212
1212
|
return get(resp, "data.tables[0].rows", 0);
|
|
1213
1213
|
}
|
|
@@ -1532,9 +1532,9 @@ const dxtServerTimeZone = () => TimeService.getInstance().getServerTimeZone;
|
|
|
1532
1532
|
const dxtToUTC = TimeService.getInstance().toUTC;
|
|
1533
1533
|
const dxtToLocalServerTime = TimeService.getInstance().toLocalServerTime;
|
|
1534
1534
|
|
|
1535
|
-
const getAssets$1 = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1535
|
+
const getAssets$1 = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1536
1536
|
const apiService = new MESApiService();
|
|
1537
|
-
const resp = yield apiService.callV2("[MES].[GetAssets]", []);
|
|
1537
|
+
const resp = yield apiService.callV2("[MES].[GetAssets]", [], signal);
|
|
1538
1538
|
if (resp.ok) {
|
|
1539
1539
|
return get(resp, "data.tables[0].rows", []);
|
|
1540
1540
|
}
|
|
@@ -1542,9 +1542,9 @@ const getAssets$1 = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
1542
1542
|
throw new Error(resp.message || "Error fetching assets");
|
|
1543
1543
|
}
|
|
1544
1544
|
});
|
|
1545
|
-
const getUTLSettings = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1545
|
+
const getUTLSettings = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1546
1546
|
const apiService = new MESApiService();
|
|
1547
|
-
const resp = yield apiService.callV2("[UTL].[GetSettings]", []);
|
|
1547
|
+
const resp = yield apiService.callV2("[UTL].[GetSettings]", [], signal);
|
|
1548
1548
|
if (resp.ok) {
|
|
1549
1549
|
return get(resp, "data.tables[0].rows", []);
|
|
1550
1550
|
}
|
|
@@ -1564,7 +1564,7 @@ const upsertDefaultAreaId = (UserId, DefaultAreaId) => __awaiter(void 0, void 0,
|
|
|
1564
1564
|
const useSearchAssets = () => {
|
|
1565
1565
|
return useQuery({
|
|
1566
1566
|
queryKey: ["assets"],
|
|
1567
|
-
queryFn: () => getAssets$1(),
|
|
1567
|
+
queryFn: ({ signal }) => getAssets$1(signal),
|
|
1568
1568
|
});
|
|
1569
1569
|
};
|
|
1570
1570
|
|
|
@@ -3254,7 +3254,7 @@ const AssetSelector = ({ value, onChange, disabled = false, }) => {
|
|
|
3254
3254
|
const searchAuthTypes = () => {
|
|
3255
3255
|
return useQuery({
|
|
3256
3256
|
queryKey: ["authTypes"],
|
|
3257
|
-
queryFn: () => getAuthTypes(),
|
|
3257
|
+
queryFn: ({ signal }) => getAuthTypes(signal),
|
|
3258
3258
|
});
|
|
3259
3259
|
};
|
|
3260
3260
|
const ITEM_HEIGHT$1 = 48;
|
|
@@ -3306,9 +3306,9 @@ const AuthTypeSelector = ({ value, onChange, disabled }) => {
|
|
|
3306
3306
|
};
|
|
3307
3307
|
|
|
3308
3308
|
//fx obtener profiles
|
|
3309
|
-
const getProfiles = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3309
|
+
const getProfiles = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3310
3310
|
const apiService = new MESApiService();
|
|
3311
|
-
const resp = yield apiService.callV2("[SEC].[GetProfiles]", []);
|
|
3311
|
+
const resp = yield apiService.callV2("[SEC].[GetProfiles]", [], signal);
|
|
3312
3312
|
if (resp.ok) {
|
|
3313
3313
|
return get(resp, "data.tables[0].rows", []);
|
|
3314
3314
|
}
|
|
@@ -3328,10 +3328,10 @@ const upsertProfile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ Profi
|
|
|
3328
3328
|
}
|
|
3329
3329
|
});
|
|
3330
3330
|
// PROFILES PROCEDURES
|
|
3331
|
-
const getActions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3331
|
+
const getActions = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3332
3332
|
const apiService = new MESApiService();
|
|
3333
3333
|
const parameters = [];
|
|
3334
|
-
const resp = yield apiService.callV2("[SEC].[GetActions]", parameters);
|
|
3334
|
+
const resp = yield apiService.callV2("[SEC].[GetActions]", parameters, signal);
|
|
3335
3335
|
if (resp.ok) {
|
|
3336
3336
|
return get(resp, "data.tables[0].rows", []);
|
|
3337
3337
|
}
|
|
@@ -3339,10 +3339,12 @@ const getActions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
3339
3339
|
throw new Error(resp.message || "Error fetching actions");
|
|
3340
3340
|
}
|
|
3341
3341
|
});
|
|
3342
|
-
const getActionsByProfileId = (
|
|
3342
|
+
const getActionsByProfileId = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3343
3343
|
const apiService = new MESApiService();
|
|
3344
|
-
const parameters = [
|
|
3345
|
-
|
|
3344
|
+
const parameters = [
|
|
3345
|
+
{ name: "ProfileId", value: params.profileId },
|
|
3346
|
+
];
|
|
3347
|
+
const resp = yield apiService.callV2("[SEC].[GetActionsByProfileId]", parameters, signal);
|
|
3346
3348
|
if (resp.ok) {
|
|
3347
3349
|
return get(resp, "data.tables[0].rows", []);
|
|
3348
3350
|
}
|
|
@@ -3604,7 +3606,7 @@ const DeleteProfile = ({ profile, show, onHide, suffixTitle, }) => {
|
|
|
3604
3606
|
const searchActions = () => {
|
|
3605
3607
|
return useQuery({
|
|
3606
3608
|
queryKey: ["actions"],
|
|
3607
|
-
queryFn: () => getActions(),
|
|
3609
|
+
queryFn: ({ signal }) => getActions(signal),
|
|
3608
3610
|
});
|
|
3609
3611
|
};
|
|
3610
3612
|
const DataTable = ({ actionsOfProfile, onSelectionChanged }) => {
|
|
@@ -3698,9 +3700,9 @@ const DataTable = ({ actionsOfProfile, onSelectionChanged }) => {
|
|
|
3698
3700
|
const searchActionsOfProfile = ({ profileId, }) => {
|
|
3699
3701
|
return useQuery({
|
|
3700
3702
|
queryKey: ["actions", profileId],
|
|
3701
|
-
queryFn: () => {
|
|
3703
|
+
queryFn: ({ signal }) => {
|
|
3702
3704
|
if (profileId) {
|
|
3703
|
-
return getActionsByProfileId(profileId);
|
|
3705
|
+
return getActionsByProfileId({ profileId }, signal);
|
|
3704
3706
|
}
|
|
3705
3707
|
else {
|
|
3706
3708
|
return [];
|
|
@@ -3960,7 +3962,7 @@ const useTableData$7 = ({ setProfileId, setModalProceduresProfile, setModalDelet
|
|
|
3960
3962
|
const useSearchProfiles = () => {
|
|
3961
3963
|
return useQuery({
|
|
3962
3964
|
queryKey: ["profiles"],
|
|
3963
|
-
queryFn: () => getProfiles(),
|
|
3965
|
+
queryFn: ({ signal }) => getProfiles(signal),
|
|
3964
3966
|
});
|
|
3965
3967
|
};
|
|
3966
3968
|
const TableProfiles = () => {
|
|
@@ -4065,7 +4067,7 @@ const TableProfiles = () => {
|
|
|
4065
4067
|
const searchProfiles = () => {
|
|
4066
4068
|
return useQuery({
|
|
4067
4069
|
queryKey: ["profiles"],
|
|
4068
|
-
queryFn: () => getProfiles(),
|
|
4070
|
+
queryFn: ({ signal }) => getProfiles(signal),
|
|
4069
4071
|
});
|
|
4070
4072
|
};
|
|
4071
4073
|
const Profiles = () => {
|
|
@@ -4222,7 +4224,7 @@ const CreateUser = ({ show, onHide, suffixTitle }) => {
|
|
|
4222
4224
|
const useSearchUser = ({ userId }) => {
|
|
4223
4225
|
return useQuery({
|
|
4224
4226
|
queryKey: ["user", userId],
|
|
4225
|
-
queryFn: () => getDataUser({ userId: userId }),
|
|
4227
|
+
queryFn: ({ signal }) => getDataUser({ userId: userId }, signal),
|
|
4226
4228
|
enabled: !!userId,
|
|
4227
4229
|
});
|
|
4228
4230
|
};
|
|
@@ -4855,7 +4857,7 @@ const useUsersOptionsFunctions = ({ setUserId, setShowEditModal, setShowDeleteMo
|
|
|
4855
4857
|
const useSearchUsers = () => {
|
|
4856
4858
|
return useQuery({
|
|
4857
4859
|
queryKey: ["users"],
|
|
4858
|
-
queryFn: () => getUsers(),
|
|
4860
|
+
queryFn: ({ signal }) => getUsers(signal),
|
|
4859
4861
|
});
|
|
4860
4862
|
};
|
|
4861
4863
|
const TableUsers = () => {
|
|
@@ -4984,7 +4986,7 @@ const TableUsers = () => {
|
|
|
4984
4986
|
const searchUser = ({ userId }) => {
|
|
4985
4987
|
return useQuery({
|
|
4986
4988
|
queryKey: ["user", userId],
|
|
4987
|
-
queryFn: () => getDataUser({ userId: userId }),
|
|
4989
|
+
queryFn: ({ signal }) => getDataUser({ userId: userId }, signal),
|
|
4988
4990
|
enabled: !!userId,
|
|
4989
4991
|
});
|
|
4990
4992
|
};
|
|
@@ -6753,9 +6755,9 @@ const ExcelIcon = (props) => {
|
|
|
6753
6755
|
};
|
|
6754
6756
|
|
|
6755
6757
|
//const moment = getMomentTz();
|
|
6756
|
-
const getJobs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
6758
|
+
const getJobs = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6757
6759
|
const apiService = new MESApiService();
|
|
6758
|
-
const resp = yield apiService.callV2("[SYSTEM].[GetJobsStatus]", []);
|
|
6760
|
+
const resp = yield apiService.callV2("[SYSTEM].[GetJobsStatus]", [], signal);
|
|
6759
6761
|
if (resp.ok) {
|
|
6760
6762
|
let rows = get(resp, "data.tables[0].rows", []);
|
|
6761
6763
|
rows = rows.map((job) => (Object.assign(Object.assign({}, job), { LastStarted: job.LastStarted
|
|
@@ -7131,7 +7133,7 @@ const useJobsTableData = ({ setShowModal, setJobSelected, showContextMenu, }) =>
|
|
|
7131
7133
|
const useSearchJobs = () => {
|
|
7132
7134
|
return useQuery({
|
|
7133
7135
|
queryKey: ["jobs"],
|
|
7134
|
-
queryFn: () => getJobs(),
|
|
7136
|
+
queryFn: ({ signal }) => getJobs(signal),
|
|
7135
7137
|
});
|
|
7136
7138
|
};
|
|
7137
7139
|
const CustomStatusPanel$1 = ({ handleNew }) => (React.createElement(IconButton$1, { onClick: handleNew, color: "primary", style: { marginLeft: -15 } },
|
|
@@ -7341,29 +7343,28 @@ const JobsPage = (props) => {
|
|
|
7341
7343
|
React.createElement(Jobs, null)));
|
|
7342
7344
|
};
|
|
7343
7345
|
|
|
7344
|
-
|
|
7345
|
-
const getLogTags = (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7346
|
+
const getLogTags = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7346
7347
|
var _a;
|
|
7347
7348
|
const apiService = new MESApiService();
|
|
7348
7349
|
const tomorrow = new Date();
|
|
7349
7350
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
7350
|
-
const parameters =
|
|
7351
|
+
const parameters = params
|
|
7351
7352
|
? [
|
|
7352
|
-
{ name: "Start", value:
|
|
7353
|
-
{ name: "End", value: (_a =
|
|
7353
|
+
{ name: "Start", value: params.startDate },
|
|
7354
|
+
{ name: "End", value: (_a = params.endDate) !== null && _a !== void 0 ? _a : tomorrow },
|
|
7354
7355
|
{
|
|
7355
7356
|
name: "LogTypeCode",
|
|
7356
|
-
value:
|
|
7357
|
+
value: params.logTypeCode === "A" ? null : params.logTypeCode,
|
|
7357
7358
|
},
|
|
7358
7359
|
{
|
|
7359
7360
|
name: "TagFilters",
|
|
7360
|
-
value:
|
|
7361
|
-
? JSON.stringify(
|
|
7361
|
+
value: params.tagFilters.length > 0
|
|
7362
|
+
? JSON.stringify(params.tagFilters)
|
|
7362
7363
|
: null,
|
|
7363
7364
|
},
|
|
7364
7365
|
]
|
|
7365
7366
|
: [];
|
|
7366
|
-
const resp = yield apiService.callV2("[SYSTEM].[GetLogTags]", parameters);
|
|
7367
|
+
const resp = yield apiService.callV2("[SYSTEM].[GetLogTags]", parameters, signal);
|
|
7367
7368
|
if (resp.ok) {
|
|
7368
7369
|
const rows = get(resp, "data.tables[0].rows", []);
|
|
7369
7370
|
return rows;
|
|
@@ -7372,24 +7373,23 @@ const getLogTags = (context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
7372
7373
|
throw new Error(resp.message || "Error fetching log tags");
|
|
7373
7374
|
}
|
|
7374
7375
|
});
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
var _a;
|
|
7376
|
+
const getLogTagValues = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7377
|
+
var _a, _b;
|
|
7378
7378
|
const apiService = new MESApiService();
|
|
7379
7379
|
const tomorrow = new Date();
|
|
7380
7380
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
7381
7381
|
// When getting values for a tag, exclude that tag from the filter context
|
|
7382
7382
|
// so we show all possible values that match the OTHER filters
|
|
7383
|
-
const otherTagFilters =
|
|
7383
|
+
const otherTagFilters = params === null || params === void 0 ? void 0 : params.tagFilters.filter((f) => f.TagName !== params.tagName);
|
|
7384
7384
|
const parameters = [
|
|
7385
|
-
{ name: "TagName", value: tagName },
|
|
7386
|
-
...(
|
|
7385
|
+
{ name: "TagName", value: (_a = params === null || params === void 0 ? void 0 : params.tagName) !== null && _a !== void 0 ? _a : "" },
|
|
7386
|
+
...(params
|
|
7387
7387
|
? [
|
|
7388
|
-
{ name: "Start", value:
|
|
7389
|
-
{ name: "End", value: (
|
|
7388
|
+
{ name: "Start", value: params.startDate },
|
|
7389
|
+
{ name: "End", value: (_b = params.endDate) !== null && _b !== void 0 ? _b : tomorrow },
|
|
7390
7390
|
{
|
|
7391
7391
|
name: "LogTypeCode",
|
|
7392
|
-
value:
|
|
7392
|
+
value: params.logTypeCode === "A" ? null : params.logTypeCode,
|
|
7393
7393
|
},
|
|
7394
7394
|
{
|
|
7395
7395
|
name: "TagFilters",
|
|
@@ -7400,7 +7400,7 @@ const getLogTagValues = (tagName, context) => __awaiter(void 0, void 0, void 0,
|
|
|
7400
7400
|
]
|
|
7401
7401
|
: []),
|
|
7402
7402
|
];
|
|
7403
|
-
const resp = yield apiService.callV2("[SYSTEM].[GetLogTagValues]", parameters);
|
|
7403
|
+
const resp = yield apiService.callV2("[SYSTEM].[GetLogTagValues]", parameters, signal);
|
|
7404
7404
|
if (resp.ok) {
|
|
7405
7405
|
const rows = get(resp, "data.tables[0].rows", []);
|
|
7406
7406
|
return rows;
|
|
@@ -7419,9 +7419,11 @@ const useSearchLogTags = ({ startDate, endDate, logTypeCode, tagFilters, }) => {
|
|
|
7419
7419
|
startDate.getTime(),
|
|
7420
7420
|
endDate === null || endDate === void 0 ? void 0 : endDate.getTime(),
|
|
7421
7421
|
logTypeCode,
|
|
7422
|
-
tagFilters,
|
|
7422
|
+
JSON.stringify(tagFilters),
|
|
7423
7423
|
],
|
|
7424
|
-
queryFn: () => getLogTags({ startDate, endDate, logTypeCode, tagFilters }),
|
|
7424
|
+
queryFn: ({ signal }) => getLogTags({ startDate, endDate, logTypeCode, tagFilters }, signal),
|
|
7425
|
+
enabled: !!startDate,
|
|
7426
|
+
staleTime: 10000,
|
|
7425
7427
|
});
|
|
7426
7428
|
};
|
|
7427
7429
|
const useSearchLogTagValues = ({ tagName, startDate, endDate, logTypeCode, tagFilters, }) => {
|
|
@@ -7429,13 +7431,14 @@ const useSearchLogTagValues = ({ tagName, startDate, endDate, logTypeCode, tagFi
|
|
|
7429
7431
|
queryKey: [
|
|
7430
7432
|
"logTagValues",
|
|
7431
7433
|
tagName,
|
|
7432
|
-
startDate,
|
|
7433
|
-
endDate,
|
|
7434
|
+
startDate.getTime(),
|
|
7435
|
+
endDate === null || endDate === void 0 ? void 0 : endDate.getTime(),
|
|
7434
7436
|
logTypeCode,
|
|
7435
|
-
tagFilters,
|
|
7437
|
+
JSON.stringify(tagFilters),
|
|
7436
7438
|
],
|
|
7437
|
-
queryFn: () => getLogTagValues(tagName,
|
|
7439
|
+
queryFn: ({ signal }) => getLogTagValues({ tagName, startDate, endDate, logTypeCode, tagFilters }, signal),
|
|
7438
7440
|
enabled: !!tagName,
|
|
7441
|
+
staleTime: 10000,
|
|
7439
7442
|
});
|
|
7440
7443
|
};
|
|
7441
7444
|
const TagFilter = ({ tagFilters, setTagFilters, filterContext, }) => {
|
|
@@ -7726,18 +7729,20 @@ const useLogTableData = () => {
|
|
|
7726
7729
|
};
|
|
7727
7730
|
|
|
7728
7731
|
//fx obtener logs
|
|
7729
|
-
const getLogs = (
|
|
7732
|
+
const getLogs = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7730
7733
|
const apiService = new MESApiService();
|
|
7731
7734
|
const tomorrow = new Date();
|
|
7732
7735
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
7733
|
-
const end = endDate ? endDate : tomorrow;
|
|
7734
|
-
const tagFiltersJson = tagFilters && tagFilters.length > 0
|
|
7736
|
+
const end = params.endDate ? params.endDate : tomorrow;
|
|
7737
|
+
const tagFiltersJson = params.tagFilters && params.tagFilters.length > 0
|
|
7738
|
+
? JSON.stringify(params.tagFilters)
|
|
7739
|
+
: null;
|
|
7735
7740
|
const parameters = [
|
|
7736
|
-
{ name: "Start", value: startDate },
|
|
7741
|
+
{ name: "Start", value: params.startDate },
|
|
7737
7742
|
{ name: "End", value: end },
|
|
7738
7743
|
{
|
|
7739
7744
|
name: "LogTypeCode",
|
|
7740
|
-
value: logTypeCode === "A" ? null : logTypeCode,
|
|
7745
|
+
value: params.logTypeCode === "A" ? null : params.logTypeCode,
|
|
7741
7746
|
},
|
|
7742
7747
|
{ name: "TagFilters", value: tagFiltersJson },
|
|
7743
7748
|
];
|
|
@@ -7852,14 +7857,22 @@ const useLogsOptionsFunctions = ({ setSelectedLog, setShowLogModal, handleResetB
|
|
|
7852
7857
|
|
|
7853
7858
|
const useSearchLogs = ({ startDate, endDate, logTypeCode, autoRefresh, tagFilters, }) => {
|
|
7854
7859
|
return useQuery({
|
|
7855
|
-
queryKey: [
|
|
7856
|
-
|
|
7860
|
+
queryKey: [
|
|
7861
|
+
"logs",
|
|
7862
|
+
startDate.getTime(),
|
|
7863
|
+
endDate === null || endDate === void 0 ? void 0 : endDate.getTime(),
|
|
7864
|
+
logTypeCode,
|
|
7865
|
+
JSON.stringify(tagFilters),
|
|
7866
|
+
],
|
|
7867
|
+
queryFn: ({ signal }) => getLogs({
|
|
7857
7868
|
startDate,
|
|
7858
7869
|
endDate,
|
|
7859
7870
|
logTypeCode,
|
|
7860
7871
|
tagFilters,
|
|
7861
7872
|
}),
|
|
7862
7873
|
refetchInterval: autoRefresh ? 5000 : false,
|
|
7874
|
+
enabled: !!startDate && (!!endDate || autoRefresh),
|
|
7875
|
+
staleTime: 10000,
|
|
7863
7876
|
});
|
|
7864
7877
|
};
|
|
7865
7878
|
const getLogTypeByCodeId = (logTypeCodeId) => {
|
|
@@ -7944,6 +7957,12 @@ const TableLogs = () => {
|
|
|
7944
7957
|
setShowLogModal,
|
|
7945
7958
|
handleResetButtonClick,
|
|
7946
7959
|
});
|
|
7960
|
+
const filterContext = useMemo(() => ({
|
|
7961
|
+
startDate,
|
|
7962
|
+
endDate,
|
|
7963
|
+
logTypeCode: logTypeCode.join(","),
|
|
7964
|
+
tagFilters,
|
|
7965
|
+
}), [startDate, endDate, logTypeCode, tagFilters]);
|
|
7947
7966
|
useEffect(() => {
|
|
7948
7967
|
registerConfig({
|
|
7949
7968
|
id: "TableLogs",
|
|
@@ -8011,12 +8030,7 @@ const TableLogs = () => {
|
|
|
8011
8030
|
React.createElement(Grid2, { size: { md: 1, xs: 12 }, style: { paddingTop: 8 } },
|
|
8012
8031
|
React.createElement(Button, { variant: "contained", color: "inherit", onClick: handleResetButtonClick, fullWidth: true }, "Reset")),
|
|
8013
8032
|
React.createElement(Grid2, { size: { md: 12, xs: 12 }, sx: { mt: 1 } },
|
|
8014
|
-
React.createElement(TagFilter, { tagFilters: tagFilters, setTagFilters: setTagFilters, filterContext:
|
|
8015
|
-
startDate,
|
|
8016
|
-
endDate,
|
|
8017
|
-
logTypeCode: logTypeCode.join(","),
|
|
8018
|
-
tagFilters,
|
|
8019
|
-
} })))))),
|
|
8033
|
+
React.createElement(TagFilter, { tagFilters: tagFilters, setTagFilters: setTagFilters, filterContext: filterContext })))))),
|
|
8020
8034
|
React.createElement(Grid2, { size: { md: 12, xs: 12 }, style: {
|
|
8021
8035
|
height: "70vh",
|
|
8022
8036
|
} },
|
|
@@ -8044,9 +8058,9 @@ const ProfilesPage = (props) => {
|
|
|
8044
8058
|
return React.createElement(Profiles, null);
|
|
8045
8059
|
};
|
|
8046
8060
|
|
|
8047
|
-
const getShiftParameters = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8061
|
+
const getShiftParameters = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8048
8062
|
const apiService = new MESApiService();
|
|
8049
|
-
const resp = yield apiService.callV2("[MES].[GetShiftParameters]", []);
|
|
8063
|
+
const resp = yield apiService.callV2("[MES].[GetShiftParameters]", [], signal);
|
|
8050
8064
|
if (resp.ok) {
|
|
8051
8065
|
return get(resp, "data.tables[0].rows", []);
|
|
8052
8066
|
}
|
|
@@ -8755,7 +8769,7 @@ const useTableData$5 = ({ setShiftSelected, setOpenModalEditShift, setOpenModalD
|
|
|
8755
8769
|
const useSearchShifts = () => {
|
|
8756
8770
|
return useQuery({
|
|
8757
8771
|
queryKey: ["shifts"],
|
|
8758
|
-
queryFn: () => getShiftParameters(),
|
|
8772
|
+
queryFn: ({ signal }) => getShiftParameters(signal),
|
|
8759
8773
|
});
|
|
8760
8774
|
};
|
|
8761
8775
|
const TableShiftsCrews = () => {
|
|
@@ -9412,7 +9426,7 @@ const EditSetting = ({ settingSelected, show, onHide, suffixTitle, }) => {
|
|
|
9412
9426
|
const useSearchSettings = () => {
|
|
9413
9427
|
return useQuery({
|
|
9414
9428
|
queryKey: ["settings"],
|
|
9415
|
-
queryFn: () => getUTLSettings(),
|
|
9429
|
+
queryFn: ({ signal }) => getUTLSettings(signal),
|
|
9416
9430
|
});
|
|
9417
9431
|
};
|
|
9418
9432
|
const TableSettings = () => {
|
|
@@ -9507,7 +9521,7 @@ const TableSettings = () => {
|
|
|
9507
9521
|
const searchSettings = () => {
|
|
9508
9522
|
return useQuery({
|
|
9509
9523
|
queryKey: ["settings"],
|
|
9510
|
-
queryFn: () => getUTLSettings(),
|
|
9524
|
+
queryFn: ({ signal }) => getUTLSettings(signal),
|
|
9511
9525
|
});
|
|
9512
9526
|
};
|
|
9513
9527
|
const SettingsPage = () => {
|
|
@@ -9813,9 +9827,9 @@ const ChatComponent = () => {
|
|
|
9813
9827
|
React__default.createElement(Button, { type: "submit", variant: "contained", color: "primary", disabled: !connectionState.isConnected || !user || !message, endIcon: React__default.createElement(Send, null), fullWidth: true, size: "medium" }, "Send"))))));
|
|
9814
9828
|
};
|
|
9815
9829
|
|
|
9816
|
-
const getQueryCacheInvalidations = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
9830
|
+
const getQueryCacheInvalidations = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9817
9831
|
const apiService = new MESApiService();
|
|
9818
|
-
const resp = yield apiService.callV2("[SYSTEM].[GetQueryCacheInvalidations]", []);
|
|
9832
|
+
const resp = yield apiService.callV2("[SYSTEM].[GetQueryCacheInvalidations]", [], signal);
|
|
9819
9833
|
if (resp.ok) {
|
|
9820
9834
|
let cacheInvalidations = get(resp, "data.tables[0].rows", []);
|
|
9821
9835
|
let actions = get(resp, "data.tables[1].rows", []);
|
|
@@ -9848,7 +9862,7 @@ const upsertQueryCacheInvalidations = (_a) => __awaiter(void 0, [_a], void 0, fu
|
|
|
9848
9862
|
const searchQueryCacheInvalidations = () => {
|
|
9849
9863
|
return useQuery({
|
|
9850
9864
|
queryKey: ["queryCacheInvalidations"],
|
|
9851
|
-
queryFn: () => getQueryCacheInvalidations(),
|
|
9865
|
+
queryFn: ({ signal }) => getQueryCacheInvalidations(signal),
|
|
9852
9866
|
});
|
|
9853
9867
|
};
|
|
9854
9868
|
const QueryCacheInvalidations = () => {
|
|
@@ -10793,10 +10807,10 @@ const useSeriesMinMax = (series, tagIds) => {
|
|
|
10793
10807
|
|
|
10794
10808
|
const getIhPath = () => localStorage.getItem("ihPath") || "[mssql2022].[IH_100020].[ih]";
|
|
10795
10809
|
//tags
|
|
10796
|
-
const getTagsTree = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
10810
|
+
const getTagsTree = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10797
10811
|
const apiService = new MESApiService();
|
|
10798
10812
|
const parameters = [];
|
|
10799
|
-
const resp = yield apiService.callV2(getIhPath() + ".[GetTagsTree]", parameters);
|
|
10813
|
+
const resp = yield apiService.callV2(getIhPath() + ".[GetTagsTree]", parameters, signal);
|
|
10800
10814
|
if (resp.ok) {
|
|
10801
10815
|
return get(resp, "data.tables[0].rows", []);
|
|
10802
10816
|
}
|
|
@@ -10869,10 +10883,10 @@ const saveTagDefaults = (_a) => __awaiter(void 0, [_a], void 0, function* ({ tag
|
|
|
10869
10883
|
}
|
|
10870
10884
|
});
|
|
10871
10885
|
//views
|
|
10872
|
-
const getViews = (
|
|
10886
|
+
const getViews = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10873
10887
|
const apiService = new MESApiService();
|
|
10874
|
-
const parameters = [{ name: "Search", value: Search }];
|
|
10875
|
-
const resp = yield apiService.callV2(getIhPath() + ".[GetViews]", parameters);
|
|
10888
|
+
const parameters = [{ name: "Search", value: params.Search }];
|
|
10889
|
+
const resp = yield apiService.callV2(getIhPath() + ".[GetViews]", parameters, signal);
|
|
10876
10890
|
if (resp.ok) {
|
|
10877
10891
|
return get(resp, "data.tables[0].rows", []);
|
|
10878
10892
|
}
|
|
@@ -10904,10 +10918,10 @@ const deleteView = (ViewId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
10904
10918
|
}
|
|
10905
10919
|
});
|
|
10906
10920
|
//viewTags
|
|
10907
|
-
const getViewTags = (
|
|
10921
|
+
const getViewTags = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10908
10922
|
const apiService = new MESApiService();
|
|
10909
|
-
const parameters = [{ name: "ViewId", value:
|
|
10910
|
-
const resp = yield apiService.callV2(getIhPath() + ".[GetViewTags]", parameters);
|
|
10923
|
+
const parameters = [{ name: "ViewId", value: params.viewId }];
|
|
10924
|
+
const resp = yield apiService.callV2(getIhPath() + ".[GetViewTags]", parameters, signal);
|
|
10911
10925
|
if (resp.ok) {
|
|
10912
10926
|
return get(resp, "data.tables[0].rows", []);
|
|
10913
10927
|
}
|
|
@@ -12200,7 +12214,7 @@ const CustomDragPreview = (props) => {
|
|
|
12200
12214
|
const useSearchTagsTree = () => {
|
|
12201
12215
|
return useQuery({
|
|
12202
12216
|
queryKey: ["tagsTree-v2"],
|
|
12203
|
-
queryFn: () => getTagsTree(),
|
|
12217
|
+
queryFn: ({ signal }) => getTagsTree(signal),
|
|
12204
12218
|
enabled: false, // Only fetch when explicitly called
|
|
12205
12219
|
});
|
|
12206
12220
|
};
|
|
@@ -14934,16 +14948,16 @@ const TrendingChartV2 = ({ series = [], customOptions, isLoading = false, onChar
|
|
|
14934
14948
|
const useSearchViews = ({ autoRefresh = false, }) => {
|
|
14935
14949
|
return useQuery({
|
|
14936
14950
|
queryKey: ["views-v2"],
|
|
14937
|
-
queryFn: () => getViews(null),
|
|
14951
|
+
queryFn: ({ signal }) => getViews({ Search: null }, signal),
|
|
14938
14952
|
refetchInterval: autoRefresh ? 10000 : false,
|
|
14939
14953
|
});
|
|
14940
14954
|
};
|
|
14941
14955
|
const useSearchViewTags = ({ viewId }) => {
|
|
14942
14956
|
return useQuery({
|
|
14943
14957
|
queryKey: ["viewTags-v2", viewId],
|
|
14944
|
-
queryFn: () => {
|
|
14958
|
+
queryFn: ({ signal }) => {
|
|
14945
14959
|
if (viewId) {
|
|
14946
|
-
return getViewTags(viewId);
|
|
14960
|
+
return getViewTags({ viewId }, signal);
|
|
14947
14961
|
}
|
|
14948
14962
|
return [];
|
|
14949
14963
|
},
|
|
@@ -15480,13 +15494,13 @@ const upsertEntry$1 = (_a) => __awaiter(void 0, [_a], void 0, function* ({ asset
|
|
|
15480
15494
|
throw new Error(resp.message || "Error upserting entry");
|
|
15481
15495
|
}
|
|
15482
15496
|
});
|
|
15483
|
-
const deleteEntry$1 = (
|
|
15497
|
+
const deleteEntry$1 = (entryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15484
15498
|
const apiService = new MESApiService();
|
|
15485
15499
|
// First, get all attachments for this entry to identify files to delete
|
|
15486
15500
|
let attachmentsToDelete = [];
|
|
15487
15501
|
try {
|
|
15488
|
-
if (
|
|
15489
|
-
attachmentsToDelete = yield getEntryAttachments$1(
|
|
15502
|
+
if (entryId) {
|
|
15503
|
+
attachmentsToDelete = yield getEntryAttachments$1({ entryId });
|
|
15490
15504
|
}
|
|
15491
15505
|
}
|
|
15492
15506
|
catch (error) {
|
|
@@ -15494,7 +15508,7 @@ const deleteEntry$1 = (EntryId) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
15494
15508
|
console.warn("Failed to get attachments for entry deletion:", error);
|
|
15495
15509
|
}
|
|
15496
15510
|
// Delete the entry (this will cascade delete attachment records)
|
|
15497
|
-
const parameters = [{ name: "EntryId", value:
|
|
15511
|
+
const parameters = [{ name: "EntryId", value: entryId }];
|
|
15498
15512
|
const resp = yield apiService.callV2("[LB].[DeleteEntry]", parameters);
|
|
15499
15513
|
if (!resp.ok) {
|
|
15500
15514
|
throw new Error(resp.message || "Error deleting entry");
|
|
@@ -15529,9 +15543,11 @@ const deleteUploadFile$1 = (uploadFileId) => __awaiter(void 0, void 0, void 0, f
|
|
|
15529
15543
|
}
|
|
15530
15544
|
});
|
|
15531
15545
|
// Attachment management functions
|
|
15532
|
-
const getEntryAttachments$1 = (
|
|
15546
|
+
const getEntryAttachments$1 = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15533
15547
|
const apiService = new MESApiService();
|
|
15534
|
-
const parameters = [
|
|
15548
|
+
const parameters = [
|
|
15549
|
+
{ name: "EntryId", value: params.entryId },
|
|
15550
|
+
];
|
|
15535
15551
|
const resp = yield apiService.callV2("[LB].[GetEntryAttachments]", parameters);
|
|
15536
15552
|
if (resp.ok) {
|
|
15537
15553
|
let rows = get(resp, "data.tables[0].rows", []);
|
|
@@ -15819,9 +15835,9 @@ const RemoveEntryDialog$1 = ({ entry, show, onHide }) => {
|
|
|
15819
15835
|
React__default.createElement(ErrorModal, { error: error, onHide: () => setError("") })));
|
|
15820
15836
|
};
|
|
15821
15837
|
|
|
15822
|
-
const getAssets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
15838
|
+
const getAssets = (signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15823
15839
|
const apiService = new MESApiService();
|
|
15824
|
-
const resp = yield apiService.callV2("[MES].[GetAssets]", []);
|
|
15840
|
+
const resp = yield apiService.callV2("[MES].[GetAssets]", [], signal);
|
|
15825
15841
|
if (resp.ok) {
|
|
15826
15842
|
return get(resp, "data.tables[0].rows", []);
|
|
15827
15843
|
}
|
|
@@ -15833,7 +15849,7 @@ const getAssets = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
15833
15849
|
const useAssets = (onError) => {
|
|
15834
15850
|
return useQuery({
|
|
15835
15851
|
queryKey: ["assets"],
|
|
15836
|
-
queryFn: () => getAssets(),
|
|
15852
|
+
queryFn: ({ signal }) => getAssets(signal),
|
|
15837
15853
|
onError: onError,
|
|
15838
15854
|
});
|
|
15839
15855
|
};
|
|
@@ -15862,15 +15878,16 @@ const AssetsFilter = ({ label = "Asset", value, onChange, filterAreaAssets = fal
|
|
|
15862
15878
|
};
|
|
15863
15879
|
|
|
15864
15880
|
const moment$d = getMomentTz();
|
|
15865
|
-
const getShifts = (
|
|
15881
|
+
const getShifts = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15882
|
+
var _a;
|
|
15866
15883
|
const apiService = new MESApiService();
|
|
15867
15884
|
const parameters = [
|
|
15868
15885
|
{
|
|
15869
15886
|
name: "ShiftId",
|
|
15870
|
-
value: shiftId !== null &&
|
|
15887
|
+
value: (_a = params.shiftId) !== null && _a !== void 0 ? _a : null,
|
|
15871
15888
|
},
|
|
15872
15889
|
];
|
|
15873
|
-
const resp = yield apiService.callV2(`[MES].[GetShiftByParameters]`, parameters);
|
|
15890
|
+
const resp = yield apiService.callV2(`[MES].[GetShiftByParameters]`, parameters, signal);
|
|
15874
15891
|
if (resp.ok) {
|
|
15875
15892
|
let rows = get(resp, "data.tables[0].rows", []);
|
|
15876
15893
|
rows = rows.map((row) => {
|
|
@@ -15958,7 +15975,7 @@ const ShiftAutocomplete = ({ currentShiftId, value, onShiftSelected, disabled, s
|
|
|
15958
15975
|
const useShifts = (shiftId) => {
|
|
15959
15976
|
return useQuery({
|
|
15960
15977
|
queryKey: ["shifts", shiftId],
|
|
15961
|
-
queryFn: () => getShifts(shiftId),
|
|
15978
|
+
queryFn: ({ signal }) => getShifts({ shiftId }, signal),
|
|
15962
15979
|
});
|
|
15963
15980
|
};
|
|
15964
15981
|
const ShiftSelector = ({ label = "Shift - Crew", value, onChange = () => { }, fieldError, disabled = false, }) => {
|
|
@@ -16113,7 +16130,7 @@ const AttachmentModal$1 = ({ open, onClose, entryId, isEditing, entryData, onEnt
|
|
|
16113
16130
|
// Query for fetching attachments
|
|
16114
16131
|
const { data: attachments = [], isLoading, error: fetchError, } = useQuery({
|
|
16115
16132
|
queryKey: ["entryAttachments", currentEntryId],
|
|
16116
|
-
queryFn: () => getEntryAttachments$1(currentEntryId),
|
|
16133
|
+
queryFn: ({ signal }) => getEntryAttachments$1({ entryId: currentEntryId }),
|
|
16117
16134
|
enabled: !!currentEntryId && currentEntryId > 0,
|
|
16118
16135
|
});
|
|
16119
16136
|
// Mutations
|
|
@@ -16409,7 +16426,7 @@ const ContentInput$1 = ({ value, onChange, isEditing, UpdateTimestamp, UpdatedBy
|
|
|
16409
16426
|
// Query for fetching attachment count
|
|
16410
16427
|
const { data: attachments = [], error: attachmentError } = useQuery({
|
|
16411
16428
|
queryKey: ["entryAttachments", effectiveEntryId],
|
|
16412
|
-
queryFn: () => getEntryAttachments$1(effectiveEntryId),
|
|
16429
|
+
queryFn: ({ signal }) => getEntryAttachments$1({ entryId: effectiveEntryId }),
|
|
16413
16430
|
enabled: !!effectiveEntryId && effectiveEntryId > 0,
|
|
16414
16431
|
retry: 1,
|
|
16415
16432
|
onError: (err) => {
|
|
@@ -17128,14 +17145,14 @@ const MESFLogbookEntry$1 = () => {
|
|
|
17128
17145
|
};
|
|
17129
17146
|
|
|
17130
17147
|
const moment$9 = getMomentTz();
|
|
17131
|
-
const getEntriesReport$1 = (
|
|
17148
|
+
const getEntriesReport$1 = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17132
17149
|
const apiService = new MESApiService();
|
|
17133
17150
|
const parameters = [
|
|
17134
|
-
{ name: "StartShiftId", value: startShiftId },
|
|
17135
|
-
{ name: "EndShiftId", value: endShiftId },
|
|
17151
|
+
{ name: "StartShiftId", value: params.startShiftId },
|
|
17152
|
+
{ name: "EndShiftId", value: params.endShiftId },
|
|
17136
17153
|
];
|
|
17137
|
-
if (assetId) {
|
|
17138
|
-
parameters.push({ name: "AssetId", value: assetId });
|
|
17154
|
+
if (params.assetId) {
|
|
17155
|
+
parameters.push({ name: "AssetId", value: params.assetId });
|
|
17139
17156
|
}
|
|
17140
17157
|
const resp = yield apiService.callV2("[LB].[GetEntries]", parameters);
|
|
17141
17158
|
if (resp.ok) {
|
|
@@ -17155,7 +17172,7 @@ const getEntriesReport$1 = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
17155
17172
|
const useEntriesReport$1 = ({ startShiftId, endShiftId, assetId, }) => {
|
|
17156
17173
|
return useQuery({
|
|
17157
17174
|
queryKey: ["entriesReport", startShiftId, endShiftId, assetId],
|
|
17158
|
-
queryFn: () => getEntriesReport$1({ startShiftId, endShiftId, assetId }),
|
|
17175
|
+
queryFn: ({ signal }) => getEntriesReport$1({ startShiftId, endShiftId, assetId }),
|
|
17159
17176
|
enabled: !!startShiftId && !!endShiftId && !!assetId,
|
|
17160
17177
|
});
|
|
17161
17178
|
};
|
|
@@ -17742,14 +17759,14 @@ const useGridDefinitions = ({ OnEdit, OnSend }) => {
|
|
|
17742
17759
|
};
|
|
17743
17760
|
|
|
17744
17761
|
const moment$6 = getMomentTz();
|
|
17745
|
-
const getEntries = (
|
|
17762
|
+
const getEntries = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17746
17763
|
const apiService = new MESApiService();
|
|
17747
17764
|
const parameters = [
|
|
17748
|
-
{ name: "ShiftId", value: shiftId },
|
|
17765
|
+
{ name: "ShiftId", value: params.shiftId },
|
|
17749
17766
|
];
|
|
17750
17767
|
// Pass comma-separated sectionIds for multi-select filter
|
|
17751
|
-
if (sectionIds && sectionIds.length > 0) {
|
|
17752
|
-
parameters.push({ name: "SectionIds", value: sectionIds.join(",") });
|
|
17768
|
+
if (params.sectionIds && params.sectionIds.length > 0) {
|
|
17769
|
+
parameters.push({ name: "SectionIds", value: params.sectionIds.join(",") });
|
|
17753
17770
|
}
|
|
17754
17771
|
// Use SWV.GetSectionLogbookEntries which extends LB.GetEntries with section info
|
|
17755
17772
|
const resp = yield apiService.callV2("[SWV].[GetSectionLogbookEntries]", parameters, signal);
|
|
@@ -17794,13 +17811,13 @@ const upsertEntry = (_a) => __awaiter(void 0, [_a], void 0, function* ({ assetId
|
|
|
17794
17811
|
throw new Error(resp.message || "Error upserting entry");
|
|
17795
17812
|
}
|
|
17796
17813
|
});
|
|
17797
|
-
const deleteEntry = (
|
|
17814
|
+
const deleteEntry = (entryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17798
17815
|
const apiService = new MESApiService();
|
|
17799
17816
|
// First, get all attachments for this entry to identify files to delete
|
|
17800
17817
|
let attachmentsToDelete = [];
|
|
17801
17818
|
try {
|
|
17802
|
-
if (
|
|
17803
|
-
attachmentsToDelete = yield getEntryAttachments(
|
|
17819
|
+
if (entryId) {
|
|
17820
|
+
attachmentsToDelete = yield getEntryAttachments({ entryId });
|
|
17804
17821
|
}
|
|
17805
17822
|
}
|
|
17806
17823
|
catch (error) {
|
|
@@ -17808,7 +17825,7 @@ const deleteEntry = (EntryId) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
17808
17825
|
console.warn("Failed to get attachments for entry deletion:", error);
|
|
17809
17826
|
}
|
|
17810
17827
|
// Delete the entry (this will cascade delete attachment records)
|
|
17811
|
-
const parameters = [{ name: "EntryId", value:
|
|
17828
|
+
const parameters = [{ name: "EntryId", value: entryId }];
|
|
17812
17829
|
const resp = yield apiService.callV2("[LB].[DeleteEntry]", parameters);
|
|
17813
17830
|
if (!resp.ok) {
|
|
17814
17831
|
throw new Error(resp.message || "Error deleting entry");
|
|
@@ -17843,9 +17860,11 @@ const deleteUploadFile = (uploadFileId) => __awaiter(void 0, void 0, void 0, fun
|
|
|
17843
17860
|
}
|
|
17844
17861
|
});
|
|
17845
17862
|
// Attachment management functions
|
|
17846
|
-
const getEntryAttachments = (
|
|
17863
|
+
const getEntryAttachments = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17847
17864
|
const apiService = new MESApiService();
|
|
17848
|
-
const parameters = [
|
|
17865
|
+
const parameters = [
|
|
17866
|
+
{ name: "EntryId", value: params.entryId },
|
|
17867
|
+
];
|
|
17849
17868
|
const resp = yield apiService.callV2("[LB].[GetEntryAttachments]", parameters);
|
|
17850
17869
|
if (resp.ok) {
|
|
17851
17870
|
let rows = get(resp, "data.tables[0].rows", []);
|
|
@@ -17909,7 +17928,7 @@ const deleteUploadFileInBackground = (uploadFileId) => __awaiter(void 0, void 0,
|
|
|
17909
17928
|
const useEntries = ({ shiftId, sectionIds }) => {
|
|
17910
17929
|
return useQuery({
|
|
17911
17930
|
queryKey: ["entries", shiftId, sectionIds],
|
|
17912
|
-
queryFn: ({ signal }) => getEntries({ shiftId, sectionIds, signal
|
|
17931
|
+
queryFn: ({ signal }) => getEntries({ shiftId, sectionIds }, signal),
|
|
17913
17932
|
});
|
|
17914
17933
|
};
|
|
17915
17934
|
const routeLogbookEntry = "/logbook/entry";
|
|
@@ -18437,7 +18456,7 @@ const AttachmentModal = ({ open, onClose, entryId, isEditing, entryData, onEntry
|
|
|
18437
18456
|
// Query for fetching attachments
|
|
18438
18457
|
const { data: attachments = [], isLoading, error: fetchError, } = useQuery({
|
|
18439
18458
|
queryKey: ["entryAttachments", currentEntryId],
|
|
18440
|
-
queryFn: () => getEntryAttachments(currentEntryId),
|
|
18459
|
+
queryFn: ({ signal }) => getEntryAttachments({ entryId: currentEntryId }),
|
|
18441
18460
|
enabled: !!currentEntryId && currentEntryId > 0,
|
|
18442
18461
|
});
|
|
18443
18462
|
// Mutations
|
|
@@ -18733,7 +18752,7 @@ const ContentInput = ({ value, onChange, isEditing, UpdateTimestamp, UpdatedBy,
|
|
|
18733
18752
|
// Query for fetching attachment count
|
|
18734
18753
|
const { data: attachments = [], error: attachmentError } = useQuery({
|
|
18735
18754
|
queryKey: ["entryAttachments", effectiveEntryId],
|
|
18736
|
-
queryFn: () => getEntryAttachments(effectiveEntryId),
|
|
18755
|
+
queryFn: ({ signal }) => getEntryAttachments({ entryId: effectiveEntryId }),
|
|
18737
18756
|
enabled: !!effectiveEntryId && effectiveEntryId > 0,
|
|
18738
18757
|
retry: 1,
|
|
18739
18758
|
onError: (err) => {
|
|
@@ -19469,18 +19488,18 @@ const MESFLogbookEntry = () => {
|
|
|
19469
19488
|
};
|
|
19470
19489
|
|
|
19471
19490
|
const moment$2 = getMomentTz();
|
|
19472
|
-
const getEntriesReport = (
|
|
19491
|
+
const getEntriesReport = (params, signal) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19473
19492
|
const apiService = new MESApiService();
|
|
19474
19493
|
const parameters = [
|
|
19475
|
-
{ name: "StartShiftId", value: startShiftId },
|
|
19476
|
-
{ name: "EndShiftId", value: endShiftId },
|
|
19494
|
+
{ name: "StartShiftId", value: params.startShiftId },
|
|
19495
|
+
{ name: "EndShiftId", value: params.endShiftId },
|
|
19477
19496
|
];
|
|
19478
|
-
if (assetId) {
|
|
19479
|
-
parameters.push({ name: "AssetId", value: assetId });
|
|
19497
|
+
if (params.assetId) {
|
|
19498
|
+
parameters.push({ name: "AssetId", value: params.assetId });
|
|
19480
19499
|
}
|
|
19481
19500
|
// Pass comma-separated sectionIds for multi-select filter
|
|
19482
|
-
if (sectionIds && sectionIds.length > 0) {
|
|
19483
|
-
parameters.push({ name: "SectionIds", value: sectionIds.join(",") });
|
|
19501
|
+
if (params.sectionIds && params.sectionIds.length > 0) {
|
|
19502
|
+
parameters.push({ name: "SectionIds", value: params.sectionIds.join(",") });
|
|
19484
19503
|
}
|
|
19485
19504
|
// Use SWV.GetSectionLogbookEntries which extends LB.GetEntries with section info
|
|
19486
19505
|
const resp = yield apiService.callV2("[SWV].[GetSectionLogbookEntries]", parameters, signal);
|
|
@@ -19506,8 +19525,7 @@ const useEntriesReport = ({ startShiftId, endShiftId, assetId, sectionIds, }) =>
|
|
|
19506
19525
|
endShiftId,
|
|
19507
19526
|
assetId,
|
|
19508
19527
|
sectionIds,
|
|
19509
|
-
|
|
19510
|
-
}),
|
|
19528
|
+
}, signal),
|
|
19511
19529
|
});
|
|
19512
19530
|
};
|
|
19513
19531
|
|