Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15282679
D20887.id49791.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D20887.id49791.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4648,6 +4648,7 @@
'PhabricatorSearchEngineExtensionModule' => 'applications/search/engineextension/PhabricatorSearchEngineExtensionModule.php',
'PhabricatorSearchFerretNgramGarbageCollector' => 'applications/search/garbagecollector/PhabricatorSearchFerretNgramGarbageCollector.php',
'PhabricatorSearchField' => 'applications/search/field/PhabricatorSearchField.php',
+ 'PhabricatorSearchHandleController' => 'applications/search/controller/PhabricatorSearchHandleController.php',
'PhabricatorSearchHost' => 'infrastructure/cluster/search/PhabricatorSearchHost.php',
'PhabricatorSearchHovercardController' => 'applications/search/controller/PhabricatorSearchHovercardController.php',
'PhabricatorSearchIndexVersion' => 'applications/search/storage/PhabricatorSearchIndexVersion.php',
@@ -4872,6 +4873,7 @@
'PhabricatorSystemActionRateLimitException' => 'applications/system/exception/PhabricatorSystemActionRateLimitException.php',
'PhabricatorSystemApplication' => 'applications/system/application/PhabricatorSystemApplication.php',
'PhabricatorSystemDAO' => 'applications/system/storage/PhabricatorSystemDAO.php',
+ 'PhabricatorSystemDebugUIEventListener' => 'applications/system/events/PhabricatorSystemDebugUIEventListener.php',
'PhabricatorSystemDestructionGarbageCollector' => 'applications/system/garbagecollector/PhabricatorSystemDestructionGarbageCollector.php',
'PhabricatorSystemDestructionLog' => 'applications/system/storage/PhabricatorSystemDestructionLog.php',
'PhabricatorSystemObjectController' => 'applications/system/controller/PhabricatorSystemObjectController.php',
@@ -11270,6 +11272,7 @@
'PhabricatorSearchEngineExtensionModule' => 'PhabricatorConfigModule',
'PhabricatorSearchFerretNgramGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorSearchField' => 'Phobject',
+ 'PhabricatorSearchHandleController' => 'PhabricatorSearchBaseController',
'PhabricatorSearchHost' => 'Phobject',
'PhabricatorSearchHovercardController' => 'PhabricatorSearchBaseController',
'PhabricatorSearchIndexVersion' => 'PhabricatorSearchDAO',
@@ -11511,6 +11514,7 @@
'PhabricatorSystemActionRateLimitException' => 'Exception',
'PhabricatorSystemApplication' => 'PhabricatorApplication',
'PhabricatorSystemDAO' => 'PhabricatorLiskDAO',
+ 'PhabricatorSystemDebugUIEventListener' => 'PhabricatorEventListener',
'PhabricatorSystemDestructionGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorSystemDestructionLog' => 'PhabricatorSystemDAO',
'PhabricatorSystemObjectController' => 'PhabricatorController',
diff --git a/src/applications/search/application/PhabricatorSearchApplication.php b/src/applications/search/application/PhabricatorSearchApplication.php
--- a/src/applications/search/application/PhabricatorSearchApplication.php
+++ b/src/applications/search/application/PhabricatorSearchApplication.php
@@ -33,6 +33,8 @@
'index/(?P<phid>[^/]+)/' => 'PhabricatorSearchIndexController',
'hovercard/'
=> 'PhabricatorSearchHovercardController',
+ 'handle/(?P<phid>[^/]+)/'
+ => 'PhabricatorSearchHandleController',
'edit/' => array(
'key/(?P<queryKey>[^/]+)/' => 'PhabricatorSearchEditController',
'id/(?P<id>[^/]+)/' => 'PhabricatorSearchEditController',
diff --git a/src/applications/search/controller/PhabricatorSearchHandleController.php b/src/applications/search/controller/PhabricatorSearchHandleController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/controller/PhabricatorSearchHandleController.php
@@ -0,0 +1,89 @@
+<?php
+
+final class PhabricatorSearchHandleController
+ extends PhabricatorSearchBaseController {
+
+ public function shouldAllowPublic() {
+ return true;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $phid = $request->getURIData('phid');
+
+ $handles = $viewer->loadHandles(array($phid));
+ $handle = $handles[$phid];
+
+ $cancel_uri = $handle->getURI();
+ if (!$cancel_uri) {
+ $cancel_uri = '/';
+ }
+
+ $rows = array();
+
+ $rows[] = array(
+ pht('PHID'),
+ $phid,
+ );
+
+ $rows[] = array(
+ pht('PHID Type'),
+ phid_get_type($phid),
+ );
+
+ $rows[] = array(
+ pht('URI'),
+ $handle->getURI(),
+ );
+
+ $icon = $handle->getIcon();
+ if ($icon !== null) {
+ $icon = id(new PHUIIconView())
+ ->setIcon($handle->getIcon());
+ }
+
+ $rows[] = array(
+ pht('Icon'),
+ $icon,
+ );
+
+ $rows[] = array(
+ pht('Object Name'),
+ $handle->getObjectName(),
+ );
+
+ $rows[] = array(
+ pht('Name'),
+ $handle->getName(),
+ );
+
+ $rows[] = array(
+ pht('Full Name'),
+ $handle->getFullName(),
+ );
+
+ $rows[] = array(
+ pht('Tag'),
+ $handle->renderTag(),
+ );
+
+ $rows[] = array(
+ pht('Link'),
+ $handle->renderLink(),
+ );
+
+ $table = id(new AphrontTableView($rows))
+ ->setColumnClasses(
+ array(
+ 'header',
+ 'wide',
+ ));
+
+ return $this->newDialog()
+ ->setTitle(pht('Handle: %s', $phid))
+ ->setWidth(AphrontDialogView::WIDTH_FORM)
+ ->appendChild($table)
+ ->addCancelButton($cancel_uri, pht('Done'));
+ }
+
+}
diff --git a/src/applications/system/application/PhabricatorSystemApplication.php b/src/applications/system/application/PhabricatorSystemApplication.php
--- a/src/applications/system/application/PhabricatorSystemApplication.php
+++ b/src/applications/system/application/PhabricatorSystemApplication.php
@@ -14,6 +14,12 @@
return true;
}
+ public function getEventListeners() {
+ return array(
+ new PhabricatorSystemDebugUIEventListener(),
+ );
+ }
+
public function getRoutes() {
return array(
'/status/' => 'PhabricatorStatusController',
diff --git a/src/applications/system/events/PhabricatorSystemDebugUIEventListener.php b/src/applications/system/events/PhabricatorSystemDebugUIEventListener.php
new file mode 100644
--- /dev/null
+++ b/src/applications/system/events/PhabricatorSystemDebugUIEventListener.php
@@ -0,0 +1,58 @@
+<?php
+
+final class PhabricatorSystemDebugUIEventListener
+ extends PhabricatorEventListener {
+
+ public function register() {
+ $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);
+ }
+
+ public function handleEvent(PhutilEvent $event) {
+ switch ($event->getType()) {
+ case PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS:
+ $this->handleActionEvent($event);
+ break;
+ }
+ }
+
+ private function handleActionEvent($event) {
+ $viewer = $event->getUser();
+ $object = $event->getValue('object');
+
+ if (!PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
+ return;
+ }
+
+ if (!$object || !$object->getPHID()) {
+ // If we have no object, or the object doesn't have a PHID, we can't
+ // do anything useful.
+ return;
+ }
+
+ $phid = $object->getPHID();
+
+ $submenu = array();
+
+ $submenu[] = id(new PhabricatorActionView())
+ ->setIcon('fa-asterisk')
+ ->setName(pht('View Handle'))
+ ->setHref(urisprintf('/search/handle/%s/', $phid))
+ ->setWorkflow(true);
+
+ $submenu[] = id(new PhabricatorActionView())
+ ->setIcon('fa-address-card-o')
+ ->setName(pht('View Hovercard'))
+ ->setHref(urisprintf('/search/hovercard/?phids[]=%s', $phid));
+
+ $developer_action = id(new PhabricatorActionView())
+ ->setName(pht('Advanced/Developer...'))
+ ->setIcon('fa-magic')
+ ->setOrder(9001)
+ ->setSubmenu($submenu);
+
+ $actions = $event->getValue('actions');
+ $actions[] = $developer_action;
+ $event->setValue('actions', $actions);
+ }
+
+}
diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php
--- a/src/view/layout/PhabricatorActionListView.php
+++ b/src/view/layout/PhabricatorActionListView.php
@@ -52,6 +52,14 @@
$action->setViewer($viewer);
}
+ $sort = array();
+ foreach ($actions as $key => $action) {
+ $sort[$key] = id(new PhutilSortVector())
+ ->addInt($action->getOrder());
+ }
+ $sort = msortv($sort, 'getSelf');
+ $actions = array_select_keys($actions, array_keys($sort));
+
require_celerity_resource('phabricator-action-list-view-css');
$items = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 1:24 AM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223273
Default Alt Text
D20887.id49791.diff (8 KB)
Attached To
Mode
D20887: Add an "Advanced/Developer..." action item for viewing object handle details and hovercards
Attached
Detach File
Event Timeline
Log In to Comment