@dexteel/mesf-core 6.1.2 → 6.2.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.
@@ -9,7 +9,7 @@ on:
9
9
  jobs:
10
10
  publish:
11
11
  if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release-please')
12
- runs-on: ubuntu-latest
12
+ runs-on: self-hosted
13
13
  steps:
14
14
  - uses: actions/checkout@v4
15
15
  - name: Setup Node.js
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "6.1.2"
2
+ ".": "6.2.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.2.0](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.4...mesf-core-v6.2.0) (2025-10-27)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Logbook:** add preview and download functionality for attachments ([4502347](https://github.com/dexteel/mesf-core-frontend/commit/4502347138321f1edb6539693121f8add29a7147))
9
+
10
+ ## [6.1.4](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.3...mesf-core-v6.1.4) (2025-10-24)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **devops:** run publish to npm from self-hosted ([d92bd45](https://github.com/dexteel/mesf-core-frontend/commit/d92bd45a196c37f8f62e8566e12f5a6a29b631b4))
16
+
17
+ ## [6.1.3](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.2...mesf-core-v6.1.3) (2025-10-24)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **Typings:** add exports of Logbook Entry typings ([0e98156](https://github.com/dexteel/mesf-core-frontend/commit/0e98156beeb001a5afe264930b6eb9816f46551f))
23
+
3
24
  ## [6.1.2](https://github.com/dexteel/mesf-core-frontend/compare/mesf-core-v6.1.1...mesf-core-v6.1.2) (2025-10-21)
4
25
 
5
26
 
package/dist/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export * from "./pages/trendings/TrendingsPage";
32
32
  export * from "./reducers/LogbookSettingsReducer";
33
33
  export * from "./services";
34
34
  export * from "./utils";
35
+ export * from "./pages/logbook/entry/models";
package/dist/index.esm.js CHANGED
@@ -8,7 +8,7 @@ import React__default, { createContext, useContext, useState, useRef, useEffect,
8
8
  import IconButton from '@material-ui/core/IconButton';
9
9
  import CloseIcon from '@material-ui/icons/Close';
10
10
  import Alert$3 from '@material-ui/lab/Alert';
11
- import { ArrowRight, ArrowBackRounded, ArrowForwardRounded, SkipNext, ChevronLeft, ChevronRight, Send, Menu as Menu$1, People, Storage, Group, Assignment, Chat, Timeline, ViewList, Build, Settings as Settings$2, AttachFile, CloudUpload, GetApp, Delete } from '@material-ui/icons';
11
+ import { ArrowRight, ArrowBackRounded, ArrowForwardRounded, SkipNext, ChevronLeft, ChevronRight, Send, Menu as Menu$1, People, Storage, Group, Assignment, Chat, Timeline, ViewList, Build, Settings as Settings$2, AttachFile, CloudUpload, Visibility, GetApp, Delete } from '@material-ui/icons';
12
12
  import { DatePicker } from '@mui/x-date-pickers/DatePicker';
13
13
  import moment$9 from 'moment-timezone';
14
14
  import { useParams, useNavigate, useSearchParams, Link, Navigate, Routes, Route, useLocation, BrowserRouter } from 'react-router-dom';
@@ -15505,6 +15505,7 @@ var useStyles$2 = makeStyles$1(function (theme) {
15505
15505
  },
15506
15506
  });
15507
15507
  });
15508
+ var PREVIEWABLE_EXTENSIONS = ["jpg", "jpeg", "png", "pdf"];
15508
15509
  var AttachmentModal = function (_a) {
15509
15510
  var open = _a.open, onClose = _a.onClose, entryId = _a.entryId, isEditing = _a.isEditing, entryData = _a.entryData, onEntrySubmitted = _a.onEntrySubmitted;
15510
15511
  var classes = useStyles$2();
@@ -15553,9 +15554,11 @@ var AttachmentModal = function (_a) {
15553
15554
  // Mutations
15554
15555
  var uploadMutation = useMutation(upsertEntryAttachment, {
15555
15556
  onSuccess: function () {
15556
- queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
15557
- queryClient.invalidateQueries(["entries"]);
15558
- queryClient.invalidateQueries(["entriesReport"]);
15557
+ queryClient.invalidateQueries({
15558
+ queryKey: ["entryAttachments", currentEntryId],
15559
+ });
15560
+ queryClient.invalidateQueries({ queryKey: ["entries"] });
15561
+ queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
15559
15562
  },
15560
15563
  onError: function (error) {
15561
15564
  setError(error.message);
@@ -15566,9 +15569,11 @@ var AttachmentModal = function (_a) {
15566
15569
  return deleteEntryAttachment(entryAttachmentId, uploadFileId);
15567
15570
  }, {
15568
15571
  onSuccess: function () {
15569
- queryClient.invalidateQueries(["entryAttachments", currentEntryId]);
15570
- queryClient.invalidateQueries(["entries"]);
15571
- queryClient.invalidateQueries(["entriesReport"]);
15572
+ queryClient.invalidateQueries({
15573
+ queryKey: ["entryAttachments", currentEntryId],
15574
+ });
15575
+ queryClient.invalidateQueries({ queryKey: ["entries"] });
15576
+ queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
15572
15577
  },
15573
15578
  onError: function (error) {
15574
15579
  setError(error.message);
@@ -15608,9 +15613,11 @@ var AttachmentModal = function (_a) {
15608
15613
  // Then create the attachment record
15609
15614
  _b.sent();
15610
15615
  // Invalidate queries for the specific entry and the main entries lists
15611
- queryClient.invalidateQueries(["entryAttachments", targetEntryId]);
15612
- queryClient.invalidateQueries(["entries"]);
15613
- queryClient.invalidateQueries(["entriesReport"]);
15616
+ queryClient.invalidateQueries({
15617
+ queryKey: ["entryAttachments", targetEntryId],
15618
+ });
15619
+ queryClient.invalidateQueries({ queryKey: ["entries"] });
15620
+ queryClient.invalidateQueries({ queryKey: ["entriesReport"] });
15614
15621
  _b.label = 5;
15615
15622
  case 5:
15616
15623
  _i++;
@@ -15727,21 +15734,41 @@ var AttachmentModal = function (_a) {
15727
15734
  }
15728
15735
  setAttachmentToDelete(null);
15729
15736
  };
15730
- // This function is no longer needed as we're using direct anchor links
15731
- // Keeping it as a reference in case it's needed elsewhere
15732
- /*
15733
- const handleDownloadAttachment = (attachment: EntryAttachment) => {
15734
- // Use the URL property with proper encoding
15735
- const encodedUrl = attachment.URL;
15736
- const link = document.createElement("a");
15737
- link.href = encodedUrl;
15738
- link.download = attachment.AttachmentName;
15739
- link.target = "_blank";
15740
- document.body.appendChild(link);
15741
- link.click();
15742
- document.body.removeChild(link);
15737
+ // Check if file can be previewed in browser
15738
+ var isPreviewable = function (fileName) {
15739
+ var extension = fileName.toLowerCase().split(".").pop() || "";
15740
+ return PREVIEWABLE_EXTENSIONS.includes(extension);
15743
15741
  };
15744
- */
15742
+ var handleDownloadAttachment = function (attachment) { return __awaiter(void 0, void 0, void 0, function () {
15743
+ var response, blob, url, link, error_4;
15744
+ return __generator(this, function (_a) {
15745
+ switch (_a.label) {
15746
+ case 0:
15747
+ _a.trys.push([0, 3, , 4]);
15748
+ return [4 /*yield*/, fetch(attachment.URL)];
15749
+ case 1:
15750
+ response = _a.sent();
15751
+ return [4 /*yield*/, response.blob()];
15752
+ case 2:
15753
+ blob = _a.sent();
15754
+ url = window.URL.createObjectURL(blob);
15755
+ link = document.createElement("a");
15756
+ link.href = url;
15757
+ link.download = attachment.FileName || attachment.AttachmentName;
15758
+ document.body.appendChild(link);
15759
+ link.click();
15760
+ document.body.removeChild(link);
15761
+ window.URL.revokeObjectURL(url);
15762
+ return [3 /*break*/, 4];
15763
+ case 3:
15764
+ error_4 = _a.sent();
15765
+ console.error("Download failed:", error_4);
15766
+ setError("Failed to download file: ".concat(error_4));
15767
+ return [3 /*break*/, 4];
15768
+ case 4: return [2 /*return*/];
15769
+ }
15770
+ });
15771
+ }); };
15745
15772
  var onDrop = useCallback(function (acceptedFiles) {
15746
15773
  if (isEditing) {
15747
15774
  handleFileUpload(acceptedFiles);
@@ -15779,13 +15806,9 @@ var AttachmentModal = function (_a) {
15779
15806
  React__default.createElement(AttachFile, null)),
15780
15807
  React__default.createElement(ListItemText, { primary: attachment.AttachmentName, secondary: "Added by ".concat(attachment.CreatedBy, " on ").concat(attachment.CreationTime.toLocaleDateString()) }),
15781
15808
  React__default.createElement(ListItemSecondaryAction, null,
15782
- React__default.createElement("a", { href: attachment.URL, target: "_blank", rel: "noopener noreferrer", title: "Download", style: {
15783
- display: "inline-flex",
15784
- padding: 8,
15785
- borderRadius: "50%",
15786
- color: "inherit",
15787
- textDecoration: "none",
15788
- }, className: "MuiButtonBase-root MuiIconButton-root" },
15809
+ isPreviewable(attachment.FileName || attachment.AttachmentName) && (React__default.createElement(IconButton$1, { component: "a", href: attachment.URL, target: "_blank", rel: "noopener noreferrer", title: "Preview", size: "small", style: { marginRight: 8 } },
15810
+ React__default.createElement(Visibility, null))),
15811
+ React__default.createElement(IconButton$1, { onClick: function () { return handleDownloadAttachment(attachment); }, title: "Download", size: "small", style: { marginRight: isEditing ? 8 : 0 } },
15789
15812
  React__default.createElement(GetApp, null)),
15790
15813
  isEditing && (React__default.createElement(IconButton$1, { edge: "end", onClick: function () {
15791
15814
  return handleDeleteAttachment(attachment.EntryAttachmentId, attachment.UploadFileId, attachment.AttachmentName);
@@ -16716,7 +16739,7 @@ var routeLogbookEntry = "/logbook/entry";
16716
16739
  var LogbookPage$1 = function () {
16717
16740
  return (React__default.createElement(React__default.Fragment, null,
16718
16741
  React__default.createElement(HelmetDexteel, { title: "Logbook Entry" }),
16719
- React__default.createElement(Grid, { container: true, style: { padding: 20 } },
16742
+ React__default.createElement(Grid, { container: true, style: { padding: 20 }, onContextMenu: function (e) { return e.preventDefault(); } },
16720
16743
  React__default.createElement(Logbook$1, null))));
16721
16744
  };
16722
16745
 
@@ -17311,7 +17334,7 @@ var routeLogbookReport = "/logbook/report";
17311
17334
  var LogbookPage = function () {
17312
17335
  return (React__default.createElement(React__default.Fragment, null,
17313
17336
  React__default.createElement(HelmetDexteel, { title: "Logbook Report" }),
17314
- React__default.createElement(Grid, { container: true, style: { padding: 20 } },
17337
+ React__default.createElement(Grid, { container: true, style: { padding: 20 }, onContextMenu: function (e) { return e.preventDefault(); } },
17315
17338
  React__default.createElement(Logbook, null))));
17316
17339
  };
17317
17340
 
@@ -17505,5 +17528,5 @@ var areaSelector = /*#__PURE__*/Object.freeze({
17505
17528
  AreaSelector: AreaSelector
17506
17529
  });
17507
17530
 
17508
- export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, EditAssetDialog, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry, MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry, routeLogbookReport, searchAssets, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useStyles$i as useStyles, useToken, useUTLSettingsContext, useUserContext };
17531
+ export { Account, AssetProvider, AssetTreePicker, AuthContext, AuthProvider, BarChartControl, ButtonWithLoading, ChangePassword, CheckBoxControl, Configuration$1 as Configuration, ContextMenu$1 as ContextMenu, ContextMenuMESFProvider, CreateNewAssetDialog, CurrencyFormatter, DataGridControl, DateFormatter, DateTimeFormatter, ENTRY_INITIAL_VALUES, EditAssetDialog, ErrorModal, FetchError, FilterPanel, GenericPanel, GenericTable, GetCrewColor, GetShiftColor, HelmetDexteel, IntegerFormatter, LogbookSettingsInitialState, LogbookSettingsProvider, Login, Logout, LongFilterPanel, MESApiService, MESFLogbookEntry, MESFLogbookReport, MESFMain, MESSAGE_API, MESSAGE_ERRORS, MasterDetailPanel, MesfModal, ModalTreeFilterControl, MultipleSelectorControl, NumberFormatter, RemoveAssetDialog, ShiftDayNavigatorControl, ShiftNavigatorProvider, ShiftPeriodNavigatorControl, SimplePasswordControl, SimpleSelectorControl, TimeAndUserMenu, TimeFormatter, TimeService, TreePickerControl, TreePickerControlV2, TrendingsPage, USER_LABELS, UTLSettingsProvider, UserProvider, axiosInstance, deleteUser, dxtServerTimeZone, dxtToLocalServerTime, dxtToUTC, formatNumber, getAuthTypes, getCrewStyle, getDataUser, getError, getMomentTz, getShiftByParameters, getShiftStyle, getShiftsRangeByParameters, getTokenFromLS, getUserPermissionsFromAPI, getUsers, logbookNavbar, logbookRoutesMESF, renewToken, routeLogbookEntry, routeLogbookReport, searchAssets, setPassword, setProfilesToUser, themeDXT, themeMESF, upsertUser, useAssetContext, useContextMenuMESF, useHasPermission, useHasProfile, useLogbookSettings, useMesfRealtime, useShiftNavigator, useShiftNavigatorManager, useStyles$i as useStyles, useToken, useUTLSettingsContext, useUserContext };
17509
17532
  //# sourceMappingURL=index.esm.js.map