Fixed public status page

This commit is contained in:
Dmitry Khomutov 2017-01-07 00:34:19 +07:00
parent 86be19f37b
commit 2482723f9c

View file

@ -3,176 +3,171 @@
<head>
<title><?php print $project->getTitle(); ?> - PHP Censor</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<link href='//fonts.googleapis.com/css?family=Roboto:300,500&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/main.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" type="image/x-icon" href="<?php echo APP_URL ?>favicon.ico">
<link rel="shortcut icon" type="image/png" href="<?php echo APP_URL ?>assets/img/favicon.png">
<script>window.APP_URL = <?php print json_encode(APP_URL) ?></script>
<link href="<?php print APP_URL; ?>assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/vendor/ion-icons/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/jQueryUI/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo APP_URL ?>assets/js/class.js"></script>
<script src="<?php echo APP_URL ?>assets/js/app.js"></script>
<script src="<?php echo APP_URL ?>assets/js/init.js"></script>
<script src="<?php print APP_URL; ?>assets/js/class.js"></script>
<script src="<?php print APP_URL; ?>assets/vendor/sprintf-js/dist/sprintf.min.js"></script>
<script src="<?php print APP_URL; ?>assets/vendor/admin-lte/plugins/daterangepicker/moment.min.js"></script>
<script src="<?php print APP_URL; ?>assets/js/app.js" type="text/javascript"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<a class="navbar-brand" href="<?php echo APP_URL ?>">PHP Censor</a>
</div>
</div>
<div id="content" class="container">
<h1><?php print $project->getTitle(); ?></h1>
<?php if (!empty($latest)): ?>
<?php
$statusClass = null;
$statusText = null;
switch ($latest->getStatus()) {
case 0:
$statusClass = 'info';
$statusText = 'Pending';
break;
case 1:
$statusClass = 'warning';
$statusText = 'Running';
break;
case 2:
$statusClass = 'success';
$statusText = 'Success';
break;
case 3:
$statusClass = 'danger';
$statusText = 'Failed';
break;
}
?>
<!-- Latest Build -->
<div class="build-info-panel panel panel-<?php print $statusClass; ?>">
<img class="pull-left" src="//www.gravatar.com/avatar/<?php print md5($latest->getCommitterEmail()); ?>?d=mm">
<div class="box-header">
<h1 class="box-title">
<a href="/project/view/<?php print $latest->getProjectId(); ?>">
<?php print $latest->getProject()->getTitle(); ?></a>
<span>#<?php print $latest->getId(); ?></span>
<label class="pull-right label label-<?php print $statusClass; ?>"><?php print $statusText; ?></label>
</h1>
</div>
<div class="box-body">
<div id="build-info">
<?php if ($latest->getCommitMessage()): ?>
<div class="commit-message">
<?php print $latest->getCommitMessage(); ?>
</div>
<?php endif; ?>
<strong>Branch: </strong> <?php print $latest->getBranch(); ?><br>
<strong>Committer: </strong> <?php print $latest->getCommitterEmail(); ?>
<?php if ($latest->getCommitId() != 'Manual'): ?>
<br><strong>Commit ID: </strong> <?php print $latest->getCommitId(); ?><br>
<?php endif; ?>
<body class="hold-transition skin-black layout-top-nav">
<div class="wrapper">
<header class="main-header">
<nav class="navbar navbar-static-top">
<div class="container">
<div class="navbar-header">
<a href="<?php print APP_URL; ?>" class="logo" style="background-color: #222d32; text-align: left;">PHP Censor</a>
</div>
</div>
</div>
<?php endif; ?>
<!-- Recent builds: -->
<div class="box">
<div class="box-header"><h3 class="box-title">Builds</h3></div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
</tr>
</thead>
<tbody id="latest-builds">
<?php if(empty($builds) || !count($builds)): ?>
<tr class="">
<td colspan="6">No builds yet.</td>
</tr>
<?php endif; ?>
<?php foreach($builds as $build): ?>
</nav>
</header>
<div class="content-wrapper">
<div class="container">
<section class="content">
<?php if (!empty($latest)): ?>
<?php
switch($build->getStatus())
{
$statusClass = null;
$statusText = null;
switch ($latest->getStatus()) {
case 0:
$cls = 'active';
$subcls = 'info';
$status = 'Pending';
$statusClass = 'blue';
$statusText = 'Pending';
break;
case 1:
$cls = 'warning';
$subcls = 'warning';
$status = 'Running';
$statusClass = 'yellow';
$statusText = 'Running';
break;
case 2:
$cls = 'success';
$subcls = 'success';
$status = 'Success';
$statusClass = 'green';
$statusText = 'Success';
break;
case 3:
$cls = 'danger';
$subcls = 'danger';
$status = 'Failed';
$statusClass = 'red';
$statusText = 'Failed';
break;
}
?>
<tr class="<?php print $cls; ?>">
<td>#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></td>
<td>
?>
<div class="small-box small-box-full bg-<?= $statusClass; ?>">
<div class="inner">
<h3 class="box-title">
<?php print $latest->getProject()->getTitle(); ?> #<?php print $latest->getId(); ?> (<?= $statusText; ?>)
</h3>
<p>
<?php if ($latest->getCommitMessage()): ?>
<?php print $latest->getCommitMessage(); ?><br /><br />
<?php endif; ?>
<strong>Branch: </strong> <?php print $latest->getBranch(); ?><br />
<strong>Committer: </strong> <?php print $latest->getCommitterEmail(); ?>
<?php if ($latest->getCommitId() != 'Manual'): ?>
<br /><strong>Commit: </strong> <?php print $latest->getCommitId(); ?><br>
<?php endif; ?>
</p>
</div>
<div class="icon">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
</div>
<div style="clear: both;"></div>
</div>
<?php endif; ?>
<div class="box">
<div class="box-header"><h3 class="box-title">Builds</h3></div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Commit</th>
<th>Branch</th>
<th>Status</th>
</tr>
</thead>
<tbody id="latest-builds">
<?php if(empty($builds) || !count($builds)): ?>
<tr class="">
<td colspan="6">No builds yet.</td>
</tr>
<?php endif; ?>
<?php foreach($builds as $build): ?>
<?php
if ($build->getCommitId() !== 'Manual') {
print '<a href="' . $build->getCommitLink() . '">';
}
print $build->getCommitId();
if ($build->getCommitId() !== 'Manual') {
print '</a>';
switch($build->getStatus())
{
case 0:
$class = 'info';
$status = 'Pending';
break;
case 1:
$class = 'warning';
$status = 'Running';
break;
case 2:
$class = 'success';
$status = 'Success';
break;
case 3:
$class = 'danger';
$status = 'Failed';
break;
}
?>
</td>
<tr>
<td>#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></td>
<td><a href="<?php print $build->getBranchLink(); ?>"><?php print $build->getBranch(); ?></a></td>
<td>
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
</td>
</tr>
<?php endforeach; ?>
<td>
<?php
if ($build->getCommitId() !== 'Manual') {
print '<a href="' . $build->getCommitLink() . '">';
}
print $build->getCommitId();
if ($build->getCommitId() !== 'Manual') {
print '</a>';
}
?>
</td>
<td><a href="<?php print $build->getBranchLink(); ?>"><?php print $build->getBranch(); ?></a></td>
<td>
<span class='label label-<?php echo $class ?>'><?php echo $status ?></span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</tbody>
</table>
</div>
</section>
</div>
</div>
<!--<footer class="main-footer">
<div class="container">
</div>
</footer>-->
</div>
</body>
</html>