Skip to content

Commit

Permalink
[MNOE-1230] Improve user table and user info
Browse files Browse the repository at this point in the history
  • Loading branch information
jin521 committed Jul 2, 2018
1 parent 73d70ba commit ff17940
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
43 changes: 38 additions & 5 deletions src/app/components/mnoe-users-list/mno-users-list.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
$translate([
"mnoe_admin_panel.dashboard.users.widget.list.table.created_at",
'mnoe_admin_panel.dashboard.users.widget.list.table.username',
"mnoe_admin_panel.dashboard.users.widget.list.table.uid",
"mnoe_admin_panel.dashboard.users.widget.list.table.external_id",
"mnoe_admin_panel.dashboard.users.widget.list.table.last_active_at",
'mnoe_admin_panel.dashboard.users.widget.list.never',
'mnoe_admin_panel.dashboard.users.widget.list.table.last_login'])
.then((locale) ->
Expand All @@ -46,6 +49,36 @@
""",
scope: { user: user }
skip_natural: true}
# User uid
{ header: locale["mnoe_admin_panel.dashboard.users.widget.list.table.uid"]
style: {width: '130px'}
attr:'uid'
render: (user) ->
template:
"<span>{{::user.uid}}</span>"
scope: {user: user}
skip_natural: true}
# User external_id
{ header: locale["mnoe_admin_panel.dashboard.users.widget.list.table.external_id"]
style: {width: '130px'}
attr:'external_id'
render: (user) ->
template:
"<span>{{::user.external_id}}</span>"
scope: {user: user}
skip_natural: true}
# User last_active_at
{ header: locale["mnoe_admin_panel.dashboard.users.widget.list.table.last_active_at"],
style: {width: '130px'},
attr:'last_active_at'
render: (user) ->
template: """
<span data-toggle="tooltip" title="{{::user.last_active_at | date: 'H:m - dd/MM/yyyy'}}">
{{(user.last_active_at | amTimeAgo) || ('mnoe_admin_panel.dashboard.users.widget.list.never' | translate)}}
</span>
""",
scope: {user: user}
skip_natural: true}
# User last login date
{ header: locale['mnoe_admin_panel.dashboard.users.widget.list.table.last_login']
attr: "last_sign_in_at"
Expand All @@ -63,11 +96,11 @@
style: {width: '130px'},
attr:'created_at',
sort_default: "reverse"
skip_natural: true
render: (user) ->
template:
"<span>{{::user.created_at | date: 'dd/MM/yyyy'}}</span>"
scope: {user: user}}]
scope: {user: user}
skip_natural: true}]
)

# Pipe for the sortable-table
Expand Down Expand Up @@ -107,8 +140,8 @@
scope.users.switchLinkTitle = 'mnoe_admin_panel.dashboard.users.widget.list.all_users.switch_link_title'

scope.searchChange = () ->
# Only search if the string is >= than 3 characters
if scope.users.search.length >= 3
# After adding external_id in the search term update the minimum string length in the search from >= 3 to >=0
if scope.users.search.length >= 0
scope.searchMode = true
setSearchUsersList(scope.users.search)
# No search string, so display current state
Expand All @@ -122,7 +155,7 @@
scope.users.widgetTitle = 'mnoe_admin_panel.dashboard.users.widget.list.search_users.title'
delete scope.users.switchLinkTitle
search = scope.users.search.toLowerCase()
terms = {'surname.like': "#{search}%", 'name.like': "#{search}%", 'email.like': "%#{search}%" }
terms = {'surname.like': "#{search}%", 'name.like': "#{search}%", 'email.like': "%#{search}%", 'uid.like': "%#{search}%", 'external_id.like': "%#{search}%"}
params = scope.filterParams || {}
MnoeUsers.search(terms, params).then(
(response) ->
Expand Down
8 changes: 8 additions & 0 deletions src/app/views/user/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ <h3 ng-show="!vm.user.name && !vm.user.surname" class="panel-title">{{::vm.user.
<div class="col-md-3"><div class="label-cell" translate>mnoe_admin_panel.dashboard.user.table.uid</div></div>
<div class="col-md-3">{{::vm.user.uid}}</div>
</div>
<div class="row">
<div class="col-md-3"><div class="label-cell" translate>mnoe_admin_panel.dashboard.user.table.external_id</div></div>
<div class="col-md-3">{{::vm.user.external_id}}</div>
</div>
<div class="row">
<div class="col-md-3"><div class="label-cell" translate>mnoe_admin_panel.dashboard.user.table.last_active_at</div></div>
<div class="col-sm-3">{{vm.user.last_active_at || ('mnoe_admin_panel.dashboard.user.table.last_active_at.never' | translate)}}</div>
</div>
<div class="row">
<div class="col-md-3"><div class="label-cell" translate>mnoe_admin_panel.dashboard.user.table.phone</div></div>
<div class="col-md-3">{{vm.user.phone || ('mnoe_admin_panel.dashboard.user.table.phone.none' | translate)}}</div>
Expand Down
11 changes: 10 additions & 1 deletion src/locales/en-AU.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@
"mnoe_admin_panel.dashboard.user.subtitle": "User info",
"mnoe_admin_panel.dashboard.user.table.email": "Email",
"mnoe_admin_panel.dashboard.user.table.uid": "UID",
"mnoe_admin_panel.dashboard.user.table.external_id": "External ID",
"mnoe_admin_panel.dashboard.user.table.last_active_at": "Last Active",
"mnoe_admin_panel.dashboard.user.table.last_active_at.never": "(never)",
"mnoe_admin_panel.dashboard.user.table.phone": "Phone",
"mnoe_admin_panel.dashboard.user.table.phone.none": "(none)",
"mnoe_admin_panel.dashboard.user.table.admin_role": "Admin Role",
Expand Down Expand Up @@ -289,7 +292,10 @@
"mnoe_admin_panel.dashboard.users.widget.list.table.username": "Username",
"mnoe_admin_panel.dashboard.users.widget.list.table.last_login": "Last login",
"mnoe_admin_panel.dashboard.users.widget.local_list.last_login.never": "n/a",
"mnoe_admin_panel.dashboard.users.widget.list.table.created_at": "Created at",
"mnoe_admin_panel.dashboard.users.widget.list.table.created_at": "Created At",
"mnoe_admin_panel.dashboard.users.widget.list.table.uid": "UID",
"mnoe_admin_panel.dashboard.users.widget.list.table.external_id": "External ID",
"mnoe_admin_panel.dashboard.users.widget.list.table.last_active_at": "Last Active",
"mnoe_admin_panel.dashboard.users.widget.list.table.lock": "This user is locked",
"mnoe_admin_panel.dashboard.users.widget.list.never": "never",
"mnoe_admin_panel.dashboard.users.widget.local_list.all_users.title": "All users ({length})",
Expand Down Expand Up @@ -416,6 +422,9 @@
"mnoe_admin_panel.dashboard.organization.widget.list.search_users.title": "Search result",
"mnoe_admin_panel.dashboard.organization.widget.list.search_users.placeholder.search_all": "Search all",
"mnoe_admin_panel.dashboard.organization.widget.list.table.name": "Name",
"mnoe_admin_panel.dashboard.organization.widget.list.table.uid": "UID",
"mnoe_admin_panel.dashboard.organization.widget.list.table.external_id": "External ID",
"mnoe_admin_panel.dashboard.organization.widget.list.table.last_active_at": "Last Active At",
"mnoe_admin_panel.dashboard.organization.widget.list.table.creation": "Creation",
"mnoe_admin_panel.dashboard.organization.widget.list.table.revenue": "Revenue",
"mnoe_admin_panel.dashboard.organization.widget.list.table.margin": "Margin",
Expand Down

0 comments on commit ff17940

Please sign in to comment.