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

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;
});
});
});