aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/users
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-08-10 16:02:22 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-10 20:21:32 +0200
commitd3530ff0004d44a2c4e9140ff9cc7774b8bc38a4 (patch)
tree03ad7aa9ab7d9bcfb0f5b354149da9c014052010 /server/sonar-web/src/main/js/apps/users
parent29b5f4a0ebf686f9dee7f1d6c6eab65fe381654d (diff)
downloadsonarqube-d3530ff0004d44a2c4e9140ff9cc7774b8bc38a4.tar.gz
sonarqube-d3530ff0004d44a2c4e9140ff9cc7774b8bc38a4.zip
update main dependencies & fix autofixable eslint warnings (#601)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/users')
-rw-r--r--server/sonar-web/src/main/js/apps/users/Search.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/users/UsersList.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx16
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/users/utils.ts17
10 files changed, 34 insertions, 31 deletions
diff --git a/server/sonar-web/src/main/js/apps/users/Search.tsx b/server/sonar-web/src/main/js/apps/users/Search.tsx
index 5df5684f10c..8ffb2ff98ff 100644
--- a/server/sonar-web/src/main/js/apps/users/Search.tsx
+++ b/server/sonar-web/src/main/js/apps/users/Search.tsx
@@ -36,7 +36,7 @@ export default class Search extends React.PureComponent<Props> {
const { query } = this.props;
return (
- <div id="users-search" className="panel panel-vertical bordered-bottom spacer-bottom">
+ <div className="panel panel-vertical bordered-bottom spacer-bottom" id="users-search">
<SearchBox
minLength={2}
onChange={this.handleSearch}
diff --git a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
index e0ea3203655..edefebb1086 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx
@@ -124,7 +124,7 @@ export default class UsersApp extends React.PureComponent<Props, State> {
const query = parseQuery(this.props.location.query);
const { loading, paging, users } = this.state;
return (
- <div id="users-page" className="page page-limited">
+ <div className="page page-limited" id="users-page">
<Suggestions suggestions="users" />
<Helmet title={translate('users.page')} />
<Header loading={loading} onUpdateUsers={this.fetchUsers} />
@@ -140,9 +140,9 @@ export default class UsersApp extends React.PureComponent<Props, State> {
{paging !== undefined && (
<ListFooter
count={users.length}
- total={paging.total}
- ready={!loading}
loadMore={this.fetchMoreUsers}
+ ready={!loading}
+ total={paging.total}
/>
)}
</div>
diff --git a/server/sonar-web/src/main/js/apps/users/UsersList.tsx b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
index de981b356f0..8888af81c51 100644
--- a/server/sonar-web/src/main/js/apps/users/UsersList.tsx
+++ b/server/sonar-web/src/main/js/apps/users/UsersList.tsx
@@ -41,7 +41,7 @@ export default function UsersList({
}: Props) {
return (
<div className="boxed-group boxed-group-inner">
- <table id="users-list" className="data zebra">
+ <table className="data zebra" id="users-list">
<thead>
<tr>
<th />
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
index dceecaeafd1..53ab715e8da 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx
@@ -54,14 +54,14 @@ export default class UserGroups extends React.PureComponent<Props, State> {
return (
<ul>
{groups.slice(0, limit).map(group => (
- <li key={group} className="little-spacer-bottom">
+ <li className="little-spacer-bottom" key={group}>
{group}
</li>
))}
{groups.length > GROUPS_LIMIT &&
this.state.showMore &&
groups.slice(limit).map(group => (
- <li key={group} className="little-spacer-bottom">
+ <li className="little-spacer-bottom" key={group}>
{group}
</li>
))}
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
index 4848a05c853..33562848989 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx
@@ -62,7 +62,7 @@ export default class UserListItem extends React.PureComponent<Props, State> {
</td>
{!organizationsEnabled && (
<td>
- <UserGroups groups={user.groups || []} user={user} onUpdateUsers={onUpdateUsers} />
+ <UserGroups groups={user.groups || []} onUpdateUsers={onUpdateUsers} user={user} />
</td>
)}
<td>
@@ -83,9 +83,9 @@ export default class UserListItem extends React.PureComponent<Props, State> {
</td>
{this.state.openTokenForm && (
<TokensFormModal
- user={user}
onClose={this.handleCloseTokensForm}
updateTokensCount={this.props.updateTokensCount}
+ user={user}
/>
)}
</tr>
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
index a609e1c9145..1d3ff144df0 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx
@@ -60,15 +60,15 @@ export function ExternalProvider({ identityProvider, user }: Props) {
<div
className="identity-provider"
style={{
- 'background-color': identityProvider.backgroundColor,
+ backgroundColor: identityProvider.backgroundColor,
color: getTextColor(identityProvider.backgroundColor, theme.secondFontColor)
}}>
<img
alt={identityProvider.name}
className="little-spacer-right"
+ height="14"
src={getBaseUrl() + identityProvider.iconPath}
width="14"
- height="14"
/>
{user.externalIdentity}
</div>
diff --git a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
index 07a6766077d..67938f2e702 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx
@@ -44,14 +44,14 @@ export default class UserScmAccounts extends React.PureComponent<Props, State> {
return (
<ul>
{scmAccounts.slice(0, limit).map((scmAccount, idx) => (
- <li key={idx} className="little-spacer-bottom">
+ <li className="little-spacer-bottom" key={idx}>
{scmAccount}
</li>
))}
{scmAccounts.length > SCM_LIMIT &&
(this.state.showMore ? (
scmAccounts.slice(limit).map((scmAccount, idx) => (
- <li key={idx + limit} className="little-spacer-bottom">
+ <li className="little-spacer-bottom" key={idx + limit}>
{scmAccount}
</li>
))
diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
index 7fb84c7f497..9628b48edc4 100644
--- a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx
@@ -103,19 +103,19 @@ export default class UsersSelectSearch extends React.PureComponent<Props, State>
<Select
autoFocus={this.props.autoFocus}
className="Select-big"
- options={this.state.searchResult}
+ clearable={false}
isLoading={this.state.isLoading}
- optionComponent={UsersSelectSearchOption}
- valueComponent={UsersSelectSearchValue}
+ labelKey="name"
+ noResultsText={noResult}
onChange={this.props.handleValueChange}
onInputChange={this.handleInputChange}
- value={this.props.selectedUser}
+ optionComponent={UsersSelectSearchOption}
+ options={this.state.searchResult}
placeholder=""
- noResultsText={noResult}
- labelKey="name"
- valueKey="login"
- clearable={false}
searchable={true}
+ value={this.props.selectedUser}
+ valueComponent={UsersSelectSearchValue}
+ valueKey="login"
/>
);
}
diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx
index 26210e9dfc7..87973ed58e4 100644
--- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx
+++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx
@@ -41,10 +41,10 @@ describe('UsersSelectSearch', () => {
const onSearch = jest.fn(() => Promise.resolve(users));
const wrapper = shallow(
<UsersSelectSearch
- selectedUser={selectedUser}
excludedUsers={excludedUsers}
handleValueChange={jest.fn()}
searchUsers={onSearch}
+ selectedUser={selectedUser}
/>
);
expect(wrapper).toMatchSnapshot();
@@ -57,7 +57,7 @@ describe('UsersSelectSearch', () => {
describe('UsersSelectSearchOption', () => {
it('should render correctly without all parameters', () => {
const wrapper = shallow(
- <UsersSelectSearchOption option={selectedUser} onFocus={jest.fn()} onSelect={jest.fn()}>
+ <UsersSelectSearchOption onFocus={jest.fn()} onSelect={jest.fn()} option={selectedUser}>
{selectedUser.name}
</UsersSelectSearchOption>
);
@@ -66,7 +66,7 @@ describe('UsersSelectSearchOption', () => {
it('should render correctly with email instead of hash', () => {
const wrapper = shallow(
- <UsersSelectSearchOption option={users[0]} onFocus={jest.fn()} onSelect={jest.fn()}>
+ <UsersSelectSearchOption onFocus={jest.fn()} onSelect={jest.fn()} option={users[0]}>
{users[0].name}
</UsersSelectSearchOption>
);
diff --git a/server/sonar-web/src/main/js/apps/users/utils.ts b/server/sonar-web/src/main/js/apps/users/utils.ts
index 937c46eadc1..abb0fcc3d78 100644
--- a/server/sonar-web/src/main/js/apps/users/utils.ts
+++ b/server/sonar-web/src/main/js/apps/users/utils.ts
@@ -24,12 +24,15 @@ export interface Query {
search: string;
}
-export const parseQuery = memoize((urlQuery: RawQuery): Query => ({
- search: parseAsString(urlQuery['search'])
-}));
-
-export const serializeQuery = memoize((query: Query): RawQuery =>
- cleanQuery({
- search: query.search ? serializeString(query.search) : undefined
+export const parseQuery = memoize(
+ (urlQuery: RawQuery): Query => ({
+ search: parseAsString(urlQuery['search'])
})
);
+
+export const serializeQuery = memoize(
+ (query: Query): RawQuery =>
+ cleanQuery({
+ search: query.search ? serializeString(query.search) : undefined
+ })
+);