<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="resourceUrl + '/partials/realm-menu.html'"></div>
<div id="content-area" class="col-md-9" role="main">
    <ul class="nav nav-tabs nav-tabs-pf">
        <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li>
        <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}/user-credentials">Credentials</a></li>
        <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}/role-mappings">Role Mappings</a></li>
        <li class="active"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/sessions">Sessions</a></li>
        <li data-ng-show="realm.identityFederationEnabled"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/federated-identity">Federated Identities</a></li>
    </ul>
    <div id="content">
        <ol class="breadcrumb">
            <li><a href="#/realms/{{realm.realm}}/users">Users</a></li>
            <li><a href="#/realms/{{realm.realm}}/users/{{user.username}}">{{user.username}}</a></li>
            <li class="active">Sessions</li>
        </ol>
        <h2>User <span>{{user.username}}'s</span> Sessions <span tooltip-placement="right" tooltip="View active logins of this user." class="fa fa-info-circle"></span></h2>
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th class="kc-table-actions" colspan="6">
                    <div class="pull-right">
                        <a class="btn btn-primary" ng-click="logoutAll()">Logout All Sessions</a>
                    </div>
                </th>
            </tr>
            <tr>
                <th>IP Address</th>
                <th>Started</th>
                <th>Last Access</th>
                <th>Applications</th>
                <th>OAuth Clients</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
            <tr data-ng-repeat="session in sessions">
                <td>{{session.ipAddress}}</td>
                <td>{{session.start | date:'medium'}}</td>
                <td>{{session.lastAccess | date:'medium'}}</td>
                <td>
                    <div data-ng-repeat="(id, name) in session.applications">
                        <a href="#/realms/{{realm.realm}}/applications/{{id}}">{{name}}</a>
                    </div>
                </ul>
                </td>
                <td>
                    <div data-ng-repeat="(clientId, clientName) in session.clients">
                        <a href="#/realms/{{realm.realm}}/oauth-clients/{{clientId}}">{{clientName}}</a>
                    </div>
                </td>
                <td><a href="" ng-click="logoutSession(session.id)">logout</a> </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>