Skip to content

Allow role mappings to be cloned#118434

Merged
XavierM merged 17 commits intoelastic:mainfrom
XavierM:clone_role_mapping
Nov 17, 2021
Merged

Allow role mappings to be cloned#118434
XavierM merged 17 commits intoelastic:mainfrom
XavierM:clone_role_mapping

Conversation

@XavierM
Copy link
Contributor

@XavierM XavierM commented Nov 11, 2021

Summary

Adding functionality to clone a role mapping. I realized that there was some discrepancy between roles and roles mapping. I took the initiative to make it similar. It also matching what EUI is doing in their example

image

image

Resolves: #111744

Checklist

@XavierM XavierM added release_note:enhancement Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// enhancement New value added to drive a business result v8.0.0 auto-backport Deprecated - use backport:version if exact versions are needed v8.1.0 labels Nov 11, 2021
@XavierM XavierM requested a review from a team as a code owner November 11, 2021 21:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@XavierM XavierM marked this pull request as draft November 11, 2021 21:55
@elastic elastic deleted a comment from kibanamachine Nov 15, 2021
@XavierM XavierM marked this pull request as ready for review November 15, 2021 21:12
@XavierM XavierM requested a review from thompsongl November 15, 2021 21:17
interface ActionsEuiTableFormattingProps {
children: ReactNode;
}
export const ActionsEuiTableFormatting = React.memo<ActionsEuiTableFormattingProps>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notes for reviewer: Why did Xavier decide to override EUI? is he crazy?
Answer: maybe he is, but the real reason is that I/we wanted to keep our icon working with onClick and href at the same time but the actions props in EuiTable does not let you do that and I still wanted the same style how EUI do it and that's my reason.
if you know/have a better way please let me know, I will love/do it.

Copy link
Contributor

Choose a reason for hiding this comment

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

There isn't a better way (that I'm aware of) to achieve this without changing some things in EUI 👍

@XavierM
Copy link
Contributor Author

XavierM commented Nov 16, 2021

@elasticmachine merge upstream

@jportner jportner self-requested a review November 16, 2021 15:36
Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Both comments should be taken as one. Not a blocker, just a suggestion if you don't need to maintain the styles in a variable as template string.

@XavierM
Copy link
Contributor Author

XavierM commented Nov 16, 2021

@elasticmachine merge upstream

Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Nice job, just a couple of nits below


it('allows a role mapping to be deleted', async () => {
await testSubjects.click(`deleteRoleMappingButton-new_role_mapping`);
await testSubjects.click('euiCollapsedItemActionsButton');
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe to future-proof the other tests against any EUI changes, we should change the other two action tests (clone, edit) to also use the collapsed item actions button. WDYT?

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 do not think it is really needed because it is the same actions button on the row or in the popover menu item. In my opinion, it should already being handle by the EUI library ;) (We need to trust our tools)

Comment on lines 468 to 471
private onCancelDelete = () => {
this.setState({ showDeleteConfirmation: false });
this.setState({ showDeleteConfirmation: false, selection: [] });
this.tableRef.current?.setSelection([]);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@XavierM XavierM requested a review from jportner November 17, 2021 16:45
Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

LGTM, one last nit below

@XavierM XavierM enabled auto-merge (squash) November 17, 2021 17:27
@XavierM XavierM merged commit 50ad304 into elastic:main Nov 17, 2021
@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
security 400 401 +1

Async chunks

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

id before after diff
security 487.4KB 490.5KB +3.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
security 49.4KB 49.5KB +123.0B

History

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

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Nov 17, 2021
* add clobe to role mapping and update functionalit in role to match UX

* fix some I

* fix jest test + fix table selection when canceling deletion

* add tests around clone action in role mapping

* fix i18n

* remove i18n

* review Greg I

* fix styling + name

* add explaination

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
8.0

This backport PR will be merged automatically after passing CI.

@legrego legrego changed the title [SECURITY] add clone functionality to role mapping Allow role mappings to be cloned Nov 17, 2021
kibanamachine added a commit that referenced this pull request Nov 17, 2021
* add clobe to role mapping and update functionalit in role to match UX

* fix some I

* fix jest test + fix table selection when canceling deletion

* add tests around clone action in role mapping

* fix i18n

* remove i18n

* review Greg I

* fix styling + name

* add explaination

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
TinLe pushed a commit to TinLe/kibana that referenced this pull request Nov 20, 2021
* add clobe to role mapping and update functionalit in role to match UX

* fix some I

* fix jest test + fix table selection when canceling deletion

* add tests around clone action in role mapping

* fix i18n

* remove i18n

* review Greg I

* fix styling + name

* add explaination

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
* add clobe to role mapping and update functionalit in role to match UX

* fix some I

* fix jest test + fix table selection when canceling deletion

* add tests around clone action in role mapping

* fix i18n

* remove i18n

* review Greg I

* fix styling + name

* add explaination

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
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 enhancement New value added to drive a business result release_note:enhancement Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// v8.0.0 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Role Mapping Clone Functionality

6 participants