<div class="top-pad"></div>

<div class="content-padding">

	<h1 class="title"><i class="fa fa-database"></i>Environments</h1>
	<div class="bar-loader bar-loader-title" ng-class="{'bar-loader-loading': loadingServers}"></div>
	<div class="box-content2 box-content-table">
		<table class="tb-zebra">
			<tr>
				<th>Environment</th>
				<th>Last Update</th>
				<th>Last Git Version</th>
			</tr>
			<tr ng-repeat="server in servers">
				<td><a href="/deploy/server/{{server.name}}">{{server.name}}</a></td>
				<td><span ng-if="server.version.timestamp"><span am-time-ago="server.version.timestamp*1000"></span></span></td>
				<td><a href="https://github.com/{{server.repo}}/commit/{{server.version.version}}" target="_system">{{server.version.version}}</a></td>
			</tr>
		</table>
	</div>



	<h1 class="title"><i class="fa fa-bookmark"></i>Versions</h1>
	<div class="bar-loader bar-loader-title" ng-class="{'bar-loader-loading': loadingVersions}"></div>
	<div class="box-content2 box-content-table">
		<table class="tb-zebra">
			<tr>
				<th>ID</th>
				<th>Environment</th>
				<th>Date</th>
				<th>Git Version / Tag</th>
				<th>Status</th>
				<th>Admin</th>
			</tr>
			<tr ng-repeat="version in versions">
				<td><a href="/deploy/version/{{version.id_deploy_version}}">{{version.id_deploy_version}}</td>
				<td>{{version.server.name}}</td>
				<td>{{version.timestamp*1000 | date:'MM/dd @ HH:mm'}}</td>
				<td>
					<span ng-if="version.version">
						<a href="https://github.com/{{version.server.repo}}/commit/{{version.version}}" target="_system">{{version.version}}</a>
					</span>
					<span ng-if="version.version && version.tag">
						&nbsp;/&nbsp;
					</span>
					<span ng-if="version.tag">
						<a href="https://github.com/{{version.server.repo}}/tree/{{version.tag}}" target="_system">{{version.tag}}</a>
					</span>
				</td>
				<td class="deploy-status-{{version.status}}">
					{{version.status}}
					<span ng-if="version.status=='deploying'">&nbsp;&nbsp;&nbsp;<i class="fa fa-cog fa-spin"></i></span>
					<span ng-if="version.status=='new'">&nbsp;&nbsp;&nbsp;<a href="" ng-click="cancel(version.id_deploy_version)" ng-if="account.user.permissions['SERVER-DEPLOY-ADMIN']"><i class="fa fa-times-circle"></i></a></span>
				</td>
				<td><a href="/staff/{{version.id_admin}}">{{version.admin.name}}</a></td>
			</tr>
		</table>
	</div>

	Current bundle: {{_current_bundle}}

</div>


