Skip to content

Commit

Permalink
Open assignment in Jupyter after app is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
frostyfan109 committed Feb 19, 2024
1 parent fb74d00 commit 8bd9262
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/contexts/workspaces-context/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export interface IWorkspacesAPI {
*/
loginSAMLUNC(): Promise<void>
loginSAMLGoogle(): Promise<void>
loginSAMLGithub(): Promise<void>
logout(fetchOptions?: AxiosRequestConfig): Promise<LogoutResponse>
/** May throw a WhitelistRequiredError */
getActiveUser(fetchOptions?: AxiosRequestConfig): Promise<User|null>
Expand Down
3 changes: 2 additions & 1 deletion src/views/splash-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export const SplashScreenView = withWorkspaceAuthentication((props) => {
);
}
else {
window.location = decoded_url;
window.location = decoded_url
return null
}

})
9 changes: 8 additions & 1 deletion src/views/workspaces/eduhelx-assignment-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ export const EduhelxAssignmentView = withWorkspaceAuthentication(() => {
setCurrentStep((currentStep) => currentStep + 1)
}, [])

const openJupyter = async () => {
if (!app) return
const instances = await api.getAppInstances()
const appInstance = instances.find(({ aid }) => aid === app.app_id)!
window.location.href = appInstance.url
}

const steps = useMemo(() => {
const steps: any[] = [
{
Expand All @@ -170,7 +177,7 @@ export const EduhelxAssignmentView = withWorkspaceAuthentication(() => {
key: 2,
title: 'Finished',
icon: <CheckOutlined />,
content: <RedirectingPane done={ () => console.log("Done!") } />
content: <RedirectingPane done={ () => openJupyter() } />
}
]
if (failed) {
Expand Down

0 comments on commit 8bd9262

Please sign in to comment.