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

Convert the "Repository Management" UI to a full-width, Phortune-style UI

Summary:
Ref T13216. I want to add some new management options to repositories (e.g., filesize limit, clone timeouts). Before adding new stuff here, update the UI to a full-width, Phortune-style UI.

This partially reverts D18523. About a year ago, several UIs got converted to fixed-width (repository management, config, settings, instance management in SAAS). I didn't think these were good changes and have never really gotten used to them. The rationale wasn't clear to me and these changes just felt like "be more like GitHub". I think usability is significantly worse, e.g. actions are now hidden inside button menus instead of immediately visible.

Phortune also got converted less dramatically to a full-width-with-menu UI, which I like much better. Adjust repository management to use that UI style instead of the fixed-width style.

Test Plan:
{F6020884}

Viewed every panel, including the Subversion panel.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216

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

+405 -210
+6 -2
src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
··· 68 68 69 69 $view = id(new PHUITwoColumnView()) 70 70 ->setHeader($header) 71 - ->setNavigation($nav) 72 - ->setFixed(true) 73 71 ->setMainColumn($content); 74 72 73 + $curtain = $panel->buildManagementPanelCurtain(); 74 + if ($curtain) { 75 + $view->setCurtain($curtain); 76 + } 77 + 75 78 return $this->newPage() 76 79 ->setTitle($title) 77 80 ->setCrumbs($crumbs) 81 + ->setNavigation($nav) 78 82 ->appendChild($view); 79 83 } 80 84
+39 -17
src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php
··· 14 14 } 15 15 16 16 public function getManagementPanelIcon() { 17 - return 'fa-flash'; 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-flash'; 28 + } else { 29 + return 'fa-flash grey'; 30 + } 18 31 } 19 32 20 33 protected function getEditEngineFieldKeys() { ··· 24 37 ); 25 38 } 26 39 40 + public function buildManagementPanelCurtain() { 41 + $repository = $this->getRepository(); 42 + $viewer = $this->getViewer(); 43 + $action_list = $this->newActionList(); 44 + 45 + $can_edit = PhabricatorPolicyFilter::hasCapability( 46 + $viewer, 47 + $repository, 48 + PhabricatorPolicyCapability::CAN_EDIT); 49 + 50 + $actions_uri = $this->getEditPageURI(); 51 + 52 + $action_list->addAction( 53 + id(new PhabricatorActionView()) 54 + ->setIcon('fa-pencil') 55 + ->setName(pht('Edit Actions')) 56 + ->setHref($actions_uri) 57 + ->setDisabled(!$can_edit) 58 + ->setWorkflow(!$can_edit)); 59 + 60 + return $this->newCurtainView() 61 + ->setActionList($action_list); 62 + } 63 + 27 64 public function buildManagementPanelContent() { 28 65 $repository = $this->getRepository(); 29 66 $viewer = $this->getViewer(); ··· 43 80 $autoclose = phutil_tag('em', array(), $autoclose); 44 81 $view->addProperty(pht('Autoclose'), $autoclose); 45 82 46 - $can_edit = PhabricatorPolicyFilter::hasCapability( 47 - $viewer, 48 - $repository, 49 - PhabricatorPolicyCapability::CAN_EDIT); 50 - 51 - $actions_uri = $this->getEditPageURI(); 52 - 53 - $button = id(new PHUIButtonView()) 54 - ->setTag('a') 55 - ->setIcon('fa-pencil') 56 - ->setText(pht('Edit')) 57 - ->setHref($actions_uri) 58 - ->setDisabled(!$can_edit) 59 - ->setWorkflow(!$can_edit); 60 - 61 - return $this->newBox(pht('Actions'), $view, array($button)); 83 + return $this->newBox(pht('Actions'), $view); 62 84 } 63 85 64 86 }
+44 -28
src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php
··· 27 27 public function getManagementPanelIcon() { 28 28 $repository = $this->getRepository(); 29 29 30 + if (!$repository->canPerformAutomation()) { 31 + return 'fa-truck grey'; 32 + } 33 + 30 34 $blueprint_phids = $repository->getAutomationBlueprintPHIDs(); 35 + if (!$blueprint_phids) { 36 + return 'fa-truck grey'; 37 + } 31 38 32 39 $is_authorized = DrydockAuthorizationQuery::isFullyAuthorized( 33 40 $repository->getPHID(), 34 41 $blueprint_phids); 35 42 if (!$is_authorized) { 36 - return 'fa-exclamation-triangle'; 43 + return 'fa-exclamation-triangle yellow'; 37 44 } 38 45 39 46 return 'fa-truck'; 40 47 } 41 48 49 + public function buildManagementPanelCurtain() { 50 + $repository = $this->getRepository(); 51 + $viewer = $this->getViewer(); 52 + $action_list = $this->newActionList(); 53 + 54 + $can_edit = PhabricatorPolicyFilter::hasCapability( 55 + $viewer, 56 + $repository, 57 + PhabricatorPolicyCapability::CAN_EDIT); 58 + 59 + $can_test = $can_edit && $repository->canPerformAutomation(); 60 + 61 + $automation_uri = $this->getEditPageURI(); 62 + $test_uri = $repository->getPathURI('edit/testautomation/'); 63 + 64 + $action_list->addAction( 65 + id(new PhabricatorActionView()) 66 + ->setIcon('fa-pencil') 67 + ->setName(pht('Edit Automation')) 68 + ->setHref($automation_uri) 69 + ->setDisabled(!$can_edit) 70 + ->setWorkflow(!$can_edit)); 71 + 72 + $action_list->addAction( 73 + id(new PhabricatorActionView()) 74 + ->setIcon('fa-gamepad') 75 + ->setName(pht('Test Configuration')) 76 + ->setWorkflow(true) 77 + ->setDisabled(!$can_test) 78 + ->setHref($test_uri)); 79 + 80 + return $this->newCurtainView() 81 + ->setActionList($action_list); 82 + } 83 + 42 84 public function buildManagementPanelContent() { 43 85 $repository = $this->getRepository(); 44 86 $viewer = $this->getViewer(); ··· 58 100 59 101 $view->addProperty(pht('Automation'), $blueprint_view); 60 102 61 - $can_edit = PhabricatorPolicyFilter::hasCapability( 62 - $viewer, 63 - $repository, 64 - PhabricatorPolicyCapability::CAN_EDIT); 65 - 66 - $can_test = $can_edit && $repository->canPerformAutomation(); 67 - 68 - $automation_uri = $this->getEditPageURI(); 69 - $test_uri = $repository->getPathURI('edit/testautomation/'); 70 - 71 - $edit = id(new PHUIButtonView()) 72 - ->setTag('a') 73 - ->setIcon('fa-pencil') 74 - ->setText(pht('Edit')) 75 - ->setHref($automation_uri) 76 - ->setDisabled(!$can_edit) 77 - ->setWorkflow(!$can_edit); 78 - 79 - $test = id(new PHUIButtonView()) 80 - ->setTag('a') 81 - ->setIcon('fa-gamepad') 82 - ->setText(pht('Test Config')) 83 - ->setWorkflow(true) 84 - ->setDisabled(!$can_test) 85 - ->setHref($test_uri); 86 - 87 - return $this->newBox(pht('Automation'), $view, array($edit, $test)); 103 + return $this->newBox(pht('Automation'), $view); 88 104 } 89 105 90 106 }
+28 -28
src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
··· 27 27 ); 28 28 } 29 29 30 - private function buildActionMenu() { 30 + public function buildManagementPanelCurtain() { 31 31 $repository = $this->getRepository(); 32 32 $viewer = $this->getViewer(); 33 + 33 34 $action_list = id(new PhabricatorActionListView()) 34 35 ->setViewer($viewer); 35 36 ··· 44 45 $encoding_uri = $this->getEditPageURI('encoding'); 45 46 $dangerous_uri = $repository->getPathURI('edit/dangerous/'); 46 47 $enormous_uri = $repository->getPathURI('edit/enormous/'); 48 + $update_uri = $repository->getPathURI('edit/update/'); 47 49 48 50 if ($repository->isTracked()) { 51 + $activate_icon = 'fa-ban'; 49 52 $activate_label = pht('Deactivate Repository'); 50 53 } else { 54 + $activate_icon = 'fa-check'; 51 55 $activate_label = pht('Activate Repository'); 52 56 } 53 57 54 58 $should_dangerous = $repository->shouldAllowDangerousChanges(); 55 59 if ($should_dangerous) { 60 + $dangerous_icon = 'fa-shield'; 56 61 $dangerous_name = pht('Prevent Dangerous Changes'); 57 62 $can_dangerous = $can_edit; 58 63 } else { 64 + $dangerous_icon = 'fa-exclamation-triangle'; 59 65 $dangerous_name = pht('Allow Dangerous Changes'); 60 66 $can_dangerous = ($can_edit && $repository->canAllowDangerousChanges()); 61 67 } 62 68 63 69 $should_enormous = $repository->shouldAllowEnormousChanges(); 64 70 if ($should_enormous) { 71 + $enormous_icon = 'fa-shield'; 65 72 $enormous_name = pht('Prevent Enormous Changes'); 66 73 $can_enormous = $can_edit; 67 74 } else { 75 + $enormous_icon = 'fa-exclamation-triangle'; 68 76 $enormous_name = pht('Allow Enormous Changes'); 69 77 $can_enormous = ($can_edit && $repository->canAllowEnormousChanges()); 70 78 } ··· 73 81 id(new PhabricatorActionView()) 74 82 ->setName(pht('Edit Basic Information')) 75 83 ->setHref($edit_uri) 84 + ->setIcon('fa-pencil') 76 85 ->setDisabled(!$can_edit) 77 86 ->setWorkflow(!$can_edit)); 78 87 79 88 $action_list->addAction( 80 89 id(new PhabricatorActionView()) 81 90 ->setName(pht('Edit Text Encoding')) 91 + ->setIcon('fa-text-width') 82 92 ->setHref($encoding_uri) 83 93 ->setDisabled(!$can_edit) 84 94 ->setWorkflow(!$can_edit)); ··· 87 97 id(new PhabricatorActionView()) 88 98 ->setName($dangerous_name) 89 99 ->setHref($dangerous_uri) 100 + ->setIcon($dangerous_icon) 90 101 ->setDisabled(!$can_dangerous) 91 102 ->setWorkflow(true)); 92 103 ··· 94 105 id(new PhabricatorActionView()) 95 106 ->setName($enormous_name) 96 107 ->setHref($enormous_uri) 108 + ->setIcon($enormous_icon) 97 109 ->setDisabled(!$can_enormous) 98 110 ->setWorkflow(true)); 99 111 100 112 $action_list->addAction( 101 113 id(new PhabricatorActionView()) 114 + ->setName($activate_label) 102 115 ->setHref($activate_uri) 103 - ->setName($activate_label) 116 + ->setIcon($activate_icon) 104 117 ->setDisabled(!$can_edit) 105 118 ->setWorkflow(true)); 106 119 107 120 $action_list->addAction( 108 121 id(new PhabricatorActionView()) 122 + ->setName(pht('Update Now')) 123 + ->setHref($update_uri) 124 + ->setIcon('fa-refresh') 125 + ->setWorkflow(true) 126 + ->setDisabled(!$can_edit)); 127 + 128 + $action_list->addAction( 129 + id(new PhabricatorActionView()) 109 130 ->setType(PhabricatorActionView::TYPE_DIVIDER)); 110 131 111 132 $action_list->addAction( 112 133 id(new PhabricatorActionView()) 113 134 ->setName(pht('Delete Repository')) 114 135 ->setHref($delete_uri) 136 + ->setIcon('fa-times') 115 137 ->setColor(PhabricatorActionView::RED) 116 138 ->setDisabled(true) 117 139 ->setWorkflow(true)); 118 140 119 - return $action_list; 141 + return $this->newCurtainView() 142 + ->setActionList($action_list); 120 143 } 121 144 122 145 public function buildManagementPanelContent() { 123 - 124 - $button = id(new PHUIButtonView()) 125 - ->setTag('a') 126 - ->setText(pht('Actions')) 127 - ->setHref('#') 128 - ->setIcon('fa-bars') 129 - ->addClass('phui-mobile-menu') 130 - ->setDropdownMenu($this->buildActionMenu()); 131 - 132 146 $basics = $this->buildBasics(); 133 - $basics = $this->newBox(pht('Properties'), $basics, array($button)); 147 + $basics = $this->newBox(pht('Properties'), $basics); 134 148 135 149 $repository = $this->getRepository(); 136 150 $is_new = $repository->isNewlyInitialized(); ··· 254 268 private function buildStatus() { 255 269 $repository = $this->getRepository(); 256 270 $viewer = $this->getViewer(); 257 - $update_uri = $repository->getPathURI('edit/update/'); 258 271 259 272 $view = id(new PHUIPropertyListView()) 260 273 ->setViewer($viewer); ··· 274 287 $view->addTextContent($raw_error); 275 288 } 276 289 277 - $can_edit = PhabricatorPolicyFilter::hasCapability( 278 - $viewer, 279 - $repository, 280 - PhabricatorPolicyCapability::CAN_EDIT); 281 - 282 - $button = id(new PHUIButtonView()) 283 - ->setTag('a') 284 - ->setIcon('fa-refresh') 285 - ->setText(pht('Update Now')) 286 - ->setWorkflow(true) 287 - ->setDisabled(!$can_edit) 288 - ->setHref($update_uri); 289 - 290 - return $this->newBox(pht('Status'), $view, array($button)); 290 + return $this->newBox(pht('Status'), $view); 291 291 } 292 292 293 293 private function buildRepositoryUpdateInterval(
+37 -17
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
··· 19 19 } 20 20 21 21 public function getManagementPanelIcon() { 22 - return 'fa-code-fork'; 22 + $repository = $this->getRepository(); 23 + 24 + $has_any = 25 + $repository->getDetail('default-branch') || 26 + $repository->getDetail('branch-filter') || 27 + $repository->getDetail('close-commits-filter'); 28 + 29 + if ($has_any) { 30 + return 'fa-code-fork'; 31 + } else { 32 + return 'fa-code-fork grey'; 33 + } 23 34 } 24 35 25 36 protected function getEditEngineFieldKeys() { ··· 30 41 ); 31 42 } 32 43 44 + public function buildManagementPanelCurtain() { 45 + $repository = $this->getRepository(); 46 + $viewer = $this->getViewer(); 47 + $action_list = $this->newActionList(); 48 + 49 + $can_edit = PhabricatorPolicyFilter::hasCapability( 50 + $viewer, 51 + $repository, 52 + PhabricatorPolicyCapability::CAN_EDIT); 53 + 54 + $branches_uri = $this->getEditPageURI(); 55 + 56 + $action_list->addAction( 57 + id(new PhabricatorActionView()) 58 + ->setIcon('fa-pencil') 59 + ->setName(pht('Edit Branches')) 60 + ->setHref($branches_uri) 61 + ->setDisabled(!$can_edit) 62 + ->setWorkflow(!$can_edit)); 63 + 64 + return $this->newCurtainView() 65 + ->setActionList($action_list); 66 + } 67 + 33 68 public function buildManagementPanelContent() { 34 69 $repository = $this->getRepository(); 35 70 $viewer = $this->getViewer(); ··· 61 96 62 97 $view->addProperty(pht('Autoclose Only'), $autoclose_only); 63 98 64 - $can_edit = PhabricatorPolicyFilter::hasCapability( 65 - $viewer, 66 - $repository, 67 - PhabricatorPolicyCapability::CAN_EDIT); 68 - 69 - $branches_uri = $this->getEditPageURI(); 70 - 71 - $button = id(new PHUIButtonView()) 72 - ->setTag('a') 73 - ->setIcon('fa-pencil') 74 - ->setText(pht('Edit')) 75 - ->setHref($branches_uri) 76 - ->setDisabled(!$can_edit) 77 - ->setWorkflow(!$can_edit); 78 - 79 - $content[] = $this->newBox(pht('Branches'), $view, array($button)); 99 + $content[] = $this->newBox(pht('Branches'), $view); 80 100 81 101 // Branch Autoclose Table 82 102 if (!$repository->isImporting()) {
+33 -16
src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
··· 41 41 abstract public function getManagementPanelLabel(); 42 42 abstract public function getManagementPanelOrder(); 43 43 abstract public function buildManagementPanelContent(); 44 + public function buildManagementPanelCurtain() { return null; } 44 45 45 46 public function getManagementPanelIcon() { 46 47 return 'fa-pencil'; ··· 61 62 ->setUniqueMethod('getManagementPanelKey') 62 63 ->setSortMethod('getManagementPanelOrder') 63 64 ->execute(); 64 - } 65 - 66 - final protected function newBox($header_text, $body, $button = array()) { 67 - $header = id(new PHUIHeaderView()) 68 - ->setHeader($header_text); 69 - 70 - foreach ($button as $link) { 71 - $header->addActionLink($link); 72 - } 73 - 74 - $view = id(new PHUIObjectBoxView()) 75 - ->setHeader($header) 76 - ->setBackground(PHUIObjectBoxView::WHITE_CONFIG) 77 - ->appendChild($body); 78 - 79 - return $view; 80 65 } 81 66 82 67 final protected function newTimeline() { ··· 122 107 123 108 public function getPanelNavigationURI() { 124 109 return $this->getPanelURI(); 110 + } 111 + 112 + final protected function newActionList() { 113 + $viewer = $this->getViewer(); 114 + $action_id = celerity_generate_unique_node_id(); 115 + 116 + return id(new PhabricatorActionListView()) 117 + ->setViewer($viewer) 118 + ->setID($action_id); 119 + } 120 + 121 + final protected function newCurtainView() { 122 + $viewer = $this->getViewer(); 123 + 124 + return id(new PHUICurtainView()) 125 + ->setViewer($viewer); 126 + } 127 + 128 + final protected function newBox($header_text, $body) { 129 + $viewer = $this->getViewer(); 130 + 131 + $header = id(new PHUIHeaderView()) 132 + ->setViewer($viewer) 133 + ->setHeader($header_text); 134 + 135 + $view = id(new PHUIObjectBoxView()) 136 + ->setViewer($viewer) 137 + ->setHeader($header) 138 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 139 + ->appendChild($body); 140 + 141 + return $view; 125 142 } 126 143 127 144 }
+55 -17
src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php
··· 14 14 } 15 15 16 16 public function getManagementPanelIcon() { 17 - return 'fa-lock'; 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 + } 18 46 } 19 47 20 48 protected function getEditEngineFieldKeys() { ··· 26 54 ); 27 55 } 28 56 57 + public function buildManagementPanelCurtain() { 58 + $repository = $this->getRepository(); 59 + $viewer = $this->getViewer(); 60 + $action_list = $this->newActionList(); 61 + 62 + $can_edit = PhabricatorPolicyFilter::hasCapability( 63 + $viewer, 64 + $repository, 65 + PhabricatorPolicyCapability::CAN_EDIT); 66 + 67 + $edit_uri = $this->getEditPageURI(); 68 + 69 + $action_list->addAction( 70 + id(new PhabricatorActionView()) 71 + ->setName(pht('Edit Policies')) 72 + ->setHref($edit_uri) 73 + ->setIcon('fa-pencil') 74 + ->setDisabled(!$can_edit) 75 + ->setWorkflow(!$can_edit)); 76 + 77 + return $this->newCurtainView() 78 + ->setActionList($action_list); 79 + } 80 + 81 + 29 82 public function buildManagementPanelContent() { 30 83 $repository = $this->getRepository(); 31 84 $viewer = $this->getViewer(); ··· 58 111 : phutil_tag('em', array(), pht('Not a Hosted Repository')); 59 112 $view->addProperty(pht('Pushable By'), $pushable); 60 113 61 - $can_edit = PhabricatorPolicyFilter::hasCapability( 62 - $viewer, 63 - $repository, 64 - PhabricatorPolicyCapability::CAN_EDIT); 65 - 66 - $edit_uri = $this->getEditPageURI(); 67 - 68 - $button = id(new PHUIButtonView()) 69 - ->setTag('a') 70 - ->setIcon('fa-pencil') 71 - ->setText(pht('Edit')) 72 - ->setHref($edit_uri) 73 - ->setDisabled(!$can_edit) 74 - ->setWorkflow(!$can_edit); 75 - 76 - return $this->newBox(pht('Policies'), $view, array($button)); 114 + return $this->newBox(pht('Policies'), $view); 77 115 } 78 116 79 117 }
+34 -18
src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php
··· 18 18 return $repository->isGit(); 19 19 } 20 20 21 + public function getManagementPanelIcon() { 22 + $repository = $this->getRepository(); 21 23 22 - public function getManagementPanelIcon() { 23 - return 'fa-upload'; 24 + $staging_uri = $repository->getStagingURI(); 25 + 26 + if ($staging_uri) { 27 + return 'fa-upload'; 28 + } else { 29 + return 'fa-upload grey'; 30 + } 24 31 } 25 32 26 33 protected function getEditEngineFieldKeys() { ··· 29 36 ); 30 37 } 31 38 39 + public function buildManagementPanelCurtain() { 40 + $repository = $this->getRepository(); 41 + $viewer = $this->getViewer(); 42 + $action_list = $this->newActionList(); 43 + 44 + $can_edit = PhabricatorPolicyFilter::hasCapability( 45 + $viewer, 46 + $repository, 47 + PhabricatorPolicyCapability::CAN_EDIT); 48 + 49 + $staging_uri = $this->getEditPageURI(); 50 + 51 + $action_list->addAction( 52 + id(new PhabricatorActionView()) 53 + ->setIcon('fa-pencil') 54 + ->setName(pht('Edit Staging')) 55 + ->setHref($staging_uri) 56 + ->setDisabled(!$can_edit) 57 + ->setWorkflow(!$can_edit)); 58 + 59 + return $this->newCurtainView() 60 + ->setActionList($action_list); 61 + } 62 + 32 63 public function buildManagementPanelContent() { 33 64 $repository = $this->getRepository(); 34 65 $viewer = $this->getViewer(); ··· 43 74 44 75 $view->addProperty(pht('Staging Area URI'), $staging_uri); 45 76 46 - $can_edit = PhabricatorPolicyFilter::hasCapability( 47 - $viewer, 48 - $repository, 49 - PhabricatorPolicyCapability::CAN_EDIT); 50 - 51 - $staging_uri = $this->getEditPageURI(); 52 - 53 - $button = id(new PHUIButtonView()) 54 - ->setTag('a') 55 - ->setIcon('fa-pencil') 56 - ->setText(pht('Edit')) 57 - ->setHref($staging_uri) 58 - ->setDisabled(!$can_edit) 59 - ->setWorkflow(!$can_edit); 60 - 61 - return $this->newBox(pht('Staging Area'), $view, array($button)); 77 + return $this->newBox(pht('Staging Area'), $view); 62 78 } 63 79 64 80 }
+27 -10
src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php
··· 14 14 } 15 15 16 16 public function getManagementPanelIcon() { 17 - return 'fa-database'; 17 + $repository = $this->getRepository(); 18 + 19 + if ($repository->getAlmanacServicePHID()) { 20 + return 'fa-sitemap'; 21 + } else if ($repository->isHosted()) { 22 + return 'fa-database'; 23 + } else { 24 + return 'fa-download'; 25 + } 26 + } 27 + 28 + public function buildManagementPanelCurtain() { 29 + $repository = $this->getRepository(); 30 + $viewer = $this->getViewer(); 31 + $action_list = $this->newActionList(); 32 + 33 + $doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); 34 + 35 + $action_list->addAction( 36 + id(new PhabricatorActionView()) 37 + ->setIcon('fa-book') 38 + ->setHref($doc_href) 39 + ->setName(pht('Cluster Documentation'))); 40 + 41 + return $this->newCurtainView() 42 + ->setActionList($action_list); 18 43 } 19 44 20 45 public function buildManagementPanelContent() { ··· 47 72 $view->addProperty(pht('Storage Path'), $storage_path); 48 73 $view->addProperty(pht('Storage Cluster'), $storage_service); 49 74 50 - $doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); 51 - 52 - $button = id(new PHUIButtonView()) 53 - ->setTag('a') 54 - ->setIcon('fa-book') 55 - ->setHref($doc_href) 56 - ->setText(pht('Help')); 57 - 58 - return $this->newBox(pht('Storage'), $view, array($button)); 75 + return $this->newBox(pht('Storage'), $view); 59 76 } 60 77 61 78 private function buildClusterStatusPanel() {
+34 -17
src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php
··· 19 19 } 20 20 21 21 public function getManagementPanelIcon() { 22 - return 'fa-folder'; 22 + $repository = $this->getRepository(); 23 + 24 + $has_any = (bool)$repository->getDetail('svn-subpath'); 25 + 26 + if ($has_any) { 27 + return 'fa-folder'; 28 + } else { 29 + return 'fa-folder grey'; 30 + } 23 31 } 24 32 25 33 protected function getEditEngineFieldKeys() { ··· 28 36 ); 29 37 } 30 38 39 + public function buildManagementPanelCurtain() { 40 + $repository = $this->getRepository(); 41 + $viewer = $this->getViewer(); 42 + $action_list = $this->newActionList(); 43 + 44 + $can_edit = PhabricatorPolicyFilter::hasCapability( 45 + $viewer, 46 + $repository, 47 + PhabricatorPolicyCapability::CAN_EDIT); 48 + 49 + $subversion_uri = $this->getEditPageURI(); 50 + 51 + $action_list->addAction( 52 + id(new PhabricatorActionView()) 53 + ->setIcon('fa-pencil') 54 + ->setName(pht('Edit Properties')) 55 + ->setHref($subversion_uri) 56 + ->setDisabled(!$can_edit) 57 + ->setWorkflow(!$can_edit)); 58 + 59 + return $this->newCurtainView($action_list) 60 + ->setActionList($action_list); 61 + } 62 + 31 63 public function buildManagementPanelContent() { 32 64 $repository = $this->getRepository(); 33 65 $viewer = $this->getViewer(); ··· 40 72 phutil_tag('em', array(), pht('Import Entire Repository'))); 41 73 $view->addProperty(pht('Import Only'), $default_branch); 42 74 43 - $can_edit = PhabricatorPolicyFilter::hasCapability( 44 - $viewer, 45 - $repository, 46 - PhabricatorPolicyCapability::CAN_EDIT); 47 - 48 - $subversion_uri = $this->getEditPageURI(); 49 - 50 - $button = id(new PHUIButtonView()) 51 - ->setTag('a') 52 - ->setIcon('fa-pencil') 53 - ->setText(pht('Edit')) 54 - ->setHref($subversion_uri) 55 - ->setDisabled(!$can_edit) 56 - ->setWorkflow(!$can_edit); 57 - 58 - return $this->newBox(pht('Subversion'), $view, array($button)); 75 + return $this->newBox(pht('Subversion'), $view); 59 76 } 60 77 61 78 }
+36 -17
src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php
··· 14 14 } 15 15 16 16 public function getManagementPanelIcon() { 17 - return 'fa-bullseye'; 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 + } 18 28 } 19 29 20 30 protected function getEditEngineFieldKeys() { ··· 24 34 ); 25 35 } 26 36 37 + public function buildManagementPanelCurtain() { 38 + $repository = $this->getRepository(); 39 + $viewer = $this->getViewer(); 40 + $action_list = $this->newActionList(); 41 + 42 + $can_edit = PhabricatorPolicyFilter::hasCapability( 43 + $viewer, 44 + $repository, 45 + PhabricatorPolicyCapability::CAN_EDIT); 46 + 47 + $symbols_uri = $this->getEditPageURI(); 48 + 49 + $action_list->addAction( 50 + id(new PhabricatorActionView()) 51 + ->setIcon('fa-pencil') 52 + ->setName(pht('Edit Symbols')) 53 + ->setHref($symbols_uri) 54 + ->setDisabled(!$can_edit) 55 + ->setWorkflow(!$can_edit)); 56 + 57 + return $this->newCurtainView() 58 + ->setActionList($action_list); 59 + } 60 + 27 61 public function buildManagementPanelContent() { 28 62 $repository = $this->getRepository(); 29 63 $viewer = $this->getViewer(); ··· 47 81 } 48 82 $view->addProperty(pht('Uses Symbols From'), $sources); 49 83 50 - $can_edit = PhabricatorPolicyFilter::hasCapability( 51 - $viewer, 52 - $repository, 53 - PhabricatorPolicyCapability::CAN_EDIT); 54 - 55 - $symbols_uri = $this->getEditPageURI(); 56 - 57 - $button = id(new PHUIButtonView()) 58 - ->setTag('a') 59 - ->setIcon('fa-pencil') 60 - ->setText(pht('Edit')) 61 - ->setHref($symbols_uri) 62 - ->setDisabled(!$can_edit) 63 - ->setWorkflow(!$can_edit); 64 - 65 - return $this->newBox(pht('Symbols'), $view, array($button)); 84 + return $this->newBox(pht('Symbols'), $view); 66 85 } 67 86 68 87 }
+32 -23
src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
··· 17 17 return 400; 18 18 } 19 19 20 + public function buildManagementPanelCurtain() { 21 + $repository = $this->getRepository(); 22 + $viewer = $this->getViewer(); 23 + $action_list = $this->newActionList(); 24 + 25 + $can_edit = PhabricatorPolicyFilter::hasCapability( 26 + $viewer, 27 + $repository, 28 + PhabricatorPolicyCapability::CAN_EDIT); 29 + 30 + $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); 31 + $add_href = $repository->getPathURI('uri/edit/'); 32 + 33 + $action_list->addAction( 34 + id(new PhabricatorActionView()) 35 + ->setIcon('fa-plus') 36 + ->setHref($add_href) 37 + ->setDisabled(!$can_edit) 38 + ->setName(pht('Add New URI'))); 39 + 40 + $action_list->addAction( 41 + id(new PhabricatorActionView()) 42 + ->setIcon('fa-book') 43 + ->setHref($doc_href) 44 + ->setName(pht('URI Documentation'))); 45 + 46 + return $this->newCurtainView() 47 + ->setActionList($action_list); 48 + } 49 + 20 50 public function buildManagementPanelContent() { 21 51 $repository = $this->getRepository(); 22 52 $viewer = $this->getViewer(); ··· 122 152 ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) 123 153 ->setErrors($messages); 124 154 125 - $can_edit = PhabricatorPolicyFilter::hasCapability( 126 - $viewer, 127 - $repository, 128 - PhabricatorPolicyCapability::CAN_EDIT); 155 + $box = $this->newBox(pht('Repository URIs'), $table); 129 156 130 - $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); 131 - $add_href = $repository->getPathURI('uri/edit/'); 132 - 133 - $add = id(new PHUIButtonView()) 134 - ->setTag('a') 135 - ->setIcon('fa-plus') 136 - ->setHref($add_href) 137 - ->setDisabled(!$can_edit) 138 - ->setText(pht('New URI')); 139 - 140 - $help = id(new PHUIButtonView()) 141 - ->setTag('a') 142 - ->setIcon('fa-book') 143 - ->setHref($doc_href) 144 - ->setText(pht('Help')); 145 - 146 - $box = $this->newBox(pht('Repository URIs'), $table, array($add, $help)); 147 - 148 - return array($box, $info_view); 157 + return array($info_view, $box); 149 158 } 150 159 151 160 }