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

feat(listviews): SIP-34 Bulk Select #10298

Merged
merged 15 commits into from
Jul 16, 2020
Merged

Conversation

nytai
Copy link
Member

@nytai nytai commented Jul 13, 2020

SUMMARY

  • Add SIP-34 Bulk select to DatasetList DashboardList, ChartList
  • convert Button.jsx -> Button.tsx (& add styling for supersetButton)
  • refactor SubMenu to be presentation only, moving DatasetAddModal to DatasetsList

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Datasets

Screen Shot 2020-07-12 at 10 09 06 PM

Screen Shot 2020-07-12 at 10 09 21 PM

Charts

Screen Shot 2020-07-12 at 10 10 24 PM

Dashboards

Screen Shot 2020-07-12 at 10 09 44 PM

TEST PLAN

  • bulk select delete works for Datasets, Charts, Dashboards
  • bulk expect works for Dashboards
  • Dataset Add flow works

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI: Behind ENABLE_REACT_CRUD_VIEWS config flag
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@nytai nytai changed the title feat: SIP-34 Bulk Select feat(listviews): SIP-34 Bulk Select Jul 13, 2020
@nytai nytai marked this pull request as ready for review July 14, 2020 02:17
export default function Button(props) {
const buttonProps = { ...props };
const SupersetButton = styled(BootstrapButton)`
&.supersetButton {
Copy link
Member

Choose a reason for hiding this comment

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

Think we need to have the .supersetButton class here anymore, or should these be the default styles for SupersetButton?

Copy link
Member Author

Choose a reason for hiding this comment

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

This button is used in other areas of the product, so there's potential for breakage. Adding the .supersetButton class renders the button as a wide CTA button (as per the SIP-34 designs). We could abstract this into a prop and use that instead, something like style: 'bootstrap' | 'default' | 'small' | 'link' | ... to control these styles, where bootstrap defaults to the bootstrap styles, and the others pertain to the new styling.

Copy link
Member

Choose a reason for hiding this comment

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

I like that idea... then ALL the buttons usage can be migrated to import/use the new Button component, instead of direct (React-)Bootstrap use, and they'll be easy to find/replace as we go forward with SIP-34.

</span>
<div className="divider" />
{bulkActions.map(action => (
<Button
Copy link
Member

Choose a reason for hiding this comment

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

Should this be an instance of SupersetButton?

Also, I'm assuming the margin-left style applied is to add a gap between buttons. If so, maybe we can kill off the margin-left style in this CSS, and add it to the SupersetButton component, e.g.:

margin-left: ${({ theme }) => theme.gridUnit * 4}px;
&:first-of-type {
  margin-left: 0;
}

Copy link
Member

Choose a reason for hiding this comment

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

n/m the comment about the SupersetButton instance... didn't realize that's what's exported by Button

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll give that styling a shot, originally I has the margins on the actual button component, but it seemed like there's more flexibility in the button not assuming anything about it's surrounding.

Copy link
Member Author

Choose a reason for hiding this comment

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

re: the SupersetButton comment, do you think it makes more sense to just make a new SupersetButton component and make the split between the new and the old explicit, or does having one component serving both make sense?

Copy link
Member

Choose a reason for hiding this comment

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

Probably debatable, but my gut tells me that one component serving both makes sense, perhaps with some props to drive it as you've suggested. Then all the code is in one spot, and easier to maintain/migrate/style, especially if/when we shift into AntD.

dashboardCount: number;
loading: boolean;
dashboards: any[];
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if it's worth the effort, but if instead of dashboard____ keys, these could be made more generic, e.g. itemCount, and then ListView could export a shared/reusable interface?

Copy link
Member Author

Choose a reason for hiding this comment

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

that's an interesting idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

DatasetList got converted into a functional component with hooks, so the shared interface makes less sense. Shared hooks on the other hand.... 🤔

@rusackas
Copy link
Member

Added some questions/comments/etc, but this is looking great!

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2020

Codecov Report

Merging #10298 into master will increase coverage by 0.05%.
The diff coverage is 86.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10298      +/-   ##
==========================================
+ Coverage   70.60%   70.65%   +0.05%     
==========================================
  Files         600      601       +1     
  Lines       32182    32269      +87     
  Branches     3257     3275      +18     
==========================================
+ Hits        22721    22801      +80     
- Misses       9358     9362       +4     
- Partials      103      106       +3     
Flag Coverage Δ
#cypress 55.64% <100.00%> (+0.04%) ⬆️
#javascript 59.60% <86.84%> (+0.12%) ⬆️
#python 69.93% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ontend/src/components/ListView/TableCollection.tsx 100.00% <ø> (+6.89%) ⬆️
superset-frontend/src/components/ListView/utils.ts 83.14% <ø> (ø)
superset-frontend/src/components/Menu/Menu.jsx 88.23% <ø> (ø)
...frontend/src/views/datasetList/AddDatasetModal.tsx 58.82% <0.00%> (ø)
...uperset-frontend/src/views/chartList/ChartList.tsx 60.40% <66.66%> (-0.56%) ⬇️
...frontend/src/views/dashboardList/DashboardList.tsx 66.00% <75.00%> (-0.44%) ⬇️
...set-frontend/src/views/datasetList/DatasetList.tsx 71.34% <83.33%> (+2.85%) ⬆️
...end/src/SqlLab/components/RunQueryActionButton.tsx 68.18% <100.00%> (ø)
superset-frontend/src/components/Button.tsx 93.75% <100.00%> (ø)
...rset-frontend/src/components/ListView/ListView.tsx 98.30% <100.00%> (+0.34%) ⬆️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2341e8d...77e4e74. Read the comment docs.

superset-frontend/spec/helpers/waitForComponentToPaint.js Outdated Show resolved Hide resolved

const BUTTON_WRAPPER_STYLE = { display: 'inline-block', cursor: 'not-allowed' };

export default function Button(props) {
const buttonProps = { ...props };
const SupersetButton = styled(BootstrapButton)`
Copy link
Member

Choose a reason for hiding this comment

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

How is this styling different from /views/datasetList/Button? Should these two components be joined together?

cc @lilykuang

Copy link
Member

Choose a reason for hiding this comment

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

yes, they are very similar. They should probably be joined together.

Copy link
Member

Choose a reason for hiding this comment

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

@nytai were you planning to action on this? Or should I review again now?

Copy link
Member Author

Choose a reason for hiding this comment

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

@etr2460 Not planning on actioning this now, mind reviewing this as is? The fix for testing hooks is needed for other PRs. I'll consider addressing this when rebasing #10335 after this merges.

superset-frontend/src/components/ListView/ListView.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/ListView/ListView.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/ListView/ListView.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Menu/SubMenu.tsx Outdated Show resolved Hide resolved
superset-frontend/src/views/datasetList/DatasetList.tsx Outdated Show resolved Hide resolved
@nytai nytai closed this Jul 15, 2020
@nytai nytai reopened this Jul 15, 2020
@nytai nytai requested review from etr2460 and rusackas July 15, 2020 17:21
@@ -104,8 +104,16 @@
}

.table-row {
.actions {
opacity: 0;
Copy link
Member

Choose a reason for hiding this comment

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

Awwww, didn't like the animation?
transition: opacity @timing-normal;
^I'm tempted to add this kind of thing lots of places in Superset ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

Lookin' good!

(though... you know... needs more css transitions everywhere ;)

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

a couple other comments, otherwise lgtm

superset-frontend/src/components/Button.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Button.tsx Outdated Show resolved Hide resolved
}
`;

const Button: React.FunctionComponent<ButtonProps> = props => {
Copy link
Member

Choose a reason for hiding this comment

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

instead of using arrow functions like this, I think it's better to do:

export default function Button(props: ButtonProps) {
...

The arrow function results in an anonymous function and makes stack traces harder to read

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point, though React.FunctionComponent<ButtonProps> adds the react builtin props/children prop.

@nytai nytai merged commit 0eee678 into apache:master Jul 16, 2020
@nytai nytai deleted the tai/SIP-34-bulk-select branch July 16, 2020 23:09
@rusackas
Copy link
Member

Impacts #8976

auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 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 size/XL 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants