-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Translate security/users component #23940
Merged
pavel06081991
merged 8 commits into
elastic:master
from
tibmt:feature/translations/security/users
Oct 29, 2018
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1b760ba
Translate security/users component
tibmt fd1afca
Merge branch 'master' into feature/translations/security/users
tibmt f26a9a8
update security/users component
tibmt ec702a9
Merge branch 'master' into feature/translations/security/users
tibmt efecec8
update translation of security/users component
tibmt 792321f
Update snapshot
maryia-lapata 9a6f709
Merge branch 'master' into feature/translations/security/users
tibmt aa6dee7
update security/users translation
tibmt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,52 +7,86 @@ | |
import React, { Component, Fragment } from 'react'; | ||
import { EuiOverlayMask, EuiConfirmModal } from '@elastic/eui'; | ||
import { toastNotifications } from 'ui/notify'; | ||
export class ConfirmDelete extends Component { | ||
import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; | ||
|
||
export class ConfirmDeleteUI 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}`); | ||
toastNotifications.addSuccess( | ||
this.props.intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.userSuccessfullyDeletedNotificationMessage", | ||
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. Please remove |
||
defaultMessage: "Deleted user {username}" | ||
}, { username }) | ||
); | ||
} catch (e) { | ||
errors.push(username); | ||
toastNotifications.addDanger(`Error deleting user ${username}`); | ||
toastNotifications.addDanger( | ||
this.props.intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.userDeletingErrorNotificationMessage", | ||
defaultMessage: "Error deleting user {username}" | ||
}, { username }) | ||
); | ||
} | ||
if (callback) { | ||
callback(usersToDelete, errors); | ||
} | ||
}); | ||
}; | ||
render() { | ||
const { usersToDelete, onCancel } = this.props; | ||
const { usersToDelete, onCancel, intl } = this.props; | ||
const moreThanOne = usersToDelete.length > 1; | ||
const title = moreThanOne | ||
? `Delete ${usersToDelete.length} users` | ||
: `Delete user '${usersToDelete[0]}'`; | ||
? intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.deleteMultipleUsersTitle", | ||
defaultMessage: "Delete {userLength} users" | ||
}, { userLength: usersToDelete.length }) | ||
: intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.deleteOneUserTitle", | ||
defaultMessage: "Delete user {userLength}" | ||
}, { userLength: usersToDelete[0] }); | ||
return ( | ||
<EuiOverlayMask> | ||
<EuiConfirmModal | ||
title={title} | ||
onCancel={onCancel} | ||
onConfirm={this.deleteUsers} | ||
cancelButtonText="Cancel" | ||
confirmButtonText="Delete" | ||
cancelButtonText={intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.cancelButtonLabel", | ||
defaultMessage: "Cancel" | ||
})} | ||
confirmButtonText={intl.formatMessage({ | ||
id: "xpack.security.components.management.users.confirmDelete.confirmButtonLabel", | ||
defaultMessage: "Delete" | ||
})} | ||
buttonColor="danger" | ||
> | ||
<div> | ||
{moreThanOne ? ( | ||
<Fragment> | ||
<p> | ||
You are about to delete these users: | ||
<FormattedMessage | ||
id="xpack.security.components.management.users.confirmDelete.removingUsersDescription" | ||
defaultMessage="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> | ||
<p> | ||
<FormattedMessage | ||
id="xpack.security.components.management.users.confirmDelete.removingUsersWarningMessage" | ||
defaultMessage="This operation cannot be undone." | ||
/> | ||
</p> | ||
</div> | ||
</EuiConfirmModal> | ||
</EuiOverlayMask> | ||
); | ||
} | ||
} | ||
|
||
export const ConfirmDelete = injectI18n(ConfirmDeleteUI); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please remove
export
.