aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/users
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-12-12 10:58:10 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-12-15 14:25:12 +0100
commitf26d933e1ecbd9ca104a6e1e0eb251462056aca8 (patch)
treead92814bbafd3fcf985fa14a173cb7f825821285 /server/sonar-web/src/main/js/apps/users
parent090c2183e379ad52500727038e3bab72d74e0dfa (diff)
downloadsonarqube-f26d933e1ecbd9ca104a6e1e0eb251462056aca8.tar.gz
sonarqube-f26d933e1ecbd9ca104a6e1e0eb251462056aca8.zip
update react to 16.2.0, use react fragments
Diffstat (limited to 'server/sonar-web/src/main/js/apps/users')
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserActions.tsx54
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UserActions-test.tsx.snap37
2 files changed, 38 insertions, 53 deletions
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
index 9c5f64fccea..4d3302709f0 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserActions.tsx
@@ -49,7 +49,7 @@ export default class UserActions extends React.PureComponent<Props, State> {
renderActions = () => {
const { user } = this.props;
return (
- <ActionsDropdown key="actions" menuClassName="dropdown-menu-right">
+ <ActionsDropdown menuClassName="dropdown-menu-right">
<ActionsDropdownItem className="js-user-update" onClick={this.handleOpenUpdateForm}>
{translate('update_details')}
</ActionsDropdownItem>
@@ -75,39 +75,23 @@ export default class UserActions extends React.PureComponent<Props, State> {
const { openForm } = this.state;
const { isCurrentUser, onUpdateUsers, user } = this.props;
- if (openForm === 'deactivate') {
- return [
- this.renderActions(),
- <DeactivateForm
- key="form"
- onClose={this.handleCloseForm}
- onUpdateUsers={onUpdateUsers}
- user={user}
- />
- ];
- }
- if (openForm === 'password') {
- return [
- this.renderActions(),
- <PasswordForm
- isCurrentUser={isCurrentUser}
- key="form"
- onClose={this.handleCloseForm}
- user={user}
- />
- ];
- }
- if (openForm === 'update') {
- return [
- this.renderActions(),
- <UserForm
- key="form"
- onClose={this.handleCloseForm}
- onUpdateUsers={onUpdateUsers}
- user={user}
- />
- ];
- }
- return this.renderActions();
+ return (
+ <React.Fragment>
+ {this.renderActions()}
+ {openForm === 'deactivate' && (
+ <DeactivateForm
+ onClose={this.handleCloseForm}
+ onUpdateUsers={onUpdateUsers}
+ user={user}
+ />
+ )}
+ {openForm === 'password' && (
+ <PasswordForm isCurrentUser={isCurrentUser} onClose={this.handleCloseForm} user={user} />
+ )}
+ {openForm === 'update' && (
+ <UserForm onClose={this.handleCloseForm} onUpdateUsers={onUpdateUsers} user={user} />
+ )}
+ </React.Fragment>
+ );
}
}
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UserActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UserActions-test.tsx.snap
index 6328daaf8e0..0fd31e7f6ae 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UserActions-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/__snapshots__/UserActions-test.tsx.snap
@@ -1,23 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render correctly 1`] = `
-<ActionsDropdown
- key="actions"
- menuClassName="dropdown-menu-right"
->
- <ActionsDropdownItem
- className="js-user-update"
- onClick={[Function]}
+<React.Fragment>
+ <ActionsDropdown
+ menuClassName="dropdown-menu-right"
>
- update_details
- </ActionsDropdownItem>
- <ActionsDropdownDivider />
- <ActionsDropdownItem
- className="js-user-deactivate"
- destructive={true}
- onClick={[Function]}
- >
- users.deactivate
- </ActionsDropdownItem>
-</ActionsDropdown>
+ <ActionsDropdownItem
+ className="js-user-update"
+ onClick={[Function]}
+ >
+ update_details
+ </ActionsDropdownItem>
+ <ActionsDropdownDivider />
+ <ActionsDropdownItem
+ className="js-user-deactivate"
+ destructive={true}
+ onClick={[Function]}
+ >
+ users.deactivate
+ </ActionsDropdownItem>
+ </ActionsDropdown>
+</React.Fragment>
`;