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

Adds quick settings button to the new launcher #52

Merged
merged 19 commits into from
Jun 14, 2024

Conversation

andrewfulton9
Copy link
Collaborator

@andrewfulton9 andrewfulton9 commented Jun 11, 2024

Reference Issues or PRs

closes number #9

What does this implement/fix?

Adds a quick settings button to the new launcher

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?

Note that the query parameter for the command to open the settings editor only works if the default settings are in place

Documentation

Access-centered content checklist

Text styling

  • The content is written with plain language (where relevant).
  • If there are headers, they use the proper header tags (with only one level-one header: H1 or # in markdown).
  • All links describe where they link to (for example, check the Nebari website).
  • This content adheres to the Nebari style guides.

Non-text content

  • All content is represented as text (for example, images need alt text, and videos need captions or descriptive transcripts).
  • If there are emojis, there are not more than three in a row.
  • Don't use flashing GIFs or videos.
  • If the content were to be read as plain text, it still makes sense, and no information is missing.

Any other comments?

@andrewfulton9 andrewfulton9 marked this pull request as draft June 11, 2024 21:40
Copy link
Contributor

Binder 👈 Launch a Binder on branch andrewfulton9/jupyterlab-new-launcher/quick_settings

@andrewfulton9
Copy link
Collaborator Author

@krassowski, I still need to add testing, but could you take a look when you get a chance. I think all the functionality is here for this one. There is one issue where the command for opening the settings editor for the new launcher only works if no default settings have been changed. Otherwise it opens the settings editor, but not to the New Launcher settings. Any idea what could be causing that?

Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @andrewfulton9! I left a few suggestions.

I see what you mean about the query not having much of an effect if settings editor is already open. I would call this an upstream bug in JupyterLab, as it also affects jupyter-ai and other places where this command is used with query. I opened jupyterlab/jupyterlab#16479 to track it (we may want to address it or let it hang as a good first issue for a while, in any case it should not block this PR).

src/types.ts Outdated Show resolved Hide resolved
x = event.clientX;
y = event.clientY;
}
menu.open(x, y);
Copy link
Member

Choose a reason for hiding this comment

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

Currently the menu is positioned within the browser window:

image

I wonder if it would be nicer if it was positioned relative to the launcher body or the button. You can pass a third argument to menu.open() with Menu.IOpenOptions object. Once jupyterlab/lumino#700 is released we will be able to pass a custom host but for now we could only try using forceX to improve the positioning.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It currently should be positioned to the button. It's just shifting the menu so it fits in the window. This is what it looks like when the panel isn't directly next the edge of the window:

image

If I use forceX the part of the menu isn't viewable which I think may be worse:

image

I wonder if there is a way to align it so the top-right corner of the menu aligns with the bottom right corner of the button. In my opinion that would look the cleanest.

Copy link
Member

Choose a reason for hiding this comment

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

align it so the top-right corner of the menu aligns with the bottom right corner of the button. In my opinion that would look the cleanest.

💯 agree. There is no way as of today. Can you open a feature request on lumino, and another issue here to track it as a follow-up enhancement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good. I opened Lumino#709 for this

Comment on lines 19 to 20
command: 'settingeditor:open',
args: { query: 'New Launcher' }
Copy link
Member

Choose a reason for hiding this comment

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

Currently it shows a generic "Settings Editor":

image

This is fine, though alternatively we could change it to "Open settings" by wrapping it in a custom command. Of note, it would be good to align the capitalization one way or another (I do not have a preference but I think other menus use Title Caps).

src/commands.ts Outdated Show resolved Hide resolved
src/launcher.tsx Outdated Show resolved Hide resolved
@krassowski krassowski linked an issue Jun 12, 2024 that may be closed by this pull request
andrewfulton9 and others added 7 commits June 12, 2024 09:33
@andrewfulton9 andrewfulton9 marked this pull request as ready for review June 14, 2024 16:25
@andrewfulton9 andrewfulton9 changed the title [DRAFT] Adds quick settings button to the new launcher Adds quick settings button to the new launcher Jun 14, 2024
@andrewfulton9
Copy link
Collaborator Author

@krassowski, I added playwright tests and I think this is ready for another review when you get a chance

Comment on lines 100 to 102
expect(await launcher.screenshot()).toMatchSnapshot(
'launcher_show_starred_from_quicksettings.png'
);
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to drop this screenshot comparison and instead add something like:

const starredSection = page.locator('.jp-CollapsibleSection-Title:has-text("Starred")')
await expect(starredSection).toBeVisible();

(I have not tested these lines so they may need adjusting

Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this as flaky. We already have one snapshot for this state, testing by locator visibility should be sufficient and easier to maintain long term :)

andrewfulton9 and others added 3 commits June 14, 2024 12:57
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Thank you @andrewfulton9, looks great!

@krassowski krassowski merged commit ff3c287 into nebari-dev:main Jun 14, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a settings button or menu (in top right corner?)
2 participants