Skip to content

Commit

Permalink
Improve includes view
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Jul 31, 2024
1 parent c71857f commit f0a95a0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/helpers/DiagnosticsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,12 @@ public static function getSiteId(): ?int

public static function getPagesCount(int $siteId): int
{
return CacheRecord::find()
->where(['siteId' => $siteId])
->andWhere(['not', self::IS_CACHED_INCLUDE_CONDITION])
->count();
return self::getPagesQuery($siteId)->count();
}

public static function getIncludesCount(int $siteId): int
{
return CacheRecord::find()
->where(['siteId' => $siteId])
->andWhere(self::IS_CACHED_INCLUDE_CONDITION)
->count();
return self::getIncludesQuery($siteId)->count();
}

public static function getParamsCount(int $siteId): int
Expand Down Expand Up @@ -218,7 +212,7 @@ public static function getIncludesQuery(int $siteId): ActiveQuery
$index = self::getIncludesIndexColumnForSelect();

return self::getBasePagesQuery($siteId)
->select(['caches.id', 'siteId', 'uri', $index . ' AS index', 'template', 'params', 'elementCount', 'elementQueryCount', 'dateCached', 'expiryDate'])
->select(['caches.id', 'caches.siteId', 'uri', $index . ' AS index', 'template', 'params', 'elementCount', 'elementQueryCount', 'dateCached', 'expiryDate'])
->innerJoin([
'indexes' => IncludeRecord::find()
->where(['siteId' => $siteId]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
{{ 'Tags'|t('blitz') }}
</button>
</th>
<th class="{{ orderBy == 'dateCached' ? 'ordered' }} {{ sortBy == 'desc' ? 'desc' }} orderable">
<button type="button" sprig s-val:order-by="dateCached" s-val:sort-by="{{ orderBy == 'dateCached' and sortBy == 'desc' ? 'asc' : 'desc' }}">
{{ 'Date Cached'|t('blitz') }}
</button>
</th>
<th class="{{ orderBy == 'expiryDate' ? 'ordered' }} {{ sortBy == 'desc' ? 'desc' }} orderable">
<button type="button" sprig s-val:order-by="expiryDate" s-val:sort-by="{{ orderBy == 'expiryDate' and sortBy == 'desc' ? 'asc' : 'desc' }}">
{{ 'Expiry Date'|t('blitz') }}
Expand Down Expand Up @@ -110,6 +115,9 @@
<td>
{{ (row.tagCount ?? 0)|number }}
</td>
<td>
{{ row.dateCached ? craft.blitz.diagnostics.toDateTime(row.dateCached)|datetime('short') }}
</td>
<td>
{{ row.expiryDate ? craft.blitz.diagnostics.toDateTime(row.expiryDate)|datetime('short') }}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</th>
<th class="{{ orderBy == 'dateCached' ? 'ordered' }} {{ sortBy == 'desc' ? 'desc' }} orderable">
<button type="button" sprig s-val:order-by="dateCached" s-val:sort-by="{{ orderBy == 'dateCached' and sortBy == 'desc' ? 'asc' : 'desc' }}">
{{ 'Cached'|t('blitz') }}
{{ 'Date Cached'|t('blitz') }}
</button>
</th>
<th class="{{ orderBy == 'expiryDate' ? 'ordered' }} {{ sortBy == 'desc' ? 'desc' }} orderable">
Expand Down

0 comments on commit f0a95a0

Please sign in to comment.