<!--

    Copyright (c) 2023-2025 Red Hat, Inc.
    This program and the accompanying materials are made
    available under the terms of the Eclipse Public License 2.0
    which is available at https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0

    Contributors:
      Red Hat, Inc. - initial API and implementation

-->
<!-- views/status.ejs -->
<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel="stylesheet" type="text/css" href="./css/style.css">
  </head>
  <body>
    <script>
      (function () {    
          window.onload = function () {
            openGateway()
          }
      }())

      function openGateway() {
        const gatewayLink = "jetbrains-gateway://connect#type=devspaces&dwNamespace=<%= dwNamespace %>&dwName=<%= dwName %>&link=<%= invitationLink %>"
        console.log("Opening Gateway app: " + gatewayLink);
        window.open(gatewayLink, "_self");
      }
    </script>

    <h1>Workspace <%= dwName %> is running</h1>

    <div class="border">
      <h4 class="center">Make sure your local oc client is logged in to your OpenShift cluster</h4>
      <p class="center">Go to the <a href="<%= clusterConsoleURL %>" target="_blank">Open OpenShift Console</a> to get the login command from the top right menu.</p>
    </div>

    <h4 class="center">Can't open the workspace?</h4>
    <p class="center">If your browser doesn't ask you to open Gateway, make sure the prerequisites mentioned in <a href="https://eclipse.dev/che/docs/stable/end-user-guide/idea-ultimate/" target="_blank">the documentation</a> are met.</p>

    <!-- Provide an alternative way to open IDE, in case the browser can't show a pop-up -->
    <p class="center"><a href="javascript:;" onclick="openGateway()"><b>Open in <%= ideFullName %></b></a></p>
    <p class="center"><a href="<%= dashboardURL %>" target="_blank">Open Dashboard</a></p>
  </body>
</html>
