Files
panel-pelican-dev/app/Filament/Pages/Dashboard.php

83 lines
2.8 KiB
PHP
Raw Normal View History

2024-04-10 17:10:25 -04:00
<?php
namespace App\Filament\Pages;
2024-04-11 00:45:20 -04:00
use App\Filament\Resources\NodeResource\Pages\ListNodes;
use App\Models\Egg;
use App\Models\Node;
use App\Models\Server;
use App\Models\User;
2024-04-17 01:30:05 -04:00
use Filament\Actions\CreateAction;
2024-04-10 17:10:25 -04:00
use Filament\Pages\Page;
2024-04-11 00:51:36 -04:00
class Dashboard extends Page
2024-04-10 17:10:25 -04:00
{
2024-04-11 00:51:36 -04:00
protected static ?string $navigationIcon = 'tabler-layout-dashboard';
2024-04-10 17:10:25 -04:00
2024-04-11 00:51:36 -04:00
protected static string $view = 'filament.pages.dashboard';
2024-04-11 00:45:20 -04:00
protected ?string $heading = '';
2024-04-11 00:51:36 -04:00
protected static ?string $title = 'Dashboard';
protected static ?string $slug = '/';
2024-04-11 00:45:20 -04:00
public string $activeTab = 'nodes';
public function getViewData(): array
{
return [
'inDevelopment' => config('app.version') === 'canary',
'eggsCount' => Egg::query()->count(),
'nodesList' => ListNodes::getUrl(),
'nodesCount' => Node::query()->count(),
'serversCount' => Server::query()->count(),
'usersCount' => User::query()->count(),
2024-04-17 01:30:05 -04:00
'devActions' => [
CreateAction::make()
->label('Create Issue')
->icon('tabler-brand-github')
->url('https://github.com/pelican-dev/panel/issues/new/choose', true)
->color('warning'),
CreateAction::make()
->label('Discuss Features')
->icon('tabler-brand-github')
->url('https://github.com/pelican-dev/panel/discussions', true)
->color('primary'),
],
'nodeActions' => [
CreateAction::make()
->label('Create first Node in Pelican')
->icon('tabler-server-2')
->url(route('filament.admin.resources.nodes.create'))
->color('primary'),
],
'supportActions' => [
CreateAction::make()
->label('Help Translate')
->icon('tabler-language')
->url('https://crowdin.com/project/pelican-dev', true)
->color('info'),
CreateAction::make()
->label('Donate Directly')
->icon('tabler-cash')
->url('https://pelican.dev/donate', true)
->color('success'),
],
'helpActions' => [
CreateAction::make()
->label('Read Documentation')
->icon('tabler-speedboat')
->url('https://pelican.dev/docs', true)
->color('info'),
CreateAction::make()
->label('Get Help in Discord')
->icon('tabler-brand-discord')
->url('https://discord.gg/pelican-panel', true)
->color('primary'),
],
2024-04-11 00:45:20 -04:00
];
}
2024-04-10 17:10:25 -04:00
}