diff --git a/src/index.jsp b/src/index.jsp index 44196ab1a..dfca0c5fb 100644 --- a/src/index.jsp +++ b/src/index.jsp @@ -16,8 +16,44 @@ <%@ page import="org.openbravo.erpCommon.utility.OBError" %> <%@ page import="org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction" %> <%@ page import="org.openbravo.client.application.window.ApplicationDictionaryCachedStructures"%> +<%@ page import="org.openbravo.base.session.OBPropertiesProvider"%> +<%@ page import="java.net.HttpURLConnection"%> +<%@ page import="java.net.URL"%> <%@ page contentType="text/html; charset=UTF-8" %> <%@ page session="false" %> +<% + // Check if UI mode is nextgen and redirect to new UI + OBPropertiesProvider propsProvider = OBPropertiesProvider.getInstance(); + String uiMode = propsProvider.getOpenbravoProperties().getProperty("ui.mode", "classic"); + + if ("nextgen".equalsIgnoreCase(uiMode)) { + String nextgenUrl = propsProvider.getOpenbravoProperties().getProperty("ui.url", "http://localhost:3000"); + + // Check if new UI server is available + boolean serverAvailable = false; + try { + URL url = new URL(nextgenUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + connection.setConnectTimeout(3000); // 3 seconds timeout + connection.setReadTimeout(3000); + int responseCode = connection.getResponseCode(); + serverAvailable = (responseCode >= 200 && responseCode < 500); + connection.disconnect(); + } catch (Exception e) { + serverAvailable = false; + } + + if (serverAvailable) { + response.sendRedirect(nextgenUrl); + return; + } else { + // Redirect to error page if server is not available + response.sendRedirect("web/ui/ui-not-started.jsp"); + return; + } + } +%> <% /* ************************************************************************* diff --git a/web/ui/ui-not-started.jsp b/web/ui/ui-not-started.jsp new file mode 100644 index 000000000..a3a0a03c9 --- /dev/null +++ b/web/ui/ui-not-started.jsp @@ -0,0 +1,281 @@ +<%@ page import="org.openbravo.base.session.OBPropertiesProvider"%> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ page session="false" %> +<% + // Get the configured next-gen UI URL + OBPropertiesProvider propsProvider = OBPropertiesProvider.getInstance(); + String nextgenUrl = propsProvider.getOpenbravoProperties().getProperty("ui.url", "http://localhost:3000"); +%> + + + + + + New UI Not Available - Etendo + + + +
+
⚠️
+

New UI Not Available

+

The system is configured to use the Next-Gen UI, but the server is not available at this time.

+ +
+ Configured URL: + <%=nextgenUrl%> +
+ +
+

What can you do?

+
    +
  1. Verify that the New UI server is running at <%=nextgenUrl%>
  2. +
  3. If you need to start the server, run the appropriate command in your development environment
  4. +
  5. If you prefer to use the Classic UI temporarily, change ui.mode to classic in the Openbravo.properties file
  6. +
+
+ +
+

🛠️ For Developers

+

If you're developing on the platform and need to start the UI server:

+ +

Start UI Server

+
+ $ ./gradlew ui +
+ +

This will start the development server on <%=nextgenUrl%>

+ +

Stop Server

+

Press Ctrl+C in the terminal to stop the server.

+ +

Other Commands

+
+ $ ./gradlew uiInstall
+ # Install dependencies +
+
+ $ ./gradlew uiBuild
+ # Build for production +
+
+ + Retry + + +
+ + \ No newline at end of file