Merge branch 'feature-ui-fixes'

This commit is contained in:
Dmitry Khomutov 2017-04-09 22:56:23 +07:00
commit 84edee960e
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
13 changed files with 136 additions and 127 deletions

View file

@ -5,7 +5,6 @@ var codeceptionPlugin = ActiveBuild.UiPlugin.extend({
lastData: null,
lastMeta: null,
displayOnUpdate: false,
box: true,
rendered: false,
register: function() {

View file

@ -4,7 +4,6 @@ var phpspecPlugin = ActiveBuild.UiPlugin.extend({
title: Lang.get('phpspec'),
lastData: null,
displayOnUpdate: false,
box: true,
rendered: false,
register: function() {

View file

@ -3,7 +3,6 @@ var phptalPlugin = ActiveBuild.UiPlugin.extend({
css: 'col-xs-12',
title: 'PHPTAL Lint',
lastData: null,
box: true,
rendered: false,
register: function() {

View file

@ -4,7 +4,6 @@ var phpunitPlugin = ActiveBuild.UiPlugin.extend({
title: Lang.get('phpunit'),
lastData: null,
displayOnUpdate: false,
box: true,
rendered: false,
statusMap: {
success : 'ok',

View file

@ -2,7 +2,6 @@ var SummaryPlugin = ActiveBuild.UiPlugin.extend({
id: 'build-summary',
css: 'col-xs-12',
title: Lang.get('build-summary'),
box: true,
statusLabels: [Lang.get('pending'), Lang.get('running'), Lang.get('success'), Lang.get('failed'), Lang.get('failed_allowed')],
statusClasses: ['info', 'warning', 'success', 'danger', 'danger'],

View file

@ -146,28 +146,25 @@ var Build = Class.extend({
}
}
$('#plugins').sortable({
handle: '.box-title',
connectWith: '#plugins',
update: self.storePluginOrder
});
$(window).trigger({type: 'build-updated', queryData: self.buildData});
},
renderPlugin: function(plugin) {
var output = plugin.render();
if (!plugin.box) {
output = $('<div class="box-body"></div>').append(output);
}
output = $('<div class="box-body"></div>').append(output);
var container = $('<div></div>').addClass('ui-plugin ' + plugin.css).attr('id', plugin.id);
var content = $('<div></div>').append(output);
content.addClass('box');
if (plugin.title) {
content.prepend('<div class="box-header"><h3 class="box-title">'+plugin.title+'</h3></div>');
content.prepend(
'<div class="box-header"><h3 class="box-title">'+plugin.title+'</h3>'+
'<div class="box-tools pull-right">'+
'<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">'+
'<i class="fa fa-minus"></i></button></div></div>'
);
}
container.append(content);

View file

@ -53,13 +53,19 @@ class ProjectController extends PHPCensor\Controller
}
/**
* View a specific project.
*/
* View a specific project.
*
* @param integer $projectId
*
* @throws NotFoundException
*
* @return string
*/
public function view($projectId)
{
$branch = $this->getParam('branch', '');
$branch = $this->getParam('branch', '');
$environment = $this->getParam('environment', '');
$project = $this->projectStore->getById($projectId);
$project = $this->projectStore->getById($projectId);
if (empty($project)) {
throw new NotFoundException(Lang::get('project_x_not_found', $projectId));
@ -76,18 +82,18 @@ class ProjectController extends PHPCensor\Controller
return $response;
}
$this->view->builds = $builds[0];
$this->view->total = $builds[1];
$this->view->project = $project;
$this->view->branch = urldecode($branch);
$this->view->branches = $this->projectStore->getKnownBranches($projectId);
$this->view->environment = urldecode($environment);
$this->view->builds = $builds[0];
$this->view->total = $builds[1];
$this->view->project = $project;
$this->view->branch = urldecode($branch);
$this->view->branches = $this->projectStore->getKnownBranches($projectId);
$this->view->environment = urldecode($environment);
$this->view->environments = $project->getEnvironmentsNames();
$this->view->page = $page;
$this->view->pages = $pages;
$this->view->perPage = $perPage;
$this->view->page = $page;
$this->view->pages = $pages;
$this->view->perPage = $perPage;
$this->layout->title = $project->getTitle();
$this->layout->title = $project->getTitle();
if (!empty($this->view->environment)) {
$this->layout->subtitle = $this->view->environment;
} else {
@ -98,8 +104,17 @@ class ProjectController extends PHPCensor\Controller
}
/**
* Create a new pending build for a project.
*/
* Create a new pending build for a project.
*
* @param integer $projectId
* @param string $type Build type: 'environment'|'branch'
* @param string $id Build type id: environment name or branch name
*
* @throws NotFoundException
*
* @return b8\Http\Response\RedirectResponse
*
*/
public function build($projectId, $type = null, $id = null)
{
/* @var \PHPCensor\Model\Project $project */

View file

@ -331,7 +331,8 @@ PHP Censor',
'build_details' => 'Build Details',
'commit_details' => 'Commit Details',
'committer' => 'Committer',
'committer' => 'Committer',
'commit_message' => 'Commit Message',
'timing' => 'Timing',
'created' => 'Created',
'started' => 'Started',

View file

@ -319,8 +319,9 @@ PHP Censor',
'severity' => 'Важность',
'build_details' => 'Информация о сборке',
'commit_details' => 'Информация о коммита',
'commit_details' => 'Информация о коммитe',
'committer' => 'Автор коммита',
'commit_message' => 'Сообщение в коммите',
'timing' => 'Тайминг',
'created' => 'Создана',
'started' => 'Началась',

View file

@ -21,10 +21,22 @@
</td>
</tr>
<tr>
<th><?php Lang::out('branch'); ?></th>
<td style="text-align: right">
<a target="_blank" href="<?php print $build->getBranchLink(); ?>">
<span class="label label-default"><?php print $build->getBranch(); ?></span>
</a>
</td>
</tr>
<tr>
<th><?php Lang::out('environment'); ?></th>
<td style="text-align: right">
<span class="label label-default"><?php print $build->getEnvironment(); ?></span>
<?php
$environment = $build->getEnvironment();
echo !empty($environment) ? ('<span class="label label-default">' . $environment . '</span>') : '—' ;
?>
</td>
</tr>
@ -59,15 +71,6 @@
<div class="box-body no-padding">
<table class="table">
<tr>
<th><?php Lang::out('branch'); ?></th>
<td style="text-align: right">
<a target="_blank" href="<?php print $build->getBranchLink(); ?>">
<span class="label label-default"><?php print $build->getBranch(); ?></span>
</a>
</td>
</tr>
<tr>
<th><?php Lang::out('commit'); ?></th>
<td style="text-align: right">
@ -85,7 +88,8 @@
</tr>
<tr>
<td colspan="2">
<th><?php Lang::out('commit_message'); ?></th>
<td style="text-align: right">
<?php print $build->getCommitMessage(); ?>
</td>
</tr>

View file

@ -14,6 +14,11 @@ use PHPCensor\Model\Build;
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php print $group['title']; ?></h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="box-body">

View file

@ -41,6 +41,7 @@ $branches = $build->getExtra('branches');
?>
<tr>
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span></td>
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
<td class="hidden-md hidden-sm hidden-xs">
<?php
@ -56,14 +57,15 @@ $branches = $build->getExtra('branches');
}
?>
</td>
<td><?php print $build->getEnvironment(); ?></td>
<td>
<a href="<?php print $build->getBranchLink(); ?>" target="_blank"><?php print $build->getBranch(); ?></a>
<?php print $branches ? ' + '.implode(', ', $branches) : ''; ?>
</td>
<td>
<span class='label label-<?php echo $subcls ?>'><?php echo $status ?></span>
<?php
$environment = $build->getEnvironment();
echo !empty($environment) ? $environment : '—' ;
?>
</td>
<td>
<?php print $build->getDuration(); ?> <?= Lang::get('seconds'); ?>

View file

@ -1,13 +1,13 @@
<?php use PHPCensor\Helper\Lang; ?>
<script>
var PROJECT_ID = <?php print $project->getId(); ?>;
var PROJECT_ENVIRONMENT = '<?php print $environment; ?>';
var PROJECT_BRANCH = '<?php print $branch; ?>';
var PER_PAGE = <?php print $perPage; ?>;
var PROJECT_ID = <?= $project->getId(); ?>;
var PROJECT_ENVIRONMENT = '<?= $environment; ?>';
var PROJECT_BRANCH = '<?= $branch; ?>';
var PER_PAGE = <?= $perPage; ?>;
</script>
<div class="clearfix" style="margin-bottom: 20px;">
<a class="btn btn-default" href="<?php print APP_URL . 'project/edit/' . $project->getId(); ?>">
<a class="btn btn-default" href="<?= APP_URL . 'project/edit/' . $project->getId(); ?>">
<?php Lang::out('edit_project'); ?>
</a>
@ -17,85 +17,57 @@
<div class="pull-right btn-group">
<?php if (!$project->getArchived()): ?>
<?php if($this->User()->getIsAdmin()): ?>
<div class="btn-group build-btn">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
<?php Lang::out('build_now_debug'); ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>?debug=1">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>?debug=1">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php if ($this->User()->getIsAdmin()): ?>
<?php if (!empty($environment)): ?>
<a class="btn btn-danger" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>/environment/<?= urlencode($environment); ?>?debug=1">
<?php Lang::out('build_now_debug'); ?>
</a>
<?php elseif (!empty($branch)): ?>
<a class="btn btn-danger" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>/branch/<?= urlencode($branch); ?>?debug=1">
<?php Lang::out('build_now_debug'); ?>
</a>
<?php else: ?>
<a class="btn btn-danger" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>?debug=1">
<?php Lang::out('build_now_debug'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
<div class="btn-group build-btn">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<?php Lang::out('build_now'); ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php if (!empty($environment)): ?>
<a class="btn btn-success" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>/environment/<?= urlencode($environment); ?>">
<?php Lang::out('build_now'); ?>
</a>
<?php elseif (!empty($branch)): ?>
<a class="btn btn-success" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>/branch/<?= urlencode($branch); ?>">
<?php Lang::out('build_now'); ?>
</a>
<?php else: ?>
<a class="btn btn-success" href="<?= APP_URL . 'project/build/' . $project->getId(); ?>">
<?php Lang::out('build_now'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
<div class="btn-group environment-btn pull-right">
<div class="btn-group branch-btn pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<?php
if (!empty($environment)) {
print Lang::get('environment_x', $environment);
<?php if (!empty($environment)) {
Lang::out('environment_x', $environment);
} elseif (!empty($branch)) {
print Lang::get('branch_x', $branch);
Lang::out('branch_x', $branch);
} else {
print Lang::get('All');
}
?>&nbsp;&nbsp;<span class="caret"></span>
Lang::out('all');
} ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
<li><a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
<li class="divider"></li>
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?environment=<?php echo urlencode($currentEnvironment) ?>">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
<li <?= ($currentEnvironment == $environment) ? 'class="active"' : ''; ?>>
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?environment=<?= urlencode($currentEnvironment); ?>">
<i class="fa fa-cog"></i><?= $currentEnvironment; ?>
</a>
</li>
<?php endforeach; ?>
@ -103,9 +75,9 @@
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($currentBranch) ?>">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
<li <?= ($currentBranch == $branch) ? 'class="active"' : ''; ?>>
<a href="<?= APP_URL; ?>project/view/<?= $project->getId(); ?>?branch=<?= urlencode($currentBranch); ?>">
<i class="fa fa-code-fork"></i><?= $currentBranch; ?>
</a>
</li>
<?php endforeach; ?>
@ -119,23 +91,23 @@
<div class="col-lg-9 col-md-8 col-sm-8">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?php print $total; ?>)</h3>
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?= $total; ?>)</h3>
</div>
<table class="table table-hover">
<thead>
<tr>
<th><?php Lang::out('id'); ?></th>
<th><?php Lang::out('status'); ?></th>
<th><?php Lang::out('date'); ?></th>
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
<th><?php Lang::out('environment'); ?></th>
<th><?php Lang::out('branch'); ?></th>
<th><?php Lang::out('status'); ?></th>
<th><?php Lang::out('environment'); ?></th>
<th><?php Lang::out('duration'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
<?= $builds; ?>
</tbody>
</table>
</div>
@ -198,6 +170,11 @@
<div class="box">
<div class="box-header">
<h4 class="box-title"><?= Lang::get('public_status_title'); ?></h4>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="box-body">
@ -220,6 +197,11 @@
<div class="box">
<div class="box-header">
<h4 class="box-title"><?php Lang::out('webhooks'); ?></h4>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="box-body">
@ -243,15 +225,22 @@
break;
}
?>
<br><br><strong style="word-wrap: break-word;"><?php print $url; ?></strong>
<br><br><strong style="word-wrap: break-word;"><?= $url; ?></strong>
</div>
</div>
<?php endif; ?>
<?php if ($project->getSshPublicKey()): ?>
<div class="box">
<div class="box-header"><h3 class="box-title"><?php Lang::out('public_key'); ?></h3></div>
<div class="box-body" style="word-break: break-all;"><?php print $project->getSshPublicKey(); ?></div>
<div class="box-header">
<h3 class="box-title"><?php Lang::out('public_key'); ?></h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="box-body" style="word-break: break-all;"><?= $project->getSshPublicKey(); ?></div>
</div>
<?php endif; ?>
</div>