Selaa lähdekoodia

HUE-7433 [frontend] Add switch to enable new charting library

Enrico Berti 8 vuotta sitten
vanhempi
commit
9de48d8

+ 2 - 2
apps/beeswax/src/beeswax/templates/execute.mako

@@ -24,8 +24,8 @@
 %>
 
 <%namespace name="assist" file="/assist.mako" />
+<%namespace name="charting" file="/charting.mako" />
 <%namespace name="comps" file="beeswax_components.mako" />
-<%namespace name="dashboard" file="common_dashboard.mako" />
 <%namespace name="layout" file="layout.mako" />
 
 ${ commonheader(_('Query'), app_name, user, request) | n,unicode }
@@ -1140,7 +1140,7 @@ ${ assist.assistPanel() }
 <link rel="stylesheet" href="${ static('desktop/ext/chosen/chosen.min.css') }">
 <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
 
-${ dashboard.import_charts() }
+${ charting.import_charts() }
 
 
 <script type="text/javascript">

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -185,6 +185,9 @@
   # Choose whether to show the improved assist panel and the right context panel
   ## use_new_side_panels=false
 
+  # Choose whether to use new charting library across the whole Hue.
+  ## use_new_charts=false
+
   # Editor autocomplete timeout (ms) when fetching columns, fields, tables etc.
   # To disable this type of autocompletion set the value to 0.
   ## editor_autocomplete_timeout=30000

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -189,6 +189,9 @@
   # Choose whether to show the improved assist panel and the right context panel
   ## use_new_side_panels=false
 
+  # Choose whether to use new charting library across the whole Hue.
+  ## use_new_charts=false
+
   # Editor autocomplete timeout (ms) when fetching columns, fields, tables etc.
   # To disable this type of autocompletion set the value to 0.
   ## editor_autocomplete_timeout=30000

+ 7 - 0
desktop/core/src/desktop/conf.py

@@ -1370,6 +1370,13 @@ USE_DEFAULT_CONFIGURATION = Config(
   help=_('Enable saved default configurations for Hive, Impala, Spark, and Oozie.')
 )
 
+USE_NEW_CHARTS = Config(
+  key='use_new_charts',
+  default=False,
+  type=coerce_bool,
+  help=_('Choose whether to use new charting library across the whole Hue.')
+)
+
 
 IS_HUE_4 = Config( # To remove in Hue 5
   key='is_hue_4',

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6 - 0
desktop/core/src/desktop/static/desktop/ext/js/plotly-latest.min.js


+ 368 - 0
desktop/core/src/desktop/static/desktop/js/ko.charts.plotly.js

@@ -0,0 +1,368 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+(function () {
+
+  ko.HUE_CHARTS = {
+    TYPES: {
+      LINECHART: "lines",
+      BARCHART: "bars",
+      TIMELINECHART: "timeline",
+      POINTCHART: "points",
+      PIECHART: "pie",
+      MAP: "map",
+      GRADIENTMAP: "gradientmap",
+      SCATTERCHART: "scatter"
+    }
+  };
+
+  ko.bindingHandlers.pieChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.barChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.timelineChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.lineChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.leafletMapChart = {
+    update: function (element, valueAccessor) {
+      var _options = valueAccessor();
+      var _data = _options.transformer(valueAccessor().datum);
+
+      function toggleVisibility() {
+        if (((_options.visible != null && _options.visible) || _options.visible == null || typeof _options == "undefined")) {
+          $(element).show();
+          $(element).siblings(".leaflet-nodata").remove();
+        }
+        else {
+          $(element).hide();
+          if ((_options.visible != null && _options.visible) && !_options.isLoading) {
+            $(element).siblings(".leaflet-nodata").remove();
+            $(element).before($("<div>").addClass("leaflet-nodata").css({ "textAlign": "center", "fontSize": "18px", "fontWeight": 700, "marginTop": "20px"}).text("No Data Available."));
+          }
+        }
+      }
+
+      if ($(element).data("mapData") == null || $(element).data("mapData") != ko.toJSON(_data) || _options.forceRedraw) {
+
+        $(element).data("mapData", ko.toJSON(_data));
+
+        var _hasAtLeastOneLat = false;
+        _data.forEach(function (item) {
+          if (item.lat != null && $.isNumeric(item.lat)) {
+            _hasAtLeastOneLat = true;
+          }
+        });
+        var _hasAtLeastOneLng = false;
+        _data.forEach(function (item) {
+          if (item.lng != null && $.isNumeric(item.lng)) {
+            _hasAtLeastOneLng = true;
+          }
+        });
+
+        if (_options.height != null) {
+          $(element).height(_options.height * 1);
+        }
+        else {
+          if ($(element).parents(".tab-pane").length > 0) {
+            $(element).height($(element).parents(".tab-pane").height() - 100);
+          }
+          else {
+            $(element).height(300);
+          }
+        }
+
+        toggleVisibility();
+
+        var _map = null;
+        if ($(element).data('_map') != null) {
+          _map = $(element).data('_map');
+          _map.removeLayer($(element).data('_markerLayer'));
+          if ($(element).data('_heatLayer')){
+            _map.removeLayer($(element).data('_heatLayer'));
+            $(element).data('_heatLayer', null);
+          }
+        }
+
+        var _clusterGroup = L.markerClusterGroup({
+          maxClusterRadius: 10,
+          polygonOptions: {
+            weight: 1.5
+          }
+        });
+
+        if (_hasAtLeastOneLat && _hasAtLeastOneLng) {
+          try {
+            if (_map == null) {
+              _map = L.map(element);
+              var tileLayerOptions = {
+                layer: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
+                attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
+              }
+              if (LeafletGlobals) {
+                tileLayerOptions = LeafletGlobals;
+              }
+              L.tileLayer(tileLayerOptions.layer, {
+                attribution: $(element).width() > 300 ? tileLayerOptions.attribution : ''
+              }).addTo(_map);
+
+              if (L.control.zoomBox) {
+                var _zoomBox = L.control.zoomBox({
+                  modal: true
+                });
+                _map.addControl(_zoomBox);
+              }
+
+              if (_options.showMoveCheckbox) {
+                var _command = L.control({
+                  position: $(element).width() > 300 ? "topright" : "bottomleft"
+                });
+
+                _command.onAdd = function (map) {
+                  var div = L.DomUtil.create("div", "leaflet-search-command leaflet-bar");
+                  div.innerHTML = '<label class="checkbox" style="font-size: 11px"><input id="command' + $(element).parents(".card-widget").attr("id") + '" type="checkbox"/> ' + (_options.moveCheckboxLabel ? _options.moveCheckboxLabel : 'Search as I move the map') + '</label>';
+                  return div;
+                };
+
+                _command.addTo(_map);
+
+                if (_options.onRegionChange == null) {
+                  _options.onRegionChange = function () {
+                  };
+                }
+
+                var _onRegionChange = function () {
+                };
+
+                $("#command" + $(element).parents(".card-widget").attr("id")).on("change", function () {
+                  if ($(this).is(":checked")) {
+                    if (_options.onRegionChange != null) {
+                      _onRegionChange = _options.onRegionChange;
+                    }
+                  }
+                  else {
+                    _onRegionChange = function () {
+                    };
+                  }
+                });
+
+                _map.on("boxzoomend", function (e) {
+                  _onRegionChange(e.boxZoomBounds);
+                });
+                _map.on("dragend", function () {
+                  _onRegionChange(_map.getBounds());
+                });
+                _map.on("zoomend", function () {
+                  _onRegionChange(_map.getBounds());
+                });
+              }
+
+            }
+
+            var heatData = [];
+
+            function sumHeatData(data) {
+              var sumData = [];
+              data.forEach(function (d) {
+                var found = false;
+                if (d.length === 3) {
+                  sumData.forEach(function (s) {
+                    if (d[0] == s[0] && d[1] == s[1]) {
+                      found = true;
+                      s[2] += d[2];
+                    }
+                  });
+                }
+                if (!found) {
+                  sumData.push(d);
+                }
+              });
+              return sumData;
+            }
+
+            function getMaxIntensity(data) {
+              var maxIntensity = 0;
+              data.forEach(function (d) {
+                if (d[2] > maxIntensity) {
+                  maxIntensity = d[2];
+                }
+              });
+              return maxIntensity;
+            }
+
+            _data.forEach(function (item) {
+              if (item && item.lng != null && item.lat != null) {
+                var _addMarker = false;
+                try {
+                  var _latLngObj = L.latLng(item.lat, item.lng);
+                  _addMarker = true;
+                }
+                catch (e) {
+                  if (typeof console != "undefined") {
+                    console.error(e);
+                  }
+                }
+                if (_addMarker) {
+                  var _marker = L.marker([item.lat, item.lng]);
+                  if (item.isHeat) {
+                    if (item.intensity != null) {
+                      heatData.push([item.lat, item.lng, item.intensity]);
+                    }
+                    else {
+                      heatData.push([item.lat, item.lng]);
+                    }
+                  }
+                  else {
+                    if (item.label != null) {
+                      _marker.bindPopup($.isArray(item.label) ? item.label.join("") : item.label);
+                    }
+                  }
+                  _clusterGroup.addLayer(_marker);
+                }
+              }
+            });
+            var heat;
+            if (heatData.length > 0) {
+              heatData = sumHeatData(heatData);
+              heat = L.heatLayer(heatData);
+              if (heatData[0].length === 3) { // it has intensity
+                heat.setOptions(getMaxIntensity(heatData));
+              }
+            }
+
+            window.setTimeout(function () {
+              if (!$("#command" + $(element).parents(".card-widget").attr("id")).is(":checked")) {
+                _map.fitBounds(_clusterGroup.getBounds());
+              }
+              if ($(element).find('.leaflet-tile-pane').children().length > 0) {
+                if (heatData.length == 0) {
+                  _map.addLayer(_clusterGroup);
+                  $('.leaflet-heatmap-layer').remove();
+                }
+                else {
+                  try {
+                    $('.leaflet-heatmap-layer').remove();
+                    heat.addTo(_map);
+                  }
+                  catch (e) {
+                  } // context2D not initialized yet
+                }
+              }
+              if (_options.onComplete != null) {
+                _options.onComplete();
+              }
+            }, 0);
+
+            if (huePubSub) {
+              huePubSub.subscribe('resize.leaflet.map', function () {
+                if ($(element).data('_map')) {
+                  $(element).data('_map').invalidateSize();
+                  if ($(element).data('_markerLayer')) {
+                    try {
+                      $(element).data('_map').fitBounds($(element).data('_markerLayer').getBounds());
+                    }
+                    catch (e) {
+                    }
+                  }
+                }
+              });
+            }
+
+          }
+          catch (err) {
+            $.jHueNotify.error(err.message);
+          }
+        }
+
+        var previousMarkerLayer = $(element).data('_markerLayer');
+        if (previousMarkerLayer) {
+          window.setTimeout(function () {
+            try {
+              previousMarkerLayer.removeLayers(previousMarkerLayer.getLayers());
+            }
+            catch(e){}
+          }, 0);
+        }
+
+        $(element).data('_map', _map);
+        $(element).data('_markerLayer', _clusterGroup);
+        $(element).data('_heatLayer', heat);
+        if (_options.onComplete != null) {
+          _options.onComplete();
+        }
+      }
+      else {
+        toggleVisibility();
+      }
+    }
+  };
+
+  ko.bindingHandlers.mapChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor, allBindingsAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.scatterChart = {
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  ko.bindingHandlers.partitionChart = {
+    init: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    },
+    update: function (element, valueAccessor) {
+      $(element).html('To-do.');
+    }
+  };
+
+  window.chartsUpdatingState = function(){};
+  window.chartsNormalState = function(){};
+
+})();

+ 71 - 0
desktop/core/src/desktop/templates/charting.mako

@@ -0,0 +1,71 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+
+<%!
+from desktop import conf
+%>
+
+<%def name="import_charts()">
+  <link rel="stylesheet" href="${ static('desktop/ext/css/hue-charts.css') }">
+  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.css') }">
+  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.markercluster.css') }">
+  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.zoombox.css') }">
+
+  <script src="${ static('desktop/js/hue.geo.js') }"></script>
+
+  <script src="${ static('desktop/ext/js/leaflet/leaflet.js') }"></script>
+  <script src="${ static('desktop/ext/js/leaflet/leaflet.markercluster.js') }"></script>
+  <script src="${ static('desktop/ext/js/leaflet/leaflet.zoombox.js') }"></script>
+  <script src="${ static('desktop/ext/js/leaflet/leaflet.heat.js') }"></script>
+
+  %if conf.USE_NEW_CHARTS.get():
+  <script src="${ static('desktop/ext/js/plotly-latest.min.js') }"></script>
+  <script src="${ static('desktop/js/ko.charts.plotly.js') }"></script>
+  %else:
+  <link rel="stylesheet" href="${ static('desktop/ext/css/nv.d3.min.css') }">
+  <link rel="stylesheet" href="${ static('desktop/css/nv.d3.css') }">
+
+  <script src="${ static('desktop/ext/js/d3.v3.js') }"></script>
+  <script src="${ static('desktop/ext/js/d3.v4.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.js') }"></script>
+  <script src="${ static('desktop/ext/js/topojson.v1.min.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/world.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/usa.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/chn.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/bra.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/can.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/ind.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/gbr.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/ita.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/fra.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/deu.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/jpn.topo.js') }"></script>
+  <script src="${ static('desktop/ext/js/topo/aus.topo.js') }"></script>
+
+  <script src="${ static('desktop/js/nv.d3.datamaps.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.legend.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.multiBarWithBrushChart.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.lineWithBrushChart.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingDiscreteBar.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingDiscreteBarChart.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingMultiBar.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingMultiBarChart.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingPie.js') }"></script>
+  <script src="${ static('desktop/js/nv.d3.growingPieChart.js') }"></script>
+  <script src="${ static('desktop/js/ko.charts.js') }"></script>
+  %endif
+
+</%def>

+ 0 - 44
desktop/core/src/desktop/templates/common_dashboard.mako

@@ -304,47 +304,3 @@
     };
   </script>
 </%def>
-
-
-<%def name="import_charts()">
-  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.css') }">
-  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.markercluster.css') }">
-  <link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.zoombox.css') }">
-  <link rel="stylesheet" href="${ static('desktop/ext/css/nv.d3.min.css') }">
-  <link rel="stylesheet" href="${ static('desktop/css/nv.d3.css') }">
-
-  <script src="${ static('desktop/js/hue.geo.js') }" type="text/javascript" charset="utf-8"></script>
-
-  <script src="${ static('desktop/ext/js/leaflet/leaflet.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/leaflet/leaflet.markercluster.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/leaflet/leaflet.zoombox.js') }" type="text/javascript" charset="utf-8"></script>
-
-  <script src="${ static('desktop/js/nv.d3.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topojson.v1.min.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/world.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/usa.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/chn.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/bra.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/can.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/ind.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/gbr.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/ita.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/fra.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/deu.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/jpn.topo.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/ext/js/topo/aus.topo.js') }" type="text/javascript" charset="utf-8"></script>
-
-  <script src="${ static('desktop/js/nv.d3.datamaps.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.legend.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.multiBarWithBrushChart.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.lineWithBrushChart.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingDiscreteBar.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingDiscreteBarChart.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingMultiBar.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingMultiBarChart.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingPie.js') }" type="text/javascript" charset="utf-8"></script>
-  <script src="${ static('desktop/js/nv.d3.growingPieChart.js') }" type="text/javascript" charset="utf-8"></script>
-
-  <script src="${ static('desktop/js/ko.charts.js') }" type="text/javascript" charset="utf-8"></script>
-
-</%def>

+ 0 - 3
desktop/core/src/desktop/templates/hue.mako

@@ -451,11 +451,8 @@ ${ commonshare() | n,unicode }
 <script src="${ static('desktop/js/jquery.tablescroller.js') }"></script>
 <script src="${ static('desktop/js/jquery.tableextender.js') }"></script>
 <script src="${ static('desktop/js/jquery.tableextender2.js') }"></script>
-<script src="${ static('desktop/ext/js/d3.v3.js') }"></script>
-<script src="${ static('desktop/ext/js/d3.v4.js') }"></script>
 <script src="${ static('desktop/js/hue.colors.js') }"></script>
 <script src="${ static('desktop/js/apiHelper.js') }"></script>
-<script src="${ static('desktop/js/ko.charts.js') }"></script>
 <script src="${ static('desktop/ext/js/knockout-sortable.min.js') }"></script>
 <script src="${ static('desktop/ext/js/knockout.validation.min.js') }"></script>
 <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }"></script>

+ 2 - 1
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -21,6 +21,7 @@ from desktop import conf
 from desktop.views import commonheader, commonfooter, _ko, commonshare
 %>
 
+<%namespace name="charting" file="/charting.mako" />
 <%namespace name="dashboard" file="common_dashboard.mako" />
 
 <%def name="page_structure(is_mobile=False, is_embeddable=False)">
@@ -2807,7 +2808,7 @@ ${ dashboard.import_layout(True) }
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.gridster.with-extras.min.js') }"></script>
 
 ${ dashboard.import_bindings() }
-${ dashboard.import_charts() }
+${ charting.import_charts() }
 
 <style type="text/css">
 % if conf.CUSTOM.BANNER_TOP_HTML.get():

+ 4 - 40
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -33,11 +33,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <link rel="stylesheet" href="${ static('notebook/css/notebook.css') }">
 <link rel="stylesheet" href="${ static('desktop/ext/css/bootstrap-editable.css') }">
 <link rel="stylesheet" href="${ static('desktop/ext/chosen/chosen.min.css') }">
-<link rel="stylesheet" href="${ static('desktop/ext/css/hue-charts.css') }">
-<link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.css') }">
-<link rel="stylesheet" href="${ static('desktop/ext/css/leaflet.markercluster.css') }">
-<link rel="stylesheet" href="${ static('desktop/ext/css/nv.d3.min.css') }">
-<link rel="stylesheet" href="${ static('desktop/css/nv.d3.css') }">
+
 <link rel="stylesheet" href="${ static('desktop/ext/select2/select2.css') }">
 <link rel="stylesheet" href="${ static('desktop/ext/css/medium-editor.min.css') }">
 <link rel="stylesheet" href="${ static('desktop/css/bootstrap-medium-editor.css') }">
@@ -46,7 +42,6 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 % if not is_embeddable:
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
 <script src="${ static('desktop/ext/js/knockout-sortable.min.js') }"></script>
-<script src="${ static('desktop/js/ko.charts.js') }"></script>
 <script src="${ static('desktop/js/ko.editable.js') }"></script>
 <script src="${ static('desktop/js/share2.vm.js') }"></script>
 % endif
@@ -119,40 +114,6 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }" type="text/javascript" charset="utf-8"></script>
 <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
 
-<script src="${ static('desktop/js/hue.geo.js') }" type="text/javascript" charset="utf-8"></script>
-
-<script src="${ static('desktop/ext/js/leaflet/leaflet.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/leaflet/leaflet.markercluster.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/leaflet/leaflet.heat.js') }" type="text/javascript" charset="utf-8"></script>
-
-<script src="${ static('desktop/js/nv.d3.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topojson.v1.min.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/world.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/usa.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/chn.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/bra.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/can.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/ind.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/gbr.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/ita.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/fra.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/deu.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/jpn.topo.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/ext/js/topo/aus.topo.js') }" type="text/javascript" charset="utf-8"></script>
-
-<script src="${ static('desktop/js/nv.d3.datamaps.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.legend.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.multiBarWithBrushChart.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.lineWithBrushChart.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingDiscreteBar.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingDiscreteBarChart.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingMultiBar.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingMultiBarChart.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingPie.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.growingPieChart.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.scatter.js') }" type="text/javascript" charset="utf-8"></script>
-<script src="${ static('desktop/js/nv.d3.scatterChart.js') }" type="text/javascript" charset="utf-8"></script>
-
 <script src="${ static('desktop/ext/select2/select2.min.js') }" type="text/javascript" charset="utf-8"></script>
 
 <!--[if IE 9]>
@@ -160,9 +121,12 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
 <![endif]-->
 <script src="${ static('desktop/ext/js/medium-editor.min.js') }" type="text/javascript" charset="utf-8"></script>
 
+<%namespace name="charting" file="/charting.mako" />
 <%namespace name="dashboard" file="/common_dashboard.mako" />
 <%namespace name="sqlSyntaxDropdown" file="/sql_syntax_dropdown.mako" />
 
+${ charting.import_charts() }
+
 <script src="${ static('desktop/js/ko.common-dashboard.js') }" type="text/javascript" charset="utf-8"></script>
 
 </%def>

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä