This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 14647fc Minor improvements to <Hotkeys /> component (#7261)
14647fc is described below
commit 14647fc2ed456052552eb96466f9ebde50d1642d
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Thu Apr 11 23:08:38 2019 -0700
Minor improvements to <Hotkeys /> component (#7261)
* left align, close to button it's related to
* text-muted, so it's a bit more subtle
* fix required func props, where no func it actually passed
---
superset/assets/src/components/Hotkeys.jsx | 6 ++++--
.../src/explore/components/ExploreViewContainer.jsx | 20 +++++++-------------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/superset/assets/src/components/Hotkeys.jsx
b/superset/assets/src/components/Hotkeys.jsx
index 36e7d57..0d45524 100644
--- a/superset/assets/src/components/Hotkeys.jsx
+++ b/superset/assets/src/components/Hotkeys.jsx
@@ -25,7 +25,7 @@ const propTypes = {
hotkeys: PropTypes.arrayOf(PropTypes.shape({
key: PropTypes.string.isRequired,
descr: PropTypes.string.isRequired,
- func: PropTypes.func.isRequired,
+ func: PropTypes.func,
})).isRequired,
header: PropTypes.string,
placement: PropTypes.string,
@@ -38,7 +38,9 @@ const defaultProps = {
export default class Hotkeys extends React.PureComponent {
componentDidMount() {
this.props.hotkeys.forEach((keyConfig) => {
- Mousetrap.bind([keyConfig.key], keyConfig.func);
+ if (keyConfig.func) {
+ Mousetrap.bind([keyConfig.key], keyConfig.func);
+ }
});
}
renderPopover() {
diff --git a/superset/assets/src/explore/components/ExploreViewContainer.jsx
b/superset/assets/src/explore/components/ExploreViewContainer.jsx
index 9ef7e9e..1f11582 100644
--- a/superset/assets/src/explore/components/ExploreViewContainer.jsx
+++ b/superset/assets/src/explore/components/ExploreViewContainer.jsx
@@ -47,17 +47,11 @@ const keymap = {
SAVE: 'ctrl + s',
};
-const getHotKeys = () => {
- const d = [];
- Object.keys(keymap).forEach((k) => {
- d.push({
- name: k,
- descr: keymap[k],
- key: k,
- });
- });
- return d;
-};
+const getHotKeys = () => Object.keys(keymap).map(k => ({
+ name: k,
+ descr: keymap[k],
+ key: k,
+}));
const propTypes = {
actions: PropTypes.object.isRequired,
@@ -321,7 +315,7 @@ class ExploreViewContainer extends React.Component {
)}
<div className="row">
<div className="col-sm-4">
- <div style={{ display: 'flex', flexDirection: 'row', alignItems:
'center', justifyContent: 'space-between' }}>
+ <div style={{ display: 'flex', flexDirection: 'row', alignItems:
'center' }}>
<QueryAndSaveBtns
canAdd="True"
onQuery={this.onQuery}
@@ -332,7 +326,7 @@ class ExploreViewContainer extends React.Component {
errorMessage={this.renderErrorMessage()}
datasourceType={this.props.datasource_type}
/>
- <div>
+ <div className="m-l-5 text-muted">
<Hotkeys
header="Keyboard shortcuts"
hotkeys={getHotKeys()}