You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2017/11/07 14:57:14 UTC

[GitHub] fabianmenges commented on a change in pull request #3771: DECKGL integration - Phase 1

fabianmenges commented on a change in pull request #3771: DECKGL integration - Phase 1
URL: https://github.com/apache/incubator-superset/pull/3771#discussion_r149383230
 
 

 ##########
 File path: superset/assets/javascripts/explore/components/controls/FixedOrMetricControl.jsx
 ##########
 @@ -0,0 +1,118 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Label, Popover, OverlayTrigger } from 'react-bootstrap';
+
+import controls from '../../stores/controls';
+import TextControl from './TextControl';
+import SelectControl from './SelectControl';
+import ControlHeader from '../ControlHeader';
+import PopoverSection from '../../../components/PopoverSection';
+
+const propTypes = {
+  onChange: PropTypes.func,
+  value: PropTypes.object,
+  isFloat: PropTypes.bool,
+  datasource: PropTypes.object,
+  default: PropTypes.object,
+};
+
+const defaultProps = {
+  onChange: () => {},
+  default: { type: 'fix', value: 5 },
+};
+
+export default class FixedOrMetricControl extends React.Component {
+  constructor(props) {
+    super(props);
+    this.onChange = this.onChange.bind(this);
+    const type = props.value ? props.value.type : props.default.type || 'fix';
 
 Review comment:
   I think adding parenthesis will make this line easier to read:
   ```
   const type = props.value ? props.value.type : (props.default.type || 'fix');
   vs
   const type = (props.value ? props.value.type : props.default.type) || 'fix';
   ```
   I always get confused about the order of operations in these cases, but maybe thats just me.
   another option is to pull out `if (props.value)`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services