Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
RMartinOscar committed Oct 18, 2024
1 parent bd42825 commit f1f989f
Show file tree
Hide file tree
Showing 14 changed files with 392 additions and 271 deletions.
3 changes: 2 additions & 1 deletion app/Filament/Resources/ApiKeyResource/Pages/CreateApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public function form(Form $form): Form
])
->schema(
collect(ApiKey::RESOURCES)->map(fn ($resource) => ToggleButtons::make("r_$resource")
->label(str($resource)->replace('_', ' ')->title())->inline()
->label(str($resource)->replace('_', ' ')->title())
->inline()
->options([
0 => 'None',
1 => 'Read',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public function form(Form $form): Form
TextInput::make('database')->columnSpanFull(),
TextInput::make('username'),
TextInput::make('password')
->password()
->revealable()
->hintAction(
Action::make('rotate')
->icon('tabler-refresh')
Expand Down
22 changes: 16 additions & 6 deletions app/Filament/Resources/EggResource/Pages/CreateEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,21 @@ public function form(Form $form): Form
->maxLength(255)
->label('Stop Command')
->helperText('The command that should be sent to server processes to stop them gracefully. If you need to send a SIGINT you should enter ^C here.'),
Textarea::make('config_startup')->rows(10)->json()
Textarea::make('config_startup')
->rows(10)
->json()
->label('Start Configuration')
->default('{}')
->helperText('List of values the daemon should be looking for when booting a server to determine completion.'),
Textarea::make('config_files')->rows(10)->json()
Textarea::make('config_files')
->rows(10)
->json()
->label('Configuration Files')
->default('{}')
->helperText('This should be a JSON representation of configuration files to modify and what parts should be changed.'),
Textarea::make('config_logs')->rows(10)->json()
Textarea::make('config_logs')
->rows(10)
->json()
->label('Log Configuration')
->default('{}')
->helperText('This should be a JSON representation of where log files are stored, and whether or not the daemon should be creating custom logs.'),
Expand All @@ -156,8 +162,10 @@ public function form(Form $form): Form
->grid()
->relationship('variables')
->name('name')
->reorderable()->orderColumn()
->collapsible()->collapsed()
->reorderable()
->orderColumn()
->collapsible()
->collapsed()
->columnSpan(2)
->defaultItems(0)
->itemLabel(fn (array $state) => $state['name'])
Expand Down Expand Up @@ -255,7 +263,9 @@ public function form(Form $form): Form
->view('filament.plugins.monaco-editor'),
]),

])->columnSpanFull()->persistTabInQueryString(),
])
->columnSpanFull()
->persistTabInQueryString(),
]);
}

Expand Down
19 changes: 14 additions & 5 deletions app/Filament/Resources/EggResource/Pages/EditEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,19 @@ public function form(Form $form): Form
->maxLength(255)
->label('Stop Command')
->helperText('The command that should be sent to server processes to stop them gracefully. If you need to send a SIGINT you should enter ^C here.'),
Textarea::make('config_startup')->rows(10)->json()
Textarea::make('config_startup')
->rows(10)
->json()
->label('Start Configuration')
->helperText('List of values the daemon should be looking for when booting a server to determine completion.'),
Textarea::make('config_files')->rows(10)->json()
Textarea::make('config_files')
->rows(10)
->json()
->label('Configuration Files')
->helperText('This should be a JSON representation of configuration files to modify and what parts should be changed.'),
Textarea::make('config_logs')->rows(10)->json()
Textarea::make('config_logs')
->rows(10)
->json()
->label('Log Configuration')
->helperText('This should be a JSON representation of where log files are stored, and whether or not the daemon should be creating custom logs.'),
]),
Expand All @@ -180,7 +186,8 @@ public function form(Form $form): Form
->relationship('variables')
->name('name')
->reorderable()
->collapsible()->collapsed()
->collapsible()
->collapsed()
->orderColumn()
->addActionLabel('New Variable')
->itemLabel(fn (array $state) => $state['name'])
Expand Down Expand Up @@ -273,7 +280,9 @@ public function form(Form $form): Form
->language('shell')
->view('filament.plugins.monaco-editor'),
]),
])->columnSpanFull()->persistTabInQueryString(),
])
->columnSpanFull()
->persistTabInQueryString(),
]);
}

Expand Down
10 changes: 6 additions & 4 deletions app/Filament/Resources/MountResource/Pages/CreateMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ public function form(Form $form): Form
->helperText('A longer description for this mount.')
->columnSpanFull(),
Hidden::make('user_mountable')->default(1),
])->columnSpan(1)->columns([
'default' => 1,
'lg' => 2,
]),
])
->columnSpan(1)
->columns([
'default' => 1,
'lg' => 2,
]),
Group::make()->schema([
Section::make()->schema([
Select::make('eggs')->multiple()
Expand Down
10 changes: 6 additions & 4 deletions app/Filament/Resources/MountResource/Pages/EditMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ public function form(Form $form): Form
Textarea::make('description')
->helperText('A longer description for this mount.')
->columnSpanFull(),
])->columnSpan(1)->columns([
'default' => 1,
'lg' => 2,
]),
])
->columnSpan(1)
->columns([
'default' => 1,
'lg' => 2,
]),
Group::make()->schema([
Section::make()->schema([
Select::make('eggs')->multiple()
Expand Down
39 changes: 27 additions & 12 deletions app/Filament/Resources/NodeResource/Pages/CreateNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ public function form(Forms\Form $form): Forms\Form
])
->schema([
ToggleButtons::make('maintenance_mode')
->label('Maintenance Mode')->inline()
->label('Maintenance Mode')
->inline()
->columnSpan(1)
->default(false)
->hinticon('tabler-question-mark')
Expand All @@ -204,7 +205,8 @@ public function form(Forms\Form $form): Forms\Form
ToggleButtons::make('public')
->default(true)
->columnSpan(1)
->label('Use Node for deployment?')->inline()
->label('Use Node for deployment?')
->inline()
->options([
true => 'Yes',
false => 'No',
Expand All @@ -220,7 +222,8 @@ public function form(Forms\Form $form): Forms\Form
->label('Upload Limit')
->helperText('Enter the maximum size of files that can be uploaded through the web-based file manager.')
->columnSpan(1)
->numeric()->required()
->numeric()
->required()
->default(256)
->minValue(1)
->maxValue(1024)
Expand All @@ -242,7 +245,9 @@ public function form(Forms\Form $form): Forms\Form
->columnSpanFull()
->schema([
ToggleButtons::make('unlimited_mem')
->label('Memory')->inlineLabel()->inline()
->label('Memory')
->inlineLabel()
->inline()
->afterStateUpdated(function (Set $set) {
$set('memory', 0);
$set('memory_overallocate', 0);
Expand All @@ -261,7 +266,8 @@ public function form(Forms\Form $form): Forms\Form
TextInput::make('memory')
->dehydratedWhenHidden()
->hidden(fn (Get $get) => $get('unlimited_mem'))
->label('Memory Limit')->inlineLabel()
->label('Memory Limit')
->inlineLabel()
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB')
->columnSpan(2)
->numeric()
Expand All @@ -270,7 +276,8 @@ public function form(Forms\Form $form): Forms\Form
->required(),
TextInput::make('memory_overallocate')
->dehydratedWhenHidden()
->label('Overallocate')->inlineLabel()
->label('Overallocate')
->inlineLabel()
->hidden(fn (Get $get) => $get('unlimited_mem'))
->hintIcon('tabler-question-mark')
->hintIconTooltip('The % allowable to go over the set limit.')
Expand All @@ -287,7 +294,9 @@ public function form(Forms\Form $form): Forms\Form
->columnSpanFull()
->schema([
ToggleButtons::make('unlimited_disk')
->label('Disk')->inlineLabel()->inline()
->label('Disk')
->inlineLabel()
->inline()
->live()
->afterStateUpdated(function (Set $set) {
$set('disk', 0);
Expand All @@ -306,7 +315,8 @@ public function form(Forms\Form $form): Forms\Form
TextInput::make('disk')
->dehydratedWhenHidden()
->hidden(fn (Get $get) => $get('unlimited_disk'))
->label('Disk Limit')->inlineLabel()
->label('Disk Limit')
->inlineLabel()
->suffix(config('panel.use_binary_prefix') ? 'MiB' : 'MB')
->columnSpan(2)
->numeric()
Expand All @@ -316,7 +326,8 @@ public function form(Forms\Form $form): Forms\Form
TextInput::make('disk_overallocate')
->dehydratedWhenHidden()
->hidden(fn (Get $get) => $get('unlimited_disk'))
->label('Overallocate')->inlineLabel()
->label('Overallocate')
->inlineLabel()
->hintIcon('tabler-question-mark')
->hintIconTooltip('The % allowable to go over the set limit.')
->columnSpan(2)
Expand All @@ -332,7 +343,9 @@ public function form(Forms\Form $form): Forms\Form
->columnSpanFull()
->schema([
ToggleButtons::make('unlimited_cpu')
->label('CPU')->inlineLabel()->inline()
->label('CPU')
->inlineLabel()
->inline()
->live()
->afterStateUpdated(function (Set $set) {
$set('cpu', 0);
Expand All @@ -351,7 +364,8 @@ public function form(Forms\Form $form): Forms\Form
TextInput::make('cpu')
->dehydratedWhenHidden()
->hidden(fn (Get $get) => $get('unlimited_cpu'))
->label('CPU Limit')->inlineLabel()
->label('CPU Limit')
->inlineLabel()
->suffix('%')
->columnSpan(2)
->numeric()
Expand All @@ -361,7 +375,8 @@ public function form(Forms\Form $form): Forms\Form
TextInput::make('cpu_overallocate')
->dehydratedWhenHidden()
->hidden(fn (Get $get) => $get('unlimited_cpu'))
->label('Overallocate')->inlineLabel()
->label('Overallocate')
->inlineLabel()
->hintIcon('tabler-question-mark')
->hintIconTooltip('The % allowable to go over the set limit.')
->columnSpan(2)
Expand Down
Loading

0 comments on commit f1f989f

Please sign in to comment.