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: replace AvatarIcon instances with FacePile #11279

Merged
merged 9 commits into from
Oct 20, 2020

Conversation

nytai
Copy link
Member

@nytai nytai commented Oct 14, 2020

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen Shot 2020-10-14 at 5 18 28 PM

Screen Shot 2020-10-14 at 5 18 34 PM

Screen Shot 2020-10-14 at 5 18 42 PM

TEST PLAN

  • unit tested
  • 👀

ADDITIONAL INFORMATION

@codecov-io
Copy link

codecov-io commented Oct 15, 2020

Codecov Report

Merging #11279 into master will increase coverage by 0.20%.
The diff coverage is 80.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11279      +/-   ##
==========================================
+ Coverage   65.43%   65.63%   +0.20%     
==========================================
  Files         831      837       +6     
  Lines       39528    39685     +157     
  Branches     3598     3608      +10     
==========================================
+ Hits        25866    26049     +183     
+ Misses      13553    13528      -25     
+ Partials      109      108       -1     
Flag Coverage Δ
#cypress 55.84% <91.17%> (-0.12%) ⬇️
#javascript 62.59% <80.39%> (-0.08%) ⬇️
#python 60.91% <ø> (+0.37%) ⬆️

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

Impacted Files Coverage Δ
...ntend/src/components/FacePile/FacePile.stories.tsx 0.00% <0.00%> (ø)
...rontend/src/views/CRUD/dashboard/DashboardList.tsx 75.40% <66.66%> (-1.21%) ⬇️
...uperset-frontend/src/components/FacePile/index.tsx 100.00% <100.00%> (ø)
...uperset-frontend/src/components/FacePile/utils.tsx 100.00% <100.00%> (ø)
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 82.40% <100.00%> (-0.94%) ⬇️
...ontend/src/views/CRUD/data/dataset/DatasetList.tsx 73.17% <100.00%> (+0.94%) ⬆️
...uperset-frontend/src/components/ExpandableList.tsx 0.00% <0.00%> (-94.45%) ⬇️
superset-frontend/src/SqlLab/components/App.jsx 69.23% <0.00%> (-8.55%) ⬇️
superset/models/slice.py 86.80% <0.00%> (-1.22%) ⬇️
... and 74 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 634676d...889e911. Read the comment docs.

@nytai nytai marked this pull request as ready for review October 15, 2020 00:44
superset-frontend/src/components/UserStack/index.tsx Outdated Show resolved Hide resolved
{users.map(({ first_name, last_name }) => {
const name = `${first_name} ${last_name}`;
return (
<Tooltip key={name} title={name} placement="top">
Copy link
Member

Choose a reason for hiding this comment

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

this key won't be unique if the same user is an owner of multiple dashboards i think. Perhaps we need to append more context 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.

this is rendered in the context of a single row for dashboards. The array here is for owers on a single dashboard and that list should be unique. While the key would not be unique for the whole page, it would be unique for the list in which each appears.

*/

// https://en.wikipedia.org/wiki/Linear_congruential_generator
function stringAsciiPRNG(value: string, m: number) {
Copy link
Member

Choose a reason for hiding this comment

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

can we add a test or two for this?

Copy link
Member

Choose a reason for hiding this comment

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

Also, what if they have a non english/ascii name?

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 should be covered in the tests for getRandomColor

@mistercrunch
Copy link
Member

NIT: tooltip-in-popover is a bit "yo dawg" :)

@nytai
Copy link
Member Author

nytai commented Oct 16, 2020

NIT: tooltip-in-popover is a bit "yo dawg" :)

Yea it's a little much visually. We could remove it (ie, check to see if the avatar is beyond the fold and not add the tooltip) but then we'd lose some information.

@nytai nytai requested a review from etr2460 October 16, 2020 00:24
@nytai nytai changed the title refactor: replace AvatarIcon instances with UserStack refactor: replace AvatarIcon instances with FacePile Oct 16, 2020
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 more comments, but nothing blocking

import FacePile from '.';

export default {
title: 'UerStack',
Copy link
Member

Choose a reason for hiding this comment

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

nit: this should probably be FacePile for consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

ohh, nice catch

<StyledGroup maxCount={maxCount}>
{users.map(({ first_name, last_name }) => {
const name = `${first_name} ${last_name}`;
const color = getRandomColor(name, colorList);
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't need to be addressed in this PR, but basing the profile color off the full name seems somewhat flawed to me. If there are naming collisions between people with common full names, then it'll be impossible to tell them apart in the FacePile. This could also cause key collisions below.

I'd recommend refactoring in the future to basing the color off the user id, or a combo of name + user id.

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, I can add user id to the mix and that should hold us over for a while. Eventually, I think, we'll have profile pictures and make these links so it's easier to differentiate users

@nytai nytai merged commit 4208ca7 into apache:master Oct 20, 2020
@nytai nytai deleted the tai/user-stack branch October 20, 2020 03:23
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 🚢 1.0.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/L 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More owners toggle in CRUD view renders with extra ellipsis
4 participants