Skip to content

Commit

Permalink
Add last_active_at column to users page (re #155)
Browse files Browse the repository at this point in the history
  • Loading branch information
alison985 authored and jezdez committed Jan 25, 2019
1 parent 17290cb commit e6d88ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/app/pages/users/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
Joined
<sort-icon column="'created_at'" sort-column="$ctrl.paginator.orderByField" reverse="$ctrl.paginator.orderByReverse"></sort-icon>
</th>
<th class="sortable-column" ng-click="$ctrl.paginator.orderBy('last_active_at')">
Last Active At
<sort-icon column="'last_active_at'" sort-column="$ctrl.paginator.orderByField" reverse="$ctrl.paginator.orderByReverse"></sort-icon>
</th>
<th width="1%"></th>
</tr>
</thead>
Expand All @@ -62,6 +66,9 @@
<td>
<span am-time-ago="user.created_at"></span>
</td>
<td>
<span am-time-ago="user.last_active_at"</span>
</td>
<td>
<div ng-if="$ctrl.currentUser.hasPermission('admin') && (user.id != $ctrl.currentUser.id)">
<button type="button" class="btn btn-primary" ng-if="user.is_disabled" ng-click="$ctrl.enableUser(user)">Enable</button>
Expand Down
2 changes: 2 additions & 0 deletions redash/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ def to_dict(self, with_api_key=False):
if with_api_key:
d['api_key'] = self.api_key

d['last_active_at'] = Event.query.filter(Event.user_id == self.id).with_entities(Event.created_at).order_by(Event.created_at.desc()).first()

return d

def is_api_user(self):
Expand Down

0 comments on commit e6d88ad

Please sign in to comment.