@seedtactics/insight-client 17.0.8 → 17.0.10

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.
@@ -30,8 +30,13 @@ export interface MaterialSummaryAndCompletedData extends MaterialSummary {
30
30
  };
31
31
  readonly currently_quarantined?: boolean;
32
32
  }
33
+ interface QuarantineSignal {
34
+ readonly counter: number;
35
+ readonly note: string | undefined;
36
+ }
33
37
  interface MaterialSummaryFromEvents extends MaterialSummaryAndCompletedData {
34
38
  readonly last_event: Date;
39
+ readonly quarantineSignals?: HashMap<number, QuarantineSignal>;
35
40
  }
36
41
  export interface MatSummaryState {
37
42
  readonly matsById: HashMap<number, MaterialSummaryFromEvents>;
@@ -177,8 +177,18 @@ function process_event(st, e) {
177
177
  case LogType.CloseOut:
178
178
  mat = { ...mat, closeout_completed: e.endUTC, closeout_failed: e.result === "Failed" };
179
179
  break;
180
- case LogType.SignalQuarantine:
181
- mat = { ...mat, quarantineAfterUnload: true };
180
+ case LogType.SignalQuarantine: {
181
+ const signals = mat.quarantineSignals ?? HashMap.empty();
182
+ const previous = signals.get(logMat.proc);
183
+ mat = {
184
+ ...mat,
185
+ quarantineAfterUnload: true,
186
+ quarantineSignals: previous && previous.counter >= e.counter
187
+ ? signals
188
+ : signals.set(logMat.proc, { counter: e.counter, note: e.details?.note?.trim() }),
189
+ };
190
+ break;
191
+ }
182
192
  }
183
193
  mats = mats.set(logMat.id, mat);
184
194
  }
@@ -212,7 +222,7 @@ export const updateLast30MatSummary = atom(null, (_, set, { evt, now, expire })
212
222
  set(last30MaterialSummaryRW, (st) => {
213
223
  const newSt = process_event(st, log);
214
224
  if (newSt === st || !expire) {
215
- return st;
225
+ return newSt;
216
226
  }
217
227
  else {
218
228
  return filter_old(addDays(now, -30), newSt);
@@ -40,7 +40,7 @@ import { useSortable } from "@dnd-kit/sortable";
40
40
  import * as api from "../../network/api.js";
41
41
  import * as matDetails from "../../cell-status/material-details.js";
42
42
  import { LogEntries } from "../LogEntry.js";
43
- import { inproc_mat_to_summary, } from "../../cell-status/material-summary.js";
43
+ import { inproc_mat_to_summary, last30MaterialSummary, } from "../../cell-status/material-summary.js";
44
44
  import { currentOperator } from "../../data/operators.js";
45
45
  import { DisplayLoadingAndError } from "../ErrorsAndLoading.js";
46
46
  import { ErrorBoundary } from "react-error-boundary";
@@ -50,7 +50,7 @@ import { useAtom, useAtomValue, useSetAtom } from "jotai";
50
50
  import { last30Rebookings } from "../../cell-status/rebookings.js";
51
51
  import { fmsInformation } from "../../network/server-settings.js";
52
52
  import { basketDisplayName, basketSlotLabel } from "../../cell-status/station-cycles.js";
53
- import { canAddOrMoveMaterialToQueue, canReorderQueuedMaterial, materialOperationState, } from "../../data/material-operation-policy.js";
53
+ import { canAddOrMoveMaterialToQueue, canReorderQueuedMaterial, materialOperationState, quarantineRoute, } from "../../data/material-operation-policy.js";
54
54
  export class PartIdenticon extends PureComponent {
55
55
  render() {
56
56
  const iconSize = this.props.size || 50;
@@ -283,10 +283,15 @@ function materialActionDescription(mat, curSt, basketName, displayActionForSingl
283
283
  else if (mat.location.type === api.LocType.InBasket) {
284
284
  return (_jsxs(_Fragment, { children: ["In ", basketName, " ", mat.location.basketId] }));
285
285
  }
286
- else if (mat.location.type === api.LocType.OnPallet &&
287
- (mat.lastCompletedMachiningRouteStopIndex === null ||
288
- mat.lastCompletedMachiningRouteStopIndex === undefined)) {
289
- return _jsx(_Fragment, { children: "Waiting for machining" });
286
+ else if (mat.location.type === api.LocType.OnPallet) {
287
+ const path = curSt.jobs[mat.jobUnique]?.procsAndPaths?.[mat.process - 1]?.paths?.[mat.path - 1];
288
+ if (path?.stops?.length === 0) {
289
+ return _jsx(_Fragment, { children: "Waiting" });
290
+ }
291
+ if (mat.lastCompletedMachiningRouteStopIndex === null ||
292
+ mat.lastCompletedMachiningRouteStopIndex === undefined) {
293
+ return _jsx(_Fragment, { children: "Waiting for machining" });
294
+ }
290
295
  }
291
296
  break;
292
297
  case api.ActionType.Machining:
@@ -294,24 +299,29 @@ function materialActionDescription(mat, curSt, basketName, displayActionForSingl
294
299
  }
295
300
  return null;
296
301
  }
297
- function Warning({ mat }) {
302
+ function Warning({ mat, inProcMat, }) {
303
+ const summary = useAtomValue(last30MaterialSummary).matsById.get(mat.materialID);
304
+ const reason = inProcMat
305
+ ? summary?.quarantineSignals?.get(quarantineRoute(inProcMat).process)?.note
306
+ : undefined;
298
307
  let tooltip = null;
299
308
  if (mat.signaledInspections.length > 0) {
300
309
  tooltip = "Inspect: " + mat.signaledInspections.join(", ");
301
310
  }
302
311
  if (mat.quarantineAfterUnload) {
312
+ const quarantine = "Material will quarantine after unload" + (reason ? `: ${reason}` : "");
303
313
  if (tooltip === null) {
304
- tooltip = "Material will quarantine after unload";
314
+ tooltip = quarantine;
305
315
  }
306
316
  else {
307
- tooltip += "; Material will quarantine after unload";
317
+ tooltip += `; ${quarantine}`;
308
318
  }
309
319
  }
310
320
  if (tooltip === null) {
311
321
  return null;
312
322
  }
313
323
  else {
314
- return (_jsx(Tooltip, { title: tooltip, children: _jsx(WarningIcon, {}) }));
324
+ return (_jsx(Tooltip, { title: tooltip, describeChild: true, children: _jsx(WarningIcon, { titleAccess: "Material warnings" }) }));
315
325
  }
316
326
  }
317
327
  function JobRawMaterial({ fsize, mat, }) {
@@ -413,7 +423,7 @@ const MatCard = function MatCard({ mat, materialCount = 1, inProcMat, fsize, foc
413
423
  alignItems: "flex-end",
414
424
  alignSelf: "start",
415
425
  flexShrink: 0,
416
- }, children: [mat.serial && mat.serial.length >= 1 && !hideAvatar ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: mat.serial.slice(-1) }) })) : undefined, hideWarningIcon ? undefined : (_jsx("div", { children: _jsx(Warning, { mat: mat }) }))] })] }) })] }));
426
+ }, children: [mat.serial && mat.serial.length >= 1 && !hideAvatar ? (_jsx("div", { children: _jsx(Avatar, { style: { width: "30px", height: "30px" }, children: mat.serial.slice(-1) }) })) : undefined, hideWarningIcon ? undefined : (_jsx("div", { children: _jsx(Warning, { mat: mat, inProcMat: inProcMat }) }))] })] }) })] }));
417
427
  };
418
428
  export const MatSummary = memo(MatCard);
419
429
  export const InProcMaterial = memo(function InProcMaterial(props) {
@@ -564,11 +574,22 @@ function RebookingNote() {
564
574
  }
565
575
  return null;
566
576
  }
577
+ function QuarantineReason({ material }) {
578
+ const events = useAtomValue(matDetails.materialInDialogLocalEvents);
579
+ const process = quarantineRoute(material).process;
580
+ const quarantine = events.reduce((latest, event) => event.type === api.LogType.SignalQuarantine &&
581
+ event.material.some((m) => m.id === material.materialID && m.proc === process) &&
582
+ (latest === null || event.counter > latest.counter)
583
+ ? event
584
+ : latest, null);
585
+ const reason = quarantine?.details?.note?.trim();
586
+ return reason ? `: ${reason}` : null;
587
+ }
567
588
  function MaterialOperationNotice() {
568
589
  const material = useAtomValue(matDetails.inProcessMaterialInDialog);
569
590
  const alarms = matDetails.useMaterialBlockingAlarms();
570
591
  const state = material ? materialOperationState(material) : null;
571
- return (_jsx(_Fragment, { children: material?.quarantineAfterUnload ? (_jsx(Typography, { variant: "caption", component: "p", children: "Quarantine requested" })) : alarms.length === 0 &&
592
+ return (_jsx(_Fragment, { children: material?.quarantineAfterUnload ? (_jsxs(Typography, { variant: "caption", component: "p", children: ["Quarantine requested", _jsx(ErrorBoundary, { fallback: null, resetKeys: [material.materialID, quarantineRoute(material).process], children: _jsx(QuarantineReason, { material: material }) })] })) : alarms.length === 0 &&
572
593
  state?.kind === "ActiveLoadStationOperation" &&
573
594
  state.cancellationId === null ? (_jsx(Typography, { variant: "caption", component: "p", children: "This material is part of the current load/unload operation. Complete the operation or cancel it at the machine control before making other changes." })) : null }));
574
595
  }
@@ -226,11 +226,8 @@ function useCellOverview() {
226
226
  });
227
227
  for (const lulNum of mach.possibleLoadStations) {
228
228
  // remove and lookup old load status
229
- let lul;
230
- loads = loads.alter(lulNum, (s) => {
231
- lul = s;
232
- return undefined;
233
- });
229
+ const lul = loads.get(lulNum);
230
+ loads = loads.delete(lulNum);
234
231
  const allMats = LazySeq.of(lul?.pal?.mats ?? []).toLookup((m) => {
235
232
  if (m.action.type === ActionType.Machining)
236
233
  return "Machining";
package/dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <link rel="shortcut icon" href="/assets/favicon-gWFxiJK2.ico" />
7
7
  <title>SeedTactic FMS Insight</title>
8
8
  <style type="text/css">.download-loader{width:100px;height:100px;display:inline-block}.download-circular{width:100px;height:100px;animation:2s linear infinite rotate}.download-path{stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;stroke:#8d6e63;animation:1.5s ease-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}</style>
9
- <script type="module" crossorigin src="/assets/index-CYOpFETi.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BKr-hck2.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-DXfAwuj-.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedtactics/insight-client",
3
- "version": "17.0.8",
3
+ "version": "17.0.10",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "url": "https://github.com/SeedTactics/fms-insight"
@@ -38,8 +38,8 @@
38
38
  "copy-to-clipboard": "^4.0.2",
39
39
  "d3-interpolate-path": "^2.3.0",
40
40
  "d3-sankey": "^0.12.3",
41
- "d3-scale": "^4.0.2",
42
- "d3-shape": "^3.2.0",
41
+ "d3-scale": "^4.0.3",
42
+ "d3-shape": "^3.2.1",
43
43
  "date-fns": "^4.4.0",
44
44
  "highlight.js": "^11.12.0",
45
45
  "jdenticon": "^3.3.0",
@@ -61,15 +61,15 @@
61
61
  "@types/d3-shape": "^3.2.0",
62
62
  "@types/react": "^19.3.0",
63
63
  "@types/react-dom": "^19.3.0",
64
- "@vitejs/plugin-react": "^6.1.2",
65
- "@vitest/browser-playwright": "^5.0.5",
64
+ "@vitejs/plugin-react": "^6.2.1",
65
+ "@vitest/browser-playwright": "^5.1.0",
66
66
  "jotai": "^3.0.1",
67
67
  "jsdom": "^30.1.3",
68
68
  "playwright": "^1.64.1",
69
69
  "react": "^19.3.1",
70
70
  "react-dom": "^19.3.1",
71
71
  "vite": "^8.3.5",
72
- "vitest": "^5.0.5",
72
+ "vitest": "^5.1.0",
73
73
  "vitest-browser-react": "^2.3.0"
74
74
  },
75
75
  "peerDependencies": {