blob: 97ae7465d8ec1c6361e8740d0249ff1cd18d8d54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
namespace Icinga\Module\Director\Dashboard\Dashlet;
use Exception;
use Icinga\Module\Director\Auth\Permission;
class EndpointObjectDashlet extends Dashlet
{
protected $icon = 'cloud';
protected $requiredStats = ['endpoint'];
protected $hasDeploymentEndpoint;
public function getTitle()
{
return $this->translate('Endpoints');
}
public function getUrl()
{
return 'director/endpoints';
}
public function listRequiredPermissions()
{
return [Permission::ADMIN];
}
protected function hasDeploymentEndpoint()
{
if ($this->hasDeploymentEndpoint === null) {
try {
$this->hasDeploymentEndpoint = $this->db->hasDeploymentEndpoint();
} catch (Exception $e) {
return false;
}
}
return $this->hasDeploymentEndpoint;
}
public function listCssClasses()
{
if (! $this->hasDeploymentEndpoint()) {
return 'state-critical';
}
return null;
}
public function getSummary()
{
$msg = parent::getSummary();
if (! $this->hasDeploymentEndpoint()) {
$msg .= '. ' . $this->translate(
'None could be used for deployments right now'
);
}
return $msg;
}
}
|