Skip to content

Commit

Permalink
Add last_active_at column to users page (re getredash#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
alison985 authored and jezdez committed Aug 16, 2018
1 parent ba80c43 commit ff55413
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 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 All @@ -74,4 +81,4 @@
<paginator paginator="$ctrl.paginator"></paginator>
</div>
</div>
</settings-screen>
</settings-screen>
2 changes: 2 additions & 0 deletions redash/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,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 ff55413

Please sign in to comment.