Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / notification / view / PhabricatorNotificationStatusView.php
blobe962395bbad1617bdc5ae9a23afe449204c10bb4
1 <?php
3 final class PhabricatorNotificationStatusView extends AphrontTagView {
5 protected function getTagAttributes() {
6 if (!$this->getID()) {
7 $this->setID(celerity_generate_unique_node_id());
10 Javelin::initBehavior(
11 'aphlict-status',
12 array(
13 'nodeID' => $this->getID(),
14 'pht' => array(
15 'setup' => pht('Setting Up Client'),
16 'open' => pht('Connected'),
17 'closed' => pht('Disconnected'),
19 'icon' => array(
20 'open' => array(
21 'icon' => 'fa-circle',
22 'color' => 'green',
24 'setup' => array(
25 'icon' => 'fa-circle',
26 'color' => 'yellow',
28 'closed' => array(
29 'icon' => 'fa-circle',
30 'color' => 'red',
33 ));
35 return array(
36 'class' => 'aphlict-connection-status',
40 protected function getTagContent() {
41 $have = PhabricatorEnv::getEnvConfig('notification.servers');
42 if ($have) {
43 $icon = id(new PHUIIconView())
44 ->setIcon('fa-circle-o yellow');
45 $text = pht('Connecting...');
46 return phutil_tag(
47 'span',
48 array(
49 'class' => 'connection-status-text '.
50 'aphlict-connection-status-connecting',
52 array(
53 $icon,
54 $text,
55 ));
56 } else {
57 $text = pht('Notification server not enabled');
58 $icon = id(new PHUIIconView())
59 ->setIcon('fa-circle-o grey');
60 return phutil_tag(
61 'span',
62 array(
63 'class' => 'connection-status-text '.
64 'aphlict-connection-status-notenabled',
66 array(
67 $icon,
68 $text,
69 ));