diff --git a/superset/assets/.babelrc b/superset/assets/.babelrc
index 0c426be741d9a..c2ea3fd240bc3 100644
--- a/superset/assets/.babelrc
+++ b/superset/assets/.babelrc
@@ -1,4 +1,4 @@
{
"presets" : ["airbnb", "react", "env"],
- "plugins": ["syntax-dynamic-import", "react-hot-loader/babel"]
+ "plugins": ["lodash", "syntax-dynamic-import", "react-hot-loader/babel"]
}
diff --git a/superset/assets/package.json b/superset/assets/package.json
index 661344b162d50..11e874698bc10 100644
--- a/superset/assets/package.json
+++ b/superset/assets/package.json
@@ -80,7 +80,6 @@
"jquery": "3.1.1",
"json-bigint": "^0.3.0",
"lodash": "^4.17.11",
- "lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.45.0",
"mathjs": "^3.20.2",
"moment": "^2.20.1",
@@ -138,6 +137,7 @@
"babel-loader": "^7.1.4",
"babel-plugin-css-modules-transform": "^1.1.0",
"babel-plugin-dynamic-import-node": "^1.2.0",
+ "babel-plugin-lodash": "^3.3.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.23.0",
"babel-preset-airbnb": "^2.1.1",
diff --git a/superset/assets/spec/javascripts/modules/utils_spec.jsx b/superset/assets/spec/javascripts/modules/utils_spec.jsx
index 10a4fbc0c11ef..0f864352e3b47 100644
--- a/superset/assets/spec/javascripts/modules/utils_spec.jsx
+++ b/superset/assets/spec/javascripts/modules/utils_spec.jsx
@@ -1,6 +1,5 @@
import { expect, assert } from 'chai';
import {
- slugify,
formatSelectOptionsForRange,
d3format,
d3FormatPreset,
@@ -10,12 +9,6 @@ import {
} from '../../../src/modules/utils';
describe('utils', () => {
- it('slugify slugifies', () => {
- expect(slugify('My Neat Label! ')).to.equal('my-neat-label');
- expect(slugify('Some Letters AnD a 5')).to.equal('some-letters-and-a-5');
- expect(slugify(' 439278 ')).to.equal('439278');
- expect(slugify('5')).to.equal('5');
- });
it('formatSelectOptionsForRange', () => {
expect(formatSelectOptionsForRange(0, 4)).to.deep.equal([
[0, '0'],
diff --git a/superset/assets/src/SqlLab/components/SqlEditor.jsx b/superset/assets/src/SqlLab/components/SqlEditor.jsx
index c595ea6c2a99e..3dd9d485849a5 100644
--- a/superset/assets/src/SqlLab/components/SqlEditor.jsx
+++ b/superset/assets/src/SqlLab/components/SqlEditor.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import throttle from 'lodash.throttle';
+import { throttle } from 'lodash';
import {
Col,
FormGroup,
diff --git a/superset/assets/src/components/AlteredSliceTag.jsx b/superset/assets/src/components/AlteredSliceTag.jsx
index a317a041a6ad0..a0c1f1ee5246c 100644
--- a/superset/assets/src/components/AlteredSliceTag.jsx
+++ b/superset/assets/src/components/AlteredSliceTag.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Table, Tr, Td, Thead, Th } from 'reactable';
-import { isEqual, isEmpty } from 'underscore';
+import { isEqual, isEmpty } from 'lodash';
import TooltipWrapper from './TooltipWrapper';
import { controls } from '../explore/controls';
diff --git a/superset/assets/src/components/Button.jsx b/superset/assets/src/components/Button.jsx
index d895a02d20ec3..1485f1f560d8d 100644
--- a/superset/assets/src/components/Button.jsx
+++ b/superset/assets/src/components/Button.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { kebabCase } from 'lodash';
import { Button as BootstrapButton, Tooltip, OverlayTrigger } from 'react-bootstrap';
-import { slugify } from '../modules/utils';
const propTypes = {
tooltip: PropTypes.node,
@@ -41,7 +41,7 @@ export default function Button(props) {
return (
{tooltip}}
+ overlay={{tooltip}}
>
{button}
diff --git a/superset/assets/src/components/InfoTooltipWithTrigger.jsx b/superset/assets/src/components/InfoTooltipWithTrigger.jsx
index caacb914a50de..cb0b4890a47e6 100644
--- a/superset/assets/src/components/InfoTooltipWithTrigger.jsx
+++ b/superset/assets/src/components/InfoTooltipWithTrigger.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { kebabCase } from 'lodash';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
-import { slugify } from '../modules/utils';
const propTypes = {
label: PropTypes.string.isRequired,
@@ -36,7 +36,7 @@ export default function InfoTooltipWithTrigger({
+
{tooltip}
}
diff --git a/superset/assets/src/components/TooltipWrapper.jsx b/superset/assets/src/components/TooltipWrapper.jsx
index b189041603de8..761ef41eda3fb 100644
--- a/superset/assets/src/components/TooltipWrapper.jsx
+++ b/superset/assets/src/components/TooltipWrapper.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
+import { kebabCase } from 'lodash';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
-import { slugify } from '../modules/utils';
const propTypes = {
label: PropTypes.string.isRequired,
@@ -18,7 +18,7 @@ export default function TooltipWrapper({ label, tooltip, children, placement })
return (
{tooltip}}
+ overlay={{tooltip}}
>
{children}
diff --git a/superset/assets/src/dashboard/components/dnd/handleHover.js b/superset/assets/src/dashboard/components/dnd/handleHover.js
index a3b16aac4cb35..7c449c9ea872f 100644
--- a/superset/assets/src/dashboard/components/dnd/handleHover.js
+++ b/superset/assets/src/dashboard/components/dnd/handleHover.js
@@ -1,4 +1,4 @@
-import throttle from 'lodash.throttle';
+import { throttle } from 'lodash';
import getDropPosition from '../../util/getDropPosition';
const HOVER_THROTTLE_MS = 100;
diff --git a/superset/assets/src/explore/components/controls/ColorSchemeControl.jsx b/superset/assets/src/explore/components/controls/ColorSchemeControl.jsx
index 9463150cf7474..f09125d20435e 100644
--- a/superset/assets/src/explore/components/controls/ColorSchemeControl.jsx
+++ b/superset/assets/src/explore/components/controls/ColorSchemeControl.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import _ from 'underscore';
+import { isFunction } from 'lodash';
import { Creatable } from 'react-select';
import ControlHeader from '../ControlHeader';
import { colorScalerFactory } from '../../../modules/colors';
@@ -48,7 +48,7 @@ export default class ColorSchemeControl extends React.PureComponent {
renderOption(key) {
const { schemes } = this.props;
- const schemeLookup = _.isFunction(schemes) ? schemes() : schemes;
+ const schemeLookup = isFunction(schemes) ? schemes() : schemes;
const currentScheme = schemeLookup[key.value || defaultProps.value];
let colors = currentScheme;
@@ -68,7 +68,7 @@ export default class ColorSchemeControl extends React.PureComponent {
render() {
const { choices } = this.props;
- const options = (_.isFunction(choices) ? choices() : choices)
+ const options = (isFunction(choices) ? choices() : choices)
.map(choice => ({ value: choice[0], label: choice[1] }));
const selectProps = {
diff --git a/superset/assets/src/modules/utils.js b/superset/assets/src/modules/utils.js
index 0694cdcd0ae18..491fcf5318896 100644
--- a/superset/assets/src/modules/utils.js
+++ b/superset/assets/src/modules/utils.js
@@ -1,7 +1,6 @@
/* eslint camelcase: 0 */
import d3 from 'd3';
import $ from 'jquery';
-
import { formatDate, UTC } from './dates';
const siFormatter = d3.format('.3s');
@@ -186,16 +185,6 @@ export function formatSelectOptions(options) {
);
}
-export function slugify(string) {
- // slugify('My Neat Label! '); returns 'my-neat-label'
- return string
- .toString()
- .toLowerCase()
- .trim()
- .replace(/[\s\W-]+/g, '-') // replace spaces, non-word chars, w/ a single dash (-)
- .replace(/-$/, ''); // remove last floating dash
-}
-
export function getAjaxErrorMsg(error) {
const respJSON = error.responseJSON;
return (respJSON && respJSON.error) ? respJSON.error :
diff --git a/superset/assets/src/reduxUtils.js b/superset/assets/src/reduxUtils.js
index 5bd2565c75b38..cc0b5810c3bd0 100644
--- a/superset/assets/src/reduxUtils.js
+++ b/superset/assets/src/reduxUtils.js
@@ -1,7 +1,7 @@
import shortid from 'shortid';
import { compose } from 'redux';
import persistState from 'redux-localstorage';
-import { isEqual } from 'underscore';
+import { isEqual } from 'lodash';
export function addToObject(state, arrKey, obj) {
const newObject = Object.assign({}, state[arrKey]);
diff --git a/superset/assets/src/visualizations/deckgl/layers/polygon.jsx b/superset/assets/src/visualizations/deckgl/layers/polygon.jsx
index c0ac6d0c35c07..e84b943f61783 100644
--- a/superset/assets/src/visualizations/deckgl/layers/polygon.jsx
+++ b/superset/assets/src/visualizations/deckgl/layers/polygon.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { PolygonLayer } from 'deck.gl';
-import _ from 'underscore';
+import { flatten } from 'lodash';
import d3 from 'd3';
import DeckGLContainer from './../DeckGLContainer';
@@ -12,7 +12,7 @@ import { colorScalerFactory } from '../../../modules/colors';
import sandboxedEval from '../../../modules/sandbox';
function getPoints(features) {
- return _.flatten(features.map(d => d.polygon), true);
+ return flatten(features.map(d => d.polygon), true);
}
function getLayer(formData, payload, slice) {
diff --git a/superset/assets/src/visualizations/nvd3/NVD3Vis.js b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
index 73cb7b7cd6632..4e47b8e5b3046 100644
--- a/superset/assets/src/visualizations/nvd3/NVD3Vis.js
+++ b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
@@ -1,4 +1,4 @@
-import throttle from 'lodash.throttle';
+import { throttle } from 'lodash';
import d3 from 'd3';
import nv from 'nvd3';
import mathjs from 'mathjs';
diff --git a/superset/assets/yarn.lock b/superset/assets/yarn.lock
index e6825d8a51fb5..160433806317d 100644
--- a/superset/assets/yarn.lock
+++ b/superset/assets/yarn.lock
@@ -1671,7 +1671,7 @@ babel-plugin-dynamic-import-node@^1.2.0:
dependencies:
babel-plugin-syntax-dynamic-import "^6.18.0"
-babel-plugin-lodash@^3.3.2:
+babel-plugin-lodash@^3.3.2, babel-plugin-lodash@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/babel-plugin-lodash/-/babel-plugin-lodash-3.3.4.tgz#4f6844358a1340baed182adbeffa8df9967bc196"
dependencies:
@@ -7467,10 +7467,6 @@ lodash.once@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
-lodash.throttle@^4.1.1:
- version "4.1.1"
- resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
-
lodash.union@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"