[GitHub] hughhhh commented on a change in pull request #4680: Hotkeys in SQL Lab

2018-03-26 Thread GitBox
hug commented on a change in pull request #4680: Hotkeys in SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/4680#discussion_r177208754
 
 

 ##
 File path: superset/assets/javascripts/SqlLab/components/SqlEditor.jsx
 ##
 @@ -226,6 +229,32 @@ class SqlEditor extends React.PureComponent {
   render() {
 const height = this.sqlEditorHeight();
 const defaultNorthHeight = this.props.queryEditor.height || 200;
+const SQLLAB_HOTKEYS = [
 
 Review comment:
   Ahhh true, the `func` param, i just don't like the bulky render view, but if 
there isn't a way to clean it up we can just go with it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] hughhhh commented on a change in pull request #4680: Hotkeys in SQL Lab

2018-03-26 Thread GitBox
hug commented on a change in pull request #4680: Hotkeys in SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/4680#discussion_r177161126
 
 

 ##
 File path: superset/assets/javascripts/components/Hotkeys.jsx
 ##
 @@ -0,0 +1,53 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { OverlayTrigger, Popover } from 'react-bootstrap';
+import { Table } from 'reactable';
+
+import Mousetrap from 'mousetrap';
+
+const propTypes = {
+  hotkeys: PropTypes.arrayOf(PropTypes.shape({
+key: PropTypes.string.isRequired,
+descr: PropTypes.string.isRequired,
+func: PropTypes.func.isRequired,
+  })).isRequired,
+  header: PropTypes.string,
+};
+
+const defaultProps = {
+  hotkeys: [],
+};
+
+export default class Hotkeys extends React.PureComponent {
+  componentDidMount() {
+this.props.hotkeys.forEach((keyConfig) => {
+  Mousetrap.bind([keyConfig.key], keyConfig.func);
+});
+  }
+  renderPopover() {
+return (
+  
+ ({
 
 Review comment:
   Nice


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] hughhhh commented on a change in pull request #4680: Hotkeys in SQL Lab

2018-03-26 Thread GitBox
hug commented on a change in pull request #4680: Hotkeys in SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/4680#discussion_r177160837
 
 

 ##
 File path: superset/assets/javascripts/SqlLab/actions.js
 ##
 @@ -196,7 +196,10 @@ export function setDatabases(databases) {
 }
 
 export function addQueryEditor(queryEditor) {
-  const newQe = Object.assign({}, queryEditor, { id: shortid.generate() });
+  const newQe = {
 
 Review comment:
   nit: `neQe >> newQuery`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] hughhhh commented on a change in pull request #4680: Hotkeys in SQL Lab

2018-03-26 Thread GitBox
hug commented on a change in pull request #4680: Hotkeys in SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/4680#discussion_r177160837
 
 

 ##
 File path: superset/assets/javascripts/SqlLab/actions.js
 ##
 @@ -196,7 +196,10 @@ export function setDatabases(databases) {
 }
 
 export function addQueryEditor(queryEditor) {
-  const newQe = Object.assign({}, queryEditor, { id: shortid.generate() });
+  const newQe = {
 
 Review comment:
   nit: neQe >> newQuery


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] hughhhh commented on a change in pull request #4680: Hotkeys in SQL Lab

2018-03-26 Thread GitBox
hug commented on a change in pull request #4680: Hotkeys in SQL Lab
URL: 
https://github.com/apache/incubator-superset/pull/4680#discussion_r177160625
 
 

 ##
 File path: superset/assets/javascripts/SqlLab/components/SqlEditor.jsx
 ##
 @@ -226,6 +229,32 @@ class SqlEditor extends React.PureComponent {
   render() {
 const height = this.sqlEditorHeight();
 const defaultNorthHeight = this.props.queryEditor.height || 200;
+const SQLLAB_HOTKEYS = [
 
 Review comment:
   nit: Can we put this at the top of the file or even in config file for 
adding new hotkeys more easily. I'm like the idea of a having this separate and 
we import it


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services