galaxy-hub icon indicating copy to clipboard operation
galaxy-hub copied to clipboard

Reimplement EU tools.yml

Open NickSto opened this issue 2 years ago • 2 comments

tools.yml is a database mapping tool names to toolshed urls. This powers the {% include tool.html %} function.

EU implementation

Seems to only be used in index-*.md middle panes (see index-rna.md)

  • The .md page uses an include like {% include tool.html id="CoFold" %}
  • Then _includes/tool.html queries the tools.yml database with {%- for tool in site.data.tools -%}
  • Then it generates a link to the tool like https://rna.usegalaxy.eu/root?tool_id=toolshed.g2.bx.psu.edu/repos/bgruening/rnaz/rnaz
    • It uses the page.subdomain variable to automatically point to the right Galaxy server.

It looks like tool.html takes 3 arguments:

  • id (required): The key to use when searching the tool database.
  • label (optional): The user-visible text to put inside the <a> tag.
  • title (optional): The title text for the link (the title attribute of the <a> tag).

Our implementation

At first glance this seems like an obvious case for a Vue component.

But how would it look up the tool name in the database? Vue components can't make GraphQL queries.

The best alternative I've thought of so far is to store the tool database in JSON file which we load in the component just like we import ~/../config.json in others. Not super pretty but it should work.

NickSto avatar May 26 '22 22:05 NickSto

Copying Bjorn's comment from #1117:

The tools.yml is just a convenience mapping of keys to proper tool-urls. This can be used for example on subdomains to link conveniently tools, e.g. in those markdown tables, without copying the URL every time AND more important, dependent on the subdomain the link is https://singlecell.usegalaxy.eu/root?tool_id={{ tool[1] }} or https://rna.usegalaxy.eu/root?tool_id={{ tool[1] }}

Originally posted by @bgruening in https://github.com/galaxyproject/galaxy-hub/issues/1117#issuecomment-1019123142

NickSto avatar May 26 '22 22:05 NickSto

@bgruening Okay, so before I go implementing some tricky solution to this, I should ask: do we need it? How bad would it be to just hardcode the tool urls in the Markdown? They're not likely to change very often, are they? And I think we're probably also going to just end up hardcoding the subdomains ({{ page.subdomain }}rna), so it won't have that advantage anyway.

NickSto avatar May 26 '22 22:05 NickSto