@prorobotech/openapi-k8s-toolkit 1.2.1-alpha.0 → 1.2.1-alpha.1

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.
@@ -82608,7 +82608,7 @@ const Styled$c = {
82608
82608
 
82609
82609
  const XTerminal$2 = ({ endpoint, namespace, podName, container, substractHeight }) => {
82610
82610
  const [isLoading, setIsLoading] = useState(true);
82611
- const [error, setError] = useState();
82611
+ const [error, setError] = useState(null);
82612
82612
  const [terminal, setTerminal] = useState();
82613
82613
  const terminalInstance = useRef(null);
82614
82614
  const terminalRef = useRef(null);
@@ -82655,6 +82655,10 @@ const XTerminal$2 = ({ endpoint, namespace, podName, container, substractHeight
82655
82655
  };
82656
82656
  socket.onmessage = (event) => {
82657
82657
  const data = JSON.parse(event.data);
82658
+ if (data.type === "error") {
82659
+ setError(data.payload);
82660
+ return;
82661
+ }
82658
82662
  if (data.type === "output") {
82659
82663
  if (data.payload.type === "Buffer" && Array.isArray(data.payload.data)) {
82660
82664
  const text = Buffer.from(data.payload.data);
@@ -82667,9 +82671,9 @@ const XTerminal$2 = ({ endpoint, namespace, podName, container, substractHeight
82667
82671
  socket.onclose = () => {
82668
82672
  console.log(`[${namespace}/${podName}]: WebSocket Client Closed`);
82669
82673
  };
82670
- socket.onerror = (error2) => {
82671
- console.error("WebSocket Error:", error2);
82672
- setError(error2);
82674
+ socket.onerror = () => {
82675
+ console.error("WebSocket Error");
82676
+ setError("Failed to connect to terminal");
82673
82677
  };
82674
82678
  terminal.onData((data) => {
82675
82679
  if (data === "\x1BOP") {
@@ -82688,7 +82692,7 @@ const XTerminal$2 = ({ endpoint, namespace, podName, container, substractHeight
82688
82692
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
82689
82693
  /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.CustomCard, { $isVisible: !isLoading && !error, $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$c.FullWidthDiv, { $substractHeight: substractHeight, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: terminalRef, style: { width: "100%", height: "100%" } }) }) }),
82690
82694
  isLoading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}),
82691
- error && /* @__PURE__ */ jsxRuntimeExports.jsx(Result, { status: "error", title: "Error", subTitle: JSON.stringify(error) })
82695
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx(Result, { status: "error", title: "Error", subTitle: error })
82692
82696
  ] });
82693
82697
  };
82694
82698