diff --git a/package.json b/package.json index f5cb0ef6..51bfdcf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ui", - "version": "0.25.3", + "version": "0.25.4", "private": true, "scripts": { "dev": "react-scripts start", diff --git a/src/contexts/RobotContext.tsx b/src/contexts/RobotContext.tsx index 2b4b7b3d..dea96dbc 100644 --- a/src/contexts/RobotContext.tsx +++ b/src/contexts/RobotContext.tsx @@ -1,10 +1,11 @@ import { useEffect, createContext, useState, useReducer } from "react"; import { IrobotTab } from "../interfaces/robotInterfaces"; -import { envApplication } from "../helpers/envProvider"; +import { envApplication, isProduction } from "../helpers/envProvider"; import useFunctions from "../hooks/useFunctions"; import { useParams } from "react-router-dom"; import useMain from "../hooks/useMain"; import ROSLIB from "roslib"; +import axios, { AxiosResponse } from "axios"; export const RobotContext: any = createContext(null); @@ -305,13 +306,6 @@ export default ({ children }: any) => { }); }); - // vdiClient?.addEventListener("close", () => { - // dispatcher({ - // type: "vdi", - // payload: false, - // }); - // }); - connectionsReducer?.vdi !== null && vdiClient && vdiClient.close(); return () => { @@ -321,6 +315,36 @@ export default ({ children }: any) => { }, [isSettedCookie, connectionsReducer?.vdi]); // VDI Test Connection + // V-IDE Test Connection + useEffect(() => { + try { + if (isSettedCookie && isProduction) { + axios + .get(responseRobot?.ideIngressEndpoint + "healthz") + .then((response: AxiosResponse) => { + console.log(response.data); + dispatcher({ + type: "virtualIDE", + payload: true, + }); + }); + } else { + dispatcher({ + type: "virtualIDE", + payload: false, + }); + } + } catch (error) { + dispatcher({ + type: "virtualIDE", + payload: false, + }); + } + + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isSettedCookie]); + // V-IDE Test Connection + function handleGetOrganization() { getOrganization( {