feat: post cover filter + admin AI cover action, restyle page-cache admin
- 抽 CoverGenerator 服务(covers:generate 与后台共用),内部强制同步产出 card 转换 - 文章列表:新增封面状态图标列、「有/无封面/完全无图」筛选、行内「生成封面」AI 操作 - 页面缓存:统计改为原生 StatsOverviewWidget(缓存页数/总大小/命中率/时长), 缓存明细表重排(表头、悬停、URL 截断、图标删除按钮、空状态)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Blog\Support\PageCacheMiddleware;
|
||||
use Filament\Widgets\StatsOverviewWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class PageCacheStats extends StatsOverviewWidget
|
||||
{
|
||||
protected function getStats(): array
|
||||
{
|
||||
$stats = PageCacheMiddleware::stats();
|
||||
$size = (int) collect(PageCacheMiddleware::entries())->sum('size');
|
||||
$sizeText = $size >= 1048576
|
||||
? number_format($size / 1048576, 2).' MB'
|
||||
: number_format($size / 1024, 1).' KB';
|
||||
|
||||
return [
|
||||
Stat::make('缓存页面', $stats['count'].' 个')
|
||||
->description('仅未登录访客的 GET 页面')
|
||||
->icon('heroicon-m-document-text'),
|
||||
Stat::make('总大小', $sizeText)
|
||||
->description('全部缓存页合计')
|
||||
->icon('heroicon-m-circle-stack'),
|
||||
Stat::make('命中率', $stats['rate'].'%')
|
||||
->description("命中 {$stats['hits']} · 未命中 {$stats['misses']}")
|
||||
->icon('heroicon-m-chart-bar'),
|
||||
Stat::make('缓存时长', ((int) config('blog.page_cache_ttl', 300)).' 秒')
|
||||
->description('到期自动失效')
|
||||
->icon('heroicon-m-clock'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user