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

[Enterprise Search] Refactor RoleMappingsTable to use EuiInMemoryTable #101918

Merged

Conversation

scottybollinger
Copy link
Contributor

@scottybollinger scottybollinger commented Jun 10, 2021

Summary

EuiInMemoryTable is way better than the bespoke one I wrote and it comes with pagination for free. Will also use this component in the Users table coming in a future PR.

Also adds a shared UsersAndRolesRowActions component for use in both tables.

Please review ent-search companion PR as a part of this review.

Checklist

Both tables use the same actions
@scottybollinger scottybollinger added auto-backport Deprecated - use backport:version if exact versions are needed Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.14.0 labels Jun 10, 2021
@scottybollinger scottybollinger marked this pull request as ready for review June 10, 2021 16:03
@scottybollinger scottybollinger requested a review from a team June 10, 2021 16:03
This is way better than the bespoke one I wrote and it comes with pagination for free

- Also fixes a typo in the i18n id
incremental: true,
fullWidth: false,
placeholder: FILTER_ROLE_MAPPINGS_PLACEHOLDER,
'data-test-subj': 'RoleMappingsTableSearchInput',
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using this attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not yet, but we hope to write some Cypress tests before 8.0 and I believe it could be used there.

Comment on lines +123 to +133
const actionsCol: EuiBasicTableColumn<SharedRoleMapping> = {
field: 'id',
name: '',
align: 'right',
render: (_, { id }: SharedRoleMapping) => (
<UsersAndRolesRowActions
onManageClick={() => initializeRoleMapping(id)}
onDeleteClick={() => handleDeleteMapping(id)}
/>
</>
);
),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this should probably be an action column https://elastic.github.io/eui/#/tabular-content/tables#adding-actions-to-table but its fine if this got polished later

Copy link
Contributor Author

@scottybollinger scottybollinger Jun 10, 2021

Choose a reason for hiding this comment

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

Yeah, I went back and forth with it. Ultimately, I decided against it because it limits the display to 2 icon buttons before collapsing the others with an ellipsis and the forthcoming invitations table for pending invitations has 3. I wasn't sure if there was any design difference between bespoke actions and that actions column but didn't want to have a mixture of them on this layout if there was.

Copy link
Member

@cee-chen cee-chen Jun 15, 2021

Choose a reason for hiding this comment

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

Sorry for the lateness on this, but semi related to this, FYI we do need to add a column header to action columns - it's an a11y issue / axe failure for a table cell not to have an accompanying table heading. We can definitely add it later though, I intend to do an axe pass on our plugin next week

@scottybollinger scottybollinger enabled auto-merge (squash) June 10, 2021 17:27
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 1418 1419 +1

Async chunks

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

id before after diff
enterpriseSearch 2.1MB 2.1MB -1.5KB

History

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

@scottybollinger scottybollinger merged commit 797c0c9 into elastic:master Jun 10, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 10, 2021
elastic#101918)

* Add shared actions component

Both tables use the same actions

* Refactor RoleMappingsTable to use EuiInMemoryTable

This is way better than the bespoke one I wrote and it comes with pagination for free

- Also fixes a typo in the i18n id
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Jun 10, 2021
#101918) (#101940)

* Add shared actions component

Both tables use the same actions

* Refactor RoleMappingsTable to use EuiInMemoryTable

This is way better than the bespoke one I wrote and it comes with pagination for free

- Also fixes a typo in the i18n id

Co-authored-by: Scotty Bollinger <scotty.bollinger@elastic.co>
@scottybollinger scottybollinger deleted the scottybollinger/table-refactor branch June 24, 2021 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Plugins release_note:skip Skip the PR/issue when compiling release notes v7.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants