3 final class AlmanacBindingTableView
extends AphrontView
{
8 private $hideServiceColumn;
10 public function setNoDataString($no_data_string) {
11 $this->noDataString
= $no_data_string;
15 public function getNoDataString() {
16 return $this->noDataString
;
19 public function setBindings(array $bindings) {
20 $this->bindings
= $bindings;
24 public function getBindings() {
25 return $this->bindings
;
28 public function setHideServiceColumn($hide_service_column) {
29 $this->hideServiceColumn
= $hide_service_column;
33 public function getHideServiceColumn() {
34 return $this->hideServiceColumn
;
37 public function render() {
38 $bindings = $this->getBindings();
39 $viewer = $this->getUser();
42 foreach ($bindings as $binding) {
43 $phids[] = $binding->getServicePHID();
44 $phids[] = $binding->getDevicePHID();
45 $phids[] = $binding->getInterface()->getNetworkPHID();
47 $handles = $viewer->loadHandles($phids);
49 $icon_disabled = id(new PHUIIconView())
51 ->addSigil('has-tooltip')
54 'tip' => pht('Disabled'),
57 $icon_active = id(new PHUIIconView())
60 ->addSigil('has-tooltip')
63 'tip' => pht('Active'),
66 $icon_device_disabled = id(new PHUIIconView())
69 ->addSigil('has-tooltip')
72 'tip' => pht('Device Disabled'),
76 foreach ($bindings as $binding) {
77 $addr = $binding->getInterface()->getAddress();
78 $port = $binding->getInterface()->getPort();
80 $device = $binding->getDevice();
81 if ($device->isDisabled()) {
82 $binding_icon = $icon_device_disabled;
83 } else if ($binding->getIsDisabled()) {
84 $binding_icon = $icon_disabled;
86 $binding_icon = $icon_active;
92 $handles->renderHandle($binding->getServicePHID()),
94 $handles->renderHandle($binding->getDevicePHID()),
95 $handles->renderHandle($binding->getInterface()->getNetworkPHID()),
96 $binding->getInterface()->renderDisplayAddress(),
100 'class' => 'small button button-grey',
101 'href' => '/almanac/binding/'.$binding->getID().'/',
107 $table = id(new AphrontTableView($rows))
108 ->setNoDataString($this->getNoDataString())
129 ->setColumnVisibility(
133 !$this->getHideServiceColumn(),