[增添]增加了网络配置界面基本设置
This commit is contained in:
@@ -2,7 +2,7 @@ APP_NAME=Laravel
|
|||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_TIMEZONE=UTC
|
APP_TIMEZONE=Asia/Shanghai
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
APP_LOCALE=zh_CN
|
APP_LOCALE=zh_CN
|
||||||
|
|||||||
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,5 +6,6 @@ return [
|
|||||||
\App\Settings\ExporterSettings::class,
|
\App\Settings\ExporterSettings::class,
|
||||||
\App\Settings\TimeSettings::class,
|
\App\Settings\TimeSettings::class,
|
||||||
\App\Settings\RemoteWriteSettings::class,
|
\App\Settings\RemoteWriteSettings::class,
|
||||||
|
\App\Settings\NetworkSettings::class
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Spatie\LaravelSettings\Migrations\SettingsMigration;
|
||||||
|
|
||||||
|
return new class extends SettingsMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$this->migrator->add('network.ip_address');
|
||||||
|
$this->migrator->add('network.subnet_mask');
|
||||||
|
$this->migrator->add('network.gateway');
|
||||||
|
$this->migrator->add('network.dns_server_1');
|
||||||
|
$this->migrator->add('network.dns_server_2');
|
||||||
|
$this->migrator->add('network.dhcp_enabled', false);
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user