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

[workspace]Fix/UI of assets table #8519

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Qxisylolo
Copy link
Contributor

@Qxisylolo Qxisylolo commented Oct 8, 2024

Description

This pr addresses the UI of assets table by:

  1. Show a couple of workspace names + a badge "+ N more" showing a popover with the rest of the list of the workspaces(To adjust UI and unstable workspace name length, only one workspace name will he shown)
  2. Add "database" icon for the assets of the type "Data source"
  3. Add "Gear" icon to the config type assets
  4. Is there are no workspaces, show mdash in the table cell

Screenshot

截屏2024-10-08 08 10 39 截屏2024-10-30 16 33 19

Changelog

  • fix: adds badge when there are more than one workspaces and updates the icon

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.86%. Comparing base (608911e) to head (06a6080).

Files with missing lines Patch % Lines
...c/components/workspace_column/workspace_column.tsx 92.85% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8519   +/-   ##
=======================================
  Coverage   60.85%   60.86%           
=======================================
  Files        3802     3802           
  Lines       91062    91074   +12     
  Branches    14376    14379    +3     
=======================================
+ Hits        55419    55430   +11     
- Misses      32104    32105    +1     
  Partials     3539     3539           
Flag Coverage Δ
Linux_1 29.02% <92.85%> (+0.01%) ⬆️
Linux_2 56.39% <ø> (ø)
Linux_3 37.87% <ø> (ø)
Linux_4 29.00% <ø> (ø)
Windows_1 29.04% <92.85%> (+0.01%) ⬆️
Windows_2 56.34% <ø> (ø)
Windows_3 37.87% <ø> (ø)
Windows_4 29.00% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 31, 2024
@Qxisylolo Qxisylolo force-pushed the fix/UI_of_assets_table branch 2 times, most recently from c09ae37 to 50de911 Compare October 31, 2024 07:03
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 31, 2024
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 31, 2024
@@ -283,13 +298,71 @@ export class Table extends PureComponent<TableProps, TableState> {
'data-test-subj': 'updated-at',
render: (updatedAt: string) => updatedAt && moment(updatedAt).format(dateFormat),
} as EuiTableFieldDataColumnType<SavedObjectWithMetadata<any>>,
...columnRegistry.getAll().map((column) => {
Copy link
Member

Choose a reason for hiding this comment

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

We are not supposed to delete the columnRegistry here, it is an extension point for other plugins to register their customized column.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment, already updated

@@ -224,7 +223,7 @@ export class Table extends PureComponent<TableProps, TableState> {
<EuiToolTip position="top" content={getSavedObjectLabel(type)}>
<EuiIcon
aria-label={getSavedObjectLabel(type)}
type={object.meta.icon || 'apps'}
type={object.type === 'config' ? 'gear' : object.meta.icon || 'app'}
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we just changed the meta.icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for all the comments, updated.

panelPaddingSize="s"
data-test-subj="workspace-column-popover"
>
{workspaceNames?.slice(1).map((ws) => (
Copy link
Member

Choose a reason for hiding this comment

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

The ws may be undefined, shall we filter those workspace out?

Comment on lines 32 to 34
expect(getByTestId('workspace-column-popover')).toBeInTheDocument();
expect(getByText('foo')).toBeInTheDocument();
expect(getByText('bar')).toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we could use findByText or findByTestId for such kind of assertion, those commands have retry mechanism out of the box.

Signed-off-by: Qxisylolo <[email protected]>
Signed-off-by: Qxisylolo <[email protected]>
setShowBadgePopover(false);
};

if (workspaceNames) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (workspaceNames) {
if (workspaceNames?.length) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants