Move to tabs

This commit is contained in:
notCharles 2024-07-14 20:48:44 -04:00
parent 1fdff43ae7
commit 4eeaf6f386
6 changed files with 99 additions and 24 deletions

View File

@ -3,8 +3,6 @@
namespace App\Filament\Resources;
use App\Filament\Resources\NodeResource\Pages;
use App\Filament\Resources\NodeResource\RelationManagers\AllocationsRelationManager;
use App\Filament\Resources\NodeResource\RelationManagers\NodesRelationManager;
use App\Models\Node;
use Filament\Resources\Resource;
@ -21,14 +19,6 @@ class NodeResource extends Resource
return static::getModel()::count() ?: null;
}
public static function getRelations(): array
{
return [
AllocationsRelationManager::class,
NodesRelationManager::class,
];
}
public static function getPages(): array
{
return [

View File

@ -22,6 +22,7 @@ use Filament\Forms\Set;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\HtmlString;
use Njxqlus\Filament\Components\Forms\RelationManager;
use Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction;
class EditNode extends EditRecord
@ -67,6 +68,20 @@ class EditNode extends EditRecord
View::make('filament.components.node-memory-chart')->columnSpan(3),
// TODO: Make purdy View::make('filament.components.node-storage-chart')->columnSpan(3),
]),
Tab::make('Servers')
->icon('tabler-brand-docker')
->schema([
RelationManager::make()
->manager(NodeResource\RelationManagers\NodesRelationManager::class)
->columnSpanFull(),
]),
Tab::make('Allocations')
->icon('tabler-plug-connected')
->schema([
RelationManager::make()
->manager(NodeResource\RelationManagers\AllocationsRelationManager::class)
->columnSpanFull(),
]),
Tab::make('Basic Settings')
->icon('tabler-server')
->schema([

View File

@ -25,8 +25,6 @@ class AllocationsRelationManager extends RelationManager
{
protected static string $relationship = 'allocations';
protected static ?string $icon = 'tabler-plug-connected';
public function form(Form $form): Form
{
return $form
@ -65,12 +63,6 @@ class AllocationsRelationManager extends RelationManager
->searchable()
->label('IP'),
])
->filters([
//
])
->actions([
//
])
->headerActions([
Tables\Actions\Action::make('create new allocation')->label('Create Allocations')
->form(fn () => [

View File

@ -12,12 +12,10 @@ class NodesRelationManager extends RelationManager
{
protected static string $relationship = 'servers';
protected static ?string $icon = 'tabler-brand-docker';
public function table(Table $table): Table
{
return $table
->searchable(false)
->searchable()
->columns([
TextColumn::make('user.username')
->label('Owner')

View File

@ -26,6 +26,7 @@
"lcobucci/jwt": "~4.3.0",
"league/flysystem-aws-s3-v3": "~3.12.2",
"league/flysystem-memory": "~3.10.3",
"njxqlus/filament-relation-manager-component": "^1.0",
"phpseclib/phpseclib": "~3.0.18",
"pragmarx/google2fa": "~8.0.0",
"predis/predis": "~2.1.1",
@ -90,4 +91,4 @@
},
"minimum-stability": "stable",
"prefer-stable": true
}
}

83
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "443ec1d95b892b261af5481f27b31083",
"content-hash": "843c3ea4e3ea8aa86eb067fc7cee08a4",
"packages": [
{
"name": "abdelhamiderrahmouni/filament-monaco-editor",
@ -5121,6 +5121,85 @@
},
"time": "2024-03-05T20:51:40+00:00"
},
{
"name": "njxqlus/filament-relation-manager-component",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/njxqlus/filament-relation-manager-component.git",
"reference": "77386bc4a7522acddbdb2d05ee330410276b59a5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/njxqlus/filament-relation-manager-component/zipball/77386bc4a7522acddbdb2d05ee330410276b59a5",
"reference": "77386bc4a7522acddbdb2d05ee330410276b59a5",
"shasum": ""
},
"require": {
"filament/filament": "^3.0",
"illuminate/contracts": "^10.0|^11.0",
"php": "^8.1",
"spatie/laravel-package-tools": "^1.15.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Njxqlus\\Filament\\Components\\FilamentRelationManagerComponentServiceProvider"
],
"aliases": {
"FilamentRelationManagerComponent": "Njxqlus\\Filament\\Components\\Facades\\FilamentRelationManagerComponent"
}
}
},
"autoload": {
"psr-4": {
"Njxqlus\\Filament\\Components\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mikael Ahabalyants",
"email": "njxqlus@gmail.com",
"role": "Developer"
}
],
"description": "Use Filament Relation Manager Everywhere!",
"homepage": "https://github.com/njxqlus/filament-relation-manager-component",
"keywords": [
"filament",
"filament-relation-manager-component",
"laravel",
"njxqlus"
],
"support": {
"issues": "https://github.com/njxqlus/filament-relation-manager-component/issues",
"source": "https://github.com/njxqlus/filament-relation-manager-component"
},
"funding": [
{
"url": "https://github.com/njxqlus",
"type": "github"
}
],
"time": "2024-05-26T23:02:11+00:00"
},
{
"name": "nunomaduro/termwind",
"version": "v2.0.1",
@ -13476,5 +13555,5 @@
"ext-zip": "*"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.3.0"
}