Skip to content

Commit

Permalink
Add env to launchAndRedirect
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Oct 12, 2024
1 parent 8ccec2a commit d929848
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.openapi-generator
.openapi-generator-ignore
openapitools.json
.DS_Store
.DS_Store

node_modules
48 changes: 34 additions & 14 deletions node/landing-page/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './App.css';

import { AppDefinition, getTheiaCloudConfig, PingRequest, RequestOptions, SessionStartRequest, TheiaCloud } from '@eclipse-theiacloud/common';
import { AppDefinition, getTheiaCloudConfig, PingRequest, RequestOptions, TheiaCloud } from '@eclipse-theiacloud/common';
import Keycloak, { KeycloakConfig } from 'keycloak-js';
import { useEffect, useState } from 'react';

Expand Down Expand Up @@ -215,7 +215,14 @@ function App(): JSX.Element {
const workspace = config.useEphemeralStorage
? undefined
: 'ws-' + config.appId + '-' + selectedAppDefinition + '-' + email;

const requestOptions: RequestOptions = {
timeout: 60000,
retries: 5,
accessToken: token
};

/*
const sessionStartRequest: SessionStartRequest = {
serviceUrl: config.serviceUrl,
appId: config.appId,
Expand All @@ -232,12 +239,6 @@ function App(): JSX.Element {
}
};
const requestOptions: RequestOptions = {
timeout: 60000,
retries: 5,
accessToken: token
};

TheiaCloud.Session.startSession(
sessionStartRequest,
requestOptions
Expand All @@ -254,13 +255,32 @@ function App(): JSX.Element {
.finally(() => {
setLoading(false);
});
/*
*/

const launchRequest = {
serviceUrl: config.serviceUrl,
appId: config.appId,
user: email!,
appDefinition: appDefinition,
workspaceName: workspace,
env: {
fromMap: {
THEIA: 'true',
ARTEMIS_TOKEN: artemisToken!,
ARTEMIS_CLONE_URL: gitUri!
}
}
};

//TheiaCloud.launchAndRedirect(
//config.useEphemeralStorage
// ? LaunchRequest.ephemeral(config.serviceUrl, config.appId, appDefinition, 5, email)
// : LaunchRequest.createWorkspace(config.serviceUrl, config.appId, appDefinition, 5, email, workspace),

TheiaCloud.launchAndRedirect(
config.useEphemeralStorage
? LaunchRequest.ephemeral(config.serviceUrl, config.appId, appDefinition, 5, email)
: LaunchRequest.createWorkspace(config.serviceUrl, config.appId, appDefinition, 5, email, workspace),
{ timeout: 60000, retries: 5, accessToken: token }
)
launchRequest,
requestOptions
)
.catch((err: Error) => {
if (err && (err as any).status === 473) {
setError(
Expand All @@ -274,7 +294,7 @@ function App(): JSX.Element {
.finally(() => {
setLoading(false);
});
*/

})
.catch((_err: Error) => {
setError(
Expand Down

0 comments on commit d929848

Please sign in to comment.