Skip to content
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] refactor slice action button group #1074

Merged
merged 6 commits into from
Sep 20, 2016
Merged

[explore] refactor slice action button group #1074

merged 6 commits into from
Sep 20, 2016

Conversation

ascott
Copy link
Contributor

@ascott ascott commented Sep 7, 2016

screenshot 2016-09-19 22 41 53

screenshot 2016-09-19 22 42 03

screenshot 2016-09-19 22 42 14

todo:

  • pass query code to query modal
  • tests

plz review @mistercrunch @bkyryliuk @vera-liu

@ascott
Copy link
Contributor Author

ascott commented Sep 20, 2016


beforeOpen() {
this.setState({
viewSqlQuery: this.props.slice.viewSqlQuery,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.props.slice gets updated after everything is mounted, so before we open the modal we need to set the state with the updated slice data. i should add a todo, to fix this once caravel.js is refactored to better work with the react structure/lifecycle.

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall but I'd love a more generic ModalTrigger!

import React, { PropTypes } from 'react';
import { Button, Tooltip, OverlayTrigger } from 'react-bootstrap';

const propTypes = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to replicate this pattern of setting the propTypes & defaultTypes at the top of the file in SqlLab!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

};

// bindings
this.copyToClipboard = this.copyToClipboard.bind(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sucks that we need to write this boilerplate, but haven't the .bind in render isn't better...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i like to keep it all in one place in the constructor.

}

tooltipText() {
let tooltipText;
Copy link
Member

@mistercrunch mistercrunch Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: ternary operator could be nice here, the whole function becomes a single line


render() {
return (
<span
Copy link
Member

@mistercrunch mistercrunch Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this component is great but on my side I wanted to use it not as a button (just an <i/>). Maybe instead of receiving buttonBody is could receive trigger as any jsx, but still be wrapped in an <span onClick>.

Another option is to put this.props.children inside the onClick span as opposed to this.props.trigger.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i updated this so you can just pass in <i />, also added a boolean prop isButton if you want it to look like a button. otherwise, it will wrap your triggerNode in a simple <a/>.


render() {
return (
<span
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, let's call it triggerNode and take out the btn styling so it can be used more generally.

@mistercrunch
Copy link
Member

LGTM

@ascott ascott merged commit 0e7af8d into apache:master Sep 20, 2016
@ascott ascott deleted the explore-js-refactor-1 branch September 20, 2016 20:45
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.11.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants