mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Hide empty build logs
Summary: This automatically hides any empty build logs from Harbormaster, so that they do not appear. Test Plan: Viewed a build plan where the logs were empty and didn't see them appear. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10091
This commit is contained in:
parent
4e9746ed4e
commit
cefe30d737
3 changed files with 68 additions and 3 deletions
|
@ -67,7 +67,7 @@ return array(
|
||||||
'rsrc/css/application/feed/feed.css' => '4e544db4',
|
'rsrc/css/application/feed/feed.css' => '4e544db4',
|
||||||
'rsrc/css/application/files/global-drag-and-drop.css' => '697324ad',
|
'rsrc/css/application/files/global-drag-and-drop.css' => '697324ad',
|
||||||
'rsrc/css/application/flag/flag.css' => '5337623f',
|
'rsrc/css/application/flag/flag.css' => '5337623f',
|
||||||
'rsrc/css/application/harbormaster/harbormaster.css' => 'cec833b7',
|
'rsrc/css/application/harbormaster/harbormaster.css' => '49d64eb4',
|
||||||
'rsrc/css/application/herald/herald-test.css' => '778b008e',
|
'rsrc/css/application/herald/herald-test.css' => '778b008e',
|
||||||
'rsrc/css/application/herald/herald.css' => 'c544dd1c',
|
'rsrc/css/application/herald/herald.css' => 'c544dd1c',
|
||||||
'rsrc/css/application/maniphest/batch-editor.css' => '8f380ebc',
|
'rsrc/css/application/maniphest/batch-editor.css' => '8f380ebc',
|
||||||
|
@ -538,7 +538,7 @@ return array(
|
||||||
'font-fontawesome' => '73d075c3',
|
'font-fontawesome' => '73d075c3',
|
||||||
'font-source-sans-pro' => '91d53463',
|
'font-source-sans-pro' => '91d53463',
|
||||||
'global-drag-and-drop-css' => '697324ad',
|
'global-drag-and-drop-css' => '697324ad',
|
||||||
'harbormaster-css' => 'cec833b7',
|
'harbormaster-css' => '49d64eb4',
|
||||||
'herald-css' => 'c544dd1c',
|
'herald-css' => 'c544dd1c',
|
||||||
'herald-rule-editor' => '3fc2c8f2',
|
'herald-rule-editor' => '3fc2c8f2',
|
||||||
'herald-test-css' => '778b008e',
|
'herald-test-css' => '778b008e',
|
||||||
|
|
|
@ -205,6 +205,8 @@ final class HarbormasterBuildViewController
|
||||||
->withBuildTargetPHIDs(array($build_target->getPHID()))
|
->withBuildTargetPHIDs(array($build_target->getPHID()))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
$empty_logs = array();
|
||||||
|
|
||||||
$log_boxes = array();
|
$log_boxes = array();
|
||||||
foreach ($logs as $log) {
|
foreach ($logs as $log) {
|
||||||
$start = 1;
|
$start = 1;
|
||||||
|
@ -217,6 +219,16 @@ final class HarbormasterBuildViewController
|
||||||
$start = 1;
|
$start = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = null;
|
||||||
|
$is_empty = false;
|
||||||
|
if (count($lines) === 1 && trim($lines[0]) === '') {
|
||||||
|
// Prevent Harbormaster from showing empty build logs.
|
||||||
|
$id = celerity_generate_unique_node_id();
|
||||||
|
$empty_logs[] = $id;
|
||||||
|
$is_empty = true;
|
||||||
|
}
|
||||||
|
|
||||||
$log_view = new ShellLogView();
|
$log_view = new ShellLogView();
|
||||||
$log_view->setLines($lines);
|
$log_view->setLines($lines);
|
||||||
$log_view->setStart($start);
|
$log_view->setStart($start);
|
||||||
|
@ -230,9 +242,54 @@ final class HarbormasterBuildViewController
|
||||||
->setSubheader($this->createLogHeader($build, $log))
|
->setSubheader($this->createLogHeader($build, $log))
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
|
||||||
$log_boxes[] = id(new PHUIObjectBoxView())
|
$log_box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->setForm($log_view);
|
->setForm($log_view);
|
||||||
|
|
||||||
|
if ($is_empty) {
|
||||||
|
require_celerity_resource('harbormaster-css');
|
||||||
|
|
||||||
|
$log_box = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'style' => 'display: none',
|
||||||
|
'id' => $id),
|
||||||
|
$log_box);
|
||||||
|
}
|
||||||
|
|
||||||
|
$log_boxes[] = $log_box;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($empty_logs) {
|
||||||
|
$hide_id = celerity_generate_unique_node_id();
|
||||||
|
|
||||||
|
Javelin::initBehavior('phabricator-reveal-content');
|
||||||
|
|
||||||
|
$expand = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'id' => $hide_id,
|
||||||
|
'class' => 'harbormaster-empty-logs-are-hidden mlr mlt mll',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
pht(
|
||||||
|
'%s empty logs are hidden.',
|
||||||
|
new PhutilNumber(count($empty_logs))),
|
||||||
|
' ',
|
||||||
|
javelin_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '#',
|
||||||
|
'sigil' => 'reveal-content',
|
||||||
|
'meta' => array(
|
||||||
|
'showIDs' => $empty_logs,
|
||||||
|
'hideIDs' => array($hide_id),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
pht('Show all logs.')),
|
||||||
|
));
|
||||||
|
|
||||||
|
array_unshift($log_boxes, $expand);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $log_boxes;
|
return $log_boxes;
|
||||||
|
|
|
@ -17,3 +17,11 @@
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
color: {$darkbluetext};
|
color: {$darkbluetext};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.harbormaster-empty-logs-are-hidden {
|
||||||
|
background: {$lightyellow};
|
||||||
|
border: 1px solid {$yellow};
|
||||||
|
text-align: center;
|
||||||
|
padding: 12px;
|
||||||
|
color: {$darkgreytext};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue