-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[explore] Modal to edit chart properties #9051
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9051 +/- ##
==========================================
- Coverage 59.43% 59.15% -0.29%
==========================================
Files 369 370 +1
Lines 11743 11813 +70
Branches 2884 2899 +15
==========================================
+ Hits 6980 6988 +8
- Misses 4584 4646 +62
Partials 179 179
Continue to review full report at Codecov.
|
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.
Just one question, otherwise LGTM!
bsSize="sm" | ||
value={description} | ||
onChange={event => setDescription(event.target.value)} | ||
style={{ maxWidth: '100%' }} |
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.
Inline styles!? Not sure the exact issue this addresses, but we can probably just slap this on all FormControl components via the theme if needed, so it needn't be repeated in the future.
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.
Perhaps. If you think it's worth messing around with global styles for this specific thing I'll do it. Without that line, you can grab+drag the textarea out into the right column of the modal layout.
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.
Snark/nits inline, but LGTM! 👍
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.
Some comments, i don't think anything blocking, but would appreciate you taking a look!
} | ||
|
||
// values of form inputs | ||
const [name, setName] = useState(slice.slice_name || ''); |
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 there a reason we default to empty string here? Seems like null would make sense since that's what you're sending to the server, and then in the UI we can replace with an empty string if needed.
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 went with empty string since this is used for the state of the <input>
, and input values should not be null. Empty strings are converted to null when sending, to allow users to unset fields. It's cleaner this way IMO.
bsSize="sm" | ||
value={cacheTimeout} | ||
onChange={event => | ||
setCacheTimeout(event.target.value.replace(/[^0-9]/, '')) |
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 made the FormControl
's input type "number"
then you could get rid of this logic
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.
That's what I did at first, but I wasn't sure if we wanted to allow non-integers. Do you have any insight into whether that would be ok?
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 marshmallow schema on the endpoint wants an integer
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 suppose that when sending the request, you could do a parseInt
on the value to remove the decimal. Maybe that's sufficient then? At least we don't need to run the validator onChange then
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.
parseInt
can return NaN
for certain inputs. An input of type="number"
allows using "e" and decimal points. I'd prefer not to open the NaN
door, personally.
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.
We could use type="number
alongside the regex filter to get the extra little browser widgets that come with number inputs if you think that'd be valuable, but I think the regex does a job here that isn't offered by html.
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.
lgtm with one other naming nit. you can either add the number type for the text box or not, up to you
owners: owners.map(o => o.value), | ||
}; | ||
try { | ||
const res = await SupersetClient.put({ |
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.
missed this before, please use complete words for variable names
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.
👍 Thanks for the review!
CATEGORY
Choose one
SUMMARY
Adds a menu option to Explore which opens a modal to edit the properties of the chart. This allows changing the chart properties without going to the autogenerated edit page - part of an ongoing effort to deprecate the CRUD pages.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS