Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings page & few small improvements #259

Closed
wants to merge 97 commits into from
Closed
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
b896680
First Commit
Poseidon281 May 19, 2024
9e1410e
Pint Fix
Poseidon281 May 19, 2024
04faf24
Delete useless helper
Poseidon281 May 19, 2024
0ec9d0b
This should fix the config problem only it does not
Poseidon281 May 19, 2024
91a04c8
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 May 19, 2024
1cd46b5
Added nav sort and Cache Flush
Poseidon281 May 19, 2024
2b7d013
Deleted unnecessary code
Poseidon281 May 20, 2024
b989405
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 May 20, 2024
e61d3f3
Composer update
Poseidon281 May 26, 2024
1c3eaa0
Revert "Composer update"
Poseidon281 May 27, 2024
5884df7
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 May 27, 2024
a80c814
Merge branch 'pelican-dev:main' into Settings
Poseidon281 May 30, 2024
06ba994
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 May 31, 2024
e04087d
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 8, 2024
575f190
Fixed TODO 1
Poseidon281 Jun 8, 2024
ea59c39
Made the more settings migration
Poseidon281 Jun 8, 2024
6e8c7ee
Finish TODO 1
Poseidon281 Jun 8, 2024
8d90c0f
Pint Fixes
Poseidon281 Jun 8, 2024
50b012a
Composer update
Poseidon281 Jun 8, 2024
c8ba7e4
Fix migration rollback
Poseidon281 Jun 8, 2024
cc3f2a2
Revert "Composer update"
Poseidon281 Jun 9, 2024
c5c3efc
Merge branch 'main' into Settings
Poseidon281 Jun 9, 2024
00dd77e
Deleted unnecessary cluster and added Exit Admin button with config
Poseidon281 Jun 11, 2024
1ec9ac3
Pint Fixes and TODO 2
Poseidon281 Jun 11, 2024
3ce1ec8
Fix bug with rendering the page
Poseidon281 Jun 11, 2024
409f845
Added labels, updated at column, Pint Fixes and changed description i…
Poseidon281 Jun 11, 2024
45cd368
Some minor things and more settings added
Poseidon281 Jun 11, 2024
5cdef59
Added Limit option
Poseidon281 Jun 11, 2024
5338d7c
Added groups and Pint Fixes
Poseidon281 Jun 11, 2024
af8763e
Fix default group error
Poseidon281 Jun 11, 2024
bc01428
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 12, 2024
b36a3b0
Put Exit Admin in both User Profile dropdown and nav bar
Poseidon281 Jun 12, 2024
0058105
Add toggle buttons
lancepioch Jun 12, 2024
cc8e7ee
Remove limiter
lancepioch Jun 12, 2024
5ecfb85
Merge branch 'Settings' of github.com:Poseidon281/Pelican-Panel into …
lancepioch Jun 12, 2024
e67ed73
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 12, 2024
31441f8
Remove Limiter Translations
Poseidon281 Jun 12, 2024
775ff40
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 14, 2024
5a28f5f
Big update
Poseidon281 Jun 14, 2024
513aa3c
Added select function back
Poseidon281 Jun 14, 2024
319f74a
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 14, 2024
11aee04
Delete unnecessary Settings-Cluster
Poseidon281 Jun 14, 2024
6098f62
Fix TODO 12
Poseidon281 Jun 14, 2024
02d5202
Pint Fixes
Poseidon281 Jun 14, 2024
3f60113
Testing adding new settings
Poseidon281 Jun 14, 2024
d5539c0
Making a few comments
Poseidon281 Jun 14, 2024
263e4a5
Temporay fix for the toggle buttons not working
Poseidon281 Jun 15, 2024
02b06e7
A beginning for TODO 14
Poseidon281 Jun 15, 2024
c6622db
Styling and added importer
Poseidon281 Jun 15, 2024
6a469d6
Removing a little bit of logging
Poseidon281 Jun 15, 2024
a28239e
Added more icons
Poseidon281 Jun 15, 2024
e36736c
Added Mail settings
Poseidon281 Jun 15, 2024
37a0c76
Pint Fixes
Poseidon281 Jun 15, 2024
490900c
Removed unnecessary setting
Poseidon281 Jun 16, 2024
4dba15d
This should fix the bug with getting the settings
Poseidon281 Jun 16, 2024
9aabd8e
removing bootstrap icons
Poseidon281 Jun 16, 2024
00c2054
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 16, 2024
17ac6d6
Composer update
Poseidon281 Jun 16, 2024
737dfa8
Merge branch 'main' into Settings
Poseidon281 Jun 17, 2024
fe06f80
Revert "Composer update"
Poseidon281 Jun 17, 2024
815467a
Pint and other fixes
Poseidon281 Jun 17, 2024
cf0a87d
Lance's Requested changes
Poseidon281 Jun 18, 2024
e2234bb
Fixed TODO 15
Poseidon281 Jun 19, 2024
4c13544
Several changes
Poseidon281 Jun 19, 2024
3c4f392
Removed exports/imports and migrations
Poseidon281 Jun 19, 2024
d912356
Removed unneccesary header action
Poseidon281 Jun 19, 2024
a5f63d4
Simplified/removed unneccesary code
Poseidon281 Jun 19, 2024
db6aa5f
Fixed TODO 5
Poseidon281 Jun 20, 2024
6caf707
Reverted a bit of AdminPanelProvider
Poseidon281 Jun 20, 2024
0bb87f9
Styling the table a bit
Poseidon281 Jun 20, 2024
d1e8eca
Added reCAPTCHA settings
Poseidon281 Jun 20, 2024
693f02e
Multiple things:
Poseidon281 Jun 21, 2024
956c30c
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 21, 2024
cc32173
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 25, 2024
3bcce89
Fix PHPstan except the API errors
Poseidon281 Jun 27, 2024
207202e
Pint
Poseidon281 Jun 27, 2024
f52f9aa
Fix Subheading bug
Poseidon281 Jun 30, 2024
9ff2fe2
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jun 30, 2024
c51c073
Fix TODO 10 and Pint
Poseidon281 Jul 2, 2024
a481b72
Make sure description does not cause an error
Poseidon281 Jul 2, 2024
4455de9
Fix description not working and ignoring phpstan errors
Poseidon281 Jul 2, 2024
e53c946
Added 2 TODO's
Poseidon281 Jul 2, 2024
505cc74
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jul 2, 2024
2c60a89
Merge branch 'Settings' of https://github.com/Poseidon281/Pelican-Pan…
Poseidon281 Jul 2, 2024
638a5a7
Fix Pint
Poseidon281 Jul 2, 2024
2dd90ba
Last things after review with Lance
Poseidon281 Jul 2, 2024
fcfa491
Forgot this
Poseidon281 Jul 2, 2024
f5ad4fc
Remove old database settings
lancepioch Jul 2, 2024
27a3afb
Make better
lancepioch Jul 2, 2024
c843aee
Unbreak /legacy
Poseidon281 Jul 2, 2024
a89572b
Header does not need to be removed
Poseidon281 Jul 3, 2024
22e6e5d
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jul 3, 2024
2805319
Fix PHPstan
Poseidon281 Jul 3, 2024
51a4d24
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jul 4, 2024
cd7adde
Change EditAction to TextInputColumn
Poseidon281 Jul 9, 2024
02af4eb
Pint Fixes
Poseidon281 Jul 9, 2024
5e45e2e
Merge remote-tracking branch 'upstream/main' into Settings
Poseidon281 Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ SESSION_DOMAIN=null
# Set this to true, and set start & end ports to auto create allocations.
PANEL_CLIENT_ALLOCATIONS_ENABLED=false
PANEL_CLIENT_ALLOCATIONS_RANGE_START=
PANEL_CLIENT_ALLOCATIONS_RANGE_END=
PANEL_CLIENT_ALLOCATIONS_RANGE_END=
10 changes: 0 additions & 10 deletions app/Filament/Clusters/Settings.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function form(Form $form): Form
$end = min((int) $end, 2 ** 16 - 1);
$range = $start <= $end ? range($start, $end) : range($end, $start);
foreach ($range as $i) {
if($i > 1024 && $i <= 65535) {
if ($i > 1024 && $i <= 65535) {
$ports->push($i);
}
}
Expand Down
114 changes: 114 additions & 0 deletions app/Filament/Resources/SettingResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\SettingResource\Pages;
use App\Models\Setting;
use Filament\Resources\Resource;
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\ToggleButtons;
use Filament\Tables\Actions\EditAction;

class SettingResource extends Resource
{
protected static ?string $model = Setting::class;

protected static ?string $navigationIcon = 'tabler-settings';

public static function canCreate(): bool
{
return false;
}

protected static ?int $navigationSort = 23;

Poseidon281 marked this conversation as resolved.
Show resolved Hide resolved
public static function table(Table $table): Table
{
return $table
->paginated(false)
->searchable(false)
->query(Setting::query())
Poseidon281 marked this conversation as resolved.
Show resolved Hide resolved
->striped(false)
//->heading('Settings')
Poseidon281 marked this conversation as resolved.
Show resolved Hide resolved
->recordUrl(null)
->recordAction(EditAction::class)
->columns([
TextColumn::make('label')
->label('Setting')
->sortable()
->searchable()
->tooltip(fn ($record) => $record->description ?? 'No description available'),

TextColumn::make('value')
->label('Value')
->formatStateUsing(fn ($state) => $state === null ? 'Empty' : $state)
->hidden(false) // TODO hide when the type is password
Poseidon281 marked this conversation as resolved.
Show resolved Hide resolved
->sortable()
->searchable(),
])
->actions([
EditAction::make()
->using(function (Setting $setting, array $data): Setting {
$setting->writeToEnvironment([$setting->key => $data['value']]);

return $setting;
})
->form(function (Setting $setting) {
return match ($setting->type) {
'select' => [
Select::make('value')
->label($setting->label)
->options($setting->options),
],
'number' => [
TextInput::make('value')
->label($setting->label)
->placeholder($setting->description)
->type('number'),
],
'limit' => [
TextInput::make('value')
->label($setting->label)
->maxLength($setting->limit)
->placeholder($setting->description),
],
'password' => [
TextInput::make('value')
->label($setting->label)
->password()
->revealable()
->placeholder($setting->description),
],
'toggle-buttons' => [
ToggleButtons::make('value')
->inline(true)
->label($setting->label)
->options([
'true' => 'True',
'false' => 'False',
])
->colors([
'false' => 'danger',
'true' => 'success',
]),
],
default => [
TextInput::make('value')
->label($setting->label)
->placeholder($setting->description),
],
};
}),
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ManageSettings::route('/'),
];
}
}
38 changes: 38 additions & 0 deletions app/Filament/Resources/SettingResource/Pages/ManageSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Filament\Resources\SettingResource\Pages;

use App\Filament\Resources\SettingResource;
use Filament\Resources\Pages\ManageRecords;
use Filament\Resources\Components\Tab;
use Illuminate\Database\Eloquent\Builder;

class ManageSettings extends ManageRecords
{
protected static string $resource = SettingResource::class;

public function getSubheading(): ?string
{
return 'Configure Pelican to your liking.';
}

public function getTabs(): array
{
return [
'panel' => Tab::make('Panel Settings')
->icon('tabler-home') // TODO search for a better icon for this
->modifyQueryUsing(fn (Builder $query) => $query->where('tabs', 'Panel')),
'mail' => Tab::make('Mail Settings')
->icon('tabler-mail')
->modifyQueryUsing(fn (Builder $query) => $query->where('tabs', 'Mail')),
'Advanced' => Tab::make('Advanced Settings')
->icon('tabler-adjustments-alt')
->modifyQueryUsing(fn (Builder $query) => $query->where('tabs', 'Advanced')),
];
}

public function getDefaultActiveTab(): string|int|null
{
return 'panel';
}
}
Loading
Loading