Differential D19342 Diff 46280 src/applications/almanac/servicetype/AlmanacClusterRepositoryServiceType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/servicetype/AlmanacClusterRepositoryServiceType.php
| Show All 18 Lines | final class AlmanacClusterRepositoryServiceType | ||||
| } | } | ||||
| public function getFieldSpecifications() { | public function getFieldSpecifications() { | ||||
| return array( | return array( | ||||
| 'closed' => id(new PhabricatorTextEditField()), | 'closed' => id(new PhabricatorTextEditField()), | ||||
| ); | ); | ||||
| } | } | ||||
| public function getBindingFieldSpecifications(AlmanacBinding $binding) { | |||||
| $protocols = array( | |||||
| array( | |||||
| 'value' => 'http', | |||||
| 'port' => 80, | |||||
| ), | |||||
| array( | |||||
| 'value' => 'https', | |||||
| 'port' => 443, | |||||
| ), | |||||
| array( | |||||
| 'value' => 'ssh', | |||||
| 'port' => 22, | |||||
| ), | |||||
| ); | |||||
| $default_value = 'http'; | |||||
| if ($binding->hasInterface()) { | |||||
| $interface = $binding->getInterface(); | |||||
| $port = $interface->getPort(); | |||||
| $default_ports = ipull($protocols, 'value', 'port'); | |||||
| $default_value = idx($default_ports, $port, $default_value); | |||||
| } | |||||
| return array( | |||||
| 'protocol' => id(new PhabricatorSelectEditField()) | |||||
| ->setOptions(ipull($protocols, 'value', 'value')) | |||||
| ->setValue($default_value), | |||||
| ); | |||||
| } | |||||
| } | } | ||||