mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Display application status in tip for needs attention number
Summary: Also splits blocking and active revisions. This could display 0 with non-empty tip over it. It's intentional meaning that 0 objects need your attention but there is still some work to do. Test Plan: Hovered over number. Reviewers: epriestley, chad Reviewed By: chad CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5049
This commit is contained in:
parent
6cee50d4d6
commit
c29fe2deb6
7 changed files with 54 additions and 28 deletions
|
@ -56,9 +56,7 @@ final class PhabricatorApplicationAudit extends PhabricatorApplication {
|
|||
->execute();
|
||||
|
||||
$count = count($audits);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_INFO;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Commit(s) Awaiting Audit', $count))
|
||||
|
@ -71,9 +69,7 @@ final class PhabricatorApplicationAudit extends PhabricatorApplication {
|
|||
->execute();
|
||||
|
||||
$count = count($commits);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Problem Commit(s)', $count))
|
||||
|
|
|
@ -87,22 +87,26 @@ final class PhabricatorApplicationDifferential extends PhabricatorApplication {
|
|||
|
||||
$status = array();
|
||||
|
||||
$active = count($blocking) + count($active);
|
||||
$type = $active
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$blocking = count($blocking);
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Review(s) Blocking Others', $blocking))
|
||||
->setCount($blocking);
|
||||
|
||||
$active = count($active);
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Review(s) Need Attention', $active))
|
||||
->setCount($active);
|
||||
|
||||
$waiting = count($waiting);
|
||||
$type = $waiting
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_INFO;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Review(s) Waiting on Others', $waiting));
|
||||
->setText(pht('%d Review(s) Waiting on Others', $waiting))
|
||||
->setCount($waiting);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ final class PhabricatorApplicationFlags extends PhabricatorApplication {
|
|||
->execute();
|
||||
|
||||
$count = count($flags);
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Flagged Object(s)', $count))
|
||||
|
|
|
@ -85,9 +85,7 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
|
|||
$query->execute();
|
||||
|
||||
$count = $query->getRowCount();
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Unbreak Now Task(s)!', $count))
|
||||
|
@ -101,12 +99,11 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
|
|||
$query->execute();
|
||||
|
||||
$count = $query->getRowCount();
|
||||
$type = $count
|
||||
? PhabricatorApplicationStatusView::TYPE_INFO
|
||||
: PhabricatorApplicationStatusView::TYPE_EMPTY;
|
||||
$type = PhabricatorApplicationStatusView::TYPE_INFO;
|
||||
$status[] = id(new PhabricatorApplicationStatusView())
|
||||
->setType($type)
|
||||
->setText(pht('%d Assigned Task(s)', $count));
|
||||
->setText(pht('%d Assigned Task(s)', $count))
|
||||
->setCount($count);
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
|
|
@ -57,16 +57,29 @@ final class PhabricatorApplicationLaunchView extends AphrontView {
|
|||
}
|
||||
|
||||
$count = 0;
|
||||
$text = array();
|
||||
if ($this->status) {
|
||||
$attention = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
|
||||
foreach ($this->status as $status) {
|
||||
$count += $status->getCount();
|
||||
if ($status->getType() == $attention) {
|
||||
$count += $status->getCount();
|
||||
}
|
||||
if ($status->getCount()) {
|
||||
$text[] = $status->getText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($count) {
|
||||
$content[] = phutil_tag(
|
||||
if ($text) {
|
||||
Javelin::initBehavior('phabricator-tooltips');
|
||||
$content[] = javelin_tag(
|
||||
'span',
|
||||
array(
|
||||
'sigil' => 'has-tooltip',
|
||||
'meta' => array(
|
||||
'tip' => implode("\n", $text),
|
||||
'size' => 240,
|
||||
),
|
||||
'class' => 'phabricator-application-launch-attention',
|
||||
),
|
||||
$count);
|
||||
|
|
|
@ -17,11 +17,19 @@ final class PhabricatorApplicationStatusView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setText($text) {
|
||||
$this->text = $text;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getText() {
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
public function setCount($count) {
|
||||
$this->count = $count;
|
||||
return $this;
|
||||
|
@ -32,9 +40,14 @@ final class PhabricatorApplicationStatusView extends AphrontView {
|
|||
}
|
||||
|
||||
public function render() {
|
||||
$type = $this->type;
|
||||
if (!$this->count) {
|
||||
$type = self::TYPE_EMPTY;
|
||||
}
|
||||
|
||||
$classes = array(
|
||||
'phabricator-application-status',
|
||||
'phabricator-application-status-type-'.$this->type,
|
||||
'phabricator-application-status-type-'.$type,
|
||||
);
|
||||
|
||||
return phutil_tag(
|
||||
|
|
|
@ -125,6 +125,11 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
'%d Problem Commits',
|
||||
),
|
||||
|
||||
'%d Review(s) Blocking Others' => array(
|
||||
'%d Review Blocking Others',
|
||||
'%d Reviews Blocking Others',
|
||||
),
|
||||
|
||||
'%d Review(s) Need Attention' => array(
|
||||
'%d Review Needs Attention',
|
||||
'%d Reviews Need Attention',
|
||||
|
|
Loading…
Reference in a new issue