Skip to content

Commit

Permalink
Connect in one click
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Zatsarynnyi <[email protected]>
  • Loading branch information
azatsarynnyy committed Feb 13, 2024
1 parent 4d90d65 commit e0efaeb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions status-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ var joinLink = new Promise((resolve) => {
const app = express();
app.set('view engine', 'ejs');
app.get('/', async function (req, res) {
const invitationLink = await joinLink;
const invitationLink = (await joinLink).replaceAll('&', '_');
const dwID = process.env.DEVWORKSPACE_ID;
const dwName = process.env.DEVWORKSPACE_NAME;
const clusterConsoleURL = process.env.CLUSTER_CONSOLE_URL;
const podName = process.env.HOSTNAME;
// render the page from EJS template
res.render('status', { dwName, clusterConsoleURL, podName, invitationLink });
res.render('status', { dwID, dwName, clusterConsoleURL, podName, invitationLink });
});

// server setup
Expand Down
12 changes: 11 additions & 1 deletion status-app/views/status.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
<title>Eclipse Che</title>
</head>
<body>
<script>
(function () {
window.onload = function () {
const gatewayLink = "jetbrains-gateway://connect#type=devspaces&dwID=<%= dwID %>&dwName=<%= dwName %>&link=<%= invitationLink %>"
console.log("Opening Gateway app: " + gatewayLink);
window.open(gatewayLink, "_self");
};
}());
</script>

<h1>"<%= dwName %>" workspace with IntelliJ IDEA dev server is running</h1>

<h3>How to connect to your Workspace?</h3>
Expand All @@ -30,7 +40,7 @@

<h4>Connect your local JetBrains thin client to the remote backend</h4>
<i>Install <a href="https://www.jetbrains.com/remote-development/gateway/" target="_blank">JetBrains Gateway</a> if not installed.</i>
<p>1. <a href="jetbrains-gateway://connect">Open JetBrains Gateway</a> and choose "Connect with a Link" option.</p>
<p>1. <a href="jetbrains-gateway://connect#type=devspaces&dwID=<%= dwID %>&dwName=<%= dwName %>&link=<%= invitationLink %>">Open JetBrains Gateway</a> and choose "Connect with a Link" option.</p>
<p>2. Pass this IDEA dev server link to your Gateway app: <%= invitationLink %></p>
</body>
</html>

0 comments on commit e0efaeb

Please sign in to comment.