Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
262bf51b
Unverified
Commit
262bf51b
authored
6 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Make a getSortedUsers selector
parent
60d77f17
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx
+2
-13
2 additions, 13 deletions
...src/metabase/admin/people/containers/PeopleListingApp.jsx
frontend/src/metabase/admin/people/selectors.js
+16
-0
16 additions, 0 deletions
frontend/src/metabase/admin/people/selectors.js
with
18 additions
and
13 deletions
frontend/src/metabase/admin/people/containers/PeopleListingApp.jsx
+
2
−
13
View file @
262bf51b
...
...
@@ -2,7 +2,6 @@
import
React
,
{
Component
}
from
"
react
"
;
import
PropTypes
from
"
prop-types
"
;
import
{
Link
}
from
"
react-router
"
;
import
_
from
"
underscore
"
;
import
{
connect
}
from
"
react-redux
"
;
import
LoadingAndErrorWrapper
from
"
metabase/components/LoadingAndErrorWrapper.jsx
"
;
...
...
@@ -30,7 +29,7 @@ export const MODAL_RESET_PASSWORD_EMAIL = "MODAL_RESET_PASSWORD_EMAIL";
export
const
MODAL_USER_ADDED_WITH_INVITE
=
"
MODAL_USER_ADDED_WITH_INVITE
"
;
export
const
MODAL_USER_ADDED_WITH_PASSWORD
=
"
MODAL_USER_ADDED_WITH_PASSWORD
"
;
import
{
getUsers
,
getModal
,
getGroups
}
from
"
../selectors
"
;
import
{
get
Sorted
Users
,
getModal
,
getGroups
}
from
"
../selectors
"
;
import
{
createUser
,
deleteUser
,
...
...
@@ -48,7 +47,7 @@ import {
const
mapStateToProps
=
(
state
,
props
)
=>
{
return
{
users
:
getUsers
(
state
,
props
),
users
:
get
Sorted
Users
(
state
,
props
),
modal
:
getModal
(
state
,
props
),
user
:
state
.
currentUser
,
groups
:
getGroups
(
state
,
props
),
...
...
@@ -402,16 +401,6 @@ export default class PeopleListingApp extends Component {
let
{
modal
,
users
,
groups
}
=
this
.
props
;
let
{
error
}
=
this
.
state
;
// sort the users list by last_name, ignore case or diacritical marks. If last names are the same then compare by
// first name
const
compareNames
=
(
a
,
b
)
=>
a
.
localeCompare
(
b
,
undefined
,
{
sensitivty
:
"
base
"
});
users
=
_
.
values
(
users
).
sort
(
(
a
,
b
)
=>
compareNames
(
a
.
last_name
,
b
.
last_name
)
||
compareNames
(
a
.
first_name
,
b
.
first_name
),
);
return
(
<
LoadingAndErrorWrapper
loading
=
{
!
users
}
error
=
{
error
}
>
{
()
=>
(
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/admin/people/selectors.js
+
16
−
0
View file @
262bf51b
...
...
@@ -23,3 +23,19 @@ export const getUsers = createSelector(
.
value
(),
})),
);
// sort the users list by last_name, ignore case or diacritical marks. If last names are the same then compare by first
// name
const
compareNames
=
(
a
,
b
)
=>
a
.
localeCompare
(
b
,
undefined
,
{
sensitivty
:
"
base
"
});
export
const
getSortedUsers
=
createSelector
(
[
getUsers
],
users
=>
users
&&
_
.
values
(
users
).
sort
(
(
a
,
b
)
=>
compareNames
(
a
.
last_name
,
b
.
last_name
)
||
compareNames
(
a
.
first_name
,
b
.
first_name
),
),
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment