Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new App Launcher Not Running Page/Functionality #384

Merged
merged 13 commits into from
Jul 16, 2024

Conversation

jbouder
Copy link
Collaborator

@jbouder jbouder commented Jul 11, 2024

Reference Issues or PRs

N/A

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

Screenshots

Screenshot 2024-07-11 at 1 31 51 PM

Any other comments?

  • Updated to base page templates to simplify future legacy migrations
  • Added new Not Running page and modal to React App
  • Updated to redirect to home and open modal when app isn't started and user navigates to stopped app directly
  • Updated app cards to display Not Running modal on click when not started

Note: native browser-based session storage is being used to track redirect and open ux. This will be replaced with global state when app is running as full SPA

Copy link

vercel bot commented Jul 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jhub-apps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2024 11:44am
jhub-apps-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2024 11:44am

@@ -23,7 +23,7 @@ async def handle_apps(request: Request):
if not theme:
theme = themes.DEFAULT_THEME
return templates.TemplateResponse(
"japps_home.html",
"japps_custom.html",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, this page template is only used by pages which require a custom route through the japps service. This change was just to reduce confusion with naming between this template and the real base template (japps_page)

Comment on lines +106 to +110
# If server_name is 'lab' then it is the default user
if server_name == "lab" or server_name == "vscode":
server_name = ""

if server_name is not None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was updated to allow calling this endpoint from the default server (JupyterLab or VSCode). Just passing an empty server_name string today results in the endpoint returning all apps, which is not what we want here.

Comment on lines +386 to +389
.card-dialog-body-wrapper {
padding: 0 24px 20px !important;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix spacing issue in modal dialogs, which are currently being overridden by JupyterLab styling

@@ -125,6 +125,7 @@ export const ContextMenu = ({
}}
onClick={(e) => {
if (!item.disabled && item.onClick) {
e.stopPropagation();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prevents the onclick event from bubbling up when the context menu should actually be handling the event

useEffect(() => {
if (currentUser) {
const currentId = window.location.pathname
.replace(/\/$/, '')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trim any extra slashes from the end to ensure we get a proper split on strings

@@ -93,6 +97,7 @@ export const getApps = (
...server,
id: app.name,
name: app.display_name,
url: server.url?.replace('/user/', '/hub/user/'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes 404 error when clicking on stopped app

Copy link
Contributor

@kildre kildre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, tests passing and coverage good. No errors.

@aktech
Copy link
Member

aktech commented Jul 15, 2024

I am seeing this on a local nebari deployment, any ideas? @jbouder

Screenshot 2024-07-15 at 3 06 30 pm

@jbouder
Copy link
Collaborator Author

jbouder commented Jul 15, 2024

I am seeing this on a local nebari deployment, any ideas? @jbouder

Screenshot 2024-07-15 at 3 06 30 pm

Aside from this message, is the app loading as expected?

@aktech
Copy link
Member

aktech commented Jul 15, 2024

Aside from this message, is the app loading as expected?

Yep, everything else seems to be running fine.

@jbouder
Copy link
Collaborator Author

jbouder commented Jul 15, 2024

Aside from this message, is the app loading as expected?

Yep, everything else seems to be running fine.

Cool. I think there is an overly specific check thats adding that message. I'll get an update pushed shortly.

@aktech
Copy link
Member

aktech commented Jul 16, 2024

It looks like the modal appears even when I just got off to clicking on the context menu, seems weird IMO, is that expected behaviour?

Screen.Recording.2024-07-16.at.9.43.49.am.mov

@aktech
Copy link
Member

aktech commented Jul 16, 2024

We would need to handle the case when a shared app is stopped and the person with whom the app is shared, tried to access the app and then start it, in that case "starting the app" will fail. At the moment backend returns 500, but after this is merged #397 it will return 404.

We're not allowing the shared user to start the app and in future we may, in that case it will return either 200 or 403.

So to summarise we need to handle the following cases:

  • 200 (already handled)
  • 404, 403: The error message should be something like you don't have permissions to start user "original-author"'s app, please ask the app author to start the app. (Same error for both cases since we're not allowing app starts by non-author for now)
  • 500: Something went wrong, generic error.

The later two cases are not handled at the moment. I am happy to get this PR in and handle those in a follow up PR as this is a huge improvement anyway.

@jbouder
Copy link
Collaborator Author

jbouder commented Jul 16, 2024

It looks like the modal appears even when I just got off to clicking on the context menu, seems weird IMO, is that expected behaviour?

Screen.Recording.2024-07-16.at.9.43.49.am.mov

Good catch. Since we're adding a click event to the card, I need to make sure the events on the card and the context menu do not conflict. I fixed that in one place, but missed this one. Will get that fixed.

@jbouder
Copy link
Collaborator Author

jbouder commented Jul 16, 2024

We would need to handle the case when a shared app is stopped and the person with whom the app is shared, tried to access the app and then start it, in that case "starting the app" will fail. At the moment backend returns 500, but after this is merged #397 it will return 404.

We're not allowing the shared user to start the app and in future we may, in that case it will return either 200 or 403.

So to summarise we need to handle the following cases:

  • 200 (already handled)
  • 404, 403: The error message should be something like you don't have permissions to start user "original-author"'s app, please ask the app author to start the app. (Same error for both cases since we're not allowing app starts by non-author for now)
  • 500: Something went wrong, generic error.

The later two cases are not handled at the moment. I am happy to get this PR in and handle those in a follow up PR as this is a huge improvement anyway.

I think we can handle this separately as it may take a little more work. Can you create an issue with the specifics?

@jbouder
Copy link
Collaborator Author

jbouder commented Jul 16, 2024

It looks like the modal appears even when I just got off to clicking on the context menu, seems weird IMO, is that expected behaviour?
Screen.Recording.2024-07-16.at.9.43.49.am.mov

Good catch. Since we're adding a click event to the card, I need to make sure the events on the card and the context menu do not conflict. I fixed that in one place, but missed this one. Will get that fixed.

Fixed

Copy link
Member

@aktech aktech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Verified the click context, works as expected.

@aktech aktech merged commit 563b8df into nebari-dev:main Jul 16, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants