<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'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}}/applications/{{application.name}}">Settings</a></li>
        <li data-ng-show="!application.bearerOnly && !application.publicClient"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/credentials">Credentials</a></li>
        <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/installation">Installation</a></li>
        <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles">Roles</a></li>
        <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/claims">Claims</a></li>
        <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/scope-mappings">Scope</a></li>
        <li><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/revocation">Revocation</a></li>
        <li class="active"><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/sessions">Sessions</a></li>
    </ul>
    <h2></h2>
    <div id="content">
        <h2><span>{{application.name}}</span> Sessions</h2>
        <form class="form-horizontal" name="sessionStats">
            <fieldset class="border-top">
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="activeSessions">Active Sessions</label>
                    <div class="col-sm-4">
                        <input class="form-control" type="text" id="activeSessions" name="activeSessions" data-ng-model="count" ng-disabled="true">
                    </div>
                </div>
            </fieldset>
        </form>
        <table class="table table-striped table-bordered" data-ng-show="count > 0">
            <thead>
            <tr data-ng-hide="sessions">
                <th class="kc-table-actions" colspan="3">
                    <div class="pull-right">
                        <a class="btn btn-primary" ng-click="loadUsers()">Show Sessions</a>
                    </div>
                </th>
            </tr>
            <tr data-ng-show="sessions">
                <th>User</th>
                <th>From IP</th>
                <th>Session Start</th>
            </tr>
            </thead>
            <tfoot data-ng-show="sessions">
            <tr>
                <td colspan="7">
                    <div class="table-nav">
                        <button data-ng-click="firstPage()" class="first" ng-disabled="query.first == 0">First page</button>
                        <button data-ng-click="previousPage()" class="prev" ng-disabled="query.first == 0">Previous page</button>
                        <button data-ng-click="nextPage()" class="next" ng-disabled="sessions.length < query.max">Next page</button>
                    </div>
                </td>
            </tr>
            </tfoot>
            <tbody>
            <tr data-ng-repeat="session in sessions">
                <td><a href="#/realms/{{realm.realm}}/users/{{session.user}}">{{session.user}}</a></td>
                <td>{{session.ipAddress}}</td>
                <td>{{session.start | date:'medium'}}</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>