simplify the sessions UI

This commit is contained in:
Girish Ramakrishnan
2019-11-07 14:28:52 -08:00
parent 836a3659b6
commit 0c5930d5cf
2 changed files with 5 additions and 14 deletions
+2 -7
View File
@@ -295,13 +295,8 @@
<div class="grid-item-top">
<div class="row">
<div class="col-xs-12">
<p>You have {{ activeClients.length + 1 }} active session(s), including this one.</p>
<span ng-show="activeTokenCount > 1">
<br/>
<h4>Active Sessions:</h4>
<p ng-repeat="client in activeClients"><b>{{ client.name }} - {{client.activeTokens.length}} time(s)</b></p>
<br/>
</span>
<p>You have {{ webadminClient.activeTokens.length }} active web session(s) and {{ cliClient.activeTokens.length }} CLI token(s).</p>
<button class="btn btn-outline btn-danger pull-right" ng-click="revokeTokens()">Logout From All</button>
</div>
</div>
+3 -7
View File
@@ -8,10 +8,10 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
$scope.user = Client.getUserInfo();
$scope.config = Client.getConfig();
$scope.activeTokens = 0;
$scope.activeClients = [];
$scope.webadminClient = {};
$scope.apiClient = {};
$scope.cliClient = {};
$scope.showApiTokens = !!$location.search().tokens;
$scope.twoFactorAuthentication = {
@@ -391,13 +391,9 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
asyncForEach(activeClients, refreshClientTokens, function () {
$scope.webadminClient = activeClients.filter(function (c) { return c.id === 'cid-webadmin'; })[0];
$scope.apiClient = activeClients.filter(function (c) { return c.id === 'cid-sdk'; })[0];
$scope.cliClient = activeClients.filter(function (c) { return c.id === 'cid-cli'; })[0];
activeClients = activeClients.filter(function (c) { return c.activeTokens.length > 0; });
$scope.activeClients = activeClients.filter(function (c) { return c.id !== 'cid-sdk' && c.id !== 'cid-webadmin'; });
$scope.activeTokenCount = $scope.activeClients.reduce(function (prev, cur) { return prev + cur.activeTokens.length; }, 0);
$scope.activeTokenCount += $scope.webadminClient ? $scope.webadminClient.activeTokens.length : 0;
$scope.activeClients = activeClients;
});
});
});