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

Webhooks fixes #25

Merged
merged 2 commits into from Feb 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/galaxy/scripts/layout/menu.js
Expand Up @@ -113,7 +113,7 @@ var Collection = Backbone.Collection.extend({
var webhook = model.toJSON();
if (webhook.activate) {
var obj = {
id: webhook.name,
id: webhook.id,
icon: webhook.config.icon,
url: webhook.config.url,
tooltip: webhook.config.tooltip,
Expand Down
66 changes: 11 additions & 55 deletions doc/source/admin/special_topics/webhooks.rst
Expand Up @@ -64,21 +64,17 @@ Each plugin has the following folder structure:
.. code-block::

- plugin_name
- config
- plugin_name.yaml (mandatory)
- helper
- __init__.py (optional)
- static
- script.js (optional)
- styles.css (optional)
- config.yml (mandatory)
- __init__.py (optional)
- script.js (optional)
- styles.css (optional)


config
------
config.yml
----------

The configuration file is just a .yml (or .yaml) file with a few options. The following options are mandatory:

- **name** - must be the same as the plugin's root directory name
- **id** - must be the same as the plugin's root directory name
- **type** (see Entry points) - can be combined with others
- **activate** - *true* or *false* - whether show the plugin on a page or not
- **icon** Icon to show (if masthead)
Expand All @@ -88,8 +84,8 @@ The configuration file is just a .yml (or .yaml) file with a few options. The fo
All other options can be anything used by the plugin and accessed later via *webhook.config['...']*.


helper/__init__.py
------------------
__init__.py
-----------

*__init__.py has* to have the **main()** function with the following (or similar) structure:

Expand All @@ -116,10 +112,8 @@ helper/__init__.py
As an example please take a look at the *phdcomics* example plugin: https://github.com/galaxyproject/galaxy/blob/release_17.05/test/functional/webhooks/phdcomics/helper/__init__.py


static
------

The *static* folder contains only two files with the specified above names (otherwise, they won’t be read on Galaxy run).
static files
------------

- script.js - all JavaScript code (with all third-party dependencies) must be here
- styles.css - all CSS styles, used by the plugin
Expand Down Expand Up @@ -149,41 +143,3 @@ tool/workflow
If a tool or a workflow plugin has script.js and/or styles.css, the content of these files will be read as two strings and sent to the client and appended to DOM’s <head>.

Such approach is a possible bottleneck if the two files are big (however, this shouldn’t ever happen because plugins are supposed to be small and simple).

masthead
--------

Topbar buttons are hard coded, so they’re rendered only after *make client*.

The plugin system is entirely dynamic. All plugins are detected during Galaxy load and their configs and statics are being saved. So, every plugin must be shown/rendered dynamically.

I found a not very optimal way to add buttons to the topbar (masthead):

.. code-block:: javascript

$(document).ready(function() {
Galaxy.page.masthead.collection.add({
id : ... ,
icon : ... ,
url : ... ,
tooltip : ... ,
onlick : function() { ... }
});
});

history-menu
------------

History Panel items are again hard coded, but in the current implementation they’re rendered as html elements (so, they’re not even stored in a collection or any other object).

To add new menu items, I do the following:

.. code-block:: javascript

menu.push({
html : _l( ... ),
anon : true,
func : function() { ... }
});

But in order to fetch all plugin menu items before rendering, I get them via API in a synchronous manner. The problem is that History Panel now may load a bit longer.
2 changes: 1 addition & 1 deletion static/scripts/bundled/admin.bundled.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions static/scripts/bundled/extended.bundled.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions static/scripts/bundled/libs.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/login.bundled.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/scripts/layout/masthead.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.