[fix] minor fix for Superset logger (#6922)

This commit is contained in:
Grace Guo 2019-02-20 15:38:45 -08:00 committed by GitHub
parent ba9523c7c4
commit 16f4721a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 22 deletions

View File

@ -24,14 +24,11 @@ import { SupersetClient } from '@superset-ui/connection';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import Omnibar from 'omnibar';
import {
Logger,
ActionLog,
LOG_ACTIONS_OMNIBAR_TRIGGERED,
} from '../logger/LogUtils';
const propTypes = {
impressionId: PropTypes.string.isRequired,
dashboardId: PropTypes.number.isRequired,
logEvent: PropTypes.func.isRequired,
};
const getDashboards = query =>
@ -71,20 +68,15 @@ class OmniContainer extends React.Component {
if (controlOrCommand && isFeatureEnabled(FeatureFlag.OMNIBAR)) {
const isK = event.key === 'k' || event.keyCode === 83;
if (isK) {
this.props.logEvent(LOG_ACTIONS_OMNIBAR_TRIGGERED, {
show_omni: !this.state.showOmni,
});
this.setState({ showOmni: !this.state.showOmni });
document
.getElementsByClassName('Omnibar')[0]
.focus();
Logger.send(
new ActionLog({
impressionId: this.props.impressionId, // impo
source: 'dashboard',
sourceId: this.props.dashboardId, // sourceId: this.props.dashboardId
eventNames: LOG_ACTIONS_OMNIBAR_TRIGGERED,
}),
);
}
}
}

View File

@ -167,14 +167,9 @@ class Dashboard extends React.PureComponent {
}
render() {
const {
impressionId,
dashboardInfo: { id },
} = this.props;
return (
<React.Fragment>
<OmniContainer impressionId={impressionId} dashboardId={id} />
<OmniContainer logEvent={this.props.actions.logEvent} />
<DashboardBuilder />
</React.Fragment>
);

View File

@ -171,10 +171,10 @@ class Header extends React.PureComponent {
}
toggleEditMode() {
this.props.setEditMode(!this.props.editMode);
this.props.logEvent(LOG_ACTIONS_TOGGLE_EDIT_DASHBOARD, {
editMode: !this.props.editMode,
edit_mode: !this.props.editMode,
});
this.props.setEditMode(!this.props.editMode);
}
overwriteDashboard() {

View File

@ -109,7 +109,7 @@ class Tabs extends React.PureComponent {
});
} else if (tabIndex !== this.state.tabIndex) {
this.props.logEvent(LOG_ACTIONS_SELECT_DASHBOARD_TAB, {
id: component.id,
tab_id: component.id,
index: tabIndex,
});