You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2019/01/24 03:40:39 UTC
[incubator-superset] branch omnibar updated: added cmd + K trigger
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch omnibar
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/omnibar by this push:
new 5a39439 added cmd + K trigger
5a39439 is described below
commit 5a39439229af5c160335222a5b81d1b5a0507627
Author: hughhhh <hm...@lyft.com>
AuthorDate: Wed Jan 23 19:40:23 2019 -0800
added cmd + K trigger
---
superset/assets/src/dashboard/components/Dashboard.jsx | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/superset/assets/src/dashboard/components/Dashboard.jsx b/superset/assets/src/dashboard/components/Dashboard.jsx
index 6915c8f..a30b5f4 100644
--- a/superset/assets/src/dashboard/components/Dashboard.jsx
+++ b/superset/assets/src/dashboard/components/Dashboard.jsx
@@ -87,6 +87,10 @@ class Dashboard extends React.PureComponent {
constructor(props) {
super(props);
+ this.state = {
+ showOmni: false,
+ }
+
this.isFirstLoad = true;
this.actionLog = new ActionLog({
impressionId: props.impressionId,
@@ -109,11 +113,17 @@ class Dashboard extends React.PureComponent {
document.removeEventListener('keydown', this.handleKeydown);
}
- handleKeydown() {
- console.log('presing some key....')
+ handleKeydown(event) {
+ console.log('presing some key....');
+ const controlOrCommand = event.ctrlKey || event.metaKey;
+ if (controlOrCommand) {
+ const isK = event.key === 'k' || event.keyCode === 83;
+ if (isK) {
+ this.setState({ showOmni: !this.state.showOmni })
+ }
+ }
}
-
componentWillReceiveProps(nextProps) {
if (!nextProps.dashboardState.editMode) {
// log pane loads
@@ -248,7 +258,7 @@ class Dashboard extends React.PureComponent {
render() {
return (
<div>
- <Modal show>
+ <Modal show={this.state.showOmni}>
<OmniContianer />
</Modal>
<DashboardBuilder />