legumeinfo / tripal_phylotree

LIS project- tripal module for chado phylogeny and gene families
GNU General Public License v2.0
1 stars 7 forks source link

Missing JS Build Step? #25

Open abretaud opened 6 years ago

abretaud commented 6 years ago

Hi, I followed the instructions in the README to build the javascript. The commands succeeded, but I get a 404 error in my browser on app-bundle-4faf7ffa80.js. I have this url which returns the expected js file: http://localhost:3300/sites/all/modules/tripal_phylotree/theme/js/aurelia/scripts/vendor-bundle-9b7c49cfad.js but then it tries to download http://localhost:3300/tripal/phylotree/scripts/app-bundle-4faf7ffa80.js. I'm wondering if the app-bundle file should be placed somewhere else after being built, or if there is something to adapt in the src?

adf-ncgr commented 6 years ago

Hi- I'm not sure I'm exactly following what you're trying to do, but I think you want to load the aurelia bundle using something like what we have done in the tripal template file here: https://github.com/legumeinfo/tripal_phylotree/blob/1ba51b01e53c451f5e57ae66bc9b22057b749c61/theme/templates/tripal_phylotree_base.tpl.php#L192

// finally, use a regular script tag to inject the aurelia boostrapper // it will populate the aurelia-app div, above. printf('<script src="%s/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>', $js_dir)

e.g. in view-source:https://legumeinfo.org/chado_phylotree/phytozome_10_2.59235205 <script src="/sites/all/modules/tripal/tripal_phylogeny/theme/js/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>

let me know if I misunderstood your issue; if I can't help sort it out, I can certainly find someone in our group more qualified to speak to js bundling issues than I am :)

abretaud commented 6 years ago

My goal is just to test the installation of tripal_phylotree on a fresh instance of tripal serving on http://localhost:3300/tripal/ (deployed with https://github.com/erasche/docker-tripal, but it shouldn't matter).

My specific problem was that, just as on legumeinfo.org, I have this tag properly generated in tripal_phylotree_base.tpl.php:

<script src="/sites/all/modules/tripal/tripal_phylogeny/theme/js/aurelia/scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>

However, this vendor-bundle.js file loads the app-bundle with the relative url ../scripts/app-bundle.js. As it is relative to the html page at http://localhost:3300/tripal/phylotree/Test1 => the url generated is http://localhost:3300/tripal/scripts/app-bundle.js which is invalid and gives a 404 error.

I've tried to play with the bundling config in aurelia, but couldn't find a way to replace ../scripts/app-bundle.js by a proper value. I ended up adding an alias in my apache configuration:

Alias "/tripal/phylotree/scripts/" "/var/www/html/sites/all/modules/tripal_phylotree/theme/js/aurelia/scripts/"

I feel like you're doing something similar for legumeinfo.org.

I see 2 ways to close this issue:

  1. document the change I made to apache config in https://github.com/legumeinfo/tripal_phylotree#javascript-build-steps
  2. change the way aurelia bundles the app to use correct urls

I can make a PR for 1), but 2) looks too complicated for me :)

adf-ncgr commented 6 years ago

OK, I think I understand better now; if you look at https://github.com/legumeinfo/tripal_phylotree/blob/1ba51b01e53c451f5e57ae66bc9b22057b749c61/tripal_phylotree.module#L130 you will see where a route is being defined for URL chado_phylotree/scripts/ -> phylotree_static_scripts which is described as: /**

Maybe there are better ways of doing this in drupal- I vaguely remember when suggested this slurp-the-file-and-spit-it-back-hack to the primary developer of this module (who has since left the group). In any case, I'm guessing the issue with your setup is that your URL structure is a bit different (looks like we are expecting chado_phylotree for most of our endpoints so you may run into other issues downstream too?- maybe there is a more flexible way we should be supporting how people choose to deploy this, let me know if you have thoughts).

abretaud commented 6 years ago

Ah ok, now I understand what's happening: I loaded my test tree using the tripal loader which defines this unexpected url for the loaded tree https://github.com/tripal/tripal/blob/7.x-2.x/tripal_phylogeny/includes/tripal_phylogeny.chado_node.inc#L499

I'll make more tests loading data with your perl scripts. Anyway, using the tripal loader causes other problems as you can't enable both tripal_phylogeny and tripal_phylotree at the same time on a tripal instance (some functions have the same name in both).

adf-ncgr commented 6 years ago

thanks for the update on this. You aren't planning to attend PAG this year, by any chance? If so, we might see if we could find a time to sit down with someone from the tripal core development group and talk about a path forward that would at least minimize the confusion, if not actually try to get the independent development efforts re-synced with each other. If not, we'll find another opportunity for that...

abretaud commented 6 years ago

No, sorry I won't go to PAG this year. I might be able to go to GCC/BOSC in june, maybe there will be a gmod meeting as they did for gcc2016?

For the time being, I'll just use the perl scripts, but on the long term you're right it would be good to sync with tripal developments. I'm not sure what's been ported from tripal2 to tripal3, I can have a look at it too as using tripal3 is also in my plans