Skip to content

Commit

Permalink
Export query implemented and functional in actions bar
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndsiWilliams committed Apr 1, 2021
1 parent d28f86b commit 9cb76c9
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
createFetchRelated,
createFetchDistinct,
createErrorHandler,
handleBulkDashboardExport,
} from 'src/views/CRUD/utils';
import Popover from 'src/components/Popover';
import withToasts from 'src/messageToasts/enhancers/withToasts';
Expand Down Expand Up @@ -97,6 +98,7 @@ function SavedQueryList({

const canEdit = hasPerm('can_write');
const canDelete = hasPerm('can_write');
const canExport = hasPerm('can_read');

const openNewQuery = () => {
window.open(`${window.location.origin}/superset/sqllab?new=true`);
Expand Down Expand Up @@ -300,12 +302,9 @@ function SavedQueryList({
const handlePreview = () => {
handleSavedQueryPreview(original.id);
};
const handleEdit = () => {
openInSqlLab(original.id);
};
const handleCopy = () => {
copyQueryLink(original.id);
};
const handleEdit = () => openInSqlLab(original.id);
const handleCopy = () => copyQueryLink(original.id);
const handleExport = () => handleBulkDashboardExport([original]);
const handleDelete = () => setQueryCurrentlyDeleting(original);

const actions = [
Expand All @@ -332,6 +331,15 @@ function SavedQueryList({
icon: 'Copy',
onClick: handleCopy,
},
canExport
? {
label: 'export-action',
tooltip: t('Export query'),
placement: 'bottom',
icon: 'Share',
onClick: handleExport,
}
: null,
canDelete
? {
label: 'delete-action',
Expand All @@ -350,7 +358,7 @@ function SavedQueryList({
disableSortBy: true,
},
],
[canDelete, canEdit, copyQueryLink, handleSavedQueryPreview],
[canDelete, canEdit, canExport, copyQueryLink, handleSavedQueryPreview],
);

const filters: Filters = useMemo(
Expand Down

0 comments on commit 9cb76c9

Please sign in to comment.