-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* partial progress on reactifying users * progress on EUIfication of users screen * removing Angular stuff * adding data-test-subj="passwordConfirmationInput" * removing data-test-subj="userFormEmailInput" refs from tests * fixing selector for role assignment * some functional test fixes * fixing some functional tests * fixing last functional test * removing stray console log * fixing warnings * attempting to fix flaky test * trying again to fix flaky test * PR feedback * PR feedback * fixing issue where form tried to submit * adding sleep to allow user to load * Design edits Mainly adding wrapper EUI page elements, but also shifted around form elements. * Fixed console error and added responsive prop to table * addressing PR feedback * A few more PR feedback - Fixed alignment of table - Removed the tooltip from the lock icon and placed the description inline. - Changed delete button to an empty button * addressing more PR feedback * adding email field back in * adding back username validation * restoring original error message * fixing dumb null error
- Loading branch information
1 parent
218dfa2
commit 35dade2
Showing
16 changed files
with
965 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/security/public/components/management/users/confirm_delete.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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> | ||
); | ||
} | ||
} |
Oops, something went wrong.