refactor: kb & station & terminal
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Station;
|
||||
use App\Models\Terminal;
|
||||
use App\Models\TerminalPrompt;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
@@ -14,23 +14,20 @@ class TerminalStatsWidget extends BaseWidget
|
||||
protected function getStats(): array
|
||||
{
|
||||
// 统计终端数据
|
||||
$totalStations = Station::count();
|
||||
$totalTerminals = Terminal::count();
|
||||
$onlineTerminals = Terminal::where('is_online', true)->count();
|
||||
|
||||
// 统计提示词
|
||||
$totalPrompts = TerminalPrompt::count();
|
||||
|
||||
return [
|
||||
Stat::make('线站数量', $totalStations)
|
||||
->description('线站')
|
||||
->descriptionIcon('heroicon-m-building-office')
|
||||
->color('info'),
|
||||
|
||||
Stat::make('终端总数', $totalTerminals)
|
||||
->description("{$onlineTerminals} 个在线")
|
||||
->descriptionIcon('heroicon-m-computer-desktop')
|
||||
->color('primary')
|
||||
->url(route('filament.admin.resources.terminals.index')),
|
||||
|
||||
Stat::make('提示词配置', $totalPrompts)
|
||||
->description('终端提示词总数')
|
||||
->descriptionIcon('heroicon-m-chat-bubble-left-right')
|
||||
->color('success'),
|
||||
->color('primary'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user