dosubot[bot] commented on issue #29775:
URL: https://github.com/apache/superset/issues/29775#issuecomment-2271399412
<!-- Answer -->
1. **Including All Plots in Email**:
To include all plots from a dashboard in an email, you need to modify the
`shareByEmail` function to ensure it captures all the plots. Here's an example
of how you might do this:
```jsx
const shareByEmail = useCallback(async () => {
try {
const subject = t('Superset Dashboard');
const chartPermalinks = await Promise.all(
dashboards.map(async (dashboard) => {
const url = await
getChartPermalink(dashboard.latestQueryFormData);
return `${dashboard.slice_name}: ${url}`;
})
);
const body = encodeURIComponent(t('Check out these charts:\n\n%s',
chartPermalinks.join('\n')));
window.location.href = `mailto:?Subject=${subject}&Body=${body}`;
} catch (error) {
addDangerToast(t('Sorry, something went wrong. Try again later.'));
}
}, [addDangerToast, dashboards]);
```
2. **Controlling Width and Height of Table Chart Cells**:
You can customize the width of columns in Table charts using the
`columnWidth` property and the `column_config` control. However, there is no
direct mention of customizing the height of individual cells, but the overall
table height can be managed using the `height` property.
```tsx
{config.columnWidth ? (
<div
style={{
width: columnWidth,
height: 0.01,
}}
/>
) : null}
```
```tsx
{
name: 'column_config',
config: {
type: 'ColumnConfigControl',
label: t('Customize columns'),
description: t('Further customize how to display each column'),
width: 400,
height: 320,
renderTrigger: true,
shouldMapStateToProps() {
return true;
},
mapStateToProps(explore, _, chart) {
return {
queryResponse: chart?.queriesResponse?.[0] as
| ChartDataResponseResult
| undefined,
};
},
},
}
```
3. **Sharing Selected Plots via Email**:
Superset currently does not support sharing multiple selected plots as a
single email attachment directly. You might need to manually create a custom
email template that includes the selected plots.
4. **Sharing Dashboards as Text via Email**:
Superset allows for text-based sharing through the `context_markdown`
field in report schedules. You can use this field to include text-based content
in your email reports. Here is an example:
```py
@pytest.fixture()
def create_report_email_chart_with_text():
chart = db.session.query(Slice).first()
chart.query_context = '{"mock": "query_context"}'
report_schedule = create_report_notification(
email_target="[email protected]",
chart=chart,
report_format=ReportDataFormat.TEXT,
)
yield report_schedule
cleanup_report_schedule(report_schedule)
```
These solutions should help you address the issues you're facing with
Superset 4.0.2.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]