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

Add icons to the new repository edit nav

Summary:
Ref T10748. These:

- Look nice.
- Hint at panel contents / effects.
- Hint which panels have been customized.
- Allow panels with issues or errors to be highlighted with an alert/attention icon.

Test Plan: {F1256156}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

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

+227 -10
+3 -3
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => 'ea0dfb3d', 10 + 'core.pkg.css' => '9968bf8d', 11 11 'core.pkg.js' => '6972d365', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => '7ba78475', ··· 113 113 'rsrc/css/font/font-lato.css' => 'c7ccd872', 114 114 'rsrc/css/font/phui-font-icon-base.css' => '6449bce8', 115 115 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', 116 - 'rsrc/css/layout/phabricator-side-menu-view.css' => '3a3d9f41', 116 + 'rsrc/css/layout/phabricator-side-menu-view.css' => 'dd849797', 117 117 'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983', 118 118 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'd1cf6f93', 119 119 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338', ··· 780 780 'phabricator-remarkup-css' => '6aae5360', 781 781 'phabricator-search-results-css' => '7dea472c', 782 782 'phabricator-shaped-request' => '7cbe244b', 783 - 'phabricator-side-menu-view-css' => '3a3d9f41', 783 + 'phabricator-side-menu-view-css' => 'dd849797', 784 784 'phabricator-slowvote-css' => 'a94b7230', 785 785 'phabricator-source-code-view-css' => 'cbeef983', 786 786 'phabricator-standard-page-view' => 'e709f6d0',
+13 -3
src/applications/diffusion/controller/DiffusionRepositoryManageController.php
··· 106 106 ->setBaseURI($base_uri); 107 107 108 108 foreach ($panels as $panel) { 109 - $nav->addFilter( 110 - $panel->getManagementPanelKey(), 111 - $panel->getManagementPanelLabel()); 109 + $key = $panel->getManagementPanelKey(); 110 + $label = $panel->getManagementPanelLabel(); 111 + $icon = $panel->getManagementPanelIcon(); 112 + $href = $repository->getPathURI("manage/{$key}/"); 113 + 114 + $item = id(new PHUIListItemView()) 115 + ->setKey($key) 116 + ->setName($label) 117 + ->setType(PHUIListItemView::TYPE_LINK) 118 + ->setHref($href) 119 + ->setIcon($icon); 120 + 121 + $nav->addMenuItem($item); 112 122 } 113 123 114 124 $nav->selectFilter($selected);
+17
src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php
··· 13 13 return 1100; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + $has_any = 20 + $repository->getDetail('herald-disabled') || 21 + $repository->getDetail('disable-autoclose'); 22 + 23 + // NOTE: Any value here really means something is disabled, so try to 24 + // hint that a little bit with the icon. 25 + 26 + if ($has_any) { 27 + return 'fa-comment-o'; 28 + } else { 29 + return 'fa-commenting grey'; 30 + } 31 + } 32 + 16 33 protected function getEditEngineFieldKeys() { 17 34 return array( 18 35 'publish',
+22
src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php
··· 19 19 ); 20 20 } 21 21 22 + public function getManagementPanelIcon() { 23 + $repository = $this->getRepository(); 24 + 25 + if (!$repository->canPerformAutomation()) { 26 + return 'fa-truck grey'; 27 + } 28 + 29 + $blueprint_phids = $repository->getAutomationBlueprintPHIDs(); 30 + if (!$blueprint_phids) { 31 + return 'fa-truck grey'; 32 + } 33 + 34 + $is_authorized = DrydockAuthorizationQuery::isFullyAuthorized( 35 + $repository->getPHID(), 36 + $blueprint_phids); 37 + if (!$is_authorized) { 38 + return 'fa-exclamation-triangle yellow'; 39 + } 40 + 41 + return 'fa-truck'; 42 + } 43 + 22 44 protected function buildManagementPanelActions() { 23 45 $repository = $this->getRepository(); 24 46 $viewer = $this->getViewer();
+10
src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
··· 13 13 return 100; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + if (!$repository->isTracked()) { 20 + return 'fa-ban indigo'; 21 + } else { 22 + return 'fa-code'; 23 + } 24 + } 25 + 16 26 protected function getEditEngineFieldKeys() { 17 27 return array( 18 28 'name',
+15
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
··· 13 13 return 1000; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + $has_any = 20 + $repository->getDetail('default-branch') || 21 + $repository->getDetail('branch-filter') || 22 + $repository->getDetail('close-commits-filter'); 23 + 24 + if ($has_any) { 25 + return 'fa-code-fork'; 26 + } else { 27 + return 'fa-code-fork grey'; 28 + } 29 + } 30 + 16 31 protected function getEditEngineFieldKeys() { 17 32 return array( 18 33 'defaultBranch',
+4
src/applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php
··· 13 13 return 2000; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + return 'fa-list-ul'; 18 + } 19 + 16 20 public function buildManagementPanelContent() { 17 21 return $this->newTimeline(); 18 22 }
+4
src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
··· 38 38 abstract public function getManagementPanelOrder(); 39 39 abstract public function buildManagementPanelContent(); 40 40 41 + public function getManagementPanelIcon() { 42 + return 'fa-pencil'; 43 + } 44 + 41 45 protected function buildManagementPanelActions() { 42 46 return array(); 43 47 }
+32
src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php
··· 13 13 return 300; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $viewer = $this->getViewer(); 18 + $repository = $this->getRepository(); 19 + 20 + $can_view = PhabricatorPolicyCapability::CAN_VIEW; 21 + $can_edit = PhabricatorPolicyCapability::CAN_EDIT; 22 + $can_push = DiffusionPushCapability::CAPABILITY; 23 + 24 + $actual_values = array( 25 + 'spacePHID' => $repository->getSpacePHID(), 26 + 'view' => $repository->getPolicy($can_view), 27 + 'edit' => $repository->getPolicy($can_edit), 28 + 'push' => $repository->getPolicy($can_push), 29 + ); 30 + 31 + $default = PhabricatorRepository::initializeNewRepository( 32 + $viewer); 33 + 34 + $default_values = array( 35 + 'spacePHID' => $default->getSpacePHID(), 36 + 'view' => $default->getPolicy($can_view), 37 + 'edit' => $default->getPolicy($can_edit), 38 + 'push' => $default->getPolicy($can_push), 39 + ); 40 + 41 + if ($actual_values === $default_values) { 42 + return 'fa-lock grey'; 43 + } else { 44 + return 'fa-lock'; 45 + } 46 + } 47 + 16 48 protected function getEditEngineFieldKeys() { 17 49 return array( 18 50 'policy.view',
+12
src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php
··· 13 13 return 700; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + $staging_uri = $repository->getStagingURI(); 20 + 21 + if ($staging_uri) { 22 + return 'fa-upload'; 23 + } else { 24 + return 'fa-upload grey'; 25 + } 26 + } 27 + 16 28 protected function getEditEngineFieldKeys() { 17 29 return array( 18 30 'stagingAreaURI',
+24 -3
src/applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php
··· 13 13 return 200; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + // TODO: We could try to show a warning icon in more cases, but just 20 + // raise in the most serious cases for now. 21 + $messages = $this->loadStatusMessages($repository); 22 + 23 + $raw_error = $this->buildRepositoryRawError($repository, $messages); 24 + if ($raw_error) { 25 + return 'fa-exclamation-triangle red'; 26 + } 27 + 28 + return 'fa-check grey'; 29 + } 30 + 16 31 protected function buildManagementPanelActions() { 17 32 $repository = $this->getRepository(); 18 33 $viewer = $this->getViewer(); ··· 46 61 pht('Update Frequency'), 47 62 $this->buildRepositoryUpdateInterval($repository)); 48 63 49 - $messages = id(new PhabricatorRepositoryStatusMessage()) 50 - ->loadAllWhere('repositoryID = %d', $repository->getID()); 51 - $messages = mpull($messages, null, 'getStatusType'); 64 + $messages = $this->loadStatusMessages($repository); 52 65 53 66 $status = $this->buildRepositoryStatus($repository, $messages); 54 67 $raw_error = $this->buildRepositoryRawError($repository, $messages); ··· 467 480 } 468 481 469 482 return $raw_message; 483 + } 484 + 485 + private function loadStatusMessages(PhabricatorRepository $repository) { 486 + $messages = id(new PhabricatorRepositoryStatusMessage()) 487 + ->loadAllWhere('repositoryID = %d', $repository->getID()); 488 + $messages = mpull($messages, null, 'getStatusType'); 489 + 490 + return $messages; 470 491 } 471 492 472 493
+12
src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php
··· 13 13 return 600; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + if ($repository->getAlmanacServicePHID()) { 20 + return 'fa-sitemap'; 21 + } else if ($repository->isHosted()) { 22 + return 'fa-folder'; 23 + } else { 24 + return 'fa-download'; 25 + } 26 + } 27 + 16 28 public function buildManagementPanelContent() { 17 29 return array( 18 30 $this->buildStorageStatusPanel(),
+14
src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php
··· 13 13 return 900; 14 14 } 15 15 16 + public function getManagementPanelIcon() { 17 + $repository = $this->getRepository(); 18 + 19 + $has_any = 20 + $repository->getSymbolLanguages() || 21 + $repository->getSymbolSources(); 22 + 23 + if ($has_any) { 24 + return 'fa-link'; 25 + } else { 26 + return 'fa-link grey'; 27 + } 28 + } 29 + 16 30 protected function getEditEngineFieldKeys() { 17 31 return array( 18 32 'symbolLanguages',
+5 -1
src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
··· 9 9 return pht('Clone / Fetch / Mirror'); 10 10 } 11 11 12 + public function getManagementPanelIcon() { 13 + return 'fa-cogs'; 14 + } 15 + 12 16 public function getManagementPanelOrder() { 13 - return 300; 17 + return 400; 14 18 } 15 19 16 20 public function buildManagementPanelContent() {
+29
src/applications/drydock/query/DrydockAuthorizationQuery.php
··· 9 9 private $blueprintStates; 10 10 private $objectStates; 11 11 12 + public static function isFullyAuthorized( 13 + $object_phid, 14 + array $blueprint_phids) { 15 + 16 + if (!$blueprint_phids) { 17 + return true; 18 + } 19 + 20 + $authorizations = id(new self()) 21 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 22 + ->withObjectPHIDs(array($object_phid)) 23 + ->withBlueprintPHIDs($blueprint_phids) 24 + ->execute(); 25 + $authorizations = mpull($authorizations, null, 'getBlueprintPHID'); 26 + 27 + foreach ($blueprint_phids as $phid) { 28 + $authorization = idx($authorizations, $phid); 29 + if (!$authorization) { 30 + return false; 31 + } 32 + 33 + if (!$authorization->isAuthorized()) { 34 + return false; 35 + } 36 + } 37 + 38 + return true; 39 + } 40 + 12 41 public function withIDs(array $ids) { 13 42 $this->ids = $ids; 14 43 return $this;
+5
src/applications/drydock/storage/DrydockAuthorization.php
··· 93 93 return idx($map, $state, pht('<Unknown: %s>', $state)); 94 94 } 95 95 96 + public function isAuthorized() { 97 + $state = $this->getBlueprintAuthorizationState(); 98 + return ($state == self::BLUEPRINTAUTH_AUTHORIZED); 99 + } 100 + 96 101 /** 97 102 * Apply external authorization effects after a user chagnes the value of a 98 103 * blueprint selector control an object.
+6
webroot/rsrc/css/layout/phabricator-side-menu-view.css
··· 18 18 border-bottom-right-radius: 3px; 19 19 } 20 20 21 + .phabricator-basic-nav .phabricator-side-menu .phui-list-item-icon { 22 + margin-left: -12px; 23 + text-align: center; 24 + width: 24px; 25 + } 26 + 21 27 .phabricator-basic-nav .phabricator-side-menu .phui-list-item-selected { 22 28 background-color: rgba({$alphablack},.05); 23 29 border-left: 4px solid {$sky};