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

[Dashboard] Add "Creator" column to dashboard listing page #182256

Merged
merged 8 commits into from
May 3, 2024

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented May 1, 2024

Summary

close #182253

This PR adds a creator column to the dashboard's listing page:

Screenshot 2024-05-02 at 09 29 12

Screenshot 2024-05-02 at 09 29 17

  • if none of the dashboards have a creator, the column is not rendered
  • if creator is empty, then the cell is empty
  • the column is not sortable because on the table level we only have user ids and it doesn't make sense to sort by them. I prefer to not block the dashboard rendering with the additional getAllUsers request to make the column sortable. Now the users are only fetched on the cell level during rendering, so we only fetch visible users. I hope this is an OK tradeoff that favors table's first paint and simplicity of implementation

@Dosant
Copy link
Contributor Author

Dosant commented May 2, 2024

/ci

@Dosant
Copy link
Contributor Author

Dosant commented May 2, 2024

/ci

@Dosant
Copy link
Contributor Author

Dosant commented May 2, 2024

/ci

@Dosant Dosant marked this pull request as ready for review May 2, 2024 12:59
@Dosant Dosant requested a review from a team as a code owner May 2, 2024 12:59
@Dosant Dosant added release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) Component:TableListView labels May 2, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@Dosant Dosant requested review from sebelga and Heenawter May 2, 2024 13:02
@Dosant Dosant self-assigned this May 2, 2024
Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Not sure if there is an easier way to test the "No user" situation (imported dashboards get metadata injected, so even manually removing it won't work) - but I ended up checking out a PR from before #179344 was merged and ran that in order to create the "No user" dashboards. (Please let me know if there is an easier way 🙈)

In this test, I noticed that the "Created by" column only gets filtered out on hard refresh:

Screen.Recording.2024-05-02.at.9.51.06.AM.mov

This isn't the best UX, but also not sure how common of an experience this will be?

I prefer to not block the dashboard rendering with the additional getAllUsers request to make the column sortable.

💯 I think performance of the listing page is much more important than sorting. That being said, we could still render the listing page and show a loading state for just the creator column, no? And, assuming if we resolve what I noted above, this column could still be hidden if, after the request is completed, none of the dashboards have created-by metadata.

That being said, none of the things I've mentioned here (or in the attached comments) are blockers - so I'm approving :) So excited to see this work! 🎉

Comment on lines +25 to +32
return (
<UserAvatarTipComponent
user={query.data.user}
avatar={query.data.data.avatar}
size={'s'}
data-test-subj={`userAvatarTip-${query.data.user.username}`}
/>
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but we see similar truncation issues that the "Created by" filter had:

image

image

cc @elastic/kibana-security

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha, thanks :) I fixed the popover but didn't notice the toolip

Copy link
Member

Choose a reason for hiding this comment

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

Good find @Heenawter ! @Dosant should I create an issue for any of our teams to handle that or are you planning to fix it in this PR?

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'll create an issue

Comment on lines +101 to +108
test("shouldn't render created by column when createdBy is disabled", async () => {
render(<TableListView {...requiredProps} />);

// wait until first render
expect(await screen.findByTestId('itemsInMemTable')).toBeVisible();

expect(() => screen.getByTestId(/tableHeaderCell_createdBy/)).toThrow();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 🎉 Good to have this test since it's not an easy situation to encounter.

Comment on lines +16 to +22
const query = useQuery(
['user-profile', props.uid],
async () => {
return getUserProfile(props.uid);
},
{ staleTime: Infinity }
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Because we are only using the uid as our query key here, it looks like the custom avatars don't get refetched until after a hard refresh:

Screen.Recording.2024-05-02.at.9.13.37.AM.mov

I don't consider this to be a blocker by any means, because I don't think it's critical that this gets updated right away necessarily - especially if this would impact performance. But figured it was worth noting.

@Dosant
Copy link
Contributor Author

Dosant commented May 3, 2024

Not sure if there is an easier way to test the "No user" situation (imported dashboards get metadata injected, so even manually removing it won't work) - but I ended up checking out a PR from before #179344 was merged and ran that in order to create the "No user" dashboards. (Please let me know if there is an easier way 🙈)

  • I think when you install some "managed" dashboards from integrations, they usually won't have creator, because they are created by the internal user.
  • There is also an edge case that there is no creator when you create a dashboard using API with API KEY

I noticed that the "Created by" column only gets filtered out on hard refresh:
This isn't the best UX, but also not sure how common of an experience this will be?

It seems that this logic was written for "last_updated_at" column and I think it was intentional to prevent unwanted table shift layouts. I think this fine. But your screenshot made me want to add a question icon tip next to "Creator" column label explaining that only new dashboards get creator.

Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

LGTM! Tested locally and works as expected 👍

@sebelga
Copy link
Contributor

sebelga commented May 3, 2024

Because we are only using the uid as our query key here, it looks like the custom avatars don't get refetched until after a hard refresh

We should be able to refetch when component mounts with react query retryOnMount maybe?

@Dosant
Copy link
Contributor Author

Dosant commented May 3, 2024

@elasticmachine merge upstream

@Dosant Dosant enabled auto-merge (squash) May 3, 2024 12:32
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 462 465 +3
eventAnnotationListing 535 538 +3
filesManagement 165 168 +3
graph 273 276 +3
maps 1182 1185 +3
visualizations 428 431 +3
total +18

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 397.1KB 399.1KB +2.0KB
eventAnnotationListing 203.3KB 205.3KB +2.0KB
filesManagement 91.9KB 93.9KB +2.0KB
graph 391.1KB 393.1KB +2.0KB
maps 3.0MB 3.0MB +2.0KB
visualizations 276.5KB 278.5KB +2.0KB
total +12.0KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Dosant

@Dosant Dosant merged commit bf64717 into elastic:main May 3, 2024
24 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Component:TableListView release_note:enhancement Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] Add created_by column to dashboard listing page
7 participants