mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 12:46:51 +01:00 
			
		
		
		
	Add server url to allocations relationship manager
This commit is contained in:
		
							parent
							
								
									27059e7b99
								
							
						
					
					
						commit
						26da0c5e74
					
				@ -3,6 +3,7 @@
 | 
				
			|||||||
namespace App\Filament\Resources\NodeResource\RelationManagers;
 | 
					namespace App\Filament\Resources\NodeResource\RelationManagers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Allocation;
 | 
					use App\Models\Allocation;
 | 
				
			||||||
 | 
					use App\Models\Server;
 | 
				
			||||||
use App\Services\Allocations\AssignmentService;
 | 
					use App\Services\Allocations\AssignmentService;
 | 
				
			||||||
use Filament\Forms;
 | 
					use Filament\Forms;
 | 
				
			||||||
use Filament\Forms\Form;
 | 
					use Filament\Forms\Form;
 | 
				
			||||||
@ -37,12 +38,19 @@ class AllocationsRelationManager extends RelationManager
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // All assigned allocations
 | 
					            // All assigned allocations
 | 
				
			||||||
            ->checkIfRecordIsSelectableUsing(fn (Allocation $allocation) => $allocation->server_id === null)
 | 
					            ->checkIfRecordIsSelectableUsing(fn (Allocation $allocation) => $allocation->server_id === null)
 | 
				
			||||||
 | 
					            ->searchable()
 | 
				
			||||||
            ->columns([
 | 
					            ->columns([
 | 
				
			||||||
                Tables\Columns\TextColumn::make('server.name')->label('Server')->icon('tabler-brand-docker'),
 | 
					                Tables\Columns\TextColumn::make('server.name')
 | 
				
			||||||
                Tables\Columns\TextColumn::make('ip_alias')->label('Alias'),
 | 
					                    ->label('Server')
 | 
				
			||||||
                Tables\Columns\TextColumn::make('ip')->label('IP'),
 | 
					                    ->icon('tabler-brand-docker')
 | 
				
			||||||
                Tables\Columns\TextColumn::make('port')->label('Port'),
 | 
					                    ->url(fn (Allocation $allocation): string => $allocation->server ? route('filament.admin.resources.servers.edit', ['record' => $allocation->server]) : ''),
 | 
				
			||||||
 | 
					                Tables\Columns\TextColumn::make('ip_alias')
 | 
				
			||||||
 | 
					                    ->label('Alias'),
 | 
				
			||||||
 | 
					                Tables\Columns\TextColumn::make('ip')
 | 
				
			||||||
 | 
					                    ->label('IP'),
 | 
				
			||||||
 | 
					                Tables\Columns\TextColumn::make('port')
 | 
				
			||||||
 | 
					                    ->searchable()
 | 
				
			||||||
 | 
					                    ->label('Port'),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
            ->filters([
 | 
					            ->filters([
 | 
				
			||||||
                //
 | 
					                //
 | 
				
			||||||
@ -59,7 +67,6 @@ class AllocationsRelationManager extends RelationManager
 | 
				
			|||||||
                            ->inlineLabel()
 | 
					                            ->inlineLabel()
 | 
				
			||||||
                            ->ipv4()
 | 
					                            ->ipv4()
 | 
				
			||||||
                            ->helperText("Usually your machine's public IP unless you are port forwarding.")
 | 
					                            ->helperText("Usually your machine's public IP unless you are port forwarding.")
 | 
				
			||||||
                            // ->selectablePlaceholder(false)
 | 
					 | 
				
			||||||
                            ->required(),
 | 
					                            ->required(),
 | 
				
			||||||
                        Forms\Components\TextInput::make('allocation_alias')
 | 
					                        Forms\Components\TextInput::make('allocation_alias')
 | 
				
			||||||
                            ->label('Alias')
 | 
					                            ->label('Alias')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user