[增添]增加了网络配置界面基本设置
This commit is contained in:
66
management-panel/app/Filament/Pages/ManageNetwork.php
Normal file
66
management-panel/app/Filament/Pages/ManageNetwork.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\NetworkSettings;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Fieldset;
|
||||
|
||||
class ManageNetwork extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
|
||||
|
||||
protected static string $settings = NetworkSettings::class;
|
||||
|
||||
protected static ?string $navigationLabel = '网络连接配置管理';
|
||||
|
||||
protected static ?string $title = '网络连接配置管理';
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Select::make('dhcp_enabled')
|
||||
->options([
|
||||
true => "是",
|
||||
false => "否"
|
||||
])
|
||||
->default(false)
|
||||
->label("DHCP启用")
|
||||
->required()
|
||||
->reactive(),
|
||||
|
||||
Fieldset::make()
|
||||
->schema([
|
||||
TextInput::make('ip_address')
|
||||
->label("IP地址")
|
||||
->placeholder('如127.0.0.1')
|
||||
->required(),
|
||||
|
||||
TextInput::make('subnet_mask')
|
||||
->label('子网掩码')
|
||||
->placeholder('如255.255.255.0')
|
||||
->required(),
|
||||
|
||||
TextInput::make('gateway')
|
||||
->label('网关')
|
||||
->placeholder('如192.168.1.1')
|
||||
->required(),
|
||||
|
||||
TextInput::make('dns_server_1')
|
||||
->label('DNS地址')
|
||||
->placeholder('如6.6.6.6')
|
||||
->required(),
|
||||
|
||||
TextInput::make('dns_server_2')
|
||||
->label('DNS备用地址')
|
||||
->placeholder('如114.114.114.114')
|
||||
->required(),
|
||||
])
|
||||
->visible(fn($get) => in_array($get('dhcp_enabled'), [false])),
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
management-panel/app/Settings/NetworkSettings.php
Normal file
20
management-panel/app/Settings/NetworkSettings.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Settings;
|
||||
|
||||
use Spatie\LaravelSettings\Settings;
|
||||
|
||||
class NetworkSettings extends Settings
|
||||
{
|
||||
public ?string $ip_address;
|
||||
public ?string $subnet_mask;
|
||||
public ?string $gateway;
|
||||
public ?string $dns_server_1;
|
||||
public ?string $dns_server_2;
|
||||
public bool $dhcp_enabled;
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'network';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user