<template name="adminInfo">
	<section class="page-container page-list">
		<header class="fixed-title">
			{{> burger}}
			<h2>
				<span class="room-title">{{_ "Info"}}</span>
			</h2>
		</header>
		<div class="content">
			{{#if hasPermission 'view-statistics'}}
				<h3>{{_ "Rocket.Chat"}}</h3>
				<table class="statistics-table">
					<tr>
						<th>{{_ "Version"}}</th>
						<td>{{statistics.version}}</td>
					</tr>
					<tr>
						<th>{{_ "DB_Migration"}}</th>
						<td>{{statistics.migration.version}}</td>
					</tr>
					<tr>
						<th>{{_ "DB_Migration_Date"}}</th>
						<td>{{statistics.migration.lockedAt}}</td>
					</tr>
					<tr>
						<th>{{_ "Installed_at"}}</th>
						<td>{{statistics.installedAt}}</td>
					</tr>
					<tr>
						<th>{{_ "Uptime"}}</th>
						<td>{{humanReadableTime statistics.process.uptime}}</td>
					</tr>
					<tr>
						<th>{{_ "Deployment_ID"}}</th>
						<td>{{statistics.uniqueId}}</td>
					</tr>
					<tr>
						<th>{{_ "PID"}}</th>
						<td>{{statistics.process.pid}}</td>
					</tr>
					<tr>
						<th>{{_ "Running_Instances"}}</th>
						<td>{{statistics.instanceCount}}</td>
					</tr>
				</table>
			{{/if}}

			<h3>{{_ "Commit"}}</h3>
			<table class="statistics-table">
				<tr>
					<th>{{_ "Hash"}}</th>
					<td>{{info.commit.hash}}</td>
				</tr>
				<tr>
					<th>{{_ "Date"}}</th>
					<td>{{info.commit.date}}</td>
				</tr>
				<tr>
					<th>{{_ "Branch"}}</th>
					<td>{{info.commit.branch}}</td>
				</tr>
				<tr>
					<th>{{_ "Tag"}}</th>
					<td>{{info.commit.tag}}</td>
				</tr>
				<tr>
					<th>{{_ "Author"}}</th>
					<td>{{info.commit.author}}</td>
				</tr>
				<tr>
					<th>{{_ "Subject"}}</th>
					<td>{{info.commit.subject}}</td>
				</tr>
			</table>

			{{#if hasPermission 'view-statistics'}}
				{{#if isReady}}
					<h3>{{_ "Runtime_Environment"}}</h3>
					<table class="statistics-table">
						<tr>
							<th>{{_ "OS_Type"}}</th>
							<td>{{statistics.os.type}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Platform"}}</th>
							<td>{{statistics.os.platform}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Arch"}}</th>
							<td>{{statistics.os.arch}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Release"}}</th>
							<td>{{statistics.os.release}}</td>
						</tr>
						<tr>
							<th>{{_ "Node_version"}}</th>
							<td>{{statistics.process.nodeVersion}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Uptime"}}</th>
							<td>{{humanReadableTime statistics.os.uptime}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Loadavg"}}</th>
							<td>{{numFormat statistics.os.loadavg.[0]}}, {{numFormat statistics.os.loadavg.[1]}}, {{numFormat statistics.os.loadavg.[2]}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Totalmem"}}</th>
							<td>{{inGB statistics.os.totalmem}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Freemem"}}</th>
							<td>{{inGB statistics.os.freemem}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Cpus"}}</th>
							<td>{{statistics.os.cpus.length}}</td>
						</tr>
					</table>

					<h3>{{_ "Build_Environment"}}</h3>
					<table class="statistics-table">
						<tr>
							<th>{{_ "OS_Platform"}}</th>
							<td>{{build.platform}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Arch"}}</th>
							<td>{{build.arch}}</td>
						</tr>
						<tr>
							<th>{{_ "OS_Release"}}</th>
							<td>{{build.osRelease}}</td>
						</tr>
						<tr>
							<th>{{_ "Node_version"}}</th>
							<td>{{build.nodeVersion}}</td>
						</tr>
						<tr>
							<th>{{_ "Date"}}</th>
							<td>{{formatDate build.date}}</td>
						</tr>
					</table>


					<h3>{{_ "Usage"}}</h3>
					<table class="statistics-table">
						<tr>
							<th>{{_ "Stats_Total_Users"}}</th>
							<td>{{statistics.totalUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Active_Users"}}</th>
							<td>{{statistics.activeUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Non_Active_Users"}}</th>
							<td>{{statistics.nonActiveUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Online_Users"}}</th>
							<td>{{statistics.onlineUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Away_Users"}}</th>
							<td>{{statistics.awayUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Offline_Users"}}</th>
							<td>{{statistics.offlineUsers}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Total_Rooms"}}</th>
							<td>{{statistics.totalRooms}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Total_Channels"}}</th>
							<td>{{statistics.totalChannels}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Total_Private_Groups"}}</th>
							<td>{{statistics.totalPrivateGroups}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Total_Direct_Messages"}}</th>
							<td>{{statistics.totalDirect}}</td>
						</tr>
						<tr>
							<th>{{_ "Stats_Total_Messages"}}</th>
							<td>{{statistics.totalMessages}}</td>
						</tr>
					</table>

					<button type="button" class="button primary refresh">Refresh</button>
				{{else}}
					{{_ "Loading..."}}
				{{/if}}
			{{/if}}
		</div>
	</section>
</template>
