Skip to content

Commit

Permalink
Remove unused static url, fix routes in plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Mar 30, 2018
1 parent f219654 commit f0dde50
Show file tree
Hide file tree
Showing 32 changed files with 43 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<%def name="stylesheets()">
${h.css('jquery-ui/smoothness/jquery-ui')}
${h.css('base')}
<%css = script_attributes.get("css") %>
%if css is not None:
<link rel="stylesheet" href="${css}">
<%css_path = script_attributes.get("css") %>
%if css_path is not None:
<link rel="stylesheet" href="${static_url}${css_path}">
%endif
</%def>
<%def name="javascripts()">
Expand All @@ -22,7 +22,8 @@
'libs/jquery/jquery-ui',
'bundled/libs.bundled',
'bundled/chart.bundled')}
<script type="text/javascript" src="${script_attributes.get("src")}"></script>
<%src_path = script_attributes.get("src") %>
<script type="text/javascript" src="${static_url}${src_path}"></script>
<script type="text/javascript">
$(function() {
var config = ${h.dumps(config)};
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/csg/templates/csg.mako
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%
root = h.url_for( "/" )
app_root = root + "plugins/visualizations/csg/static/"
app_root = root + "static/plugins/visualizations/csg/static/"
%>

<!DOCTYPE HTML>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/script.js"/>
<entry_point entry_point_type="chart" src="script.js"/>
<settings>
<input>
<label>Curve style</label>
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/drawrna/config/drawrna.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/script.js"/>
<entry_point entry_point_type="chart" src="script.js"/>
</visualization>
2 changes: 1 addition & 1 deletion config/plugins/visualizations/example/config/example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/script.js"/>
<entry_point entry_point_type="chart" src="script.js"/>
<specs>
<tag>svg</tag>
<use_panels>both</use_panels>
Expand Down
12 changes: 6 additions & 6 deletions config/plugins/visualizations/graphviz/templates/graphviz.mako
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@

<script type="text/javascript" src="/static/scripts/libs/jquery/jquery.js"></script>

${h.stylesheet_link( root + 'plugins/visualizations/graphviz/static/css/style.css' )}
${h.javascript_link( root + 'plugins/visualizations/graphviz/static/js/cytoscape.min.js' )}
${h.javascript_link( root + 'plugins/visualizations/graphviz/static/js/collapse.js' )}
${h.javascript_link( root + 'plugins/visualizations/graphviz/static/js/toolPanelFunctions.js' )}
${h.javascript_link( root + 'plugins/visualizations/graphviz/static/js/graphVis.js' )}
${h.stylesheet_link( root + 'static/plugins/visualizations/graphviz/static/css/style.css' )}
${h.javascript_link( root + 'static/plugins/visualizations/graphviz/static/js/cytoscape.min.js' )}
${h.javascript_link( root + 'static/plugins/visualizations/graphviz/static/js/collapse.js' )}
${h.javascript_link( root + 'static/plugins/visualizations/graphviz/static/js/toolPanelFunctions.js' )}
${h.javascript_link( root + 'static/plugins/visualizations/graphviz/static/js/graphVis.js' )}

</head>

## ----------------------------------------------------------------------------
<body>
${h.javascript_link( root + 'plugins/visualizations/graphviz/static/js/wz_tooltip.js' )}
${h.javascript_link( root + 'static/plugins/visualizations/graphviz/static/js/wz_tooltip.js' )}

<script>
function parseNodeEdge( data ){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<import>../../heatmap_default/config/heatmap_shared.xml</import>
</macros>
<description>Applies hierarchical clustering to a matrix using R. The data has to be provided in 3-column format. The result is displayed as clustered heatmap.</description>
<entry_point entry_point_type="chart" src="../heatmap_default/static/script.js" load="heatmap_cluster"/>
<entry_point entry_point_type="chart" src="../../heatmap_default/static/script.js" load="heatmap_cluster"/>
<expand macro="shared"/>
<specs>
<tag>svg</tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<import>heatmap_shared.xml</import>
</macros>
<description>Renders a heatmap from matrix data provided in 3-column format (x, y, observation).</description>
<entry_point entry_point_type="chart" src="../heatmap_default/static/script.js" load="heatmap_default"/>
<entry_point entry_point_type="chart" src="script.js" load="heatmap_default"/>
<expand macro="shared"/>
<specs>
<tag>svg</tag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a bar diagram using jqPlot hosted at http://www.jqplot.com.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../jqplot_bar/static/script.js" css="../jqplot_bar/static/script.css" load="jqplot_bar"/>
<entry_point entry_point_type="chart" src="script.js" css="script.css" load="jqplot_bar"/>
<specs>
<expand macro="specs"/>
</specs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Processes tabular data using R and renders a box plot using jqPlot hosted at http://www.jqplot.com.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../jqplot_bar/static/script.js" load="jqplot_box"/>
<entry_point entry_point_type="chart" src="../../jqplot_bar/static/script.js" css="../../jqplot_bar/static/script.css" load="jqplot_box"/>
<specs>
<expand macro="specs"/>
<confirm>True</confirm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Derives a discrete histogram from tabular data using R and renders a regular bar diagram using jqPlot hosted at http://www.jqplot.com.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../jqplot_bar/static/script.js" load="jqplot_histogram"/>
<entry_point entry_point_type="chart" src="../../jqplot_bar/static/script.js" css="../../jqplot_bar/static/script.css" load="jqplot_histogram"/>
<specs>
<expand macro="specs"/>
<confirm>True</confirm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a line chart using jqPlot hosted at http://www.jqplot.com.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../jqplot_bar/static/script.js" load="jqplot_line"/>
<entry_point entry_point_type="chart" src="../../jqplot_bar/static/script.js" css="../../jqplot_bar/static/script.css" load="jqplot_line"/>
<specs>
<expand macro="specs"/>
</specs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a scatter plot using jqPlot hosted at http://www.jqplot.com.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../jqplot_bar/static/script.js" load="jqplot_scatter"/>
<entry_point entry_point_type="chart" src="../../jqplot_bar/static/script.js" css="../../jqplot_bar/static/script.css" load="jqplot_scatter"/>
<specs>
<expand macro="specs"/>
</specs>
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/msa/config/msa.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/script.js"/>
<entry_point entry_point_type="chart" src="script.js"/>
<settings>
<input>
<label>Show conservation</label>
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/ngl/config/ngl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/ngl.js"/>
<entry_point entry_point_type="chart" src="ngl.js"/>
<settings>
<input>
<label>Quality</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a regular bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="static/nvd3.css" load="nvd3_bar"/>
<entry_point entry_point_type="chart" src="nvd3.js" css="nvd3.css" load="nvd3_bar"/>
<specs>
<expand macro="specs"/>
</specs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a scatter plot using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_bar_stacked"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_bar_stacked"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Uses the R-based `charts` tool to derive a histogram and displays it as regular or stacked bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_histogram"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_histogram"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Uses the R-based `charts` tool to derive a histogram for discrete data e.g. text labels. The result is displayed as regular or stacked bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_histogram_discrete"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_histogram_discrete"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a horizontal bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_horizontal"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_horizontal"/>
<specs>
<expand macro="specs"/>
</specs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a stacked horizontal bar diagram using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_horizontal_stacked"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_horizontal_stacked"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a line chart using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_line"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_line"/>
<specs>
<expand macro="specs"/>
<zoomable>true</zoomable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a line chart with focus using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_line_focus"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_line_focus"/>
<specs>
<expand macro="specs"/>
<zoomable>native</zoomable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a pie chart using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_pie"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_pie"/>
<specs>
<expand macro="specs"/>
<use_panels>yes</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a scatter plot using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_scatter"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_scatter"/>
<specs>
<expand macro="specs"/>
<zoomable>true</zoomable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a stacked area using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders an expanded stacked area using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea_full"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea_full"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</macros>
<description>Renders a stream chart using NVD3 hosted at http://www.nvd3.org.</description>
<expand macro="data"/>
<entry_point entry_point_type="chart" src="../nvd3_bar/static/nvd3.js" css="../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea_stream"/>
<entry_point entry_point_type="chart" src="../../nvd3_bar/static/nvd3.js" css="../../nvd3_bar/static/nvd3.css" load="nvd3_stackedarea_stream"/>
<specs>
<expand macro="specs"/>
<use_panels>no</use_panels>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/script.js"/>
<entry_point entry_point_type="chart" src="script.js"/>
<settings>
<input>
<label>Tree types</label>
Expand Down
2 changes: 1 addition & 1 deletion config/plugins/visualizations/pv/config/pv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="chart" src="static/pv.js"/>
<entry_point entry_point_type="chart" src="pv.js"/>
<settings>
<input>
<label>Quality</label>
Expand Down
16 changes: 4 additions & 12 deletions lib/galaxy/visualization/plugins/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def _set_up_static_plugin(self, **kwargs):
self.serves_static = False
if self._is_static_plugin():
self.static_path = self._build_static_path()
self.static_url = self._build_static_url()
self.serves_static = True
return self.serves_static

Expand All @@ -43,10 +42,7 @@ def _is_static_plugin(self):
return os.path.isdir(self._build_static_path())

def _build_static_path(self):
return os.path.join(self.path, 'static')

def _build_static_url(self):
return self.static_path.replace("./config", "./static")
return os.path.join(self.path.replace('./config', './static'), 'static')


class ServesTemplatesPluginMixin(object):
Expand Down Expand Up @@ -151,7 +147,6 @@ def to_dict(self):
'settings' : self.config.get('settings'),
'groups' : self.config.get('groups'),
'specs' : self.config.get('specs'),
'static_url' : None if not self.serves_static else '/'.join(['plugins', self.static_url]),
'href' : self._get_url()
}

Expand All @@ -170,14 +165,10 @@ def _get_saved_visualization_config(self, visualization, revision=None, **kwargs
return copy.copy(visualization.latest_revision.config)

# ---- non-public
def _check_path(self, path):
return os.path.exists(path)

def _set_up_static_images(self):
if self.serves_static:
logo_path = '/'.join([self.static_url, 'logo.png'])
if self._check_path(logo_path):
self.config['logo'] = logo_path
if os.path.exists(os.path.join(self.static_path, 'logo.png')):
self.config['logo'] = '/'.join([self.static_path, 'logo.png'])

def _build_render_vars(self, config, trans=None, **kwargs):
"""
Expand Down Expand Up @@ -340,6 +331,7 @@ def _render(self, render_vars, trans=None, embedded=None, **kwargs):
template.
"""
render_vars['embedded'] = self._parse_embedded(embedded)
render_vars['static_url'] = url_for('/%s/' % self.static_path)
render_vars.update(vars={})
render_vars.update({
"script_attributes" : self.config['entry_point']['attr']
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/webapps/galaxy/buildapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,5 +1060,4 @@ def wrap_in_middleware(app, global_conf, application_stack, **local_conf):

def wrap_in_static(app, global_conf, plugin_frameworks=None, **local_conf):
urlmap, cache_time = galaxy.web.framework.webapp.build_url_map(app, global_conf, local_conf)
# URL mapper becomes the root webapp
return urlmap

0 comments on commit f0dde50

Please sign in to comment.