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

On the Diffusion cluster status page, improve device sort order

Summary:
Ref T13216. See PHI943. When you have a large number of cluster bindings for a repository, the UI sorting can be a bit hard to manage.

One install that regularly cycles repository cluster devices had a couple dozen older disabled bindings, with the enabled bindings intermingled.

Sort the UI:

- enabled devices come first;
- in each group, sort by name.

Test Plan: Mixed disabled/enabled bindings, loaded {nav Diffusion > Repository > Storage} page with clustering configured. Before: relatively unhelpful sort order. After: more intuitive sort order.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13216

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

+25 -8
+25 -8
src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php
··· 99 99 100 100 $versions = mpull($versions, null, 'getDevicePHID'); 101 101 102 - foreach ($bindings as $binding_group) { 103 - $all_disabled = true; 104 - foreach ($binding_group as $binding) { 105 - if (!$binding->getIsDisabled()) { 106 - $all_disabled = false; 107 - break; 108 - } 109 - } 102 + // List enabled devices first, then sort devices in each group by name. 103 + $sort = array(); 104 + foreach ($bindings as $key => $binding_group) { 105 + $all_disabled = $this->isDisabledGroup($binding_group); 106 + 107 + $sort[$key] = id(new PhutilSortVector()) 108 + ->addInt($all_disabled ? 1 : 0) 109 + ->addString(head($binding_group)->getDevice()->getName()); 110 + } 111 + $sort = msortv($sort, 'getSelf'); 112 + $bindings = array_select_keys($bindings, array_keys($sort)) + $bindings; 110 113 114 + foreach ($bindings as $binding_group) { 115 + $all_disabled = $this->isDisabledGroup($binding_group); 111 116 $any_binding = head($binding_group); 112 117 113 118 if ($all_disabled) { ··· 226 231 )); 227 232 228 233 return $this->newBox(pht('Cluster Status'), $table); 234 + } 235 + 236 + private function isDisabledGroup(array $binding_group) { 237 + assert_instances_of($binding_group, 'AlmanacBinding'); 238 + 239 + foreach ($binding_group as $binding) { 240 + if (!$binding->getIsDisabled()) { 241 + return false; 242 + } 243 + } 244 + 245 + return true; 229 246 } 230 247 231 248 }