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_r391791542
##########
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:
if the sql sting was required before, we probably don't need a default here
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]