[增添]增添了后缀下拉菜单组件,修正了时间单位模版设置
This commit is contained in:
@@ -8,6 +8,7 @@ use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\SettingsPage;
|
||||
use Marvinosswald\FilamentInputSelectAffix\TextInputSelectAffix;
|
||||
|
||||
class ManageTime extends SettingsPage
|
||||
{
|
||||
@@ -23,22 +24,72 @@ class ManageTime extends SettingsPage
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('global_scrape_interval')
|
||||
TextInputSelectAffix::make('global_scrape_interval')
|
||||
->label('默认拉取时间')
|
||||
->numeric()
|
||||
->required()
|
||||
->suffix("s"),
|
||||
TextInput::make('node_exporter_scrape_interval')
|
||||
->select(fn() => Forms\Components\Select::make('global_scrape_interval_unit')
|
||||
->extraAttributes([
|
||||
'class' => 'w-[72px]' // if you want to constrain the selects size, depending on your usecase
|
||||
])
|
||||
->options([
|
||||
'd' => '天',
|
||||
'h' => '小时',
|
||||
'm' => '分钟',
|
||||
's' => '秒'
|
||||
])
|
||||
->required()
|
||||
|
||||
),
|
||||
TextInputSelectAffix::make('node_exporter_scrape_interval')
|
||||
->label('系统监控时间间隔')
|
||||
->required()
|
||||
->suffix("s"),
|
||||
TextInput::make('opcua_scrape_interval')
|
||||
->numeric()
|
||||
->select(fn() => Forms\Components\Select::make('node_exporter_scrape_interval_unit')
|
||||
->extraAttributes([
|
||||
'class' => 'w-[72px]' // if you want to constrain the selects size, depending on your usecase
|
||||
])
|
||||
->options([
|
||||
'd' => '天',
|
||||
'h' => '小时',
|
||||
'm' => '分钟',
|
||||
's' => '秒'
|
||||
])
|
||||
->required()
|
||||
|
||||
),
|
||||
TextInputSelectAffix::make('opcua_scrape_interval')
|
||||
->label('opcua_exporter抓取间隔')
|
||||
->required()
|
||||
->suffix("s"),
|
||||
TextInput::make('storage_interval')
|
||||
->numeric()
|
||||
->select(fn() => Forms\Components\Select::make('opcua_scrape_interval_unit')
|
||||
->extraAttributes([
|
||||
'class' => 'w-[72px]' // if you want to constrain the selects size, depending on your usecase
|
||||
])
|
||||
->options([
|
||||
'd' => '天',
|
||||
'h' => '小时',
|
||||
'm' => '分钟',
|
||||
's' => '秒'
|
||||
])
|
||||
->required()
|
||||
),
|
||||
TextInputSelectAffix::make('storage_interval')
|
||||
->label('数据存储时间')
|
||||
->required()
|
||||
->suffix("h"),
|
||||
->numeric()
|
||||
->select(fn() => Forms\Components\Select::make('storage_interval_unit')
|
||||
->extraAttributes([
|
||||
'class' => 'w-[72px]' // if you want to constrain the selects size, depending on your usecase
|
||||
])
|
||||
->options([
|
||||
'd' => '天',
|
||||
'h' => '小时',
|
||||
'm' => '分钟',
|
||||
's' => '秒'
|
||||
])
|
||||
->required()
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,13 @@ class TimeSettings extends Settings
|
||||
// 数据存储时间
|
||||
public ?string $storage_interval;
|
||||
|
||||
public ?string $global_scrape_interval_unit;
|
||||
public ?string $node_exporter_scrape_interval_unit;
|
||||
public ?string $opcua_scrape_interval_unit;
|
||||
public ?string $storage_interval_unit;
|
||||
|
||||
|
||||
|
||||
public static function group(): string
|
||||
{
|
||||
return 'time';
|
||||
|
||||
Reference in New Issue
Block a user