superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [incubator-superset] branch omnibar updated: 🚢
Date Thu, 31 Jan 2019 23:23:07 GMT
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 dad13db  🚢
dad13db is described below

commit dad13db53a4930044503da290c6f218411648755
Author: hughhhh <hmiles@lyft.com>
AuthorDate: Thu Jan 31 15:22:55 2019 -0800

    🚢
---
 superset/assets/src/components/OmniContainer.jsx   |  8 +++---
 .../assets/src/dashboard/components/Dashboard.jsx  | 32 ----------------------
 2 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/superset/assets/src/components/OmniContainer.jsx b/superset/assets/src/components/OmniContainer.jsx
index 0554ad9..a00d71c 100644
--- a/superset/assets/src/components/OmniContainer.jsx
+++ b/superset/assets/src/components/OmniContainer.jsx
@@ -55,6 +55,7 @@ class OmniContainer extends React.Component {
       showOmni: false,
     };
     this.handleKeydown = this.handleKeydown.bind(this);
+    this.omniBar = React.createRef();
   }
 
   componentDidMount() {
@@ -74,8 +75,7 @@ class OmniContainer extends React.Component {
 
         // Get first input in the modal div
         document
-          .getElementsByClassName('modal-dialog')[0]
-          .getElementsByTagName('input')[0]
+          .getElementsByClassName('Omnibar')[0]
           .focus();
 
         Logger.send(
@@ -92,8 +92,8 @@ class OmniContainer extends React.Component {
 
   render() {
       return (
-        <Modal show={this.state.showOmni} ref={this.exampleRef}>
-          <Omnibar placeholder="Search for dashboards.." extensions={[getDashboards]}
/>
+        <Modal show={this.state.showOmni} >
+          <Omnibar className="Omnibar" placeholder="Search for dashboards.." extensions={[getDashboards]}
ref={this.omniBar} />
         </Modal>
       );
   }
diff --git a/superset/assets/src/dashboard/components/Dashboard.jsx b/superset/assets/src/dashboard/components/Dashboard.jsx
index 57cc661..6f28f6d 100644
--- a/superset/assets/src/dashboard/components/Dashboard.jsx
+++ b/superset/assets/src/dashboard/components/Dashboard.jsx
@@ -96,13 +96,10 @@ class Dashboard extends React.PureComponent {
     });
     Logger.start(this.actionLog);
     this.initTs = new Date().getTime();
-
-    this.handleKeydown = this.handleKeydown.bind(this);
   }
 
   componentDidMount() {
     Logger.append(LOG_ACTIONS_MOUNT_DASHBOARD);
-    document.addEventListener('keydown', this.handleKeydown);
   }
 
   componentWillReceiveProps(nextProps) {
@@ -208,40 +205,11 @@ class Dashboard extends React.PureComponent {
     }
   }
 
-  componentWillUnmount() {
-    document.removeEventListener('keydown', this.handleKeydown);
-  }
-
   // return charts in array
   getAllCharts() {
     return Object.values(this.props.charts);
   }
 
-  handleKeydown(event) {
-    const controlOrCommand = event.ctrlKey || event.metaKey;
-    if (controlOrCommand) {
-      const isK = event.key === 'k' || event.keyCode === 83;
-      if (isK) {
-        this.setState({ showOmni: !this.state.showOmni });
-
-        // Get first input in the modal div
-        document
-          .getElementsByClassName('modal-dialog')[0]
-          .getElementsByTagName('input')[0]
-          .focus();
-
-        Logger.send(
-          new ActionLog({
-            impressionId: this.props.impressionId,
-            source: 'dashboard',
-            sourceId: this.props.dashboardInfo.id,
-            eventNames: LOG_ACTIONS_OMNIBAR_TRIGGERED,
-          }),
-        );
-      }
-    }
-  }
-
   refreshExcept(filterKey) {
     const immune = this.props.dashboardInfo.metadata.filter_immune_slices || [];
 


Mime
View raw message