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

  <table class="table table-striped table-bordered">
    <tr>
        <td width="20%">Keycloak Version</td>
        <td>{{serverInfo.version}}</td>
    </tr>
    <tr>
        <td>Server Time</td>
        <td>{{serverInfo.serverTime}} (<a style="cursor: pointer" data-ng-click="serverInfoUpdate()">update</a>)</td>
    </tr>
    <tr>
        <td>Server Uptime</td>
        <td>{{serverInfo.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>{{serverInfo.memoryInfo.totalFormated}}</td>
	        </tr>
	        <tr>
	            <td>Free Memory</td>
	            <td>{{serverInfo.memoryInfo.freeFormated}} ({{serverInfo.memoryInfo.freePercentage}}%)</td>
	        </tr>
	        <tr>
	            <td>Used Memory</td>
	            <td>{{serverInfo.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>{{serverInfo.systemInfo.userDir}}</td>
        </tr>
        <tr>
            <td>Java Version</td>
            <td>{{serverInfo.systemInfo.javaVersion}}</td>
        </tr>
        <tr>
            <td>Java Vendor</td>
            <td>{{serverInfo.systemInfo.javaVendor}}</td>
        </tr>
        <tr>
            <td>Java Runtime</td>
            <td>{{serverInfo.systemInfo.javaRuntime}}</td>
        </tr>
        <tr>
            <td>Java VM</td>
            <td>{{serverInfo.systemInfo.javaVm}}</td>
        </tr>
        <tr>
            <td>Java VM Version</td>
            <td>{{serverInfo.systemInfo.javaVmVersion}}</td>
        </tr>
        <tr>
            <td>Java Home</td>
            <td>{{serverInfo.systemInfo.javaHome}}</td>
        </tr>
        <tr>
            <td>User Name</td>
            <td>{{serverInfo.systemInfo.userName}}</td>
        </tr>
        <tr>
            <td>User Timezone</td>
            <td>{{serverInfo.systemInfo.userTimezone}}</td>
        </tr>
        <tr>
            <td>User Locale</td>
            <td>{{serverInfo.systemInfo.userLocale}}</td>
        </tr>
        <tr>
            <td>System Encoding</td>
            <td>{{serverInfo.systemInfo.fileEncoding}}</td>
        </tr>
        <tr>
            <td>Operating System</td>
            <td>{{serverInfo.systemInfo.osName}} {{serverInfo.systemInfo.osVersion}}</td>
        </tr>
        <tr>
            <td>OS Architecture</td>
            <td>{{serverInfo.systemInfo.osArchitecture}}</td>
        </tr>
        </table>
        </div>
    </fieldset>    

   	
    <fieldset ng-show="serverInfo.jpaInfo">
        <legend collapsed>Database Info</legend>
        <div class="form-group">
        <table class="table table-striped table-bordered" style="margin-top: 0px;">
    			<tr>
            <td width="20%">Database URL</td>
            <td>{{serverInfo.jpaInfo.jdbcUrl}}</td>
        	</tr>
        	<tr>
            <td>Database User</td>
            <td>{{serverInfo.jpaInfo.databaseUser}}</td>
        	</tr>    
        	<tr>
            <td>Database Type</td>
            <td>{{serverInfo.jpaInfo.databaseProduct}}</td>
        	</tr>
        	<tr>
            <td>Database Driver</td>
            <td>{{serverInfo.jpaInfo.databaseDriver}}</td>
        	</tr>
        </table>
        </div>
    </fieldset>    

    <fieldset ng-show="serverInfo.mongoDbInfo">
        <legend collapsed>Mongo DB Info</legend>
        <div class="form-group">
        <table class="table table-striped table-bordered" style="margin-top: 0px;">
    			<tr width="20%">
            <td>Address</td>
            <td>{{serverInfo.mongoDbInfo.address}}</td>
        	</tr>
        	<tr>
            <td>Database</td>
            <td>{{serverInfo.mongoDbInfo.database}}</td>
        	</tr>
        	<tr>
            <td>User</td>
            <td>{{serverInfo.mongoDbInfo.user}}</td>
        	</tr>    
        	<tr>
            <td>Driver Version</td>
            <td>{{serverInfo.mongoDbInfo.driverVersion}}</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 (serverInfo.providers | filter:{internal:false} | orderBy:'name')">
                    <td>{{spi.name}}</td>
                    <td>
                        <div data-ng-repeat="provider in (spi.implementations | orderBy:'toString()')">
                            {{provider}}
                        </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 (serverInfo.providers | filter:{internal:true} | orderBy:'name')">
                    <td>{{spi.name}}</td>
                    <td>
                        <div data-ng-repeat="provider in (spi.implementations | orderBy:'toString()')">
                            {{provider}}
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </fieldset>
</div>