justinpark commented on code in PR #26391:
URL: https://github.com/apache/superset/pull/26391#discussion_r1721737106
##########
superset-frontend/src/SqlLab/components/ResultSet/index.tsx:
##########
@@ -310,12 +320,50 @@ const ResultSet = ({
schema: query?.schema,
};
- const canExportData = findPermission(
+ const canExportCsv = findPermission(
'can_export_csv',
- 'SQLLab',
+ 'SqlLab',
+ user?.roles,
+ );
+ const canExportGoogleSheets = findPermission(
+ 'can_export_google_sheets',
+ 'SqlLab',
user?.roles,
);
+ // Antd >= 4.24.0 format:
+ const exportMenuItems = [];
+ if (canExportCsv) {
+ exportMenuItems.push({
+ label: t('CSV'),
+ key: 'csv',
+ icon: <Icons.FileOutlined />,
+ onClick: () => {
+ logAction(LOG_ACTIONS_SQLLAB_DOWNLOAD_CSV, {});
+ window.open(getExportCsvUrl(query.id), '_blank')?.focus();
+ },
+ });
+ }
+ if (isFeatureEnabled(FeatureFlag.GoogleSheetsExport) &&
canExportGoogleSheets) {
+ exportMenuItems.push({
+ label: t('Google Sheets'),
+ key: 'google-sheets',
+ icon: <Icons.GoogleOutlined />,
+ onClick: () =>
+ window.open(getExportGoogleSheetsUrl(query.id), '_blank')?.focus(),
Review Comment:
I hope to add the action logging like the above export csv.
```
```
```suggestion
logAction(LOG_ACTIONS_SQLLAB_DOWNLOAD_GSHEET, {});
window.open(getExportGoogleSheetsUrl(query.id),
'_blank')?.focus(),
```
--
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]