<div class="col-md-12">
  <h1>Server Info</h1>

  <table class="table table-striped table-bordered">
    <tr>
        <td width="20%">Keycloak Version</td>
        <td>{{serverInfoPage.version}}</td>
    </tr>
    <tr>
        <td>Server Time</td>
        <td>{{serverInfoPage.serverTime}} (<a style="cursor: pointer" data-ng-click="serverInfoPageUpdate()">update</a>)</td>
    </tr>
    <tr>
        <td>Server Uptime</td>
        <td>{{serverInfoPage.serverUptime}}</td>
    </tr>
  </table>

	<fieldset>
	  <legend>Java VM Memory Statistics</legend>
	  <div class="form-group">
	    <table class="table table-striped table-bordered" style="margin-top: 0px;">
	        <tr>
	            <td width="20%">Total Memory</td>
	            <td>{{serverInfoPage.memoryInfo.totalFormated}}</td>
	        </tr>
	        <tr>
	            <td>Free Memory</td>
	            <td>{{serverInfoPage.memoryInfo.freeFormated}} ({{serverInfoPage.memoryInfo.freePercentage}}%)</td>
	        </tr>
	        <tr>
	            <td>Used Memory</td>
	            <td>{{serverInfoPage.memoryInfo.usedFormated}}</td>
	        </tr>
	   	</table>
		</div>
	</fieldset>
	
    <fieldset>
        <legend collapsed>System Info</legend>
        <div class="form-group">
        <table class="table table-striped table-bordered" style="margin-top: 0px;">
        <tr>
            <td width="20%">Current Working Directory</td>
            <td>{{serverInfoPage.systemInfo.userDir}}</td>
        </tr>
        <tr>
            <td>Java Version</td>
            <td>{{serverInfoPage.systemInfo.javaVersion}}</td>
        </tr>
        <tr>
            <td>Java Vendor</td>
            <td>{{serverInfoPage.systemInfo.javaVendor}}</td>
        </tr>
        <tr>
            <td>Java Runtime</td>
            <td>{{serverInfoPage.systemInfo.javaRuntime}}</td>
        </tr>
        <tr>
            <td>Java VM</td>
            <td>{{serverInfoPage.systemInfo.javaVm}}</td>
        </tr>
        <tr>
            <td>Java VM Version</td>
            <td>{{serverInfoPage.systemInfo.javaVmVersion}}</td>
        </tr>
        <tr>
            <td>Java Home</td>
            <td>{{serverInfoPage.systemInfo.javaHome}}</td>
        </tr>
        <tr>
            <td>User Name</td>
            <td>{{serverInfoPage.systemInfo.userName}}</td>
        </tr>
        <tr>
            <td>User Timezone</td>
            <td>{{serverInfoPage.systemInfo.userTimezone}}</td>
        </tr>
        <tr>
            <td>User Locale</td>
            <td>{{serverInfoPage.systemInfo.userLocale}}</td>
        </tr>
        <tr>
            <td>System Encoding</td>
            <td>{{serverInfoPage.systemInfo.fileEncoding}}</td>
        </tr>
        <tr>
            <td>Operating System</td>
            <td>{{serverInfoPage.systemInfo.osName}} {{serverInfoPage.systemInfo.osVersion}}</td>
        </tr>
        <tr>
            <td>OS Architecture</td>
            <td>{{serverInfoPage.systemInfo.osArchitecture}}</td>
        </tr>
        </table>
        </div>
    </fieldset>    

   	
    <fieldset ng-show="serverInfoPage.jpaInfo">
        <legend collapsed>Database Info</legend>
        <div class="form-group">
        <table class="table table-striped table-bordered" style="margin-top: 0px;">
        	<tr ng-repeat="(key, value) in serverInfoPage.jpaInfo">
            <td width="20%">{{key}}</td>
            <td>{{value}}</td>
        	</tr>
        </table>
        </div>
    </fieldset>    

    <fieldset>
        <legend collapsed>Providers</legend>

        <div class="form-group">
            <h3>Public SPIs</h3>
            <kc-tooltip>For public SPIs there are built-in providers, but it's also supported to write your own custom providers.</kc-tooltip>

            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th width="20%">SPI</th>
                    <th>Providers</th>
                </tr>
                </thead>
                <tbody>
                <tr data-ng-repeat="spi in (serverInfoPage.providers | filter:{internal:false} | orderBy:'name')">
                    <td>{{spi.name}}</td>
                    <td>
                        <div data-ng-repeat="provider in (spi.implementations | orderBy:'name')">
                            {{provider.name}}
                            <span ng-show="provider.operationalInfo">
                            	<button type="button" class="btn btn-default btn-xs" ng-click="collapseRep = !collapseRep">
                                <span class="glyphicon glyphicon-plus" data-ng-show="!collapseRep"></span>
                                <span class="glyphicon glyphicon-minus" data-ng-show="collapseRep"></span>
                              </button>
	                            <table ng-show="collapseRep" class="table table-striped table-bordered" style="margin-top: 0px;">
											        	<tr ng-repeat="(key, value) in provider.operationalInfo">
											            <td width="20%">{{key}}</td>
											            <td>{{value}}</td>
											        	</tr>
											        </table>
										        </span>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="form-group">
            <h3>Internal SPIs</h3>
            <kc-tooltip>For internal SPIs there are only built-in providers. It's not recommended to write your own custom providers as internal SPIs may change or be removed without notice.</kc-tooltip>

            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th width="20%">SPI</th>
                    <th>Providers</th>
                </tr>
                </thead>
                <tbody>
                <tr data-ng-repeat="spi in (serverInfoPage.providers | filter:{internal:true} | orderBy:'name')">
                    <td>{{spi.name}}</td>
                    <td>
                        <div data-ng-repeat="provider in (spi.implementations | orderBy:'name')">
                            {{provider.name}}
                            <span ng-show="provider.operationalInfo">
                            	<button type="button" class="btn btn-default btn-xs" ng-click="collapseRep = !collapseRep">
                                <span class="glyphicon glyphicon-plus" data-ng-show="!collapseRep"></span>
                                <span class="glyphicon glyphicon-minus" data-ng-show="collapseRep"></span>
                              </button>
	                            <table ng-show="collapseRep" class="table table-striped table-bordered" style="margin-top: 0px;">
											        	<tr ng-repeat="(key, value) in provider.operationalInfo">
											            <td width="20%">{{key}}</td>
											            <td>{{value}}</td>
											        	</tr>
											        </table>
										        </span>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
</div>