From fd63d8383c27a57553d798bb35d7638a193774ab Mon Sep 17 00:00:00 2001 From: Johan Ahlen Date: Wed, 20 Mar 2019 16:31:18 +0100 Subject: [PATCH] HUE-8687 [frontend] Move reminding chart components into webpack bundles --- .eslintrc.js | 2 +- .../src/beeswax/templates/execute.mako | 4 - .../src/beeswax/templates/watch_results.mako | 2 - .../templates/editor2/bundle_editor.mako | 1 - .../templates/editor2/coordinator_editor.mako | 1 - .../templates/editor2/workflow_editor.mako | 1 - desktop/core/src/desktop/js/hue.js | 4 +- .../ko/bindings/charts/ko.leafletMapChart.js | 363 +++ .../bindings/charts/mapchart/ko.mapChart.js | 4 +- .../js/ko/bindings/charts/plotly/ko.plotly.js | 181 ++ desktop/core/src/desktop/js/ko/ko.all.js | 3 +- .../bindings/ko.plotly.js => nvd3/nv.all.js} | 22 +- .../js/nvd3/nv.d3.growingDiscreteBar.js | 483 ++++ .../js/nvd3/nv.d3.growingDiscreteBarChart.js | 439 ++++ .../desktop/js/nvd3/nv.d3.growingMultiBar.js | 687 +++++ .../js/nvd3/nv.d3.growingMultiBarChart.js | 651 +++++ .../src/desktop/js/nvd3/nv.d3.growingPie.js | 589 +++++ .../js => js/nvd3}/nv.d3.growingPieChart.js | 247 +- .../core/src/desktop/js/nvd3/nv.d3.legend.js | 380 +++ .../js/nvd3/nv.d3.lineWithBrushChart.js | 1146 ++++++++ .../js/nvd3/nv.d3.multiBarWithBrushChart.js | 1275 +++++++++ desktop/core/src/desktop/js/utils/hueGeo.js | 2338 +++++++++++++++++ .../desktop/ext/js/plotly-latest.min.js | 80 - .../src/desktop/static/desktop/js/hue.geo.js | 355 --- .../static/desktop/js/ko.charts.leaflet.js | 310 --- .../static/desktop/js/ko.charts.plotly.js | 173 -- .../desktop/static/desktop/js/nv.d3.dom.js | 42 - .../desktop/js/nv.d3.growingDiscreteBar.js | 390 --- .../js/nv.d3.growingDiscreteBarChart.js | 387 --- .../desktop/js/nv.d3.growingMultiBar.js | 528 ---- .../desktop/js/nv.d3.growingMultiBarChart.js | 569 ---- .../static/desktop/js/nv.d3.growingPie.js | 481 ---- .../desktop/static/desktop/js/nv.d3.legend.js | 300 --- .../desktop/js/nv.d3.lineWithBrushChart.js | 974 ------- .../js/nv.d3.multiBarWithBrushChart.js | 1092 -------- .../static/desktop/js/nv.d3.scatter.js | 689 ----- .../static/desktop/js/nv.d3.scatterChart.js | 644 ----- .../static/desktop/js/nv.d3.sunburst.js | 508 ---- .../static/desktop/js/nv.d3.sunburstChart.js | 188 -- .../static/desktop/js/nv.d3.tooltip.js | 498 ---- .../desktop/static/desktop/js/nv.d3.utils.js | 747 ------ .../core/src/desktop/templates/charting.mako | 54 - .../src/desktop/templates/common_header.mako | 2 - .../desktop/templates/common_header_m.mako | 3 - desktop/core/src/desktop/templates/hue.mako | 10 +- .../dashboard/templates/common_search.mako | 1 - ext/thirdparty/README.md | 5 +- package-lock.json | 28 + package.json | 13 +- 49 files changed, 8739 insertions(+), 9155 deletions(-) create mode 100644 desktop/core/src/desktop/js/ko/bindings/charts/ko.leafletMapChart.js create mode 100644 desktop/core/src/desktop/js/ko/bindings/charts/plotly/ko.plotly.js rename desktop/core/src/desktop/js/{ko/bindings/ko.plotly.js => nvd3/nv.all.js} (65%) create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.growingDiscreteBar.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.growingDiscreteBarChart.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.growingMultiBar.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.growingMultiBarChart.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.growingPie.js rename desktop/core/src/desktop/{static/desktop/js => js/nvd3}/nv.d3.growingPieChart.js (58%) create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.legend.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.lineWithBrushChart.js create mode 100644 desktop/core/src/desktop/js/nvd3/nv.d3.multiBarWithBrushChart.js create mode 100644 desktop/core/src/desktop/js/utils/hueGeo.js delete mode 100644 desktop/core/src/desktop/static/desktop/ext/js/plotly-latest.min.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/hue.geo.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/ko.charts.leaflet.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/ko.charts.plotly.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.dom.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.growingDiscreteBar.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.growingDiscreteBarChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.growingMultiBar.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.growingMultiBarChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.growingPie.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.legend.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.lineWithBrushChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.multiBarWithBrushChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.scatter.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.scatterChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.sunburst.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.sunburstChart.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.tooltip.js delete mode 100644 desktop/core/src/desktop/static/desktop/js/nv.d3.utils.js delete mode 100644 desktop/core/src/desktop/templates/charting.mako diff --git a/.eslintrc.js b/.eslintrc.js index 6cd56475921..ca9b3d4928f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,7 @@ const hueGlobals = [ 'USER_HOME_DIR', 'WorkerGlobalScope', // other misc - 'ace', 'CodeMirror', 'HueGeo', 'impalaDagre', 'less', 'MediumEditor', 'moment', 'Plotly', 'Role', 'trackOnGA', + 'ace', 'CodeMirror', 'impalaDagre', 'less', 'MediumEditor', 'moment', 'Role', 'trackOnGA', // jasmine 'afterAll', 'afterEach', 'beforeAll', 'beforeEach', 'describe', 'expect', 'fail', 'fdescribe', 'fit', 'it', 'jasmine', diff --git a/apps/beeswax/src/beeswax/templates/execute.mako b/apps/beeswax/src/beeswax/templates/execute.mako index ef85e7a79d4..ea91749e413 100644 --- a/apps/beeswax/src/beeswax/templates/execute.mako +++ b/apps/beeswax/src/beeswax/templates/execute.mako @@ -24,7 +24,6 @@ %> <%namespace name="assist" file="/assist.mako" /> -<%namespace name="charting" file="/charting.mako" /> <%namespace name="comps" file="beeswax_components.mako" /> <%namespace name="layout" file="layout.mako" /> @@ -1121,12 +1120,9 @@ ${ assist.assistPanel() } - -${ charting.import_charts() } - - - - - - - - %if conf.USE_NEW_CHARTS.get(): - - - - %else: - - - - - - - - - - - - - - %endif - - diff --git a/desktop/core/src/desktop/templates/common_header.mako b/desktop/core/src/desktop/templates/common_header.mako index 46d9641409c..343db00e9fe 100644 --- a/desktop/core/src/desktop/templates/common_header.mako +++ b/desktop/core/src/desktop/templates/common_header.mako @@ -31,7 +31,6 @@ if USE_NEW_EDITOR.get(): home_url = url('desktop_views_home2') %> -<%namespace name="charting" file="/charting.mako" /> <%namespace name="commonHeaderFooterComponents" file="/common_header_footer_components.mako" /> <%namespace name="hueAceAutocompleter" file="/hue_ace_autocompleter.mako" /> <%namespace name="hueIcons" file="/hue_icons.mako" /> @@ -161,7 +160,6 @@ if USE_NEW_EDITOR.get(): - ${ charting.import_charts() } ${ koComponents.all() } ${ hueAceAutocompleter.hueAceAutocompleter() } %endif diff --git a/desktop/core/src/desktop/templates/common_header_m.mako b/desktop/core/src/desktop/templates/common_header_m.mako index 7156215e4a0..029b81c5bde 100644 --- a/desktop/core/src/desktop/templates/common_header_m.mako +++ b/desktop/core/src/desktop/templates/common_header_m.mako @@ -126,9 +126,6 @@ if USE_NEW_EDITOR.get(): ace.config.set("basePath", "/static/desktop/js/ace"); - <%namespace name="charting" file="/charting.mako" /> - ${ charting.import_charts() } - -<%namespace name="charting" file="/charting.mako" /> <%namespace name="configKoComponents" file="/config_ko_components.mako" /> <%namespace name="notebookKoComponents" file="/common_notebook_ko_components.mako" /> <%namespace name="hueAceAutocompleter" file="/hue_ace_autocompleter.mako" /> -${ charting.import_charts() } ${ configKoComponents.config() } ${ notebookKoComponents.aceKeyboardShortcuts() } ${ notebookKoComponents.downloadSnippetResults() } diff --git a/desktop/libs/dashboard/src/dashboard/templates/common_search.mako b/desktop/libs/dashboard/src/dashboard/templates/common_search.mako index d34add98233..e7066af2f46 100644 --- a/desktop/libs/dashboard/src/dashboard/templates/common_search.mako +++ b/desktop/libs/dashboard/src/dashboard/templates/common_search.mako @@ -3063,7 +3063,6 @@ ${ dashboard.layout_skeleton(suffix='search') } %endif - ${ dashboard.import_layout(True) } diff --git a/ext/thirdparty/README.md b/ext/thirdparty/README.md index 64132feabc2..ea8375f01b1 100644 --- a/ext/thirdparty/README.md +++ b/ext/thirdparty/README.md @@ -174,8 +174,9 @@ Frontend third party dependencies (some checked in and some via npm) |Knockout Validation|2.0.3|MIT|https://github.com/Knockout-Contrib/Knockout-Validation| |KnockoutJS|3.4.2|MIT|https://github.com/knockout/knockout| |Leaflet|0.7.2|BSD|https://github.com/Leaflet/Leaflet| -|Leaflet Heat|?|BSD|https://github.com/mourner/simpleheat| -|Leaflet ZoomBox|?|ISC|https://github.com/consbio/Leaflet.ZoomBox| +|Leaflet Heat|0.2.0|BSD|https://github.com/mourner/simpleheat| +|Leaflet Marker cluster|0.5.0|MIT|https://github.com/Leaflet/Leaflet.markercluster| +|Leaflet ZoomBox|0.5.1|ISC|https://github.com/consbio/Leaflet.ZoomBox| |LESS|3.9.0|Apache|https://github.com/less/less.js/| |Load Grunt Tasks|4.0.0|MIT|https://www.npmjs.com/package/load-grunt-tasks| |LocalForage|1.7.3|Apache|https://github.com/localForage/localForage| diff --git a/package-lock.json b/package-lock.json index 0825fca9a0b..f5ad84e86d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7110,6 +7110,29 @@ "invert-kv": "^2.0.0" } }, + "leaflet": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-0.7.2.tgz", + "integrity": "sha1-gUpYh9BER9qQtWPAZRm3k0bXHkA=" + }, + "leaflet-zoombox": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/leaflet-zoombox/-/leaflet-zoombox-0.5.1.tgz", + "integrity": "sha512-qbLm6vkJzN1thr1cQFf9xsP+M7K5dz0Xa4EAt9kppkGDxV9Xewr1kpg6e8JBFfCGcqJi6pulNhkxLnfooxYZRQ==" + }, + "leaflet.heat": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/leaflet.heat/-/leaflet.heat-0.2.0.tgz", + "integrity": "sha1-EJ2M9Ybwre5B8Fr/Ax4np3/swik=" + }, + "leaflet.markercluster": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/leaflet.markercluster/-/leaflet.markercluster-0.5.0.tgz", + "integrity": "sha1-gEpcKwLsrLGcBkolM5arYNXfaZs=", + "requires": { + "leaflet": "~0.7.1" + } + }, "less": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/less/-/less-3.9.0.tgz", @@ -8598,6 +8621,11 @@ } } }, + "plotly.js-dist": { + "version": "1.45.3", + "resolved": "https://registry.npmjs.org/plotly.js-dist/-/plotly.js-dist-1.45.3.tgz", + "integrity": "sha512-suJi344/mTIQn3OKVjDtnDwiv9dhnluGqaH+poqgdJABp21rjDMa07LUQV5nZJ68d6+ZYTjkpC/DPfkiP+8ezA==" + }, "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", diff --git a/package.json b/package.json index f4e31c2b090..a83442d137b 100644 --- a/package.json +++ b/package.json @@ -25,26 +25,31 @@ }, "dependencies": { "clipboard": "1.7.1", - "d3v3": "1.0.3", "d3": "5.7.0", + "d3v3": "1.0.3", "dropzone": "5.5.1", "filesize": "4.0.0", "jquery": "3.3.1", - "jquery-ui": "1.12.1", - "jquery.cookie": "1.4.1", "jquery-form": "4.2.2", "jquery-mousewheel": "3.1.13", + "jquery-ui": "1.12.1", + "jquery.cookie": "1.4.1", "knockout": "3.4.2", - "knockout.mapping": "2.4.3", "knockout-sortable": "1.1.0", "knockout-switch-case": "2.1.0", + "knockout.mapping": "2.4.3", "knockout.validation": "2.0.3", + "leaflet": "0.7.2", + "leaflet-zoombox": "0.5.1", + "leaflet.heat": "0.2.0", + "leaflet.markercluster": "0.5.0", "less": "3.9.0", "localforage": "1.7.3", "lodash": "4.17.11", "medium-editor": "5.23.3", "minimist": "^1.2.0", "page": "1.8.6", + "plotly.js-dist": "1.45.3", "select2": "3.5.1", "selectize": "0.12.6", "selectize-plugin-clear": "0.0.3",