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

Add ribbon display as option on gene pages #515

Open
selewis opened this issue Jul 6, 2018 · 27 comments · May be fixed by #518
Open

Add ribbon display as option on gene pages #515

selewis opened this issue Jul 6, 2018 · 27 comments · May be fixed by #518
Assignees
Milestone

Comments

@selewis
Copy link

selewis commented Jul 6, 2018

Will help if needed. Package is here: https://www.npmjs.com/package/@geneontology/ribbon and code is right next door.

@kltm kltm added this to the wishlist milestone Jul 7, 2018
@kltm
Copy link
Member

kltm commented Jul 7, 2018

The docs on the page do not actually see to demonstrate usage or API options. As well, one thing we'd want to confirm is how to ensure that the links pointing to our own stuff. @selewis can you help with that, or should we rope @nathandunn in?

@selewis
Copy link
Author

selewis commented Jul 7, 2018

@kltm - I'd like to help, but for this we'll need @nathandunn because I've no experience with that side of things (be good to know)

@nathandunn
Copy link

@kltm / @selewis Yeah, I can help with that. I have to do something similar with genome features, as well. We may want to think about this for Monarch, as well. Talk on Monday.

@kltm
Copy link
Member

kltm commented Jul 10, 2018

More explicitly, I'd likely need the following to move forward:

  • widget insertion/injection documentation
  • CSS documentation (we'd like to align with our bootstrap a bit)
  • API documentation (at least how to use/change the linker)

@nathandunn
Copy link

@kltm / @selewis do you know where you want this in the page?

@kltm
Copy link
Member

kltm commented Jul 10, 2018

I'll put it in a new tab to begin with once I have the above.

@nathandunn
Copy link

Okay. Most likely we'll have to tool around with amigo a little bit to see how you do this insertion. My guess is that this is mostly jQuery / bbop libs? In theory here are some examples: http://tech.oyster.com/using-react-and-jquery-together/

@kltm
Copy link
Member

kltm commented Jul 10, 2018

Is that even necessary? The parts that will be used by the React component will have no interaction with any jQuery. As long as it can be injected (i.e. used as an external lib via browserify in our case) and does not actively conflict, I'm not sure what the issue would be.

@nathandunn
Copy link

hopefully it can be loaded as a passive react library using this: https://reactarmory.com/answers/how-to-integrate-react-into-existing-app . Doesn't look to bad.

Only one way to know for sure.

@kltm
Copy link
Member

kltm commented Jul 10, 2018

Give me docs (as above) and I'll try it out.

@nathandunn
Copy link

Sure. I need to confer with Suzi as there are a few other things that need to happen with it first (if you are waiting for docs). I'll provide docs for both react and vanilla.js (and hopefully working within the demo there). Probably next week unless its more urgent. You can probably test the method by just grabbing a random one, though:

https://www.npmjs.com/package/recharts

and see if that insert method works. It won't be any different.

@kltm
Copy link
Member

kltm commented Jul 10, 2018

Great! I'll probably just wait for the official docs from you as we'll also need to make sure that links stay within AmiGO where possible, etc.

@nathandunn
Copy link

nathandunn commented Jul 10, 2018 via email

@nathandunn
Copy link

@kltm I'm sure there will be a number of things to change yet, but probably good to at least get the ball rolling (and I'll be out Thursday and Friday).

Anyway, I updated the readme, and you can hopefully just follow the bouncing ball to get it work.

https://github.com/geneontology/ribbon/blob/master/README.md

Based on https://reactarmory.com/answers/how-to-integrate-react-into-existing-app . I think it shouldn't be too bad.

@kltm
Copy link
Member

kltm commented Jul 12, 2018

I think this is going in the right direction, but I am looking for the following:

Given the following HTML page:

<html>
<head>
 <link rel="stylesheet" type="text/css" href="my-css-compiled-my-way.css" />
 <script type="text/javascript" src="my-js-compiled-my-way.js"></script>
 <script type="text/javascript" src="MyOtherAppCompiledMyWayInNotReact.js"></script>
</head>
 <body>
  <div id="foo"></div>
 </body>
</html>

How do I get your widget into div "foo" with my linker (to make sure that things link internally to my app)?

@nathandunn
Copy link

I see what you are saying. I think its possible thatI may need a further component to make this work. I have a few more Ribbon things to take care of and then I'll give this another shot in pure HTML.

@nathandunn
Copy link

@kltm Are you using NPM at all?

@kltm
Copy link
Member

kltm commented Jul 17, 2018

@nathandunn Massively--we don't use anything else currently (except when knitting local package versions as is the case with some AmiGO deployments).

@nathandunn
Copy link

Okay, I'll try to create a simple npm project and wrap it in. I still have to fix coloring and a few other things. Might happen later this week. My intuition is that I will need a wrapper file. Its also likely that the script does the insertion, but only way to find out.

@nathandunn
Copy link

@kltm Are you running es6, es5?

@nathandunn
Copy link

@kltm I think the most eloquent solution looks like this (it is not working, but I want to give you an idea):

https://github.com/nathandunn/ribbon-import-test

You provide a div: https://github.com/nathandunn/ribbon-import-test/blob/master/dist/index.html#L22

and then tell react to render it:

https://github.com/nathandunn/ribbon-import-test/blob/master/src/application.js#L15

Demo isn't parameterized, so its commented out (and we should really not use a component called demo in the first-place). However, we can create a react component that mirrors Demo fairly easily in-line or we can just put something like this into the demo function and it will just work.

Doing it this way, you'll need to add react, react-dom, and @geneontology/ribbon to your npm package.json

I think this is the best strategy for doing this effectively. If you cut out a swath for me as a PR to test that you can do a simple ReactDOM.render() I'm sure I can take care of the rest or we can figure it out later this week.

@kltm
Copy link
Member

kltm commented Jul 18, 2018

@nathandunn es5, no transpiler. Although is necessary, that could be added to the setup.

@kltm
Copy link
Member

kltm commented Jul 18, 2018

We do not use webpack, rather browserify right now. CommonJS compatibility is important.

@nathandunn
Copy link

I don't think that webpack or babel will be necessary. https://stackoverflow.com/questions/43175140/why-does-react-require-babel-and-webpack-to-work

If you could get that example kind of working in amigo (just the ReactDOM.render(<div>abc</div>), I think the rest should be pretty straight-forward
.

@nathandunn nathandunn linked a pull request Jul 19, 2018 that will close this issue
@nathandunn
Copy link

@kltm So it works as part of #518 for react injection. The important pieces will be:

  1. add the appropriate packages and import them: https://github.com/geneontology/amigo/pull/518/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R25

I have it working using a script import in the template file + babel you probably want to remove: https://github.com/geneontology/amigo/pull/518/files#diff-c5524986336c8851ed608187ea3c28e8R6

  1. provide a div (maybe in the template): https://github.com/geneontology/amigo/pull/518/files#diff-c5524986336c8851ed608187ea3c28e8R117 . Could be done in code as well.

  2. create a react component and render it: https://github.com/geneontology/amigo/pull/518/files#diff-c5524986336c8851ed608187ea3c28e8R158 and call ReactDom.render() https://github.com/geneontology/amigo/pull/518/files#diff-c5524986336c8851ed608187ea3c28e8R171

  3. include the Ribbon Component (this is where I got stuck) and render it as a react component where it gets properly configured. We do this in the Ribbon demo:

and within the agr_ui:

@kltm
Copy link
Member

kltm commented Dec 1, 2018

Talking to @sibyl229 , it seems they have run into similar issues. It might be good to touch bases.

@lpalbou
Copy link
Contributor

lpalbou commented Dec 1, 2018

Similar issues as ... ? But yes, we were also discussing yesterday with Patrick and ZFIN (not using any framework), but they still would want to be able to integrate the ribbon. So we'll need some more work & documentation on that. I should have some time to work on that in a ~ month, but the ribbon is still changing and there will be some components refactoring soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants