You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/03/12 17:54:41 UTC

[GitHub] [incubator-superset] etr2460 commented on a change in pull request #9291: [SIP-36] Migrate RunQueryActionButton.jsx to RunQueryActionButton.tsx…

etr2460 commented on a change in pull request #9291: [SIP-36] Migrate RunQueryActionButton.jsx to RunQueryActionButton.tsx…
URL: https://github.com/apache/incubator-superset/pull/9291#discussion_r391793747
 
 

 ##########
 File path: superset-frontend/src/SqlLab/components/RunQueryActionButton.tsx
 ##########
 @@ -17,53 +17,57 @@
  * under the License.
  */
 import React from 'react';
-import PropTypes from 'prop-types';
 import { t } from '@superset-ui/translation';
 
 import Button from '../../components/Button';
 
-const propTypes = {
-  allowAsync: PropTypes.bool.isRequired,
-  dbId: PropTypes.number,
-  queryState: PropTypes.string,
-  runQuery: PropTypes.func.isRequired,
-  selectedText: PropTypes.string,
-  stopQuery: PropTypes.func.isRequired,
-  sql: PropTypes.string.isRequired,
-};
-const defaultProps = {
-  allowAsync: false,
-  sql: '',
-};
+interface Props {
+  allowAsync: boolean;
+  dbId: number | null;
+  queryState: string;
+  runQuery: (c?: boolean) => void;
+  selectedText: string;
+  stopQuery: () => void;
+  sql: string;
+}
 
-export default function RunQueryActionButton(props) {
-  const runBtnText = props.selectedText
-    ? t('Run Selected Query')
-    : t('Run Query');
-  const btnStyle = props.selectedText ? 'warning' : 'primary';
-  const shouldShowStopBtn =
-    ['running', 'pending'].indexOf(props.queryState) > -1;
+const RunQueryActionButton = ({
+  allowAsync = false,
+  dbId = null,
+  queryState = '',
+  runQuery = () => {
+    // Do nothing
+  },
+  selectedText = '',
+  stopQuery = () => {
+    // Do nothing
+  },
+  sql = '',
 
 Review comment:
   Remove the appropriate defaults re the `Props` comments above

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org