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

feat: add option to display an app in a new browser window #977

Merged
merged 11 commits into from
Jun 27, 2022

Conversation

mariobuikhuizen
Copy link
Collaborator

@mariobuikhuizen mariobuikhuizen commented Nov 30, 2021

Description

This pull request adds button to the app which will open it in a new browser window:

popout.mp4

Popout functionality is implemented in https://github.com/mariobuikhuizen/ipypopout

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a change log needed? If yes, is it added to CHANGES.rst?
  • Is a milestone set? Milestone is only currently required for PRs related to Imviz MVP.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@github-actions github-actions bot added the embed Regarding issues with front-end embedding label Nov 30, 2021
@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

This looks awesome! But it doesn't seem to work for me... clicking on the button shows a new window being created but is immediately destroyed (using chrome, in both notebook and lab).

@havok2063
Copy link
Collaborator

This is something that could potentially be useful on the MAST side of things, depending on its requirements. We should check that it works. Otherwise we will need a way to disable this button for MAST, ideally via the config file.

@mariobuikhuizen
Copy link
Collaborator Author

@kecnry I forgot chrome blocks popups by default. This can be changed here: chrome://settings/content/popups

@mariobuikhuizen
Copy link
Collaborator Author

Also, using localhost instead of 127.0.0.1 seems to allow popups by default

@rosteen
Copy link
Collaborator

rosteen commented Nov 30, 2021

Firefox seems to open and then instantly close the new window. I have popups allowed for the page.

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

It doesn't seem to be blocking the popup, but rather immediately closing/crashing it (as compared to other cases where popups are blocked and never even created).

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

@havok2063 - I can run those tests with your standalone repo before we merge this and if not make sure you have a hook to disable the button. There are also some styling issues, especially in imviz (which has a taller toolbar and isn't vertically centering the button).

@rosteen
Copy link
Collaborator

rosteen commented Nov 30, 2021

It doesn't seem to be blocking the popup, but rather immediately closing/crashing it (as compared to other cases where popups are blocked and never even created).

Exactly what I'm seeing.

@mariobuikhuizen
Copy link
Collaborator Author

Can you try right clicking? This should open a tab instead of a window, maybe this gives some more info.

@rosteen
Copy link
Collaborator

rosteen commented Nov 30, 2021

That results in behavior I've never seen before in a browser - the tab opens and then immediately crashes/closes.

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

@mariobuikhuizen - similar behavior. It very briefly seems to start opening a new tab (just start the see the x button of a new tab expanding, blue background of an empty tab, and immediately disappears)

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

Ah, seems to be my adblocker's fault (I use ublock origin) - disabling that and it works. @rosteen - can you confirm on your end?

@pllim
Copy link
Contributor

pllim commented Nov 30, 2021

Did you try to turn your antivirus off? 😅 (Oh, nvm, didn't see Kyle's post above.)

@mariobuikhuizen
Copy link
Collaborator Author

Well, at least that's consistent with opening a window 😅

I can't reproduce it. I'm setting up a fresh environment to see if that helps.

@rosteen
Copy link
Collaborator

rosteen commented Nov 30, 2021

Ah, seems to be my adblocker's fault (I use ublock origin) - disabling that and it works. @rosteen - can you confirm on your end?

Ahhh good call, uBlock Origin was killing it. After turning off my extensions it works. Looks awesome, I'll have to do a little more testing with it.

@mariobuikhuizen
Copy link
Collaborator Author

Ok, great!

@pllim
Copy link
Contributor

pllim commented Nov 30, 2021

Probably should add a warning on user facing doc about this. Maybe under known issues?

Also please add change log.

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

I'm not sure if there is any way around that or to detect when it happens and raise a message? Or if we should just handle it in the docs/tooltip text?

It looks like this also breaks all tests as ipypopout is looking for a non-existing Kernel.

I'll do more testing including embedded in MAST in the meantime!

@mariobuikhuizen
Copy link
Collaborator Author

For MAST we might have to add the right base-url to the body tag.

@rosteen
Copy link
Collaborator

rosteen commented Nov 30, 2021

@kecnry I had the same issue here that I showed you a week or two ago - in the popup window, if I open the model fitting plugin (which has a lot of content), the viewer/app resizes to the entire length of the plugin, rather than restricting the plugin height and adding a scrollbar. I think I showed you this in Voila, can't remember if you have a fix open for it already.

@kecnry
Copy link
Member

kecnry commented Nov 30, 2021

@rosteen - I can reproduce that here (although it wasn't introduced here, I'm guessing it just occurs whenever the wrapping div doesn't set a fixed height as Jupyter does) and created #979.

@havok2063
Copy link
Collaborator

havok2063 commented Dec 1, 2021

Even if it works in the standalone repo, we may run into other issues when it's deployed in a MAST domain. It might be a good idea to include with this PR the option for hiding the button. Another question I have is how is this mode different than running Jdaviz in desktop app mode?

@mariobuikhuizen mariobuikhuizen marked this pull request as ready for review June 1, 2022 19:16
@pllim

This comment was marked as outdated.

@pllim

This comment was marked as outdated.

@pllim
Copy link
Contributor

pllim commented Jun 1, 2022

This is from Notebook. The text is supposed to be white and it is white in the original notebook, but black in the popout.

Screenshot 2022-06-01 155023

@pllim
Copy link
Contributor

pllim commented Jun 1, 2022

The viewer stretches weirdly under some circumstances. Try this workflow:

  1. Run Cubeviz example notebook and load the data.
  2. Pop it out.
  3. In the pop out, open up Metadata Viewer.
  4. See the image viewers all stretches out very long vertically until Metadata Viewer is closed. This does not happen in the original notebook.

@rosteen
Copy link
Collaborator

rosteen commented Jun 1, 2022

I also saw the viewers stretching to match the length of the plugin tray, rather than the plugin tray being limited to the height of the app.

mariobuikhuizen and others added 10 commits June 2, 2022 15:26
- Button is hidden when data-base-url is not set
- Enable button in MAST by setting:
   <body data-base-url="/" data-voila-host="http://mydomain:8888"
- fix: button is disappearing after clicking it
- feat: expose windowName and windowFeatures to python
Co-authored-by: Ricky O'Steen <39831871+rosteen@users.noreply.github.com>
The doctype in ipypopout's HTML file was missing, putting the page
in quirks-mode, which causes tables not to inherit the text color
(and can cause many more rendering differences). This was fixed in
v0.0.7
@pllim
Copy link
Contributor

pllim commented Jun 2, 2022

I installed this branch on Windows 10 (editable install). The standalone app does not load properly (i.e., localhost:<port> page popped up, I see "running cell 1" for a sec, then everything is blank).

On the terminal, I see this:

WARNING:tornado.general:403 GET /voila/static/voila.js.map (::1): voila.js.map is not in root static directory

On the browser dev console:

Screenshot 2022-06-02 121057

For comparison, when I run the same CLI from current main, there is no warning on the terminal and everything loaded fine. And this is what I see on the browser dev console:

Screenshot 2022-06-02 121749

@maartenbreddels
Copy link
Collaborator

WARNING:tornado.general:403 GET /voila/static/voila.js.map (::1): voila.js.map is not in root static directory

FYI: this is the browser looking for source mapping (if you care about debugging js), it can be ignored.

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

The error in Windows is fixed but the "standalone app" mode still gives me weird stuff, like this extra "add" text in subset selection tool. I do not see it in notebook mode nor in main.

Screenshot 2022-06-13 141216

@mariobuikhuizen
Copy link
Collaborator Author

@pllim I can't reproduce this issue in the standalone app on mac or windows.

@pllim
Copy link
Contributor

pllim commented Jun 27, 2022

I will try again. It was on editable install, maybe I'll try a non-editable and see. 🤷

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

I updated my dependencies on Windows and the weird wording is gone in both editable and non-editable installs. Works fine in "standalone" and "notebook" modes for me now.

The box zoom is a little weird but I don't think it is related as I remember @kecnry mentioned it separately before.

Since my approval is the second one, I will merge. Thanks!

@pllim pllim merged commit bb76ac6 into spacetelescope:main Jun 27, 2022
@kecnry kecnry mentioned this pull request Jun 28, 2022
9 tasks
@kecnry kecnry mentioned this pull request Jul 6, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embed Regarding issues with front-end embedding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants