mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 13:29:26 +01:00
Allow to "embed" server list (#1860)
This commit is contained in:
parent
852f7beb39
commit
4bda7cba75
@ -10,10 +10,17 @@ class ServerResource extends Resource
|
|||||||
{
|
{
|
||||||
protected static ?string $model = Server::class;
|
protected static ?string $model = Server::class;
|
||||||
|
|
||||||
|
protected static string|\BackedEnum|null $navigationIcon = 'tabler-brand-docker';
|
||||||
|
|
||||||
protected static ?string $slug = '/';
|
protected static ?string $slug = '/';
|
||||||
|
|
||||||
protected static bool $shouldRegisterNavigation = false;
|
protected static bool $shouldRegisterNavigation = false;
|
||||||
|
|
||||||
|
public static function getNavigationBadge(): ?string
|
||||||
|
{
|
||||||
|
return (string) user()?->directAccessibleServers()->where('owner_id', user()?->id)->count();
|
||||||
|
}
|
||||||
|
|
||||||
public static function canAccess(): bool
|
public static function canAccess(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -25,4 +32,10 @@ class ServerResource extends Resource
|
|||||||
'index' => ListServers::route('/'),
|
'index' => ListServers::route('/'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function embedServerList(bool $condition = true): void
|
||||||
|
{
|
||||||
|
static::$slug = $condition ? null : '/';
|
||||||
|
static::$shouldRegisterNavigation = $condition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user