@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow long daemon log messages to be expanded

Summary:
Ref T3557. We summarize long messages, but don't let you see the entire message. This is occasionally inconvenient, and I'm planning to add more prefix junk to some messages for T2569.

Provide a link you can click to see the full message.

This isn't javascripted because a ton of these can make the page ridiculously enormous and it seems unlikely you'd care much about all of them.

Test Plan: {F51261} {F51262}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, chad

Maniphest Tasks: T3557

Differential Revision: https://secure.phabricator.com/D6546

+173 -71
+45 -45
src/__celerity_resource_map__.php
··· 917 917 ), 918 918 'aphront-table-view-css' => 919 919 array( 920 - 'uri' => '/res/d3c44c69/rsrc/css/aphront/table-view.css', 920 + 'uri' => '/res/be5ca6be/rsrc/css/aphront/table-view.css', 921 921 'type' => 'css', 922 922 'requires' => 923 923 array( ··· 4182 4182 ), array( 4183 4183 'packages' => 4184 4184 array( 4185 - '72b33589' => 4185 + '570cc49c' => 4186 4186 array( 4187 4187 'name' => 'core.pkg.css', 4188 4188 'symbols' => ··· 4230 4230 40 => 'phabricator-property-list-view-css', 4231 4231 41 => 'phabricator-tag-view-css', 4232 4232 ), 4233 - 'uri' => '/res/pkg/72b33589/core.pkg.css', 4233 + 'uri' => '/res/pkg/570cc49c/core.pkg.css', 4234 4234 'type' => 'css', 4235 4235 ), 4236 4236 '75ccea43' => ··· 4421 4421 ), 4422 4422 'reverse' => 4423 4423 array( 4424 - 'aphront-dialog-view-css' => '72b33589', 4425 - 'aphront-error-view-css' => '72b33589', 4426 - 'aphront-form-view-css' => '72b33589', 4427 - 'aphront-list-filter-view-css' => '72b33589', 4428 - 'aphront-pager-view-css' => '72b33589', 4429 - 'aphront-panel-view-css' => '72b33589', 4430 - 'aphront-table-view-css' => '72b33589', 4431 - 'aphront-tokenizer-control-css' => '72b33589', 4432 - 'aphront-tooltip-css' => '72b33589', 4433 - 'aphront-typeahead-control-css' => '72b33589', 4424 + 'aphront-dialog-view-css' => '570cc49c', 4425 + 'aphront-error-view-css' => '570cc49c', 4426 + 'aphront-form-view-css' => '570cc49c', 4427 + 'aphront-list-filter-view-css' => '570cc49c', 4428 + 'aphront-pager-view-css' => '570cc49c', 4429 + 'aphront-panel-view-css' => '570cc49c', 4430 + 'aphront-table-view-css' => '570cc49c', 4431 + 'aphront-tokenizer-control-css' => '570cc49c', 4432 + 'aphront-tooltip-css' => '570cc49c', 4433 + 'aphront-typeahead-control-css' => '570cc49c', 4434 4434 'differential-changeset-view-css' => 'dd27a69b', 4435 4435 'differential-core-view-css' => 'dd27a69b', 4436 4436 'differential-inline-comment-editor' => '48040be9', ··· 4444 4444 'differential-table-of-contents-css' => 'dd27a69b', 4445 4445 'diffusion-commit-view-css' => 'c8ce2d88', 4446 4446 'diffusion-icons-css' => 'c8ce2d88', 4447 - 'global-drag-and-drop-css' => '72b33589', 4447 + 'global-drag-and-drop-css' => '570cc49c', 4448 4448 'inline-comment-summary-css' => 'dd27a69b', 4449 4449 'javelin-aphlict' => '75ccea43', 4450 4450 'javelin-behavior' => 'a9f14d76', ··· 4517 4517 'javelin-util' => 'a9f14d76', 4518 4518 'javelin-vector' => 'a9f14d76', 4519 4519 'javelin-workflow' => 'a9f14d76', 4520 - 'lightbox-attachment-css' => '72b33589', 4520 + 'lightbox-attachment-css' => '570cc49c', 4521 4521 'maniphest-task-summary-css' => '06bacb9a', 4522 4522 'maniphest-transaction-detail-css' => '06bacb9a', 4523 - 'phabricator-action-list-view-css' => '72b33589', 4524 - 'phabricator-application-launch-view-css' => '72b33589', 4523 + 'phabricator-action-list-view-css' => '570cc49c', 4524 + 'phabricator-application-launch-view-css' => '570cc49c', 4525 4525 'phabricator-busy' => '75ccea43', 4526 4526 'phabricator-content-source-view-css' => 'dd27a69b', 4527 - 'phabricator-core-css' => '72b33589', 4528 - 'phabricator-crumbs-view-css' => '72b33589', 4527 + 'phabricator-core-css' => '570cc49c', 4528 + 'phabricator-crumbs-view-css' => '570cc49c', 4529 4529 'phabricator-drag-and-drop-file-upload' => '48040be9', 4530 4530 'phabricator-dropdown-menu' => '75ccea43', 4531 4531 'phabricator-file-upload' => '75ccea43', 4532 - 'phabricator-filetree-view-css' => '72b33589', 4533 - 'phabricator-flag-css' => '72b33589', 4534 - 'phabricator-form-view-css' => '72b33589', 4535 - 'phabricator-header-view-css' => '72b33589', 4532 + 'phabricator-filetree-view-css' => '570cc49c', 4533 + 'phabricator-flag-css' => '570cc49c', 4534 + 'phabricator-form-view-css' => '570cc49c', 4535 + 'phabricator-header-view-css' => '570cc49c', 4536 4536 'phabricator-hovercard' => '75ccea43', 4537 - 'phabricator-jump-nav' => '72b33589', 4537 + 'phabricator-jump-nav' => '570cc49c', 4538 4538 'phabricator-keyboard-shortcut' => '75ccea43', 4539 4539 'phabricator-keyboard-shortcut-manager' => '75ccea43', 4540 - 'phabricator-main-menu-view' => '72b33589', 4540 + 'phabricator-main-menu-view' => '570cc49c', 4541 4541 'phabricator-menu-item' => '75ccea43', 4542 - 'phabricator-nav-view-css' => '72b33589', 4542 + 'phabricator-nav-view-css' => '570cc49c', 4543 4543 'phabricator-notification' => '75ccea43', 4544 - 'phabricator-notification-css' => '72b33589', 4545 - 'phabricator-notification-menu-css' => '72b33589', 4546 - 'phabricator-object-item-list-view-css' => '72b33589', 4544 + 'phabricator-notification-css' => '570cc49c', 4545 + 'phabricator-notification-menu-css' => '570cc49c', 4546 + 'phabricator-object-item-list-view-css' => '570cc49c', 4547 4547 'phabricator-object-selector-css' => 'dd27a69b', 4548 4548 'phabricator-phtize' => '75ccea43', 4549 4549 'phabricator-prefab' => '75ccea43', 4550 4550 'phabricator-project-tag-css' => '06bacb9a', 4551 - 'phabricator-property-list-view-css' => '72b33589', 4552 - 'phabricator-remarkup-css' => '72b33589', 4551 + 'phabricator-property-list-view-css' => '570cc49c', 4552 + 'phabricator-remarkup-css' => '570cc49c', 4553 4553 'phabricator-shaped-request' => '48040be9', 4554 - 'phabricator-side-menu-view-css' => '72b33589', 4555 - 'phabricator-standard-page-view' => '72b33589', 4556 - 'phabricator-tag-view-css' => '72b33589', 4554 + 'phabricator-side-menu-view-css' => '570cc49c', 4555 + 'phabricator-standard-page-view' => '570cc49c', 4556 + 'phabricator-tag-view-css' => '570cc49c', 4557 4557 'phabricator-textareautils' => '75ccea43', 4558 4558 'phabricator-tooltip' => '75ccea43', 4559 - 'phabricator-transaction-view-css' => '72b33589', 4560 - 'phabricator-zindex-css' => '72b33589', 4561 - 'phui-button-css' => '72b33589', 4562 - 'phui-form-css' => '72b33589', 4563 - 'phui-icon-view-css' => '72b33589', 4564 - 'phui-spacing-css' => '72b33589', 4565 - 'sprite-apps-large-css' => '72b33589', 4566 - 'sprite-gradient-css' => '72b33589', 4567 - 'sprite-icons-css' => '72b33589', 4568 - 'sprite-menu-css' => '72b33589', 4569 - 'syntax-highlighting-css' => '72b33589', 4559 + 'phabricator-transaction-view-css' => '570cc49c', 4560 + 'phabricator-zindex-css' => '570cc49c', 4561 + 'phui-button-css' => '570cc49c', 4562 + 'phui-form-css' => '570cc49c', 4563 + 'phui-icon-view-css' => '570cc49c', 4564 + 'phui-spacing-css' => '570cc49c', 4565 + 'sprite-apps-large-css' => '570cc49c', 4566 + 'sprite-gradient-css' => '570cc49c', 4567 + 'sprite-icons-css' => '570cc49c', 4568 + 'sprite-menu-css' => '570cc49c', 4569 + 'syntax-highlighting-css' => '570cc49c', 4570 4570 ), 4571 4571 ));
+2
src/__phutil_library_map__.php
··· 1023 1023 'PhabricatorDaemonEventListener' => 'applications/daemon/event/PhabricatorDaemonEventListener.php', 1024 1024 'PhabricatorDaemonLog' => 'applications/daemon/storage/PhabricatorDaemonLog.php', 1025 1025 'PhabricatorDaemonLogEvent' => 'applications/daemon/storage/PhabricatorDaemonLogEvent.php', 1026 + 'PhabricatorDaemonLogEventViewController' => 'applications/daemon/controller/PhabricatorDaemonLogEventViewController.php', 1026 1027 'PhabricatorDaemonLogEventsView' => 'applications/daemon/view/PhabricatorDaemonLogEventsView.php', 1027 1028 'PhabricatorDaemonLogListController' => 'applications/daemon/controller/PhabricatorDaemonLogListController.php', 1028 1029 'PhabricatorDaemonLogListView' => 'applications/daemon/view/PhabricatorDaemonLogListView.php', ··· 3029 3030 1 => 'PhabricatorPolicyInterface', 3030 3031 ), 3031 3032 'PhabricatorDaemonLogEvent' => 'PhabricatorDaemonDAO', 3033 + 'PhabricatorDaemonLogEventViewController' => 'PhabricatorDaemonController', 3032 3034 'PhabricatorDaemonLogEventsView' => 'AphrontView', 3033 3035 'PhabricatorDaemonLogListController' => 'PhabricatorDaemonController', 3034 3036 'PhabricatorDaemonLogListView' => 'AphrontView',
+1
src/applications/daemon/application/PhabricatorApplicationDaemons.php
··· 48 48 'combined/' => 'PhabricatorDaemonCombinedLogController', 49 49 '(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogViewController', 50 50 ), 51 + 'event/(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogEventViewController', 51 52 ), 52 53 ); 53 54 }
+52
src/applications/daemon/controller/PhabricatorDaemonLogEventViewController.php
··· 1 + <?php 2 + 3 + final class PhabricatorDaemonLogEventViewController 4 + extends PhabricatorDaemonController { 5 + 6 + private $id; 7 + 8 + public function willProcessRequest(array $data) { 9 + $this->id = $data['id']; 10 + } 11 + 12 + public function processRequest() { 13 + $request = $this->getRequest(); 14 + 15 + $event = id(new PhabricatorDaemonLogEvent())->load($this->id); 16 + if (!$event) { 17 + return new Aphront404Response(); 18 + } 19 + 20 + $event_view = id(new PhabricatorDaemonLogEventsView()) 21 + ->setEvents(array($event)) 22 + ->setUser($request->getUser()) 23 + ->setCombinedLog(true) 24 + ->setShowFullMessage(true); 25 + 26 + $log_panel = new AphrontPanelView(); 27 + $log_panel->appendChild($event_view); 28 + $log_panel->setNoBackground(); 29 + 30 + $daemon_id = $event->getLogID(); 31 + 32 + $crumbs = $this->buildApplicationCrumbs(); 33 + $crumbs->addCrumb( 34 + id(new PhabricatorCrumbView()) 35 + ->setName(pht('Daemon %s', $daemon_id)) 36 + ->setHref($this->getApplicationURI("log/{$daemon_id}/"))); 37 + $crumbs->addCrumb( 38 + id(new PhabricatorCrumbView()) 39 + ->setName(pht('Event %s', $event->getID()))); 40 + 41 + 42 + return $this->buildApplicationPage( 43 + array( 44 + $crumbs, 45 + $log_panel, 46 + ), 47 + array( 48 + 'title' => pht('Combined Daemon Log'), 49 + )); 50 + } 51 + 52 + }
+4 -1
src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
··· 13 13 $request = $this->getRequest(); 14 14 $user = $request->getUser(); 15 15 16 - $log = id(new PhabricatorDaemonLog())->load($this->id); 16 + $log = id(new PhabricatorDaemonLogQuery()) 17 + ->setViewer($user) 18 + ->withIDs(array($this->id)) 19 + ->executeOne(); 17 20 if (!$log) { 18 21 return new Aphront404Response(); 19 22 }
+13
src/applications/daemon/query/PhabricatorDaemonLogQuery.php
··· 6 6 const STATUS_ALL = 'status-all'; 7 7 const STATUS_ALIVE = 'status-alive'; 8 8 9 + private $ids; 9 10 private $status = self::STATUS_ALL; 10 11 11 12 public static function getTimeUntilUnknown() { ··· 14 15 15 16 public static function getTimeUntilDead() { 16 17 return 30 * PhutilDaemonOverseer::HEARTBEAT_WAIT; 18 + } 19 + 20 + public function withIDs(array $ids) { 21 + $this->ids = $ids; 22 + return $this; 17 23 } 18 24 19 25 public function withStatus($status) { ··· 88 94 89 95 private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 90 96 $where = array(); 97 + 98 + if ($this->ids) { 99 + $where[] = qsprintf( 100 + $conn_r, 101 + 'id IN (%Ld)', 102 + $this->ids); 103 + } 91 104 92 105 if ($this->getStatusConstants()) { 93 106 $where[] = qsprintf(
+50 -25
src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
··· 4 4 5 5 private $events; 6 6 private $combinedLog; 7 + private $showFullMessage; 8 + 9 + 10 + public function setShowFullMessage($show_full_message) { 11 + $this->showFullMessage = $show_full_message; 12 + return $this; 13 + } 7 14 8 15 public function setEvents(array $events) { 9 16 assert_instances_of($events, 'PhabricatorDaemonLogEvent'); ··· 31 38 // truncation if that doesn't get things short enough. 32 39 33 40 $message = $event->getMessage(); 41 + $more = null; 34 42 35 - $more_lines = null; 36 - $more_chars = null; 37 - $line_limit = 12; 38 - if (substr_count($message, "\n") > $line_limit) { 39 - $message = explode("\n", $message); 40 - $more_lines = count($message) - $line_limit; 41 - $message = array_slice($message, 0, $line_limit); 42 - $message = implode("\n", $message); 43 - } 43 + if (!$this->showFullMessage) { 44 + $more_lines = null; 45 + $more_chars = null; 46 + $line_limit = 12; 47 + if (substr_count($message, "\n") > $line_limit) { 48 + $message = explode("\n", $message); 49 + $more_lines = count($message) - $line_limit; 50 + $message = array_slice($message, 0, $line_limit); 51 + $message = implode("\n", $message); 52 + } 44 53 45 - $char_limit = 8192; 46 - if (strlen($message) > $char_limit) { 47 - $message = phutil_utf8v($message); 48 - $more_chars = count($message) - $char_limit; 49 - $message = array_slice($message, 0, $char_limit); 50 - $message = implode('', $message); 51 - } 54 + $char_limit = 8192; 55 + if (strlen($message) > $char_limit) { 56 + $message = phutil_utf8v($message); 57 + $more_chars = count($message) - $char_limit; 58 + $message = array_slice($message, 0, $char_limit); 59 + $message = implode('', $message); 60 + } 61 + 62 + if ($more_chars) { 63 + $more = new PhutilNumber($more_chars); 64 + $more = pht("Show %d more character(s)...", $more); 65 + } else if ($more_lines) { 66 + $more = new PhutilNumber($more_lines); 67 + $more = pht("Show %d more line(s)...", $more); 68 + } 52 69 53 - $more = null; 54 - if ($more_chars) { 55 - $more = number_format($more_chars); 56 - $more = "\n<... {$more} more characters ...>"; 57 - } else if ($more_lines) { 58 - $more = number_format($more_lines); 59 - $more = "\n<... {$more} more lines ...>"; 70 + if ($more) { 71 + $id = $event->getID(); 72 + $more = array( 73 + "\n...\n", 74 + phutil_tag( 75 + 'a', 76 + array( 77 + 'href' => "/daemon/event/{$id}/", 78 + ), 79 + $more), 80 + ); 81 + } 60 82 } 61 83 62 84 $row = array( 63 85 $event->getLogType(), 64 86 phabricator_date($event->getEpoch(), $this->user), 65 87 phabricator_time($event->getEpoch(), $this->user), 66 - phutil_escape_html_newlines($message.$more), 88 + array( 89 + $message, 90 + $more, 91 + ), 67 92 ); 68 93 69 94 if ($this->combinedLog) { ··· 84 109 '', 85 110 '', 86 111 'right', 87 - 'wide wrap', 112 + 'wide prewrap', 88 113 ); 89 114 90 115 $headers = array(
+6
webroot/rsrc/css/aphront/table-view.css
··· 168 168 white-space: normal; 169 169 } 170 170 171 + .aphront-table-view td.prewrap { 172 + font-family: "Monaco", monospace; 173 + font-size: 11px; 174 + white-space: pre-wrap; 175 + } 176 + 171 177 .aphront-table-view td.narrow { 172 178 width: 1px; 173 179 }