@wandelbots/wandelbots-js-react-components 2.31.0 → 2.32.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/dist/components/ProgramStateIndicator.d.ts +26 -0
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -0
- package/dist/index.cjs +38 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3300 -3198
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/ProgramStateIndicator.tsx +148 -0
- package/src/i18n/locales/de/translations.json +12 -1
- package/src/i18n/locales/en/translations.json +12 -1
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
60
60
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
61
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
62
|
-
"@storybook/addon-docs": "^9.
|
|
63
|
-
"@storybook/react-vite": "^9.
|
|
62
|
+
"@storybook/addon-docs": "^9.1.2",
|
|
63
|
+
"@storybook/react-vite": "^9.1.2",
|
|
64
64
|
"@storybook/test-runner": "^0.23.0",
|
|
65
65
|
"@svgr/rollup": "^8.1.0",
|
|
66
66
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@vitejs/plugin-react": "^4.3.4",
|
|
73
73
|
"@wandelbots/nova-js": "^2.1.0",
|
|
74
74
|
"add": "^2.0.6",
|
|
75
|
-
"eslint-plugin-storybook": "^9.
|
|
75
|
+
"eslint-plugin-storybook": "^9.1.2",
|
|
76
76
|
"glob": "^11.0.1",
|
|
77
77
|
"http-server": "^14.1.1",
|
|
78
78
|
"husky": "^9.1.7",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
96
96
|
"rollup-plugin-postcss": "^4.0.2",
|
|
97
97
|
"semantic-release": "^24.2.3",
|
|
98
|
-
"storybook": "^9.
|
|
98
|
+
"storybook": "^9.1.2",
|
|
99
99
|
"storybook-preset-inline-svg": "^1.0.1",
|
|
100
100
|
"three": "^0.174.0",
|
|
101
101
|
"three-stdlib": "^2.35.14",
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { Chip, useTheme } from "@mui/material"
|
|
2
|
+
import type {
|
|
3
|
+
RobotControllerStateOperationModeEnum,
|
|
4
|
+
RobotControllerStateSafetyStateEnum,
|
|
5
|
+
} from "@wandelbots/nova-js/v1"
|
|
6
|
+
import { observer } from "mobx-react-lite"
|
|
7
|
+
import { useTranslation } from "react-i18next"
|
|
8
|
+
import { externalizeComponent } from "../externalizeComponent"
|
|
9
|
+
import type { ProgramState } from "./ProgramControl"
|
|
10
|
+
|
|
11
|
+
export interface ProgramStateIndicatorProps {
|
|
12
|
+
/** The current state of the program */
|
|
13
|
+
programState: ProgramState
|
|
14
|
+
/** The current safety state of the robot controller */
|
|
15
|
+
safetyState: RobotControllerStateSafetyStateEnum
|
|
16
|
+
/** The current operation mode of the robot controller */
|
|
17
|
+
operationMode: RobotControllerStateOperationModeEnum
|
|
18
|
+
/** Additional CSS class name */
|
|
19
|
+
className?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A state indicator component that displays the current program execution state
|
|
24
|
+
* combined with robot controller safety and operation mode states.
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - Combines program state with safety and operation mode states
|
|
28
|
+
* - Color-coded based on state severity (success, warning, error)
|
|
29
|
+
* - Rendered as Material-UI filled chip
|
|
30
|
+
* - Localization support via react-i18next
|
|
31
|
+
*/
|
|
32
|
+
export const ProgramStateIndicator = externalizeComponent(
|
|
33
|
+
observer(
|
|
34
|
+
({
|
|
35
|
+
programState,
|
|
36
|
+
safetyState,
|
|
37
|
+
operationMode,
|
|
38
|
+
className,
|
|
39
|
+
}: ProgramStateIndicatorProps) => {
|
|
40
|
+
const theme = useTheme()
|
|
41
|
+
const { t } = useTranslation()
|
|
42
|
+
|
|
43
|
+
const getStateInfo = () => {
|
|
44
|
+
// First check for emergency stop or critical safety states
|
|
45
|
+
if (
|
|
46
|
+
safetyState === "SAFETY_STATE_DEVICE_EMERGENCY_STOP" ||
|
|
47
|
+
safetyState === "SAFETY_STATE_ROBOT_EMERGENCY_STOP" ||
|
|
48
|
+
safetyState === "SAFETY_STATE_STOP_0" ||
|
|
49
|
+
safetyState === "SAFETY_STATE_STOP_1" ||
|
|
50
|
+
safetyState === "SAFETY_STATE_STOP_2" ||
|
|
51
|
+
safetyState === "SAFETY_STATE_PROTECTIVE_STOP" ||
|
|
52
|
+
safetyState === "SAFETY_STATE_STOP" ||
|
|
53
|
+
safetyState === "SAFETY_STATE_REDUCED" ||
|
|
54
|
+
safetyState === "SAFETY_STATE_MASTERING" ||
|
|
55
|
+
safetyState === "SAFETY_STATE_CONFIRM_SAFETY" ||
|
|
56
|
+
safetyState === "SAFETY_STATE_OPERATOR_SAFETY" ||
|
|
57
|
+
safetyState === "SAFETY_STATE_RECOVERY" ||
|
|
58
|
+
safetyState === "SAFETY_STATE_VIOLATION"
|
|
59
|
+
) {
|
|
60
|
+
return {
|
|
61
|
+
label: t("ProgramStateIndicator.EStop.lb"),
|
|
62
|
+
color: theme.palette.error.main,
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check for error states
|
|
67
|
+
if (
|
|
68
|
+
safetyState === "SAFETY_STATE_UNKNOWN" ||
|
|
69
|
+
safetyState === "SAFETY_STATE_FAULT"
|
|
70
|
+
) {
|
|
71
|
+
return {
|
|
72
|
+
label: t("ProgramStateIndicator.Error.lb"),
|
|
73
|
+
color: theme.palette.error.main,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// For normal safety states, check program state
|
|
78
|
+
if (safetyState === "SAFETY_STATE_NORMAL") {
|
|
79
|
+
switch (programState) {
|
|
80
|
+
case "running":
|
|
81
|
+
return {
|
|
82
|
+
label: t("ProgramStateIndicator.Running.lb"),
|
|
83
|
+
color: theme.palette.success.main,
|
|
84
|
+
}
|
|
85
|
+
case "paused":
|
|
86
|
+
return {
|
|
87
|
+
label: t("ProgramStateIndicator.Paused.lb"),
|
|
88
|
+
color: theme.palette.grey[600],
|
|
89
|
+
}
|
|
90
|
+
case "stopping":
|
|
91
|
+
return {
|
|
92
|
+
label: t("ProgramStateIndicator.Stopped.lb"),
|
|
93
|
+
color: theme.palette.error.main,
|
|
94
|
+
}
|
|
95
|
+
case "idle":
|
|
96
|
+
default:
|
|
97
|
+
return {
|
|
98
|
+
label: t("ProgramStateIndicator.Ready.lb"),
|
|
99
|
+
color: theme.palette.success.main,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Default fallback
|
|
105
|
+
return {
|
|
106
|
+
label: t("ProgramStateIndicator.Idle.lb"),
|
|
107
|
+
color: theme.palette.grey[600],
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const { label, color } = getStateInfo()
|
|
112
|
+
|
|
113
|
+
// Add operation mode suffix if not automatic
|
|
114
|
+
const getOperationModeText = () => {
|
|
115
|
+
switch (operationMode) {
|
|
116
|
+
case "OPERATION_MODE_AUTO":
|
|
117
|
+
return t("ProgramStateIndicator.Auto.lb")
|
|
118
|
+
case "OPERATION_MODE_MANUAL":
|
|
119
|
+
return t("ProgramStateIndicator.Manual.lb")
|
|
120
|
+
case "OPERATION_MODE_MANUAL_T1":
|
|
121
|
+
return t("ProgramStateIndicator.ManualT1.lb")
|
|
122
|
+
case "OPERATION_MODE_MANUAL_T2":
|
|
123
|
+
return t("ProgramStateIndicator.ManualT2.lb")
|
|
124
|
+
default:
|
|
125
|
+
return t("ProgramStateIndicator.Auto.lb") // Default to Auto for unknown modes
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const fullLabel = `${label} / ${getOperationModeText()}`
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<Chip
|
|
133
|
+
className={className}
|
|
134
|
+
label={fullLabel}
|
|
135
|
+
variant="filled"
|
|
136
|
+
sx={{
|
|
137
|
+
backgroundColor: color,
|
|
138
|
+
color: theme.palette.getContrastText(color),
|
|
139
|
+
fontWeight: 500,
|
|
140
|
+
"& .MuiChip-label": {
|
|
141
|
+
paddingX: 2,
|
|
142
|
+
},
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
146
|
+
},
|
|
147
|
+
),
|
|
148
|
+
)
|
|
@@ -50,5 +50,16 @@
|
|
|
50
50
|
"ProgramControl.Start.bt": "Start",
|
|
51
51
|
"ProgramControl.Resume.bt": "Weiter",
|
|
52
52
|
"ProgramControl.Pause.bt": "Pause",
|
|
53
|
-
"ProgramControl.Stop.bt": "Stopp"
|
|
53
|
+
"ProgramControl.Stop.bt": "Stopp",
|
|
54
|
+
"ProgramStateIndicator.Running.lb": "In Betrieb",
|
|
55
|
+
"ProgramStateIndicator.Error.lb": "Fehler",
|
|
56
|
+
"ProgramStateIndicator.EStop.lb": "Not-Aus",
|
|
57
|
+
"ProgramStateIndicator.Idle.lb": "Leerlauf",
|
|
58
|
+
"ProgramStateIndicator.Paused.lb": "Pausiert",
|
|
59
|
+
"ProgramStateIndicator.Ready.lb": "Bereit",
|
|
60
|
+
"ProgramStateIndicator.Stopped.lb": "Gestoppt",
|
|
61
|
+
"ProgramStateIndicator.Auto.lb": "Auto",
|
|
62
|
+
"ProgramStateIndicator.Manual.lb": "Manuell",
|
|
63
|
+
"ProgramStateIndicator.ManualT1.lb": "Manuell T1",
|
|
64
|
+
"ProgramStateIndicator.ManualT2.lb": "Manuell T2"
|
|
54
65
|
}
|
|
@@ -51,5 +51,16 @@
|
|
|
51
51
|
"ProgramControl.Start.bt": "Start",
|
|
52
52
|
"ProgramControl.Resume.bt": "Resume",
|
|
53
53
|
"ProgramControl.Pause.bt": "Pause",
|
|
54
|
-
"ProgramControl.Stop.bt": "Stop"
|
|
54
|
+
"ProgramControl.Stop.bt": "Stop",
|
|
55
|
+
"ProgramStateIndicator.Running.lb": "Running",
|
|
56
|
+
"ProgramStateIndicator.Error.lb": "Error",
|
|
57
|
+
"ProgramStateIndicator.EStop.lb": "E-Stop",
|
|
58
|
+
"ProgramStateIndicator.Idle.lb": "Idle",
|
|
59
|
+
"ProgramStateIndicator.Paused.lb": "Paused",
|
|
60
|
+
"ProgramStateIndicator.Ready.lb": "Ready",
|
|
61
|
+
"ProgramStateIndicator.Stopped.lb": "Stopped",
|
|
62
|
+
"ProgramStateIndicator.Auto.lb": "Auto",
|
|
63
|
+
"ProgramStateIndicator.Manual.lb": "Manual",
|
|
64
|
+
"ProgramStateIndicator.ManualT1.lb": "Manual T1",
|
|
65
|
+
"ProgramStateIndicator.ManualT2.lb": "Manual T2"
|
|
55
66
|
}
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./components/jogging/PoseJointValues"
|
|
|
11
11
|
export * from "./components/LoadingCover"
|
|
12
12
|
export * from "./components/modal/NoMotionGroupModal"
|
|
13
13
|
export * from "./components/ProgramControl"
|
|
14
|
+
export * from "./components/ProgramStateIndicator"
|
|
14
15
|
export * from "./components/robots/AxisConfig"
|
|
15
16
|
export * from "./components/robots/Robot"
|
|
16
17
|
export { defaultGetModel } from "./components/robots/robotModelLogic"
|