-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathSystemStatusEnum.php
More file actions
66 lines (58 loc) 路 1.99 KB
/
Copy pathSystemStatusEnum.php
File metadata and controls
66 lines (58 loc) 路 1.99 KB
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
65
66
<?php
namespace Cachet\Enums;
use Filament\Support\Colors\Color;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;
enum SystemStatusEnum implements HasColor, HasIcon, HasLabel
{
case operational;
case partial_outage;
case major_outage;
case under_maintenance;
public function getLabel(): string
{
return match ($this) {
self::operational => __('cachet::system_status.operational'),
self::partial_outage => __('cachet::system_status.partial_outage'),
self::major_outage => __('cachet::system_status.major_outage'),
self::under_maintenance => __('cachet::system_status.under_maintenance'),
};
}
public function getColor(): array
{
return match ($this) {
self::operational => Color::Green,
self::partial_outage => Color::Amber,
self::major_outage => Color::Red,
self::under_maintenance => Color::Orange,
};
}
public function getBadgeColor(): string
{
return match ($this) {
self::operational => 'brightgreen',
self::partial_outage => 'orange',
self::major_outage => 'red',
self::under_maintenance => 'orange',
};
}
public function getIcon(): string
{
return match ($this) {
self::operational => 'heroicon-m-check-circle',
self::partial_outage => 'cachet-component-partial-outage',
self::major_outage => 'cachet-component-major-outage',
self::under_maintenance => 'cachet-component-under-maintenance',
};
}
public function getFavicon(): ?string
{
return match ($this) {
self::operational => null,
self::partial_outage => 'favicon-partial-outage.svg',
self::major_outage => 'favicon-major-outage.svg',
self::under_maintenance => 'favicon-under-maintenance.svg',
};
}
}