diff --git a/resources/lang/de/user.php b/resources/lang/de/user.php index 2907ae8b..cf908851 100644 --- a/resources/lang/de/user.php +++ b/resources/lang/de/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Admin', - 'user' => 'Benutzer', - ], 'resource_label' => 'Benutzer|Benutzer', 'list' => [ 'headers' => [ diff --git a/resources/lang/de_AT/user.php b/resources/lang/de_AT/user.php index 2907ae8b..cf908851 100644 --- a/resources/lang/de_AT/user.php +++ b/resources/lang/de_AT/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Admin', - 'user' => 'Benutzer', - ], 'resource_label' => 'Benutzer|Benutzer', 'list' => [ 'headers' => [ diff --git a/resources/lang/de_CH/user.php b/resources/lang/de_CH/user.php index 2907ae8b..cf908851 100644 --- a/resources/lang/de_CH/user.php +++ b/resources/lang/de_CH/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Admin', - 'user' => 'Benutzer', - ], 'resource_label' => 'Benutzer|Benutzer', 'list' => [ 'headers' => [ diff --git a/resources/lang/en/user.php b/resources/lang/en/user.php index 615534f9..b7569f79 100644 --- a/resources/lang/en/user.php +++ b/resources/lang/en/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Admin', - 'user' => 'User', - ], 'resource_label' => 'User|Users', 'list' => [ 'headers' => [ diff --git a/resources/lang/es_ES/user.php b/resources/lang/es_ES/user.php index 9a51e79a..b1b6f15e 100644 --- a/resources/lang/es_ES/user.php +++ b/resources/lang/es_ES/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Administrador', - 'user' => 'Usuario', - ], 'resource_label' => 'Usuario|Usuarios', 'list' => [ 'headers' => [ diff --git a/resources/lang/fr/user.php b/resources/lang/fr/user.php index 84646ac4..6931e4c8 100644 --- a/resources/lang/fr/user.php +++ b/resources/lang/fr/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Administrateur', - 'user' => 'Utilisateur', - ], 'resource_label' => 'Utilisateur|Utilisateurs', 'list' => [ 'headers' => [ diff --git a/resources/lang/ko/user.php b/resources/lang/ko/user.php index 65f471f5..e02d8eb3 100644 --- a/resources/lang/ko/user.php +++ b/resources/lang/ko/user.php @@ -1,10 +1,6 @@ [ - 'admin' => '관리자', - 'user' => '사용자', - ], 'resource_label' => '사용자|사용자', 'list' => [ 'headers' => [ diff --git a/resources/lang/nl/user.php b/resources/lang/nl/user.php index 26eba751..e57a037b 100644 --- a/resources/lang/nl/user.php +++ b/resources/lang/nl/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Beheerder', - 'user' => 'Gebruiker', - ], 'resource_label' => 'Gebruiker|Gebruikers', 'list' => [ 'headers' => [ diff --git a/resources/lang/ph/user.php b/resources/lang/ph/user.php index 943e8458..31d03e03 100644 --- a/resources/lang/ph/user.php +++ b/resources/lang/ph/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Admin', - 'user' => 'User', - ], 'resource_label' => 'User|Users', 'list' => [ 'headers' => [ diff --git a/resources/lang/pt_BR/user.php b/resources/lang/pt_BR/user.php index 31be62a6..75f5a7da 100644 --- a/resources/lang/pt_BR/user.php +++ b/resources/lang/pt_BR/user.php @@ -1,10 +1,6 @@ [ - 'admin' => 'Administrador', - 'user' => 'Usuário', - ], 'resource_label' => 'Usuário|Usuários', 'list' => [ 'headers' => [ diff --git a/resources/lang/zh_CN/user.php b/resources/lang/zh_CN/user.php index 3b1b815b..9e1e7590 100644 --- a/resources/lang/zh_CN/user.php +++ b/resources/lang/zh_CN/user.php @@ -1,10 +1,6 @@ [ - 'admin' => '管理员', - 'user' => '用户', - ], 'resource_label' => '用户|用户', 'list' => [ 'headers' => [ diff --git a/resources/lang/zh_TW/user.php b/resources/lang/zh_TW/user.php index ff7bc5a3..7eb38f34 100644 --- a/resources/lang/zh_TW/user.php +++ b/resources/lang/zh_TW/user.php @@ -1,10 +1,6 @@ [ - 'admin' => '管理員', - 'user' => '用戶', - ], 'resource_label' => '用戶|用戶', 'list' => [ 'headers' => [ diff --git a/src/Actions/Integrations/ImportOhDearFeed.php b/src/Actions/Integrations/ImportOhDearFeed.php index b9587837..3c698147 100644 --- a/src/Actions/Integrations/ImportOhDearFeed.php +++ b/src/Actions/Integrations/ImportOhDearFeed.php @@ -3,7 +3,6 @@ namespace Cachet\Actions\Integrations; use Cachet\Actions\Component\ChangeComponentStatus; -use Cachet\Enums\ComponentStatusEnum; use Cachet\Enums\ComponentStatusSourceEnum; use Cachet\Enums\ExternalProviderEnum; use Cachet\Models\Component; @@ -37,7 +36,7 @@ public function __invoke(array $data, bool $importSites, ?int $componentGroupId, private function importSites(array $sites, ?int $componentGroupId): void { foreach ($sites as $site) { - $status = $site['status'] === 'up' ? ComponentStatusEnum::operational : ComponentStatusEnum::partial_outage; + $status = ExternalProviderEnum::OhDear->componentStatus($site['status']); $attributes = ['name' => $site['label'], 'component_group_id' => $componentGroupId]; $component = Component::firstOrNew(['link' => $site['url']]); diff --git a/src/Data/Requests/Schedule/CreateScheduleRequestData.php b/src/Data/Requests/Schedule/CreateScheduleRequestData.php index b5ca1fe1..c7521ec0 100644 --- a/src/Data/Requests/Schedule/CreateScheduleRequestData.php +++ b/src/Data/Requests/Schedule/CreateScheduleRequestData.php @@ -5,7 +5,6 @@ use Cachet\Data\BaseData; use Cachet\Data\Casts\FlexibleDateTimeCast; use Cachet\Enums\ComponentStatusEnum; -use Cachet\Enums\ScheduleStatusEnum; use Carbon\Carbon; use Illuminate\Validation\Rule; use Spatie\LaravelData\Attributes\DataCollectionOf; @@ -23,7 +22,6 @@ public function __construct( public readonly ?Carbon $completedAt = null, #[WithCast(FlexibleDateTimeCast::class)] public readonly ?Carbon $publishedAt = null, - public readonly ?ScheduleStatusEnum $status = null, public readonly bool $notifications = false, #[DataCollectionOf(ScheduleComponentRequestData::class)] public readonly ?array $components = null, diff --git a/src/Data/Requests/Schedule/UpdateScheduleRequestData.php b/src/Data/Requests/Schedule/UpdateScheduleRequestData.php index fd45e980..b528e73b 100644 --- a/src/Data/Requests/Schedule/UpdateScheduleRequestData.php +++ b/src/Data/Requests/Schedule/UpdateScheduleRequestData.php @@ -5,7 +5,6 @@ use Cachet\Data\BaseData; use Cachet\Data\Casts\FlexibleDateTimeCast; use Cachet\Enums\ComponentStatusEnum; -use Cachet\Enums\ScheduleStatusEnum; use Carbon\Carbon; use Illuminate\Validation\Rule; use Spatie\LaravelData\Attributes\DataCollectionOf; @@ -17,7 +16,6 @@ final class UpdateScheduleRequestData extends BaseData public function __construct( public readonly ?string $name = null, public readonly ?string $message = null, - public readonly ?ScheduleStatusEnum $status = null, #[WithCast(FlexibleDateTimeCast::class)] public readonly ?Carbon $scheduledAt = null, #[WithCast(FlexibleDateTimeCast::class)] diff --git a/src/Enums/ExternalProviderEnum.php b/src/Enums/ExternalProviderEnum.php index bc27000d..62fcf9df 100644 --- a/src/Enums/ExternalProviderEnum.php +++ b/src/Enums/ExternalProviderEnum.php @@ -19,4 +19,17 @@ public function status(mixed $status): IncidentStatusEnum }, }; } + + /** + * Match the status to the Cachet component status. + */ + public function componentStatus(mixed $status): ComponentStatusEnum + { + return match ($this) { + self::OhDear => match ($status) { + 'up' => ComponentStatusEnum::operational, + default => ComponentStatusEnum::partial_outage, + }, + }; + } } diff --git a/src/Enums/ScheduleStatusEnum.php b/src/Enums/ScheduleStatusEnum.php index b8eb676e..b8564c72 100644 --- a/src/Enums/ScheduleStatusEnum.php +++ b/src/Enums/ScheduleStatusEnum.php @@ -25,13 +25,12 @@ public static function incomplete(): array } /** - * Get the statuses that are in upcoming. + * Get the statuses that are upcoming. */ public static function upcoming(): array { return [ self::upcoming->value, - self::in_progress->value, ]; } diff --git a/src/Enums/UserLevelEnum.php b/src/Enums/UserLevelEnum.php deleted file mode 100644 index 277a6a89..00000000 --- a/src/Enums/UserLevelEnum.php +++ /dev/null @@ -1,17 +0,0 @@ -value) { - self::admin->value => __('cachet::user.level.admin'), - self::user->value => __('cachet::user.level.user'), - }; - } -} diff --git a/src/Status.php b/src/Status.php index b4ba80da..e73b8b4c 100644 --- a/src/Status.php +++ b/src/Status.php @@ -18,6 +18,10 @@ class Status /** * Get the current system status as an enum. + * + * There is deliberately no dedicated system status for performance issues: + * components in a performance_issues (or partial_outage) state roll up to + * SystemStatusEnum::partial_outage, which is returned as the default below. */ public function current(): SystemStatusEnum {