mirror of
https://github.com/apache/superset.git
synced 2026-07-27 00:52:33 +00:00
chore(sqllab): Add logging for actions (#28876)
This commit is contained in:
@@ -71,6 +71,12 @@ import {
|
||||
reRunQuery,
|
||||
} from 'src/SqlLab/actions/sqlLab';
|
||||
import { URL_PARAMS } from 'src/constants';
|
||||
import useLogAction from 'src/logger/useLogAction';
|
||||
import {
|
||||
LOG_ACTIONS_SQLLAB_COPY_RESULT_TO_CLIPBOARD,
|
||||
LOG_ACTIONS_SQLLAB_CREATE_CHART,
|
||||
LOG_ACTIONS_SQLLAB_DOWNLOAD_CSV,
|
||||
} from 'src/logger/LogUtils';
|
||||
import Icons from 'src/components/Icons';
|
||||
import ExploreCtasResultsButton from '../ExploreCtasResultsButton';
|
||||
import ExploreResultsButton from '../ExploreResultsButton';
|
||||
@@ -171,6 +177,7 @@ const ResultSet = ({
|
||||
'dbId',
|
||||
'tab',
|
||||
'sql',
|
||||
'sqlEditorId',
|
||||
'templateParams',
|
||||
'schema',
|
||||
'rows',
|
||||
@@ -201,6 +208,7 @@ const ResultSet = ({
|
||||
|
||||
const history = useHistory();
|
||||
const dispatch = useDispatch();
|
||||
const logAction = useLogAction({ queryId, sqlEditorId: query.sqlEditorId });
|
||||
|
||||
const reRunQueryIfSessionTimeoutErrorOnMount = useCallback(() => {
|
||||
if (
|
||||
@@ -258,7 +266,7 @@ const ResultSet = ({
|
||||
const { results } = query;
|
||||
|
||||
const openInNewWindow = clickEvent.metaKey;
|
||||
|
||||
logAction(LOG_ACTIONS_SQLLAB_CREATE_CHART, {});
|
||||
if (results?.query_id) {
|
||||
const key = await postFormData(results.query_id, 'query', {
|
||||
...EXPLORE_CHART_DEFAULT,
|
||||
@@ -321,7 +329,11 @@ const ResultSet = ({
|
||||
/>
|
||||
)}
|
||||
{csv && (
|
||||
<Button buttonSize="small" href={getExportCsvUrl(query.id)}>
|
||||
<Button
|
||||
buttonSize="small"
|
||||
href={getExportCsvUrl(query.id)}
|
||||
onClick={() => logAction(LOG_ACTIONS_SQLLAB_DOWNLOAD_CSV, {})}
|
||||
>
|
||||
<i className="fa fa-file-text-o" /> {t('Download to CSV')}
|
||||
</Button>
|
||||
)}
|
||||
@@ -335,6 +347,9 @@ const ResultSet = ({
|
||||
</Button>
|
||||
}
|
||||
hideTooltip
|
||||
onCopyEnd={() =>
|
||||
logAction(LOG_ACTIONS_SQLLAB_COPY_RESULT_TO_CLIPBOARD, {})
|
||||
}
|
||||
/>
|
||||
</ResultSetButtons>
|
||||
{search && (
|
||||
|
||||
Reference in New Issue
Block a user