Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15392940
D19927.id47565.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D19927.id47565.diff
View Options
diff --git a/src/applications/phrequent/engineextension/PhrequentCurtainExtension.php b/src/applications/phrequent/engineextension/PhrequentCurtainExtension.php
--- a/src/applications/phrequent/engineextension/PhrequentCurtainExtension.php
+++ b/src/applications/phrequent/engineextension/PhrequentCurtainExtension.php
@@ -29,6 +29,7 @@
$handles = $viewer->loadHandles(array_keys($event_groups));
$status_view = new PHUIStatusListView();
+ $now = PhabricatorTime::getNow();
foreach ($event_groups as $user_phid => $event_group) {
$item = new PHUIStatusItemView();
@@ -68,16 +69,20 @@
}
$block = new PhrequentTimeBlock($event_group);
- $item->setNote(
- phutil_format_relative_time(
- $block->getTimeSpentOnObject(
- $object->getPHID(),
- time())));
+
+ $duration = $block->getTimeSpentOnObject(
+ $object->getPHID(),
+ $now);
+
+ $duration_display = phutil_format_relative_time_detailed(
+ $duration,
+ $levels = 3);
+
+ $item->setNote($duration_display);
$status_view->addItem($item);
}
-
return $this->newPanel()
->setHeaderText(pht('Time Spent'))
->setOrder(40000)
diff --git a/src/applications/phrequent/event/PhrequentUIEventListener.php b/src/applications/phrequent/event/PhrequentUIEventListener.php
--- a/src/applications/phrequent/event/PhrequentUIEventListener.php
+++ b/src/applications/phrequent/event/PhrequentUIEventListener.php
@@ -5,7 +5,6 @@
public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
- $this->listen(PhabricatorEventType::TYPE_UI_WILLRENDERPROPERTIES);
}
public function handleEvent(PhutilEvent $event) {
@@ -13,9 +12,6 @@
case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
$this->handleActionEvent($event);
break;
- case PhabricatorEventType::TYPE_UI_WILLRENDERPROPERTIES:
- $this->handlePropertyEvent($event);
- break;
}
}
@@ -61,91 +57,4 @@
$this->addActionMenuItems($event, $track_action);
}
- private function handlePropertyEvent($ui_event) {
- $user = $ui_event->getUser();
- $object = $ui_event->getValue('object');
-
- if (!$object || !$object->getPHID()) {
- // No object, or the object has no PHID yet..
- return;
- }
-
- if (!($object instanceof PhrequentTrackableInterface)) {
- // This object isn't a time trackable object.
- return;
- }
-
- if (!$this->canUseApplication($ui_event->getUser())) {
- return;
- }
-
- $events = id(new PhrequentUserTimeQuery())
- ->setViewer($user)
- ->withObjectPHIDs(array($object->getPHID()))
- ->needPreemptingEvents(true)
- ->execute();
- $event_groups = mgroup($events, 'getUserPHID');
-
- if (!$events) {
- return;
- }
-
- $handles = id(new PhabricatorHandleQuery())
- ->setViewer($user)
- ->withPHIDs(array_keys($event_groups))
- ->execute();
-
- $status_view = new PHUIStatusListView();
-
- foreach ($event_groups as $user_phid => $event_group) {
- $item = new PHUIStatusItemView();
- $item->setTarget($handles[$user_phid]->renderLink());
-
- $state = 'stopped';
- foreach ($event_group as $event) {
- if ($event->getDateEnded() === null) {
- if ($event->isPreempted()) {
- $state = 'suspended';
- } else {
- $state = 'active';
- break;
- }
- }
- }
-
- switch ($state) {
- case 'active':
- $item->setIcon(
- PHUIStatusItemView::ICON_CLOCK,
- 'green',
- pht('Working Now'));
- break;
- case 'suspended':
- $item->setIcon(
- PHUIStatusItemView::ICON_CLOCK,
- 'yellow',
- pht('Interrupted'));
- break;
- case 'stopped':
- $item->setIcon(
- PHUIStatusItemView::ICON_CLOCK,
- 'bluegrey',
- pht('Not Working Now'));
- break;
- }
-
- $block = new PhrequentTimeBlock($event_group);
- $item->setNote(
- phutil_format_relative_time(
- $block->getTimeSpentOnObject(
- $object->getPHID(),
- time())));
-
- $status_view->addItem($item);
- }
-
- $view = $ui_event->getValue('view');
- $view->addProperty(pht('Time Spent'), $status_view);
- }
-
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 6:36 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7577245
Default Alt Text
D19927.id47565.diff (4 KB)
Attached To
Mode
D19927: Remove old Phrequent propery rendering code and show "Time Spent" in higher precision
Attached
Detach File
Event Timeline
Log In to Comment