Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/notification/view/PhabricatorNotificationStatusView.php
12256 views
1
<?php
2
3
final class PhabricatorNotificationStatusView extends AphrontTagView {
4
5
protected function getTagAttributes() {
6
if (!$this->getID()) {
7
$this->setID(celerity_generate_unique_node_id());
8
}
9
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'),
18
),
19
'icon' => array(
20
'open' => array(
21
'icon' => 'fa-circle',
22
'color' => 'green',
23
),
24
'setup' => array(
25
'icon' => 'fa-circle',
26
'color' => 'yellow',
27
),
28
'closed' => array(
29
'icon' => 'fa-circle',
30
'color' => 'red',
31
),
32
),
33
));
34
35
return array(
36
'class' => 'aphlict-connection-status',
37
);
38
}
39
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',
51
),
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',
65
),
66
array(
67
$icon,
68
$text,
69
));
70
}
71
}
72
73
}
74
75