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 04e12163ec2bfee8f7ca272bcffdb67ab9070edb Author: hughhhh <[email protected]> AuthorDate: Mon Nov 9 18:37:20 2020 -0800 setup savemodal for components --- .../src/SqlLab/components/SaveDatasetModal.tsx | 43 +++++++++++++++++++++- .../components/controls/preset.code-workspace | 10 +++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx index b7bd1d3..7085991 100644 --- a/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx +++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal.tsx @@ -17,14 +17,53 @@ * under the License. */ -import React, { FunctionComponent } from 'react'; +import React, { useState } from 'react'; +import { Radio, AutoComplete, Input } from 'src/common/components'; import Modal from 'src/common/components/Modal'; +const mockVal = (str, repeat = 1) => { + return { + value: str.repeat(repeat), + }; +}; + // eslint-disable-next-line no-empty-pattern export const SaveDatasetModal = ({}) => { + const [value, setValue] = useState(''); + const [options, setOptions] = useState([]); + + const onSearch = (searchText) => { + setOptions( + !searchText ? [] : [mockVal(searchText), mockVal(searchText, 2), mockVal(searchText, 3)], + ); + }; + + const onSelect = (data) => { + console.log('onSelect', data); + }; + + const onChange = (data) => { + setValue(data); + }; + return ( <Modal show onHide={() => {}} title="Save a new dataset"> - <div>To explore the results of this query, we need to save it as a virtual dataset</div> + <div> + To explore the results of this query, we need to save it as a virtual dataset + <Radio>Save as new dataset</Radio> + <Input style={{ width: 200 }} defaultValue="my_new_dataset_A" /> + <br/> + <Radio>Overwrite existing dataset</Radio> + <AutoComplete + options={options} + style={{ + width: 200, + }} + onSelect={onSelect} + onSearch={onSearch} + placeholder="input here" + /> + </div> </Modal> ); }; diff --git a/superset-frontend/src/explore/components/controls/preset.code-workspace b/superset-frontend/src/explore/components/controls/preset.code-workspace new file mode 100644 index 0000000..419b3b4 --- /dev/null +++ b/superset-frontend/src/explore/components/controls/preset.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "../../../../.." + }, + { + "path": "../../../../../../superset-shell" + } + ] +}
