From bb44f6792003135c9ede673b5cde3e1c2077e20a Mon Sep 17 00:00:00 2001 From: Shyim Date: Mon, 17 Feb 2025 09:11:40 +0100 Subject: [PATCH 01/11] ci: use extension verifier --- .github/workflows/code-style.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 21821327..e7666015 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -8,10 +8,19 @@ on: jobs: cs: - if: github.event_name != 'schedule' - uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main - phpstan: - uses: shopware/github-actions/.github/workflows/phpstan.yml@main - with: - extensionName: FroshTools - shopwareVersion: v6.6.0.0-rc1 + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run CS + run: docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run + + check: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run CS + run: docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext From 9f3561e9549cb19d5091e4d0823fc53231636732 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 09:27:56 +0100 Subject: [PATCH 02/11] ci: pass down step summary --- .github/workflows/code-style.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index e7666015..4fdc47cb 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v4 - name: Run CS - run: docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run + run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run check: runs-on: ubuntu-24.04 @@ -23,4 +23,4 @@ jobs: uses: actions/checkout@v4 - name: Run CS - run: docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext + run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext From 3a23dc88fcc85da50509822a5e76a4ac3b657a93 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 09:48:28 +0100 Subject: [PATCH 03/11] chore: format all files --- src/Command/EnvListCommand.php | 4 +- src/Components/CacheAdapter.php | 12 +- .../AdminInfoSubscriberEventListener.php | 3 +- .../DisabledElasticsearchManager.php | 4 +- .../Elasticsearch/ElasticsearchManager.php | 3 +- .../Environment/EnvironmentFile.php | 4 +- .../Checker/HealthChecker/DebugChecker.php | 3 +- .../HealthChecker/HealthCheckerInterface.php | 4 +- .../Checker/HealthChecker/MysqlChecker.php | 4 +- .../HealthChecker/ProductionChecker.php | 3 +- .../Checker/HealthChecker/QueueChecker.php | 3 +- .../HealthChecker/SwagSecurityChecker.php | 3 +- .../HealthChecker/SystemInfoChecker.php | 3 +- .../Checker/HealthChecker/TaskChecker.php | 5 +- .../PerformanceChecker/AdminWorkerChecker.php | 3 +- .../CompressionMethodChecker.php | 3 +- .../DisableSymfonySecretsChecker.php | 3 +- .../DisabledMailUpdatesChecker.php | 4 +- .../FineGrainedCachingChecker.php | 3 +- .../FixCacheIdSetChecker.php | 3 +- .../IncrementStorageChecker.php | 3 +- .../MailOverQueueChecker.php | 3 +- .../MessengerAutoSetupChecker.php | 3 +- .../MysqlSettingsChecker.php | 4 +- .../PerformanceCheckerInterface.php | 4 +- .../ProductStreamIndexingChecker.php | 3 +- .../QueueConnectionChecker.php | 3 +- .../RedisTagAwareChecker.php | 3 +- src/Components/LineReader.php | 4 +- .../SystemConfig/ConfigSystemConfigLoader.php | 4 +- src/Controller/CacheController.php | 3 +- src/Controller/ElasticsearchController.php | 4 +- src/Controller/HealthController.php | 3 +- src/Controller/QueueController.php | 9 +- src/Controller/ScheduledTaskController.php | 3 +- src/Controller/ShopwareFilesController.php | 2 +- src/Controller/StateMachineController.php | 4 +- src/Resources/app/administration/package.json | 14 +- .../administration/src/api/elasticsearch.js | 235 +++++----- .../app/administration/src/api/frosh-tools.js | 410 +++++++++--------- .../app/administration/src/api/index.js | 15 +- .../src/module/frosh-tools/acl/index.js | 25 +- .../component/frosh-tools-tab-cache/index.js | 207 ++++----- .../frosh-tools-tab-elasticsearch/index.js | 331 +++++++------- .../component/frosh-tools-tab-files/index.js | 221 +++++----- .../component/frosh-tools-tab-index/index.js | 91 ++-- .../component/frosh-tools-tab-logs/index.js | 167 +++---- .../component/frosh-tools-tab-queue/index.js | 108 +++-- .../frosh-tools-tab-scheduled/index.js | 309 +++++++------ .../frosh-tools-tab-state-machines/index.js | 91 ++-- .../src/module/frosh-tools/index.js | 178 ++++---- .../module/frosh-tools/page/index/index.js | 15 +- .../src/module/frosh-tools/snippet/de-DE.json | 220 +++++----- .../src/module/frosh-tools/snippet/en-GB.json | 220 +++++----- .../sw-data-grid-inline-edit/index.js | 2 +- .../src/overrides/sw-version/index.js | 164 +++---- 56 files changed, 1639 insertions(+), 1523 deletions(-) diff --git a/src/Command/EnvListCommand.php b/src/Command/EnvListCommand.php index dcb1b16d..dd0b412f 100644 --- a/src/Command/EnvListCommand.php +++ b/src/Command/EnvListCommand.php @@ -7,4 +7,6 @@ use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand('frosh:env:list')] -class EnvListCommand extends EnvGetCommand {} +class EnvListCommand extends EnvGetCommand +{ +} diff --git a/src/Components/CacheAdapter.php b/src/Components/CacheAdapter.php index 202ab6d2..8f7cd4e6 100644 --- a/src/Components/CacheAdapter.php +++ b/src/Components/CacheAdapter.php @@ -114,14 +114,14 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface { if ($adapter instanceof CacheDecorator) { // Do not declare function as static - $func = \Closure::bind(fn() => $adapter->decorated, $adapter, $adapter::class); + $func = \Closure::bind(fn () => $adapter->decorated, $adapter, $adapter::class); return $this->getCacheAdapter($func()); } if ($adapter instanceof TagAwareAdapter || $adapter instanceof TraceableAdapter) { // Do not declare function as static - $func = \Closure::bind(fn() => $adapter->pool, $adapter, $adapter::class); + $func = \Closure::bind(fn () => $adapter->pool, $adapter, $adapter::class); return $this->getCacheAdapter($func()); } @@ -132,10 +132,10 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface private function getRedis(AdapterInterface $adapter): \Redis { if ($adapter instanceof RedisTagAwareAdapter) { - $redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisTagAwareAdapter::class); + $redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisTagAwareAdapter::class); } else { // @phpstan-ignore-next-line - $redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisAdapter::class); + $redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisAdapter::class); } return $redisProxyGetter(); @@ -143,14 +143,14 @@ private function getRedis(AdapterInterface $adapter): \Redis private function getPathFromFilesystemAdapter(FilesystemAdapter $adapter): string { - $getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class); + $getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class); return $getter(); } private function getPathOfFilesAdapter(PhpFilesAdapter $adapter): string { - $getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class); + $getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class); return $getter(); } diff --git a/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php b/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php index de8b61da..584df6dc 100644 --- a/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php +++ b/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php @@ -14,7 +14,8 @@ public function __construct( #[Autowire(param: 'frosh_tools.elasticsearch.enabled')] private bool $elasticsearchEnabled, - ) {} + ) { + } public function __invoke(ResponseEvent $event): void { if ($event->getRequest()->attributes->get('_route') !== 'api.info.config') { diff --git a/src/Components/Elasticsearch/DisabledElasticsearchManager.php b/src/Components/Elasticsearch/DisabledElasticsearchManager.php index 6b56ab4d..9d00d8ea 100644 --- a/src/Components/Elasticsearch/DisabledElasticsearchManager.php +++ b/src/Components/Elasticsearch/DisabledElasticsearchManager.php @@ -6,7 +6,9 @@ class DisabledElasticsearchManager extends ElasticsearchManager { - public function __construct() {} + public function __construct() + { + } public function isEnabled(): bool { diff --git a/src/Components/Elasticsearch/ElasticsearchManager.php b/src/Components/Elasticsearch/ElasticsearchManager.php index b0a3e765..9fe0789d 100644 --- a/src/Components/Elasticsearch/ElasticsearchManager.php +++ b/src/Components/Elasticsearch/ElasticsearchManager.php @@ -28,7 +28,8 @@ public function __construct( private readonly Connection $connection, #[Autowire(service: 'shopware.increment.gateway.registry')] private readonly IncrementGatewayRegistry $gatewayRegistry, - ) {} + ) { + } public function isEnabled(): bool { diff --git a/src/Components/Environment/EnvironmentFile.php b/src/Components/Environment/EnvironmentFile.php index 90ee898a..04e7a4f4 100644 --- a/src/Components/Environment/EnvironmentFile.php +++ b/src/Components/Environment/EnvironmentFile.php @@ -9,7 +9,9 @@ class EnvironmentFile implements \Stringable /** * @param list $items */ - public function __construct(private array $items) {} + public function __construct(private array $items) + { + } public function __toString(): string { diff --git a/src/Components/Health/Checker/HealthChecker/DebugChecker.php b/src/Components/Health/Checker/HealthChecker/DebugChecker.php index 49f39da7..fdbcbdd7 100644 --- a/src/Components/Health/Checker/HealthChecker/DebugChecker.php +++ b/src/Components/Health/Checker/HealthChecker/DebugChecker.php @@ -18,7 +18,8 @@ public function __construct( private readonly array $kernelBundles, #[Autowire(param: 'kernel.debug')] private readonly bool $kernelDebug, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/HealthCheckerInterface.php b/src/Components/Health/Checker/HealthChecker/HealthCheckerInterface.php index 4198e70a..8c1670ec 100644 --- a/src/Components/Health/Checker/HealthChecker/HealthCheckerInterface.php +++ b/src/Components/Health/Checker/HealthChecker/HealthCheckerInterface.php @@ -7,4 +7,6 @@ use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; #[AutoconfigureTag('frosh_tools.health_checker')] -interface HealthCheckerInterface {} +interface HealthCheckerInterface +{ +} diff --git a/src/Components/Health/Checker/HealthChecker/MysqlChecker.php b/src/Components/Health/Checker/HealthChecker/MysqlChecker.php index 4ee105da..06f9b1fb 100644 --- a/src/Components/Health/Checker/HealthChecker/MysqlChecker.php +++ b/src/Components/Health/Checker/HealthChecker/MysqlChecker.php @@ -11,7 +11,9 @@ class MysqlChecker implements HealthCheckerInterface, CheckerInterface { - public function __construct(private readonly Connection $connection) {} + public function __construct(private readonly Connection $connection) + { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/ProductionChecker.php b/src/Components/Health/Checker/HealthChecker/ProductionChecker.php index ec53923c..c2118db5 100644 --- a/src/Components/Health/Checker/HealthChecker/ProductionChecker.php +++ b/src/Components/Health/Checker/HealthChecker/ProductionChecker.php @@ -14,7 +14,8 @@ class ProductionChecker implements HealthCheckerInterface, CheckerInterface public function __construct( #[Autowire(param: 'kernel.environment')] private readonly string $environment, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/QueueChecker.php b/src/Components/Health/Checker/HealthChecker/QueueChecker.php index 93b22aa7..98db7f05 100644 --- a/src/Components/Health/Checker/HealthChecker/QueueChecker.php +++ b/src/Components/Health/Checker/HealthChecker/QueueChecker.php @@ -15,7 +15,8 @@ class QueueChecker implements HealthCheckerInterface, CheckerInterface public function __construct( private readonly Connection $connection, private readonly SystemConfigService $configService, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php b/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php index e502d7ce..94fc2ead 100644 --- a/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php +++ b/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php @@ -27,7 +27,8 @@ public function __construct( private readonly CacheInterface $cacheObject, #[Autowire(lazy: true)] private readonly HttpClientInterface $httpClient, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/SystemInfoChecker.php b/src/Components/Health/Checker/HealthChecker/SystemInfoChecker.php index c7b6ff2b..befa0905 100644 --- a/src/Components/Health/Checker/HealthChecker/SystemInfoChecker.php +++ b/src/Components/Health/Checker/HealthChecker/SystemInfoChecker.php @@ -15,7 +15,8 @@ class SystemInfoChecker implements HealthCheckerInterface, CheckerInterface public function __construct( #[Autowire(param: 'kernel.project_dir')] private readonly string $projectDir, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/HealthChecker/TaskChecker.php b/src/Components/Health/Checker/HealthChecker/TaskChecker.php index 115937ee..85dd0df3 100644 --- a/src/Components/Health/Checker/HealthChecker/TaskChecker.php +++ b/src/Components/Health/Checker/HealthChecker/TaskChecker.php @@ -18,7 +18,8 @@ public function __construct( private readonly Connection $connection, private readonly ParameterBagInterface $parameterBag, private readonly SystemConfigService $configService, - ) {} + ) { + } public function collect(HealthCollection $collection): void { @@ -45,7 +46,7 @@ public function collect(HealthCollection $collection): void $taskDateLimit = (new \DateTimeImmutable())->modify(\sprintf('-%d minutes', $maxDiff)); $recommended = \sprintf('max %d mins', $maxDiff); - $tasks = array_filter($tasks, fn(array $task) => new \DateTimeImmutable($task['next_execution_time']) < $taskDateLimit); + $tasks = array_filter($tasks, fn (array $task) => new \DateTimeImmutable($task['next_execution_time']) < $taskDateLimit); if ($tasks === []) { $collection->add(SettingsResult::ok('scheduled_task', 'Scheduled tasks overdue', '0 mins', $recommended)); diff --git a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php index 6c04201c..a1b43a5f 100644 --- a/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/AdminWorkerChecker.php @@ -14,7 +14,8 @@ class AdminWorkerChecker implements PerformanceCheckerInterface, CheckerInterfac public function __construct( #[Autowire(param: 'shopware.admin_worker.enable_admin_worker')] private readonly bool $adminWorkerEnabled, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index 7da6fb13..31848ec8 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -22,7 +22,8 @@ public function __construct( public readonly bool $cartCompressionEnabled, #[Autowire(param: 'shopware.cart.compression_method')] public readonly string $cartCompressionMethod, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php index b3ccc0b4..422c03fe 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisableSymfonySecretsChecker.php @@ -15,7 +15,8 @@ class DisableSymfonySecretsChecker implements PerformanceCheckerInterface, Check public function __construct( #[Autowire(service: 'secrets.vault')] private readonly ?AbstractVault $vault = null, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php index 85dd9a23..a6f86ce0 100644 --- a/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/DisabledMailUpdatesChecker.php @@ -11,7 +11,9 @@ class DisabledMailUpdatesChecker implements PerformanceCheckerInterface, CheckerInterface { - public function __construct(private readonly ParameterBagInterface $params) {} + public function __construct(private readonly ParameterBagInterface $params) + { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index 3fb9976f..f4dc360c 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -20,7 +20,8 @@ public function __construct( public readonly bool $cacheTaggingEachSnippet, #[Autowire('%shopware.cache.tagging.each_theme_config%')] public readonly bool $cacheTaggingEachThemeConfig, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php index 90bd3486..7384db8a 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FixCacheIdSetChecker.php @@ -15,7 +15,8 @@ class FixCacheIdSetChecker implements PerformanceCheckerInterface, CheckerInterf public function __construct( #[Autowire(param: 'kernel.shopware_version')] protected string $shopwareVersion, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php index 55a6c448..7895e94b 100644 --- a/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/IncrementStorageChecker.php @@ -16,7 +16,8 @@ public function __construct( private readonly string $userActivity, #[Autowire(param: 'shopware.increment.message_queue.type')] private readonly string $queueActivity, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php index a84e70c6..54801d2d 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MailOverQueueChecker.php @@ -14,7 +14,8 @@ class MailOverQueueChecker implements PerformanceCheckerInterface, CheckerInterf public function __construct( #[Autowire(param: 'frosh_tools.mail_over_queue')] protected bool $mailerIsOverQueue, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php index 0aaaa782..406a36ca 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MessengerAutoSetupChecker.php @@ -18,7 +18,8 @@ public function __construct( private readonly string $messageTransportDsnLowPriority, #[Autowire(param: 'env(MESSENGER_TRANSPORT_FAILURE_DSN)')] private readonly string $messageTransportDsnFailure, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php index f0f56d1f..852f86fc 100644 --- a/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/MysqlSettingsChecker.php @@ -18,7 +18,9 @@ class MysqlSettingsChecker implements PerformanceCheckerInterface, CheckerInterf public const MYSQL_SQL_MODE_PART = 'ONLY_FULL_GROUP_BY'; - public function __construct(private readonly Connection $connection) {} + public function __construct(private readonly Connection $connection) + { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/PerformanceCheckerInterface.php b/src/Components/Health/Checker/PerformanceChecker/PerformanceCheckerInterface.php index 99eb8eb2..604d81ac 100644 --- a/src/Components/Health/Checker/PerformanceChecker/PerformanceCheckerInterface.php +++ b/src/Components/Health/Checker/PerformanceChecker/PerformanceCheckerInterface.php @@ -7,4 +7,6 @@ use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; #[AutoconfigureTag('frosh_tools.performance_checker')] -interface PerformanceCheckerInterface {} +interface PerformanceCheckerInterface +{ +} diff --git a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php index 43788a46..12e02a87 100644 --- a/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/ProductStreamIndexingChecker.php @@ -14,7 +14,8 @@ class ProductStreamIndexingChecker implements PerformanceCheckerInterface, Check public function __construct( #[Autowire(param: 'shopware.product_stream.indexing')] private readonly bool $productStreamIndexingEnabled, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index a1414d6a..f5e6a882 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -14,7 +14,8 @@ class QueueConnectionChecker implements PerformanceCheckerInterface, CheckerInte public function __construct( #[Autowire(param: 'frosh_tools.queue_connection')] protected string $connection, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php index b76f7393..53208b94 100644 --- a/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/RedisTagAwareChecker.php @@ -14,7 +14,8 @@ class RedisTagAwareChecker implements PerformanceCheckerInterface, CheckerInterf { public function __construct( private readonly CacheRegistry $cacheRegistry, - ) {} + ) { + } public function collect(HealthCollection $collection): void { diff --git a/src/Components/LineReader.php b/src/Components/LineReader.php index b0671137..870ba326 100644 --- a/src/Components/LineReader.php +++ b/src/Components/LineReader.php @@ -13,7 +13,9 @@ final class LineReader /** * Prevent instantiation */ - private function __construct() {} + private function __construct() + { + } /** * @return \Generator diff --git a/src/Components/SystemConfig/ConfigSystemConfigLoader.php b/src/Components/SystemConfig/ConfigSystemConfigLoader.php index e1363af3..b9e5d637 100644 --- a/src/Components/SystemConfig/ConfigSystemConfigLoader.php +++ b/src/Components/SystemConfig/ConfigSystemConfigLoader.php @@ -16,7 +16,9 @@ class ConfigSystemConfigLoader extends AbstractSystemConfigLoader /** * @param array|bool|float|int|string|null>> $config */ - public function __construct(private readonly AbstractSystemConfigLoader $decorated, #[Autowire(param: 'frosh_tools.system_config')] private readonly array $config) {} + public function __construct(private readonly AbstractSystemConfigLoader $decorated, #[Autowire(param: 'frosh_tools.system_config')] private readonly array $config) + { + } public function getDecorated(): AbstractSystemConfigLoader { diff --git a/src/Controller/CacheController.php b/src/Controller/CacheController.php index 3fd0d314..3a740092 100644 --- a/src/Controller/CacheController.php +++ b/src/Controller/CacheController.php @@ -19,7 +19,8 @@ public function __construct( #[Autowire(param: 'kernel.cache_dir')] private readonly string $cacheDir, private readonly CacheRegistry $cacheRegistry, - ) {} + ) { + } #[Route(path: '/cache', name: 'api.frosh.tools.cache.get', methods: ['GET'])] public function cacheStatistics(): JsonResponse diff --git a/src/Controller/ElasticsearchController.php b/src/Controller/ElasticsearchController.php index 20a14e22..92b58d29 100644 --- a/src/Controller/ElasticsearchController.php +++ b/src/Controller/ElasticsearchController.php @@ -14,7 +14,9 @@ #[Route(path: '/api/_action/frosh-tools/elasticsearch', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])] class ElasticsearchController extends AbstractController { - public function __construct(private readonly ElasticsearchManager $manager) {} + public function __construct(private readonly ElasticsearchManager $manager) + { + } #[Route(path: '/status', name: 'api.frosh.tools.elasticsearch.status', methods: ['GET'])] public function status(): Response diff --git a/src/Controller/HealthController.php b/src/Controller/HealthController.php index 6ac8c560..b3f641fb 100644 --- a/src/Controller/HealthController.php +++ b/src/Controller/HealthController.php @@ -27,7 +27,8 @@ public function __construct( #[AutowireIterator('frosh_tools.performance_checker')] private readonly iterable $performanceCheckers, private readonly CacheInterface $cacheObject, - ) {} + ) { + } #[Route(path: '/health/status', name: 'api.frosh.tools.health.status', methods: ['GET'])] public function status(): JsonResponse diff --git a/src/Controller/QueueController.php b/src/Controller/QueueController.php index 529b3ddf..18fa4189 100644 --- a/src/Controller/QueueController.php +++ b/src/Controller/QueueController.php @@ -27,7 +27,8 @@ public function __construct( private readonly IncrementGatewayRegistry $incrementer, #[Autowire(service: 'messenger.receiver_locator')] private readonly ServiceLocator $transportLocator, - ) {} + ) { + } #[Route(path: '/queue/list', name: 'api.frosh.tools.queue.list', methods: ['GET'])] public function list(): JsonResponse @@ -35,7 +36,7 @@ public function list(): JsonResponse $incrementer = $this->incrementer->get(IncrementGatewayRegistry::MESSAGE_QUEUE_POOL); $list = $incrementer->list('message_queue_stats', -1); - $queueData = array_map(static fn(array $entry) => [ + $queueData = array_map(static fn (array $entry) => [ 'name' => $entry['key'], 'size' => (int) $entry['count'], ], array_values($list)); @@ -78,7 +79,7 @@ private function getMessengerStats(array &$queueData): void ]; } - usort($queueData, static fn(array $a, array $b) => $b['size'] <=> $a['size']); + usort($queueData, static fn (array $a, array $b) => $b['size'] <=> $a['size']); } /** @@ -88,6 +89,6 @@ private function getTransportNames(): array { $transportNames = array_keys($this->transportLocator->getProvidedServices()); - return array_filter($transportNames, static fn(string $transportName) => str_starts_with($transportName, 'messenger.transport')); + return array_filter($transportNames, static fn (string $transportName) => str_starts_with($transportName, 'messenger.transport')); } } diff --git a/src/Controller/ScheduledTaskController.php b/src/Controller/ScheduledTaskController.php index 46630af0..dcc6d488 100644 --- a/src/Controller/ScheduledTaskController.php +++ b/src/Controller/ScheduledTaskController.php @@ -28,7 +28,8 @@ public function __construct( private readonly EntityRepository $scheduledTaskRepository, private readonly TaskRegistry $taskRegistry, private readonly TaskRunner $taskRunner, - ) {} + ) { + } #[Route(path: '/scheduled-task/{id}', name: 'api.frosh.tools.scheduled.task.run', methods: ['POST'])] public function runTask(string $id, Context $context): JsonResponse diff --git a/src/Controller/ShopwareFilesController.php b/src/Controller/ShopwareFilesController.php index 960cdb6a..14dae6de 100644 --- a/src/Controller/ShopwareFilesController.php +++ b/src/Controller/ShopwareFilesController.php @@ -73,7 +73,7 @@ public function listShopwareFiles(): JsonResponse foreach (explode("\n", $data) as $row) { if ($this->isPlatform) { - $row = preg_replace_callback('/vendor\/shopware\/(.)/', fn($matches): string => 'src/' . strtoupper($matches[1]), $row); + $row = preg_replace_callback('/vendor\/shopware\/(.)/', fn ($matches): string => 'src/' . strtoupper($matches[1]), $row); } [$expectedMd5Sum, $file] = explode(' ', trim((string) $row)); diff --git a/src/Controller/StateMachineController.php b/src/Controller/StateMachineController.php index da907e37..b7f8c889 100644 --- a/src/Controller/StateMachineController.php +++ b/src/Controller/StateMachineController.php @@ -25,7 +25,9 @@ final class StateMachineController extends AbstractController /** * @param EntityRepository $stateMachineRepository */ - public function __construct(private readonly EntityRepository $stateMachineRepository) {} + public function __construct(private readonly EntityRepository $stateMachineRepository) + { + } #[Route(path: '/state-machines/load/{stateMachineId}', name: 'api.frosh.tools.state-machines.load', methods: ['GET'])] public function load(string $stateMachineId, Context $context): JsonResponse diff --git a/src/Resources/app/administration/package.json b/src/Resources/app/administration/package.json index f7db6522..0f9617e4 100644 --- a/src/Resources/app/administration/package.json +++ b/src/Resources/app/administration/package.json @@ -1,9 +1,9 @@ { - "name": "Resources", - "version": "1.0.0", - "main": "index.js", - "dependencies": { - "diff-match-patch": "^1.0.5" - }, - "license": "MIT" + "name": "Resources", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "diff-match-patch": "^1.0.5" + }, + "license": "MIT" } diff --git a/src/Resources/app/administration/src/api/elasticsearch.js b/src/Resources/app/administration/src/api/elasticsearch.js index b3839ee8..4b258788 100644 --- a/src/Resources/app/administration/src/api/elasticsearch.js +++ b/src/Resources/app/administration/src/api/elasticsearch.js @@ -1,127 +1,138 @@ const { ApiService } = Shopware.Classes; class Elasticsearch extends ApiService { - constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools/elasticsearch') { - super(httpClient, loginService, apiEndpoint); - } + constructor( + httpClient, + loginService, + apiEndpoint = '_action/frosh-tools/elasticsearch', + ) { + super(httpClient, loginService, apiEndpoint); + } - status() { - const apiRoute = `${this.getApiBasePath()}/status`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + status() { + const apiRoute = `${this.getApiBasePath()}/status`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - indices() { - const apiRoute = `${this.getApiBasePath()}/indices`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + indices() { + const apiRoute = `${this.getApiBasePath()}/indices`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - deleteIndex(indexName) { - const apiRoute = `${this.getApiBasePath()}/index/` + indexName; - return this.httpClient.delete( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + deleteIndex(indexName) { + const apiRoute = `${this.getApiBasePath()}/index/` + indexName; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - console(method, path, payload) { - const apiRoute = `${this.getApiBasePath()}/console` + path; - return this.httpClient.request( - { - url: apiRoute, - method: method, - headers: { - ...this.getBasicHeaders(), - 'content-type': 'application/json', - }, - data: payload, - }, - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + console(method, path, payload) { + const apiRoute = `${this.getApiBasePath()}/console` + path; + return this.httpClient + .request({ + url: apiRoute, + method: method, + headers: { + ...this.getBasicHeaders(), + 'content-type': 'application/json', + }, + data: payload, + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - flushAll() { - const apiRoute = `${this.getApiBasePath()}/flush_all`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + flushAll() { + const apiRoute = `${this.getApiBasePath()}/flush_all`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - reindex() { - const apiRoute = `${this.getApiBasePath()}/reindex`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + reindex() { + const apiRoute = `${this.getApiBasePath()}/reindex`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - switchAlias() { - const apiRoute = `${this.getApiBasePath()}/switch_alias`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + switchAlias() { + const apiRoute = `${this.getApiBasePath()}/switch_alias`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - cleanup() { - const apiRoute = `${this.getApiBasePath()}/cleanup`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + cleanup() { + const apiRoute = `${this.getApiBasePath()}/cleanup`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - reset() { - const apiRoute = `${this.getApiBasePath()}/reset`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + reset() { + const apiRoute = `${this.getApiBasePath()}/reset`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } } export default Elasticsearch; diff --git a/src/Resources/app/administration/src/api/frosh-tools.js b/src/Resources/app/administration/src/api/frosh-tools.js index e81b7ccb..318920ab 100644 --- a/src/Resources/app/administration/src/api/frosh-tools.js +++ b/src/Resources/app/administration/src/api/frosh-tools.js @@ -1,214 +1,208 @@ const { ApiService } = Shopware.Classes; class FroshTools extends ApiService { - constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { - super(httpClient, loginService, apiEndpoint); - } - - getCacheInfo() { - const apiRoute = `${this.getApiBasePath()}/cache`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - clearCache(folder) { - const apiRoute = `${this.getApiBasePath()}/cache/${folder}`; - return this.httpClient.delete( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - getQueue() { - const apiRoute = `${this.getApiBasePath()}/queue/list`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - resetQueue() { - const apiRoute = `${this.getApiBasePath()}/queue`; - return this.httpClient.delete( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - runScheduledTask(id) { - const apiRoute = `${this.getApiBasePath()}/scheduled-task/${id}`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - scheduleScheduledTask(id, immediately = false) { - const apiRoute = `${this.getApiBasePath()}/scheduled-task/schedule/${id}`; - return this.httpClient.post( - apiRoute, - { - 'immediately': immediately - }, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - scheduledTasksRegister() { - const apiRoute = `${this.getApiBasePath()}/scheduled-tasks/register`; - return this.httpClient.post( - apiRoute, - {}, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - healthStatus(cached = false) { - if (!this.loginService.isLoggedIn()) { - return; - } - - let apiRoute = `${this.getApiBasePath()}/health/status`; - - if (cached) { - apiRoute = `${this.getApiBasePath()}/health-ping/status`; - } - - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - performanceStatus() { - const apiRoute = `${this.getApiBasePath()}/performance/status`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - getLogFiles() { - const apiRoute = `${this.getApiBasePath()}/logs/files`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } - - getLogFile(file, offset = 0, limit = 20) { - const apiRoute = `${this.getApiBasePath()}/logs/file`; - return this.httpClient.get( - apiRoute, - { - params: { - file, - offset, - limit - }, - headers: this.getBasicHeaders() - } - ).then((response) => { - return response; - }); - } - - getShopwareFiles() { - const apiRoute = `${this.getApiBasePath()}/shopware-files`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return response; - }); - } - - getFileContents(file) { - const apiRoute = `${this.getApiBasePath()}/file-contents`; - return this.httpClient.get( - apiRoute, - { - params: { - file, - }, - headers: this.getBasicHeaders() - } - ).then((response) => { - return response; - }); - } - - restoreShopwareFile(file) { - const apiRoute = `${this.getApiBasePath()}/shopware-file/restore`; - return this.httpClient.get( - apiRoute, - { - params: { - file, - }, - headers: this.getBasicHeaders() - } - ).then((response) => { - return response; - }); - } - - stateMachines(id) { - const apiRoute = `${this.getApiBasePath()}/state-machines/load/${id}`; - return this.httpClient.get( - apiRoute, - { - headers: this.getBasicHeaders() - } - ).then((response) => { - return ApiService.handleResponse(response); - }); - } + constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { + super(httpClient, loginService, apiEndpoint); + } + + getCacheInfo() { + const apiRoute = `${this.getApiBasePath()}/cache`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + clearCache(folder) { + const apiRoute = `${this.getApiBasePath()}/cache/${folder}`; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getQueue() { + const apiRoute = `${this.getApiBasePath()}/queue/list`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + resetQueue() { + const apiRoute = `${this.getApiBasePath()}/queue`; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + runScheduledTask(id) { + const apiRoute = `${this.getApiBasePath()}/scheduled-task/${id}`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + scheduleScheduledTask(id, immediately = false) { + const apiRoute = `${this.getApiBasePath()}/scheduled-task/schedule/${id}`; + return this.httpClient + .post( + apiRoute, + { + immediately: immediately, + }, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + scheduledTasksRegister() { + const apiRoute = `${this.getApiBasePath()}/scheduled-tasks/register`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + healthStatus(cached = false) { + if (!this.loginService.isLoggedIn()) { + return; + } + + let apiRoute = `${this.getApiBasePath()}/health/status`; + + if (cached) { + apiRoute = `${this.getApiBasePath()}/health-ping/status`; + } + + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + performanceStatus() { + const apiRoute = `${this.getApiBasePath()}/performance/status`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getLogFiles() { + const apiRoute = `${this.getApiBasePath()}/logs/files`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getLogFile(file, offset = 0, limit = 20) { + const apiRoute = `${this.getApiBasePath()}/logs/file`; + return this.httpClient + .get(apiRoute, { + params: { + file, + offset, + limit, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + getShopwareFiles() { + const apiRoute = `${this.getApiBasePath()}/shopware-files`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + getFileContents(file) { + const apiRoute = `${this.getApiBasePath()}/file-contents`; + return this.httpClient + .get(apiRoute, { + params: { + file, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + restoreShopwareFile(file) { + const apiRoute = `${this.getApiBasePath()}/shopware-file/restore`; + return this.httpClient + .get(apiRoute, { + params: { + file, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + stateMachines(id) { + const apiRoute = `${this.getApiBasePath()}/state-machines/load/${id}`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } } export default FroshTools; diff --git a/src/Resources/app/administration/src/api/index.js b/src/Resources/app/administration/src/api/index.js index b59e2812..50f2df42 100644 --- a/src/Resources/app/administration/src/api/index.js +++ b/src/Resources/app/administration/src/api/index.js @@ -1,16 +1,19 @@ -import FroshToolsService from "./frosh-tools"; -import Elasticsearch from "./elasticsearch"; +import FroshToolsService from './frosh-tools'; +import Elasticsearch from './elasticsearch'; const { Application } = Shopware; Application.addServiceProvider('froshToolsService', (container) => { - const initContainer = Application.getContainer('init'); + const initContainer = Application.getContainer('init'); - return new FroshToolsService(initContainer.httpClient, container.loginService); + return new FroshToolsService( + initContainer.httpClient, + container.loginService, + ); }); Application.addServiceProvider('froshElasticSearch', (container) => { - const initContainer = Application.getContainer('init'); + const initContainer = Application.getContainer('init'); - return new Elasticsearch(initContainer.httpClient, container.loginService); + return new Elasticsearch(initContainer.httpClient, container.loginService); }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js index db0cb7a2..ba494172 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js @@ -1,14 +1,11 @@ -Shopware.Service('privileges') - .addPrivilegeMappingEntry({ - category: 'additional_permissions', - parent: null, - key: 'frosh_tools', - roles: { - frosh_tools: { - privileges: [ - 'frosh_tools:read', - ], - dependencies: [], - }, - }, - }); +Shopware.Service('privileges').addPrivilegeMappingEntry({ + category: 'additional_permissions', + parent: null, + key: 'frosh_tools', + roles: { + frosh_tools: { + privileges: ['frosh_tools:read'], + dependencies: [], + }, + }, +}); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 222b9ce9..299e41de 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -5,104 +5,111 @@ const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; Component.register('frosh-tools-tab-cache', { - template, - - inject: ['froshToolsService', 'repositoryFactory', 'themeService'], - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - cacheInfo: null, - isLoading: true, - numberFormater: null - } - }, - - created() { - const language = Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); - this.numberFormater = new Intl.NumberFormat( - language, - { minimumFractionDigits: 2, maximumFractionDigits: 2 } - ); - - this.createdComponent(); - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true - }, - { - property: 'size', - label: 'frosh-tools.used', - rawData: true, - align: 'right' - }, - { - property: 'freeSpace', - label: 'frosh-tools.free', - rawData: true, - align: 'right' - } - ]; - }, - cacheFolders() { - if (this.cacheInfo === null) { - return []; - } - - return this.cacheInfo; - }, - - salesChannelRepository() { - return this.repositoryFactory.create('sales_channel'); - } - }, - - methods: { - async createdComponent() { - this.isLoading = true; - this.cacheInfo = await this.froshToolsService.getCacheInfo(); - this.isLoading = false; - }, - - formatSize(bytes) { - const formatted = bytes / (1024 * 1024); - - return this.numberFormater.format(formatted) + ' MiB'; - }, - - async clearCache(item) { - this.isLoading = true; - await this.froshToolsService.clearCache(item.name); - await this.createdComponent(); - }, - - async compileTheme() { - const criteria = new Criteria(); - criteria.addAssociation('themes'); - this.isLoading = true; - - let salesChannels = await this.salesChannelRepository.search(criteria, Shopware.Context.api); - - for (let salesChannel of salesChannels) { - const theme = salesChannel.extensions.themes.first(); - - if (theme) { - await this.themeService.assignTheme(theme.id, salesChannel.id); - this.createNotificationSuccess({ - message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}` - }) - } - } - - this.isLoading = false; - } - } + template, + + inject: ['froshToolsService', 'repositoryFactory', 'themeService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + cacheInfo: null, + isLoading: true, + numberFormater: null, + }; + }, + + created() { + const language = + Shopware.Application.getContainer( + 'factory', + ).locale.getLastKnownLocale(); + this.numberFormater = new Intl.NumberFormat(language, { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }); + + this.createdComponent(); + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + }, + { + property: 'size', + label: 'frosh-tools.used', + rawData: true, + align: 'right', + }, + { + property: 'freeSpace', + label: 'frosh-tools.free', + rawData: true, + align: 'right', + }, + ]; + }, + cacheFolders() { + if (this.cacheInfo === null) { + return []; + } + + return this.cacheInfo; + }, + + salesChannelRepository() { + return this.repositoryFactory.create('sales_channel'); + }, + }, + + methods: { + async createdComponent() { + this.isLoading = true; + this.cacheInfo = await this.froshToolsService.getCacheInfo(); + this.isLoading = false; + }, + + formatSize(bytes) { + const formatted = bytes / (1024 * 1024); + + return this.numberFormater.format(formatted) + ' MiB'; + }, + + async clearCache(item) { + this.isLoading = true; + await this.froshToolsService.clearCache(item.name); + await this.createdComponent(); + }, + + async compileTheme() { + const criteria = new Criteria(); + criteria.addAssociation('themes'); + this.isLoading = true; + + let salesChannels = await this.salesChannelRepository.search( + criteria, + Shopware.Context.api, + ); + + for (let salesChannel of salesChannels) { + const theme = salesChannel.extensions.themes.first(); + + if (theme) { + await this.themeService.assignTheme( + theme.id, + salesChannel.id, + ); + this.createNotificationSuccess({ + message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, + }); + } + } + + this.isLoading = false; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index e5ffe43e..38381a4b 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -3,163 +3,174 @@ import template from './template.twig'; const { Mixin, Component } = Shopware; Component.register('frosh-tools-tab-elasticsearch', { - template, - - inject: ['froshElasticSearch'], - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - isLoading: true, - isActive: true, - statusInfo: {}, - indices: [], - consoleInput: 'GET /_cat/indices', - consoleOutput: {}, - }; - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true - }, - { - property: 'indexSize', - label: 'frosh-tools.size', - rawData: true, - primary: true - }, - { - property: 'docs', - label: 'frosh-tools.docs', - rawData: true, - primary: true - } - ]; - } - }, - - created() { - this.createdComponent(); - }, - - methods: { - async createdComponent() { - this.isLoading = true; - - try { - this.statusInfo = await this.froshElasticSearch.status(); - } catch (err) { - this.isActive = false; - this.isLoading = false; - - return; - } finally { - this.isLoading = false; - } - - this.indices = await this.froshElasticSearch.indices(); - }, - - formatSize(bytes) { - const thresh = 1024; - const dp = 1; - let formatted = bytes - - if (Math.abs(bytes) < thresh) { - return bytes + ' B'; - } - - const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; - let index = -1; - const reach = 10**dp; - - do { - formatted /= thresh; - ++index; - } while (Math.round(Math.abs(formatted) * reach) / reach >= thresh && index < units.length - 1); - - return formatted.toFixed(dp) + ' ' + units[index]; - }, - - async deleteIndex(indexName) { - await this.froshElasticSearch.deleteIndex(indexName); - await this.createdComponent(); - }, - - async onConsoleEnter() { - const lines = this.consoleInput.split("\n") - const requestLine = lines.shift(); - const payload = lines.join("\n").trim(); - const [method, uri] = requestLine.split(" "); - - try { - this.consoleOutput = await this.froshElasticSearch.console(method, uri, payload); - } catch (e) { - this.consoleOutput = e.response.data - } - }, - - async reindex() { - await this.froshElasticSearch.reindex(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success') - } - ); - - await this.createdComponent() - }, - - async switchAlias() { - await this.froshElasticSearch.switchAlias(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success') - } - ); - - await this.createdComponent() - }, - - async flushAll() { - await this.froshElasticSearch.flushAll(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success') - } - ); - - await this.createdComponent() - }, - - async resetElasticsearch() { - await this.froshElasticSearch.reset(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success') - } - ); - - await this.createdComponent() - }, - - async cleanup() { - await this.froshElasticSearch.cleanup(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success') - } - ); - - await this.createdComponent() - } - } -}) + template, + + inject: ['froshElasticSearch'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + isLoading: true, + isActive: true, + statusInfo: {}, + indices: [], + consoleInput: 'GET /_cat/indices', + consoleOutput: {}, + }; + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'indexSize', + label: 'frosh-tools.size', + rawData: true, + primary: true, + }, + { + property: 'docs', + label: 'frosh-tools.docs', + rawData: true, + primary: true, + }, + ]; + }, + }, + + created() { + this.createdComponent(); + }, + + methods: { + async createdComponent() { + this.isLoading = true; + + try { + this.statusInfo = await this.froshElasticSearch.status(); + } catch (err) { + this.isActive = false; + this.isLoading = false; + + console.error(err); + + return; + } finally { + this.isLoading = false; + } + + this.indices = await this.froshElasticSearch.indices(); + }, + + formatSize(bytes) { + const thresh = 1024; + const dp = 1; + let formatted = bytes; + + if (Math.abs(bytes) < thresh) { + return bytes + ' B'; + } + + const units = [ + 'KiB', + 'MiB', + 'GiB', + 'TiB', + 'PiB', + 'EiB', + 'ZiB', + 'YiB', + ]; + let index = -1; + const reach = 10 ** dp; + + do { + formatted /= thresh; + ++index; + } while ( + Math.round(Math.abs(formatted) * reach) / reach >= thresh && + index < units.length - 1 + ); + + return formatted.toFixed(dp) + ' ' + units[index]; + }, + + async deleteIndex(indexName) { + await this.froshElasticSearch.deleteIndex(indexName); + await this.createdComponent(); + }, + + async onConsoleEnter() { + const lines = this.consoleInput.split('\n'); + const requestLine = lines.shift(); + const payload = lines.join('\n').trim(); + const [method, uri] = requestLine.split(' '); + + try { + this.consoleOutput = await this.froshElasticSearch.console( + method, + uri, + payload, + ); + } catch (e) { + this.consoleOutput = e.response.data; + } + }, + + async reindex() { + await this.froshElasticSearch.reindex(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async switchAlias() { + await this.froshElasticSearch.switchAlias(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async flushAll() { + await this.froshElasticSearch.flushAll(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async resetElasticsearch() { + await this.froshElasticSearch.reset(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async cleanup() { + await this.froshElasticSearch.cleanup(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + }, +}); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index c3260d5e..0842b1c7 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -1,111 +1,122 @@ import template from './template.twig'; -import DiffMatchPatch from "diff-match-patch"; +import DiffMatchPatch from 'diff-match-patch'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-files', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - items: {}, - isLoading: true, - diffData: { - html: '', - file: '' - }, - showModal: false, - }; - }, - - created() { - this.createdComponent(); - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true - }, - { - property: 'expected', - label: 'frosh-tools.status', - rawData: true, - primary: true - } - ]; - }, - - isLoadingClass() { - return { - 'is-loading': this.isLoading - } - }, - }, - - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - - async createdComponent() { - this.items = (await this.froshToolsService.getShopwareFiles()).data; - this.isLoading = false; - }, - - openUrl(url) { - window.open(url, '_blank'); - }, - - async diff(file) { - this.isLoading = true; - const fileContents = (await this.froshToolsService.getFileContents(file.name)).data; - - const dmp = new DiffMatchPatch(); - const diff = dmp.diff_main(fileContents.originalContent, fileContents.content); - dmp.diff_cleanupSemantic(diff); - this.diffData.html = dmp.diff_prettyHtml(diff) - .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') - .replace(new RegExp('background:#ffe6e6;', 'g'), 'background:rgba(255,129,130,0.4);'); - this.diffData.file = file; - - this.openModal(); - this.isLoading = false; - }, - - async restoreFile(name) { - this.closeModal(); - this.isLoading = true; - const response = await this.froshToolsService.restoreShopwareFile(name); - - if (response.data.status) { - this.createNotificationSuccess({ - message: response.data.status - }) - } else { - this.createNotificationError({ - message: response.data.error - }) - } - - await this.refresh(); - }, - - openModal() { - this.showModal = true; - }, - - closeModal() { - this.showModal = false; - }, - } + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + items: {}, + isLoading: true, + diffData: { + html: '', + file: '', + }, + showModal: false, + }; + }, + + created() { + this.createdComponent(); + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'expected', + label: 'frosh-tools.status', + rawData: true, + primary: true, + }, + ]; + }, + + isLoadingClass() { + return { + 'is-loading': this.isLoading, + }; + }, + }, + + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + + async createdComponent() { + this.items = (await this.froshToolsService.getShopwareFiles()).data; + this.isLoading = false; + }, + + openUrl(url) { + window.open(url, '_blank'); + }, + + async diff(file) { + this.isLoading = true; + const fileContents = ( + await this.froshToolsService.getFileContents(file.name) + ).data; + + const dmp = new DiffMatchPatch(); + const diff = dmp.diff_main( + fileContents.originalContent, + fileContents.content, + ); + dmp.diff_cleanupSemantic(diff); + this.diffData.html = dmp + .diff_prettyHtml(diff) + .replace( + new RegExp('background:#e6ffe6;', 'g'), + 'background:#ABF2BC;', + ) + .replace( + new RegExp('background:#ffe6e6;', 'g'), + 'background:rgba(255,129,130,0.4);', + ); + this.diffData.file = file; + + this.openModal(); + this.isLoading = false; + }, + + async restoreFile(name) { + this.closeModal(); + this.isLoading = true; + const response = + await this.froshToolsService.restoreShopwareFile(name); + + if (response.data.status) { + this.createNotificationSuccess({ + message: response.data.status, + }); + } else { + this.createNotificationError({ + message: response.data.error, + }); + } + + await this.refresh(); + }, + + openModal() { + this.showModal = true; + }, + + closeModal() { + this.showModal = false; + }, + }, }); 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 12555b97..ec3333e7 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 @@ -4,53 +4,54 @@ import './style.scss'; const { Component } = Shopware; Component.register('frosh-tools-tab-index', { - inject: ['froshToolsService'], - template, + inject: ['froshToolsService'], + template, - data() { - return { - isLoading: true, - health: null, - performanceStatus: null, - } - }, + data() { + return { + isLoading: true, + health: null, + performanceStatus: null, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true - }, - { - property: 'current', - label: 'frosh-tools.current', - rawData: true - }, - { - property: 'recommended', - label: 'frosh-tools.recommended', - rawData: true - } - ]; - }, - }, + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + }, + { + property: 'current', + label: 'frosh-tools.current', + rawData: true, + }, + { + property: 'recommended', + label: 'frosh-tools.recommended', + rawData: true, + }, + ]; + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, - async createdComponent() { - this.health = await this.froshToolsService.healthStatus(); - this.performanceStatus = await this.froshToolsService.performanceStatus(); - this.isLoading = false; - }, - } -}) + async createdComponent() { + this.health = await this.froshToolsService.healthStatus(); + this.performanceStatus = + await this.froshToolsService.performanceStatus(); + this.isLoading = false; + }, + }, +}); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index 293acf77..28afea3f 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -4,99 +4,100 @@ import './style.scss'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-logs', { - template, - inject: ['froshToolsService'], - mixins: [ - Mixin.getByName('notification') - ], + template, + inject: ['froshToolsService'], + mixins: [Mixin.getByName('notification')], - data() { - return { - logFiles: [], - selectedLogFile: null, - logEntries: [], - totalLogEntries: 0, - limit: 25, - page: 1, - isLoading: true, - displayedLog: null - }; - }, + data() { + return { + logFiles: [], + selectedLogFile: null, + logEntries: [], + totalLogEntries: 0, + limit: 25, + page: 1, + isLoading: true, + displayedLog: null, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'date', - label: 'frosh-tools.date', - rawData: true - }, - { - property: 'channel', - label: 'frosh-tools.channel', - rawData: true - }, - { - property: 'level', - label: 'frosh-tools.level', - rawData: true - }, - { - property: 'message', - label: 'frosh-tools.message', - rawData: true - } - ]; - }, + computed: { + columns() { + return [ + { + property: 'date', + label: 'frosh-tools.date', + rawData: true, + }, + { + property: 'channel', + label: 'frosh-tools.channel', + rawData: true, + }, + { + property: 'level', + label: 'frosh-tools.level', + rawData: true, + }, + { + property: 'message', + label: 'frosh-tools.message', + rawData: true, + }, + ]; + }, - date() { - return Shopware.Filter.getByName('date'); - }, - }, + date() { + return Shopware.Filter.getByName('date'); + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - await this.onFileSelected(); - }, + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + await this.onFileSelected(); + }, - async createdComponent() { - this.logFiles = await this.froshToolsService.getLogFiles(); - this.isLoading = false; - }, + async createdComponent() { + this.logFiles = await this.froshToolsService.getLogFiles(); + this.isLoading = false; + }, - async onFileSelected() { - if (!this.selectedLogFile) { - return; - } + async onFileSelected() { + if (!this.selectedLogFile) { + return; + } - const logEntries = await this.froshToolsService.getLogFile( - this.selectedLogFile, - (this.page - 1) * this.limit, - this.limit - ); + const logEntries = await this.froshToolsService.getLogFile( + this.selectedLogFile, + (this.page - 1) * this.limit, + this.limit, + ); - this.logEntries = logEntries.data; - this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); - }, + this.logEntries = logEntries.data; + this.totalLogEntries = parseInt( + logEntries.headers['file-size'], + 10, + ); + }, - async onPageChange(page) { - this.page = page.page; - this.limit = page.limit; - await this.onFileSelected(); - }, + async onPageChange(page) { + this.page = page.page; + this.limit = page.limit; + await this.onFileSelected(); + }, - showInfoModal(entryContents) { - this.displayedLog = entryContents; - }, + showInfoModal(entryContents) { + this.displayedLog = entryContents; + }, - closeInfoModal() { - this.displayedLog = null; - }, - } + closeInfoModal() { + this.displayedLog = null; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js index ceb23902..9d693bac 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js @@ -4,64 +4,62 @@ import './style.scss'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-queue', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [ - Mixin.getByName('notification') - ], + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], - data() { - return { - queueEntries: [], - showResetModal: false, - isLoading: true - }; - }, + data() { + return { + queueEntries: [], + showResetModal: false, + isLoading: true, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'name', - label: 'Name', - rawData: true - }, - { - property: 'size', - label: 'Size', - rawData: true - } - ]; - } - }, + computed: { + columns() { + return [ + { + property: 'name', + label: 'Name', + rawData: true, + }, + { + property: 'size', + label: 'Size', + rawData: true, + }, + ]; + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - async createdComponent() { - this.queueEntries = await this.froshToolsService.getQueue(); + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + async createdComponent() { + this.queueEntries = await this.froshToolsService.getQueue(); - for (const queue of this.queueEntries) { - const nameSplit = queue.name.split('\\') - queue.name = nameSplit[nameSplit.length - 1]; - } - this.isLoading = false; - }, - async resetQueue() { - this.isLoading = true; - await this.froshToolsService.resetQueue(); - this.showResetModal = false; - await this.createdComponent(); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.tabs.queue.reset.success') - }) - this.isLoading = false; - } - } + for (const queue of this.queueEntries) { + const nameSplit = queue.name.split('\\'); + queue.name = nameSplit[nameSplit.length - 1]; + } + this.isLoading = false; + }, + async resetQueue() { + this.isLoading = true; + await this.froshToolsService.resetQueue(); + this.showResetModal = false; + await this.createdComponent(); + this.createNotificationSuccess({ + message: this.$tc('frosh-tools.tabs.queue.reset.success'), + }); + this.isLoading = false; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index cd75891f..0278e51e 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -5,145 +5,172 @@ const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; Component.register('frosh-tools-tab-scheduled', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - items: null, - showResetModal: false, - isLoading: true, - page: 1, - limit: 25, - taskError: null - }; - }, - - created() { - this.createdComponent(); - }, - - computed: { - scheduledRepository() { - return this.repositoryFactory.create('scheduled_task'); - }, - - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true - }, - { - property: 'runInterval', - label: 'frosh-tools.interval', - rawData: true, - inlineEdit: 'number' - }, - { - property: 'lastExecutionTime', - label: 'frosh-tools.lastExecutionTime', - rawData: true - }, - { - property: 'nextExecutionTime', - label: 'frosh-tools.nextExecutionTime', - rawData: true, - inlineEdit: 'datetime' - }, - { - property: 'status', - label: 'frosh-tools.status', - rawData: true - } - ]; - }, - - date() { - return Shopware.Filter.getByName('date'); - }, - }, - - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - - async createdComponent() { - const criteria = new Criteria(this.page, this.limit); - criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); - this.items = await this.scheduledRepository.search(criteria, Shopware.Context.api); - this.isLoading = false; - }, - - async runTask(item) { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTaskStarted', 0, {'name': item.name}) - }) - await this.froshToolsService.runScheduledTask(item.id); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, {'name': item.name}) - }) - } catch (e) { - this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTaskFailed', 0, {'name': item.name}) - }) - - this.taskError = e.response.data; - } - - this.createdComponent(); - }, - - async scheduleTask(item, immediately = false) { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$t('frosh-tools.scheduledTaskScheduleStarted', {'name': item.name}) - }) - await this.froshToolsService.scheduleScheduledTask(item.id, immediately); - this.createNotificationSuccess({ - message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', {'name': item.name}) - }) - } catch (e) { - this.createNotificationError({ - message: this.$t('frosh-tools.scheduledTaskScheduleFailed', {'name': item.name}) - }) - - this.taskError = e.response.data; - } - - this.createdComponent(); - }, - - async registerScheduledTasks() { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTasksRegisterStarted') - }) - await this.froshToolsService.scheduledTasksRegister(); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed') - }) - } catch (e) { - this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTasksRegisterFailed') - }) - } - - this.createdComponent(); - }, - } + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + items: null, + showResetModal: false, + isLoading: true, + page: 1, + limit: 25, + taskError: null, + }; + }, + + created() { + this.createdComponent(); + }, + + computed: { + scheduledRepository() { + return this.repositoryFactory.create('scheduled_task'); + }, + + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'runInterval', + label: 'frosh-tools.interval', + rawData: true, + inlineEdit: 'number', + }, + { + property: 'lastExecutionTime', + label: 'frosh-tools.lastExecutionTime', + rawData: true, + }, + { + property: 'nextExecutionTime', + label: 'frosh-tools.nextExecutionTime', + rawData: true, + inlineEdit: 'datetime', + }, + { + property: 'status', + label: 'frosh-tools.status', + rawData: true, + }, + ]; + }, + + date() { + return Shopware.Filter.getByName('date'); + }, + }, + + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + + async createdComponent() { + const criteria = new Criteria(this.page, this.limit); + criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); + this.items = await this.scheduledRepository.search( + criteria, + Shopware.Context.api, + ); + this.isLoading = false; + }, + + async runTask(item) { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$tc('frosh-tools.scheduledTaskStarted', 0, { + name: item.name, + }), + }); + await this.froshToolsService.runScheduledTask(item.id); + this.createNotificationSuccess({ + message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, { + name: item.name, + }), + }); + } catch (e) { + this.createNotificationError({ + message: this.$tc('frosh-tools.scheduledTaskFailed', 0, { + name: item.name, + }), + }); + + this.taskError = e.response.data; + } + + this.createdComponent(); + }, + + async scheduleTask(item, immediately = false) { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$t( + 'frosh-tools.scheduledTaskScheduleStarted', + { name: item.name }, + ), + }); + await this.froshToolsService.scheduleScheduledTask( + item.id, + immediately, + ); + this.createNotificationSuccess({ + message: this.$t( + 'frosh-tools.scheduledTaskScheduleSucceed', + { name: item.name }, + ), + }); + } catch (e) { + this.createNotificationError({ + message: this.$t( + 'frosh-tools.scheduledTaskScheduleFailed', + { name: item.name }, + ), + }); + + this.taskError = e.response.data; + } + + this.createdComponent(); + }, + + async registerScheduledTasks() { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterStarted', + ), + }); + await this.froshToolsService.scheduledTasksRegister(); + this.createNotificationSuccess({ + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterSucceed', + ), + }); + } catch (err) { + console.error(err); + + this.createNotificationError({ + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterFailed', + ), + }); + } + + this.createdComponent(); + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index 9e66427c..90f83d0d 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -1,53 +1,52 @@ -/*global Shopware*/ - import './style.scss'; import template from './template.html.twig'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-state-machines', { - template, - - inject: ['froshToolsService'], - - mixins: [ - Mixin.getByName('notification') - ], - - data() { - return { - selectedStateMachine: null, - image: null, - isLoading: true, - } - }, - - created() { - this.createdComponent(); - }, - - methods: { - createdComponent() { - this.isLoading = false; - }, - - async onStateMachineChange(stateMachineChangeId) { - if (!stateMachineChangeId) { - return; - } - - const response = await this.froshToolsService.stateMachines(stateMachineChangeId); - - const elem = document.getElementById('state_machine'); - if ("svg" in response) { - this.image = response.svg; - elem.src = this.image; - elem.style.opacity = '1'; - elem.style.width = '100%'; - elem.style.height = 'auto'; - } else { - elem.style.opacity = '0'; - } - } - } + template, + + inject: ['froshToolsService'], + + mixins: [Mixin.getByName('notification')], + + data() { + return { + selectedStateMachine: null, + image: null, + isLoading: true, + }; + }, + + created() { + this.createdComponent(); + }, + + methods: { + createdComponent() { + this.isLoading = false; + }, + + async onStateMachineChange(stateMachineChangeId) { + if (!stateMachineChangeId) { + return; + } + + const response = + await this.froshToolsService.stateMachines( + stateMachineChangeId, + ); + + const elem = document.getElementById('state_machine'); + if ('svg' in response) { + this.image = response.svg; + elem.src = this.image; + elem.style.opacity = '1'; + elem.style.width = '100%'; + elem.style.height = 'auto'; + } else { + elem.style.opacity = '0'; + } + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/index.js b/src/Resources/app/administration/src/module/frosh-tools/index.js index 846f65bc..2529be5d 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/index.js @@ -7,98 +7,98 @@ import './component/frosh-tools-tab-logs'; import './component/frosh-tools-tab-state-machines'; import './component/frosh-tools-tab-files'; import './page/index'; -import './acl' +import './acl'; Shopware.Module.register('frosh-tools', { - type: 'plugin', - name: 'frosh-tools.title', - title: 'frosh-tools.title', - description: '', - color: '#303A4F', + type: 'plugin', + name: 'frosh-tools.title', + title: 'frosh-tools.title', + description: '', + color: '#303A4F', - icon: 'regular-cog', + icon: 'regular-cog', - routes: { - index: { - component: 'frosh-tools-index', - path: 'index', - children: { - index: { - component: 'frosh-tools-tab-index', - path: 'index', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - cache: { - component: 'frosh-tools-tab-cache', - path: 'cache', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - queue: { - component: 'frosh-tools-tab-queue', - path: 'queue', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - scheduled: { - component: 'frosh-tools-tab-scheduled', - path: 'scheduled', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - elasticsearch: { - component: 'frosh-tools-tab-elasticsearch', - path: 'elasticsearch', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - logs: { - component: 'frosh-tools-tab-logs', - path: 'logs', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - files: { - component: 'frosh-tools-tab-files', - path: 'files', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - statemachines: { - component: 'frosh-tools-tab-state-machines', - path: 'state-machines', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins' - } - }, - } - }, - }, + routes: { + index: { + component: 'frosh-tools-index', + path: 'index', + children: { + index: { + component: 'frosh-tools-tab-index', + path: 'index', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + cache: { + component: 'frosh-tools-tab-cache', + path: 'cache', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + queue: { + component: 'frosh-tools-tab-queue', + path: 'queue', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + scheduled: { + component: 'frosh-tools-tab-scheduled', + path: 'scheduled', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + elasticsearch: { + component: 'frosh-tools-tab-elasticsearch', + path: 'elasticsearch', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + logs: { + component: 'frosh-tools-tab-logs', + path: 'logs', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + files: { + component: 'frosh-tools-tab-files', + path: 'files', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + statemachines: { + component: 'frosh-tools-tab-state-machines', + path: 'state-machines', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + }, + }, + }, - settingsItem: [ - { - group: 'plugins', - to: 'frosh.tools.index.cache', - icon: 'regular-cog', - name: 'frosh-tools', - label: 'frosh-tools.title', - privilege: 'frosh_tools:read' - } - ] + settingsItem: [ + { + group: 'plugins', + to: 'frosh.tools.index.cache', + icon: 'regular-cog', + name: 'frosh-tools', + label: 'frosh-tools.title', + privilege: 'frosh_tools:read', + }, + ], }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js index 84d97027..6603765e 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js @@ -4,11 +4,14 @@ import template from './template.twig'; const { Component } = Shopware; Component.register('frosh-tools-index', { - template, + template, - computed: { - elasticsearchAvailable() { - return Shopware.State.get('context').app.config.settings?.elasticsearchEnabled || false; - } - } + computed: { + elasticsearchAvailable() { + return ( + Shopware.State.get('context').app.config.settings + ?.elasticsearchEnabled || false + ); + }, + }, }); 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 611b94ab..43900aad 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 @@ -1,112 +1,112 @@ { - "frosh-tools": { - "title": "Tools", - "tabs": { - "index": { - "title": "System-Status", - "performance": "Performance Empfehlungen" - }, - "systemInfo": { - "title": "System-Info" - }, - "cache": { - "title": "Cache" - }, - "scheduledTaskOverview": { - "title": "Geplante Aufgaben" - }, - "queue": { - "title": "Warteschlange", - "reset": { - "modal": { - "title": "Warteschlange zurücksetzen", - "description": "Durch das Zurücksetzen der Warteschlange werden alle ausgehenden Aufgaben entfernt.", - "reset": "Zurücksetzen" - }, - "success": "Die Warteschlange wurde geleert" - } - }, - "elasticsearch": { - "title": "Elasticsearch" - }, - "logs": { - "title": "Log viewer", - "logFileSelect": { - "placeholder": "Datei auswählen" - } - }, - "files": { - "title": "Shopware Dateien Checker", - "allFilesOk": "Alle Dateien entsprechen den Originalen, es wurden keine Manipulationen erkannt", - "notOk": "Es gibt Dateien, die manipuliert wurden", - "openOriginal": "Öffne Originaldatei auf GitHub", - "restore": { - "diff": "Vergleiche Datei mit Original", - "restoreFile": "Datei wiederherstellen" - }, - "expectedAll": "Datei wurde manipuliert", - "expectedProject": "Datei wurde manipuliert, Fehler wird ignoriert durch Projekt Konfiguration" - }, - "state-machines": { - "title": "State Machine Viewer", - "label": "State Machine", - "helpText": "Wähle eine State Machine. Das Bild wird mit Hilfe der plantuml.com API generiert. Dafür ist es notwendig, dass der Server auf plantuml.com zugreifen darf und nicht etwa von einer Firewall blockiert wird.", - "orderTitle": "Bestellstatus", - "transactionTitle": "Bezahlstatus", - "deliveryTitle": "Versandstatus" - } - }, - "clear": "Leeren", - "status": "Status", - "name": "Name", - "good": "Gut", - "warning": "Warnung", - "error": "Fehler", - "info": "Info", - "active": "Aktiv", - "used": "Belegt", - "free": "Frei", - "compileTheme": "Theme kompilieren", - "themeCompiled": "Theme wurde kompiliert", - "actions": "Aktionen", - "scheduledTasks": "Geplante Aufgaben", - "interval": "Intervall", - "lastExecutionTime": "letzte Ausführung", - "nextExecutionTime": "nächste Ausführung", - "runManually": "starte manuell", - "scheduledTaskStarted": "Die geplante Aufgabe für \"{name}\" wurde gestartet", - "scheduledTaskSucceed": "Die geplante Aufgabe für \"{name}\" war erfolgreich", - "scheduledTaskFailed": "Die geplante Aufgabe für \"{name}\" ist fehlgeschlagen", - "setToScheduled": "auf geplant setzen", - "setToScheduledImmediately": "auf sofort geplant setzen", - "scheduledTaskScheduleStarted": "Die geplante Aufgabe für \"{name}\" wird auf geplant gesetzt", - "scheduledTaskScheduleSucceed": "Die geplante Aufgabe für \"{name}\" wurde auf geplant gesetzt", - "scheduledTaskScheduleFailed": "Die geplante Aufgabe für \"{name}\" konnte nicht auf geplant gesetzt werden", - "scheduledTasksRegisterStarted": "Registriere geplante Aufgaben", - "scheduledTasksRegisterSucceed": "Geplante Aufgaben registriert", - "scheduledTasksRegisterFailed": "Es ist ein Fehler beim Registrieren aufgetreten", - "size": "Größe", - "docs": "Dokumente", - "delete": "Löschen", - "resetQueue": "Warteschlange zurücksetzen", - "date": "Zeitpunkt", - "channel": "Kanal", - "level": "Level", - "message": "Nachricht", - "current": "aktuell", - "recommended": "empfohlen", - "noRecommendations": "Keine Empfehlungen", - "chooseStateMachine": "Wähle eine State Machine...", - "order": "Bestellung", - "transaction": "Bezahlung", - "delivery": "Versand" - }, - "sw-privileges": { - "additional_permissions": { - "frosh_tools": { - "frosh_tools": "Überwachung anzeigen", - "label": "Frosh tools" - } - } - } + "frosh-tools": { + "title": "Tools", + "tabs": { + "index": { + "title": "System-Status", + "performance": "Performance Empfehlungen" + }, + "systemInfo": { + "title": "System-Info" + }, + "cache": { + "title": "Cache" + }, + "scheduledTaskOverview": { + "title": "Geplante Aufgaben" + }, + "queue": { + "title": "Warteschlange", + "reset": { + "modal": { + "title": "Warteschlange zurücksetzen", + "description": "Durch das Zurücksetzen der Warteschlange werden alle ausgehenden Aufgaben entfernt.", + "reset": "Zurücksetzen" + }, + "success": "Die Warteschlange wurde geleert" + } + }, + "elasticsearch": { + "title": "Elasticsearch" + }, + "logs": { + "title": "Log viewer", + "logFileSelect": { + "placeholder": "Datei auswählen" + } + }, + "files": { + "title": "Shopware Dateien Checker", + "allFilesOk": "Alle Dateien entsprechen den Originalen, es wurden keine Manipulationen erkannt", + "notOk": "Es gibt Dateien, die manipuliert wurden", + "openOriginal": "Öffne Originaldatei auf GitHub", + "restore": { + "diff": "Vergleiche Datei mit Original", + "restoreFile": "Datei wiederherstellen" + }, + "expectedAll": "Datei wurde manipuliert", + "expectedProject": "Datei wurde manipuliert, Fehler wird ignoriert durch Projekt Konfiguration" + }, + "state-machines": { + "title": "State Machine Viewer", + "label": "State Machine", + "helpText": "Wähle eine State Machine. Das Bild wird mit Hilfe der plantuml.com API generiert. Dafür ist es notwendig, dass der Server auf plantuml.com zugreifen darf und nicht etwa von einer Firewall blockiert wird.", + "orderTitle": "Bestellstatus", + "transactionTitle": "Bezahlstatus", + "deliveryTitle": "Versandstatus" + } + }, + "clear": "Leeren", + "status": "Status", + "name": "Name", + "good": "Gut", + "warning": "Warnung", + "error": "Fehler", + "info": "Info", + "active": "Aktiv", + "used": "Belegt", + "free": "Frei", + "compileTheme": "Theme kompilieren", + "themeCompiled": "Theme wurde kompiliert", + "actions": "Aktionen", + "scheduledTasks": "Geplante Aufgaben", + "interval": "Intervall", + "lastExecutionTime": "letzte Ausführung", + "nextExecutionTime": "nächste Ausführung", + "runManually": "starte manuell", + "scheduledTaskStarted": "Die geplante Aufgabe für \"{name}\" wurde gestartet", + "scheduledTaskSucceed": "Die geplante Aufgabe für \"{name}\" war erfolgreich", + "scheduledTaskFailed": "Die geplante Aufgabe für \"{name}\" ist fehlgeschlagen", + "setToScheduled": "auf geplant setzen", + "setToScheduledImmediately": "auf sofort geplant setzen", + "scheduledTaskScheduleStarted": "Die geplante Aufgabe für \"{name}\" wird auf geplant gesetzt", + "scheduledTaskScheduleSucceed": "Die geplante Aufgabe für \"{name}\" wurde auf geplant gesetzt", + "scheduledTaskScheduleFailed": "Die geplante Aufgabe für \"{name}\" konnte nicht auf geplant gesetzt werden", + "scheduledTasksRegisterStarted": "Registriere geplante Aufgaben", + "scheduledTasksRegisterSucceed": "Geplante Aufgaben registriert", + "scheduledTasksRegisterFailed": "Es ist ein Fehler beim Registrieren aufgetreten", + "size": "Größe", + "docs": "Dokumente", + "delete": "Löschen", + "resetQueue": "Warteschlange zurücksetzen", + "date": "Zeitpunkt", + "channel": "Kanal", + "level": "Level", + "message": "Nachricht", + "current": "aktuell", + "recommended": "empfohlen", + "noRecommendations": "Keine Empfehlungen", + "chooseStateMachine": "Wähle eine State Machine...", + "order": "Bestellung", + "transaction": "Bezahlung", + "delivery": "Versand" + }, + "sw-privileges": { + "additional_permissions": { + "frosh_tools": { + "frosh_tools": "Überwachung anzeigen", + "label": "Frosh tools" + } + } + } } 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 19ce8c5b..6a0ebacd 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 @@ -1,112 +1,112 @@ { - "frosh-tools": { - "title": "Tools", - "tabs": { - "index": { - "title": "System Status", - "performance": "Performance recommendations" - }, - "systemInfo": { - "title": "System Info" - }, - "cache": { - "title": "Cache" - }, - "scheduledTaskOverview": { - "title": "Scheduled Tasks Manager" - }, - "queue": { - "title": "Queue Manager", - "reset": { - "modal": { - "title": "Reset Queue", - "description": "Resetting Queue will remove all outgoing tasks.", - "reset": "Reset" - }, - "success": "The queue has been cleared" - } - }, - "elasticsearch": { - "title": "Elasticsearch Manager" - }, - "logs": { - "title": "Log viewer", - "logFileSelect": { - "placeholder": "Choose file" - } - }, - "files": { - "title": "Shopware file checker", - "allFilesOk": "No files modified", - "notOk": "There are modified files", - "openOriginal": "Open original file on GitHub", - "restore": { - "diff": "Diff file with original", - "restoreFile": "Restore file" - }, - "expectedAll": "File has been modified", - "expectedProject": "File has been modified, but will be ignored by project settings" - }, - "state-machines": { - "title": "State Machine Viewer", - "label": "State Machine", - "helpText": "Choose a state machine. The image is generated by the plantuml.com API. Therefore it's necessary that your server has access to plantuml.com and is exempt from Firewall rules.", - "orderTitle": "Order status", - "transactionTitle": "Transaction status", - "deliveryTitle": "Delivery status" - } - }, - "clear": "Clear", - "status": "Status", - "name": "Name", - "good": "Good", - "warning": "Warning", - "error": "Error", - "info": "Info", - "active": "Active", - "used": "Used", - "free": "Free", - "compileTheme": "Compile theme", - "themeCompiled": "Theme were compiled", - "actions": "Actions", - "scheduledTasks": "Scheduled Tasks", - "interval": "Interval", - "lastExecutionTime": "last execution", - "nextExecutionTime": "next execution", - "runManually": "start manually", - "scheduledTaskStarted": "The scheduled task execution for \"{name}\" started", - "scheduledTaskSucceed": "The scheduled task execution for \"{name}\" succeed", - "scheduledTaskFailed": "The scheduled task execution for \"{name}\" failed", - "setToScheduled": "Set task status to scheduled", - "setToScheduledImmediately": "Set task status to scheduled immediately", - "scheduledTaskScheduleStarted": "The scheduled task for \"{name}\" is being scheduled", - "scheduledTaskScheduleSucceed": "The scheduled task for \"{name}\" has been scheduled", - "scheduledTaskScheduleFailed": "The scheduled task for \"{name}\" could not be scheduled", - "scheduledTasksRegisterStarted": "Register scheduled tasks", - "scheduledTasksRegisterSucceed": "Scheduled tasks registered", - "scheduledTasksRegisterFailed": "Scheduled tasks registration failed", - "size": "Size", - "docs": "Documents", - "delete": "Delete", - "resetQueue": "Reset Queue", - "date": "Date", - "channel": "Channel", - "level": "Level", - "message": "Message", - "current": "current", - "recommended": "recommended", - "noRecommendations": "No recommendations", - "chooseStateMachine": "Choose a State Machine...", - "order": "Order", - "transaction": "Payment", - "delivery": "Delivery" - }, - "sw-privileges": { - "additional_permissions": { - "frosh_tools": { - "frosh_tools": "View monitoring", - "label": "Frosh tools" - } - } - } + "frosh-tools": { + "title": "Tools", + "tabs": { + "index": { + "title": "System Status", + "performance": "Performance recommendations" + }, + "systemInfo": { + "title": "System Info" + }, + "cache": { + "title": "Cache" + }, + "scheduledTaskOverview": { + "title": "Scheduled Tasks Manager" + }, + "queue": { + "title": "Queue Manager", + "reset": { + "modal": { + "title": "Reset Queue", + "description": "Resetting Queue will remove all outgoing tasks.", + "reset": "Reset" + }, + "success": "The queue has been cleared" + } + }, + "elasticsearch": { + "title": "Elasticsearch Manager" + }, + "logs": { + "title": "Log viewer", + "logFileSelect": { + "placeholder": "Choose file" + } + }, + "files": { + "title": "Shopware file checker", + "allFilesOk": "No files modified", + "notOk": "There are modified files", + "openOriginal": "Open original file on GitHub", + "restore": { + "diff": "Diff file with original", + "restoreFile": "Restore file" + }, + "expectedAll": "File has been modified", + "expectedProject": "File has been modified, but will be ignored by project settings" + }, + "state-machines": { + "title": "State Machine Viewer", + "label": "State Machine", + "helpText": "Choose a state machine. The image is generated by the plantuml.com API. Therefore it's necessary that your server has access to plantuml.com and is exempt from Firewall rules.", + "orderTitle": "Order status", + "transactionTitle": "Transaction status", + "deliveryTitle": "Delivery status" + } + }, + "clear": "Clear", + "status": "Status", + "name": "Name", + "good": "Good", + "warning": "Warning", + "error": "Error", + "info": "Info", + "active": "Active", + "used": "Used", + "free": "Free", + "compileTheme": "Compile theme", + "themeCompiled": "Theme were compiled", + "actions": "Actions", + "scheduledTasks": "Scheduled Tasks", + "interval": "Interval", + "lastExecutionTime": "last execution", + "nextExecutionTime": "next execution", + "runManually": "start manually", + "scheduledTaskStarted": "The scheduled task execution for \"{name}\" started", + "scheduledTaskSucceed": "The scheduled task execution for \"{name}\" succeed", + "scheduledTaskFailed": "The scheduled task execution for \"{name}\" failed", + "setToScheduled": "Set task status to scheduled", + "setToScheduledImmediately": "Set task status to scheduled immediately", + "scheduledTaskScheduleStarted": "The scheduled task for \"{name}\" is being scheduled", + "scheduledTaskScheduleSucceed": "The scheduled task for \"{name}\" has been scheduled", + "scheduledTaskScheduleFailed": "The scheduled task for \"{name}\" could not be scheduled", + "scheduledTasksRegisterStarted": "Register scheduled tasks", + "scheduledTasksRegisterSucceed": "Scheduled tasks registered", + "scheduledTasksRegisterFailed": "Scheduled tasks registration failed", + "size": "Size", + "docs": "Documents", + "delete": "Delete", + "resetQueue": "Reset Queue", + "date": "Date", + "channel": "Channel", + "level": "Level", + "message": "Message", + "current": "current", + "recommended": "recommended", + "noRecommendations": "No recommendations", + "chooseStateMachine": "Choose a State Machine...", + "order": "Order", + "transaction": "Payment", + "delivery": "Delivery" + }, + "sw-privileges": { + "additional_permissions": { + "frosh_tools": { + "frosh_tools": "View monitoring", + "label": "Frosh tools" + } + } + } } diff --git a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js index e79343f4..88c53045 100644 --- a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js +++ b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js @@ -3,5 +3,5 @@ import template from './template.twig'; const { Component } = Shopware; Component.override('sw-data-grid-inline-edit', { - template + template, }); diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index a3d4ee21..f364064d 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -3,82 +3,88 @@ import template from './template.twig'; const { Component } = Shopware; Component.override('sw-version', { - template, - inject: ['froshToolsService', 'acl', 'loginService'], - - async created() { - if(!this.checkPermission()) { - return; - } - - await this.checkHealth(); - }, - - data() { - return { - health: null, - hasPermission: false - } - }, - - computed: { - healthVariant() { - let variant = 'success'; - - for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - variant = 'error'; - continue; - } - - if (health.state === 'STATE_WARNING' && variant === 'success') { - variant = 'warning'; - } - } - - return variant; - }, - - healthPlaceholder() { - let msg = 'Shop Status: Ok'; - - if (this.health === null) { - return msg; - } - - for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - msg = 'Shop Status: May outage, Check System Status'; - continue; - } - - if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { - msg = 'Shop Status: Issues, Check System Status'; - } - } - - return msg; - } - }, - - methods: { - async checkHealth() { - this.health = await this.froshToolsService.healthStatus(true); - - this.checkInterval = setInterval(async() => { - try { - this.health = await this.froshToolsService.healthStatus(true); - } catch (e) { - console.error(e); - clearInterval(this.checkInterval); - } - }, 60000); - - this.loginService.addOnLogoutListener(() => clearInterval(this.checkInterval)); - }, - - checkPermission() { - return this.hasPermission = this.acl.can('frosh_tools:read'); - } - } -}) + template, + inject: ['froshToolsService', 'acl', 'loginService'], + + async created() { + if (!this.checkPermission()) { + return; + } + + await this.checkHealth(); + }, + + data() { + return { + health: null, + hasPermission: false, + }; + }, + + computed: { + healthVariant() { + let variant = 'success'; + + for (let health of this.health) { + if (health.state === 'STATE_ERROR') { + variant = 'error'; + continue; + } + + if (health.state === 'STATE_WARNING' && variant === 'success') { + variant = 'warning'; + } + } + + return variant; + }, + + healthPlaceholder() { + let msg = 'Shop Status: Ok'; + + if (this.health === null) { + return msg; + } + + for (let health of this.health) { + if (health.state === 'STATE_ERROR') { + msg = 'Shop Status: May outage, Check System Status'; + continue; + } + + if ( + health.state === 'STATE_WARNING' && + msg === 'Shop Status: Ok' + ) { + msg = 'Shop Status: Issues, Check System Status'; + } + } + + return msg; + }, + }, + + methods: { + async checkHealth() { + this.health = await this.froshToolsService.healthStatus(true); + + this.checkInterval = setInterval(async () => { + try { + this.health = + await this.froshToolsService.healthStatus(true); + } catch (e) { + console.error(e); + clearInterval(this.checkInterval); + } + }, 60000); + + this.loginService.addOnLogoutListener(() => + clearInterval(this.checkInterval), + ); + }, + + checkPermission() { + return (this.hasPermission = this.acl.can('frosh_tools:read')); + }, + }, +}); From fc4f0338149ff77b62d73bf31f269ba038d7eb3e Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 10:14:50 +0100 Subject: [PATCH 04/11] chore: fix config --- .github/workflows/code-style.yml | 6 +++- phpstan.neon.dist | 4 --- qodana.yaml | 12 ------- .../component/frosh-tools-tab-cache/index.js | 9 ++--- .../frosh-tools-tab-elasticsearch/index.js | 11 +------ .../component/frosh-tools-tab-files/index.js | 8 ++--- .../component/frosh-tools-tab-index/index.js | 3 +- .../component/frosh-tools-tab-logs/index.js | 5 +-- .../frosh-tools-tab-scheduled/index.js | 33 +++++++------------ .../frosh-tools-tab-state-machines/index.js | 4 +-- .../src/overrides/sw-version/index.js | 8 ++--- 11 files changed, 27 insertions(+), 76 deletions(-) delete mode 100644 qodana.yaml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 4fdc47cb..05e6b8c3 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -18,9 +18,13 @@ jobs: check: runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + version-selection: [ 'lowest', 'highest'] steps: - name: Checkout uses: actions/checkout@v4 - name: Run CS - run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext + run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }} diff --git a/phpstan.neon.dist b/phpstan.neon.dist index aafcb7b4..1ff472c7 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,7 +2,3 @@ parameters: level: 8 paths: - src - type_coverage: - return_type: 100 - param_type: 98 - property_type: 100 diff --git a/qodana.yaml b/qodana.yaml deleted file mode 100644 index ddff5ae7..00000000 --- a/qodana.yaml +++ /dev/null @@ -1,12 +0,0 @@ -version: "1.0" -linter: ghcr.io/shyim/qodana-php:8.2 -bootstrap: composer req shopware/elasticsearch:* -php: - version: "8.2" -include: - - name: VulnerableLibrariesGlobal -plugins: - - id: de.espend.idea.php.annotation - - id: fr.adrienbrault.idea.symfony2plugin - - id: com.kalessil.phpStorm.phpInspectionsEA - diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 299e41de..25614c85 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -20,9 +20,7 @@ Component.register('frosh-tools-tab-cache', { created() { const language = - Shopware.Application.getContainer( - 'factory', - ).locale.getLastKnownLocale(); + Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); this.numberFormater = new Intl.NumberFormat(language, { minimumFractionDigits: 2, maximumFractionDigits: 2, @@ -99,10 +97,7 @@ Component.register('frosh-tools-tab-cache', { const theme = salesChannel.extensions.themes.first(); if (theme) { - await this.themeService.assignTheme( - theme.id, - salesChannel.id, - ); + await this.themeService.assignTheme(theme.id, salesChannel.id); this.createNotificationSuccess({ message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index 38381a4b..e506e759 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -77,16 +77,7 @@ Component.register('frosh-tools-tab-elasticsearch', { return bytes + ' B'; } - const units = [ - 'KiB', - 'MiB', - 'GiB', - 'TiB', - 'PiB', - 'EiB', - 'ZiB', - 'YiB', - ]; + const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; let index = -1; const reach = 10 ** dp; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index 0842b1c7..dfbe18d7 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -78,10 +78,7 @@ Component.register('frosh-tools-tab-files', { dmp.diff_cleanupSemantic(diff); this.diffData.html = dmp .diff_prettyHtml(diff) - .replace( - new RegExp('background:#e6ffe6;', 'g'), - 'background:#ABF2BC;', - ) + .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') .replace( new RegExp('background:#ffe6e6;', 'g'), 'background:rgba(255,129,130,0.4);', @@ -95,8 +92,7 @@ Component.register('frosh-tools-tab-files', { async restoreFile(name) { this.closeModal(); this.isLoading = true; - const response = - await this.froshToolsService.restoreShopwareFile(name); + const response = await this.froshToolsService.restoreShopwareFile(name); if (response.data.status) { this.createNotificationSuccess({ 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 ec3333e7..cc6b5c4f 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 @@ -49,8 +49,7 @@ Component.register('frosh-tools-tab-index', { async createdComponent() { this.health = await this.froshToolsService.healthStatus(); - this.performanceStatus = - await this.froshToolsService.performanceStatus(); + this.performanceStatus = await this.froshToolsService.performanceStatus(); this.isLoading = false; }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index 28afea3f..2a4e7dcb 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -80,10 +80,7 @@ Component.register('frosh-tools-tab-logs', { ); this.logEntries = logEntries.data; - this.totalLogEntries = parseInt( - logEntries.headers['file-size'], - 10, - ); + this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); }, async onPageChange(page) { diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index 0278e51e..7c9cf8af 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -116,27 +116,24 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleStarted', - { name: item.name }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleStarted', { + name: item.name, + }), }); await this.froshToolsService.scheduleScheduledTask( item.id, immediately, ); this.createNotificationSuccess({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleSucceed', - { name: item.name }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', { + name: item.name, + }), }); } catch (e) { this.createNotificationError({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleFailed', - { name: item.name }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleFailed', { + name: item.name, + }), }); this.taskError = e.response.data; @@ -150,23 +147,17 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterStarted', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterStarted'), }); await this.froshToolsService.scheduledTasksRegister(); this.createNotificationSuccess({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterSucceed', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed'), }); } catch (err) { console.error(err); this.createNotificationError({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterFailed', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterFailed'), }); } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index 90f83d0d..23a5f2e3 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -33,9 +33,7 @@ Component.register('frosh-tools-tab-state-machines', { } const response = - await this.froshToolsService.stateMachines( - stateMachineChangeId, - ); + await this.froshToolsService.stateMachines(stateMachineChangeId); const elem = document.getElementById('state_machine'); if ('svg' in response) { diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index f364064d..a6fb69a4 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -52,10 +52,7 @@ Component.override('sw-version', { continue; } - if ( - health.state === 'STATE_WARNING' && - msg === 'Shop Status: Ok' - ) { + if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { msg = 'Shop Status: Issues, Check System Status'; } } @@ -70,8 +67,7 @@ Component.override('sw-version', { this.checkInterval = setInterval(async () => { try { - this.health = - await this.froshToolsService.healthStatus(true); + this.health = await this.froshToolsService.healthStatus(true); } catch (e) { console.error(e); clearInterval(this.checkInterval); From 199b03c13303e17119e7ed037be1703578015e0d Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 10:26:16 +0100 Subject: [PATCH 05/11] ci: add pull to own step --- .github/workflows/code-style.yml | 8 +- .../administration/src/api/elasticsearch.js | 4 +- .../app/administration/src/api/frosh-tools.js | 2 +- .../app/administration/src/api/index.js | 12 +- src/Resources/app/administration/src/main.js | 8 +- .../src/module/frosh-tools/acl/index.js | 8 +- .../component/frosh-tools-tab-cache/index.js | 36 +++--- .../frosh-tools-tab-elasticsearch/index.js | 44 +++---- .../component/frosh-tools-tab-files/index.js | 32 ++--- .../component/frosh-tools-tab-index/index.js | 20 +-- .../component/frosh-tools-tab-logs/index.js | 30 ++--- .../component/frosh-tools-tab-queue/index.js | 22 ++-- .../frosh-tools-tab-scheduled/index.js | 58 ++++----- .../frosh-tools-tab-state-machines/index.js | 22 ++-- .../src/module/frosh-tools/index.js | 114 +++++++++--------- .../module/frosh-tools/page/index/index.js | 8 +- .../sw-data-grid-inline-edit/index.js | 4 +- .../src/overrides/sw-version/index.js | 28 ++--- 18 files changed, 233 insertions(+), 227 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 05e6b8c3..e9d91464 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -13,6 +13,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Pull verifier + run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest + - name: Run CS run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run @@ -26,5 +29,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Run CS + - name: Pull verifier + run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest + + - name: Run Check run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }} diff --git a/src/Resources/app/administration/src/api/elasticsearch.js b/src/Resources/app/administration/src/api/elasticsearch.js index 4b258788..5303618b 100644 --- a/src/Resources/app/administration/src/api/elasticsearch.js +++ b/src/Resources/app/administration/src/api/elasticsearch.js @@ -4,7 +4,7 @@ class Elasticsearch extends ApiService { constructor( httpClient, loginService, - apiEndpoint = '_action/frosh-tools/elasticsearch', + apiEndpoint = "_action/frosh-tools/elasticsearch", ) { super(httpClient, loginService, apiEndpoint); } @@ -50,7 +50,7 @@ class Elasticsearch extends ApiService { method: method, headers: { ...this.getBasicHeaders(), - 'content-type': 'application/json', + "content-type": "application/json", }, data: payload, }) diff --git a/src/Resources/app/administration/src/api/frosh-tools.js b/src/Resources/app/administration/src/api/frosh-tools.js index 318920ab..3ded83ad 100644 --- a/src/Resources/app/administration/src/api/frosh-tools.js +++ b/src/Resources/app/administration/src/api/frosh-tools.js @@ -1,7 +1,7 @@ const { ApiService } = Shopware.Classes; class FroshTools extends ApiService { - constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { + constructor(httpClient, loginService, apiEndpoint = "_action/frosh-tools") { super(httpClient, loginService, apiEndpoint); } diff --git a/src/Resources/app/administration/src/api/index.js b/src/Resources/app/administration/src/api/index.js index 50f2df42..2c518b54 100644 --- a/src/Resources/app/administration/src/api/index.js +++ b/src/Resources/app/administration/src/api/index.js @@ -1,10 +1,10 @@ -import FroshToolsService from './frosh-tools'; -import Elasticsearch from './elasticsearch'; +import FroshToolsService from "./frosh-tools"; +import Elasticsearch from "./elasticsearch"; const { Application } = Shopware; -Application.addServiceProvider('froshToolsService', (container) => { - const initContainer = Application.getContainer('init'); +Application.addServiceProvider("froshToolsService", (container) => { + const initContainer = Application.getContainer("init"); return new FroshToolsService( initContainer.httpClient, @@ -12,8 +12,8 @@ Application.addServiceProvider('froshToolsService', (container) => { ); }); -Application.addServiceProvider('froshElasticSearch', (container) => { - const initContainer = Application.getContainer('init'); +Application.addServiceProvider("froshElasticSearch", (container) => { + const initContainer = Application.getContainer("init"); return new Elasticsearch(initContainer.httpClient, container.loginService); }); diff --git a/src/Resources/app/administration/src/main.js b/src/Resources/app/administration/src/main.js index c3c3b364..861bf238 100644 --- a/src/Resources/app/administration/src/main.js +++ b/src/Resources/app/administration/src/main.js @@ -1,4 +1,4 @@ -import './api'; -import './overrides/sw-data-grid-inline-edit'; -import './overrides/sw-version'; -import './module/frosh-tools'; +import "./api"; +import "./overrides/sw-data-grid-inline-edit"; +import "./overrides/sw-version"; +import "./module/frosh-tools"; diff --git a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js index ba494172..c4314869 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js @@ -1,10 +1,10 @@ -Shopware.Service('privileges').addPrivilegeMappingEntry({ - category: 'additional_permissions', +Shopware.Service("privileges").addPrivilegeMappingEntry({ + category: "additional_permissions", parent: null, - key: 'frosh_tools', + key: "frosh_tools", roles: { frosh_tools: { - privileges: ['frosh_tools:read'], + privileges: ["frosh_tools:read"], dependencies: [], }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 25614c85..12d67a82 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -1,14 +1,14 @@ -import template from './template.twig'; -import './style.scss'; +import template from "./template.twig"; +import "./style.scss"; const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; -Component.register('frosh-tools-tab-cache', { +Component.register("frosh-tools-tab-cache", { template, - inject: ['froshToolsService', 'repositoryFactory', 'themeService'], - mixins: [Mixin.getByName('notification')], + inject: ["froshToolsService", "repositoryFactory", "themeService"], + mixins: [Mixin.getByName("notification")], data() { return { @@ -20,7 +20,7 @@ Component.register('frosh-tools-tab-cache', { created() { const language = - Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); + Shopware.Application.getContainer("factory").locale.getLastKnownLocale(); this.numberFormater = new Intl.NumberFormat(language, { minimumFractionDigits: 2, maximumFractionDigits: 2, @@ -33,21 +33,21 @@ Component.register('frosh-tools-tab-cache', { columns() { return [ { - property: 'name', - label: 'frosh-tools.name', + property: "name", + label: "frosh-tools.name", rawData: true, }, { - property: 'size', - label: 'frosh-tools.used', + property: "size", + label: "frosh-tools.used", rawData: true, - align: 'right', + align: "right", }, { - property: 'freeSpace', - label: 'frosh-tools.free', + property: "freeSpace", + label: "frosh-tools.free", rawData: true, - align: 'right', + align: "right", }, ]; }, @@ -60,7 +60,7 @@ Component.register('frosh-tools-tab-cache', { }, salesChannelRepository() { - return this.repositoryFactory.create('sales_channel'); + return this.repositoryFactory.create("sales_channel"); }, }, @@ -74,7 +74,7 @@ Component.register('frosh-tools-tab-cache', { formatSize(bytes) { const formatted = bytes / (1024 * 1024); - return this.numberFormater.format(formatted) + ' MiB'; + return this.numberFormater.format(formatted) + " MiB"; }, async clearCache(item) { @@ -85,7 +85,7 @@ Component.register('frosh-tools-tab-cache', { async compileTheme() { const criteria = new Criteria(); - criteria.addAssociation('themes'); + criteria.addAssociation("themes"); this.isLoading = true; let salesChannels = await this.salesChannelRepository.search( @@ -99,7 +99,7 @@ Component.register('frosh-tools-tab-cache', { if (theme) { await this.themeService.assignTheme(theme.id, salesChannel.id); this.createNotificationSuccess({ - message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, + message: `${salesChannel.translated.name}: ${this.$tc("frosh-tools.themeCompiled")}`, }); } } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index e506e759..55c17f26 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -1,12 +1,12 @@ -import template from './template.twig'; +import template from "./template.twig"; const { Mixin, Component } = Shopware; -Component.register('frosh-tools-tab-elasticsearch', { +Component.register("frosh-tools-tab-elasticsearch", { template, - inject: ['froshElasticSearch'], - mixins: [Mixin.getByName('notification')], + inject: ["froshElasticSearch"], + mixins: [Mixin.getByName("notification")], data() { return { @@ -14,7 +14,7 @@ Component.register('frosh-tools-tab-elasticsearch', { isActive: true, statusInfo: {}, indices: [], - consoleInput: 'GET /_cat/indices', + consoleInput: "GET /_cat/indices", consoleOutput: {}, }; }, @@ -23,20 +23,20 @@ Component.register('frosh-tools-tab-elasticsearch', { columns() { return [ { - property: 'name', - label: 'frosh-tools.name', + property: "name", + label: "frosh-tools.name", rawData: true, primary: true, }, { - property: 'indexSize', - label: 'frosh-tools.size', + property: "indexSize", + label: "frosh-tools.size", rawData: true, primary: true, }, { - property: 'docs', - label: 'frosh-tools.docs', + property: "docs", + label: "frosh-tools.docs", rawData: true, primary: true, }, @@ -74,10 +74,10 @@ Component.register('frosh-tools-tab-elasticsearch', { let formatted = bytes; if (Math.abs(bytes) < thresh) { - return bytes + ' B'; + return bytes + " B"; } - const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; + const units = ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; let index = -1; const reach = 10 ** dp; @@ -89,7 +89,7 @@ Component.register('frosh-tools-tab-elasticsearch', { index < units.length - 1 ); - return formatted.toFixed(dp) + ' ' + units[index]; + return formatted.toFixed(dp) + " " + units[index]; }, async deleteIndex(indexName) { @@ -98,10 +98,10 @@ Component.register('frosh-tools-tab-elasticsearch', { }, async onConsoleEnter() { - const lines = this.consoleInput.split('\n'); + const lines = this.consoleInput.split("\n"); const requestLine = lines.shift(); - const payload = lines.join('\n').trim(); - const [method, uri] = requestLine.split(' '); + const payload = lines.join("\n").trim(); + const [method, uri] = requestLine.split(" "); try { this.consoleOutput = await this.froshElasticSearch.console( @@ -118,7 +118,7 @@ Component.register('frosh-tools-tab-elasticsearch', { await this.froshElasticSearch.reindex(); this.createNotificationSuccess({ - message: this.$tc('global.default.success'), + message: this.$tc("global.default.success"), }); await this.createdComponent(); @@ -128,7 +128,7 @@ Component.register('frosh-tools-tab-elasticsearch', { await this.froshElasticSearch.switchAlias(); this.createNotificationSuccess({ - message: this.$tc('global.default.success'), + message: this.$tc("global.default.success"), }); await this.createdComponent(); @@ -138,7 +138,7 @@ Component.register('frosh-tools-tab-elasticsearch', { await this.froshElasticSearch.flushAll(); this.createNotificationSuccess({ - message: this.$tc('global.default.success'), + message: this.$tc("global.default.success"), }); await this.createdComponent(); @@ -148,7 +148,7 @@ Component.register('frosh-tools-tab-elasticsearch', { await this.froshElasticSearch.reset(); this.createNotificationSuccess({ - message: this.$tc('global.default.success'), + message: this.$tc("global.default.success"), }); await this.createdComponent(); @@ -158,7 +158,7 @@ Component.register('frosh-tools-tab-elasticsearch', { await this.froshElasticSearch.cleanup(); this.createNotificationSuccess({ - message: this.$tc('global.default.success'), + message: this.$tc("global.default.success"), }); await this.createdComponent(); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index dfbe18d7..b05b5010 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -1,20 +1,20 @@ -import template from './template.twig'; -import DiffMatchPatch from 'diff-match-patch'; +import template from "./template.twig"; +import DiffMatchPatch from "diff-match-patch"; const { Component, Mixin } = Shopware; -Component.register('frosh-tools-tab-files', { +Component.register("frosh-tools-tab-files", { template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], + inject: ["repositoryFactory", "froshToolsService"], + mixins: [Mixin.getByName("notification")], data() { return { items: {}, isLoading: true, diffData: { - html: '', - file: '', + html: "", + file: "", }, showModal: false, }; @@ -28,14 +28,14 @@ Component.register('frosh-tools-tab-files', { columns() { return [ { - property: 'name', - label: 'frosh-tools.name', + property: "name", + label: "frosh-tools.name", rawData: true, primary: true, }, { - property: 'expected', - label: 'frosh-tools.status', + property: "expected", + label: "frosh-tools.status", rawData: true, primary: true, }, @@ -44,7 +44,7 @@ Component.register('frosh-tools-tab-files', { isLoadingClass() { return { - 'is-loading': this.isLoading, + "is-loading": this.isLoading, }; }, }, @@ -61,7 +61,7 @@ Component.register('frosh-tools-tab-files', { }, openUrl(url) { - window.open(url, '_blank'); + window.open(url, "_blank"); }, async diff(file) { @@ -78,10 +78,10 @@ Component.register('frosh-tools-tab-files', { dmp.diff_cleanupSemantic(diff); this.diffData.html = dmp .diff_prettyHtml(diff) - .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') + .replace(new RegExp("background:#e6ffe6;", "g"), "background:#ABF2BC;") .replace( - new RegExp('background:#ffe6e6;', 'g'), - 'background:rgba(255,129,130,0.4);', + new RegExp("background:#ffe6e6;", "g"), + "background:rgba(255,129,130,0.4);", ); this.diffData.file = file; 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 cc6b5c4f..5c8c49bb 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 @@ -1,10 +1,10 @@ -import template from './template.twig'; -import './style.scss'; +import template from "./template.twig"; +import "./style.scss"; const { Component } = Shopware; -Component.register('frosh-tools-tab-index', { - inject: ['froshToolsService'], +Component.register("frosh-tools-tab-index", { + inject: ["froshToolsService"], template, data() { @@ -23,18 +23,18 @@ Component.register('frosh-tools-tab-index', { columns() { return [ { - property: 'name', - label: 'frosh-tools.name', + property: "name", + label: "frosh-tools.name", rawData: true, }, { - property: 'current', - label: 'frosh-tools.current', + property: "current", + label: "frosh-tools.current", rawData: true, }, { - property: 'recommended', - label: 'frosh-tools.recommended', + property: "recommended", + label: "frosh-tools.recommended", rawData: true, }, ]; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index 2a4e7dcb..db71a399 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -1,12 +1,12 @@ -import template from './template.twig'; -import './style.scss'; +import template from "./template.twig"; +import "./style.scss"; const { Component, Mixin } = Shopware; -Component.register('frosh-tools-tab-logs', { +Component.register("frosh-tools-tab-logs", { template, - inject: ['froshToolsService'], - mixins: [Mixin.getByName('notification')], + inject: ["froshToolsService"], + mixins: [Mixin.getByName("notification")], data() { return { @@ -29,30 +29,30 @@ Component.register('frosh-tools-tab-logs', { columns() { return [ { - property: 'date', - label: 'frosh-tools.date', + property: "date", + label: "frosh-tools.date", rawData: true, }, { - property: 'channel', - label: 'frosh-tools.channel', + property: "channel", + label: "frosh-tools.channel", rawData: true, }, { - property: 'level', - label: 'frosh-tools.level', + property: "level", + label: "frosh-tools.level", rawData: true, }, { - property: 'message', - label: 'frosh-tools.message', + property: "message", + label: "frosh-tools.message", rawData: true, }, ]; }, date() { - return Shopware.Filter.getByName('date'); + return Shopware.Filter.getByName("date"); }, }, @@ -80,7 +80,7 @@ Component.register('frosh-tools-tab-logs', { ); this.logEntries = logEntries.data; - this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); + this.totalLogEntries = parseInt(logEntries.headers["file-size"], 10); }, async onPageChange(page) { diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js index 9d693bac..b1fa8b42 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js @@ -1,12 +1,12 @@ -import template from './template.twig'; -import './style.scss'; +import template from "./template.twig"; +import "./style.scss"; const { Component, Mixin } = Shopware; -Component.register('frosh-tools-tab-queue', { +Component.register("frosh-tools-tab-queue", { template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], + inject: ["repositoryFactory", "froshToolsService"], + mixins: [Mixin.getByName("notification")], data() { return { @@ -24,13 +24,13 @@ Component.register('frosh-tools-tab-queue', { columns() { return [ { - property: 'name', - label: 'Name', + property: "name", + label: "Name", rawData: true, }, { - property: 'size', - label: 'Size', + property: "size", + label: "Size", rawData: true, }, ]; @@ -46,7 +46,7 @@ Component.register('frosh-tools-tab-queue', { this.queueEntries = await this.froshToolsService.getQueue(); for (const queue of this.queueEntries) { - const nameSplit = queue.name.split('\\'); + const nameSplit = queue.name.split("\\"); queue.name = nameSplit[nameSplit.length - 1]; } this.isLoading = false; @@ -57,7 +57,7 @@ Component.register('frosh-tools-tab-queue', { this.showResetModal = false; await this.createdComponent(); this.createNotificationSuccess({ - message: this.$tc('frosh-tools.tabs.queue.reset.success'), + message: this.$tc("frosh-tools.tabs.queue.reset.success"), }); this.isLoading = false; }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index 7c9cf8af..c7b91724 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -1,13 +1,13 @@ -import template from './template.twig'; -import './style.scss'; +import template from "./template.twig"; +import "./style.scss"; const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; -Component.register('frosh-tools-tab-scheduled', { +Component.register("frosh-tools-tab-scheduled", { template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], + inject: ["repositoryFactory", "froshToolsService"], + mixins: [Mixin.getByName("notification")], data() { return { @@ -26,44 +26,44 @@ Component.register('frosh-tools-tab-scheduled', { computed: { scheduledRepository() { - return this.repositoryFactory.create('scheduled_task'); + return this.repositoryFactory.create("scheduled_task"); }, columns() { return [ { - property: 'name', - label: 'frosh-tools.name', + property: "name", + label: "frosh-tools.name", rawData: true, primary: true, }, { - property: 'runInterval', - label: 'frosh-tools.interval', + property: "runInterval", + label: "frosh-tools.interval", rawData: true, - inlineEdit: 'number', + inlineEdit: "number", }, { - property: 'lastExecutionTime', - label: 'frosh-tools.lastExecutionTime', + property: "lastExecutionTime", + label: "frosh-tools.lastExecutionTime", rawData: true, }, { - property: 'nextExecutionTime', - label: 'frosh-tools.nextExecutionTime', + property: "nextExecutionTime", + label: "frosh-tools.nextExecutionTime", rawData: true, - inlineEdit: 'datetime', + inlineEdit: "datetime", }, { - property: 'status', - label: 'frosh-tools.status', + property: "status", + label: "frosh-tools.status", rawData: true, }, ]; }, date() { - return Shopware.Filter.getByName('date'); + return Shopware.Filter.getByName("date"); }, }, @@ -75,7 +75,7 @@ Component.register('frosh-tools-tab-scheduled', { async createdComponent() { const criteria = new Criteria(this.page, this.limit); - criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); + criteria.addSorting(Criteria.sort("nextExecutionTime", "ASC")); this.items = await this.scheduledRepository.search( criteria, Shopware.Context.api, @@ -88,19 +88,19 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTaskStarted', 0, { + message: this.$tc("frosh-tools.scheduledTaskStarted", 0, { name: item.name, }), }); await this.froshToolsService.runScheduledTask(item.id); this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, { + message: this.$tc("frosh-tools.scheduledTaskSucceed", 0, { name: item.name, }), }); } catch (e) { this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTaskFailed', 0, { + message: this.$tc("frosh-tools.scheduledTaskFailed", 0, { name: item.name, }), }); @@ -116,7 +116,7 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$t('frosh-tools.scheduledTaskScheduleStarted', { + message: this.$t("frosh-tools.scheduledTaskScheduleStarted", { name: item.name, }), }); @@ -125,13 +125,13 @@ Component.register('frosh-tools-tab-scheduled', { immediately, ); this.createNotificationSuccess({ - message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', { + message: this.$t("frosh-tools.scheduledTaskScheduleSucceed", { name: item.name, }), }); } catch (e) { this.createNotificationError({ - message: this.$t('frosh-tools.scheduledTaskScheduleFailed', { + message: this.$t("frosh-tools.scheduledTaskScheduleFailed", { name: item.name, }), }); @@ -147,17 +147,17 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTasksRegisterStarted'), + message: this.$tc("frosh-tools.scheduledTasksRegisterStarted"), }); await this.froshToolsService.scheduledTasksRegister(); this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed'), + message: this.$tc("frosh-tools.scheduledTasksRegisterSucceed"), }); } catch (err) { console.error(err); this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTasksRegisterFailed'), + message: this.$tc("frosh-tools.scheduledTasksRegisterFailed"), }); } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index 23a5f2e3..f2d1e45c 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -1,14 +1,14 @@ -import './style.scss'; -import template from './template.html.twig'; +import "./style.scss"; +import template from "./template.html.twig"; const { Component, Mixin } = Shopware; -Component.register('frosh-tools-tab-state-machines', { +Component.register("frosh-tools-tab-state-machines", { template, - inject: ['froshToolsService'], + inject: ["froshToolsService"], - mixins: [Mixin.getByName('notification')], + mixins: [Mixin.getByName("notification")], data() { return { @@ -35,15 +35,15 @@ Component.register('frosh-tools-tab-state-machines', { const response = await this.froshToolsService.stateMachines(stateMachineChangeId); - const elem = document.getElementById('state_machine'); - if ('svg' in response) { + const elem = document.getElementById("state_machine"); + if ("svg" in response) { this.image = response.svg; elem.src = this.image; - elem.style.opacity = '1'; - elem.style.width = '100%'; - elem.style.height = 'auto'; + elem.style.opacity = "1"; + elem.style.width = "100%"; + elem.style.height = "auto"; } else { - elem.style.opacity = '0'; + elem.style.opacity = "0"; } }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/index.js b/src/Resources/app/administration/src/module/frosh-tools/index.js index 2529be5d..b388522a 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/index.js @@ -1,90 +1,90 @@ -import './component/frosh-tools-tab-index'; -import './component/frosh-tools-tab-cache'; -import './component/frosh-tools-tab-queue'; -import './component/frosh-tools-tab-scheduled'; -import './component/frosh-tools-tab-elasticsearch'; -import './component/frosh-tools-tab-logs'; -import './component/frosh-tools-tab-state-machines'; -import './component/frosh-tools-tab-files'; -import './page/index'; -import './acl'; +import "./component/frosh-tools-tab-index"; +import "./component/frosh-tools-tab-cache"; +import "./component/frosh-tools-tab-queue"; +import "./component/frosh-tools-tab-scheduled"; +import "./component/frosh-tools-tab-elasticsearch"; +import "./component/frosh-tools-tab-logs"; +import "./component/frosh-tools-tab-state-machines"; +import "./component/frosh-tools-tab-files"; +import "./page/index"; +import "./acl"; -Shopware.Module.register('frosh-tools', { - type: 'plugin', - name: 'frosh-tools.title', - title: 'frosh-tools.title', - description: '', - color: '#303A4F', +Shopware.Module.register("frosh-tools", { + type: "plugin", + name: "frosh-tools.title", + title: "frosh-tools.title", + description: "", + color: "#303A4F", - icon: 'regular-cog', + icon: "regular-cog", routes: { index: { - component: 'frosh-tools-index', - path: 'index', + component: "frosh-tools-index", + path: "index", children: { index: { - component: 'frosh-tools-tab-index', - path: 'index', + component: "frosh-tools-tab-index", + path: "index", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, cache: { - component: 'frosh-tools-tab-cache', - path: 'cache', + component: "frosh-tools-tab-cache", + path: "cache", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, queue: { - component: 'frosh-tools-tab-queue', - path: 'queue', + component: "frosh-tools-tab-queue", + path: "queue", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, scheduled: { - component: 'frosh-tools-tab-scheduled', - path: 'scheduled', + component: "frosh-tools-tab-scheduled", + path: "scheduled", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, elasticsearch: { - component: 'frosh-tools-tab-elasticsearch', - path: 'elasticsearch', + component: "frosh-tools-tab-elasticsearch", + path: "elasticsearch", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, logs: { - component: 'frosh-tools-tab-logs', - path: 'logs', + component: "frosh-tools-tab-logs", + path: "logs", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, files: { - component: 'frosh-tools-tab-files', - path: 'files', + component: "frosh-tools-tab-files", + path: "files", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, statemachines: { - component: 'frosh-tools-tab-state-machines', - path: 'state-machines', + component: "frosh-tools-tab-state-machines", + path: "state-machines", meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', + privilege: "frosh_tools:read", + parentPath: "sw.settings.index.plugins", }, }, }, @@ -93,12 +93,12 @@ Shopware.Module.register('frosh-tools', { settingsItem: [ { - group: 'plugins', - to: 'frosh.tools.index.cache', - icon: 'regular-cog', - name: 'frosh-tools', - label: 'frosh-tools.title', - privilege: 'frosh_tools:read', + group: "plugins", + to: "frosh.tools.index.cache", + icon: "regular-cog", + name: "frosh-tools", + label: "frosh-tools.title", + privilege: "frosh_tools:read", }, ], }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js index 6603765e..34260032 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js @@ -1,15 +1,15 @@ -import './frosh-tools.scss'; -import template from './template.twig'; +import "./frosh-tools.scss"; +import template from "./template.twig"; const { Component } = Shopware; -Component.register('frosh-tools-index', { +Component.register("frosh-tools-index", { template, computed: { elasticsearchAvailable() { return ( - Shopware.State.get('context').app.config.settings + Shopware.State.get("context").app.config.settings ?.elasticsearchEnabled || false ); }, diff --git a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js index 88c53045..e04e58a6 100644 --- a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js +++ b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js @@ -1,7 +1,7 @@ -import template from './template.twig'; +import template from "./template.twig"; const { Component } = Shopware; -Component.override('sw-data-grid-inline-edit', { +Component.override("sw-data-grid-inline-edit", { template, }); diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index a6fb69a4..e5d723c9 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -1,10 +1,10 @@ -import template from './template.twig'; +import template from "./template.twig"; const { Component } = Shopware; -Component.override('sw-version', { +Component.override("sw-version", { template, - inject: ['froshToolsService', 'acl', 'loginService'], + inject: ["froshToolsService", "acl", "loginService"], async created() { if (!this.checkPermission()) { @@ -23,16 +23,16 @@ Component.override('sw-version', { computed: { healthVariant() { - let variant = 'success'; + let variant = "success"; for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - variant = 'error'; + if (health.state === "STATE_ERROR") { + variant = "error"; continue; } - if (health.state === 'STATE_WARNING' && variant === 'success') { - variant = 'warning'; + if (health.state === "STATE_WARNING" && variant === "success") { + variant = "warning"; } } @@ -40,20 +40,20 @@ Component.override('sw-version', { }, healthPlaceholder() { - let msg = 'Shop Status: Ok'; + let msg = "Shop Status: Ok"; if (this.health === null) { return msg; } for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - msg = 'Shop Status: May outage, Check System Status'; + if (health.state === "STATE_ERROR") { + msg = "Shop Status: May outage, Check System Status"; continue; } - if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { - msg = 'Shop Status: Issues, Check System Status'; + if (health.state === "STATE_WARNING" && msg === "Shop Status: Ok") { + msg = "Shop Status: Issues, Check System Status"; } } @@ -80,7 +80,7 @@ Component.override('sw-version', { }, checkPermission() { - return (this.hasPermission = this.acl.can('frosh_tools:read')); + return (this.hasPermission = this.acl.can("frosh_tools:read")); }, }, }); From b88c1791cb601a2f3da5a4d5aaf54f6340eb2d9e Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 10:33:55 +0100 Subject: [PATCH 06/11] chore: format all files --- composer.json | 94 +++++++-------- frosh-tools-schema.json | 62 +++++----- .../administration/src/api/elasticsearch.js | 4 +- .../app/administration/src/api/frosh-tools.js | 2 +- .../app/administration/src/api/index.js | 12 +- src/Resources/app/administration/src/main.js | 8 +- .../src/module/frosh-tools/acl/index.js | 8 +- .../component/frosh-tools-tab-cache/index.js | 43 ++++--- .../frosh-tools-tab-elasticsearch/index.js | 53 ++++---- .../component/frosh-tools-tab-files/index.js | 38 +++--- .../component/frosh-tools-tab-index/index.js | 23 ++-- .../component/frosh-tools-tab-logs/index.js | 33 ++--- .../component/frosh-tools-tab-queue/index.js | 22 ++-- .../frosh-tools-tab-scheduled/index.js | 85 +++++++------ .../frosh-tools-tab-state-machines/index.js | 26 ++-- .../src/module/frosh-tools/index.js | 114 +++++++++--------- .../module/frosh-tools/page/index/index.js | 8 +- .../sw-data-grid-inline-edit/index.js | 4 +- .../src/overrides/sw-version/index.js | 34 +++--- 19 files changed, 358 insertions(+), 315 deletions(-) diff --git a/composer.json b/composer.json index c9a3dbd7..6fd3b883 100644 --- a/composer.json +++ b/composer.json @@ -1,49 +1,49 @@ { - "name": "frosh/tools", - "version": "2.6.0", - "description": "Provides some basic things for managing the Shopware Installation", - "type": "shopware-platform-plugin", - "license": "MIT", - "autoload": { - "psr-4": { - "Frosh\\Tools\\": "src/" - } - }, - "authors": [ - { - "name": "FriendsOfShopware", - "homepage": "https://friendsofshopware.com" - } - ], - "extra": { - "shopware-plugin-class": "Frosh\\Tools\\FroshTools", - "label": { - "de-DE": "Tools", - "en-GB": "Tools" - }, - "description": { - "de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.", - "en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status." - }, - "manufacturerLink": { - "de-DE": "https://github.com/FriendsOfShopware/FroshTools", - "en-GB": "https://github.com/FriendsOfShopware/FroshTools" - }, - "supportLink": { - "de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues", - "en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues" - } - }, - "require": { - "shopware/core": "~6.6.0" - }, - "config": { - "allow-plugins": { - "symfony/runtime": true - } - }, - "scripts": { - "cs-fix": "docker run --rm -v $(pwd):$(pwd) -w $(pwd) oskarstark/php-cs-fixer-ga --rules=@PER-CS2.0,no_unused_imports .", - "phpstan": "docker run --rm -v $(pwd):/app aragon999/phpstan-shopware:v6.6.0 analyse --level max ." - } + "name": "frosh/tools", + "version": "2.6.0", + "description": "Provides some basic things for managing the Shopware Installation", + "type": "shopware-platform-plugin", + "license": "MIT", + "autoload": { + "psr-4": { + "Frosh\\Tools\\": "src/" + } + }, + "authors": [ + { + "name": "FriendsOfShopware", + "homepage": "https://friendsofshopware.com" + } + ], + "extra": { + "shopware-plugin-class": "Frosh\\Tools\\FroshTools", + "label": { + "de-DE": "Tools", + "en-GB": "Tools" + }, + "description": { + "de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.", + "en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status." + }, + "manufacturerLink": { + "de-DE": "https://github.com/FriendsOfShopware/FroshTools", + "en-GB": "https://github.com/FriendsOfShopware/FroshTools" + }, + "supportLink": { + "de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues", + "en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues" + } + }, + "require": { + "shopware/core": "~6.6.0" + }, + "config": { + "allow-plugins": { + "symfony/runtime": true + } + }, + "scripts": { + "format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext", + "check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext" + } } diff --git a/frosh-tools-schema.json b/frosh-tools-schema.json index f67b8eb7..5dd515f9 100644 --- a/frosh-tools-schema.json +++ b/frosh-tools-schema.json @@ -1,33 +1,33 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "Configuration for FroshTools", - "$ref": "#/definitions/root", - "definitions": { - "root": { - "type": "object", - "properties": { - "frosh_tools": { - "$ref": "#/definitions/frosh_tools" - } - }, - "additionalProperties": false - }, - "frosh_tools": { - "type": "object", - "properties": { - "file_checker": { - "title": "File checker allow-list", - "type": "array", - "items": { - "type": "string" - } - }, - "system_config": { - "type": "object", - "additionalProperties": true - } - }, - "additionalProperties": false - } - } + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Configuration for FroshTools", + "$ref": "#/definitions/root", + "definitions": { + "root": { + "type": "object", + "properties": { + "frosh_tools": { + "$ref": "#/definitions/frosh_tools" + } + }, + "additionalProperties": false + }, + "frosh_tools": { + "type": "object", + "properties": { + "file_checker": { + "title": "File checker allow-list", + "type": "array", + "items": { + "type": "string" + } + }, + "system_config": { + "type": "object", + "additionalProperties": true + } + }, + "additionalProperties": false + } + } } diff --git a/src/Resources/app/administration/src/api/elasticsearch.js b/src/Resources/app/administration/src/api/elasticsearch.js index 5303618b..4b258788 100644 --- a/src/Resources/app/administration/src/api/elasticsearch.js +++ b/src/Resources/app/administration/src/api/elasticsearch.js @@ -4,7 +4,7 @@ class Elasticsearch extends ApiService { constructor( httpClient, loginService, - apiEndpoint = "_action/frosh-tools/elasticsearch", + apiEndpoint = '_action/frosh-tools/elasticsearch', ) { super(httpClient, loginService, apiEndpoint); } @@ -50,7 +50,7 @@ class Elasticsearch extends ApiService { method: method, headers: { ...this.getBasicHeaders(), - "content-type": "application/json", + 'content-type': 'application/json', }, data: payload, }) diff --git a/src/Resources/app/administration/src/api/frosh-tools.js b/src/Resources/app/administration/src/api/frosh-tools.js index 3ded83ad..318920ab 100644 --- a/src/Resources/app/administration/src/api/frosh-tools.js +++ b/src/Resources/app/administration/src/api/frosh-tools.js @@ -1,7 +1,7 @@ const { ApiService } = Shopware.Classes; class FroshTools extends ApiService { - constructor(httpClient, loginService, apiEndpoint = "_action/frosh-tools") { + constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { super(httpClient, loginService, apiEndpoint); } diff --git a/src/Resources/app/administration/src/api/index.js b/src/Resources/app/administration/src/api/index.js index 2c518b54..50f2df42 100644 --- a/src/Resources/app/administration/src/api/index.js +++ b/src/Resources/app/administration/src/api/index.js @@ -1,10 +1,10 @@ -import FroshToolsService from "./frosh-tools"; -import Elasticsearch from "./elasticsearch"; +import FroshToolsService from './frosh-tools'; +import Elasticsearch from './elasticsearch'; const { Application } = Shopware; -Application.addServiceProvider("froshToolsService", (container) => { - const initContainer = Application.getContainer("init"); +Application.addServiceProvider('froshToolsService', (container) => { + const initContainer = Application.getContainer('init'); return new FroshToolsService( initContainer.httpClient, @@ -12,8 +12,8 @@ Application.addServiceProvider("froshToolsService", (container) => { ); }); -Application.addServiceProvider("froshElasticSearch", (container) => { - const initContainer = Application.getContainer("init"); +Application.addServiceProvider('froshElasticSearch', (container) => { + const initContainer = Application.getContainer('init'); return new Elasticsearch(initContainer.httpClient, container.loginService); }); diff --git a/src/Resources/app/administration/src/main.js b/src/Resources/app/administration/src/main.js index 861bf238..c3c3b364 100644 --- a/src/Resources/app/administration/src/main.js +++ b/src/Resources/app/administration/src/main.js @@ -1,4 +1,4 @@ -import "./api"; -import "./overrides/sw-data-grid-inline-edit"; -import "./overrides/sw-version"; -import "./module/frosh-tools"; +import './api'; +import './overrides/sw-data-grid-inline-edit'; +import './overrides/sw-version'; +import './module/frosh-tools'; diff --git a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js index c4314869..ba494172 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js @@ -1,10 +1,10 @@ -Shopware.Service("privileges").addPrivilegeMappingEntry({ - category: "additional_permissions", +Shopware.Service('privileges').addPrivilegeMappingEntry({ + category: 'additional_permissions', parent: null, - key: "frosh_tools", + key: 'frosh_tools', roles: { frosh_tools: { - privileges: ["frosh_tools:read"], + privileges: ['frosh_tools:read'], dependencies: [], }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 12d67a82..299e41de 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -1,14 +1,14 @@ -import template from "./template.twig"; -import "./style.scss"; +import template from './template.twig'; +import './style.scss'; const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; -Component.register("frosh-tools-tab-cache", { +Component.register('frosh-tools-tab-cache', { template, - inject: ["froshToolsService", "repositoryFactory", "themeService"], - mixins: [Mixin.getByName("notification")], + inject: ['froshToolsService', 'repositoryFactory', 'themeService'], + mixins: [Mixin.getByName('notification')], data() { return { @@ -20,7 +20,9 @@ Component.register("frosh-tools-tab-cache", { created() { const language = - Shopware.Application.getContainer("factory").locale.getLastKnownLocale(); + Shopware.Application.getContainer( + 'factory', + ).locale.getLastKnownLocale(); this.numberFormater = new Intl.NumberFormat(language, { minimumFractionDigits: 2, maximumFractionDigits: 2, @@ -33,21 +35,21 @@ Component.register("frosh-tools-tab-cache", { columns() { return [ { - property: "name", - label: "frosh-tools.name", + property: 'name', + label: 'frosh-tools.name', rawData: true, }, { - property: "size", - label: "frosh-tools.used", + property: 'size', + label: 'frosh-tools.used', rawData: true, - align: "right", + align: 'right', }, { - property: "freeSpace", - label: "frosh-tools.free", + property: 'freeSpace', + label: 'frosh-tools.free', rawData: true, - align: "right", + align: 'right', }, ]; }, @@ -60,7 +62,7 @@ Component.register("frosh-tools-tab-cache", { }, salesChannelRepository() { - return this.repositoryFactory.create("sales_channel"); + return this.repositoryFactory.create('sales_channel'); }, }, @@ -74,7 +76,7 @@ Component.register("frosh-tools-tab-cache", { formatSize(bytes) { const formatted = bytes / (1024 * 1024); - return this.numberFormater.format(formatted) + " MiB"; + return this.numberFormater.format(formatted) + ' MiB'; }, async clearCache(item) { @@ -85,7 +87,7 @@ Component.register("frosh-tools-tab-cache", { async compileTheme() { const criteria = new Criteria(); - criteria.addAssociation("themes"); + criteria.addAssociation('themes'); this.isLoading = true; let salesChannels = await this.salesChannelRepository.search( @@ -97,9 +99,12 @@ Component.register("frosh-tools-tab-cache", { const theme = salesChannel.extensions.themes.first(); if (theme) { - await this.themeService.assignTheme(theme.id, salesChannel.id); + await this.themeService.assignTheme( + theme.id, + salesChannel.id, + ); this.createNotificationSuccess({ - message: `${salesChannel.translated.name}: ${this.$tc("frosh-tools.themeCompiled")}`, + message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, }); } } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index 55c17f26..38381a4b 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -1,12 +1,12 @@ -import template from "./template.twig"; +import template from './template.twig'; const { Mixin, Component } = Shopware; -Component.register("frosh-tools-tab-elasticsearch", { +Component.register('frosh-tools-tab-elasticsearch', { template, - inject: ["froshElasticSearch"], - mixins: [Mixin.getByName("notification")], + inject: ['froshElasticSearch'], + mixins: [Mixin.getByName('notification')], data() { return { @@ -14,7 +14,7 @@ Component.register("frosh-tools-tab-elasticsearch", { isActive: true, statusInfo: {}, indices: [], - consoleInput: "GET /_cat/indices", + consoleInput: 'GET /_cat/indices', consoleOutput: {}, }; }, @@ -23,20 +23,20 @@ Component.register("frosh-tools-tab-elasticsearch", { columns() { return [ { - property: "name", - label: "frosh-tools.name", + property: 'name', + label: 'frosh-tools.name', rawData: true, primary: true, }, { - property: "indexSize", - label: "frosh-tools.size", + property: 'indexSize', + label: 'frosh-tools.size', rawData: true, primary: true, }, { - property: "docs", - label: "frosh-tools.docs", + property: 'docs', + label: 'frosh-tools.docs', rawData: true, primary: true, }, @@ -74,10 +74,19 @@ Component.register("frosh-tools-tab-elasticsearch", { let formatted = bytes; if (Math.abs(bytes) < thresh) { - return bytes + " B"; + return bytes + ' B'; } - const units = ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]; + const units = [ + 'KiB', + 'MiB', + 'GiB', + 'TiB', + 'PiB', + 'EiB', + 'ZiB', + 'YiB', + ]; let index = -1; const reach = 10 ** dp; @@ -89,7 +98,7 @@ Component.register("frosh-tools-tab-elasticsearch", { index < units.length - 1 ); - return formatted.toFixed(dp) + " " + units[index]; + return formatted.toFixed(dp) + ' ' + units[index]; }, async deleteIndex(indexName) { @@ -98,10 +107,10 @@ Component.register("frosh-tools-tab-elasticsearch", { }, async onConsoleEnter() { - const lines = this.consoleInput.split("\n"); + const lines = this.consoleInput.split('\n'); const requestLine = lines.shift(); - const payload = lines.join("\n").trim(); - const [method, uri] = requestLine.split(" "); + const payload = lines.join('\n').trim(); + const [method, uri] = requestLine.split(' '); try { this.consoleOutput = await this.froshElasticSearch.console( @@ -118,7 +127,7 @@ Component.register("frosh-tools-tab-elasticsearch", { await this.froshElasticSearch.reindex(); this.createNotificationSuccess({ - message: this.$tc("global.default.success"), + message: this.$tc('global.default.success'), }); await this.createdComponent(); @@ -128,7 +137,7 @@ Component.register("frosh-tools-tab-elasticsearch", { await this.froshElasticSearch.switchAlias(); this.createNotificationSuccess({ - message: this.$tc("global.default.success"), + message: this.$tc('global.default.success'), }); await this.createdComponent(); @@ -138,7 +147,7 @@ Component.register("frosh-tools-tab-elasticsearch", { await this.froshElasticSearch.flushAll(); this.createNotificationSuccess({ - message: this.$tc("global.default.success"), + message: this.$tc('global.default.success'), }); await this.createdComponent(); @@ -148,7 +157,7 @@ Component.register("frosh-tools-tab-elasticsearch", { await this.froshElasticSearch.reset(); this.createNotificationSuccess({ - message: this.$tc("global.default.success"), + message: this.$tc('global.default.success'), }); await this.createdComponent(); @@ -158,7 +167,7 @@ Component.register("frosh-tools-tab-elasticsearch", { await this.froshElasticSearch.cleanup(); this.createNotificationSuccess({ - message: this.$tc("global.default.success"), + message: this.$tc('global.default.success'), }); await this.createdComponent(); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index b05b5010..0842b1c7 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -1,20 +1,20 @@ -import template from "./template.twig"; -import DiffMatchPatch from "diff-match-patch"; +import template from './template.twig'; +import DiffMatchPatch from 'diff-match-patch'; const { Component, Mixin } = Shopware; -Component.register("frosh-tools-tab-files", { +Component.register('frosh-tools-tab-files', { template, - inject: ["repositoryFactory", "froshToolsService"], - mixins: [Mixin.getByName("notification")], + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], data() { return { items: {}, isLoading: true, diffData: { - html: "", - file: "", + html: '', + file: '', }, showModal: false, }; @@ -28,14 +28,14 @@ Component.register("frosh-tools-tab-files", { columns() { return [ { - property: "name", - label: "frosh-tools.name", + property: 'name', + label: 'frosh-tools.name', rawData: true, primary: true, }, { - property: "expected", - label: "frosh-tools.status", + property: 'expected', + label: 'frosh-tools.status', rawData: true, primary: true, }, @@ -44,7 +44,7 @@ Component.register("frosh-tools-tab-files", { isLoadingClass() { return { - "is-loading": this.isLoading, + 'is-loading': this.isLoading, }; }, }, @@ -61,7 +61,7 @@ Component.register("frosh-tools-tab-files", { }, openUrl(url) { - window.open(url, "_blank"); + window.open(url, '_blank'); }, async diff(file) { @@ -78,10 +78,13 @@ Component.register("frosh-tools-tab-files", { dmp.diff_cleanupSemantic(diff); this.diffData.html = dmp .diff_prettyHtml(diff) - .replace(new RegExp("background:#e6ffe6;", "g"), "background:#ABF2BC;") .replace( - new RegExp("background:#ffe6e6;", "g"), - "background:rgba(255,129,130,0.4);", + new RegExp('background:#e6ffe6;', 'g'), + 'background:#ABF2BC;', + ) + .replace( + new RegExp('background:#ffe6e6;', 'g'), + 'background:rgba(255,129,130,0.4);', ); this.diffData.file = file; @@ -92,7 +95,8 @@ Component.register("frosh-tools-tab-files", { async restoreFile(name) { this.closeModal(); this.isLoading = true; - const response = await this.froshToolsService.restoreShopwareFile(name); + const response = + await this.froshToolsService.restoreShopwareFile(name); if (response.data.status) { this.createNotificationSuccess({ 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 5c8c49bb..ec3333e7 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 @@ -1,10 +1,10 @@ -import template from "./template.twig"; -import "./style.scss"; +import template from './template.twig'; +import './style.scss'; const { Component } = Shopware; -Component.register("frosh-tools-tab-index", { - inject: ["froshToolsService"], +Component.register('frosh-tools-tab-index', { + inject: ['froshToolsService'], template, data() { @@ -23,18 +23,18 @@ Component.register("frosh-tools-tab-index", { columns() { return [ { - property: "name", - label: "frosh-tools.name", + property: 'name', + label: 'frosh-tools.name', rawData: true, }, { - property: "current", - label: "frosh-tools.current", + property: 'current', + label: 'frosh-tools.current', rawData: true, }, { - property: "recommended", - label: "frosh-tools.recommended", + property: 'recommended', + label: 'frosh-tools.recommended', rawData: true, }, ]; @@ -49,7 +49,8 @@ Component.register("frosh-tools-tab-index", { async createdComponent() { this.health = await this.froshToolsService.healthStatus(); - this.performanceStatus = await this.froshToolsService.performanceStatus(); + this.performanceStatus = + await this.froshToolsService.performanceStatus(); this.isLoading = false; }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index db71a399..28afea3f 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -1,12 +1,12 @@ -import template from "./template.twig"; -import "./style.scss"; +import template from './template.twig'; +import './style.scss'; const { Component, Mixin } = Shopware; -Component.register("frosh-tools-tab-logs", { +Component.register('frosh-tools-tab-logs', { template, - inject: ["froshToolsService"], - mixins: [Mixin.getByName("notification")], + inject: ['froshToolsService'], + mixins: [Mixin.getByName('notification')], data() { return { @@ -29,30 +29,30 @@ Component.register("frosh-tools-tab-logs", { columns() { return [ { - property: "date", - label: "frosh-tools.date", + property: 'date', + label: 'frosh-tools.date', rawData: true, }, { - property: "channel", - label: "frosh-tools.channel", + property: 'channel', + label: 'frosh-tools.channel', rawData: true, }, { - property: "level", - label: "frosh-tools.level", + property: 'level', + label: 'frosh-tools.level', rawData: true, }, { - property: "message", - label: "frosh-tools.message", + property: 'message', + label: 'frosh-tools.message', rawData: true, }, ]; }, date() { - return Shopware.Filter.getByName("date"); + return Shopware.Filter.getByName('date'); }, }, @@ -80,7 +80,10 @@ Component.register("frosh-tools-tab-logs", { ); this.logEntries = logEntries.data; - this.totalLogEntries = parseInt(logEntries.headers["file-size"], 10); + this.totalLogEntries = parseInt( + logEntries.headers['file-size'], + 10, + ); }, async onPageChange(page) { diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js index b1fa8b42..9d693bac 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js @@ -1,12 +1,12 @@ -import template from "./template.twig"; -import "./style.scss"; +import template from './template.twig'; +import './style.scss'; const { Component, Mixin } = Shopware; -Component.register("frosh-tools-tab-queue", { +Component.register('frosh-tools-tab-queue', { template, - inject: ["repositoryFactory", "froshToolsService"], - mixins: [Mixin.getByName("notification")], + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], data() { return { @@ -24,13 +24,13 @@ Component.register("frosh-tools-tab-queue", { columns() { return [ { - property: "name", - label: "Name", + property: 'name', + label: 'Name', rawData: true, }, { - property: "size", - label: "Size", + property: 'size', + label: 'Size', rawData: true, }, ]; @@ -46,7 +46,7 @@ Component.register("frosh-tools-tab-queue", { this.queueEntries = await this.froshToolsService.getQueue(); for (const queue of this.queueEntries) { - const nameSplit = queue.name.split("\\"); + const nameSplit = queue.name.split('\\'); queue.name = nameSplit[nameSplit.length - 1]; } this.isLoading = false; @@ -57,7 +57,7 @@ Component.register("frosh-tools-tab-queue", { this.showResetModal = false; await this.createdComponent(); this.createNotificationSuccess({ - message: this.$tc("frosh-tools.tabs.queue.reset.success"), + message: this.$tc('frosh-tools.tabs.queue.reset.success'), }); this.isLoading = false; }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index c7b91724..d0011fb8 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -1,13 +1,13 @@ -import template from "./template.twig"; -import "./style.scss"; +import template from './template.twig'; +import './style.scss'; const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; -Component.register("frosh-tools-tab-scheduled", { +Component.register('frosh-tools-tab-scheduled', { template, - inject: ["repositoryFactory", "froshToolsService"], - mixins: [Mixin.getByName("notification")], + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], data() { return { @@ -26,44 +26,44 @@ Component.register("frosh-tools-tab-scheduled", { computed: { scheduledRepository() { - return this.repositoryFactory.create("scheduled_task"); + return this.repositoryFactory.create('scheduled_task'); }, columns() { return [ { - property: "name", - label: "frosh-tools.name", + property: 'name', + label: 'frosh-tools.name', rawData: true, primary: true, }, { - property: "runInterval", - label: "frosh-tools.interval", + property: 'runInterval', + label: 'frosh-tools.interval', rawData: true, - inlineEdit: "number", + inlineEdit: 'number', }, { - property: "lastExecutionTime", - label: "frosh-tools.lastExecutionTime", + property: 'lastExecutionTime', + label: 'frosh-tools.lastExecutionTime', rawData: true, }, { - property: "nextExecutionTime", - label: "frosh-tools.nextExecutionTime", + property: 'nextExecutionTime', + label: 'frosh-tools.nextExecutionTime', rawData: true, - inlineEdit: "datetime", + inlineEdit: 'datetime', }, { - property: "status", - label: "frosh-tools.status", + property: 'status', + label: 'frosh-tools.status', rawData: true, }, ]; }, date() { - return Shopware.Filter.getByName("date"); + return Shopware.Filter.getByName('date'); }, }, @@ -75,7 +75,7 @@ Component.register("frosh-tools-tab-scheduled", { async createdComponent() { const criteria = new Criteria(this.page, this.limit); - criteria.addSorting(Criteria.sort("nextExecutionTime", "ASC")); + criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); this.items = await this.scheduledRepository.search( criteria, Shopware.Context.api, @@ -88,19 +88,19 @@ Component.register("frosh-tools-tab-scheduled", { try { this.createNotificationInfo({ - message: this.$tc("frosh-tools.scheduledTaskStarted", 0, { + message: this.$tc('frosh-tools.scheduledTaskStarted', 0, { name: item.name, }), }); await this.froshToolsService.runScheduledTask(item.id); this.createNotificationSuccess({ - message: this.$tc("frosh-tools.scheduledTaskSucceed", 0, { + message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, { name: item.name, }), }); } catch (e) { this.createNotificationError({ - message: this.$tc("frosh-tools.scheduledTaskFailed", 0, { + message: this.$tc('frosh-tools.scheduledTaskFailed', 0, { name: item.name, }), }); @@ -116,24 +116,33 @@ Component.register("frosh-tools-tab-scheduled", { try { this.createNotificationInfo({ - message: this.$t("frosh-tools.scheduledTaskScheduleStarted", { - name: item.name, - }), + message: this.$t( + 'frosh-tools.scheduledTaskScheduleStarted', + { + name: item.name, + }, + ), }); await this.froshToolsService.scheduleScheduledTask( item.id, immediately, ); this.createNotificationSuccess({ - message: this.$t("frosh-tools.scheduledTaskScheduleSucceed", { - name: item.name, - }), + message: this.$t( + 'frosh-tools.scheduledTaskScheduleSucceed', + { + name: item.name, + }, + ), }); } catch (e) { this.createNotificationError({ - message: this.$t("frosh-tools.scheduledTaskScheduleFailed", { - name: item.name, - }), + message: this.$t( + 'frosh-tools.scheduledTaskScheduleFailed', + { + name: item.name, + }, + ), }); this.taskError = e.response.data; @@ -147,17 +156,23 @@ Component.register("frosh-tools-tab-scheduled", { try { this.createNotificationInfo({ - message: this.$tc("frosh-tools.scheduledTasksRegisterStarted"), + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterStarted', + ), }); await this.froshToolsService.scheduledTasksRegister(); this.createNotificationSuccess({ - message: this.$tc("frosh-tools.scheduledTasksRegisterSucceed"), + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterSucceed', + ), }); } catch (err) { console.error(err); this.createNotificationError({ - message: this.$tc("frosh-tools.scheduledTasksRegisterFailed"), + message: this.$tc( + 'frosh-tools.scheduledTasksRegisterFailed', + ), }); } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index f2d1e45c..90f83d0d 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -1,14 +1,14 @@ -import "./style.scss"; -import template from "./template.html.twig"; +import './style.scss'; +import template from './template.html.twig'; const { Component, Mixin } = Shopware; -Component.register("frosh-tools-tab-state-machines", { +Component.register('frosh-tools-tab-state-machines', { template, - inject: ["froshToolsService"], + inject: ['froshToolsService'], - mixins: [Mixin.getByName("notification")], + mixins: [Mixin.getByName('notification')], data() { return { @@ -33,17 +33,19 @@ Component.register("frosh-tools-tab-state-machines", { } const response = - await this.froshToolsService.stateMachines(stateMachineChangeId); + await this.froshToolsService.stateMachines( + stateMachineChangeId, + ); - const elem = document.getElementById("state_machine"); - if ("svg" in response) { + const elem = document.getElementById('state_machine'); + if ('svg' in response) { this.image = response.svg; elem.src = this.image; - elem.style.opacity = "1"; - elem.style.width = "100%"; - elem.style.height = "auto"; + elem.style.opacity = '1'; + elem.style.width = '100%'; + elem.style.height = 'auto'; } else { - elem.style.opacity = "0"; + elem.style.opacity = '0'; } }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/index.js b/src/Resources/app/administration/src/module/frosh-tools/index.js index b388522a..2529be5d 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/index.js @@ -1,90 +1,90 @@ -import "./component/frosh-tools-tab-index"; -import "./component/frosh-tools-tab-cache"; -import "./component/frosh-tools-tab-queue"; -import "./component/frosh-tools-tab-scheduled"; -import "./component/frosh-tools-tab-elasticsearch"; -import "./component/frosh-tools-tab-logs"; -import "./component/frosh-tools-tab-state-machines"; -import "./component/frosh-tools-tab-files"; -import "./page/index"; -import "./acl"; +import './component/frosh-tools-tab-index'; +import './component/frosh-tools-tab-cache'; +import './component/frosh-tools-tab-queue'; +import './component/frosh-tools-tab-scheduled'; +import './component/frosh-tools-tab-elasticsearch'; +import './component/frosh-tools-tab-logs'; +import './component/frosh-tools-tab-state-machines'; +import './component/frosh-tools-tab-files'; +import './page/index'; +import './acl'; -Shopware.Module.register("frosh-tools", { - type: "plugin", - name: "frosh-tools.title", - title: "frosh-tools.title", - description: "", - color: "#303A4F", +Shopware.Module.register('frosh-tools', { + type: 'plugin', + name: 'frosh-tools.title', + title: 'frosh-tools.title', + description: '', + color: '#303A4F', - icon: "regular-cog", + icon: 'regular-cog', routes: { index: { - component: "frosh-tools-index", - path: "index", + component: 'frosh-tools-index', + path: 'index', children: { index: { - component: "frosh-tools-tab-index", - path: "index", + component: 'frosh-tools-tab-index', + path: 'index', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, cache: { - component: "frosh-tools-tab-cache", - path: "cache", + component: 'frosh-tools-tab-cache', + path: 'cache', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, queue: { - component: "frosh-tools-tab-queue", - path: "queue", + component: 'frosh-tools-tab-queue', + path: 'queue', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, scheduled: { - component: "frosh-tools-tab-scheduled", - path: "scheduled", + component: 'frosh-tools-tab-scheduled', + path: 'scheduled', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, elasticsearch: { - component: "frosh-tools-tab-elasticsearch", - path: "elasticsearch", + component: 'frosh-tools-tab-elasticsearch', + path: 'elasticsearch', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, logs: { - component: "frosh-tools-tab-logs", - path: "logs", + component: 'frosh-tools-tab-logs', + path: 'logs', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, files: { - component: "frosh-tools-tab-files", - path: "files", + component: 'frosh-tools-tab-files', + path: 'files', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, statemachines: { - component: "frosh-tools-tab-state-machines", - path: "state-machines", + component: 'frosh-tools-tab-state-machines', + path: 'state-machines', meta: { - privilege: "frosh_tools:read", - parentPath: "sw.settings.index.plugins", + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', }, }, }, @@ -93,12 +93,12 @@ Shopware.Module.register("frosh-tools", { settingsItem: [ { - group: "plugins", - to: "frosh.tools.index.cache", - icon: "regular-cog", - name: "frosh-tools", - label: "frosh-tools.title", - privilege: "frosh_tools:read", + group: 'plugins', + to: 'frosh.tools.index.cache', + icon: 'regular-cog', + name: 'frosh-tools', + label: 'frosh-tools.title', + privilege: 'frosh_tools:read', }, ], }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js index 34260032..6603765e 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js @@ -1,15 +1,15 @@ -import "./frosh-tools.scss"; -import template from "./template.twig"; +import './frosh-tools.scss'; +import template from './template.twig'; const { Component } = Shopware; -Component.register("frosh-tools-index", { +Component.register('frosh-tools-index', { template, computed: { elasticsearchAvailable() { return ( - Shopware.State.get("context").app.config.settings + Shopware.State.get('context').app.config.settings ?.elasticsearchEnabled || false ); }, diff --git a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js index e04e58a6..88c53045 100644 --- a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js +++ b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js @@ -1,7 +1,7 @@ -import template from "./template.twig"; +import template from './template.twig'; const { Component } = Shopware; -Component.override("sw-data-grid-inline-edit", { +Component.override('sw-data-grid-inline-edit', { template, }); diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index e5d723c9..f364064d 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -1,10 +1,10 @@ -import template from "./template.twig"; +import template from './template.twig'; const { Component } = Shopware; -Component.override("sw-version", { +Component.override('sw-version', { template, - inject: ["froshToolsService", "acl", "loginService"], + inject: ['froshToolsService', 'acl', 'loginService'], async created() { if (!this.checkPermission()) { @@ -23,16 +23,16 @@ Component.override("sw-version", { computed: { healthVariant() { - let variant = "success"; + let variant = 'success'; for (let health of this.health) { - if (health.state === "STATE_ERROR") { - variant = "error"; + if (health.state === 'STATE_ERROR') { + variant = 'error'; continue; } - if (health.state === "STATE_WARNING" && variant === "success") { - variant = "warning"; + if (health.state === 'STATE_WARNING' && variant === 'success') { + variant = 'warning'; } } @@ -40,20 +40,23 @@ Component.override("sw-version", { }, healthPlaceholder() { - let msg = "Shop Status: Ok"; + let msg = 'Shop Status: Ok'; if (this.health === null) { return msg; } for (let health of this.health) { - if (health.state === "STATE_ERROR") { - msg = "Shop Status: May outage, Check System Status"; + if (health.state === 'STATE_ERROR') { + msg = 'Shop Status: May outage, Check System Status'; continue; } - if (health.state === "STATE_WARNING" && msg === "Shop Status: Ok") { - msg = "Shop Status: Issues, Check System Status"; + if ( + health.state === 'STATE_WARNING' && + msg === 'Shop Status: Ok' + ) { + msg = 'Shop Status: Issues, Check System Status'; } } @@ -67,7 +70,8 @@ Component.override("sw-version", { this.checkInterval = setInterval(async () => { try { - this.health = await this.froshToolsService.healthStatus(true); + this.health = + await this.froshToolsService.healthStatus(true); } catch (e) { console.error(e); clearInterval(this.checkInterval); @@ -80,7 +84,7 @@ Component.override("sw-version", { }, checkPermission() { - return (this.hasPermission = this.acl.can("frosh_tools:read")); + return (this.hasPermission = this.acl.can('frosh_tools:read')); }, }, }); From 79b85f078b4454fa4ca68a14398efc2ba63dfb10 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 10:34:44 +0100 Subject: [PATCH 07/11] chore: format all files --- .../component/frosh-tools-tab-cache/index.js | 9 +---- .../frosh-tools-tab-elasticsearch/index.js | 11 +----- .../component/frosh-tools-tab-files/index.js | 8 +--- .../component/frosh-tools-tab-index/index.js | 3 +- .../component/frosh-tools-tab-logs/index.js | 5 +-- .../frosh-tools-tab-scheduled/index.js | 39 ++++++------------- .../frosh-tools-tab-state-machines/index.js | 4 +- .../src/overrides/sw-version/index.js | 8 +--- 8 files changed, 22 insertions(+), 65 deletions(-) diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 299e41de..25614c85 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -20,9 +20,7 @@ Component.register('frosh-tools-tab-cache', { created() { const language = - Shopware.Application.getContainer( - 'factory', - ).locale.getLastKnownLocale(); + Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); this.numberFormater = new Intl.NumberFormat(language, { minimumFractionDigits: 2, maximumFractionDigits: 2, @@ -99,10 +97,7 @@ Component.register('frosh-tools-tab-cache', { const theme = salesChannel.extensions.themes.first(); if (theme) { - await this.themeService.assignTheme( - theme.id, - salesChannel.id, - ); + await this.themeService.assignTheme(theme.id, salesChannel.id); this.createNotificationSuccess({ message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index 38381a4b..e506e759 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -77,16 +77,7 @@ Component.register('frosh-tools-tab-elasticsearch', { return bytes + ' B'; } - const units = [ - 'KiB', - 'MiB', - 'GiB', - 'TiB', - 'PiB', - 'EiB', - 'ZiB', - 'YiB', - ]; + const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; let index = -1; const reach = 10 ** dp; diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index 0842b1c7..dfbe18d7 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -78,10 +78,7 @@ Component.register('frosh-tools-tab-files', { dmp.diff_cleanupSemantic(diff); this.diffData.html = dmp .diff_prettyHtml(diff) - .replace( - new RegExp('background:#e6ffe6;', 'g'), - 'background:#ABF2BC;', - ) + .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') .replace( new RegExp('background:#ffe6e6;', 'g'), 'background:rgba(255,129,130,0.4);', @@ -95,8 +92,7 @@ Component.register('frosh-tools-tab-files', { async restoreFile(name) { this.closeModal(); this.isLoading = true; - const response = - await this.froshToolsService.restoreShopwareFile(name); + const response = await this.froshToolsService.restoreShopwareFile(name); if (response.data.status) { this.createNotificationSuccess({ 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 ec3333e7..cc6b5c4f 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 @@ -49,8 +49,7 @@ Component.register('frosh-tools-tab-index', { async createdComponent() { this.health = await this.froshToolsService.healthStatus(); - this.performanceStatus = - await this.froshToolsService.performanceStatus(); + this.performanceStatus = await this.froshToolsService.performanceStatus(); this.isLoading = false; }, }, diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index 28afea3f..2a4e7dcb 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -80,10 +80,7 @@ Component.register('frosh-tools-tab-logs', { ); this.logEntries = logEntries.data; - this.totalLogEntries = parseInt( - logEntries.headers['file-size'], - 10, - ); + this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); }, async onPageChange(page) { diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index d0011fb8..7c9cf8af 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -116,33 +116,24 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleStarted', - { - name: item.name, - }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleStarted', { + name: item.name, + }), }); await this.froshToolsService.scheduleScheduledTask( item.id, immediately, ); this.createNotificationSuccess({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleSucceed', - { - name: item.name, - }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', { + name: item.name, + }), }); } catch (e) { this.createNotificationError({ - message: this.$t( - 'frosh-tools.scheduledTaskScheduleFailed', - { - name: item.name, - }, - ), + message: this.$t('frosh-tools.scheduledTaskScheduleFailed', { + name: item.name, + }), }); this.taskError = e.response.data; @@ -156,23 +147,17 @@ Component.register('frosh-tools-tab-scheduled', { try { this.createNotificationInfo({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterStarted', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterStarted'), }); await this.froshToolsService.scheduledTasksRegister(); this.createNotificationSuccess({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterSucceed', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed'), }); } catch (err) { console.error(err); this.createNotificationError({ - message: this.$tc( - 'frosh-tools.scheduledTasksRegisterFailed', - ), + message: this.$tc('frosh-tools.scheduledTasksRegisterFailed'), }); } diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index 90f83d0d..23a5f2e3 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -33,9 +33,7 @@ Component.register('frosh-tools-tab-state-machines', { } const response = - await this.froshToolsService.stateMachines( - stateMachineChangeId, - ); + await this.froshToolsService.stateMachines(stateMachineChangeId); const elem = document.getElementById('state_machine'); if ('svg' in response) { diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index f364064d..a6fb69a4 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -52,10 +52,7 @@ Component.override('sw-version', { continue; } - if ( - health.state === 'STATE_WARNING' && - msg === 'Shop Status: Ok' - ) { + if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { msg = 'Shop Status: Issues, Check System Status'; } } @@ -70,8 +67,7 @@ Component.override('sw-version', { this.checkInterval = setInterval(async () => { try { - this.health = - await this.froshToolsService.healthStatus(true); + this.health = await this.froshToolsService.healthStatus(true); } catch (e) { console.error(e); clearInterval(this.checkInterval); From ae24a6891f918fc4a043cfad5d5978ca7e9dede9 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 10:43:24 +0100 Subject: [PATCH 08/11] chore: format all files --- src/Resources/app/administration/package.json | 14 +- .../administration/src/api/elasticsearch.js | 246 +++++------ .../app/administration/src/api/frosh-tools.js | 404 +++++++++--------- .../app/administration/src/api/index.js | 14 +- .../src/module/frosh-tools/acl/index.js | 18 +- .../component/frosh-tools-tab-cache/index.js | 204 ++++----- .../frosh-tools-tab-elasticsearch/index.js | 322 +++++++------- .../component/frosh-tools-tab-files/index.js | 222 +++++----- .../component/frosh-tools-tab-index/index.js | 88 ++-- .../component/frosh-tools-tab-logs/index.js | 162 +++---- .../component/frosh-tools-tab-queue/index.js | 106 ++--- .../frosh-tools-tab-scheduled/index.js | 318 +++++++------- .../frosh-tools-tab-state-machines/index.js | 86 ++-- .../src/module/frosh-tools/index.js | 176 ++++---- .../module/frosh-tools/page/index/index.js | 18 +- .../src/module/frosh-tools/snippet/de-DE.json | 220 +++++----- .../src/module/frosh-tools/snippet/en-GB.json | 220 +++++----- .../sw-data-grid-inline-edit/index.js | 2 +- .../src/overrides/sw-version/index.js | 160 +++---- 19 files changed, 1500 insertions(+), 1500 deletions(-) diff --git a/src/Resources/app/administration/package.json b/src/Resources/app/administration/package.json index 0f9617e4..f7db6522 100644 --- a/src/Resources/app/administration/package.json +++ b/src/Resources/app/administration/package.json @@ -1,9 +1,9 @@ { - "name": "Resources", - "version": "1.0.0", - "main": "index.js", - "dependencies": { - "diff-match-patch": "^1.0.5" - }, - "license": "MIT" + "name": "Resources", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "diff-match-patch": "^1.0.5" + }, + "license": "MIT" } diff --git a/src/Resources/app/administration/src/api/elasticsearch.js b/src/Resources/app/administration/src/api/elasticsearch.js index 4b258788..8bb0de5e 100644 --- a/src/Resources/app/administration/src/api/elasticsearch.js +++ b/src/Resources/app/administration/src/api/elasticsearch.js @@ -1,138 +1,138 @@ const { ApiService } = Shopware.Classes; class Elasticsearch extends ApiService { - constructor( - httpClient, - loginService, - apiEndpoint = '_action/frosh-tools/elasticsearch', - ) { - super(httpClient, loginService, apiEndpoint); - } + constructor( + httpClient, + loginService, + apiEndpoint = '_action/frosh-tools/elasticsearch', + ) { + super(httpClient, loginService, apiEndpoint); + } - status() { - const apiRoute = `${this.getApiBasePath()}/status`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + status() { + const apiRoute = `${this.getApiBasePath()}/status`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - indices() { - const apiRoute = `${this.getApiBasePath()}/indices`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + indices() { + const apiRoute = `${this.getApiBasePath()}/indices`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - deleteIndex(indexName) { - const apiRoute = `${this.getApiBasePath()}/index/` + indexName; - return this.httpClient - .delete(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + deleteIndex(indexName) { + const apiRoute = `${this.getApiBasePath()}/index/` + indexName; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - console(method, path, payload) { - const apiRoute = `${this.getApiBasePath()}/console` + path; - return this.httpClient - .request({ - url: apiRoute, - method: method, - headers: { - ...this.getBasicHeaders(), - 'content-type': 'application/json', - }, - data: payload, - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + console(method, path, payload) { + const apiRoute = `${this.getApiBasePath()}/console` + path; + return this.httpClient + .request({ + url: apiRoute, + method: method, + headers: { + ...this.getBasicHeaders(), + 'content-type': 'application/json', + }, + data: payload, + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - flushAll() { - const apiRoute = `${this.getApiBasePath()}/flush_all`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + flushAll() { + const apiRoute = `${this.getApiBasePath()}/flush_all`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - reindex() { - const apiRoute = `${this.getApiBasePath()}/reindex`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + reindex() { + const apiRoute = `${this.getApiBasePath()}/reindex`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - switchAlias() { - const apiRoute = `${this.getApiBasePath()}/switch_alias`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + switchAlias() { + const apiRoute = `${this.getApiBasePath()}/switch_alias`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - cleanup() { - const apiRoute = `${this.getApiBasePath()}/cleanup`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + cleanup() { + const apiRoute = `${this.getApiBasePath()}/cleanup`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } - reset() { - const apiRoute = `${this.getApiBasePath()}/reset`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + reset() { + const apiRoute = `${this.getApiBasePath()}/reset`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } } export default Elasticsearch; diff --git a/src/Resources/app/administration/src/api/frosh-tools.js b/src/Resources/app/administration/src/api/frosh-tools.js index 318920ab..e0e2c491 100644 --- a/src/Resources/app/administration/src/api/frosh-tools.js +++ b/src/Resources/app/administration/src/api/frosh-tools.js @@ -1,208 +1,208 @@ const { ApiService } = Shopware.Classes; class FroshTools extends ApiService { - constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { - super(httpClient, loginService, apiEndpoint); - } - - getCacheInfo() { - const apiRoute = `${this.getApiBasePath()}/cache`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - clearCache(folder) { - const apiRoute = `${this.getApiBasePath()}/cache/${folder}`; - return this.httpClient - .delete(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - getQueue() { - const apiRoute = `${this.getApiBasePath()}/queue/list`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - resetQueue() { - const apiRoute = `${this.getApiBasePath()}/queue`; - return this.httpClient - .delete(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - runScheduledTask(id) { - const apiRoute = `${this.getApiBasePath()}/scheduled-task/${id}`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - scheduleScheduledTask(id, immediately = false) { - const apiRoute = `${this.getApiBasePath()}/scheduled-task/schedule/${id}`; - return this.httpClient - .post( - apiRoute, - { - immediately: immediately, - }, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - scheduledTasksRegister() { - const apiRoute = `${this.getApiBasePath()}/scheduled-tasks/register`; - return this.httpClient - .post( - apiRoute, - {}, - { - headers: this.getBasicHeaders(), - }, - ) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - healthStatus(cached = false) { - if (!this.loginService.isLoggedIn()) { - return; - } - - let apiRoute = `${this.getApiBasePath()}/health/status`; - - if (cached) { - apiRoute = `${this.getApiBasePath()}/health-ping/status`; - } - - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - performanceStatus() { - const apiRoute = `${this.getApiBasePath()}/performance/status`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - getLogFiles() { - const apiRoute = `${this.getApiBasePath()}/logs/files`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } - - getLogFile(file, offset = 0, limit = 20) { - const apiRoute = `${this.getApiBasePath()}/logs/file`; - return this.httpClient - .get(apiRoute, { - params: { - file, - offset, - limit, - }, - headers: this.getBasicHeaders(), - }) - .then((response) => { - return response; - }); - } - - getShopwareFiles() { - const apiRoute = `${this.getApiBasePath()}/shopware-files`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return response; - }); - } - - getFileContents(file) { - const apiRoute = `${this.getApiBasePath()}/file-contents`; - return this.httpClient - .get(apiRoute, { - params: { - file, - }, - headers: this.getBasicHeaders(), - }) - .then((response) => { - return response; - }); - } - - restoreShopwareFile(file) { - const apiRoute = `${this.getApiBasePath()}/shopware-file/restore`; - return this.httpClient - .get(apiRoute, { - params: { - file, - }, - headers: this.getBasicHeaders(), - }) - .then((response) => { - return response; - }); - } - - stateMachines(id) { - const apiRoute = `${this.getApiBasePath()}/state-machines/load/${id}`; - return this.httpClient - .get(apiRoute, { - headers: this.getBasicHeaders(), - }) - .then((response) => { - return ApiService.handleResponse(response); - }); - } + constructor(httpClient, loginService, apiEndpoint = '_action/frosh-tools') { + super(httpClient, loginService, apiEndpoint); + } + + getCacheInfo() { + const apiRoute = `${this.getApiBasePath()}/cache`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + clearCache(folder) { + const apiRoute = `${this.getApiBasePath()}/cache/${folder}`; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getQueue() { + const apiRoute = `${this.getApiBasePath()}/queue/list`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + resetQueue() { + const apiRoute = `${this.getApiBasePath()}/queue`; + return this.httpClient + .delete(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + runScheduledTask(id) { + const apiRoute = `${this.getApiBasePath()}/scheduled-task/${id}`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + scheduleScheduledTask(id, immediately = false) { + const apiRoute = `${this.getApiBasePath()}/scheduled-task/schedule/${id}`; + return this.httpClient + .post( + apiRoute, + { + immediately: immediately, + }, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + scheduledTasksRegister() { + const apiRoute = `${this.getApiBasePath()}/scheduled-tasks/register`; + return this.httpClient + .post( + apiRoute, + {}, + { + headers: this.getBasicHeaders(), + }, + ) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + healthStatus(cached = false) { + if (!this.loginService.isLoggedIn()) { + return; + } + + let apiRoute = `${this.getApiBasePath()}/health/status`; + + if (cached) { + apiRoute = `${this.getApiBasePath()}/health-ping/status`; + } + + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + performanceStatus() { + const apiRoute = `${this.getApiBasePath()}/performance/status`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getLogFiles() { + const apiRoute = `${this.getApiBasePath()}/logs/files`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } + + getLogFile(file, offset = 0, limit = 20) { + const apiRoute = `${this.getApiBasePath()}/logs/file`; + return this.httpClient + .get(apiRoute, { + params: { + file, + offset, + limit, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + getShopwareFiles() { + const apiRoute = `${this.getApiBasePath()}/shopware-files`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + getFileContents(file) { + const apiRoute = `${this.getApiBasePath()}/file-contents`; + return this.httpClient + .get(apiRoute, { + params: { + file, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + restoreShopwareFile(file) { + const apiRoute = `${this.getApiBasePath()}/shopware-file/restore`; + return this.httpClient + .get(apiRoute, { + params: { + file, + }, + headers: this.getBasicHeaders(), + }) + .then((response) => { + return response; + }); + } + + stateMachines(id) { + const apiRoute = `${this.getApiBasePath()}/state-machines/load/${id}`; + return this.httpClient + .get(apiRoute, { + headers: this.getBasicHeaders(), + }) + .then((response) => { + return ApiService.handleResponse(response); + }); + } } export default FroshTools; diff --git a/src/Resources/app/administration/src/api/index.js b/src/Resources/app/administration/src/api/index.js index 50f2df42..579e8d11 100644 --- a/src/Resources/app/administration/src/api/index.js +++ b/src/Resources/app/administration/src/api/index.js @@ -4,16 +4,16 @@ import Elasticsearch from './elasticsearch'; const { Application } = Shopware; Application.addServiceProvider('froshToolsService', (container) => { - const initContainer = Application.getContainer('init'); + const initContainer = Application.getContainer('init'); - return new FroshToolsService( - initContainer.httpClient, - container.loginService, - ); + return new FroshToolsService( + initContainer.httpClient, + container.loginService, + ); }); Application.addServiceProvider('froshElasticSearch', (container) => { - const initContainer = Application.getContainer('init'); + const initContainer = Application.getContainer('init'); - return new Elasticsearch(initContainer.httpClient, container.loginService); + return new Elasticsearch(initContainer.httpClient, container.loginService); }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js index ba494172..330d2b37 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/acl/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/acl/index.js @@ -1,11 +1,11 @@ Shopware.Service('privileges').addPrivilegeMappingEntry({ - category: 'additional_permissions', - parent: null, - key: 'frosh_tools', - roles: { - frosh_tools: { - privileges: ['frosh_tools:read'], - dependencies: [], - }, - }, + category: 'additional_permissions', + parent: null, + key: 'frosh_tools', + roles: { + frosh_tools: { + privileges: ['frosh_tools:read'], + dependencies: [], + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js index 25614c85..db26a883 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-cache/index.js @@ -5,106 +5,106 @@ const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; Component.register('frosh-tools-tab-cache', { - template, - - inject: ['froshToolsService', 'repositoryFactory', 'themeService'], - mixins: [Mixin.getByName('notification')], - - data() { - return { - cacheInfo: null, - isLoading: true, - numberFormater: null, - }; - }, - - created() { - const language = - Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); - this.numberFormater = new Intl.NumberFormat(language, { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }); - - this.createdComponent(); - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - }, - { - property: 'size', - label: 'frosh-tools.used', - rawData: true, - align: 'right', - }, - { - property: 'freeSpace', - label: 'frosh-tools.free', - rawData: true, - align: 'right', - }, - ]; - }, - cacheFolders() { - if (this.cacheInfo === null) { - return []; - } - - return this.cacheInfo; - }, - - salesChannelRepository() { - return this.repositoryFactory.create('sales_channel'); - }, - }, - - methods: { - async createdComponent() { - this.isLoading = true; - this.cacheInfo = await this.froshToolsService.getCacheInfo(); - this.isLoading = false; - }, - - formatSize(bytes) { - const formatted = bytes / (1024 * 1024); - - return this.numberFormater.format(formatted) + ' MiB'; - }, - - async clearCache(item) { - this.isLoading = true; - await this.froshToolsService.clearCache(item.name); - await this.createdComponent(); - }, - - async compileTheme() { - const criteria = new Criteria(); - criteria.addAssociation('themes'); - this.isLoading = true; - - let salesChannels = await this.salesChannelRepository.search( - criteria, - Shopware.Context.api, - ); - - for (let salesChannel of salesChannels) { - const theme = salesChannel.extensions.themes.first(); - - if (theme) { - await this.themeService.assignTheme(theme.id, salesChannel.id); - this.createNotificationSuccess({ - message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, - }); - } - } - - this.isLoading = false; - }, - }, + template, + + inject: ['froshToolsService', 'repositoryFactory', 'themeService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + cacheInfo: null, + isLoading: true, + numberFormater: null, + }; + }, + + created() { + const language = + Shopware.Application.getContainer('factory').locale.getLastKnownLocale(); + this.numberFormater = new Intl.NumberFormat(language, { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }); + + this.createdComponent(); + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + }, + { + property: 'size', + label: 'frosh-tools.used', + rawData: true, + align: 'right', + }, + { + property: 'freeSpace', + label: 'frosh-tools.free', + rawData: true, + align: 'right', + }, + ]; + }, + cacheFolders() { + if (this.cacheInfo === null) { + return []; + } + + return this.cacheInfo; + }, + + salesChannelRepository() { + return this.repositoryFactory.create('sales_channel'); + }, + }, + + methods: { + async createdComponent() { + this.isLoading = true; + this.cacheInfo = await this.froshToolsService.getCacheInfo(); + this.isLoading = false; + }, + + formatSize(bytes) { + const formatted = bytes / (1024 * 1024); + + return this.numberFormater.format(formatted) + ' MiB'; + }, + + async clearCache(item) { + this.isLoading = true; + await this.froshToolsService.clearCache(item.name); + await this.createdComponent(); + }, + + async compileTheme() { + const criteria = new Criteria(); + criteria.addAssociation('themes'); + this.isLoading = true; + + let salesChannels = await this.salesChannelRepository.search( + criteria, + Shopware.Context.api, + ); + + for (let salesChannel of salesChannels) { + const theme = salesChannel.extensions.themes.first(); + + if (theme) { + await this.themeService.assignTheme(theme.id, salesChannel.id); + this.createNotificationSuccess({ + message: `${salesChannel.translated.name}: ${this.$tc('frosh-tools.themeCompiled')}`, + }); + } + } + + this.isLoading = false; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js index e506e759..f4daa9af 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-elasticsearch/index.js @@ -3,165 +3,165 @@ import template from './template.twig'; const { Mixin, Component } = Shopware; Component.register('frosh-tools-tab-elasticsearch', { - template, - - inject: ['froshElasticSearch'], - mixins: [Mixin.getByName('notification')], - - data() { - return { - isLoading: true, - isActive: true, - statusInfo: {}, - indices: [], - consoleInput: 'GET /_cat/indices', - consoleOutput: {}, - }; - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true, - }, - { - property: 'indexSize', - label: 'frosh-tools.size', - rawData: true, - primary: true, - }, - { - property: 'docs', - label: 'frosh-tools.docs', - rawData: true, - primary: true, - }, - ]; - }, - }, - - created() { - this.createdComponent(); - }, - - methods: { - async createdComponent() { - this.isLoading = true; - - try { - this.statusInfo = await this.froshElasticSearch.status(); - } catch (err) { - this.isActive = false; - this.isLoading = false; - - console.error(err); - - return; - } finally { - this.isLoading = false; - } - - this.indices = await this.froshElasticSearch.indices(); - }, - - formatSize(bytes) { - const thresh = 1024; - const dp = 1; - let formatted = bytes; - - if (Math.abs(bytes) < thresh) { - return bytes + ' B'; - } - - const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; - let index = -1; - const reach = 10 ** dp; - - do { - formatted /= thresh; - ++index; - } while ( - Math.round(Math.abs(formatted) * reach) / reach >= thresh && - index < units.length - 1 - ); - - return formatted.toFixed(dp) + ' ' + units[index]; - }, - - async deleteIndex(indexName) { - await this.froshElasticSearch.deleteIndex(indexName); - await this.createdComponent(); - }, - - async onConsoleEnter() { - const lines = this.consoleInput.split('\n'); - const requestLine = lines.shift(); - const payload = lines.join('\n').trim(); - const [method, uri] = requestLine.split(' '); - - try { - this.consoleOutput = await this.froshElasticSearch.console( - method, - uri, - payload, - ); - } catch (e) { - this.consoleOutput = e.response.data; - } - }, - - async reindex() { - await this.froshElasticSearch.reindex(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success'), - }); - - await this.createdComponent(); - }, - - async switchAlias() { - await this.froshElasticSearch.switchAlias(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success'), - }); - - await this.createdComponent(); - }, - - async flushAll() { - await this.froshElasticSearch.flushAll(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success'), - }); - - await this.createdComponent(); - }, - - async resetElasticsearch() { - await this.froshElasticSearch.reset(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success'), - }); - - await this.createdComponent(); - }, - - async cleanup() { - await this.froshElasticSearch.cleanup(); - - this.createNotificationSuccess({ - message: this.$tc('global.default.success'), - }); - - await this.createdComponent(); - }, - }, + template, + + inject: ['froshElasticSearch'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + isLoading: true, + isActive: true, + statusInfo: {}, + indices: [], + consoleInput: 'GET /_cat/indices', + consoleOutput: {}, + }; + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'indexSize', + label: 'frosh-tools.size', + rawData: true, + primary: true, + }, + { + property: 'docs', + label: 'frosh-tools.docs', + rawData: true, + primary: true, + }, + ]; + }, + }, + + created() { + this.createdComponent(); + }, + + methods: { + async createdComponent() { + this.isLoading = true; + + try { + this.statusInfo = await this.froshElasticSearch.status(); + } catch (err) { + this.isActive = false; + this.isLoading = false; + + console.error(err); + + return; + } finally { + this.isLoading = false; + } + + this.indices = await this.froshElasticSearch.indices(); + }, + + formatSize(bytes) { + const thresh = 1024; + const dp = 1; + let formatted = bytes; + + if (Math.abs(bytes) < thresh) { + return bytes + ' B'; + } + + const units = ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; + let index = -1; + const reach = 10 ** dp; + + do { + formatted /= thresh; + ++index; + } while ( + Math.round(Math.abs(formatted) * reach) / reach >= thresh && + index < units.length - 1 + ); + + return formatted.toFixed(dp) + ' ' + units[index]; + }, + + async deleteIndex(indexName) { + await this.froshElasticSearch.deleteIndex(indexName); + await this.createdComponent(); + }, + + async onConsoleEnter() { + const lines = this.consoleInput.split('\n'); + const requestLine = lines.shift(); + const payload = lines.join('\n').trim(); + const [method, uri] = requestLine.split(' '); + + try { + this.consoleOutput = await this.froshElasticSearch.console( + method, + uri, + payload, + ); + } catch (e) { + this.consoleOutput = e.response.data; + } + }, + + async reindex() { + await this.froshElasticSearch.reindex(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async switchAlias() { + await this.froshElasticSearch.switchAlias(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async flushAll() { + await this.froshElasticSearch.flushAll(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async resetElasticsearch() { + await this.froshElasticSearch.reset(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + + async cleanup() { + await this.froshElasticSearch.cleanup(); + + this.createNotificationSuccess({ + message: this.$tc('global.default.success'), + }); + + await this.createdComponent(); + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js index dfbe18d7..5e0c0f7c 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-files/index.js @@ -4,115 +4,115 @@ import DiffMatchPatch from 'diff-match-patch'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-files', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], - - data() { - return { - items: {}, - isLoading: true, - diffData: { - html: '', - file: '', - }, - showModal: false, - }; - }, - - created() { - this.createdComponent(); - }, - - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true, - }, - { - property: 'expected', - label: 'frosh-tools.status', - rawData: true, - primary: true, - }, - ]; - }, - - isLoadingClass() { - return { - 'is-loading': this.isLoading, - }; - }, - }, - - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - - async createdComponent() { - this.items = (await this.froshToolsService.getShopwareFiles()).data; - this.isLoading = false; - }, - - openUrl(url) { - window.open(url, '_blank'); - }, - - async diff(file) { - this.isLoading = true; - const fileContents = ( - await this.froshToolsService.getFileContents(file.name) - ).data; - - const dmp = new DiffMatchPatch(); - const diff = dmp.diff_main( - fileContents.originalContent, - fileContents.content, - ); - dmp.diff_cleanupSemantic(diff); - this.diffData.html = dmp - .diff_prettyHtml(diff) - .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') - .replace( - new RegExp('background:#ffe6e6;', 'g'), - 'background:rgba(255,129,130,0.4);', - ); - this.diffData.file = file; - - this.openModal(); - this.isLoading = false; - }, - - async restoreFile(name) { - this.closeModal(); - this.isLoading = true; - const response = await this.froshToolsService.restoreShopwareFile(name); - - if (response.data.status) { - this.createNotificationSuccess({ - message: response.data.status, - }); - } else { - this.createNotificationError({ - message: response.data.error, - }); - } - - await this.refresh(); - }, - - openModal() { - this.showModal = true; - }, - - closeModal() { - this.showModal = false; - }, - }, + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + items: {}, + isLoading: true, + diffData: { + html: '', + file: '', + }, + showModal: false, + }; + }, + + created() { + this.createdComponent(); + }, + + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'expected', + label: 'frosh-tools.status', + rawData: true, + primary: true, + }, + ]; + }, + + isLoadingClass() { + return { + 'is-loading': this.isLoading, + }; + }, + }, + + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + + async createdComponent() { + this.items = (await this.froshToolsService.getShopwareFiles()).data; + this.isLoading = false; + }, + + openUrl(url) { + window.open(url, '_blank'); + }, + + async diff(file) { + this.isLoading = true; + const fileContents = ( + await this.froshToolsService.getFileContents(file.name) + ).data; + + const dmp = new DiffMatchPatch(); + const diff = dmp.diff_main( + fileContents.originalContent, + fileContents.content, + ); + dmp.diff_cleanupSemantic(diff); + this.diffData.html = dmp + .diff_prettyHtml(diff) + .replace(new RegExp('background:#e6ffe6;', 'g'), 'background:#ABF2BC;') + .replace( + new RegExp('background:#ffe6e6;', 'g'), + 'background:rgba(255,129,130,0.4);', + ); + this.diffData.file = file; + + this.openModal(); + this.isLoading = false; + }, + + async restoreFile(name) { + this.closeModal(); + this.isLoading = true; + const response = await this.froshToolsService.restoreShopwareFile(name); + + if (response.data.status) { + this.createNotificationSuccess({ + message: response.data.status, + }); + } else { + this.createNotificationError({ + message: response.data.error, + }); + } + + await this.refresh(); + }, + + openModal() { + this.showModal = true; + }, + + closeModal() { + this.showModal = false; + }, + }, }); 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 cc6b5c4f..13eec035 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 @@ -4,53 +4,53 @@ import './style.scss'; const { Component } = Shopware; Component.register('frosh-tools-tab-index', { - inject: ['froshToolsService'], - template, + inject: ['froshToolsService'], + template, - data() { - return { - isLoading: true, - health: null, - performanceStatus: null, - }; - }, + data() { + return { + isLoading: true, + health: null, + performanceStatus: null, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - }, - { - property: 'current', - label: 'frosh-tools.current', - rawData: true, - }, - { - property: 'recommended', - label: 'frosh-tools.recommended', - rawData: true, - }, - ]; - }, - }, + computed: { + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + }, + { + property: 'current', + label: 'frosh-tools.current', + rawData: true, + }, + { + property: 'recommended', + label: 'frosh-tools.recommended', + rawData: true, + }, + ]; + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, - async createdComponent() { - this.health = await this.froshToolsService.healthStatus(); - this.performanceStatus = await this.froshToolsService.performanceStatus(); - this.isLoading = false; - }, - }, + async createdComponent() { + this.health = await this.froshToolsService.healthStatus(); + this.performanceStatus = await this.froshToolsService.performanceStatus(); + this.isLoading = false; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js index 2a4e7dcb..cad28b0b 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-logs/index.js @@ -4,97 +4,97 @@ import './style.scss'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-logs', { - template, - inject: ['froshToolsService'], - mixins: [Mixin.getByName('notification')], + template, + inject: ['froshToolsService'], + mixins: [Mixin.getByName('notification')], - data() { - return { - logFiles: [], - selectedLogFile: null, - logEntries: [], - totalLogEntries: 0, - limit: 25, - page: 1, - isLoading: true, - displayedLog: null, - }; - }, + data() { + return { + logFiles: [], + selectedLogFile: null, + logEntries: [], + totalLogEntries: 0, + limit: 25, + page: 1, + isLoading: true, + displayedLog: null, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'date', - label: 'frosh-tools.date', - rawData: true, - }, - { - property: 'channel', - label: 'frosh-tools.channel', - rawData: true, - }, - { - property: 'level', - label: 'frosh-tools.level', - rawData: true, - }, - { - property: 'message', - label: 'frosh-tools.message', - rawData: true, - }, - ]; - }, + computed: { + columns() { + return [ + { + property: 'date', + label: 'frosh-tools.date', + rawData: true, + }, + { + property: 'channel', + label: 'frosh-tools.channel', + rawData: true, + }, + { + property: 'level', + label: 'frosh-tools.level', + rawData: true, + }, + { + property: 'message', + label: 'frosh-tools.message', + rawData: true, + }, + ]; + }, - date() { - return Shopware.Filter.getByName('date'); - }, - }, + date() { + return Shopware.Filter.getByName('date'); + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - await this.onFileSelected(); - }, + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + await this.onFileSelected(); + }, - async createdComponent() { - this.logFiles = await this.froshToolsService.getLogFiles(); - this.isLoading = false; - }, + async createdComponent() { + this.logFiles = await this.froshToolsService.getLogFiles(); + this.isLoading = false; + }, - async onFileSelected() { - if (!this.selectedLogFile) { - return; - } + async onFileSelected() { + if (!this.selectedLogFile) { + return; + } - const logEntries = await this.froshToolsService.getLogFile( - this.selectedLogFile, - (this.page - 1) * this.limit, - this.limit, - ); + const logEntries = await this.froshToolsService.getLogFile( + this.selectedLogFile, + (this.page - 1) * this.limit, + this.limit, + ); - this.logEntries = logEntries.data; - this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); - }, + this.logEntries = logEntries.data; + this.totalLogEntries = parseInt(logEntries.headers['file-size'], 10); + }, - async onPageChange(page) { - this.page = page.page; - this.limit = page.limit; - await this.onFileSelected(); - }, + async onPageChange(page) { + this.page = page.page; + this.limit = page.limit; + await this.onFileSelected(); + }, - showInfoModal(entryContents) { - this.displayedLog = entryContents; - }, + showInfoModal(entryContents) { + this.displayedLog = entryContents; + }, - closeInfoModal() { - this.displayedLog = null; - }, - }, + closeInfoModal() { + this.displayedLog = null; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js index 9d693bac..0e60a184 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-queue/index.js @@ -4,62 +4,62 @@ import './style.scss'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-queue', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], - data() { - return { - queueEntries: [], - showResetModal: false, - isLoading: true, - }; - }, + data() { + return { + queueEntries: [], + showResetModal: false, + isLoading: true, + }; + }, - created() { - this.createdComponent(); - }, + created() { + this.createdComponent(); + }, - computed: { - columns() { - return [ - { - property: 'name', - label: 'Name', - rawData: true, - }, - { - property: 'size', - label: 'Size', - rawData: true, - }, - ]; - }, - }, + computed: { + columns() { + return [ + { + property: 'name', + label: 'Name', + rawData: true, + }, + { + property: 'size', + label: 'Size', + rawData: true, + }, + ]; + }, + }, - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - async createdComponent() { - this.queueEntries = await this.froshToolsService.getQueue(); + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + async createdComponent() { + this.queueEntries = await this.froshToolsService.getQueue(); - for (const queue of this.queueEntries) { - const nameSplit = queue.name.split('\\'); - queue.name = nameSplit[nameSplit.length - 1]; - } - this.isLoading = false; - }, - async resetQueue() { - this.isLoading = true; - await this.froshToolsService.resetQueue(); - this.showResetModal = false; - await this.createdComponent(); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.tabs.queue.reset.success'), - }); - this.isLoading = false; - }, - }, + for (const queue of this.queueEntries) { + const nameSplit = queue.name.split('\\'); + queue.name = nameSplit[nameSplit.length - 1]; + } + this.isLoading = false; + }, + async resetQueue() { + this.isLoading = true; + await this.froshToolsService.resetQueue(); + this.showResetModal = false; + await this.createdComponent(); + this.createNotificationSuccess({ + message: this.$tc('frosh-tools.tabs.queue.reset.success'), + }); + this.isLoading = false; + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js index 7c9cf8af..f0d8f49d 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-scheduled/index.js @@ -5,163 +5,163 @@ const { Component, Mixin } = Shopware; const { Criteria } = Shopware.Data; Component.register('frosh-tools-tab-scheduled', { - template, - inject: ['repositoryFactory', 'froshToolsService'], - mixins: [Mixin.getByName('notification')], - - data() { - return { - items: null, - showResetModal: false, - isLoading: true, - page: 1, - limit: 25, - taskError: null, - }; - }, - - created() { - this.createdComponent(); - }, - - computed: { - scheduledRepository() { - return this.repositoryFactory.create('scheduled_task'); - }, - - columns() { - return [ - { - property: 'name', - label: 'frosh-tools.name', - rawData: true, - primary: true, - }, - { - property: 'runInterval', - label: 'frosh-tools.interval', - rawData: true, - inlineEdit: 'number', - }, - { - property: 'lastExecutionTime', - label: 'frosh-tools.lastExecutionTime', - rawData: true, - }, - { - property: 'nextExecutionTime', - label: 'frosh-tools.nextExecutionTime', - rawData: true, - inlineEdit: 'datetime', - }, - { - property: 'status', - label: 'frosh-tools.status', - rawData: true, - }, - ]; - }, - - date() { - return Shopware.Filter.getByName('date'); - }, - }, - - methods: { - async refresh() { - this.isLoading = true; - await this.createdComponent(); - }, - - async createdComponent() { - const criteria = new Criteria(this.page, this.limit); - criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); - this.items = await this.scheduledRepository.search( - criteria, - Shopware.Context.api, - ); - this.isLoading = false; - }, - - async runTask(item) { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTaskStarted', 0, { - name: item.name, - }), - }); - await this.froshToolsService.runScheduledTask(item.id); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, { - name: item.name, - }), - }); - } catch (e) { - this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTaskFailed', 0, { - name: item.name, - }), - }); - - this.taskError = e.response.data; - } - - this.createdComponent(); - }, - - async scheduleTask(item, immediately = false) { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$t('frosh-tools.scheduledTaskScheduleStarted', { - name: item.name, - }), - }); - await this.froshToolsService.scheduleScheduledTask( - item.id, - immediately, - ); - this.createNotificationSuccess({ - message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', { - name: item.name, - }), - }); - } catch (e) { - this.createNotificationError({ - message: this.$t('frosh-tools.scheduledTaskScheduleFailed', { - name: item.name, - }), - }); - - this.taskError = e.response.data; - } - - this.createdComponent(); - }, - - async registerScheduledTasks() { - this.isLoading = true; - - try { - this.createNotificationInfo({ - message: this.$tc('frosh-tools.scheduledTasksRegisterStarted'), - }); - await this.froshToolsService.scheduledTasksRegister(); - this.createNotificationSuccess({ - message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed'), - }); - } catch (err) { - console.error(err); - - this.createNotificationError({ - message: this.$tc('frosh-tools.scheduledTasksRegisterFailed'), - }); - } - - this.createdComponent(); - }, - }, + template, + inject: ['repositoryFactory', 'froshToolsService'], + mixins: [Mixin.getByName('notification')], + + data() { + return { + items: null, + showResetModal: false, + isLoading: true, + page: 1, + limit: 25, + taskError: null, + }; + }, + + created() { + this.createdComponent(); + }, + + computed: { + scheduledRepository() { + return this.repositoryFactory.create('scheduled_task'); + }, + + columns() { + return [ + { + property: 'name', + label: 'frosh-tools.name', + rawData: true, + primary: true, + }, + { + property: 'runInterval', + label: 'frosh-tools.interval', + rawData: true, + inlineEdit: 'number', + }, + { + property: 'lastExecutionTime', + label: 'frosh-tools.lastExecutionTime', + rawData: true, + }, + { + property: 'nextExecutionTime', + label: 'frosh-tools.nextExecutionTime', + rawData: true, + inlineEdit: 'datetime', + }, + { + property: 'status', + label: 'frosh-tools.status', + rawData: true, + }, + ]; + }, + + date() { + return Shopware.Filter.getByName('date'); + }, + }, + + methods: { + async refresh() { + this.isLoading = true; + await this.createdComponent(); + }, + + async createdComponent() { + const criteria = new Criteria(this.page, this.limit); + criteria.addSorting(Criteria.sort('nextExecutionTime', 'ASC')); + this.items = await this.scheduledRepository.search( + criteria, + Shopware.Context.api, + ); + this.isLoading = false; + }, + + async runTask(item) { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$tc('frosh-tools.scheduledTaskStarted', 0, { + name: item.name, + }), + }); + await this.froshToolsService.runScheduledTask(item.id); + this.createNotificationSuccess({ + message: this.$tc('frosh-tools.scheduledTaskSucceed', 0, { + name: item.name, + }), + }); + } catch (e) { + this.createNotificationError({ + message: this.$tc('frosh-tools.scheduledTaskFailed', 0, { + name: item.name, + }), + }); + + this.taskError = e.response.data; + } + + this.createdComponent(); + }, + + async scheduleTask(item, immediately = false) { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$t('frosh-tools.scheduledTaskScheduleStarted', { + name: item.name, + }), + }); + await this.froshToolsService.scheduleScheduledTask( + item.id, + immediately, + ); + this.createNotificationSuccess({ + message: this.$t('frosh-tools.scheduledTaskScheduleSucceed', { + name: item.name, + }), + }); + } catch (e) { + this.createNotificationError({ + message: this.$t('frosh-tools.scheduledTaskScheduleFailed', { + name: item.name, + }), + }); + + this.taskError = e.response.data; + } + + this.createdComponent(); + }, + + async registerScheduledTasks() { + this.isLoading = true; + + try { + this.createNotificationInfo({ + message: this.$tc('frosh-tools.scheduledTasksRegisterStarted'), + }); + await this.froshToolsService.scheduledTasksRegister(); + this.createNotificationSuccess({ + message: this.$tc('frosh-tools.scheduledTasksRegisterSucceed'), + }); + } catch (err) { + console.error(err); + + this.createNotificationError({ + message: this.$tc('frosh-tools.scheduledTasksRegisterFailed'), + }); + } + + this.createdComponent(); + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js index 23a5f2e3..4a6acece 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-tab-state-machines/index.js @@ -4,47 +4,47 @@ import template from './template.html.twig'; const { Component, Mixin } = Shopware; Component.register('frosh-tools-tab-state-machines', { - template, - - inject: ['froshToolsService'], - - mixins: [Mixin.getByName('notification')], - - data() { - return { - selectedStateMachine: null, - image: null, - isLoading: true, - }; - }, - - created() { - this.createdComponent(); - }, - - methods: { - createdComponent() { - this.isLoading = false; - }, - - async onStateMachineChange(stateMachineChangeId) { - if (!stateMachineChangeId) { - return; - } - - const response = - await this.froshToolsService.stateMachines(stateMachineChangeId); - - const elem = document.getElementById('state_machine'); - if ('svg' in response) { - this.image = response.svg; - elem.src = this.image; - elem.style.opacity = '1'; - elem.style.width = '100%'; - elem.style.height = 'auto'; - } else { - elem.style.opacity = '0'; - } - }, - }, + template, + + inject: ['froshToolsService'], + + mixins: [Mixin.getByName('notification')], + + data() { + return { + selectedStateMachine: null, + image: null, + isLoading: true, + }; + }, + + created() { + this.createdComponent(); + }, + + methods: { + createdComponent() { + this.isLoading = false; + }, + + async onStateMachineChange(stateMachineChangeId) { + if (!stateMachineChangeId) { + return; + } + + const response = + await this.froshToolsService.stateMachines(stateMachineChangeId); + + const elem = document.getElementById('state_machine'); + if ('svg' in response) { + this.image = response.svg; + elem.src = this.image; + elem.style.opacity = '1'; + elem.style.width = '100%'; + elem.style.height = 'auto'; + } else { + elem.style.opacity = '0'; + } + }, + }, }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/index.js b/src/Resources/app/administration/src/module/frosh-tools/index.js index 2529be5d..3bd29612 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/index.js @@ -10,95 +10,95 @@ import './page/index'; import './acl'; Shopware.Module.register('frosh-tools', { - type: 'plugin', - name: 'frosh-tools.title', - title: 'frosh-tools.title', - description: '', - color: '#303A4F', + type: 'plugin', + name: 'frosh-tools.title', + title: 'frosh-tools.title', + description: '', + color: '#303A4F', - icon: 'regular-cog', + icon: 'regular-cog', - routes: { - index: { - component: 'frosh-tools-index', - path: 'index', - children: { - index: { - component: 'frosh-tools-tab-index', - path: 'index', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - cache: { - component: 'frosh-tools-tab-cache', - path: 'cache', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - queue: { - component: 'frosh-tools-tab-queue', - path: 'queue', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - scheduled: { - component: 'frosh-tools-tab-scheduled', - path: 'scheduled', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - elasticsearch: { - component: 'frosh-tools-tab-elasticsearch', - path: 'elasticsearch', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - logs: { - component: 'frosh-tools-tab-logs', - path: 'logs', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - files: { - component: 'frosh-tools-tab-files', - path: 'files', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - statemachines: { - component: 'frosh-tools-tab-state-machines', - path: 'state-machines', - meta: { - privilege: 'frosh_tools:read', - parentPath: 'sw.settings.index.plugins', - }, - }, - }, - }, - }, + routes: { + index: { + component: 'frosh-tools-index', + path: 'index', + children: { + index: { + component: 'frosh-tools-tab-index', + path: 'index', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + cache: { + component: 'frosh-tools-tab-cache', + path: 'cache', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + queue: { + component: 'frosh-tools-tab-queue', + path: 'queue', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + scheduled: { + component: 'frosh-tools-tab-scheduled', + path: 'scheduled', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + elasticsearch: { + component: 'frosh-tools-tab-elasticsearch', + path: 'elasticsearch', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + logs: { + component: 'frosh-tools-tab-logs', + path: 'logs', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + files: { + component: 'frosh-tools-tab-files', + path: 'files', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + statemachines: { + component: 'frosh-tools-tab-state-machines', + path: 'state-machines', + meta: { + privilege: 'frosh_tools:read', + parentPath: 'sw.settings.index.plugins', + }, + }, + }, + }, + }, - settingsItem: [ - { - group: 'plugins', - to: 'frosh.tools.index.cache', - icon: 'regular-cog', - name: 'frosh-tools', - label: 'frosh-tools.title', - privilege: 'frosh_tools:read', - }, - ], + settingsItem: [ + { + group: 'plugins', + to: 'frosh.tools.index.cache', + icon: 'regular-cog', + name: 'frosh-tools', + label: 'frosh-tools.title', + privilege: 'frosh_tools:read', + }, + ], }); diff --git a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js index 6603765e..ac37a2e3 100644 --- a/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js +++ b/src/Resources/app/administration/src/module/frosh-tools/page/index/index.js @@ -4,14 +4,14 @@ import template from './template.twig'; const { Component } = Shopware; Component.register('frosh-tools-index', { - template, + template, - computed: { - elasticsearchAvailable() { - return ( - Shopware.State.get('context').app.config.settings - ?.elasticsearchEnabled || false - ); - }, - }, + computed: { + elasticsearchAvailable() { + return ( + Shopware.State.get('context').app.config.settings + ?.elasticsearchEnabled || false + ); + }, + }, }); 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 43900aad..611b94ab 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 @@ -1,112 +1,112 @@ { - "frosh-tools": { - "title": "Tools", - "tabs": { - "index": { - "title": "System-Status", - "performance": "Performance Empfehlungen" - }, - "systemInfo": { - "title": "System-Info" - }, - "cache": { - "title": "Cache" - }, - "scheduledTaskOverview": { - "title": "Geplante Aufgaben" - }, - "queue": { - "title": "Warteschlange", - "reset": { - "modal": { - "title": "Warteschlange zurücksetzen", - "description": "Durch das Zurücksetzen der Warteschlange werden alle ausgehenden Aufgaben entfernt.", - "reset": "Zurücksetzen" - }, - "success": "Die Warteschlange wurde geleert" - } - }, - "elasticsearch": { - "title": "Elasticsearch" - }, - "logs": { - "title": "Log viewer", - "logFileSelect": { - "placeholder": "Datei auswählen" - } - }, - "files": { - "title": "Shopware Dateien Checker", - "allFilesOk": "Alle Dateien entsprechen den Originalen, es wurden keine Manipulationen erkannt", - "notOk": "Es gibt Dateien, die manipuliert wurden", - "openOriginal": "Öffne Originaldatei auf GitHub", - "restore": { - "diff": "Vergleiche Datei mit Original", - "restoreFile": "Datei wiederherstellen" - }, - "expectedAll": "Datei wurde manipuliert", - "expectedProject": "Datei wurde manipuliert, Fehler wird ignoriert durch Projekt Konfiguration" - }, - "state-machines": { - "title": "State Machine Viewer", - "label": "State Machine", - "helpText": "Wähle eine State Machine. Das Bild wird mit Hilfe der plantuml.com API generiert. Dafür ist es notwendig, dass der Server auf plantuml.com zugreifen darf und nicht etwa von einer Firewall blockiert wird.", - "orderTitle": "Bestellstatus", - "transactionTitle": "Bezahlstatus", - "deliveryTitle": "Versandstatus" - } - }, - "clear": "Leeren", - "status": "Status", - "name": "Name", - "good": "Gut", - "warning": "Warnung", - "error": "Fehler", - "info": "Info", - "active": "Aktiv", - "used": "Belegt", - "free": "Frei", - "compileTheme": "Theme kompilieren", - "themeCompiled": "Theme wurde kompiliert", - "actions": "Aktionen", - "scheduledTasks": "Geplante Aufgaben", - "interval": "Intervall", - "lastExecutionTime": "letzte Ausführung", - "nextExecutionTime": "nächste Ausführung", - "runManually": "starte manuell", - "scheduledTaskStarted": "Die geplante Aufgabe für \"{name}\" wurde gestartet", - "scheduledTaskSucceed": "Die geplante Aufgabe für \"{name}\" war erfolgreich", - "scheduledTaskFailed": "Die geplante Aufgabe für \"{name}\" ist fehlgeschlagen", - "setToScheduled": "auf geplant setzen", - "setToScheduledImmediately": "auf sofort geplant setzen", - "scheduledTaskScheduleStarted": "Die geplante Aufgabe für \"{name}\" wird auf geplant gesetzt", - "scheduledTaskScheduleSucceed": "Die geplante Aufgabe für \"{name}\" wurde auf geplant gesetzt", - "scheduledTaskScheduleFailed": "Die geplante Aufgabe für \"{name}\" konnte nicht auf geplant gesetzt werden", - "scheduledTasksRegisterStarted": "Registriere geplante Aufgaben", - "scheduledTasksRegisterSucceed": "Geplante Aufgaben registriert", - "scheduledTasksRegisterFailed": "Es ist ein Fehler beim Registrieren aufgetreten", - "size": "Größe", - "docs": "Dokumente", - "delete": "Löschen", - "resetQueue": "Warteschlange zurücksetzen", - "date": "Zeitpunkt", - "channel": "Kanal", - "level": "Level", - "message": "Nachricht", - "current": "aktuell", - "recommended": "empfohlen", - "noRecommendations": "Keine Empfehlungen", - "chooseStateMachine": "Wähle eine State Machine...", - "order": "Bestellung", - "transaction": "Bezahlung", - "delivery": "Versand" - }, - "sw-privileges": { - "additional_permissions": { - "frosh_tools": { - "frosh_tools": "Überwachung anzeigen", - "label": "Frosh tools" - } - } - } + "frosh-tools": { + "title": "Tools", + "tabs": { + "index": { + "title": "System-Status", + "performance": "Performance Empfehlungen" + }, + "systemInfo": { + "title": "System-Info" + }, + "cache": { + "title": "Cache" + }, + "scheduledTaskOverview": { + "title": "Geplante Aufgaben" + }, + "queue": { + "title": "Warteschlange", + "reset": { + "modal": { + "title": "Warteschlange zurücksetzen", + "description": "Durch das Zurücksetzen der Warteschlange werden alle ausgehenden Aufgaben entfernt.", + "reset": "Zurücksetzen" + }, + "success": "Die Warteschlange wurde geleert" + } + }, + "elasticsearch": { + "title": "Elasticsearch" + }, + "logs": { + "title": "Log viewer", + "logFileSelect": { + "placeholder": "Datei auswählen" + } + }, + "files": { + "title": "Shopware Dateien Checker", + "allFilesOk": "Alle Dateien entsprechen den Originalen, es wurden keine Manipulationen erkannt", + "notOk": "Es gibt Dateien, die manipuliert wurden", + "openOriginal": "Öffne Originaldatei auf GitHub", + "restore": { + "diff": "Vergleiche Datei mit Original", + "restoreFile": "Datei wiederherstellen" + }, + "expectedAll": "Datei wurde manipuliert", + "expectedProject": "Datei wurde manipuliert, Fehler wird ignoriert durch Projekt Konfiguration" + }, + "state-machines": { + "title": "State Machine Viewer", + "label": "State Machine", + "helpText": "Wähle eine State Machine. Das Bild wird mit Hilfe der plantuml.com API generiert. Dafür ist es notwendig, dass der Server auf plantuml.com zugreifen darf und nicht etwa von einer Firewall blockiert wird.", + "orderTitle": "Bestellstatus", + "transactionTitle": "Bezahlstatus", + "deliveryTitle": "Versandstatus" + } + }, + "clear": "Leeren", + "status": "Status", + "name": "Name", + "good": "Gut", + "warning": "Warnung", + "error": "Fehler", + "info": "Info", + "active": "Aktiv", + "used": "Belegt", + "free": "Frei", + "compileTheme": "Theme kompilieren", + "themeCompiled": "Theme wurde kompiliert", + "actions": "Aktionen", + "scheduledTasks": "Geplante Aufgaben", + "interval": "Intervall", + "lastExecutionTime": "letzte Ausführung", + "nextExecutionTime": "nächste Ausführung", + "runManually": "starte manuell", + "scheduledTaskStarted": "Die geplante Aufgabe für \"{name}\" wurde gestartet", + "scheduledTaskSucceed": "Die geplante Aufgabe für \"{name}\" war erfolgreich", + "scheduledTaskFailed": "Die geplante Aufgabe für \"{name}\" ist fehlgeschlagen", + "setToScheduled": "auf geplant setzen", + "setToScheduledImmediately": "auf sofort geplant setzen", + "scheduledTaskScheduleStarted": "Die geplante Aufgabe für \"{name}\" wird auf geplant gesetzt", + "scheduledTaskScheduleSucceed": "Die geplante Aufgabe für \"{name}\" wurde auf geplant gesetzt", + "scheduledTaskScheduleFailed": "Die geplante Aufgabe für \"{name}\" konnte nicht auf geplant gesetzt werden", + "scheduledTasksRegisterStarted": "Registriere geplante Aufgaben", + "scheduledTasksRegisterSucceed": "Geplante Aufgaben registriert", + "scheduledTasksRegisterFailed": "Es ist ein Fehler beim Registrieren aufgetreten", + "size": "Größe", + "docs": "Dokumente", + "delete": "Löschen", + "resetQueue": "Warteschlange zurücksetzen", + "date": "Zeitpunkt", + "channel": "Kanal", + "level": "Level", + "message": "Nachricht", + "current": "aktuell", + "recommended": "empfohlen", + "noRecommendations": "Keine Empfehlungen", + "chooseStateMachine": "Wähle eine State Machine...", + "order": "Bestellung", + "transaction": "Bezahlung", + "delivery": "Versand" + }, + "sw-privileges": { + "additional_permissions": { + "frosh_tools": { + "frosh_tools": "Überwachung anzeigen", + "label": "Frosh tools" + } + } + } } 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 6a0ebacd..19ce8c5b 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 @@ -1,112 +1,112 @@ { - "frosh-tools": { - "title": "Tools", - "tabs": { - "index": { - "title": "System Status", - "performance": "Performance recommendations" - }, - "systemInfo": { - "title": "System Info" - }, - "cache": { - "title": "Cache" - }, - "scheduledTaskOverview": { - "title": "Scheduled Tasks Manager" - }, - "queue": { - "title": "Queue Manager", - "reset": { - "modal": { - "title": "Reset Queue", - "description": "Resetting Queue will remove all outgoing tasks.", - "reset": "Reset" - }, - "success": "The queue has been cleared" - } - }, - "elasticsearch": { - "title": "Elasticsearch Manager" - }, - "logs": { - "title": "Log viewer", - "logFileSelect": { - "placeholder": "Choose file" - } - }, - "files": { - "title": "Shopware file checker", - "allFilesOk": "No files modified", - "notOk": "There are modified files", - "openOriginal": "Open original file on GitHub", - "restore": { - "diff": "Diff file with original", - "restoreFile": "Restore file" - }, - "expectedAll": "File has been modified", - "expectedProject": "File has been modified, but will be ignored by project settings" - }, - "state-machines": { - "title": "State Machine Viewer", - "label": "State Machine", - "helpText": "Choose a state machine. The image is generated by the plantuml.com API. Therefore it's necessary that your server has access to plantuml.com and is exempt from Firewall rules.", - "orderTitle": "Order status", - "transactionTitle": "Transaction status", - "deliveryTitle": "Delivery status" - } - }, - "clear": "Clear", - "status": "Status", - "name": "Name", - "good": "Good", - "warning": "Warning", - "error": "Error", - "info": "Info", - "active": "Active", - "used": "Used", - "free": "Free", - "compileTheme": "Compile theme", - "themeCompiled": "Theme were compiled", - "actions": "Actions", - "scheduledTasks": "Scheduled Tasks", - "interval": "Interval", - "lastExecutionTime": "last execution", - "nextExecutionTime": "next execution", - "runManually": "start manually", - "scheduledTaskStarted": "The scheduled task execution for \"{name}\" started", - "scheduledTaskSucceed": "The scheduled task execution for \"{name}\" succeed", - "scheduledTaskFailed": "The scheduled task execution for \"{name}\" failed", - "setToScheduled": "Set task status to scheduled", - "setToScheduledImmediately": "Set task status to scheduled immediately", - "scheduledTaskScheduleStarted": "The scheduled task for \"{name}\" is being scheduled", - "scheduledTaskScheduleSucceed": "The scheduled task for \"{name}\" has been scheduled", - "scheduledTaskScheduleFailed": "The scheduled task for \"{name}\" could not be scheduled", - "scheduledTasksRegisterStarted": "Register scheduled tasks", - "scheduledTasksRegisterSucceed": "Scheduled tasks registered", - "scheduledTasksRegisterFailed": "Scheduled tasks registration failed", - "size": "Size", - "docs": "Documents", - "delete": "Delete", - "resetQueue": "Reset Queue", - "date": "Date", - "channel": "Channel", - "level": "Level", - "message": "Message", - "current": "current", - "recommended": "recommended", - "noRecommendations": "No recommendations", - "chooseStateMachine": "Choose a State Machine...", - "order": "Order", - "transaction": "Payment", - "delivery": "Delivery" - }, - "sw-privileges": { - "additional_permissions": { - "frosh_tools": { - "frosh_tools": "View monitoring", - "label": "Frosh tools" - } - } - } + "frosh-tools": { + "title": "Tools", + "tabs": { + "index": { + "title": "System Status", + "performance": "Performance recommendations" + }, + "systemInfo": { + "title": "System Info" + }, + "cache": { + "title": "Cache" + }, + "scheduledTaskOverview": { + "title": "Scheduled Tasks Manager" + }, + "queue": { + "title": "Queue Manager", + "reset": { + "modal": { + "title": "Reset Queue", + "description": "Resetting Queue will remove all outgoing tasks.", + "reset": "Reset" + }, + "success": "The queue has been cleared" + } + }, + "elasticsearch": { + "title": "Elasticsearch Manager" + }, + "logs": { + "title": "Log viewer", + "logFileSelect": { + "placeholder": "Choose file" + } + }, + "files": { + "title": "Shopware file checker", + "allFilesOk": "No files modified", + "notOk": "There are modified files", + "openOriginal": "Open original file on GitHub", + "restore": { + "diff": "Diff file with original", + "restoreFile": "Restore file" + }, + "expectedAll": "File has been modified", + "expectedProject": "File has been modified, but will be ignored by project settings" + }, + "state-machines": { + "title": "State Machine Viewer", + "label": "State Machine", + "helpText": "Choose a state machine. The image is generated by the plantuml.com API. Therefore it's necessary that your server has access to plantuml.com and is exempt from Firewall rules.", + "orderTitle": "Order status", + "transactionTitle": "Transaction status", + "deliveryTitle": "Delivery status" + } + }, + "clear": "Clear", + "status": "Status", + "name": "Name", + "good": "Good", + "warning": "Warning", + "error": "Error", + "info": "Info", + "active": "Active", + "used": "Used", + "free": "Free", + "compileTheme": "Compile theme", + "themeCompiled": "Theme were compiled", + "actions": "Actions", + "scheduledTasks": "Scheduled Tasks", + "interval": "Interval", + "lastExecutionTime": "last execution", + "nextExecutionTime": "next execution", + "runManually": "start manually", + "scheduledTaskStarted": "The scheduled task execution for \"{name}\" started", + "scheduledTaskSucceed": "The scheduled task execution for \"{name}\" succeed", + "scheduledTaskFailed": "The scheduled task execution for \"{name}\" failed", + "setToScheduled": "Set task status to scheduled", + "setToScheduledImmediately": "Set task status to scheduled immediately", + "scheduledTaskScheduleStarted": "The scheduled task for \"{name}\" is being scheduled", + "scheduledTaskScheduleSucceed": "The scheduled task for \"{name}\" has been scheduled", + "scheduledTaskScheduleFailed": "The scheduled task for \"{name}\" could not be scheduled", + "scheduledTasksRegisterStarted": "Register scheduled tasks", + "scheduledTasksRegisterSucceed": "Scheduled tasks registered", + "scheduledTasksRegisterFailed": "Scheduled tasks registration failed", + "size": "Size", + "docs": "Documents", + "delete": "Delete", + "resetQueue": "Reset Queue", + "date": "Date", + "channel": "Channel", + "level": "Level", + "message": "Message", + "current": "current", + "recommended": "recommended", + "noRecommendations": "No recommendations", + "chooseStateMachine": "Choose a State Machine...", + "order": "Order", + "transaction": "Payment", + "delivery": "Delivery" + }, + "sw-privileges": { + "additional_permissions": { + "frosh_tools": { + "frosh_tools": "View monitoring", + "label": "Frosh tools" + } + } + } } diff --git a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js index 88c53045..d534b07d 100644 --- a/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js +++ b/src/Resources/app/administration/src/overrides/sw-data-grid-inline-edit/index.js @@ -3,5 +3,5 @@ import template from './template.twig'; const { Component } = Shopware; Component.override('sw-data-grid-inline-edit', { - template, + template, }); diff --git a/src/Resources/app/administration/src/overrides/sw-version/index.js b/src/Resources/app/administration/src/overrides/sw-version/index.js index a6fb69a4..6b93cd71 100644 --- a/src/Resources/app/administration/src/overrides/sw-version/index.js +++ b/src/Resources/app/administration/src/overrides/sw-version/index.js @@ -3,84 +3,84 @@ import template from './template.twig'; const { Component } = Shopware; Component.override('sw-version', { - template, - inject: ['froshToolsService', 'acl', 'loginService'], - - async created() { - if (!this.checkPermission()) { - return; - } - - await this.checkHealth(); - }, - - data() { - return { - health: null, - hasPermission: false, - }; - }, - - computed: { - healthVariant() { - let variant = 'success'; - - for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - variant = 'error'; - continue; - } - - if (health.state === 'STATE_WARNING' && variant === 'success') { - variant = 'warning'; - } - } - - return variant; - }, - - healthPlaceholder() { - let msg = 'Shop Status: Ok'; - - if (this.health === null) { - return msg; - } - - for (let health of this.health) { - if (health.state === 'STATE_ERROR') { - msg = 'Shop Status: May outage, Check System Status'; - continue; - } - - if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { - msg = 'Shop Status: Issues, Check System Status'; - } - } - - return msg; - }, - }, - - methods: { - async checkHealth() { - this.health = await this.froshToolsService.healthStatus(true); - - this.checkInterval = setInterval(async () => { - try { - this.health = await this.froshToolsService.healthStatus(true); - } catch (e) { - console.error(e); - clearInterval(this.checkInterval); - } - }, 60000); - - this.loginService.addOnLogoutListener(() => - clearInterval(this.checkInterval), - ); - }, - - checkPermission() { - return (this.hasPermission = this.acl.can('frosh_tools:read')); - }, - }, + template, + inject: ['froshToolsService', 'acl', 'loginService'], + + async created() { + if (!this.checkPermission()) { + return; + } + + await this.checkHealth(); + }, + + data() { + return { + health: null, + hasPermission: false, + }; + }, + + computed: { + healthVariant() { + let variant = 'success'; + + for (let health of this.health) { + if (health.state === 'STATE_ERROR') { + variant = 'error'; + continue; + } + + if (health.state === 'STATE_WARNING' && variant === 'success') { + variant = 'warning'; + } + } + + return variant; + }, + + healthPlaceholder() { + let msg = 'Shop Status: Ok'; + + if (this.health === null) { + return msg; + } + + for (let health of this.health) { + if (health.state === 'STATE_ERROR') { + msg = 'Shop Status: May outage, Check System Status'; + continue; + } + + if (health.state === 'STATE_WARNING' && msg === 'Shop Status: Ok') { + msg = 'Shop Status: Issues, Check System Status'; + } + } + + return msg; + }, + }, + + methods: { + async checkHealth() { + this.health = await this.froshToolsService.healthStatus(true); + + this.checkInterval = setInterval(async () => { + try { + this.health = await this.froshToolsService.healthStatus(true); + } catch (e) { + console.error(e); + clearInterval(this.checkInterval); + } + }, 60000); + + this.loginService.addOnLogoutListener(() => + clearInterval(this.checkInterval), + ); + }, + + checkPermission() { + return (this.hasPermission = this.acl.can('frosh_tools:read')); + }, + }, }); From 8a685691f5a6cf3881d5a724d34f08848e02eb19 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 11:06:07 +0100 Subject: [PATCH 09/11] chore: format all files --- .devcontainer.json | 32 +++++++------- composer.json | 94 ++++++++++++++++++++--------------------- frosh-tools-schema.json | 62 +++++++++++++-------------- 3 files changed, 94 insertions(+), 94 deletions(-) diff --git a/.devcontainer.json b/.devcontainer.json index f89a8023..02d23710 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,18 +1,18 @@ { - "image": "ghcr.io/shopwarelabs/devcontainer/symfony-flex:6.6.8-8.3", - "workspaceFolder": "/var/www/html", - "overrideCommand": false, - "updateRemoteUserUID": false, - "forwardPorts": [8000], - "portsAttributes": { - "8000": { - "label": "Shopware", - "onAutoForward": "notify" - }, - "8080": { - "label": "Administration Watcher", - "onAutoForward": "notify" - } - }, - "onCreateCommand": "install-activate-plugin" + "image": "ghcr.io/shopwarelabs/devcontainer/symfony-flex:6.6.8-8.3", + "workspaceFolder": "/var/www/html", + "overrideCommand": false, + "updateRemoteUserUID": false, + "forwardPorts": [8000], + "portsAttributes": { + "8000": { + "label": "Shopware", + "onAutoForward": "notify" + }, + "8080": { + "label": "Administration Watcher", + "onAutoForward": "notify" + } + }, + "onCreateCommand": "install-activate-plugin" } diff --git a/composer.json b/composer.json index 6fd3b883..fa8b269f 100644 --- a/composer.json +++ b/composer.json @@ -1,49 +1,49 @@ { - "name": "frosh/tools", - "version": "2.6.0", - "description": "Provides some basic things for managing the Shopware Installation", - "type": "shopware-platform-plugin", - "license": "MIT", - "autoload": { - "psr-4": { - "Frosh\\Tools\\": "src/" - } - }, - "authors": [ - { - "name": "FriendsOfShopware", - "homepage": "https://friendsofshopware.com" - } - ], - "extra": { - "shopware-plugin-class": "Frosh\\Tools\\FroshTools", - "label": { - "de-DE": "Tools", - "en-GB": "Tools" - }, - "description": { - "de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.", - "en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status." - }, - "manufacturerLink": { - "de-DE": "https://github.com/FriendsOfShopware/FroshTools", - "en-GB": "https://github.com/FriendsOfShopware/FroshTools" - }, - "supportLink": { - "de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues", - "en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues" - } - }, - "require": { - "shopware/core": "~6.6.0" - }, - "config": { - "allow-plugins": { - "symfony/runtime": true - } - }, - "scripts": { - "format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext", - "check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext" - } + "name": "frosh/tools", + "version": "2.6.0", + "description": "Provides some basic things for managing the Shopware Installation", + "type": "shopware-platform-plugin", + "license": "MIT", + "autoload": { + "psr-4": { + "Frosh\\Tools\\": "src/" + } + }, + "authors": [ + { + "name": "FriendsOfShopware", + "homepage": "https://friendsofshopware.com" + } + ], + "extra": { + "shopware-plugin-class": "Frosh\\Tools\\FroshTools", + "label": { + "de-DE": "Tools", + "en-GB": "Tools" + }, + "description": { + "de-DE": "Die kostenlose Shopware 6 App beinhaltet mehrere Werkzeuge um den Shop besser zu verwalten. Optimierter Cache Manager, Log Viewer um die Logeinträge zu sehen oder Tasks auszuführen.", + "en-GB": "The free Shopware 6 app include several tools to manage the store much better like a cache manager, log viewer to see the log entries, run the tasks or see the system status." + }, + "manufacturerLink": { + "de-DE": "https://github.com/FriendsOfShopware/FroshTools", + "en-GB": "https://github.com/FriendsOfShopware/FroshTools" + }, + "supportLink": { + "de-DE": "https://github.com/FriendsOfShopware/FroshTools/issues", + "en-GB": "https://github.com/FriendsOfShopware/FroshTools/issues" + } + }, + "require": { + "shopware/core": "~6.6.0" + }, + "config": { + "allow-plugins": { + "symfony/runtime": true + } + }, + "scripts": { + "format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext", + "check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext" + } } diff --git a/frosh-tools-schema.json b/frosh-tools-schema.json index 5dd515f9..f67b8eb7 100644 --- a/frosh-tools-schema.json +++ b/frosh-tools-schema.json @@ -1,33 +1,33 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "Configuration for FroshTools", - "$ref": "#/definitions/root", - "definitions": { - "root": { - "type": "object", - "properties": { - "frosh_tools": { - "$ref": "#/definitions/frosh_tools" - } - }, - "additionalProperties": false - }, - "frosh_tools": { - "type": "object", - "properties": { - "file_checker": { - "title": "File checker allow-list", - "type": "array", - "items": { - "type": "string" - } - }, - "system_config": { - "type": "object", - "additionalProperties": true - } - }, - "additionalProperties": false - } - } + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Configuration for FroshTools", + "$ref": "#/definitions/root", + "definitions": { + "root": { + "type": "object", + "properties": { + "frosh_tools": { + "$ref": "#/definitions/frosh_tools" + } + }, + "additionalProperties": false + }, + "frosh_tools": { + "type": "object", + "properties": { + "file_checker": { + "title": "File checker allow-list", + "type": "array", + "items": { + "type": "string" + } + }, + "system_config": { + "type": "object", + "additionalProperties": true + } + }, + "additionalProperties": false + } + } } From bed7e03d786ef92bce450f044294fa94c0f1d059 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 17 Feb 2025 11:27:40 +0100 Subject: [PATCH 10/11] chore: format all files --- src/Command/EnvGetCommand.php | 2 +- src/Components/CacheHelper.php | 2 +- src/Components/CacheRegistry.php | 2 +- .../AdminInfoSubscriberEventListener.php | 1 + src/Components/Environment/EnvironmentManager.php | 2 +- .../Health/Checker/HealthChecker/MysqlChecker.php | 2 +- .../Health/Checker/HealthChecker/PhpChecker.php | 2 +- .../Checker/HealthChecker/SwagSecurityChecker.php | 11 +++++------ .../PerformanceChecker/CompressionMethodChecker.php | 4 ++-- .../PerformanceChecker/FineGrainedCachingChecker.php | 2 +- .../PerformanceChecker/MysqlSettingsChecker.php | 2 +- .../PerformanceChecker/QueueConnectionChecker.php | 2 +- src/Components/LineReader.php | 8 ++++---- .../SystemConfig/ConfigSystemConfigLoader.php | 4 ++-- src/Controller/ShopwareFilesController.php | 8 ++++---- src/Controller/StateMachineController.php | 4 ++-- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Command/EnvGetCommand.php b/src/Command/EnvGetCommand.php index 09c733d8..eb6e42dd 100644 --- a/src/Command/EnvGetCommand.php +++ b/src/Command/EnvGetCommand.php @@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $var = $file->get($variable); if (!$var instanceof EnvironmentKeyValue) { - throw new \RuntimeException(sprintf('Cannot find variable with name: %s', $variable)); + throw new \RuntimeException(\sprintf('Cannot find variable with name: %s', $variable)); } if ($mode === 'json') { diff --git a/src/Components/CacheHelper.php b/src/Components/CacheHelper.php index 2cd0133f..120a71b2 100644 --- a/src/Components/CacheHelper.php +++ b/src/Components/CacheHelper.php @@ -31,7 +31,7 @@ public static function removeDir(string $path): void $blankDir = sys_get_temp_dir() . '/' . uniqid() . '/'; if (!mkdir($blankDir, 0o755, true) && !is_dir($blankDir)) { - throw new \RuntimeException(sprintf('Directory "%s" was not created', $blankDir)); + throw new \RuntimeException(\sprintf('Directory "%s" was not created', $blankDir)); } $process = new Process(['rsync', '-qa', '--delete', $blankDir, $path . '/']); diff --git a/src/Components/CacheRegistry.php b/src/Components/CacheRegistry.php index 5c67fc35..6ec0dd1e 100644 --- a/src/Components/CacheRegistry.php +++ b/src/Components/CacheRegistry.php @@ -27,7 +27,7 @@ public function all(): array public function get(string $name): CacheAdapter { if (!isset($this->adapters[$name])) { - throw new \OutOfBoundsException(sprintf('Cannot find adapter by name %s', $name)); + throw new \OutOfBoundsException(\sprintf('Cannot find adapter by name %s', $name)); } return $this->adapters[$name]; diff --git a/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php b/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php index 584df6dc..eb9932c4 100644 --- a/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php +++ b/src/Components/Elasticsearch/AdminInfoSubscriberEventListener.php @@ -16,6 +16,7 @@ public function __construct( private bool $elasticsearchEnabled, ) { } + public function __invoke(ResponseEvent $event): void { if ($event->getRequest()->attributes->get('_route') !== 'api.info.config') { diff --git a/src/Components/Environment/EnvironmentManager.php b/src/Components/Environment/EnvironmentManager.php index b10dc07c..8923125f 100644 --- a/src/Components/Environment/EnvironmentManager.php +++ b/src/Components/Environment/EnvironmentManager.php @@ -10,7 +10,7 @@ public function read(string $path): EnvironmentFile { $content = file_get_contents($path); if ($content === false) { - throw new \RuntimeException(sprintf('Cannot read file %s', $path)); + throw new \RuntimeException(\sprintf('Cannot read file %s', $path)); } /** @var array $lines */ diff --git a/src/Components/Health/Checker/HealthChecker/MysqlChecker.php b/src/Components/Health/Checker/HealthChecker/MysqlChecker.php index 06f9b1fb..715a3e40 100644 --- a/src/Components/Health/Checker/HealthChecker/MysqlChecker.php +++ b/src/Components/Health/Checker/HealthChecker/MysqlChecker.php @@ -119,7 +119,7 @@ private static function getVersionNumber(string $versionString): string $versionString, $versionParts, )) { - throw new \RuntimeException(sprintf('Invalid version string: %s', $versionString)); + throw new \RuntimeException(\sprintf('Invalid version string: %s', $versionString)); } return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; diff --git a/src/Components/Health/Checker/HealthChecker/PhpChecker.php b/src/Components/Health/Checker/HealthChecker/PhpChecker.php index 842fe479..44403521 100644 --- a/src/Components/Health/Checker/HealthChecker/PhpChecker.php +++ b/src/Components/Health/Checker/HealthChecker/PhpChecker.php @@ -134,7 +134,7 @@ private function checkPcreJitActive(HealthCollection $collection): void private function parseQuantity(string $val): float { - //TODO: remove condition and own calculation when min php version is 8.2 + // TODO: remove condition and own calculation when min php version is 8.2 if (\function_exists('ini_parse_quantity')) { return (float) \ini_parse_quantity($val); } diff --git a/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php b/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php index 94fc2ead..af6a4c9f 100644 --- a/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php +++ b/src/Components/Health/Checker/HealthChecker/SwagSecurityChecker.php @@ -9,11 +9,11 @@ use Frosh\Tools\Components\Health\HealthCollection; use Frosh\Tools\Components\Health\SettingsResult; use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Contracts\Cache\CacheInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Contracts\Cache\CacheInterface; use Symfony\Contracts\Cache\ItemInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; @@ -67,7 +67,7 @@ private function hasSecurityAdvisories(): bool throw new \RuntimeException('Could not fetch security.json'); } - $data = \json_decode(trim($securityJson), true, 512, JSON_THROW_ON_ERROR); + $data = \json_decode(trim($securityJson), true, 512, \JSON_THROW_ON_ERROR); if (!\is_array($data)) { throw new \RuntimeException('Could not read security.json'); @@ -124,7 +124,6 @@ private function determineSecurityIssue(HealthCollection $collection): void private function determineEolSupport(HealthCollection $collection): void { - $id = 'security-eol-shopware'; $snippet = 'Security updates'; @@ -223,7 +222,7 @@ private function getReleasesSupport(): array throw new \RuntimeException('Could not fetch releases.json'); } - $data = \json_decode(trim($releasesJson), true, 512, JSON_THROW_ON_ERROR); + $data = \json_decode(trim($releasesJson), true, 512, \JSON_THROW_ON_ERROR); if (!\is_array($data)) { throw new \RuntimeException('Could not read releases.json'); @@ -239,11 +238,11 @@ private function getReleasesSupport(): array } if (!empty($entry['extended_eol']) - && version_compare($entry['version'], ($result['extended_eol_version'] ?? ''), '>')) { + && version_compare($entry['version'], $result['extended_eol_version'] ?? '', '>')) { $result['extended_eol_version'] = $entry['version']; } - if (version_compare($entry['version'], ($result['version'] ?? ''), '>') + if (version_compare($entry['version'], $result['version'] ?? '', '>') && version_compare($entry['version'], $this->shopwareVersion, '<=')) { $result = [...$result, ...$entry]; } diff --git a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php index 31848ec8..b9306913 100644 --- a/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/CompressionMethodChecker.php @@ -1,4 +1,4 @@ -add( SettingsResult::error( strtolower($functionality) . '-compression-method-extension-zstd', diff --git a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php index f4dc360c..62d63731 100644 --- a/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php @@ -1,4 +1,4 @@ -connection->fetchOne('SELECT @@group_concat_max_len'); + $groupConcatMaxLen = $this->connection->fetchOne('SELECT @@group_concat_max_len'); if (!$groupConcatMaxLen || (int) $groupConcatMaxLen < self::MYSQL_GROUP_CONCAT_MAX_LEN) { $collection->add( SettingsResult::error( diff --git a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php index f5e6a882..7482ba91 100644 --- a/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php +++ b/src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php @@ -55,7 +55,7 @@ private function getSchema(): string { $urlSchema = \parse_url($this->connection, \PHP_URL_SCHEME); - if (!is_string($urlSchema)) { + if (!\is_string($urlSchema)) { $urlSchema = explode('://', $this->connection)[0] ?? 'unknown'; } diff --git a/src/Components/LineReader.php b/src/Components/LineReader.php index 870ba326..366a5b83 100644 --- a/src/Components/LineReader.php +++ b/src/Components/LineReader.php @@ -18,9 +18,9 @@ private function __construct() } /** - * @return \Generator - * * @throws \InvalidArgumentException if $filePath is not readable + * + * @return \Generator */ public static function readLines(string $filePath): \Generator { @@ -32,9 +32,9 @@ public static function readLines(string $filePath): \Generator } /** - * @return \Generator - * * @throws \InvalidArgumentException if $filePath is not readable + * + * @return \Generator */ public static function readLinesBackwards(string $filePath): \Generator { diff --git a/src/Components/SystemConfig/ConfigSystemConfigLoader.php b/src/Components/SystemConfig/ConfigSystemConfigLoader.php index b9e5d637..384b4d2a 100644 --- a/src/Components/SystemConfig/ConfigSystemConfigLoader.php +++ b/src/Components/SystemConfig/ConfigSystemConfigLoader.php @@ -1,9 +1,9 @@ - 'Git version is not supported']); } - $url = sprintf('https://swagger.docs.fos.gg/version/%s/Files.xxhsums', $this->shopwareVersion); + $url = \sprintf('https://swagger.docs.fos.gg/version/%s/Files.xxhsums', $this->shopwareVersion); $data = $this->httpClient->request('GET', $url)->getContent(false); $data = trim((string) $data); @@ -171,7 +171,7 @@ public function restoreShopwareFile(Request $request, Context $context): JsonRes $userName = $this->getUserName($context) ?? 'unknown'; - $message = sprintf('File at "%s" has been restored by %s', $file, $userName); + $message = \sprintf('File at "%s" has been restored by %s', $file, $userName); $this->froshToolsLogger->info($message); @@ -234,7 +234,7 @@ private function getUserName(Context $context): ?string private function getUserNameByUserId(string $userId): ?string { - /** @var null|UserEntity $userEntity */ + /** @var UserEntity|null $userEntity */ $userEntity = $this->userRepository->search( new Criteria([$userId]), Context::createDefaultContext(), @@ -249,7 +249,7 @@ private function getUserNameByUserId(string $userId): ?string private function getNameByIntegrationId(string $integrationId): ?string { - /** @var null|IntegrationEntity $integrationEntity */ + /** @var IntegrationEntity|null $integrationEntity */ $integrationEntity = $this->integrationRepository->search( new Criteria([$integrationId]), Context::createDefaultContext(), diff --git a/src/Controller/StateMachineController.php b/src/Controller/StateMachineController.php index b7f8c889..d7b7ac2a 100644 --- a/src/Controller/StateMachineController.php +++ b/src/Controller/StateMachineController.php @@ -11,13 +11,13 @@ use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; +use Shopware\Core\Framework\Uuid\Uuid; use Shopware\Core\System\StateMachine\StateMachineCollection; +use Shopware\Core\System\StateMachine\StateMachineEntity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Attribute\Route; -use Shopware\Core\Framework\Uuid\Uuid; -use Shopware\Core\System\StateMachine\StateMachineEntity; #[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])] final class StateMachineController extends AbstractController From cc5fda65aabf981055b51d3140162e91d561bc3b Mon Sep 17 00:00:00 2001 From: Shyim Date: Tue, 18 Feb 2025 09:50:05 +0100 Subject: [PATCH 11/11] Add GITHUB_ACTIONS environment variable to Docker run --- .github/workflows/code-style.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index e9d91464..3468d690 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -17,7 +17,7 @@ jobs: run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest - name: Run CS - run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run + run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run check: runs-on: ubuntu-24.04 @@ -33,4 +33,4 @@ jobs: run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest - name: Run Check - run: docker run --rm -e GITHUB_STEP_SUMMARY -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }} + run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }}