Skip to content

Commit

Permalink
Prepare automatic session startup
Browse files Browse the repository at this point in the history
  • Loading branch information
iyannsch committed Aug 28, 2024
1 parent ae3207d commit 9e767d7
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions node/landing-page/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,30 @@ function App(): JSX.Element {
const element = document.getElementById('selectapp');
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('appDef') || urlParams.has('appdef')) {
const defaultSelection = urlParams.get('appDef') || urlParams.get('appdef');
const pathBlueprintSelection = urlParams.get('appDef') || urlParams.get('appdef');
if (
// eslint-disable-next-line no-null/no-null
defaultSelection !== null &&
isDefaultSelectionValueValid(defaultSelection, config.appDefinition, config.additionalApps)
pathBlueprintSelection !== null &&
isDefaultSelectionValueValid(pathBlueprintSelection, config.appDefinition, config.additionalApps)
) {
// eslint-disable-next-line no-null/no-null
if (element !== null && config.additionalApps && config.additionalApps.length > 0) {
(element as HTMLSelectElement).value = defaultSelection;
(element as HTMLSelectElement).value = pathBlueprintSelection;
setSelectedAppName(
(element as HTMLSelectElement).options[(element as HTMLSelectElement).selectedIndex].text
);
setSelectedAppDefinition((element as HTMLSelectElement).value);
} else {
// If there are no additional apps, just use the application id as the name
setSelectedAppDefinition(defaultSelection);
setSelectedAppName(defaultSelection);
setSelectedAppDefinition(pathBlueprintSelection);
setSelectedAppName(pathBlueprintSelection);
}
initialAppName = selectedAppName;
initialAppDefinition = selectedAppDefinition;
console.log('Set ' + defaultSelection + ' as default selection');
console.log('Set ' + pathBlueprintSelection + ' as selection');
} else {
setError('Invalid default selection value: ' + pathBlueprintSelection);
console.error('Invalid default selection value: ' + pathBlueprintSelection);
}
}
if (config.useKeycloak) {
Expand Down Expand Up @@ -107,14 +110,14 @@ function App(): JSX.Element {

// Try to start the app if the app definition is set
if (selectedAppDefinition) {
handleStartSession(selectedAppDefinition);
//handleStartSession(selectedAppDefinition);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
/* eslint-enable react-hooks/rules-of-hooks */

document.title = `${selectedAppName} - Try Now`;
document.title = `${selectedAppName} - Theia`;

const authenticate = (): void => {
const keycloak = Keycloak(keycloakConfig);
Expand Down

0 comments on commit 9e767d7

Please sign in to comment.