@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.

Make Panels slightly easier to find and use

Summary: Ref T10390, turns "add existing panel" into a typeahead, and add lots more information to search.

Test Plan: Add an existing panel, click the search icon, see more information (type, engine).

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10390

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

+42 -17
+6 -13
src/applications/dashboard/controller/PhabricatorDashboardAddPanelController.php
··· 23 23 $redirect_uri = $this->getApplicationURI( 24 24 'arrange/'.$dashboard->getID().'/'); 25 25 26 - $v_panel = $request->getStr('panel'); 26 + $v_panel = head($request->getArr('panel')); 27 27 $e_panel = true; 28 28 $errors = array(); 29 29 if ($request->isFormPost()) { ··· 70 70 ->addCancelButton($redirect_uri); 71 71 } 72 72 73 - $panel_options = array(); 74 - foreach ($panels as $panel) { 75 - $panel_options[$panel->getID()] = pht( 76 - '%s %s', 77 - $panel->getMonogram(), 78 - $panel->getName()); 79 - } 80 - 81 73 $form = id(new AphrontFormView()) 82 74 ->setUser($viewer) 83 75 ->addHiddenInput('column', $request->getInt('column')) 84 76 ->appendRemarkupInstructions( 85 77 pht('Choose a panel to add to this dashboard:')) 86 78 ->appendChild( 87 - id(new AphrontFormSelectControl()) 79 + id(new AphrontFormTokenizerControl()) 80 + ->setUser($this->getViewer()) 81 + ->setDatasource(new PhabricatorDashboardPanelDatasource()) 82 + ->setLimit(1) 88 83 ->setName('panel') 89 84 ->setLabel(pht('Panel')) 90 - ->setValue($v_panel) 91 - ->setError($e_panel) 92 - ->setOptions($panel_options)); 85 + ->setValue($v_panel)); 93 86 94 87 return $this->newDialog() 95 88 ->setTitle(pht('Add Panel'))
+1
src/applications/dashboard/paneltype/PhabricatorDashboardPanelType.php
··· 6 6 abstract public function getPanelTypeName(); 7 7 abstract public function getPanelTypeDescription(); 8 8 abstract public function getFieldSpecifications(); 9 + abstract public function getIcon(); 9 10 10 11 abstract public function renderPanelContent( 11 12 PhabricatorUser $viewer,
+4
src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
··· 11 11 return pht('Query Panel'); 12 12 } 13 13 14 + public function getIcon() { 15 + return 'fa-search'; 16 + } 17 + 14 18 public function getPanelTypeDescription() { 15 19 return pht( 16 20 'Show results of a search query, like the most recently filed tasks or '.
+4
src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php
··· 11 11 return pht('Tab Panel'); 12 12 } 13 13 14 + public function getIcon() { 15 + return 'fa-window-maximize'; 16 + } 17 + 14 18 public function getPanelTypeDescription() { 15 19 return pht('Use tabs to switch between several other panels.'); 16 20 }
+4
src/applications/dashboard/paneltype/PhabricatorDashboardTextPanelType.php
··· 11 11 return pht('Text Panel'); 12 12 } 13 13 14 + public function getIcon() { 15 + return 'fa-paragraph'; 16 + } 17 + 14 18 public function getPanelTypeDescription() { 15 19 return pht( 16 20 'Add some static text to the dashboard. This can be used to '.
+23 -4
src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php
··· 16 16 } 17 17 18 18 public function loadResults() { 19 - $query = id(new PhabricatorDashboardPanelQuery()); 19 + $results = $this->buildResults(); 20 + return $this->filterResultsAgainstTokens($results); 21 + } 22 + 20 23 24 + protected function renderSpecialTokens(array $values) { 25 + return $this->renderTokensFromResults($this->buildResults(), $values); 26 + } 27 + 28 + public function buildResults() { 29 + $query = id(new PhabricatorDashboardPanelQuery()); 21 30 $panels = $this->executeQuery($query); 31 + 22 32 $results = array(); 23 33 foreach ($panels as $panel) { 24 34 $impl = $panel->getImplementation(); ··· 27 37 } else { 28 38 $type_text = nonempty($panel->getPanelType(), pht('Unknown Type')); 29 39 } 40 + $id = $panel->getID(); 41 + $monogram = $panel->getMonogram(); 42 + $properties = $panel->getProperties(); 30 43 31 44 $result = id(new PhabricatorTypeaheadResult()) 32 45 ->setName($panel->getName()) 33 - ->setPHID($panel->getPHID()) 46 + ->setDisplayName($monogram.' '.$panel->getName()) 47 + ->setPHID($id) 48 + ->setIcon($impl->getIcon()) 34 49 ->addAttribute($type_text); 35 50 51 + if (!empty($properties['class'])) { 52 + $result->addAttribute($properties['class']); 53 + } 54 + 36 55 if ($panel->getIsArchived()) { 37 56 $result->setClosed(pht('Archived')); 38 57 } 39 58 40 - $results[] = $result; 59 + $results[$id] = $result; 41 60 } 42 61 43 - return $this->filterResultsAgainstTokens($results); 62 + return $results; 44 63 } 45 64 46 65 }