diff --git a/panoramix/models.py b/panoramix/models.py index 4eb47a5a94..575764dc79 100644 --- a/panoramix/models.py +++ b/panoramix/models.py @@ -96,8 +96,8 @@ class Dashboard(Model, AuditMixin): def js_files(self): l = [] for o in self.slices: - l += o.js_files - return list(set(l)) + l += [f for f in o.js_files if f not in l] + return l @property def css_files(self): diff --git a/panoramix/templates/panoramix/dashboard.html b/panoramix/templates/panoramix/dashboard.html index ad8dfa0e89..d56ea6f8c0 100644 --- a/panoramix/templates/panoramix/dashboard.html +++ b/panoramix/templates/panoramix/dashboard.html @@ -2,12 +2,14 @@ {% block head_css %} {{ super() }} + {% for css in dashboard.css_files %} + + {% endfor %} {% endblock %} @@ -42,6 +48,7 @@
{{ slice.slice_name }}
+
{% endfor %} @@ -50,18 +57,40 @@ {% block tail %} {{ super() }} + {% for js in dashboard.js_files %} + + {% endfor %} + + {% endblock %} diff --git a/panoramix/templates/panoramix/datasource.html b/panoramix/templates/panoramix/datasource.html index aae04dfdf3..257dd77efe 100644 --- a/panoramix/templates/panoramix/datasource.html +++ b/panoramix/templates/panoramix/datasource.html @@ -112,6 +112,7 @@ form input.form-control { {% endif %}
+
{% block viz %} {% if viz.error_msg %}
{{ viz.error_msg }}
@@ -120,6 +121,7 @@ form input.form-control {
{{ viz.warning_msg }}
{% endif %} {% endblock %} +
{% if debug %}

Results

@@ -154,10 +156,8 @@ form input.form-control { {% block tail_js %} {{ super() }} - - {% endfor %} + + + {% if not skip_libs %} + {% for js in viz.js_files %} + + {% endfor %} + {% endif %} {% endblock %} diff --git a/panoramix/templates/panoramix/viz_highcharts.html b/panoramix/templates/panoramix/viz_highcharts.html index 5d815d4649..6ec6f8fed0 100644 --- a/panoramix/templates/panoramix/viz_highcharts.html +++ b/panoramix/templates/panoramix/viz_highcharts.html @@ -1,7 +1,7 @@ {% extends "panoramix/viz.html" %} {% block viz %} {{ super() }} -
+
{% endblock %} {% block tail %} diff --git a/panoramix/templates/panoramix/viz_standalone.html b/panoramix/templates/panoramix/viz_standalone.html index 3e8c32dbeb..64adf199fa 100644 --- a/panoramix/templates/panoramix/viz_standalone.html +++ b/panoramix/templates/panoramix/viz_standalone.html @@ -1,9 +1,14 @@ -{% extends "appbuilder/baselayout.html" %} -{% block body %} + + + {% if not skip_libs %} + {% block head %} + + {% endblock %} + {% endif %} + {% block tail %}{% endblock %} + + {% block viz %} {% endblock %} -{% endblock %} -{% block tail %} - {{ super() }} -{% endblock %} - + + diff --git a/panoramix/viz.py b/panoramix/viz.py index 4a38b8f796..08cb114d92 100644 --- a/panoramix/viz.py +++ b/panoramix/viz.py @@ -11,7 +11,7 @@ from panoramix.highchart import Highchart, HighchartBubble from panoramix.forms import form_factory CHART_ARGS = { - 'height': 700, + #'height': 700, 'title': None, 'target_div': 'chart', } @@ -132,6 +132,7 @@ class BaseViz(object): self.template, form=form, viz=self, datasource=self.datasource, results=self.results, standalone=request.args.get('standalone') == 'true', + skip_libs=request.args.get('skip_libs') == 'true', *args, **kwargs) @@ -169,7 +170,7 @@ class HighchartsViz(BaseViz): stacked = False chart_type = 'not_stock' compare = False - js_files = ['highcharts.js'] + js_files = ['highstock.js'] class BubbleViz(HighchartsViz): @@ -179,7 +180,7 @@ class BubbleViz(HighchartsViz): form_fields = [ 'viz_type', 'since', 'until', 'series', 'entity', 'x', 'y', 'size', 'limit'] - js_files = ['highcharts.js', 'highcharts-more.js'] + js_files = ['highstock.js', 'highcharts-more.js'] def query_obj(self): d = super(BubbleViz, self).query_obj()