Files
data-collection-terminal/management-panel/app/Filament/Pages/ManageTime.php

96 lines
3.8 KiB
PHP

<?php
namespace App\Filament\Pages;
use App\Settings\TimeSettings;
use Filament\Forms;
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
{
protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';
protected static string $settings = TimeSettings::class;
protected static ?string $navigationLabel = '时间配置管理'; // 设置侧边栏的中文名称
protected static ?string $title = '时间配置管理'; // 自定义页面标题
public function form(Form $form): Form
{
return $form
->schema([
TextInputSelectAffix::make('global_scrape_interval')
->label('默认拉取时间')
->numeric()
->required()
->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()
->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()
->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()
->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()
),
]);
}
}