Add email-to option in action buttons for dashboard and slice (#1705)

* Add email-to option in explore action buttons

* email to option for dashboard
This commit is contained in:
vera-liu
2016-12-14 11:52:53 -08:00
committed by GitHub
parent e1e20b8757
commit fa9c066ffe
2 changed files with 13 additions and 0 deletions

View File

@@ -44,6 +44,9 @@ class Controls extends React.PureComponent {
render() { render() {
const dashboard = this.props.dashboard; const dashboard = this.props.dashboard;
const canSave = dashboard.context.dash_save_perm; const canSave = dashboard.context.dash_save_perm;
const emailBody = `Checkout this dashboard: ${window.location.href}`;
const emailLink = 'mailto:?Subject=Superset%20Dashboard%20'
+ `${dashboard.dashboard_title}&Body=${emailBody}`;
return ( return (
<ButtonGroup> <ButtonGroup>
<Button <Button
@@ -93,6 +96,11 @@ class Controls extends React.PureComponent {
<i className="fa fa-save" /> <i className="fa fa-save" />
} }
/> />
<Button
onClick={() => { window.location = emailLink; }}
>
<i className="fa fa-envelope"></i>
</Button>
</ButtonGroup> </ButtonGroup>
); );
} }

View File

@@ -27,12 +27,17 @@ export default class URLShortLinkButton extends React.Component {
} }
renderPopover() { renderPopover() {
const emailBody = `Check out this slice: ${this.state.shortUrl}`;
return ( return (
<Popover id="shorturl-popover"> <Popover id="shorturl-popover">
<CopyToClipboard <CopyToClipboard
text={this.state.shortUrl} text={this.state.shortUrl}
copyNode={<i className="fa fa-clipboard" title="Copy to clipboard"></i>} copyNode={<i className="fa fa-clipboard" title="Copy to clipboard"></i>}
/> />
&nbsp;&nbsp;
<a href={`mailto:?Subject=Superset%20Slice%20&Body=${emailBody}`}>
<i className="fa fa-envelope"></i>
</a>
</Popover> </Popover>
); );
} }