diff --git a/superset/assets/spec/javascripts/explore/components/URLShortLinkButton_spec.jsx b/superset/assets/spec/javascripts/components/URLShortLinkButton_spec.jsx
similarity index 76%
rename from superset/assets/spec/javascripts/explore/components/URLShortLinkButton_spec.jsx
rename to superset/assets/spec/javascripts/components/URLShortLinkButton_spec.jsx
index 986daaa43..98e6e2cf6 100644
--- a/superset/assets/spec/javascripts/explore/components/URLShortLinkButton_spec.jsx
+++ b/superset/assets/spec/javascripts/components/URLShortLinkButton_spec.jsx
@@ -4,13 +4,13 @@ import { describe, it } from 'mocha';
import { shallow } from 'enzyme';
import { OverlayTrigger } from 'react-bootstrap';
-import URLShortLinkButton from '../../../../src/explore/components/URLShortLinkButton';
+import URLShortLinkButton from '../../../src/components/URLShortLinkButton';
describe('URLShortLinkButton', () => {
const defaultProps = {
- slice: {
- querystring: () => 'query string',
- },
+ url: 'mockURL',
+ emailSubject: 'Mock Subject',
+ emailContent: 'mock content',
};
it('renders', () => {
diff --git a/superset/assets/src/explore/components/URLShortLinkButton.jsx b/superset/assets/src/components/URLShortLinkButton.jsx
similarity index 65%
rename from superset/assets/src/explore/components/URLShortLinkButton.jsx
rename to superset/assets/src/components/URLShortLinkButton.jsx
index 223852477..aa9ae96ef 100644
--- a/superset/assets/src/explore/components/URLShortLinkButton.jsx
+++ b/superset/assets/src/components/URLShortLinkButton.jsx
@@ -1,13 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Popover, OverlayTrigger } from 'react-bootstrap';
-import CopyToClipboard from './../../components/CopyToClipboard';
-import { getShortUrl } from '../../utils/common';
-import { getExploreLongUrl } from '../exploreUtils';
-import { t } from '../../locales';
+import CopyToClipboard from './CopyToClipboard';
+import { getShortUrl } from '../utils/common';
+import { t } from '../locales';
const propTypes = {
- latestQueryFormData: PropTypes.object.isRequired,
+ url: PropTypes.string,
+ emailSubject: PropTypes.string,
+ emailContent: PropTypes.string,
};
export default class URLShortLinkButton extends React.Component {
@@ -25,12 +26,11 @@ export default class URLShortLinkButton extends React.Component {
}
getCopyUrl() {
- const longUrl = getExploreLongUrl(this.props.latestQueryFormData);
- getShortUrl(longUrl, this.onShortUrlSuccess.bind(this));
+ getShortUrl(this.props.url, this.onShortUrlSuccess.bind(this));
}
renderPopover() {
- const emailBody = t('Check out this chart: %s', this.state.shortUrl);
+ const emailBody = t('%s%s', this.props.emailContent, this.state.shortUrl);
return (