gephi / gephi-plugins

Repository for Gephi Plugins maintained by the team. Each plugin has it's branch.
269 stars 622 forks source link

Web publish plugin #268

Closed seinecle closed 2 years ago

seinecle commented 2 years ago

New plugin or plugin update?

What is the purpose of this plugin?

Enable the user to publish the network they are working on, to the web. See this issue for details of the implementation: https://github.com/gephi/gephi-plugins/issues/262#issuecomment-1231627948

How to test your plugin in Gephi?

  1. Go to File -> Export -> Publish to the Web
  2. Follow the instructions in the "Setup" tab
  3. Switch to the "Publish" tab and publish.

Checklist before submission

mbastian commented 2 years ago

Nice @seinecle and sorry for the delay. I started looking into it and have some general comments and questions:

  1. You currently don't configure the GEXF exporter. Are all the default settings what you would expect? For instance I don't think the viewer support dynamic graphs so we should probably turn this off.
  2. How do you deal with Gist's limits? Seems like the limit could be reach fairly quickly with large graphs so we should probably deal with it. At least inform the user. Maybe we should also thing about strategies to reduce the file size? Maybe Sigma.js supports zipped's GEXF?
  3. You have a number of hardcoded strings in your code like URLs, clientId etc. Could you turn all of those into constants for code clarity? (private static final String)
seinecle commented 2 years ago

hi @mbastian,

  1. I didn't know the exporter can be configured. I feel like the export to gist should preserve the network exactly as the user is working on it in Gephi, so I would not restrain / limit the gexf to some features. That's rather up to Retina / Sigma to handle it in the way they need?
  2. I was not aware of these limits. I'll have a look and yes, I will add warnings and will add ways to handle the exceptions related to limits
  3. Good point, will do.
seinecle commented 2 years ago

Did some verifications:

Gist has a push limit at 100Mb per file (when not using GLFS).

I used the plugin to publish a network which corresponds to a gexf file of 61Mb with 2000 nodes and 279,000 edges.

During the Gephi week I had asked @jacomyal about rough upper limits for the size of a network to be displayed by Retina. It would be around 10k nodes and 20k edges - above this, the browser might get slower on some computers.

So it seems that the first limit is the network size that Retina can handle, not the max file size Gist accepts.

I propose that we set a limit to the size of the network to be published? Like: 20k nodes max, 40k edges max? If any of these limits is reached, the "Publish" button remains greyed out with an explainer.

Your comments are welcome @mbastian @jacomyal

mbastian commented 2 years ago

@seinecle Thanks for verifying! It's a good news although it does contradict the Gist documentation, which I find strange. The link you posted is for GitHub and may not apply to Gist.

Regarding the size limit I'm not a fan of forbidding the upload but maybe rather inform the user that the experience is not gonna be optimal. The node/edge counts is also only partially a factor in the file size. The number of attributes and their content can also be a bit factor.

seinecle commented 2 years ago

Ok, so no hard limit but a warning then - I'll update the plugin today.

seinecle commented 2 years ago

Wow indeed many improvements to make. My comments:

mbastian commented 2 years ago

@seinecle I did a deeper refactoring to help decouple the UI from the business logic, which was still tightly coupled. In addition, I uses our LongTask API instead of SwingWorker. With that, you easily get the progress bar too. The two Runnable classes are now completely decoupled from the UI. The UI updates itself through a LongTaskListener (success) and LongTaskErrorHandler (error).

One UI improvement I think you could still make is on the final result. It's really paintful to have to copy-paste the final URL from a text field. Why not having an "Open" button or "Copy to clipboard"? Java can easily open the browser for you with an URL.

seinecle commented 2 years ago

@mbastian thanks! LongTaskseems super nice, glad to discover this utility! And thanks for the refactoring.

I have:

mbastian commented 2 years ago

Thanks @seinecle! I just noticed that the access token we get from GitHub expires after 8 hours. This isn't something we can change but there is a flow we can use via refresh tokens to have 6 months tokens. It seems unpractical to have to go through the authentification every day so it would be good to implement that. We shall also change the narrative in the UI. It's a little more complicated than "Setup once".

seinecle commented 2 years ago

ok, thanks for identifying this! Will have a look.

seinecle commented 2 years ago

@mbastian reading the doc, it seems we can just opt out of expiring tokens? If I understand correctly, the 8 hours limit is just for expiring tokens. So in Gephi's github app ("gephi-lite"), there just needs to opt out expiring tokens. The steps to find this option are detailed in the link you included in your comment. Please let me know if I misunderstand something.

mbastian commented 2 years ago

@seinecle Interesting. It still don't really get from the doc what happens when we opt-out? Access token don't expire at all? I opted out now. Let's see how it goes

seinecle commented 2 years ago

@mbastian do you think we can move to the publication?

mbastian commented 2 years ago

@seinecle Yes, almost :) Looks like you inverted the buttons between gist view versus network viz.

mbastian commented 2 years ago

@seinecle The plugin is published https://gephi.org/plugins/#/plugin/web-publish-plugin

Thanks for this great work! cc @jacomyal

seinecle commented 2 years ago

@mbastian Thank you for the extensive code review !!

DeJeroenBakker commented 1 year ago

First of all, thanks for developing this plugin @seinecle. I can imagine this being very useful!

The plugin doesn't seem to work for me at the moment, however. The authentication process works flawlessly, but when I try to publish my network, I always get the following 500 error:

Error creating online gexf file. Error code:500; Error message:

Is there any way to fix this? I've tried re-authenticating, using a different network and restarting Gephi, but it doesn't seem to make a difference.

Thanks!