@seedtactics/insight-client 17.0.1-beta.16 → 17.0.1-beta.17
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/assets/{index-Bb9RtihL.js → index-htn3QO9k.js} +71 -71
- package/dist/components/ErrorsAndLoading.js +2 -1
- package/dist/components/quality/QualityMaterial.js +3 -12
- package/dist/components/station-monitor/BasketLoadStationWork.js +7 -12
- package/dist/components/station-monitor/CancelLoadButton.js +3 -2
- package/dist/components/station-monitor/InvalidateCycle.js +2 -6
- package/dist/components/station-monitor/LoadStation.js +4 -7
- package/dist/components/station-monitor/QuarantineButton.js +4 -3
- package/dist/components/station-monitor/QueuesAddMaterial.js +2 -5
- package/dist/index.html +1 -1
- package/dist/network/api-errors.d.ts +6 -0
- package/dist/network/api-errors.js +72 -0
- package/dist/network/websocket.js +4 -21
- package/dist/util/parseISODuration.js +10 -9
- package/docs/server-config.md +20 -12
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ import { Card } from "@mui/material";
|
|
|
37
37
|
import { CardContent } from "@mui/material";
|
|
38
38
|
import { ErrorBoundary } from "react-error-boundary";
|
|
39
39
|
import { ApiException } from "../network/api.js";
|
|
40
|
+
import { apiErrorMessage } from "../network/api-errors.js";
|
|
40
41
|
function displayUnknownError(error) {
|
|
41
42
|
if (typeof error === "string") {
|
|
42
43
|
return error;
|
|
@@ -53,7 +54,7 @@ export function DisplayError({ error }) {
|
|
|
53
54
|
if (error === undefined)
|
|
54
55
|
return _jsx(_Fragment, {});
|
|
55
56
|
if (ApiException.isApiException(error)) {
|
|
56
|
-
return (_jsx(Card, { children: _jsxs(CardContent, { children: [_jsx("h3", { children: "FMS Insight Server Error" }), _jsx("p", { children: error
|
|
57
|
+
return (_jsx(Card, { children: _jsxs(CardContent, { children: [_jsx("h3", { children: "FMS Insight Server Error" }), _jsx("p", { children: apiErrorMessage(error) })] }) }));
|
|
57
58
|
}
|
|
58
59
|
else if (error instanceof Error) {
|
|
59
60
|
return (_jsx(Card, { children: _jsx(CardContent, { children: error.message }) }));
|
|
@@ -37,7 +37,8 @@ import * as matDetails from "../../cell-status/material-details.js";
|
|
|
37
37
|
import { MaterialDetailTitle, MaterialDetailContent, MaterialLoading, } from "../station-monitor/Material.js";
|
|
38
38
|
import { buildPathString, extractPath } from "../../data/results.inspection.js";
|
|
39
39
|
import { startOfToday, addDays, startOfDay, endOfDay } from "date-fns";
|
|
40
|
-
import {
|
|
40
|
+
import { LogType } from "../../network/api.js";
|
|
41
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
41
42
|
import { InspectionSankey } from "../analysis/InspectionSankey.js";
|
|
42
43
|
import { useIsDemo, useSetTitle } from "../routes.js";
|
|
43
44
|
import { extendRange, inspectionLogEntries, pathLookupRange } from "../../data/path-lookup.js";
|
|
@@ -68,17 +69,7 @@ function SerialLookup() {
|
|
|
68
69
|
setError("No material found with serial " + serial);
|
|
69
70
|
}
|
|
70
71
|
})
|
|
71
|
-
.catch((e) =>
|
|
72
|
-
if (ApiException.isApiException(e)) {
|
|
73
|
-
setError(e.response);
|
|
74
|
-
}
|
|
75
|
-
else if (e instanceof Error) {
|
|
76
|
-
setError(e.message);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
setError(e);
|
|
80
|
-
}
|
|
81
|
-
})
|
|
72
|
+
.catch((e) => setError(apiErrorMessage(e)))
|
|
82
73
|
.finally(() => setLoading(false));
|
|
83
74
|
}
|
|
84
75
|
}
|
|
@@ -113,17 +113,7 @@ function stationWork(material, basket) {
|
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
return { type: "none" };
|
|
118
|
-
const tagged = validActions.filter((action) => isNonBlank(action.workId));
|
|
119
|
-
const workIds = LazySeq.of(tagged).toHashSet(({ workId }) => workId);
|
|
120
|
-
if (tagged.length !== validActions.length || workIds.size !== 1) {
|
|
121
|
-
return { type: "inconsistent" };
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
type: "active",
|
|
125
|
-
work: { workId: tagged[0].workId, ready: true, confirmEmpty: false, awaitingSlots: [] },
|
|
126
|
-
};
|
|
116
|
+
return { type: validActions.length === 0 ? "none" : "inconsistent" };
|
|
127
117
|
}
|
|
128
118
|
function SlotMaterial({ material, basketId, fsize, }) {
|
|
129
119
|
return material.map((mat) => (_jsx(MoveMaterialArrowNode, { kind: { type: MoveMaterialNodeKindType.Material, material: mat }, children: _jsx(InProcMaterial, { mat: mat, displayActionForSingleBasket: basketId, fsize: fsize }) }, mat.materialID)));
|
|
@@ -188,7 +178,12 @@ export function BasketLoadStationWorkflow({ basket, material, fsize, title, elap
|
|
|
188
178
|
gridTemplateColumns: "1fr auto auto",
|
|
189
179
|
alignItems: "center",
|
|
190
180
|
columnGap: 4,
|
|
191
|
-
}, children: [title, _jsx(Box, { children: work ? (_jsx(Button, { variant: "contained", color: "secondary", size: "large", disabled: submissionDisabled, onClick: () => void submit(), children: "Confirm" })) : null }), _jsx(Box, { sx: {
|
|
181
|
+
}, children: [title, _jsx(Box, { children: work ? (_jsx(Button, { variant: "contained", color: "secondary", size: "large", disabled: submissionDisabled, onClick: () => void submit(), children: "Confirm" })) : null }), _jsx(Box, { sx: {
|
|
182
|
+
justifySelf: "flex-end",
|
|
183
|
+
minWidth: "8ch",
|
|
184
|
+
textAlign: "right",
|
|
185
|
+
fontVariantNumeric: "tabular-nums",
|
|
186
|
+
}, children: elapsed })] }), _jsxs(Stack, { spacing: 2, sx: { ml: "4em", mr: "4em", mt: 2 }, children: [work?.confirmEmpty && work.ready && (_jsxs(Typography, { children: ["Confirm basket ", basket.basketId, " is empty."] })), instructionWarning && _jsx(Alert, { severity: "warning", children: instructionWarning }), work && !work.ready && (_jsx(Alert, { severity: "info", children: blockedReason ||
|
|
192
187
|
(work.awaitingSlots.length > 0
|
|
193
188
|
? `Waiting for material for slots ${work.awaitingSlots.map(basketSlotLabel).join(", ")}.`
|
|
194
189
|
: "Basket work is not ready for confirmation.") })), !work && workState.type === "inconsistent" ? (_jsx(Alert, { severity: "warning", children: "Basket work is inconsistent. Wait for refreshed material actions before confirming." })) : null, submissionState === "accepted" ? (_jsx(Alert, { severity: "success", children: "Confirmation accepted. Waiting for refreshed work." })) : submissionState === "conflict" ? (_jsx(Alert, { severity: "warning", children: "Basket work changed before confirmation. Review the refreshed slots and try again." })) : submissionState === "error" ? (_jsx(Alert, { severity: "error", children: "Unable to confirm basket work. No work was assumed complete." })) : null] }), _jsx(MoveMaterialArrowNode, { kind: { type: MoveMaterialNodeKindType.BasketZone, basketId: basket.basketId }, children: slots.map((slot, idx) => {
|
|
@@ -7,7 +7,8 @@ import { currentStatus } from "../../cell-status/current-status.js";
|
|
|
7
7
|
import { inProcessMaterialInDialog, materialDialogOpen, } from "../../cell-status/material-details.js";
|
|
8
8
|
import { currentOperator } from "../../data/operators.js";
|
|
9
9
|
import { JobsBackend } from "../../network/backend.js";
|
|
10
|
-
import {
|
|
10
|
+
import { CancelLoadRequest } from "../../network/api.js";
|
|
11
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
11
12
|
import { canCancelLoad } from "../../data/material-operation-policy.js";
|
|
12
13
|
export function CancelLoadButton({ onClose, ignoreOperator = false, }) {
|
|
13
14
|
const material = useAtomValue(inProcessMaterialInDialog);
|
|
@@ -47,7 +48,7 @@ export function CancelLoadButton({ onClose, ignoreOperator = false, }) {
|
|
|
47
48
|
onClose?.();
|
|
48
49
|
}
|
|
49
50
|
catch (e) {
|
|
50
|
-
setError(
|
|
51
|
+
setError(apiErrorMessage(e));
|
|
51
52
|
}
|
|
52
53
|
finally {
|
|
53
54
|
setUpdating(false);
|
|
@@ -46,7 +46,7 @@ import { useEffect, useRef } from "react";
|
|
|
46
46
|
import { last30Jobs } from "../../cell-status/scheduled-jobs.js";
|
|
47
47
|
import { PartIdenticon } from "./Material.js";
|
|
48
48
|
import { isLogEntryInvalidated } from "../LogEntry.js";
|
|
49
|
-
import {
|
|
49
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
50
50
|
import { canInvalidateMaterial } from "../../data/material-operation-policy.js";
|
|
51
51
|
const invalidatableEventTypes = LazySeq.of([
|
|
52
52
|
LogType.AddToQueue,
|
|
@@ -221,11 +221,7 @@ export function InvalidateCycleDialogButton(props) {
|
|
|
221
221
|
props.setState({
|
|
222
222
|
...props.st,
|
|
223
223
|
updating: false,
|
|
224
|
-
error:
|
|
225
|
-
? e.response
|
|
226
|
-
: e instanceof Error
|
|
227
|
-
? e.message
|
|
228
|
-
: String(e),
|
|
224
|
+
error: apiErrorMessage(e),
|
|
229
225
|
});
|
|
230
226
|
});
|
|
231
227
|
}
|
|
@@ -38,6 +38,7 @@ import { FolderOpen as FolderOpenIcon } from "@mui/icons-material";
|
|
|
38
38
|
import { MaterialDialog, InProcMaterial, SortableInProcMaterial, DragOverlayInProcMaterial, MatSummary, } from "./Material.js";
|
|
39
39
|
import { SortableRegion } from "./Whiteboard.js";
|
|
40
40
|
import * as api from "../../network/api.js";
|
|
41
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
41
42
|
import * as matDetails from "../../cell-status/material-details.js";
|
|
42
43
|
import { SelectWorkorderDialog, selectWorkorderDialogOpen } from "./SelectWorkorder.js";
|
|
43
44
|
import { SelectInspTypeDialog, SignalInspectionButton } from "./SelectInspType.js";
|
|
@@ -394,8 +395,8 @@ function ElapsedLoadTime({ elapsedLoadTime }) {
|
|
|
394
395
|
const secondsSinceEpoch = useAtomValue(secondsSinceEpochAtom);
|
|
395
396
|
if (elapsedLoadTime) {
|
|
396
397
|
const elapsedSecsInCurSt = durationToSeconds(elapsedLoadTime);
|
|
397
|
-
const elapsedSecs = elapsedSecsInCurSt + (secondsSinceEpoch -
|
|
398
|
-
return _jsx("span", { children: formatSeconds(elapsedSecs) });
|
|
398
|
+
const elapsedSecs = elapsedSecsInCurSt + (secondsSinceEpoch - currentStTime.getTime() / 1000);
|
|
399
|
+
return _jsx("span", { children: formatSeconds(Math.max(0, elapsedSecs)) });
|
|
399
400
|
}
|
|
400
401
|
else {
|
|
401
402
|
return null;
|
|
@@ -610,11 +611,7 @@ function AddMatButton({ queues, onClose, toQueue, showAddToQueue, setShowAddToQu
|
|
|
610
611
|
onClose();
|
|
611
612
|
}
|
|
612
613
|
catch (e) {
|
|
613
|
-
setAddError(
|
|
614
|
-
? e.response
|
|
615
|
-
: e instanceof Error
|
|
616
|
-
? e.message
|
|
617
|
-
: String(e));
|
|
614
|
+
setAddError(apiErrorMessage(e));
|
|
618
615
|
}
|
|
619
616
|
}, children: ["Add To ", toQueue ?? "Queue", " ", lastProcMat ? ` To Run Process ${lastProcMat.process + 1}` : ""] }), addError ? _jsx(Typography, { role: "alert", children: addError }) : null] }));
|
|
620
617
|
}
|
|
@@ -37,7 +37,8 @@ import { LazySeq } from "@seedtactics/immutable-collections";
|
|
|
37
37
|
import { currentStatus } from "../../cell-status/current-status.js";
|
|
38
38
|
import { inProcessMaterialInDialog, materialDialogOpen, useQuarantineQueuedMaterial, useRemoveFromQueue, useSignalForQuarantine, } from "../../cell-status/material-details.js";
|
|
39
39
|
import { currentOperator } from "../../data/operators.js";
|
|
40
|
-
import {
|
|
40
|
+
import { LocType, QueueRole } from "../../network/api.js";
|
|
41
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
41
42
|
import { fmsInformation } from "../../network/server-settings.js";
|
|
42
43
|
import { useAtomValue, useSetAtom } from "jotai";
|
|
43
44
|
import { canDirectlyQuarantine, canRemoveFromQueue, canSignalQuarantine, quarantineRoute, } from "../../data/material-operation-policy.js";
|
|
@@ -136,7 +137,7 @@ function RemoveFromQueuesButton({ material, removeFromQueues, removing, }) {
|
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
catch (e) {
|
|
139
|
-
setError(
|
|
140
|
+
setError(apiErrorMessage(e));
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
function openRemoval() {
|
|
@@ -244,7 +245,7 @@ export function QuarantineMatButton({ onClose, ignoreOperator, }) {
|
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
247
|
catch (e) {
|
|
247
|
-
setError(
|
|
248
|
+
setError(apiErrorMessage(e));
|
|
248
249
|
}
|
|
249
250
|
finally {
|
|
250
251
|
setUpdating(false);
|
|
@@ -36,6 +36,7 @@ import { Button, Collapse, List, ListItem, ListItemButton, ListItemIcon, ListIte
|
|
|
36
36
|
import { ExpandMore as ExpandMoreIcon } from "@mui/icons-material";
|
|
37
37
|
import { PartIdenticon, WorkorderFromBarcode } from "./Material.js";
|
|
38
38
|
import * as api from "../../network/api.js";
|
|
39
|
+
import { apiErrorMessage } from "../../network/api-errors.js";
|
|
39
40
|
import * as matDetails from "../../cell-status/material-details.js";
|
|
40
41
|
import { usePossibleNewMaterialTypes, } from "../../data/queue-material.js";
|
|
41
42
|
import { currentOperator } from "../../data/operators.js";
|
|
@@ -262,11 +263,7 @@ export function AddToQueueButton({ st: { enteredOperator, newMaterialTy, toQueue
|
|
|
262
263
|
onClose();
|
|
263
264
|
}
|
|
264
265
|
catch (e) {
|
|
265
|
-
setAddError(
|
|
266
|
-
? e.response
|
|
267
|
-
: e instanceof Error
|
|
268
|
-
? e.message
|
|
269
|
-
: String(e));
|
|
266
|
+
setAddError(apiErrorMessage(e));
|
|
270
267
|
}
|
|
271
268
|
}, children: toQueue === null ? ("Add to Queue") : (_jsxs("span", { children: [curQueue !== null ? `Move From ${curQueue} To` : "Add To", " ", toQueue, withSerialMsg, addProcMsg] })) }) }) }), addError ? _jsx("p", { role: "alert", children: addError }) : null] }));
|
|
272
269
|
}
|
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-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-htn3QO9k.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-DXfAwuj-.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server's explanation for a failed request: the detail of a JSON problem or a plain-text
|
|
3
|
+
* message (also assumed without a content type). Other responses, such as HTML from a proxy, use
|
|
4
|
+
* the request error's own message.
|
|
5
|
+
*/
|
|
6
|
+
export declare function apiErrorMessage(error: unknown, fallback?: string): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* Copyright (c) 2026, John Lenz
|
|
2
|
+
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above
|
|
12
|
+
copyright notice, this list of conditions and the following
|
|
13
|
+
disclaimer in the documentation and/or other materials provided
|
|
14
|
+
with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
17
|
+
nor the names of other contributors may be used to endorse or
|
|
18
|
+
promote products derived from this software without specific
|
|
19
|
+
prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
22
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
23
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
24
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
25
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
29
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
*/
|
|
33
|
+
import { ApiException } from "./api.js";
|
|
34
|
+
function mediaType(headers) {
|
|
35
|
+
const value = headers["content-type"];
|
|
36
|
+
return typeof value === "string" ? (value.split(";")[0] ?? "").trim().toLowerCase() : "";
|
|
37
|
+
}
|
|
38
|
+
function nonBlank(value) {
|
|
39
|
+
return typeof value === "string" && value.trim() !== "" ? value : null;
|
|
40
|
+
}
|
|
41
|
+
function problemMessage(response) {
|
|
42
|
+
try {
|
|
43
|
+
const problem = JSON.parse(response);
|
|
44
|
+
if (problem === null || typeof problem !== "object")
|
|
45
|
+
return null;
|
|
46
|
+
return (("detail" in problem ? nonBlank(problem.detail) : null) ??
|
|
47
|
+
("title" in problem ? nonBlank(problem.title) : null));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The server's explanation for a failed request: the detail of a JSON problem or a plain-text
|
|
55
|
+
* message (also assumed without a content type). Other responses, such as HTML from a proxy, use
|
|
56
|
+
* the request error's own message.
|
|
57
|
+
*/
|
|
58
|
+
export function apiErrorMessage(error, fallback = "Error") {
|
|
59
|
+
if (error !== null && typeof error === "object" && ApiException.isApiException(error)) {
|
|
60
|
+
const type = mediaType(error.headers);
|
|
61
|
+
const message = type === "application/problem+json" || type === "application/json"
|
|
62
|
+
? problemMessage(error.response)
|
|
63
|
+
: type === "text/plain" || type === ""
|
|
64
|
+
? nonBlank(error.response)
|
|
65
|
+
: null;
|
|
66
|
+
if (message !== null)
|
|
67
|
+
return message;
|
|
68
|
+
}
|
|
69
|
+
if (error instanceof Error)
|
|
70
|
+
return error.message;
|
|
71
|
+
return nonBlank(error) ?? fallback;
|
|
72
|
+
}
|
|
@@ -30,7 +30,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
30
30
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31
31
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
32
|
*/
|
|
33
|
-
import {
|
|
33
|
+
import { ServerEvent } from "./api.js";
|
|
34
|
+
import { apiErrorMessage } from "./api-errors.js";
|
|
34
35
|
import { JobsBackend, LogBackend } from "./backend.js";
|
|
35
36
|
import { fmsInformation } from "./server-settings.js";
|
|
36
37
|
import { useEffect, useRef } from "react";
|
|
@@ -59,24 +60,6 @@ export const errorLoadingLast30 = atom((get) => get(errorLoadingLast30RW) ?? get
|
|
|
59
60
|
function isCurrentSession(get, session) {
|
|
60
61
|
return get(websocketSessionAtom).id === session;
|
|
61
62
|
}
|
|
62
|
-
function loadingErrorMessage(error, fallback) {
|
|
63
|
-
if (error !== null && typeof error === "object" && ApiException.isApiException(error)) {
|
|
64
|
-
try {
|
|
65
|
-
const problem = JSON.parse(error.response);
|
|
66
|
-
if (problem !== null &&
|
|
67
|
-
typeof problem === "object" &&
|
|
68
|
-
"detail" in problem &&
|
|
69
|
-
typeof problem.detail === "string" &&
|
|
70
|
-
problem.detail.trim().length > 0) {
|
|
71
|
-
return problem.detail;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
// Older servers can return plain text or HTML instead of a JSON problem.
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return error instanceof Error ? error.message : fallback;
|
|
79
|
-
}
|
|
80
63
|
function loadCurrentStatus(get, set, session) {
|
|
81
64
|
return JobsBackend.currentStatus().then((st) => {
|
|
82
65
|
const current = get(websocketSessionAtom);
|
|
@@ -101,7 +84,7 @@ function loadHistory(get, set, session, from, retryDelay = 1000) {
|
|
|
101
84
|
}, (e) => {
|
|
102
85
|
if (!isCurrentSession(get, session))
|
|
103
86
|
return;
|
|
104
|
-
set(errorLoadingLogRW,
|
|
87
|
+
set(errorLoadingLogRW, apiErrorMessage(e, "Error loading log history"));
|
|
105
88
|
// Keep buffering and retry from the same applied position without interrupting live status.
|
|
106
89
|
setTimeout(() => {
|
|
107
90
|
if (isCurrentSession(get, session)) {
|
|
@@ -125,7 +108,7 @@ function finishLoading(loads, get, set, session) {
|
|
|
125
108
|
Promise.all(loads)
|
|
126
109
|
.catch((e) => {
|
|
127
110
|
if (isCurrentSession(get, session)) {
|
|
128
|
-
set(errorLoadingLast30RW,
|
|
111
|
+
set(errorLoadingLast30RW, apiErrorMessage(e, "Error"));
|
|
129
112
|
}
|
|
130
113
|
})
|
|
131
114
|
.finally(() => {
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
const nr = "-?\\d+(?:[\\.,]\\d+)?";
|
|
2
2
|
const dateRegex = "(" + nr + "Y)?(" + nr + "M)?(" + nr + "D)?";
|
|
3
3
|
const timeRegex = "T(" + nr + "H)?(" + nr + "M)?(" + nr + "S)?";
|
|
4
|
-
const durationRegex = new RegExp("P" + dateRegex + "(?:" + timeRegex + ")
|
|
4
|
+
const durationRegex = new RegExp("^(-?)P" + dateRegex + "(?:" + timeRegex + ")?$");
|
|
5
5
|
export default function parseISODuration(argument) {
|
|
6
6
|
const match = durationRegex.exec(argument);
|
|
7
7
|
if (!match) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
// at least one part must be specified
|
|
11
|
-
if (!match
|
|
11
|
+
if (!match.slice(2).some(Boolean)) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
+
const sign = match[1] === "-" ? -1 : 1;
|
|
14
15
|
const duration = {};
|
|
15
|
-
if (match[1])
|
|
16
|
-
duration.years = parseFloat(match[1]);
|
|
17
16
|
if (match[2])
|
|
18
|
-
duration.
|
|
17
|
+
duration.years = sign * parseFloat(match[2]);
|
|
19
18
|
if (match[3])
|
|
20
|
-
duration.
|
|
19
|
+
duration.months = sign * parseFloat(match[3]);
|
|
21
20
|
if (match[4])
|
|
22
|
-
duration.
|
|
21
|
+
duration.days = sign * parseFloat(match[4]);
|
|
23
22
|
if (match[5])
|
|
24
|
-
duration.
|
|
23
|
+
duration.hours = sign * parseFloat(match[5]);
|
|
25
24
|
if (match[6])
|
|
26
|
-
duration.
|
|
25
|
+
duration.minutes = sign * parseFloat(match[6]);
|
|
26
|
+
if (match[7])
|
|
27
|
+
duration.seconds = sign * parseFloat(match[7]);
|
|
27
28
|
return duration;
|
|
28
29
|
}
|
|
29
30
|
export function durationToSeconds(duration) {
|
package/docs/server-config.md
CHANGED
|
@@ -29,19 +29,27 @@ message with details into the [event log](server-errors).
|
|
|
29
29
|
|
|
30
30
|
FMS Insight uses [SQLite](https://www.sqlite.org/) to store data about the cell. The primary data
|
|
31
31
|
stored is a log of the activity of all parts, pallets, machines, jobs, schedules, inspections,
|
|
32
|
-
serial numbers, orders, and other data.
|
|
33
|
-
|
|
32
|
+
serial numbers, orders, and other data. The databases also hold operational state, including
|
|
33
|
+
committed basket contents, material-allocation identities, and operation receipts used to recognize
|
|
34
|
+
completed work on retries.
|
|
34
35
|
|
|
35
36
|
The SQLite databases are by default stored locally in the Windows Common AppData folder which on a
|
|
36
37
|
default Windows install is `c:\ProgramData\SeedTactics\FMSInsight`. This path can be changed in the
|
|
37
38
|
`config.ini` file if needed, but we suggest that the databases are kept on the local drive for
|
|
38
|
-
performance and data integrity (SQLite works best on a local drive).
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
performance and data integrity (SQLite works best on a local drive). Database size grows with
|
|
40
|
+
production activity and retained history; allow space for both production databases and backups.
|
|
41
|
+
|
|
42
|
+
Preserve production databases and back them up before upgrades. Use a backup method that captures a
|
|
43
|
+
consistent SQLite database, such as stopping the server before copying its database files. If an
|
|
44
|
+
integration maintains additional coordination databases, follow its procedure for backing up the
|
|
45
|
+
complete installation consistently.
|
|
46
|
+
|
|
47
|
+
Deleting a production database loses both history and operational identities and retry records.
|
|
48
|
+
Creating a fresh database does not reconstruct that state from the equipment. Follow the
|
|
49
|
+
integration's recovery procedure before resetting or restoring databases, including reconciling the
|
|
50
|
+
physical cell and any integration-specific state. A backup from an earlier point in production is
|
|
51
|
+
not automatically safe to restore against a cell that has continued operating.
|
|
52
|
+
|
|
53
|
+
Fresh databases can be used for controlled QA or initial commissioning when the physical cell and
|
|
54
|
+
the integration's state have been prepared for a fresh start. FMS Insight creates missing databases
|
|
55
|
+
at startup; integrations may impose additional startup and initialization requirements.
|