-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Sqllab to Explore UX improvements #11755
Conversation
…tor-superset into hugh/SO-1117-modal
} | ||
|
||
componentDidMount() { | ||
// only do this the first time the component is rendered/mounted | ||
this.reRunQueryIfSessionTimeoutErrorOnMount(); | ||
|
||
// Todo: figure out how to get user information to properly query datasets they own |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you query the API on /api/v1/dataset/
it should return only datasets owned by the user (cc: @dpgaspar).
}), | ||
); | ||
|
||
this.setState({ userDatasetsOwned }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this data loaded into redux when the app loads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database_ids is actually living in the bootstap-data, but is behind a featureFlag. @mistercrunch has a PR to fix
https://github.com/apache/incubator-superset/pull/11934/files
|
||
if ( | ||
Object.keys(datasetToOverwrite).length === 0 && | ||
datasetToOverwrite.constructor === Object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will Object.keys(datasetToOverwrite).length === 0
ever be true and datasetToOverwrite.constructor === Object
be false? Seems like if the former is true, then the constructor will always be an Object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch i actually figured out how to prevent this via onChangeAutocomplete. Users have to choose a value from the dropdown before progressing to the overwrite page. So we don't need this condition.
@@ -357,6 +658,7 @@ export default class ResultSet extends React.PureComponent< | |||
if (query.progress > 0) { | |||
progressBar = ( | |||
<ProgressBar | |||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you running into issues where a value is missing on these types/interfaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea wasn't able to figure out what the issue is
} = this.state; | ||
const disableSaveAndExploreBtn = | ||
(saveDatasetRadioBtnState === 1 && newSaveDatasetName.length === 0) || | ||
(saveDatasetRadioBtnState === 2 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to use the enum DatasetRadioState
here?
Hi @hughhhh Thanks for making this PR. I have a question: Is there any permission check when one user overwriting an existed dataset? If not, i feel it is a very dangerous feature. It looks like anyone can overwrite my chart without my acknowledge, even they are not owner. |
this.setState({ datasetToOverwrite: {} }); | ||
}; | ||
|
||
handleOverwriteDataset = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async/await
usually used as a pair, to avoid nested callback hells
. Could you please replace .then
block with await?
…into hugh/SO-1117-modal
On the dataset.update we check for the ownership on every request. I'm also only exposing datasets the user owns via |
It's good that users only see dataset list from they |
> | ||
Ok | ||
Save & Explore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n needed
'MM/DD/YYYY HH:mm:ss', | ||
)}`, | ||
userDatasetsOwned: [], | ||
saveDatasetRadioBtnState: DatasetRadioState.SAVE_NEW, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting too specific. I would just call it "shouldSaveAsNewDataset" or something aline. Imagine what if a future design changes the radio button to a dropdown select?
shouldOverwriteDataSet: false, | ||
datasetToOverwrite: {}, | ||
saveModalAutocompleteValue: '', | ||
userDatasetOptions: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel you may be passing too many states between components unnecessarily. Can these be combined into one construct as the modal's local states and only be passed up to the parent component when users hit "Save"?
shouldOverwriteDataSet: false, | ||
datasetToOverwrite: {}, | ||
newSaveDatasetName: `${this.props.query.tab} ${moment().format( | ||
'MM/DD/YYYY HH:mm:ss', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 i18n strategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"YYYY-MM-DD HH:mm:ss" It's a more common way for i18n.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on using YYYY-MM-DD HH:mm:ss
by default before we add proper internalization/localization support.
newSaveDatasetName: `${this.props.query.tab} ${moment().format( | ||
'MM/DD/YYYY HH:mm:ss', | ||
)}`, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's seem to be some repetitive code between Override and Save as New. Is there a chance for abstraction?
@graceguo-supercat So the only way for the users to overwrite a dataset is if they are in the owner list via |
…into hugh/SO-1117-modal
SUMMARY
Allow users the option to name their dataset or overwrite a previously created dataset they own. This a new flow to allow users to update datasets they currently own vs. only being able to create new ones.
Creating a new dataset
https://www.loom.com/share/52e624667090477f91db69addc42fccb
Overwriting a dataset
https://www.loom.com/share/4e77b441c4894dc69ccfb655804cc6ae
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION