Merge pull request #232 from Poseidon281/Navigation-Sidebar

Update: Navigation sidebar
This commit is contained in:
Lance Pioch 2024-05-15 13:24:25 -04:00 committed by GitHub
commit b1d056a301
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 385 additions and 338 deletions

View File

@ -13,6 +13,10 @@ class ApiKeyResource extends Resource
protected static ?string $model = ApiKey::class; protected static ?string $model = ApiKey::class;
protected static ?string $label = 'API Key'; protected static ?string $label = 'API Key';
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-key'; protected static ?string $navigationIcon = 'tabler-key';
public static function canEdit($record): bool public static function canEdit($record): bool

View File

@ -10,6 +10,11 @@ class DatabaseHostResource extends Resource
{ {
protected static ?string $model = DatabaseHost::class; protected static ?string $model = DatabaseHost::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $label = 'Databases'; protected static ?string $label = 'Databases';
protected static ?string $navigationIcon = 'tabler-database'; protected static ?string $navigationIcon = 'tabler-database';

View File

@ -10,6 +10,11 @@ class DatabaseResource extends Resource
{ {
protected static ?string $model = Database::class; protected static ?string $model = Database::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-database'; protected static ?string $navigationIcon = 'tabler-database';
protected static bool $shouldRegisterNavigation = false; protected static bool $shouldRegisterNavigation = false;

View File

@ -10,6 +10,10 @@ class EggResource extends Resource
{ {
protected static ?string $model = Egg::class; protected static ?string $model = Egg::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-eggs'; protected static ?string $navigationIcon = 'tabler-eggs';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';

View File

@ -10,6 +10,11 @@ class MountResource extends Resource
{ {
protected static ?string $model = Mount::class; protected static ?string $model = Mount::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-layers-linked'; protected static ?string $navigationIcon = 'tabler-layers-linked';
public static function getRelations(): array public static function getRelations(): array

View File

@ -11,6 +11,11 @@ class NodeResource extends Resource
{ {
protected static ?string $model = Node::class; protected static ?string $model = Node::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-server-2'; protected static ?string $navigationIcon = 'tabler-server-2';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';

View File

@ -10,6 +10,11 @@ class ServerResource extends Resource
{ {
protected static ?string $model = Server::class; protected static ?string $model = Server::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-brand-docker'; protected static ?string $navigationIcon = 'tabler-brand-docker';
protected static ?string $recordTitleAttribute = 'name'; protected static ?string $recordTitleAttribute = 'name';

View File

@ -11,6 +11,10 @@ class UserResource extends Resource
{ {
protected static ?string $model = User::class; protected static ?string $model = User::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-users'; protected static ?string $navigationIcon = 'tabler-users';
protected static ?string $recordTitleAttribute = 'username'; protected static ?string $recordTitleAttribute = 'username';

View File

@ -36,6 +36,7 @@ class AdminPanelProvider extends PanelProvider
->default() ->default()
->id('admin') ->id('admin')
->path('admin') ->path('admin')
->topNavigation(true)
->login() ->login()
->homeUrl('/') ->homeUrl('/')
->favicon('/pelican.ico') ->favicon('/pelican.ico')

685
composer.lock generated

File diff suppressed because it is too large Load Diff