mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Merge pull request #56 from pelican-dev/feature/mounts
Mounts: Relationships for Eggs & Nodes
This commit is contained in:
commit
c54217f236
@ -81,12 +81,6 @@ class DatabaseHostResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('node.name')
|
Tables\Columns\TextColumn::make('node.name')
|
||||||
->numeric()
|
->numeric()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->sortable(),
|
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
//
|
//
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\MountResource\Pages;
|
use App\Filament\Resources\MountResource\Pages;
|
||||||
use App\Filament\Resources\MountResource\RelationManagers;
|
|
||||||
use App\Models\Mount;
|
use App\Models\Mount;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\Group;
|
||||||
|
use Filament\Forms\Components\Section;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class MountResource extends Resource
|
class MountResource extends Resource
|
||||||
{
|
{
|
||||||
@ -23,57 +23,78 @@ class MountResource extends Resource
|
|||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('name')
|
Section::make()->schema([
|
||||||
->required()
|
Forms\Components\TextInput::make('name')
|
||||||
->helperText('Unique name used to separate this mount from another.')
|
->required()
|
||||||
->maxLength(191),
|
->helperText('Unique name used to separate this mount from another.')
|
||||||
Forms\Components\ToggleButtons::make('read_only')
|
->maxLength(64),
|
||||||
->label('Read only?')
|
Forms\Components\ToggleButtons::make('read_only')
|
||||||
->helperText('Is the mount read only inside the container?')
|
->label('Read only?')
|
||||||
->options([
|
->helperText('Is the mount read only inside the container?')
|
||||||
false => 'Writeable',
|
->options([
|
||||||
true => 'Read only',
|
false => 'Writeable',
|
||||||
|
true => 'Read only',
|
||||||
|
])
|
||||||
|
->icons([
|
||||||
|
false => 'tabler-writing',
|
||||||
|
true => 'tabler-writing-off',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
false => 'warning',
|
||||||
|
true => 'success',
|
||||||
|
])
|
||||||
|
->inline()
|
||||||
|
->default(false)
|
||||||
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('source')
|
||||||
|
->required()
|
||||||
|
->helperText('File path on the host system to mount to a container.')
|
||||||
|
->maxLength(191),
|
||||||
|
Forms\Components\TextInput::make('target')
|
||||||
|
->required()
|
||||||
|
->helperText('Where the mount will be accessible inside a container.')
|
||||||
|
->maxLength(191),
|
||||||
|
Forms\Components\ToggleButtons::make('user_mountable')
|
||||||
|
->hidden()
|
||||||
|
->label('User mountable?')
|
||||||
|
->options([
|
||||||
|
false => 'No',
|
||||||
|
true => 'Yes',
|
||||||
|
])
|
||||||
|
->icons([
|
||||||
|
false => 'tabler-user-cancel',
|
||||||
|
true => 'tabler-user-bolt',
|
||||||
|
])
|
||||||
|
->colors([
|
||||||
|
false => 'success',
|
||||||
|
true => 'warning',
|
||||||
|
])
|
||||||
|
->default(false)
|
||||||
|
->inline()
|
||||||
|
->required(),
|
||||||
|
Forms\Components\Textarea::make('description')
|
||||||
|
->helperText('A longer description for this mount.')
|
||||||
|
->columnSpanFull(),
|
||||||
|
])->columnSpan(2)->columns([
|
||||||
|
'default' => 1,
|
||||||
|
'lg' => 2,
|
||||||
|
]),
|
||||||
|
Group::make()->schema([
|
||||||
|
Section::make()->schema([
|
||||||
|
Select::make('eggs')->multiple()
|
||||||
|
->relationship('eggs', 'name')
|
||||||
|
->preload(),
|
||||||
|
Select::make('nodes')->multiple()
|
||||||
|
->relationship('nodes', 'name')
|
||||||
|
->searchable(['name', 'fqdn'])
|
||||||
|
->preload(),
|
||||||
])
|
])
|
||||||
->icons([
|
])->columns([
|
||||||
false => 'tabler-writing',
|
'default' => 1,
|
||||||
true => 'tabler-writing-off',
|
]),
|
||||||
])
|
])->columns([
|
||||||
->colors([
|
'default' => 1,
|
||||||
false => 'warning',
|
'lg' => 3,
|
||||||
true => 'success',
|
|
||||||
])
|
|
||||||
->inline()
|
|
||||||
->default(false)
|
|
||||||
->required(),
|
|
||||||
Forms\Components\TextInput::make('source')
|
|
||||||
->required()
|
|
||||||
->helperText('File path on the host system to mount to a container.')
|
|
||||||
->maxLength(191),
|
|
||||||
Forms\Components\TextInput::make('target')
|
|
||||||
->required()
|
|
||||||
->helperText('Where the mount will be accessible inside a container.')
|
|
||||||
->maxLength(191),
|
|
||||||
Forms\Components\ToggleButtons::make('user_mountable')
|
|
||||||
->hidden()
|
|
||||||
->label('User mountable?')
|
|
||||||
->options([
|
|
||||||
false => 'No',
|
|
||||||
true => 'Yes',
|
|
||||||
])
|
|
||||||
->icons([
|
|
||||||
false => 'tabler-user-cancel',
|
|
||||||
true => 'tabler-user-bolt',
|
|
||||||
])
|
|
||||||
->colors([
|
|
||||||
false => 'success',
|
|
||||||
true => 'warning',
|
|
||||||
])
|
|
||||||
->default(false)
|
|
||||||
->inline()
|
|
||||||
->required(),
|
|
||||||
Forms\Components\Textarea::make('description')
|
|
||||||
->helperText('A longer description for this mount.')
|
|
||||||
->columnSpanFull(),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user