-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Reactify users roles #20739
Reactify users roles #20739
Changes from 27 commits
1d209ca
0b9f706
a8b6aa0
3f2111c
3dfc4e9
6ae9785
aba4df5
1cdd642
a6b9f0c
0645315
a75d9f3
0e95c45
29e5537
89ae92a
8c90d9c
f76a77c
4f9ab79
74cb8b4
4c72e45
fb4f27e
5819a4e
ed1040a
8f73767
f12db47
b1d41ac
b4495d9
f8afe3b
8480f43
9624a2b
61428b0
70c0efc
f1bc298
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React, { Component, Fragment } from 'react'; | ||
import { EuiOverlayMask, EuiConfirmModal } from '@elastic/eui'; | ||
import { toastNotifications } from 'ui/notify'; | ||
export class ConfirmDelete extends Component { | ||
deleteUsers = () => { | ||
const { usersToDelete, apiClient, callback } = this.props; | ||
const errors = []; | ||
usersToDelete.forEach(async username => { | ||
try { | ||
await apiClient.deleteUser(username); | ||
toastNotifications.addSuccess(`Deleted user ${username}`); | ||
} catch (e) { | ||
errors.push(username); | ||
toastNotifications.addDanger(`Error deleting user ${username}`); | ||
} | ||
if (callback) { | ||
callback(usersToDelete, errors); | ||
} | ||
}); | ||
}; | ||
render() { | ||
const { usersToDelete, onCancel } = this.props; | ||
const moreThanOne = usersToDelete.length > 1; | ||
const title = moreThanOne | ||
? `Delete ${usersToDelete.length} users` | ||
: `Delete user '${usersToDelete[0]}'`; | ||
return ( | ||
<EuiOverlayMask> | ||
<EuiConfirmModal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cchaos This modal looks like it's missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this will be fixed by the followup PR updating EUI in X-Pack. |
||
title={title} | ||
onCancel={onCancel} | ||
onConfirm={this.deleteUsers} | ||
cancelButtonText="Cancel" | ||
confirmButtonText="Delete" | ||
buttonColor="danger" | ||
> | ||
<div> | ||
{moreThanOne ? ( | ||
<Fragment> | ||
<p> | ||
You are about to delete these users: | ||
</p> | ||
<ul>{usersToDelete.map(username => <li key={username}>{username}</li>)}</ul> | ||
</Fragment> | ||
) : null} | ||
<p>This operation cannot be undone.</p> | ||
</div> | ||
</EuiConfirmModal> | ||
</EuiOverlayMask> | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related to the user management changeset, or is it a fix for an unrelated flaky test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated flaky test, @stacey-gammon opened a bug for it.