Fixed links to Errors tab from Information tab (Summary).
This commit is contained in:
parent
c6ae043750
commit
1304ca29f7
|
@ -59,7 +59,7 @@ var SummaryPlugin = ActiveBuild.UiPlugin.extend({
|
|||
duration = data.started ? ((data.ended || Math.floor(Date.now() / 1000)) - data.started) : '-';
|
||||
|
||||
var pluginName = Lang.get(plugin);
|
||||
if ('test' === stage && 2 < data.status) {
|
||||
if (0 < data.errors) {
|
||||
pluginName = '<a href="' + window.APP_URL + 'build/view/' + ActiveBuild.buildId + '?plugin=' + plugin + '#errors">' + Lang.get(plugin) + '</a>';
|
||||
}
|
||||
tbody.append(
|
||||
|
|
|
@ -189,8 +189,8 @@ class BuildController extends Controller
|
|||
$errorView->build = $build;
|
||||
$errorView->errors = $errors['items'];
|
||||
|
||||
$data['errors'] = (integer)$errorStore->getErrorTotalForBuild($build->getId(), $plugin, $severity);
|
||||
$data['errors_total'] = (integer)$errorStore->getErrorTotalForBuild($build->getId());
|
||||
$data['errors'] = $errorStore->getErrorTotalForBuild($build->getId(), $plugin, $severity);
|
||||
$data['errors_total'] = $errorStore->getErrorTotalForBuild($build->getId());
|
||||
$data['error_html'] = $errorView->render();
|
||||
|
||||
return $data;
|
||||
|
|
|
@ -137,12 +137,11 @@ class BuildErrorStore extends Store
|
|||
* @param string $plugin
|
||||
* @param integer $severity
|
||||
*
|
||||
* @return array
|
||||
* @return integer
|
||||
*/
|
||||
public function getErrorTotalForBuild($buildId, $plugin = null, $severity = null)
|
||||
{
|
||||
$query = 'SELECT COUNT(*) AS {{total}} FROM {{build_error}}
|
||||
WHERE {{build_id}} = :build';
|
||||
$query = 'SELECT COUNT(*) AS {{total}} FROM {{build_error}} WHERE {{build_id}} = :build';
|
||||
if ($plugin) {
|
||||
$query .= ' AND {{plugin}} = :plugin';
|
||||
}
|
||||
|
@ -162,9 +161,10 @@ class BuildErrorStore extends Store
|
|||
|
||||
if ($stmt->execute()) {
|
||||
$res = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return $res['total'];
|
||||
|
||||
return (integer)$res['total'];
|
||||
} else {
|
||||
return [];
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -425,9 +425,23 @@ class BuildStore extends Store
|
|||
if ($stmt->execute()) {
|
||||
$rtn = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
/** @var \PHPCensor\Store\BuildErrorStore $errorStore */
|
||||
$errorStore = Factory::getStore('BuildError');
|
||||
|
||||
$rtn = array_reverse($rtn);
|
||||
$rtn = array_map(function ($item) {
|
||||
$rtn = array_map(function ($item) use ($key, $errorStore, $buildId) {
|
||||
$item['meta_value'] = json_decode($item['meta_value'], true);
|
||||
if ('plugin-summary' === $key) {
|
||||
foreach ($item['meta_value'] as $stage => $stageData) {
|
||||
foreach ($stageData as $plugin => $pluginData) {
|
||||
$item['meta_value'][$stage][$plugin]['errors'] = $errorStore->getErrorTotalForBuild(
|
||||
$buildId,
|
||||
$plugin
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}, $rtn);
|
||||
|
||||
|
|
Loading…
Reference in a new issue