@seedtactics/insight-client 16.4.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/README.md +37 -0
- package/dist/cell-status/buffers.d.ts +36 -0
- package/dist/cell-status/buffers.js +127 -0
- package/dist/cell-status/current-status.d.ts +30 -0
- package/dist/cell-status/current-status.js +200 -0
- package/dist/cell-status/estimated-cycle-times.d.ts +41 -0
- package/dist/cell-status/estimated-cycle-times.js +257 -0
- package/dist/cell-status/inspections.d.ts +55 -0
- package/dist/cell-status/inspections.js +213 -0
- package/dist/cell-status/loading.d.ts +26 -0
- package/dist/cell-status/loading.js +112 -0
- package/dist/cell-status/material-details.d.ts +116 -0
- package/dist/cell-status/material-details.js +422 -0
- package/dist/cell-status/material-summary.d.ts +52 -0
- package/dist/cell-status/material-summary.js +312 -0
- package/dist/cell-status/names.d.ts +19 -0
- package/dist/cell-status/names.js +134 -0
- package/dist/cell-status/pallet-cycles.d.ts +24 -0
- package/dist/cell-status/pallet-cycles.js +78 -0
- package/dist/cell-status/rebookings.d.ts +30 -0
- package/dist/cell-status/rebookings.js +139 -0
- package/dist/cell-status/scheduled-jobs.d.ts +18 -0
- package/dist/cell-status/scheduled-jobs.js +94 -0
- package/dist/cell-status/sim-day-usage.d.ts +14 -0
- package/dist/cell-status/sim-day-usage.js +54 -0
- package/dist/cell-status/sim-production.d.ts +22 -0
- package/dist/cell-status/sim-production.js +91 -0
- package/dist/cell-status/sim-station-use.d.ts +25 -0
- package/dist/cell-status/sim-station-use.js +71 -0
- package/dist/cell-status/station-cycles.d.ts +34 -0
- package/dist/cell-status/station-cycles.js +145 -0
- package/dist/cell-status/tool-replacements.d.ts +44 -0
- package/dist/cell-status/tool-replacements.js +155 -0
- package/dist/cell-status/tool-usage.d.ts +25 -0
- package/dist/cell-status/tool-usage.js +95 -0
- package/dist/components/App.d.ts +15 -0
- package/dist/components/App.js +549 -0
- package/dist/components/AxisAndGrid.d.ts +51 -0
- package/dist/components/AxisAndGrid.js +47 -0
- package/dist/components/BarcodeScanning.d.ts +6 -0
- package/dist/components/BarcodeScanning.js +150 -0
- package/dist/components/ChartTooltip.d.ts +28 -0
- package/dist/components/ChartTooltip.js +95 -0
- package/dist/components/ChooseMode.d.ts +18 -0
- package/dist/components/ChooseMode.js +136 -0
- package/dist/components/ChooseOperator.d.ts +1 -0
- package/dist/components/ChooseOperator.js +93 -0
- package/dist/components/ErrorsAndLoading.d.ts +9 -0
- package/dist/components/ErrorsAndLoading.js +55 -0
- package/dist/components/LoadingIcon.d.ts +1 -0
- package/dist/components/LoadingIcon.js +48 -0
- package/dist/components/LogEntry.d.ts +16 -0
- package/dist/components/LogEntry.js +365 -0
- package/dist/components/ManualSerialEntry.d.ts +5 -0
- package/dist/components/ManualSerialEntry.js +91 -0
- package/dist/components/MonthSelect.d.ts +6 -0
- package/dist/components/MonthSelect.js +67 -0
- package/dist/components/Navigation.d.ts +23 -0
- package/dist/components/Navigation.js +120 -0
- package/dist/components/VerboseLogging.d.ts +1 -0
- package/dist/components/VerboseLogging.js +47 -0
- package/dist/components/analysis/AnalysisSelectToolbar.d.ts +1 -0
- package/dist/components/analysis/AnalysisSelectToolbar.js +55 -0
- package/dist/components/analysis/BufferChart.d.ts +1 -0
- package/dist/components/analysis/BufferChart.js +139 -0
- package/dist/components/analysis/CostPerPiece.d.ts +2 -0
- package/dist/components/analysis/CostPerPiece.js +175 -0
- package/dist/components/analysis/CycleChart.d.ts +42 -0
- package/dist/components/analysis/CycleChart.js +281 -0
- package/dist/components/analysis/DataTable.d.ts +83 -0
- package/dist/components/analysis/DataTable.js +215 -0
- package/dist/components/analysis/EfficiencyPage.d.ts +2 -0
- package/dist/components/analysis/EfficiencyPage.js +138 -0
- package/dist/components/analysis/HeatChart.d.ts +22 -0
- package/dist/components/analysis/HeatChart.js +161 -0
- package/dist/components/analysis/InspectionDataTable.d.ts +10 -0
- package/dist/components/analysis/InspectionDataTable.js +148 -0
- package/dist/components/analysis/InspectionSankey.d.ts +12 -0
- package/dist/components/analysis/InspectionSankey.js +140 -0
- package/dist/components/analysis/PalletCycleCards.d.ts +1 -0
- package/dist/components/analysis/PalletCycleCards.js +137 -0
- package/dist/components/analysis/PartCycleCards.d.ts +2 -0
- package/dist/components/analysis/PartCycleCards.js +331 -0
- package/dist/components/analysis/QualityPage.d.ts +1 -0
- package/dist/components/analysis/QualityPage.js +49 -0
- package/dist/components/analysis/ScheduleHistory.d.ts +3 -0
- package/dist/components/analysis/ScheduleHistory.js +108 -0
- package/dist/components/analysis/StationDataTable.d.ts +25 -0
- package/dist/components/analysis/StationDataTable.js +246 -0
- package/dist/components/analysis/ToolReplacements.d.ts +1 -0
- package/dist/components/analysis/ToolReplacements.js +370 -0
- package/dist/components/operations/AllMaterial.d.ts +5 -0
- package/dist/components/operations/AllMaterial.js +267 -0
- package/dist/components/operations/ChartRangeEdit.d.ts +4 -0
- package/dist/components/operations/ChartRangeEdit.js +148 -0
- package/dist/components/operations/CloseoutReport.d.ts +2 -0
- package/dist/components/operations/CloseoutReport.js +172 -0
- package/dist/components/operations/CompletedParts.d.ts +2 -0
- package/dist/components/operations/CompletedParts.js +286 -0
- package/dist/components/operations/CurrentWorkorders.d.ts +3 -0
- package/dist/components/operations/CurrentWorkorders.js +368 -0
- package/dist/components/operations/Dashboard.d.ts +2 -0
- package/dist/components/operations/Dashboard.js +90 -0
- package/dist/components/operations/OEEChart.d.ts +10 -0
- package/dist/components/operations/OEEChart.js +173 -0
- package/dist/components/operations/Outliers.d.ts +4 -0
- package/dist/components/operations/Outliers.js +69 -0
- package/dist/components/operations/ProgramHighlight.d.ts +1 -0
- package/dist/components/operations/ProgramHighlight.js +9 -0
- package/dist/components/operations/Programs.d.ts +5 -0
- package/dist/components/operations/Programs.js +363 -0
- package/dist/components/operations/Rebookings.d.ts +1 -0
- package/dist/components/operations/Rebookings.js +213 -0
- package/dist/components/operations/RecentCycleChart.d.ts +4 -0
- package/dist/components/operations/RecentCycleChart.js +240 -0
- package/dist/components/operations/RecentProduction.d.ts +2 -0
- package/dist/components/operations/RecentProduction.js +213 -0
- package/dist/components/operations/RecentSchedules.d.ts +12 -0
- package/dist/components/operations/RecentSchedules.js +180 -0
- package/dist/components/operations/RecentStationCycles.d.ts +4 -0
- package/dist/components/operations/RecentStationCycles.js +159 -0
- package/dist/components/operations/ShiftSettings.d.ts +6 -0
- package/dist/components/operations/ShiftSettings.js +134 -0
- package/dist/components/operations/SimDayUsage.d.ts +1 -0
- package/dist/components/operations/SimDayUsage.js +133 -0
- package/dist/components/operations/ToolReport.d.ts +3 -0
- package/dist/components/operations/ToolReport.js +233 -0
- package/dist/components/operations/WorkorderGantt.d.ts +1 -0
- package/dist/components/operations/WorkorderGantt.js +124 -0
- package/dist/components/quality/QualityMaterial.d.ts +2 -0
- package/dist/components/quality/QualityMaterial.js +169 -0
- package/dist/components/quality/QualityPaths.d.ts +1 -0
- package/dist/components/quality/QualityPaths.js +53 -0
- package/dist/components/quality/RecentFailedInspections.d.ts +1 -0
- package/dist/components/quality/RecentFailedInspections.js +123 -0
- package/dist/components/routes.d.ts +170 -0
- package/dist/components/routes.js +301 -0
- package/dist/components/station-monitor/BulkRawMaterial.d.ts +11 -0
- package/dist/components/station-monitor/BulkRawMaterial.js +251 -0
- package/dist/components/station-monitor/Closeout.d.ts +5 -0
- package/dist/components/station-monitor/Closeout.js +162 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.d.ts +1 -0
- package/dist/components/station-monitor/CustomStationMonitorDialog.js +55 -0
- package/dist/components/station-monitor/Inspection.d.ts +8 -0
- package/dist/components/station-monitor/Inspection.js +164 -0
- package/dist/components/station-monitor/InvalidateCycle.d.ts +33 -0
- package/dist/components/station-monitor/InvalidateCycle.js +262 -0
- package/dist/components/station-monitor/JobDetails.d.ts +7 -0
- package/dist/components/station-monitor/JobDetails.js +108 -0
- package/dist/components/station-monitor/LoadStation.d.ts +10 -0
- package/dist/components/station-monitor/LoadStation.js +450 -0
- package/dist/components/station-monitor/Material.d.ts +77 -0
- package/dist/components/station-monitor/Material.js +489 -0
- package/dist/components/station-monitor/MoveMaterialArrows.d.ts +11 -0
- package/dist/components/station-monitor/MoveMaterialArrows.js +118 -0
- package/dist/components/station-monitor/PrintedLabel.d.ts +29 -0
- package/dist/components/station-monitor/PrintedLabel.js +166 -0
- package/dist/components/station-monitor/QuarantineButton.d.ts +4 -0
- package/dist/components/station-monitor/QuarantineButton.js +184 -0
- package/dist/components/station-monitor/Queues.d.ts +23 -0
- package/dist/components/station-monitor/Queues.js +312 -0
- package/dist/components/station-monitor/QueuesAddMaterial.d.ts +30 -0
- package/dist/components/station-monitor/QueuesAddMaterial.js +248 -0
- package/dist/components/station-monitor/SelectInspType.d.ts +2 -0
- package/dist/components/station-monitor/SelectInspType.js +99 -0
- package/dist/components/station-monitor/SelectWorkorder.d.ts +4 -0
- package/dist/components/station-monitor/SelectWorkorder.js +100 -0
- package/dist/components/station-monitor/StationToolbar.d.ts +3 -0
- package/dist/components/station-monitor/StationToolbar.js +168 -0
- package/dist/components/station-monitor/SystemOverview.d.ts +46 -0
- package/dist/components/station-monitor/SystemOverview.js +439 -0
- package/dist/components/station-monitor/Whiteboard.d.ts +10 -0
- package/dist/components/station-monitor/Whiteboard.js +67 -0
- package/dist/data/all-material-bins.d.ts +45 -0
- package/dist/data/all-material-bins.js +224 -0
- package/dist/data/chart-times.d.ts +20 -0
- package/dist/data/chart-times.js +99 -0
- package/dist/data/cost-per-piece.d.ts +32 -0
- package/dist/data/cost-per-piece.js +183 -0
- package/dist/data/current-cycles.d.ts +13 -0
- package/dist/data/current-cycles.js +144 -0
- package/dist/data/inspection-sankey.d.ts +15 -0
- package/dist/data/inspection-sankey.js +147 -0
- package/dist/data/move-arrows.d.ts +48 -0
- package/dist/data/move-arrows.js +217 -0
- package/dist/data/operators.d.ts +2 -0
- package/dist/data/operators.js +44 -0
- package/dist/data/part-summary.d.ts +17 -0
- package/dist/data/part-summary.js +107 -0
- package/dist/data/path-lookup.d.ts +13 -0
- package/dist/data/path-lookup.js +107 -0
- package/dist/data/queue-material.d.ts +46 -0
- package/dist/data/queue-material.js +256 -0
- package/dist/data/results.bufferchart.d.ts +10 -0
- package/dist/data/results.bufferchart.js +90 -0
- package/dist/data/results.completed-parts.d.ts +26 -0
- package/dist/data/results.completed-parts.js +181 -0
- package/dist/data/results.cycles.d.ts +86 -0
- package/dist/data/results.cycles.js +454 -0
- package/dist/data/results.inspection.d.ts +36 -0
- package/dist/data/results.inspection.js +188 -0
- package/dist/data/results.oee.d.ts +40 -0
- package/dist/data/results.oee.js +330 -0
- package/dist/data/results.schedules.d.ts +23 -0
- package/dist/data/results.schedules.js +157 -0
- package/dist/data/tools-programs.d.ts +78 -0
- package/dist/data/tools-programs.js +376 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -0
- package/dist/network/api.d.ts +1390 -0
- package/dist/network/api.js +4971 -0
- package/dist/network/backend-mock.d.ts +11 -0
- package/dist/network/backend-mock.js +512 -0
- package/dist/network/backend.d.ts +57 -0
- package/dist/network/backend.js +77 -0
- package/dist/network/load-specific-month.d.ts +13 -0
- package/dist/network/load-specific-month.js +77 -0
- package/dist/network/server-settings.d.ts +12 -0
- package/dist/network/server-settings.js +92 -0
- package/dist/network/websocket.d.ts +4 -0
- package/dist/network/websocket.js +165 -0
- package/dist/renderer.d.ts +8 -0
- package/dist/renderer.js +55 -0
- package/dist/seedtactics-logo.d.ts +2 -0
- package/dist/seedtactics-logo.js +4 -0
- package/dist/util/chart-colors.d.ts +1 -0
- package/dist/util/chart-colors.js +116 -0
- package/dist/util/chart-helpers.d.ts +3 -0
- package/dist/util/chart-helpers.js +51 -0
- package/dist/util/parseISODuration.d.ts +4 -0
- package/dist/util/parseISODuration.js +40 -0
- package/docs/client-efficiency.md +355 -0
- package/docs/client-engineering.md +54 -0
- package/docs/client-launch.md +55 -0
- package/docs/client-operations.md +88 -0
- package/docs/client-quality.md +74 -0
- package/docs/client-sales.md +61 -0
- package/docs/client-scanners.md +41 -0
- package/docs/client-station-monitor.md +149 -0
- package/docs/client-tools-programs.md +74 -0
- package/docs/improve-fms.md +141 -0
- package/docs/makino.md +40 -0
- package/docs/material-quarantine.md +82 -0
- package/docs/material-tracking.md +236 -0
- package/docs/mazak.md +115 -0
- package/docs/niigata.md +228 -0
- package/docs/operator-procedures.md +106 -0
- package/docs/part-instructions.md +63 -0
- package/docs/screenshots/insight-all-material.png +0 -0
- package/docs/screenshots/insight-analysis-pallets.png +0 -0
- package/docs/screenshots/insight-analysis-part-completed.png +0 -0
- package/docs/screenshots/insight-analysis-sankey.png +0 -0
- package/docs/screenshots/insight-analysis-station-oee.png +0 -0
- package/docs/screenshots/insight-buffer-occupancy.png +0 -0
- package/docs/screenshots/insight-choose-analysis-month.png +0 -0
- package/docs/screenshots/insight-closeout.png +0 -0
- package/docs/screenshots/insight-cost-percentages.png +0 -0
- package/docs/screenshots/insight-dashboard.png +0 -0
- package/docs/screenshots/insight-event-custom-view.jpg +0 -0
- package/docs/screenshots/insight-event-viewer.jpg +0 -0
- package/docs/screenshots/insight-inspection.png +0 -0
- package/docs/screenshots/insight-load-station-details.png +0 -0
- package/docs/screenshots/insight-load-station.png +0 -0
- package/docs/screenshots/insight-loadcycle-graph.png +0 -0
- package/docs/screenshots/insight-loadstation-small.jpg +0 -0
- package/docs/screenshots/insight-machinecycle-graph.png +0 -0
- package/docs/screenshots/insight-machinecycle-table.png +0 -0
- package/docs/screenshots/insight-machinecycles.png +0 -0
- package/docs/screenshots/insight-machinehours.png +0 -0
- package/docs/screenshots/insight-machineoutliers.png +0 -0
- package/docs/screenshots/insight-monthly-schedules.png +0 -0
- package/docs/screenshots/insight-operations-material.png +0 -0
- package/docs/screenshots/insight-operations-overview.png +0 -0
- package/docs/screenshots/insight-operations-reports.png +0 -0
- package/docs/screenshots/insight-part-cost.png +0 -0
- package/docs/screenshots/insight-program-report.png +0 -0
- package/docs/screenshots/insight-quality-material-details.png +0 -0
- package/docs/screenshots/insight-quality-material.png +0 -0
- package/docs/screenshots/insight-quality-quarantine.png +0 -0
- package/docs/screenshots/insight-quality-sankey.png +0 -0
- package/docs/screenshots/insight-quality-similar-paths.png +0 -0
- package/docs/screenshots/insight-queue-details.png +0 -0
- package/docs/screenshots/insight-queues-jobs-table.png +0 -0
- package/docs/screenshots/insight-queues.png +0 -0
- package/docs/screenshots/insight-sim-day-usage.png +0 -0
- package/docs/screenshots/insight-station-system-overview-buttons.png +0 -0
- package/docs/screenshots/insight-station-system-overview.png +0 -0
- package/docs/screenshots/insight-system-overview.png +0 -0
- package/docs/screenshots/insight-tool-replacements.png +0 -0
- package/docs/screenshots/insight-tool-report.png +0 -0
- package/docs/screenshots/insight-toolbar-btns.png +0 -0
- package/docs/screenshots/insight-workorder-gantt.png +0 -0
- package/docs/screenshots/insight-workorders.png +0 -0
- package/docs/security.md +131 -0
- package/docs/server-config.md +56 -0
- package/docs/server-errors.md +44 -0
- package/package.json +90 -0
- package/src/index.ts +65 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2022, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo, useEffect, useState } from "react";
|
|
35
|
+
import { materialDialogOpen } from "../cell-status/material-details.js";
|
|
36
|
+
import { atom, useAtom, useSetAtom } from "jotai";
|
|
37
|
+
import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TextField, Tooltip, } from "@mui/material";
|
|
38
|
+
import { CameraAlt } from "@mui/icons-material";
|
|
39
|
+
import { Scanner } from "@yudiel/react-qr-scanner";
|
|
40
|
+
export const BarcodeListener = memo(function BarcodeListener() {
|
|
41
|
+
const setBarcode = useSetAtom(materialDialogOpen);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
let timeout;
|
|
44
|
+
let scanActive = false;
|
|
45
|
+
let scannedTxt = "";
|
|
46
|
+
let lastBangTime = null;
|
|
47
|
+
function cancelDetection() {
|
|
48
|
+
scannedTxt = "";
|
|
49
|
+
scanActive = false;
|
|
50
|
+
}
|
|
51
|
+
function startDetection() {
|
|
52
|
+
scannedTxt = "";
|
|
53
|
+
scanActive = true;
|
|
54
|
+
timeout = window.setTimeout(cancelDetection, 3 * 1000);
|
|
55
|
+
}
|
|
56
|
+
function success() {
|
|
57
|
+
if (timeout) {
|
|
58
|
+
clearTimeout(timeout);
|
|
59
|
+
timeout = undefined;
|
|
60
|
+
}
|
|
61
|
+
scanActive = false;
|
|
62
|
+
setBarcode({ type: "Barcode", barcode: scannedTxt, toQueue: null });
|
|
63
|
+
}
|
|
64
|
+
function onKeyDown(k) {
|
|
65
|
+
if (k.key === "!") {
|
|
66
|
+
lastBangTime = Date.now();
|
|
67
|
+
}
|
|
68
|
+
else if (k.code === "F1" && !scanActive) {
|
|
69
|
+
startDetection();
|
|
70
|
+
k.stopPropagation();
|
|
71
|
+
k.preventDefault();
|
|
72
|
+
}
|
|
73
|
+
else if (k.key === "*" && !scanActive && lastBangTime !== null && Date.now() - lastBangTime < 1000) {
|
|
74
|
+
startDetection();
|
|
75
|
+
k.stopPropagation();
|
|
76
|
+
k.preventDefault();
|
|
77
|
+
}
|
|
78
|
+
else if (scanActive && k.code === "Enter") {
|
|
79
|
+
success();
|
|
80
|
+
k.stopPropagation();
|
|
81
|
+
k.preventDefault();
|
|
82
|
+
}
|
|
83
|
+
else if (scanActive && k.key && k.key.length === 1) {
|
|
84
|
+
if (/[a-zA-Z0-9-|_,;]/.test(k.key)) {
|
|
85
|
+
scannedTxt += k.key;
|
|
86
|
+
k.stopPropagation();
|
|
87
|
+
k.preventDefault();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
document.addEventListener("keydown", onKeyDown, { capture: true });
|
|
92
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
93
|
+
}, [setBarcode]);
|
|
94
|
+
return null;
|
|
95
|
+
});
|
|
96
|
+
export const QRScanButton = memo(function QRScanButton() {
|
|
97
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
98
|
+
const setBarcode = useSetAtom(materialDialogOpen);
|
|
99
|
+
const [manual, setManual] = useState("");
|
|
100
|
+
if (window.location.protocol !== "https:" &&
|
|
101
|
+
(import.meta.env.PROD || window.location.hostname !== "localhost"))
|
|
102
|
+
return null;
|
|
103
|
+
function onScan(results) {
|
|
104
|
+
if (results.length > 0 && results[0].rawValue !== null && results[0].rawValue !== "") {
|
|
105
|
+
setBarcode({ type: "Barcode", barcode: results[0].rawValue, toQueue: null });
|
|
106
|
+
setDialogOpen(false);
|
|
107
|
+
setManual("");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function onManual() {
|
|
111
|
+
if (manual !== "") {
|
|
112
|
+
setBarcode({ type: "Barcode", barcode: manual, toQueue: null });
|
|
113
|
+
}
|
|
114
|
+
setDialogOpen(false);
|
|
115
|
+
setManual("");
|
|
116
|
+
}
|
|
117
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Dialog, { open: dialogOpen, onClose: () => setDialogOpen(false), children: [_jsx(DialogTitle, { children: "Scan a QR Code" }), _jsxs(DialogContent, { children: [_jsx(Box, { width: "15em", height: "15em", children: dialogOpen ? _jsx(Scanner, { onScan: onScan }) : undefined }), _jsx(Box, { marginTop: "1em", children: _jsx(TextField, { label: "Manual Entry", value: manual, variant: "outlined", fullWidth: true, onKeyDown: (e) => {
|
|
118
|
+
if (e.key === "Enter") {
|
|
119
|
+
onManual();
|
|
120
|
+
}
|
|
121
|
+
}, onChange: (e) => setManual(e.target.value) }) })] }), _jsxs(DialogActions, { children: [manual !== "" ? _jsx(Button, { onClick: onManual, children: "Submit" }) : undefined, _jsx(Button, { onClick: () => setDialogOpen(false), children: "Cancel" })] })] }), _jsx(Tooltip, { title: "Scan QR Code", children: _jsx(IconButton, { onClick: () => setDialogOpen(true), size: "large", children: _jsx(CameraAlt, {}) }) })] }));
|
|
122
|
+
});
|
|
123
|
+
// A version of the above dialog that in addition passes along which queue the material
|
|
124
|
+
// is being added to.
|
|
125
|
+
export const scanBarcodeToAddToQueueDialog = atom(null);
|
|
126
|
+
export const AddByBarcodeDialog = memo(function AddByBarcodeDialog() {
|
|
127
|
+
const [queue, setQueue] = useAtom(scanBarcodeToAddToQueueDialog);
|
|
128
|
+
const [manual, setManual] = useState("");
|
|
129
|
+
const setBarcode = useSetAtom(materialDialogOpen);
|
|
130
|
+
function onScan(results) {
|
|
131
|
+
if (queue !== null && results.length > 0 && results[0].rawValue !== null && results[0].rawValue !== "") {
|
|
132
|
+
setBarcode({ type: "Barcode", barcode: results[0].rawValue, toQueue: queue });
|
|
133
|
+
setQueue(null);
|
|
134
|
+
setManual("");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function onManual() {
|
|
138
|
+
if (manual !== "" && queue !== null) {
|
|
139
|
+
setBarcode({ type: "Barcode", barcode: manual, toQueue: queue });
|
|
140
|
+
}
|
|
141
|
+
setQueue(null);
|
|
142
|
+
setManual("");
|
|
143
|
+
}
|
|
144
|
+
return (_jsxs(Dialog, { open: queue !== null, onClose: () => setQueue(null), maxWidth: "md", children: [_jsxs(DialogTitle, { children: ["Scan a Barcode To Add To ", queue] }), _jsxs(DialogContent, { children: [window.location.protocol === "https:" ||
|
|
145
|
+
(import.meta.env.DEV && window.location.hostname === "localhost") ? (_jsx(Box, { width: "15em", height: "15em", children: queue !== null ? _jsx(Scanner, { onScan: onScan }) : undefined })) : undefined, _jsx(Box, { marginTop: "1em", children: _jsx(TextField, { label: "Manual Entry", value: manual, variant: "outlined", fullWidth: true, onKeyDown: (e) => {
|
|
146
|
+
if (e.key === "Enter") {
|
|
147
|
+
onManual();
|
|
148
|
+
}
|
|
149
|
+
}, onChange: (e) => setManual(e.target.value) }) })] }), _jsxs(DialogActions, { children: [manual !== "" ? _jsx(Button, { onClick: onManual, children: "Submit" }) : undefined, _jsx(Button, { onClick: () => setQueue(null), children: "Cancel" })] })] }));
|
|
150
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material/styles";
|
|
2
|
+
import { Atom } from "jotai";
|
|
3
|
+
import { ComponentType } from "react";
|
|
4
|
+
export type TooltipAtom<T> = Atom<({
|
|
5
|
+
readonly left: number;
|
|
6
|
+
readonly top: number;
|
|
7
|
+
readonly zIndex?: number;
|
|
8
|
+
} & T) | null>;
|
|
9
|
+
export declare function Tooltip<T>({ chartHeight, chartWidth, atom, TooltipContent, }: {
|
|
10
|
+
chartHeight: number;
|
|
11
|
+
chartWidth: number;
|
|
12
|
+
atom: TooltipAtom<T>;
|
|
13
|
+
TooltipContent: ComponentType<{
|
|
14
|
+
tooltip: T;
|
|
15
|
+
}>;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export declare function ChartWithTooltip<T>({ chart, tooltipAtom, TooltipContent, sx, autoHeight, }: {
|
|
18
|
+
chart: ({ width, height }: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}) => React.ReactNode;
|
|
22
|
+
tooltipAtom: TooltipAtom<T>;
|
|
23
|
+
TooltipContent: ComponentType<{
|
|
24
|
+
tooltip: T;
|
|
25
|
+
}>;
|
|
26
|
+
sx?: SxProps;
|
|
27
|
+
autoHeight?: boolean;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2025, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { styled } from "@mui/material/styles";
|
|
35
|
+
import { grey } from "@mui/material/colors";
|
|
36
|
+
import { useResizeDetector } from "react-resize-detector";
|
|
37
|
+
import { useAtomValue } from "jotai";
|
|
38
|
+
import { Box } from "@mui/material";
|
|
39
|
+
const ChartTooltipContainer = styled("div")({
|
|
40
|
+
backgroundColor: grey[700],
|
|
41
|
+
color: "white",
|
|
42
|
+
padding: "0.3rem 0.5rem",
|
|
43
|
+
borderRadius: "3px",
|
|
44
|
+
boxShadow: "0 1px 2px rgba(33, 33, 33, 0.2)",
|
|
45
|
+
pointerEvents: "none",
|
|
46
|
+
});
|
|
47
|
+
export function Tooltip({ chartHeight, chartWidth, atom, TooltipContent, }) {
|
|
48
|
+
const pos = useAtomValue(atom);
|
|
49
|
+
const { ref: tooltipRef, width: tooltipWidth, height: tooltipHeight, } = useResizeDetector({
|
|
50
|
+
refreshMode: "debounce",
|
|
51
|
+
refreshRate: 100,
|
|
52
|
+
});
|
|
53
|
+
if (!pos)
|
|
54
|
+
return null;
|
|
55
|
+
let tLeft = pos.left;
|
|
56
|
+
let tTop = pos.top;
|
|
57
|
+
if (tooltipWidth !== undefined) {
|
|
58
|
+
// Adjust tooltip position if it overflows the chart boundaries
|
|
59
|
+
// Check if the right edge (tLeft + 10 + tooltipWidth) is beyond the chart width
|
|
60
|
+
// and also that we are past halfway across
|
|
61
|
+
if (tLeft + 10 + tooltipWidth > chartWidth && tLeft + 10 > chartWidth / 2) {
|
|
62
|
+
tLeft = tLeft - tooltipWidth - 30;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
tLeft = tLeft + 10;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (tooltipHeight !== undefined) {
|
|
69
|
+
// Adjust tooltip position if it overflows the chart boundaries
|
|
70
|
+
// Check if the bottom edge (tTop + 10 + tooltipHeight) is beyond the chart height
|
|
71
|
+
// and also that we are past halfway down
|
|
72
|
+
if (tTop + 10 + tooltipHeight > chartHeight && tTop + 10 > chartHeight / 2) {
|
|
73
|
+
tTop = tTop - tooltipHeight - 10;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
tTop = tTop + 10;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return (_jsx("div", { style: {
|
|
80
|
+
visibility: tooltipHeight !== undefined && tooltipWidth !== undefined ? "visible" : "hidden",
|
|
81
|
+
position: "absolute",
|
|
82
|
+
left: tLeft,
|
|
83
|
+
top: tTop,
|
|
84
|
+
zIndex: 10,
|
|
85
|
+
}, children: _jsx(ChartTooltipContainer, { ref: tooltipRef, style: pos?.zIndex ? { zIndex: pos.zIndex } : undefined, children: _jsx(TooltipContent, { tooltip: pos }) }) }));
|
|
86
|
+
}
|
|
87
|
+
export function ChartWithTooltip({ chart, tooltipAtom, TooltipContent, sx, autoHeight, }) {
|
|
88
|
+
const { ref: chartRef, width: chartWidth, height: chartHeight, } = useResizeDetector({
|
|
89
|
+
refreshMode: "debounce",
|
|
90
|
+
refreshRate: 100,
|
|
91
|
+
});
|
|
92
|
+
return (_jsx(Box, { ref: chartRef, sx: sx, children: _jsxs(Box, { sx: { position: "relative", overflow: "hidden" }, children: [chartWidth && (chartHeight || autoHeight)
|
|
93
|
+
? chart({ width: chartWidth, height: chartHeight ?? 0 })
|
|
94
|
+
: undefined, chartHeight && chartWidth ? (_jsx(Tooltip, { chartHeight: chartHeight, chartWidth: chartWidth, atom: tooltipAtom, TooltipContent: TooltipContent })) : undefined] }) }));
|
|
95
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RouteState } from "./routes.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export type ChooseModeItem = {
|
|
4
|
+
readonly type: "Subheader";
|
|
5
|
+
readonly caption: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: "Link";
|
|
8
|
+
route: RouteState;
|
|
9
|
+
readonly icon: ReactNode;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const defaultChooseModes: ReadonlyArray<ChooseModeItem>;
|
|
13
|
+
export interface ChooseModeProps {
|
|
14
|
+
readonly setRoute: (r: RouteState) => void;
|
|
15
|
+
readonly modes?: ReadonlyArray<ChooseModeItem> | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function ChooseMode(p: ChooseModeProps): ReactNode;
|
|
18
|
+
export default ChooseMode;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2021, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { ListItem, ListItemButton, Paper } from "@mui/material";
|
|
35
|
+
import { List } from "@mui/material";
|
|
36
|
+
import { ListItemIcon } from "@mui/material";
|
|
37
|
+
import { ListSubheader } from "@mui/material";
|
|
38
|
+
import { ListItemText } from "@mui/material";
|
|
39
|
+
import { Typography } from "@mui/material";
|
|
40
|
+
import { Build as BuildIcon, ShoppingBasket, Directions as DirectionsIcon, StarRate as StarIcon, InsertChart as ChartIcon, Extension as ExtensionIcon, Info as InfoIcon, Opacity as OpacityIcon, Memory as MemoryIcon, CalendarViewMonth, Paid as SalesIcon, } from "@mui/icons-material";
|
|
41
|
+
import { RouteLocation } from "./routes.js";
|
|
42
|
+
export const defaultChooseModes = [
|
|
43
|
+
{ type: "Subheader", caption: "Shop Floor" },
|
|
44
|
+
{
|
|
45
|
+
type: "Link",
|
|
46
|
+
route: {
|
|
47
|
+
route: RouteLocation.Station_LoadMonitor,
|
|
48
|
+
loadNum: 1,
|
|
49
|
+
queues: [],
|
|
50
|
+
completed: false,
|
|
51
|
+
},
|
|
52
|
+
icon: _jsx(DirectionsIcon, {}),
|
|
53
|
+
label: "Load Station",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "Link",
|
|
57
|
+
route: {
|
|
58
|
+
route: RouteLocation.Station_Queues,
|
|
59
|
+
queues: [],
|
|
60
|
+
},
|
|
61
|
+
icon: _jsx(ExtensionIcon, {}),
|
|
62
|
+
label: "Queue Management",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "Link",
|
|
66
|
+
route: {
|
|
67
|
+
route: RouteLocation.Station_InspectionMonitor,
|
|
68
|
+
},
|
|
69
|
+
icon: _jsx(InfoIcon, {}),
|
|
70
|
+
label: "Inspection Stand",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: "Link",
|
|
74
|
+
route: {
|
|
75
|
+
route: RouteLocation.Station_Closeout,
|
|
76
|
+
},
|
|
77
|
+
icon: _jsx(OpacityIcon, {}),
|
|
78
|
+
label: "Close Out",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "Link",
|
|
82
|
+
route: {
|
|
83
|
+
route: RouteLocation.Tools_Dashboard,
|
|
84
|
+
},
|
|
85
|
+
icon: _jsx(BuildIcon, {}),
|
|
86
|
+
label: "Tool Management",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "Link",
|
|
90
|
+
route: {
|
|
91
|
+
route: RouteLocation.Station_Overview,
|
|
92
|
+
},
|
|
93
|
+
icon: _jsx(CalendarViewMonth, {}),
|
|
94
|
+
label: "System Overview",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "Subheader",
|
|
98
|
+
caption: "Daily Monitoring",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: "Link",
|
|
102
|
+
route: { route: RouteLocation.Operations_Dashboard },
|
|
103
|
+
icon: _jsx(ShoppingBasket, {}),
|
|
104
|
+
label: "Operation Management",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
type: "Link",
|
|
108
|
+
route: { route: RouteLocation.Engineering_Cycles },
|
|
109
|
+
icon: _jsx(MemoryIcon, {}),
|
|
110
|
+
label: "Engineering",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "Link",
|
|
114
|
+
route: { route: RouteLocation.Quality_Dashboard },
|
|
115
|
+
icon: _jsx(StarIcon, {}),
|
|
116
|
+
label: "Quality Analysis",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: "Link",
|
|
120
|
+
route: { route: RouteLocation.Sales_Dashboard },
|
|
121
|
+
icon: _jsx(SalesIcon, {}),
|
|
122
|
+
label: "Sales",
|
|
123
|
+
},
|
|
124
|
+
{ type: "Subheader", caption: "Monthly Review" },
|
|
125
|
+
{
|
|
126
|
+
type: "Link",
|
|
127
|
+
route: { route: RouteLocation.Analysis_Buffers },
|
|
128
|
+
icon: _jsx(ChartIcon, {}),
|
|
129
|
+
label: "Flexibility Analysis",
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
export function ChooseMode(p) {
|
|
133
|
+
const navList = (_jsx(Paper, { children: _jsx(List, { component: "nav", dense: true, children: (p.modes ?? defaultChooseModes).map((mode, idx) => mode.type === "Subheader" ? (_jsx(ListSubheader, { children: mode.caption }, idx)) : (_jsx(ListItem, { children: _jsxs(ListItemButton, { onClick: () => p.setRoute(mode.route), children: [_jsx(ListItemIcon, { children: mode.icon }), _jsx(ListItemText, { children: mode.label })] }) }, idx))) }) }));
|
|
134
|
+
return (_jsx("main", { style: { display: "flex", justifyContent: "center" }, children: _jsxs("div", { children: [_jsxs("div", { style: { textAlign: "center" }, children: [_jsx(Typography, { variant: "h4", style: { marginTop: "2em" }, children: "Select user and computer location" }), _jsxs(Typography, { variant: "caption", style: { marginBottom: "2em", maxWidth: "30em", marginLeft: "auto", marginRight: "auto" }, children: ["We recommend that after selecting one of the following modes, you bookmark the page and visit it directly.", _jsx("a", { href: "https://fms-insight.seedtactics.com/docs/client-dashboard.html", children: "Learn More" })] })] }), navList] }) }));
|
|
135
|
+
}
|
|
136
|
+
export default ChooseMode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OperatorSelect: import("react").NamedExoticComponent<object>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2019, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo, useState } from "react";
|
|
35
|
+
import { Select } from "@mui/material";
|
|
36
|
+
import { MenuItem } from "@mui/material";
|
|
37
|
+
import { ListItemText } from "@mui/material";
|
|
38
|
+
import { ListItemSecondaryAction } from "@mui/material";
|
|
39
|
+
import { IconButton } from "@mui/material";
|
|
40
|
+
import { Delete as DeleteIcon } from "@mui/icons-material";
|
|
41
|
+
import { Dialog } from "@mui/material";
|
|
42
|
+
import { DialogTitle } from "@mui/material";
|
|
43
|
+
import { TextField } from "@mui/material";
|
|
44
|
+
import { DialogContent } from "@mui/material";
|
|
45
|
+
import { DialogActions } from "@mui/material";
|
|
46
|
+
import { Button } from "@mui/material";
|
|
47
|
+
import { allOperators, currentOperator } from "../data/operators.js";
|
|
48
|
+
import { fmsInformation } from "../network/server-settings.js";
|
|
49
|
+
import { LazySeq } from "@seedtactics/immutable-collections";
|
|
50
|
+
import { useAtom, useAtomValue } from "jotai";
|
|
51
|
+
const NewOper = "__FMS_INSIGHT_NEW_OPERATOR__";
|
|
52
|
+
export const OperatorSelect = memo(function OperatorSelectF() {
|
|
53
|
+
const fmsInfo = useAtomValue(fmsInformation);
|
|
54
|
+
const [operator, setOperator] = useAtom(currentOperator);
|
|
55
|
+
const [allOpers, setAllOpers] = useAtom(allOperators);
|
|
56
|
+
const [newOperOpen, setNewOperOpen] = useState(false);
|
|
57
|
+
const [newOperName, setNewOperName] = useState("");
|
|
58
|
+
function changeOper(evt) {
|
|
59
|
+
if (evt.target.value === NewOper) {
|
|
60
|
+
setNewOperOpen(true);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
setOperator(evt.target.value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function removeOperator(oper) {
|
|
67
|
+
setAllOpers((s) => s.filter((o) => o !== oper));
|
|
68
|
+
}
|
|
69
|
+
function addOperator() {
|
|
70
|
+
if (newOperName !== "") {
|
|
71
|
+
setAllOpers((s) => [...s.filter((o) => o !== newOperName), newOperName]);
|
|
72
|
+
setOperator(newOperName);
|
|
73
|
+
setNewOperName("");
|
|
74
|
+
setNewOperOpen(false);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (fmsInfo.user) {
|
|
78
|
+
return _jsx("div", { children: fmsInfo.user.profile.name || fmsInfo.user.profile.sub });
|
|
79
|
+
}
|
|
80
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Select, { value: operator || "", onChange: changeOper, variant: "standard", renderValue: (x) => x, children: [LazySeq.of(allOpers)
|
|
81
|
+
.sortBy((x) => x)
|
|
82
|
+
.map((oper, idx) => (_jsxs(MenuItem, { value: oper, children: [_jsx(ListItemText, { primary: oper }), _jsx(ListItemSecondaryAction, { children: _jsx(IconButton, { edge: "end", onClick: () => removeOperator(oper), size: "large", children: _jsx(DeleteIcon, {}) }) })] }, idx))), _jsx(MenuItem, { value: NewOper, children: _jsx("em", { children: "Create New Operator" }) }, "new")] }), _jsxs(Dialog, { open: newOperOpen, onClose: () => {
|
|
83
|
+
setNewOperOpen(false);
|
|
84
|
+
setNewOperName("");
|
|
85
|
+
}, children: [_jsx(DialogTitle, { children: "Create New Operator" }), _jsx(DialogContent, { children: _jsx(TextField, { value: newOperName, onChange: (evt) => setNewOperName(evt.target.value), label: "New Name", variant: "outlined", autoFocus: true, sx: { mt: "0.5em" }, onKeyUp: (evt) => {
|
|
86
|
+
if (evt.keyCode === 13) {
|
|
87
|
+
addOperator();
|
|
88
|
+
}
|
|
89
|
+
} }) }), _jsxs(DialogActions, { children: [_jsxs(Button, { disabled: newOperName === "", onClick: addOperator, children: ["Create ", newOperName] }), _jsx(Button, { onClick: () => {
|
|
90
|
+
setNewOperName("");
|
|
91
|
+
setNewOperOpen(false);
|
|
92
|
+
}, children: "Cancel" })] })] })] }));
|
|
93
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare function Loading(): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DisplayError({ error }: {
|
|
4
|
+
readonly error?: Error;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function DisplayLoadingAndError(props: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
fallback?: ReactNode;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2020, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { Suspense } from "react";
|
|
35
|
+
import { CircularProgress } from "@mui/material";
|
|
36
|
+
import { Card } from "@mui/material";
|
|
37
|
+
import { CardContent } from "@mui/material";
|
|
38
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
39
|
+
import { ApiException } from "../network/api.js";
|
|
40
|
+
export function Loading() {
|
|
41
|
+
return (_jsxs("div", { style: { textAlign: "center", marginTop: "4em" }, children: [_jsx(CircularProgress, {}), _jsx("p", { children: "Loading" })] }));
|
|
42
|
+
}
|
|
43
|
+
export function DisplayError({ error }) {
|
|
44
|
+
if (error === undefined)
|
|
45
|
+
return _jsx(_Fragment, {});
|
|
46
|
+
if (ApiException.isApiException(error)) {
|
|
47
|
+
return (_jsx(Card, { children: _jsxs(CardContent, { children: [_jsx("h3", { children: "FMS Insight Server Error" }), _jsx("p", { children: error.response })] }) }));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return (_jsx(Card, { children: _jsx(CardContent, { children: error.message }) }));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export function DisplayLoadingAndError(props) {
|
|
54
|
+
return (_jsx(ErrorBoundary, { FallbackComponent: DisplayError, children: _jsx(Suspense, { fallback: props.fallback ?? _jsx(Loading, {}), children: props.children }) }));
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LoadingIcon: import("react").NamedExoticComponent<object>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/* Copyright (c) 2018, John Lenz
|
|
3
|
+
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright
|
|
10
|
+
notice, this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above
|
|
13
|
+
copyright notice, this list of conditions and the following
|
|
14
|
+
disclaimer in the documentation and/or other materials provided
|
|
15
|
+
with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of John Lenz, Black Maple Software, SeedTactics,
|
|
18
|
+
nor the names of other contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific
|
|
20
|
+
prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
26
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
27
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
29
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
30
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
31
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
*/
|
|
34
|
+
import { memo, useState } from "react";
|
|
35
|
+
import { Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, } from "@mui/material";
|
|
36
|
+
import { Error as ErrorIcon } from "@mui/icons-material";
|
|
37
|
+
import { Tooltip } from "@mui/material";
|
|
38
|
+
import { errorLoadingLast30, websocketReconnecting } from "../network/websocket.js";
|
|
39
|
+
import { errorLoadingSpecificMonthData, loadingSpecificMonthData } from "../network/load-specific-month.js";
|
|
40
|
+
import { useAtomValue } from "jotai";
|
|
41
|
+
export const LoadingIcon = memo(function LoadingIcon() {
|
|
42
|
+
const websocketLoading = useAtomValue(websocketReconnecting);
|
|
43
|
+
const specificMonthLoading = useAtomValue(loadingSpecificMonthData);
|
|
44
|
+
const last30Error = useAtomValue(errorLoadingLast30);
|
|
45
|
+
const specificMonthError = useAtomValue(errorLoadingSpecificMonthData);
|
|
46
|
+
const [dialogOpen, setDialogOpen] = useState(false);
|
|
47
|
+
return (_jsxs(_Fragment, { children: [last30Error != null || specificMonthError != null ? (_jsx(Tooltip, { title: "Error", children: _jsx(IconButton, { onClick: () => setDialogOpen(true), size: "large", children: _jsx(ErrorIcon, {}) }) })) : undefined, websocketLoading || specificMonthLoading ? (_jsx(Tooltip, { title: "Loading", children: _jsx(CircularProgress, { "data-testid": "loading-icon", color: "secondary" }) })) : undefined, _jsxs(Dialog, { open: dialogOpen, onClose: () => setDialogOpen(false), children: [_jsx(DialogTitle, { children: "Error" }), _jsxs(DialogContent, { children: [last30Error !== null ? _jsx("p", { children: last30Error }) : undefined, specificMonthError !== null ? _jsx("p", { children: specificMonthError }) : undefined] }), _jsx(DialogActions, { children: _jsx(Button, { onClick: () => setDialogOpen(false), children: "Close" }) })] })] }));
|
|
48
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as api from "../network/api.js";
|
|
2
|
+
export interface LogEntryProps {
|
|
3
|
+
entry: api.ILogEntry;
|
|
4
|
+
detailLogCounter: number | null;
|
|
5
|
+
setDetail: (counter: number | null) => void;
|
|
6
|
+
readonly highlightProcsGreaterOrEqualTo?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function isLogEntryInvalidated(e: api.ILogEntry): boolean;
|
|
9
|
+
export declare const LogEntry: import("react").NamedExoticComponent<LogEntryProps>;
|
|
10
|
+
export declare function filterRemoveAddQueue(entries: Iterable<Readonly<api.ILogEntry>>): Iterable<Readonly<api.ILogEntry>>;
|
|
11
|
+
export interface LogEntriesProps {
|
|
12
|
+
entries: Iterable<Readonly<api.ILogEntry>>;
|
|
13
|
+
copyToClipboard?: boolean;
|
|
14
|
+
highlightProcsGreaterOrEqualTo?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const LogEntries: import("react").NamedExoticComponent<LogEntriesProps>;
|