diff --git a/src/Blitz.php b/src/Blitz.php index 6cff1e73..4150e1f7 100644 --- a/src/Blitz.php +++ b/src/Blitz.php @@ -489,6 +489,7 @@ function(RegisterUrlRulesEvent $event) { // Merge so that settings controller action comes first (important!) $event->rules = array_merge([ 'settings/plugins/blitz' => 'blitz/settings/edit', + 'blitz/diagnostics/' => 'blitz/diagnostics/index', ], $event->rules ); diff --git a/src/controllers/DiagnosticsController.php b/src/controllers/DiagnosticsController.php index fea3ac48..b081e132 100755 --- a/src/controllers/DiagnosticsController.php +++ b/src/controllers/DiagnosticsController.php @@ -5,11 +5,14 @@ namespace putyourlightson\blitz\controllers; +use Craft; use craft\helpers\App; use craft\web\Controller; use craft\web\CsvResponseFormatter; -use craft\web\Response; +use putyourlightson\blitz\assets\BlitzAsset; use putyourlightson\blitz\helpers\DiagnosticsHelper; +use putyourlightson\sprig\Sprig; +use yii\web\Response; /** * @since 4.10.0 @@ -23,6 +26,28 @@ public function beforeAction($action): bool return parent::beforeAction($action); } + public function actionIndex(string $path): Response + { + Craft::$app->getView()->registerAssetBundle(BlitzAsset::class); + + Sprig::bootstrap(); + Sprig::$core->components->setConfig(['requestClass' => 'busy']); + + $siteId = null; + $site = Craft::$app->getRequest()->getParam('site'); + if ($site) { + $site = Craft::$app->getSites()->getSiteByHandle($site); + $siteId = $site ? $site->id : null; + } + if (empty($siteId)) { + $siteId = Craft::$app->getSites()->getCurrentSite()->id; + } + + return $this->renderTemplate('blitz/_utilities/diagnostics/' . $path, [ + 'siteId' => $siteId, + ]); + } + public function actionExportPages(int $siteId): Response { App::maxPowerCaptain(); diff --git a/src/resources/css/cp.css b/src/resources/css/cp.css index fcc54c3a..7964fd87 100644 --- a/src/resources/css/cp.css +++ b/src/resources/css/cp.css @@ -90,25 +90,8 @@ table.editable th.code { font-size: inherit !important; } -.breadcrumb-list li.leaf:after { - border: none; -} - -.blitz-diagnostics { - margin-top: -10px; -} - .blitz-diagnostics #header { - padding-left: 0; - padding-right: 0; - margin-bottom: 0.5rem; - width: calc(100vw - 226px - 226px - 24px - 24px - 24px); -} - -@media only screen and (max-width: 1199px) { - .blitz-diagnostics #header { - width: calc(100vw - 24px - 24px - 24px - 24px); - } + padding: 0; } .blitz-diagnostics > h1 { @@ -116,8 +99,12 @@ table.editable th.code { line-height: 34px; } -.blitz-diagnostics .elements { - margin-top: 1rem; +.blitz-diagnostics .search-container { + margin-bottom: 1rem; +} + +.blitz-diagnostics .chip { + background-color: transparent; } #footer { diff --git a/src/resources/js/cp.js b/src/resources/js/cp.js index 4b49a50e..3f7cb9d1 100644 --- a/src/resources/js/cp.js +++ b/src/resources/js/cp.js @@ -1,7 +1,3 @@ $('.putyourlightson\\\\blitz\\\\widgets\\\\cachewidget .action .heading').click(function() { $(this).closest('.action').find('.form').toggleClass('hidden'); }); - -if ($('.blitz-diagnostics #crumbs').length) { - $('#global-header #crumbs').replaceWith($('.blitz-diagnostics #crumbs').removeClass('hidden')); -} diff --git a/src/templates/_utilities/diagnostics/components/elementQueries.twig b/src/templates/_utilities/diagnostics/components/elementQueries.twig index 021e4a21..8be751c4 100644 --- a/src/templates/_utilities/diagnostics/components/elementQueries.twig +++ b/src/templates/_utilities/diagnostics/components/elementQueries.twig @@ -18,17 +18,10 @@ .all() %}
- +
+ + +
{{ hiddenInput('orderBy', orderBy) }} {{ hiddenInput('sortBy', sortBy) }} diff --git a/src/templates/_utilities/diagnostics/components/elements.twig b/src/templates/_utilities/diagnostics/components/elements.twig index 5578460d..6fc6222a 100644 --- a/src/templates/_utilities/diagnostics/components/elements.twig +++ b/src/templates/_utilities/diagnostics/components/elements.twig @@ -20,17 +20,10 @@ {% set elements = craft.blitz.diagnostics.getElementsFromIds(siteId, elementType, elementIds) %}
- +
+ + +
{{ hiddenInput('orderBy', orderBy) }} {{ hiddenInput('sortBy', sortBy) }} diff --git a/src/templates/_utilities/diagnostics/components/pages.twig b/src/templates/_utilities/diagnostics/components/pages.twig index 0d204797..daa7b591 100644 --- a/src/templates/_utilities/diagnostics/components/pages.twig +++ b/src/templates/_utilities/diagnostics/components/pages.twig @@ -21,23 +21,10 @@ {% set maxVisible = rows|length + offset %}
- +
+ + +
{{ hiddenInput('orderBy', orderBy) }} {{ hiddenInput('sortBy', sortBy) }} @@ -82,7 +69,7 @@ {% set url = siteUrl(uri, null, null, siteId) %} - + {{ uri }} diff --git a/src/templates/_utilities/diagnostics/components/paramPages.twig b/src/templates/_utilities/diagnostics/components/paramPages.twig index a2c4eeec..3cc7fb92 100644 --- a/src/templates/_utilities/diagnostics/components/paramPages.twig +++ b/src/templates/_utilities/diagnostics/components/paramPages.twig @@ -16,17 +16,10 @@ {% set rows = query.all() %}
- +
+ + +
{{ hiddenInput('orderBy', orderBy) }} {{ hiddenInput('sortBy', sortBy) }} diff --git a/src/templates/_utilities/diagnostics/components/params.twig b/src/templates/_utilities/diagnostics/components/params.twig index 8c275054..87eecc4c 100644 --- a/src/templates/_utilities/diagnostics/components/params.twig +++ b/src/templates/_utilities/diagnostics/components/params.twig @@ -17,25 +17,10 @@ {% set maxVisible = rows|length + offset %}
- +
+ + +
{{ hiddenInput('orderBy', orderBy) }} {{ hiddenInput('sortBy', sortBy) }} @@ -59,7 +44,7 @@ {% for row in rows %} - {{ row.param }} diff --git a/src/templates/_utilities/diagnostics/element-queries/element-query-type.twig b/src/templates/_utilities/diagnostics/element-queries/element-query-type.twig index 8bdfb161..264edc1e 100644 --- a/src/templates/_utilities/diagnostics/element-queries/element-query-type.twig +++ b/src/templates/_utilities/diagnostics/element-queries/element-query-type.twig @@ -1,14 +1,13 @@ {% extends 'blitz/_utilities/diagnostics/layouts/element-queries' %} {% set element = craft.blitz.diagnostics.getElementOfType() %} +{% set title = 'Tracked ' ~ element.displayName ~ ' Queries' %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/elementQueries', { siteId: siteId, elementType: className(element), displayName: element.displayName, pluralDisplayName: element.displayName ~ ' Queries', }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/element-queries/index.twig b/src/templates/_utilities/diagnostics/element-queries/index.twig index 12347d75..a3d0c9dd 100644 --- a/src/templates/_utilities/diagnostics/element-queries/index.twig +++ b/src/templates/_utilities/diagnostics/element-queries/index.twig @@ -1,55 +1,49 @@ {% extends 'blitz/_utilities/diagnostics/layouts/base' %} -{% set crumbs = [] %} +{% set title = 'Tracked Element Queries'|t('blitz') %} {% set elementQueryTypes = craft.blitz.diagnostics.getElementQueryTypes(siteId) %} -{% block content %} - - +{% block pageTitle %} +
+

{{ title }}

+ {% if craft.app.getIsMultiSite() %} + {% include '_elements/sitemenu' with { + selectedSiteId: siteId, + urlFormat: 'blitz/diagnostics/element-queries?site={handle}', + } only %} + {% endif %} +
+{% endblock %} - {% if elementQueryTypes|length %} -
- - +{% block content %} +
+
+ + + + + + + + {% for elementQueryType in elementQueryTypes %} - - + + - - - {% for elementQueryType in elementQueryTypes %} - - - - - {% endfor %} - -
+ {{ 'Element Type'|t('blitz') }} + + {{ 'Element Queries'|t('blitz') }} +
- {{ 'Element Type'|t('blitz') }} - - {{ 'Element Queries'|t('blitz') }} - + + {{ elementQueryType.type }} + + + {{ elementQueryType.count|number }} +
- - {{ elementQueryType.type }} - - - {{ elementQueryType.count|number }} -
-
- {% endif %} - + {% endfor %} + + +
{% endblock %} diff --git a/src/templates/_utilities/diagnostics/elements/element-type.twig b/src/templates/_utilities/diagnostics/elements/element-type.twig index 8e06152d..410fb200 100644 --- a/src/templates/_utilities/diagnostics/elements/element-type.twig +++ b/src/templates/_utilities/diagnostics/elements/element-type.twig @@ -1,9 +1,9 @@ {% extends 'blitz/_utilities/diagnostics/layouts/elements' %} {% set element = craft.blitz.diagnostics.getElementOfType() %} +{% set title = 'Tracked ' ~ element.pluralDisplayName %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/elements', { siteId: siteId, elementType: className(element), @@ -11,5 +11,4 @@ pluralDisplayName: element.pluralDisplayName, hasUris: element.hasUris, }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/elements/index.twig b/src/templates/_utilities/diagnostics/elements/index.twig index a4c364c9..30e290f4 100644 --- a/src/templates/_utilities/diagnostics/elements/index.twig +++ b/src/templates/_utilities/diagnostics/elements/index.twig @@ -1,55 +1,38 @@ {% extends 'blitz/_utilities/diagnostics/layouts/base' %} -{% set crumbs = [] %} +{% set title = 'Tracked Elements'|t('blitz') %} +{% set showSiteMenu = true %} {% set elementTypes = craft.blitz.diagnostics.getElementTypes(siteId) %} {% block content %} - - - - {% if elementTypes|length %} -
- - +
+
+ + + + + + + + {% for elementType in elementTypes %} - - + + - - - {% for elementType in elementTypes %} - - - - - {% endfor %} - -
+ {{ 'Element Type'|t('blitz') }} + + {{ 'Elements'|t('blitz') }} +
- {{ 'Element Type'|t('blitz') }} - - {{ 'Elements'|t('blitz') }} - + + {{ elementType.type }} + + + {{ elementType.count|number }} +
- - {{ elementType.type }} - - - {{ elementType.count|number }} -
-
- {% endif %} - + {% endfor %} + + +
{% endblock %} diff --git a/src/templates/_utilities/diagnostics/index.twig b/src/templates/_utilities/diagnostics/index.twig index 1a3fd70d..f9240568 100644 --- a/src/templates/_utilities/diagnostics/index.twig +++ b/src/templates/_utilities/diagnostics/index.twig @@ -1,7 +1,4 @@ -{% extends 'blitz/_utilities/diagnostics/layouts/base' %} - -{% block content %} - +

- + {% set count = craft.blitz.diagnostics.getPagesCount(siteId) %} {{ count|number }} {{ '{num, plural, =1{Tracked Page} other{Tracked Pages}}'|t('blitz', { num: count }) }}

- + {% set count = craft.blitz.diagnostics.getParamsCount(siteId) %} {{ count|number }} {{ '{num, plural, =1{Tracked Query String Param} other{Tracked Query String Params}}'|t('blitz', { num: count }) }}

- + {% set count = craft.blitz.diagnostics.getElementsCount(siteId) %} {{ count|number }} {{ '{num, plural, =1{Tracked Element} other{Tracked Elements}}'|t('blitz', { num: count }) }}

- + {% set count = craft.blitz.diagnostics.getElementQueriesCount(siteId) %} {{ count|number }} {{ '{num, plural, =1{Tracked Element Query} other{Tracked Element Queries}}'|t('blitz', { num: count }) }} @@ -52,10 +49,14 @@ {% if globalSetCount > 0 %} {% if settings.refreshCacheAutomaticallyForGlobals %} - {{ globalSetCount }} {{ '{num, plural, =1{global} other{globals}}'|t('blitz', { num: globalSetCount }) }} exist and refreshCacheAutomaticallyForGlobals is enabled. + {{ globalSetCount }} + {{ '{num, plural, =1{global} other{globals}}'|t('blitz', { num: globalSetCount }) }} exist and + refreshCacheAutomaticallyForGlobals is enabled. {% else %} - {{ globalSetCount }} {{ '{num, plural, =1{global} other{globals}}'|t('blitz', { num: globalSetCount }) }} exist and refreshCacheAutomaticallyForGlobals is disabled. + {{ globalSetCount }} + {{ '{num, plural, =1{global} other{globals}}'|t('blitz', { num: globalSetCount }) }} exist and + refreshCacheAutomaticallyForGlobals is disabled. {% endif %} {% else %} @@ -68,10 +69,12 @@

{% if craft.app.request.isWebAliasSetDynamically %} - The @web alias should be explicitly defined. + The + @web alias should be explicitly defined. {% else %} - The @web alias is explicitly defined. + The + @web alias is explicitly defined. {% endif %} Explicitly defining the @web alias is important for ensuring that URLs work correctly when the cache is generated via console requests. Learn more @@ -104,10 +107,12 @@

{% if craft.app.plugins.getPlugin('async-queue') is not null %} - The Async Queue plugin is enabled. + The + Async Queue plugin is enabled. {% else %} - The Async Queue plugin is not enabled. + The + Async Queue plugin is not enabled. {% endif %} The Async Queue plugin can be unreliable when used in some environments and cause queue jobs to stall. Learn more @@ -118,10 +123,13 @@ {% set hintsCount = craft.blitz.diagnostics.hintsCount %} {% if hintsCount > 0 %} - The Blitz Hints utility is reporting {{ hintsCount }} eager-loading {{ '{num, plural, =1{opportunity} other{opportunities}}'|t('blitz', { num: hintsCount }) }}. + The + Blitz Hints utility is reporting + {{ hintsCount }} eager-loading {{ '{num, plural, =1{opportunity} other{opportunities}}'|t('blitz', { num: hintsCount }) }}. {% else %} - The Blitz Hints utility is not reporting any eager-loading opportunities. + The + Blitz Hints utility is not reporting any eager-loading opportunities. {% endif %} {% else %} @@ -159,14 +167,15 @@ {% set refreshExpired = craft.blitz.diagnostics.driverDataAction('refresh-expired-cli') %} {% if refreshExpired is null or refreshExpired < craft.blitz.diagnostics.dateForDb(now|date_modify('-24 hours')) %} - The blitz/cache/refresh-expired console command has not been executed within the past 24 hours. + The + blitz/cache/refresh-expired console command has not been executed within the past 24 hours. {% else %} - The blitz/cache/refresh-expired console command has been executed within the past 24 hours. + The + blitz/cache/refresh-expired console command has been executed within the past 24 hours. {% endif %} The blitz/cache/refresh-expired console command not having been executed within the past 24 hours can indicate that a scheduled cron job should be set up to refresh expired cache at a recurring interval. (You may have to wait for the cron job to run after an update.) Learn more

- -{% endblock %} +

diff --git a/src/templates/_utilities/diagnostics/layouts/base.twig b/src/templates/_utilities/diagnostics/layouts/base.twig index 3d146413..4fc05d68 100644 --- a/src/templates/_utilities/diagnostics/layouts/base.twig +++ b/src/templates/_utilities/diagnostics/layouts/base.twig @@ -1,28 +1,30 @@ -
+{% extends '_layouts/cp' %} - {% if crumbs is defined %} - - {% endif %} +{% set crumbs = [ + { + label: 'Blitz Diagnostics'|t('blitz'), + url: cpUrl('utilities/blitz-diagnostics'), + } +]|merge(crumbs ?? []) %} - {% block content %}{% endblock %} +{% block pageTitle %} +

+ {% if codeTitle ?? false %} + {{ title }} + {% else %} + {{ title }} + {% endif %} +

+ {% if craft.app.getIsMultiSite() and showSiteMenu ?? false %} + {% include '_elements/sitemenu' with { + selectedSiteId: siteId, + urlFormat: craft.app.request.pathInfo ~ '?site={handle}', + } only %} + {% endif %} +{% endblock %} -
+{% block main %} +
+ {{ parent() }} +
+{% endblock %} diff --git a/src/templates/_utilities/diagnostics/layouts/element-queries.twig b/src/templates/_utilities/diagnostics/layouts/element-queries.twig index cb71f193..1aa038ad 100644 --- a/src/templates/_utilities/diagnostics/layouts/element-queries.twig +++ b/src/templates/_utilities/diagnostics/layouts/element-queries.twig @@ -3,7 +3,6 @@ {% set crumbs = [ { label: 'Tracked Element Queries', - path: 'element-queries', + url: cpUrl('blitz/diagnostics/element-queries'), }, ]|merge(crumbs ?? []) %} - diff --git a/src/templates/_utilities/diagnostics/layouts/elements.twig b/src/templates/_utilities/diagnostics/layouts/elements.twig index 31466a8a..1bb7b0c6 100644 --- a/src/templates/_utilities/diagnostics/layouts/elements.twig +++ b/src/templates/_utilities/diagnostics/layouts/elements.twig @@ -3,7 +3,7 @@ {% set crumbs = [ { label: 'Tracked Elements', - path: 'elements', + url: cpUrl('blitz/diagnostics/elements'), }, ]|merge(crumbs ?? []) %} diff --git a/src/templates/_utilities/diagnostics/layouts/page.twig b/src/templates/_utilities/diagnostics/layouts/page.twig index a56c5f31..4c05c263 100644 --- a/src/templates/_utilities/diagnostics/layouts/page.twig +++ b/src/templates/_utilities/diagnostics/layouts/page.twig @@ -8,12 +8,7 @@ {% set crumbs = [ { label: 'Tracked Pages', - path: 'pages', - }, - { - label: page.uri, - path: (isLeaf ?? false) ? null : 'pages/page?pageId=' ~ page.id, - class: (isLeaf ?? false) ? 'leaf code' : 'code', + url: cpUrl('blitz/diagnostics/pages'), }, ]|merge(crumbs ?? []) %} diff --git a/src/templates/_utilities/diagnostics/layouts/param.twig b/src/templates/_utilities/diagnostics/layouts/param.twig index e4bf4de7..8199fb53 100644 --- a/src/templates/_utilities/diagnostics/layouts/param.twig +++ b/src/templates/_utilities/diagnostics/layouts/param.twig @@ -3,12 +3,7 @@ {% set crumbs = [ { label: 'Tracked Query String Params', - path: 'params', - }, - { - label: param, - path: (isLeaf ?? false) ? null : 'params/param?param=' ~ param, - class: (isLeaf ?? false) ? 'leaf code' : 'code', + url: cpUrl('blitz/diagnostics/params'), }, ]|merge(crumbs ?? []) %} diff --git a/src/templates/_utilities/diagnostics/pages/element-query-type.twig b/src/templates/_utilities/diagnostics/pages/element-query-type.twig index a89ad134..1cf2498a 100644 --- a/src/templates/_utilities/diagnostics/pages/element-query-type.twig +++ b/src/templates/_utilities/diagnostics/pages/element-query-type.twig @@ -2,9 +2,15 @@ {% set page = craft.blitz.diagnostics.getPage() %} {% set element = craft.blitz.diagnostics.getElementOfType(page.id) %} +{% set title = 'Tracked ' ~ element.displayName ~ ' Queries' %} +{% set crumbs = [ + { + label: page.uri, + url: cpUrl('blitz/diagnostics/pages/page?pageId=' ~ page.id), + }, +] %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/elementQueries', { siteId: siteId, pageId: page.id, @@ -12,5 +18,4 @@ displayName: element.displayName, pluralDisplayName: element.displayName ~ ' Queries', }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/pages/element-type.twig b/src/templates/_utilities/diagnostics/pages/element-type.twig index b0255d3e..a1cc37ff 100644 --- a/src/templates/_utilities/diagnostics/pages/element-type.twig +++ b/src/templates/_utilities/diagnostics/pages/element-type.twig @@ -2,9 +2,15 @@ {% set page = craft.blitz.diagnostics.getPage() %} {% set element = craft.blitz.diagnostics.getElementOfType(page.id) %} +{% set title = 'Tracked ' ~ element.pluralDisplayName %} +{% set crumbs = [ + { + label: page.uri, + url: cpUrl('blitz/diagnostics/pages/page?pageId=' ~ page.id), + }, +] %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/elements', { siteId: siteId, pageId: page.id, @@ -13,5 +19,4 @@ pluralDisplayName: element.pluralDisplayName, hasUris: element.hasUris, }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/pages/index.twig b/src/templates/_utilities/diagnostics/pages/index.twig index 34f7ae7d..70ea9124 100644 --- a/src/templates/_utilities/diagnostics/pages/index.twig +++ b/src/templates/_utilities/diagnostics/pages/index.twig @@ -1,9 +1,8 @@ {% extends 'blitz/_utilities/diagnostics/layouts/base' %} -{% set crumbs = [] %} +{% set title = 'Tracked Pages'|t('blitz') %} +{% set showSiteMenu = true %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/pages', { siteId: siteId }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/pages/page.twig b/src/templates/_utilities/diagnostics/pages/page.twig index 5b408de0..0c1673ac 100644 --- a/src/templates/_utilities/diagnostics/pages/page.twig +++ b/src/templates/_utilities/diagnostics/pages/page.twig @@ -2,18 +2,17 @@ {% set page = craft.blitz.diagnostics.getPage() %} {% if page is null %} - {% redirect 'utilities/blitz-diagnostics/pages' with error 'The page no longer exists or may have been refreshed.' %} + {% redirect 'blitz/diagnostics/pages' with error 'The page no longer exists or may have been refreshed.' %} {% endif %} {% set elementTypes = craft.blitz.diagnostics.getElementTypes(siteId, page.id) %} {% set elementQueryTypes = craft.blitz.diagnostics.getElementQueryTypes(siteId, page.id) %} -{% set isLeaf = true %} +{% set title = page.uri %} +{% set codeTitle = true %} {% block content %} -

{{ elementTypes|length ? 'Tracked Elements'|t('blitz') : 'No Tracked Elements'|t('blitz') }}

- {% if elementTypes|length %}
@@ -31,7 +30,7 @@ {% for elementType in elementTypes %}
- @@ -48,11 +47,9 @@
{% endif %} -

{{ elementQueryTypes|length ? 'Tracked Element Queries'|t('blitz') : 'No Tracked Element Queries'|t('blitz') }}

- {% if elementQueryTypes|length %}
@@ -70,7 +67,7 @@ {% for elementQueryType in elementQueryTypes %}
- @@ -86,5 +83,4 @@
{% endif %} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/params/index.twig b/src/templates/_utilities/diagnostics/params/index.twig index d0e66390..ee2ec660 100644 --- a/src/templates/_utilities/diagnostics/params/index.twig +++ b/src/templates/_utilities/diagnostics/params/index.twig @@ -1,14 +1,13 @@ {% extends 'blitz/_utilities/diagnostics/layouts/base' %} -{% set crumbs = [] %} +{% set title = 'Tracked Query String Params'|t('blitz') %} +{% set showSiteMenu = true %} {% set params = craft.blitz.diagnostics.getParams(siteId) %} {% block content %} - {{ sprig('blitz/_utilities/diagnostics/components/params', { siteId: siteId, displayName: 'Param', pluralDisplayName: 'Params', }) }} - {% endblock %} diff --git a/src/templates/_utilities/diagnostics/params/param.twig b/src/templates/_utilities/diagnostics/params/param.twig index 3767fdc7..1d6961ad 100644 --- a/src/templates/_utilities/diagnostics/params/param.twig +++ b/src/templates/_utilities/diagnostics/params/param.twig @@ -1,16 +1,19 @@ {% extends 'blitz/_utilities/diagnostics/layouts/param' %} -{% set isLeaf = true %} - {% set param = craft.app.request.param('param') %} +{% set title = param %} -{% block content %} +{% block pageTitle %} +

+ {{ title }} +

+{% endblock %} +{% block content %} {{ sprig('blitz/_utilities/diagnostics/components/paramPages', { siteId: siteId, param: param, displayName: 'Page', pluralDisplayName: 'Pages', }) }} - {% endblock %} diff --git a/src/utilities/DiagnosticsUtility.php b/src/utilities/DiagnosticsUtility.php index b0ebc64b..e40af53c 100644 --- a/src/utilities/DiagnosticsUtility.php +++ b/src/utilities/DiagnosticsUtility.php @@ -8,7 +8,6 @@ use Craft; use craft\base\Utility; use putyourlightson\blitz\assets\BlitzAsset; -use putyourlightson\sprig\Sprig; /** * @since 4.10.0 @@ -52,9 +51,6 @@ public static function contentHtml(): string { Craft::$app->getView()->registerAssetBundle(BlitzAsset::class); - Sprig::bootstrap(); - Sprig::$core->components->setConfig(['requestClass' => 'busy']); - $siteId = null; $site = Craft::$app->getRequest()->getParam('site'); if ($site) { @@ -65,10 +61,7 @@ public static function contentHtml(): string $siteId = Craft::$app->getSites()->getCurrentSite()->id; } - $templateSegments = array_slice(Craft::$app->getRequest()->getSegments(), 2); - $templatePath = 'blitz/_utilities/diagnostics/' . implode('/', $templateSegments); - - return Craft::$app->getView()->renderTemplate($templatePath, [ + return Craft::$app->getView()->renderTemplate('blitz/_utilities/diagnostics/', [ 'siteId' => $siteId, ]); }