@imperosoft/cris-webui-components 1.4.0 → 1.5.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/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1038,7 +1038,7 @@ function CrisSpinner({
|
|
|
1038
1038
|
|
|
1039
1039
|
// src/components/CrisOfflinePage.tsx
|
|
1040
1040
|
import { useEffect as useEffect3, useState as useState3, useCallback as useCallback3 } from "react";
|
|
1041
|
-
import { isNativeMode, useConnectionStore } from "@imperosoft/cris-webui-ch5-core";
|
|
1041
|
+
import { isNativeMode, getActiveTransport, useConnectionStore } from "@imperosoft/cris-webui-ch5-core";
|
|
1042
1042
|
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1043
1043
|
var isFileProtocol = typeof window !== "undefined" && window.location.protocol === "file:";
|
|
1044
1044
|
var isDevModeDefault = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
|
@@ -1078,6 +1078,7 @@ function CrisOfflinePage({
|
|
|
1078
1078
|
});
|
|
1079
1079
|
const processorHost = processorHostProp ?? (typeof window !== "undefined" ? window.location.hostname : "localhost");
|
|
1080
1080
|
const isError = connectionStatus === "error" || hasSeenError && connectionStatus !== "connected";
|
|
1081
|
+
const isWsTransport = getActiveTransport() === "ws";
|
|
1081
1082
|
useEffect3(() => {
|
|
1082
1083
|
if (connectionStatus === "error") {
|
|
1083
1084
|
setHasSeenError(true);
|
|
@@ -1126,6 +1127,7 @@ function CrisOfflinePage({
|
|
|
1126
1127
|
return () => clearTimeout(timer);
|
|
1127
1128
|
}, [retryCountdown, retryConnection]);
|
|
1128
1129
|
useEffect3(() => {
|
|
1130
|
+
if (isWsTransport) return;
|
|
1129
1131
|
if (isError && isDeployedOnProcessor && loginRedirectDelay > 0 && !returnedFromLogin) {
|
|
1130
1132
|
const timer = setTimeout(() => {
|
|
1131
1133
|
try {
|
|
@@ -1136,7 +1138,7 @@ function CrisOfflinePage({
|
|
|
1136
1138
|
}, loginRedirectDelay);
|
|
1137
1139
|
return () => clearTimeout(timer);
|
|
1138
1140
|
}
|
|
1139
|
-
}, [isError, isDeployedOnProcessor, loginUrl, loginRedirectDelay, returnedFromLogin]);
|
|
1141
|
+
}, [isError, isDeployedOnProcessor, loginUrl, loginRedirectDelay, returnedFromLogin, isWsTransport]);
|
|
1140
1142
|
const envInfo = {
|
|
1141
1143
|
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "N/A",
|
|
1142
1144
|
hasCrComLib: typeof window !== "undefined" && typeof window.CrComLib !== "undefined",
|
|
@@ -1157,9 +1159,9 @@ function CrisOfflinePage({
|
|
|
1157
1159
|
return /* @__PURE__ */ jsx6("div", { className: `cris-offline-page absolute inset-0 bg-gray-900 flex flex-col items-center justify-center overflow-auto py-8 ${className}`, children: /* @__PURE__ */ jsxs5("div", { className: "text-center max-w-4xl px-4", children: [
|
|
1158
1160
|
/* @__PURE__ */ jsx6("div", { className: "mb-8", children: /* @__PURE__ */ jsx6("div", { className: `w-16 h-16 mx-auto rounded-full flex items-center justify-center ${isError ? "bg-red-500/20" : "bg-yellow-500/20"}`, children: /* @__PURE__ */ jsx6("div", { className: `w-8 h-8 rounded-full ${isError ? "bg-red-500" : "bg-yellow-500 animate-pulse"}` }) }) }),
|
|
1159
1161
|
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-bold text-white mb-2", children: isError ? isTimeoutError ? "Processor Unreachable" : "Connection Error" : "Connecting..." }),
|
|
1160
|
-
/* @__PURE__ */ jsx6("p", { className: "text-gray-400", children: isError ? isDeployedOnProcessor ? returnedFromLogin ? "Connection failed after login. Please try again." : "Redirecting to login page..." : isTimeoutError ? "Could not connect to the processor. Check the IP address and network connection." : "WebSocket connection failed. SSL certificate may need to be accepted." : "Establishing connection to control system" }),
|
|
1161
|
-
/* @__PURE__ */ jsx6("div", { className: "mt-8", children: /* @__PURE__ */ jsx6("span", { className: `px-4 py-2 rounded-full text-sm font-medium ${isError ? "bg-red-500/20 text-red-400" : "bg-yellow-500/20 text-yellow-400"}`, children: isError ? isTimeoutError ? "Connection Timeout" : isDevMode ? "Dev Mode - Auth Error" : isVC4 ? "VC4 - Not Authorized" : "Auth Error" : "Connecting" }) }),
|
|
1162
|
-
isError && !isDeployedOnProcessor && isTimeoutError && /* @__PURE__ */ jsxs5("div", { className: "mt-[2em] bg-orange-500/10 border border-orange-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: [
|
|
1162
|
+
/* @__PURE__ */ jsx6("p", { className: "text-gray-400", children: isError ? isWsTransport ? "Control system is not responding. Reconnecting automatically..." : isDeployedOnProcessor ? returnedFromLogin ? "Connection failed after login. Please try again." : "Redirecting to login page..." : isTimeoutError ? "Could not connect to the processor. Check the IP address and network connection." : "WebSocket connection failed. SSL certificate may need to be accepted." : "Establishing connection to control system" }),
|
|
1163
|
+
/* @__PURE__ */ jsx6("div", { className: "mt-8", children: /* @__PURE__ */ jsx6("span", { className: `px-4 py-2 rounded-full text-sm font-medium ${isError ? "bg-red-500/20 text-red-400" : "bg-yellow-500/20 text-yellow-400"}`, children: isError ? isWsTransport ? "Reconnecting" : isTimeoutError ? "Connection Timeout" : isDevMode ? "Dev Mode - Auth Error" : isVC4 ? "VC4 - Not Authorized" : "Auth Error" : "Connecting" }) }),
|
|
1164
|
+
isError && !isWsTransport && !isDeployedOnProcessor && isTimeoutError && /* @__PURE__ */ jsxs5("div", { className: "mt-[2em] bg-orange-500/10 border border-orange-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: [
|
|
1163
1165
|
/* @__PURE__ */ jsxs5("p", { className: "text-orange-400 font-medium", style: { fontSize: "1.2em", marginBottom: "1em" }, children: [
|
|
1164
1166
|
"The processor at ",
|
|
1165
1167
|
/* @__PURE__ */ jsx6("span", { className: "text-white", children: processorHost }),
|
|
@@ -1180,7 +1182,24 @@ function CrisOfflinePage({
|
|
|
1180
1182
|
}
|
|
1181
1183
|
) })
|
|
1182
1184
|
] }),
|
|
1183
|
-
isError &&
|
|
1185
|
+
isError && isWsTransport && /* @__PURE__ */ jsxs5("div", { className: "mt-[2em] bg-orange-500/10 border border-orange-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: [
|
|
1186
|
+
/* @__PURE__ */ jsxs5("p", { className: "text-orange-400 font-medium", style: { fontSize: "1.2em", marginBottom: "1em" }, children: [
|
|
1187
|
+
"The control system at ",
|
|
1188
|
+
/* @__PURE__ */ jsx6("span", { className: "text-white", children: processorHost }),
|
|
1189
|
+
" is not responding."
|
|
1190
|
+
] }),
|
|
1191
|
+
/* @__PURE__ */ jsx6("p", { className: "text-gray-400", style: { fontSize: "1em", marginBottom: "1em" }, children: "It may be restarting (e.g. a program update). The connection retries automatically." }),
|
|
1192
|
+
/* @__PURE__ */ jsx6("div", { className: "flex gap-[1em] justify-center", style: { overflow: "visible" }, children: /* @__PURE__ */ jsx6(
|
|
1193
|
+
"button",
|
|
1194
|
+
{
|
|
1195
|
+
onClick: retryConnection,
|
|
1196
|
+
className: "bg-orange-600 hover:bg-orange-500 text-white font-medium rounded-xl transition-colors",
|
|
1197
|
+
style: { padding: "1em 2em", fontSize: "1.2em", whiteSpace: "nowrap", overflow: "visible" },
|
|
1198
|
+
children: "Retry Now"
|
|
1199
|
+
}
|
|
1200
|
+
) })
|
|
1201
|
+
] }),
|
|
1202
|
+
isError && !isWsTransport && !isDeployedOnProcessor && !isTimeoutError && /* @__PURE__ */ jsx6("div", { className: "mt-[2em] bg-blue-500/10 border border-blue-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: retryCountdown !== null ? /* @__PURE__ */ jsxs5("div", { className: "text-center", style: { overflow: "visible" }, children: [
|
|
1184
1203
|
/* @__PURE__ */ jsxs5("p", { className: "text-blue-400 font-medium", style: { fontSize: "1.4em", marginBottom: "1em" }, children: [
|
|
1185
1204
|
"Retrying connection in ",
|
|
1186
1205
|
retryCountdown,
|
|
@@ -1219,7 +1238,7 @@ function CrisOfflinePage({
|
|
|
1219
1238
|
] }),
|
|
1220
1239
|
certPageOpened && /* @__PURE__ */ jsx6("p", { className: "text-gray-400", style: { fontSize: "1em", marginTop: "1em" }, children: "Connection will auto-retry when you return to this page." })
|
|
1221
1240
|
] }) }),
|
|
1222
|
-
isError && isDeployedOnProcessor && returnedFromLogin && /* @__PURE__ */ jsxs5("div", { className: "mt-[2em] bg-red-500/10 border border-red-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: [
|
|
1241
|
+
isError && !isWsTransport && isDeployedOnProcessor && returnedFromLogin && /* @__PURE__ */ jsxs5("div", { className: "mt-[2em] bg-red-500/10 border border-red-500/30 rounded-xl", style: { overflow: "visible", padding: "1.5em 1.5em 2em 1.5em" }, children: [
|
|
1223
1242
|
/* @__PURE__ */ jsx6("p", { className: "text-red-400 font-medium", style: { fontSize: "1.2em", marginBottom: "1em" }, children: "Connection failed after authentication." }),
|
|
1224
1243
|
/* @__PURE__ */ jsx6("p", { className: "text-gray-400", style: { fontSize: "1em", marginBottom: "1em" }, children: "This may be due to an expired session or WebSocket connection issue." }),
|
|
1225
1244
|
/* @__PURE__ */ jsxs5("div", { className: "flex gap-[1em] justify-center flex-wrap", style: { overflow: "visible" }, children: [
|