You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2020/11/16 18:49:11 UTC

[incubator-superset] 02/02: saving spot for callback on text input

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch hugh/SO-1117-modal
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 74348a1d707da48ce299f23c41a9eaef8958a87c
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Nov 16 10:48:19 2020 -0800

    saving spot for callback on text input
---
 superset-frontend/src/SqlLab/components/ResultSet.tsx        | 10 +++++++---
 superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx |  4 ++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/ResultSet.tsx b/superset-frontend/src/SqlLab/components/ResultSet.tsx
index caed1d9..c8cf1f2 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet.tsx
@@ -88,7 +88,8 @@ export default class ResultSet extends React.PureComponent<
       searchText: '',
       showExploreResultsButton: false,
       data: [],
-      showSaveDatasetModal: false
+      showSaveDatasetModal: false,
+      newSaveDatasetName: '',
     };
 
     this.changeSearch = this.changeSearch.bind(this);
@@ -203,6 +204,10 @@ export default class ResultSet extends React.PureComponent<
       });
   }
 
+  handleDatasetNameChange(e) {
+    console.log(e.target.value)
+  }
+
   handleHideSaveModal() {
     console.log('hiding the modal');
     this.setState({showSaveDatasetModal: false})
@@ -222,8 +227,7 @@ export default class ResultSet extends React.PureComponent<
             visible={showSaveDatasetModal}
             onOk={this.handleSaveInDataset}
             onCancel={this.handleHideSaveModal}
-            query={this.props.query}
-            createDatasource={this.props.actions.createDatasource}
+            handleDatasetNameChange={this.handleDatasetNameChange}
           />
           <div className="ResultSetButtons">
             {this.props.visualize &&
diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx
index e052e25..c0dccc6 100644
--- a/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx
+++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx
@@ -32,7 +32,7 @@ interface SaveDatasetModalProps = {
 }
 
 // eslint-disable-next-line no-empty-pattern
-export const SaveDatasetModal: FunctionComponent<> = ({visible, onOk, onCancel}) => {
+export const SaveDatasetModal: FunctionComponent<> = ({visible, onOk, onCancel, handleDatasetNameChange}) => {
   const [value, setValue] = useState('');
   const [options, setOptions] = useState([]);
   const [radioOption, setRadioOptions] = useState(1);
@@ -87,7 +87,7 @@ export const SaveDatasetModal: FunctionComponent<> = ({visible, onOk, onCancel})
         <Radio.Group onChange={onRadioChange} value={radioOption}>
           <Radio style={radioStyle} value={1}>
             Save as new dataset
-            <Input style={{ width: 200 }} defaultValue="my_new_dataset_A" />
+            <Input style={{ width: 200 }} defaultValue="my_new_dataset_A" onChange={handleDatasetNameChange} />
           </Radio>
           <Radio style={radioStyle} value={2}>
             Overwrite existing dataset