diff --git a/composer.json b/composer.json index 7a21b3d5c..df951dd2d 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "source": "https://github.com/cakephp/debug_kit" }, "require": { - "cakephp/cakephp": "^5.0", + "cakephp/cakephp": "dev-5.next as 5.1.0", "composer/composer": "^2.0", "doctrine/sql-formatter": "^1.1.3" }, @@ -66,5 +66,7 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 64cd47585..c659942de 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + _composerPaths]]> @@ -40,6 +40,14 @@ new $class($this, $config) + + + PluginConfig::getAppConfig() + + + PluginConfig::getAppConfig() + + genericInstances diff --git a/src/Panel/PluginsPanel.php b/src/Panel/PluginsPanel.php new file mode 100644 index 000000000..b8011740e --- /dev/null +++ b/src/Panel/PluginsPanel.php @@ -0,0 +1,62 @@ +_data['hasEmptyAppConfig'] = empty($config); + $plugins = []; + + foreach ($config as $pluginName => $options) { + $plugins[$pluginName] = [ + 'isLoaded' => $loadedPluginsCollection->has($pluginName), + 'onlyDebug' => $options['onlyDebug'] ?? false, + 'onlyCli' => $options['onlyCli'] ?? false, + 'optional' => $options['optional'] ?? false, + ]; + } + + $this->_data['plugins'] = $plugins; + } + + /** + * Get summary data for the plugins panel. + * + * @return string + */ + public function summary(): string + { + if (!isset($this->_data['plugins'])) { + return '0'; + } + + return (string)count($this->_data['plugins']); + } +} diff --git a/src/ToolbarService.php b/src/ToolbarService.php index 578f22b7e..64113cd64 100644 --- a/src/ToolbarService.php +++ b/src/ToolbarService.php @@ -68,6 +68,7 @@ class ToolbarService 'DebugKit.Packages' => true, 'DebugKit.Mail' => true, 'DebugKit.Deprecations' => true, + 'DebugKit.Plugins' => true, ], 'forceEnable' => false, 'safeTld' => [], diff --git a/templates/element/plugins_panel.php b/templates/element/plugins_panel.php new file mode 100644 index 000000000..f76067c80 --- /dev/null +++ b/templates/element/plugins_panel.php @@ -0,0 +1,51 @@ + +
+ config/plugins.php
'; + printf('

%s

', $msg); + ?> +
+ + + + + + + + + + + + $pluginConfig) : ?> + + + + + + + + + +
PluginIs LoadedOnly DebugOnly CLIOptional
Html->image('DebugKit./img/cake-red.svg') : '' ?>Html->image('DebugKit./img/cake-red.svg') : '' ?>Html->image('DebugKit./img/cake-red.svg') : '' ?>Html->image('DebugKit./img/cake-red.svg') : '' ?>
+
+
diff --git a/tests/TestCase/Middleware/DebugKitMiddlewareTest.php b/tests/TestCase/Middleware/DebugKitMiddlewareTest.php index fad52934f..97a14f493 100644 --- a/tests/TestCase/Middleware/DebugKitMiddlewareTest.php +++ b/tests/TestCase/Middleware/DebugKitMiddlewareTest.php @@ -121,10 +121,10 @@ public function testInvokeSaveData() $this->assertSame(200, $result->status_code); $this->assertGreaterThan(1, $result->panels); - $this->assertSame('SqlLog', $result->panels[11]->panel); - $this->assertSame('DebugKit.sql_log_panel', $result->panels[11]->element); - $this->assertNotNull($result->panels[11]->summary); - $this->assertSame('Sql Log', $result->panels[11]->title); + $this->assertSame('SqlLog', $result->panels[12]->panel); + $this->assertSame('DebugKit.sql_log_panel', $result->panels[12]->element); + $this->assertNotNull($result->panels[12]->summary); + $this->assertSame('Sql Log', $result->panels[12]->title); $timeStamp = filectime(Plugin::path('DebugKit') . 'webroot' . DS . 'js' . DS . 'main.js'); diff --git a/tests/TestCase/ToolbarServiceTest.php b/tests/TestCase/ToolbarServiceTest.php index d9283ff40..5bda2582c 100644 --- a/tests/TestCase/ToolbarServiceTest.php +++ b/tests/TestCase/ToolbarServiceTest.php @@ -250,10 +250,10 @@ public function testSaveData() $this->assertSame(200, $result->status_code); $this->assertGreaterThan(1, $result->panels); - $this->assertSame('SqlLog', $result->panels[11]->panel); - $this->assertSame('DebugKit.sql_log_panel', $result->panels[11]->element); - $this->assertSame('0', $result->panels[11]->summary); - $this->assertSame('Sql Log', $result->panels[11]->title); + $this->assertSame('SqlLog', $result->panels[12]->panel); + $this->assertSame('DebugKit.sql_log_panel', $result->panels[12]->element); + $this->assertSame('0', $result->panels[12]->summary); + $this->assertSame('Sql Log', $result->panels[12]->title); } /** diff --git a/webroot/css/style.css b/webroot/css/style.css index ce5224b43..d57fee96e 100644 --- a/webroot/css/style.css +++ b/webroot/css/style.css @@ -676,6 +676,10 @@ strong { border-left: 1px solid var(--mail-border); } +.c-plugins-panel img { + height: 18px; +} + .u-text-center { text-align: center; } diff --git a/webroot/img/cake-red.svg b/webroot/img/cake-red.svg new file mode 100644 index 000000000..d3daf55c7 --- /dev/null +++ b/webroot/img/cake-red.svg @@ -0,0 +1 @@ +