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

refactor: Changes the list views to use the new Select component #16393

Merged

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Aug 22, 2021

SUMMARY

  • Change the list views to use the new Select component
  • Adjusts the design of the date range picker to match other controls
  • Aligns the sort select with the other controls
  • Makes the layout behavior consistent when resizing the screen
  • Adjusts the controls to have the same width
  • Previously we had 'Me' and 'Admin', which are the same user, now it will only show the name of the logged user always as the first option of the select.
  • Adjusts the tests

@junlincc @jinghua-qa @rusackas @mistercrunch

PS: Sorry for the big PR, but everything needs to be tested as a whole.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2021-08-25.at.3.36.08.PM.mov
Screen.Recording.2021-09-14.at.8.36.40.AM.mov

TESTING INSTRUCTIONS

Check the videos for instructions.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@michael-s-molina michael-s-molina changed the title chore: Change the list views to use the new Select component chore: Changes the list views to use the new Select component Aug 25, 2021
@michael-s-molina michael-s-molina marked this pull request as ready for review August 25, 2021 19:42
@codecov
Copy link

codecov bot commented Aug 25, 2021

Codecov Report

Merging #16393 (2a65c11) into master (adc3d24) will decrease coverage by 0.05%.
The diff coverage is 67.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16393      +/-   ##
==========================================
- Coverage   76.95%   76.89%   -0.06%     
==========================================
  Files        1007     1006       -1     
  Lines       54149    54145       -4     
  Branches     7369     7457      +88     
==========================================
- Hits        41669    41634      -35     
- Misses      12240    12269      +29     
- Partials      240      242       +2     
Flag Coverage Δ
javascript 71.16% <67.22%> (-0.13%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/components/ListView/types.ts 100.00% <ø> (ø)
...perset-frontend/src/views/CRUD/alert/AlertList.tsx 75.75% <ø> (ø)
...ews/CRUD/annotationlayers/AnnotationLayersList.tsx 77.35% <ø> (ø)
...d/src/views/CRUD/csstemplates/CssTemplatesList.tsx 78.26% <ø> (ø)
...ontend/src/views/CRUD/data/dataset/DatasetList.tsx 69.41% <ø> (ø)
...t-frontend/src/views/CRUD/data/query/QueryList.tsx 69.89% <ø> (-1.08%) ⬇️
superset-frontend/src/views/CRUD/utils.tsx 55.81% <5.00%> (-13.04%) ⬇️
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 74.35% <58.33%> (-3.63%) ⬇️
...rontend/src/components/ListView/Filters/Select.tsx 76.92% <70.00%> (-20.64%) ⬇️
...rontend/src/views/CRUD/dashboard/DashboardList.tsx 72.22% <71.42%> (+0.39%) ⬆️
... 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 adc3d24...2a65c11. Read the comment docs.

@michael-s-molina
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@michael-s-molina Ephemeral environment spinning up at http://35.163.253.132:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa
Copy link
Member

I tested in the test environment, I found that there are some fields are not supported typing, is that expected?
These are the fields I found I can not type and search:

Dashboards:
STATUS/ FAVORITE

Charts
VIZ TYPE /FAVORITE

Database
EXPOSE IN SQL LAB
AQE

Dataset
TYPE

@michael-s-molina
Copy link
Member Author

I tested in the test environment, I found that there are some fields are not supported typing, is that expected?

@jinghua-qa Thanks for testing! I added a fix to enable searching for all controls.

@michael-s-molina
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@michael-s-molina Ephemeral environment spinning up at http://52.12.77.56:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@michael-s-molina michael-s-molina changed the title chore: Changes the list views to use the new Select component refactor: Changes the list views to use the new Select component Aug 27, 2021
@michael-s-molina michael-s-molina requested review from ktmud and removed request for rusackas and suddjian August 27, 2021 10:21
@michael-s-molina michael-s-molina force-pushed the change-list-view-selects branch 2 times, most recently from 6d23d30 to 79e2d6e Compare August 27, 2021 11:04
@michael-s-molina
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@michael-s-molina Ephemeral environment spinning up at http://34.222.251.103:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

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.

some initial comments

totalCount: 0,
};
},
[], // eslint-disable-line react-hooks/exhaustive-deps
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we add in the dependencies here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! Done.

/>
)}
<Select
ariaLabel={typeof Header === 'string' ? Header : emptyLabel}
Copy link
Member

Choose a reason for hiding this comment

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

since Header can be a react node too, this would mean we'd have a11y text of None for a custom rendered header. seems less than ideal

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. I changed it to use the header or the name or a generic 'Filter'.

function UIFilters({
filters,
internalFilters = [],
updateFilterValue,
}: UIFiltersProps) {
return (
<FilterWrapper>
<>
Copy link
Member

Choose a reason for hiding this comment

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

do we need this? i'm a bit rusty, but i thought you could return an array as a react component too

Copy link
Member Author

Choose a reason for hiding this comment

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

@github-actions
Copy link
Contributor

@ktmud Ephemeral environment spinning up at http://34.215.173.11:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@ktmud
Copy link
Member

ktmud commented Sep 14, 2021

image

I'm getting a JS error when trying to clear a selected value.

@michael-s-molina
Copy link
Member Author

I'm getting a JS error when trying to clear a selected value.

Thanks for spotting that @ktmud. I fixed and also rebased to get the latest changes.

@michael-s-molina
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@michael-s-molina Ephemeral environment spinning up at http://35.85.138.206:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

Code lgtm but are we sure this is the design we want? Currently it jus looks like there are too many "holes" in the header section. Consistency is good for most cases, but there is also context here---IMO a simple dropdown switch used for navigation has a totally different purpose than say a multi-select control in a form intended for collecting information.

This is deviating further and further away from SIP-34 design:

Xnip2021-09-15_17-42-36

I'm going to stamp as I understand the need to consolidate Select implementation, but I hope we can reconsider the design here.


export const RangePicker = styled(AntdRangePicker)`
border-radius: ${({ theme }) => theme.gridUnit}px;
`;
Copy link
Member

Choose a reason for hiding this comment

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

Is this change intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The idea is to match the border style of the Select and Input components.

PartialThemeConfig,
} from 'src/components/Select';
import React, { useState, useMemo } from 'react';
import { withTheme, SupersetThemeProps, t } from '@superset-ui/core';
Copy link
Member

Choose a reason for hiding this comment

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

It seems theme variables are not used directly by this component anymore. Can we clean up withTheme?

On a separate note, I think we should prefer useTheme in all future refactoring, too---unless for wrapping legacy class-based components. I added an entry in the CSS Styled Guide.

cc. @evans @etr2460 Lmk if you have different opinions.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed

Copy link
Member Author

Choose a reason for hiding this comment

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

withTheme removed.

@michael-s-molina
Copy link
Member Author

This is deviating further and further away from SIP-34 design:

I'm going to stamp as I understand the need to consolidate Select implementation, but I hope we can reconsider the design here.

@ktmud During our design session we came to the same conclusion. We chose to preserve the Select consistency for now, in order to migrate the component, but @mihir174 and @jess-dillard will analyze the design and propose improvements that will be implemented in the future.

@ktmud
Copy link
Member

ktmud commented Sep 16, 2021

Xnip2021-09-16_11-31-30

Not sure if it'd help but here's a design I implemented for another project. Using carets instead of arrows helps.

@michael-s-molina michael-s-molina merged commit b6d78bf into apache:master Sep 22, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
…che#16393)

* chore: Change the list views to use the new Select component

* Fix Cypress tests

* Enables search for all controls

* Adjusts controls width

* Removes 'Me' and keeps the logged user on top

* Fixes tests

* Uses the borderless version for the filters

* Fixes the tests

* Reverts the Select theme to the default

* Rebases and fixes js error

* Fixes failing test

* Removes unused withTheme
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
…che#16393)

* chore: Change the list views to use the new Select component

* Fix Cypress tests

* Enables search for all controls

* Adjusts controls width

* Removes 'Me' and keeps the logged user on top

* Fixes tests

* Uses the borderless version for the filters

* Fixes the tests

* Reverts the Select theme to the default

* Rebases and fixes js error

* Fixes failing test

* Removes unused withTheme
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 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/XXL test_priority:high 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants