Added filtration for errors by severity and plugin. Issue #85.
This commit is contained in:
parent
6b102f214e
commit
42888630e7
8 changed files with 253 additions and 36 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
/**
|
||||
* @var Build $build
|
||||
|
|
@ -172,10 +173,10 @@ use PHPCensor\Model\Build;
|
|||
<li class="">
|
||||
<a href="#errors" data-toggle="tab">
|
||||
<i class="fa fa-exclamation-triangle"></i> <?php print Lang::get('errors'); ?>
|
||||
<?php if ($data['errors'] == 0): ?>
|
||||
<?php if ($data['errors_total'] == 0): ?>
|
||||
<span class="errors-label label label-danger" style="display: none">0</span>
|
||||
<?php else: ?>
|
||||
<span class="errors-label label label-danger"><?php print $data['errors']; ?></span>
|
||||
<span class="errors-label label label-danger"><?php print $data['errors_total']; ?></span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -190,6 +191,65 @@ use PHPCensor\Model\Build;
|
|||
</div>
|
||||
|
||||
<div class="tab-pane" id="errors">
|
||||
<?php if ($build->getStatus() > Build::STATUS_RUNNING): ?>
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title"><?= Lang::get('filters'); ?></h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php if ($data['errors'] < $data['errors_total']): ?>
|
||||
<p><?= Lang::get('errors_selected'); ?>: <?= $data['errors']; ?> / <?= $data['errors_total']; ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if (!empty($plugin)) {
|
||||
echo Lang::get('plugin') . ': ' . Lang::get($plugin);
|
||||
} else {
|
||||
echo Lang::get('all_plugins');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?severity=<?= urlencode($severity); ?>#errors"><?= Lang::get('all_plugins'); ?></a></li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($plugins)): ?>
|
||||
<?php foreach ($plugins as $currentPlugin) : ?>
|
||||
<li <?= ($currentPlugin === $plugin) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?plugin=<?= urlencode($currentPlugin); ?>&severity=<?= urlencode($severity); ?>#errors">
|
||||
<?= Lang::get($currentPlugin); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<?php if ('' !== $severity) {
|
||||
echo Lang::get('severity') . ': ' . Lang::get(BuildError::getSeverityName($severity));
|
||||
} else {
|
||||
echo Lang::get('all_severities');
|
||||
} ?> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?plugin=<?= urlencode($plugin); ?>#errors"><?= Lang::get('all_severities'); ?></a></li>
|
||||
<li class="divider"></li>
|
||||
|
||||
<?php if(!empty($severities)): ?>
|
||||
<?php foreach ($severities as $currentSeverity) : ?>
|
||||
<li <?= ($currentSeverity === $severity) ? 'class="active"' : ''; ?>>
|
||||
<a href="<?= APP_URL; ?>build/view/<?= $build->getId(); ?>?plugin=<?= urlencode($plugin); ?>&severity=<?= urlencode($currentSeverity); ?>#errors">
|
||||
<?= Lang::get(BuildError::getSeverityName($currentSeverity)); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<table class="errors-table table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -217,11 +277,13 @@ use PHPCensor\Model\Build;
|
|||
|
||||
<script src="<?php print APP_URL; ?>assets/js/build.js"></script>
|
||||
<script>
|
||||
var PER_PAGE = <?= $perPage; ?>;
|
||||
var PAGE = <?= $page; ?>;
|
||||
var PER_PAGE = <?= $perPage; ?>;
|
||||
var PAGE = <?= $page; ?>;
|
||||
var BUILD_PLUGIN = '<?= $plugin; ?>';
|
||||
var BUILD_SEVERITY = '<?= $severity; ?>';
|
||||
|
||||
var ActiveBuild = new Build(<?php print $build->getId() ?>);
|
||||
ActiveBuild.setupBuild(<?php print json_encode($data); ?>, <?php print json_encode($build->getFileLinkTemplate()); ?>);
|
||||
var ActiveBuild = new Build(<?= $build->getId(); ?>);
|
||||
ActiveBuild.setupBuild(<?= json_encode($data); ?>, <?= json_encode($build->getFileLinkTemplate()); ?>);
|
||||
|
||||
var url = document.location.toString();
|
||||
if (url.match('#')) {
|
||||
|
|
@ -235,8 +297,8 @@ use PHPCensor\Model\Build;
|
|||
</script>
|
||||
|
||||
<?php
|
||||
foreach ($plugins as $plugin) {
|
||||
print '<script src="' . APP_URL . 'assets/js/build-plugins/' . $plugin . '"></script>' . PHP_EOL;
|
||||
foreach ($uiPlugins as $uiPlugin) {
|
||||
print '<script src="' . APP_URL . 'assets/js/build-plugins/' . $uiPlugin . '"></script>' . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue