diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index 42f72905..c91c137b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -19,15 +19,14 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->adminWorkerEnabled) { - $collection->add( - SettingsResult::warning( - 'admin-watcher', - 'Admin-Worker', - 'enabled', - 'disabled', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->adminWorkerEnabled ? SettingsResult::WARNING : SettingsResult::GREEN, + 'admin-watcher', + 'Admin-Worker', + $this->adminWorkerEnabled ? 'enabled' : 'disabled', + 'disabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php index 8cc83b3d..0168ed98 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableAppUrlExternalCheckChecker.php @@ -14,15 +14,14 @@ class DisableAppUrlExternalCheckChecker implements PerformanceCheckerInterface, public function collect(HealthCollection $collection): void { $appUrlCheckDisabled = (bool) EnvironmentHelper::getVariable('APP_URL_CHECK_DISABLED', false); - if (!$appUrlCheckDisabled) { - $collection->add( - SettingsResult::warning( - 'app-url-check-disabled', - 'App URL external check', - 'enabled', - 'disabled', - ), - ); - } + $collection->add( + SettingsResult::create( + !$appUrlCheckDisabled ? SettingsResult::WARNING : SettingsResult::GREEN, + 'app-url-check-disabled', + 'App URL external check', + !$appUrlCheckDisabled ? 'enabled' : 'disabled', + 'disabled', + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index 710bf37c..b44120ba 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -20,15 +20,14 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->vault) { - $collection->add( - SettingsResult::info( - 'symfony-secrets', - 'Disable Symfony Secrets', - 'enabled', - 'disabled', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->vault ? SettingsResult::INFO : SettingsResult::GREEN, + 'symfony-secrets', + 'Disable Symfony Secrets', + $this->vault ? 'enabled' : 'disabled', + 'disabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index 438cef35..61f57124 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -23,12 +23,14 @@ public function collect(HealthCollection $collection): void $setting = $this->params->get('shopware.mail.update_mail_variables_on_send'); - if (!$setting) { - return; - } - - $result = SettingsResult::warning('mail_variables', 'MailVariables updates', 'enabled', 'disabled'); - - $collection->add($result); + $collection->add( + SettingsResult::create( + !$setting ? SettingsResult::GREEN : SettingsResult::WARNING, + 'mail_variables', + 'MailVariables updates', + $setting ? 'enabled' : 'disabled', + 'disabled' + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php index 38cc062b..841283a7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/EsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/EsChecker.php @@ -20,15 +20,14 @@ public function __construct(ElasticsearchManager $elasticsearchManager) public function collect(HealthCollection $collection): void { - if (!$this->esEnabled) { - $collection->add( - SettingsResult::info( - 'elasticsearch', - 'Elasticsearch', - 'disabled', - 'enabled', - ), - ); - } + $collection->add( + SettingsResult::create( + !$this->esEnabled ? SettingsResult::INFO : SettingsResult::GREEN, + 'elasticsearch', + 'Elasticsearch', + !$this->esEnabled ? 'disabled' : 'enabled', + 'enabled', + ) + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 9785288e..729436c7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -33,17 +33,17 @@ public function collect(HealthCollection $collection): void if (\version_compare($this->shopwareVersion, '6.7.0.0', '>=')) { return; } + $fineGrainedCachingEnabled = $this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig; - if ($this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig) { - $collection->add( - // only info, because it only affects redis, varnish etc. - SettingsResult::info( - 'fine-grained-caching', - 'Fine-grained caching on Redis, Varnish etc.', - 'enabled', - 'disabled', - ), - ); - } + $collection->add( + // only info, because it only affects redis, varnish etc. + SettingsResult::create( + $fineGrainedCachingEnabled ? SettingsResult::INFO : SettingsResult::GREEN, + 'fine-grained-caching', + 'Fine-grained caching on Redis, Varnish etc.', + $fineGrainedCachingEnabled ? 'enabled' : 'disabled', + 'disabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index ac373319..1c5df252 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -30,15 +30,14 @@ public function collect(HealthCollection $collection): void $cacheId = (string) EnvironmentHelper::getVariable('SHOPWARE_CACHE_ID', ''); - if ($cacheId === '') { - $collection->add( - SettingsResult::warning( - 'cache-id', - 'Fixed cache id', - 'not set', - 'set', - ), - ); - } + $collection->add( + SettingsResult::create( + $cacheId === '' ? SettingsResult::WARNING : SettingsResult::GREEN, + 'cache-id', + 'Fixed cache id', + $cacheId === '' ? 'not set' : 'set', + 'set', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index 6880d80d..d29d2bb6 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -21,17 +21,19 @@ public function __construct( public function collect(HealthCollection $collection): void { - $recommended = 'array or redis'; + $usesMysql = $this->userActivity === 'mysql' || $this->queueActivity === 'mysql'; + $current = $this->userActivity === $this->queueActivity + ? $this->userActivity + : $this->userActivity . ', ' . $this->queueActivity; - if ($this->userActivity === 'mysql' || $this->queueActivity === 'mysql') { - $collection->add( - SettingsResult::warning( - 'increment-storage', - 'Increment storage', - 'mysql', - $recommended, - ), - ); - } + $collection->add( + SettingsResult::create( + $usesMysql ? SettingsResult::WARNING : SettingsResult::GREEN, + 'increment-storage', + 'Increment storage', + $current, + 'array or redis', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php index f2093b13..5c81a2c8 100644 --- a/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/LoggerLevelChecker.php @@ -25,13 +25,14 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->businessEventHandlerLevel->isLowerThan(Level::Warning)) { - $collection->add(SettingsResult::warning( + $collection->add( + SettingsResult::create( + $this->businessEventHandlerLevel->isLowerThan(Level::Warning) ? SettingsResult::WARNING : SettingsResult::GREEN, 'business_logger', 'BusinessEventHandler logging', Logger::toMonologLevel($this->businessEventHandlerLevel)->getName(), 'min WARNING', - )); - } + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index aceffa01..3d021d5d 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -19,15 +19,14 @@ public function __construct( public function collect(HealthCollection $collection): void { - if (!$this->mailerIsOverQueue) { - $collection->add( - SettingsResult::warning( - 'mail', - 'Sending mails over queue', - 'disabled', - 'enabled', - ), - ); - } + $collection->add( + SettingsResult::create( + !$this->mailerIsOverQueue ? SettingsResult::WARNING : SettingsResult::GREEN, + 'mail', + 'Sending mails over queue', + $this->mailerIsOverQueue ? 'enabled' : 'disabled', + 'enabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index 39682d66..56a839d7 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -23,16 +23,17 @@ public function __construct( public function collect(HealthCollection $collection): void { - if ($this->isAutoSetupEnabled($this->messageTransportDsn) || $this->isAutoSetupEnabled($this->messageTransportDsnLowPriority) || $this->isAutoSetupEnabled($this->messageTransportDsnFailure)) { - $collection->add( - SettingsResult::info( - 'messenger-auto-setup', - 'Messenger auto_setup', - 'enabled', - 'disabled', - ), - ); - } + $autoSetupState = $this->isAutoSetupEnabled($this->messageTransportDsn) || $this->isAutoSetupEnabled($this->messageTransportDsnLowPriority) || $this->isAutoSetupEnabled($this->messageTransportDsnFailure); + + $collection->add( + SettingsResult::create( + $autoSetupState ? SettingsResult::INFO : SettingsResult::GREEN, + 'messenger-auto-setup', + 'Messenger auto_setup', + $autoSetupState ? 'enabled' : 'disabled', + 'disabled', + ), + ); } private function isAutoSetupEnabled(string $messageTransportDsn): bool diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index dba276be..4af9db9f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -41,46 +41,57 @@ private function checkGroupConcatMaxLen(HealthCollection $collection): void { /** @var string|false $groupConcatMaxLen */ $groupConcatMaxLen = $this->connection->fetchOne('SELECT @@group_concat_max_len'); - if (!$groupConcatMaxLen || (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN) { - $collection->add( - SettingsResult::error( - 'sql_group_concat_max_len', - 'MySQL value group_concat_max_len', - (string) $groupConcatMaxLen, - 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, - ), - ); - } + $maxLenNotOk = (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN; + + $collection->add( + SettingsResult::create( + $maxLenNotOk ? SettingsResult::ERROR : SettingsResult::GREEN, + 'sql_group_concat_max_len', + 'MySQL value group_concat_max_len', + (string) $groupConcatMaxLen, + 'min ' . self::MYSQL_GROUP_CONCAT_MAX_LEN, + ), + ); } private function checkSqlMode(HealthCollection $collection): void { $sqlMode = $this->connection->fetchOne('SELECT @@sql_mode'); - if (\is_string($sqlMode) && \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART)) { - $collection->add( - SettingsResult::error( - 'sql_mode', - 'MySQL value sql_mode', - $sqlMode, - 'No ' . self::MYSQL_SQL_MODE_PART, - ), - ); + + if (!\is_string($sqlMode)) { + return; } + + $hasForbiddenMode = \str_contains($sqlMode, self::MYSQL_SQL_MODE_PART); + $collection->add( + SettingsResult::create( + $hasForbiddenMode ? SettingsResult::ERROR : SettingsResult::GREEN, + 'sql_mode', + 'MySQL value sql_mode', + $sqlMode, + 'No ' . self::MYSQL_SQL_MODE_PART, + ), + ); } private function checkTimeZone(HealthCollection $collection): void { $timeZone = $this->connection->fetchOne('SELECT @@time_zone'); - if (\is_string($timeZone) && !\in_array($timeZone, self::MYSQL_TIME_ZONES, true)) { - $collection->add( - SettingsResult::warning( - 'sql_time_zone', - 'MySQL value time_zone', - $timeZone, - implode(', ', self::MYSQL_TIME_ZONES), - ), - ); + + if (!\is_string($timeZone)) { + return; } + + $isInvalidTimeZone = !\in_array($timeZone, self::MYSQL_TIME_ZONES, true); + $collection->add( + SettingsResult::create( + $isInvalidTimeZone ? SettingsResult::WARNING : SettingsResult::GREEN, + 'sql_time_zone', + 'MySQL value time_zone', + $timeZone, + implode(', ', self::MYSQL_TIME_ZONES), + ), + ); } private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $collection): void @@ -91,15 +102,15 @@ private function checkCheckDefaultEnvironmentSessionVariables(HealthCollection $ } $setSessionVariables = (bool) EnvironmentHelper::getVariable('SQL_SET_DEFAULT_SESSION_VARIABLES', true); - if ($setSessionVariables) { - $collection->add( - SettingsResult::warning( - 'sql_set_default_session_variables', - 'MySQL session vars are set on each connect', - 'enabled', - 'disabled', - ), - ); - } + + $collection->add( + SettingsResult::create( + $setSessionVariables ? SettingsResult::WARNING : SettingsResult::GREEN, + 'sql_set_default_session_variables', + 'MySQL session vars are set on each connect', + $setSessionVariables ? 'enabled' : 'disabled', + 'disabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php index 3a069091..16e782de 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/PhpSettingsChecker.php @@ -22,74 +22,75 @@ public function collect(HealthCollection $collection): void private function checkAssertActive(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('zend.assertions'); - if ($currentValue !== '-1') { - $collection->add( - SettingsResult::warning( - 'zend.assertions', - 'PHP value zend.assertions', - $currentValue, - '-1', - ), - ); - } + $collection->add( + SettingsResult::create( + $currentValue !== '-1' ? SettingsResult::WARNING : SettingsResult::GREEN, + 'zend.assertions', + 'PHP value zend.assertions', + $currentValue, + '-1', + ), + ); } private function checkEnableFileOverride(HealthCollection $collection): void { - if (!$this->isIniEnabled('opcache.enable_file_override')) { - $collection->add( - SettingsResult::warning( - 'php.opcache.enable_file_override', - 'PHP value opcache.enable_file_override', - $this->iniGetFailover('opcache.enable_file_override'), - '1', - ), - ); - } + $currentValue = $this->iniGetFailover('opcache.enable_file_override'); + $iniFailOver = !$this->isIniEnabled('opcache.enable_file_override'); + $collection->add( + SettingsResult::create( + $iniFailOver ? SettingsResult::WARNING : SettingsResult::GREEN, + 'php.opcache.enable_file_override', + 'PHP value opcache.enable_file_override', + $currentValue, + '1', + ), + ); } private function checkInternedStringsBuffer(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('opcache.interned_strings_buffer'); - if ((int) $currentValue < 20) { - $collection->add( - SettingsResult::warning( - 'php.opcache.interned_strings_buffer', - 'PHP value opcache.interned_strings_buffer', - $currentValue, - 'min 20', - ), - ); - } + $bufferTooSmall = (int) $currentValue < 20; + $collection->add( + SettingsResult::create( + $bufferTooSmall ? SettingsResult::WARNING : SettingsResult::GREEN, + 'php.opcache.interned_strings_buffer', + 'PHP value opcache.interned_strings_buffer', + $currentValue, + 'min 20', + ), + ); } private function checkZendDetectUnicode(HealthCollection $collection): void { - if ($this->isIniEnabled('zend.detect_unicode')) { - $collection->add( - SettingsResult::warning( - 'php.zend.detect_unicode', - 'PHP value zend.detect_unicode', - $this->iniGetFailover('zend.detect_unicode'), - '0', - ), - ); - } + $currentValue = $this->iniGetFailover('zend.detect_unicode'); + $iniFailOver = $this->isIniEnabled('zend.detect_unicode'); + $collection->add( + SettingsResult::create( + $iniFailOver ? SettingsResult::WARNING : SettingsResult::GREEN, + 'php.zend.detect_unicode', + 'PHP value zend.detect_unicode', + $currentValue, + '0', + ), + ); } private function checkRealpathCacheTtl(HealthCollection $collection): void { $currentValue = $this->iniGetFailover('realpath_cache_ttl'); - if ((int) $currentValue < 3600) { - $collection->add( - SettingsResult::warning( - 'php.zend.realpath_cache_ttl', - 'PHP value realpath_cache_ttl', - $currentValue, - 'min 3600', - ), - ); - } + $ttlTooLow = (int) $currentValue < 3600; + $collection->add( + SettingsResult::create( + $ttlTooLow ? SettingsResult::WARNING : SettingsResult::GREEN, + 'php.zend.realpath_cache_ttl', + 'PHP value realpath_cache_ttl', + $currentValue, + 'min 3600', + ), + ); } /** diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index 767a448d..9254d86c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -26,15 +26,14 @@ public function collect(HealthCollection $collection): void return; } - if ($this->productStreamIndexingEnabled) { - $collection->add( - SettingsResult::info( - 'product-stream-indexing', - 'Product Stream Indexing', - 'enabled', - 'disabled', - ), - ); - } + $collection->add( + SettingsResult::create( + $this->productStreamIndexingEnabled ? SettingsResult::INFO : SettingsResult::GREEN, + 'product-stream-indexing', + 'Product Stream Indexing', + $this->productStreamIndexingEnabled ? 'enabled' : 'disabled', + 'disabled', + ), + ); } } diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index c5c675cb..7c7d529f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -11,6 +11,9 @@ class QueueConnectionChecker implements PerformanceCheckerInterface, CheckerInterface { + private const ID = 'queue.adapter'; + private const RECOMMENDED = 'redis or rabbitmq'; + public function __construct( #[Autowire(param: 'frosh_tools.queue_connection')] protected string $connection, @@ -20,32 +23,37 @@ public function __construct( public function collect(HealthCollection $collection): void { $schema = $this->getSchema(); + $state = $this->determineState($schema); + $snippet = $this->getSnippet($schema); - $id = 'queue.adapter'; - - if ($schema === 'doctrine') { - $collection->add( - SettingsResult::warning( - $id, - 'The queue storage in database does not scale well with multiple workers', - $schema, - 'redis or rabbitmq', - ), - ); + $collection->add( + SettingsResult::create( + $state, + self::ID, + $snippet, + $schema, + self::RECOMMENDED, + ), + ); + } - return; - } + private function determineState(string $schema): string + { + return match ($schema) { + 'redis', 'rabbitmq' => SettingsResult::GREEN, + 'doctrine', 'sync' => SettingsResult::WARNING, + default => SettingsResult::INFO, + }; + } - if ($schema === 'sync') { - $collection->add( - SettingsResult::warning( - $id, - 'The sync queue is not suitable for production environments', - $schema, - 'redis or rabbitmq', - ), - ); - } + private function getSnippet(string $schema): string + { + return match ($schema) { + 'doctrine' => 'The queue storage in database does not scale well with multiple workers', + 'sync' => 'The sync queue is not suitable for production environments', + 'redis', 'rabbitmq' => 'Queue adapter', + default => 'Unknown queue adapter', + }; } private function getSchema(): string diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index ab81bbad..0cbec3a4 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -21,16 +21,18 @@ public function collect(HealthCollection $collection): void { $httpCacheType = $this->cacheRegistry->get('cache.http')->getType(); - if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS) - || \str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE)) { + // no redis + if (!\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS)) { return; } + $notTagAware = !\str_starts_with($httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE); $collection->add( - SettingsResult::warning( + SettingsResult::create( + $notTagAware ? SettingsResult::WARNING : SettingsResult::GREEN, 'redis-tag-aware', 'Redis adapter should be TagAware', - CacheAdapter::TYPE_REDIS, + $httpCacheType, CacheAdapter::TYPE_REDIS_TAG_AWARE, ), ); diff --git a/src/Components/Health/SettingsResult.php b/src/Components/Health/SettingsResult.php index 9251b694..e7396b05 100644 --- a/src/Components/Health/SettingsResult.php +++ b/src/Components/Health/SettingsResult.php @@ -70,4 +70,20 @@ public static function info(string $id, string $snippet, string $current = '', s return $me; } + + public static function create( + string $state, + string $id, + string $snippet, + string $current = '', + string $recommended = '' + ): self { + return match ($state) { + self::GREEN => self::ok($id, $snippet, $current, $recommended), + self::WARNING => self::warning($id, $snippet, $current, $recommended), + self::ERROR => self::error($id, $snippet, $current, $recommended), + self::INFO => self::info($id, $snippet, $current, $recommended), + default => throw new \InvalidArgumentException("Invalid state: {$state}"), + }; + } } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js index 880f4803..67ff2a82 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/index.js @@ -15,9 +15,10 @@ Component.register('frosh-tools-tab-index', { data() { return { isLoading: true, + showDone: false, loadError: null, health: null, - performanceStatus: null, + performanceStatus: [], activeInfo: null, }; }, @@ -26,6 +27,18 @@ Component.register('frosh-tools-tab-index', { this.createdComponent(); }, + computed: { + filteredPerformanceStatus() { + if (this.showDone) { + return this.performanceStatus; + } + + return this.performanceStatus.filter( + (item) => item.state !== 'STATE_OK' + ); + }, + }, + methods: { recommendationFor(item) { return (item && recommendations[item.id]) || null; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss index dba7a176..9e21ff54 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/style.scss @@ -11,6 +11,19 @@ font-weight: 500; } +.ft-show-done-toggle { + display: inline-flex; + align-items: center; + gap: 6px; + font-size: 13px; + color: var(--ft-text-muted); + cursor: pointer; + + input { + margin: 0; + } +} + .ft-info-modal { display: flex; flex-direction: column; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig index d6cb59a0..af2fe228 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-index/template.twig @@ -98,11 +98,20 @@ +
@@ -140,7 +149,7 @@
diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json index edaa981c..de4cbb49 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json +++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/de-DE.json @@ -422,6 +422,8 @@ "status": "Status", "name": "Name", "good": "Gut", + "done": "Erledigt", + "showDone": "Erledigte anzeigen", "warning": "Warnung", "error": "Fehler", "info": "Info", diff --git a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json index bc2ca433..c7d4d095 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json +++ b/src/Resources/app/administration/src/module/frosh-tools/snippet/en-GB.json @@ -422,6 +422,8 @@ "status": "Status", "name": "Name", "good": "Good", + "done": "Done", + "showDone": "Show done", "warning": "Warning", "error": "Error", "info": "Info",