[修改]修改文本 调整了布局

This commit is contained in:
makotocc0107
2024-08-27 17:02:16 +08:00
parent 016e6b215d
commit 90b0ebaf93
10 changed files with 98 additions and 44 deletions

View File

@@ -22,6 +22,11 @@ class ManageDataSource extends SettingsPage
protected static string $settings = DataSourceSettings::class;
protected static ?string $navigationLabel = '数据源配置管理'; // 设置侧边栏的中文名称
protected static ?string $title = '数据源配置管理'; // 自定义页面标题
public function form(Form $form): Form
{
return $form
@@ -60,19 +65,10 @@ class ManageDataSource extends SettingsPage
'Monitor' => '监控模式',
])
->required(),
TextInput::make('cache_update')
->label("缓存更新时间")
->suffix("ms")
->required(),
TextInput::make('cache_timeout')
->label("缓存超时时间")
->suffix("ms")
->required()
])
->visible(fn($get) => in_array($get('data_source_type'), ['opcua'])),
Fieldset::make()
->schema([
Select::make('security_mode')
@@ -128,21 +124,36 @@ class ManageDataSource extends SettingsPage
->visible(fn($get) => $get('security_mode') === 'OpensslMbedtls'),
// Anonymous mode: Shows 'measurement_point_address' and 'interface_address'
TextInput::make('measurement_point_address')
->label('测点地址')
->required()
->visible(fn($get) => in_array($get('security_mode'), ['Anonymous', 'Certificate', 'UsernamePassword', 'CertificateAndUsernamePassword', 'OpensslMbedtls'])),
TextInput::make('interface_address')
->label('接口地址')
->required()
->visible(fn($get) => in_array($get('security_mode'), ['Anonymous', 'Certificate', 'UsernamePassword', 'CertificateAndUsernamePassword', 'OpensslMbedtls'])),
Toggle::make('state')
->label('启用')
->onColor('success'),
// TextInput::make('measurement_point_address')
// ->label('测点地址')
// ->required()
// ->visible(fn($get) => in_array($get('security_mode'), ['Anonymous', 'Certificate', 'UsernamePassword', 'CertificateAndUsernamePassword', 'OpensslMbedtls'])),
//
// TextInput::make('interface_address')
// ->label('接口地址')
// ->required()
// ->visible(fn($get) => in_array($get('security_mode'), ['Anonymous', 'Certificate', 'UsernamePassword', 'CertificateAndUsernamePassword', 'OpensslMbedtls'])),
//
// Toggle::make('state')
// ->label('启用')
// ->onColor('success'),
])
->visible(fn($get) => in_array($get('data_source_type'), ['opcua'])),
Fieldset::make()
->schema([
TextInput::make('cache_update')
->label("缓存更新时间")
->suffix("ms")
->required(),
TextInput::make('cache_timeout')
->label("缓存超时时间")
->suffix("ms")
->required()
])
->visible(fn($get) => in_array($get('data_source_type'), ['opcua'])),
]);
}
}

View File

@@ -21,6 +21,11 @@ class ManageExporter extends SettingsPage
protected static string $settings = ExporterSettings::class;
protected static ?string $navigationLabel = 'Exporter配置管理'; // 设置侧边栏的中文名称
protected static ?string $title = 'Exporter配置管理'; // 自定义页面标题
public function form(Form $form): Form
{
return $form
@@ -28,10 +33,10 @@ class ManageExporter extends SettingsPage
Fieldset::make()
->schema([
TextInput::make('exposer_bind')
->label('bind')
->label('端口')
->required(),
TextInput::make('exposer_thread')
->label('thread')
->label('线程')
->required(),
]),

View File

@@ -13,6 +13,12 @@ class UpdateToEtcd extends Page
protected static string $view = 'filament.pages.update-to-etcd';
protected static ?string $navigationLabel = '导出至ETCD'; // 设置侧边栏的中文名称
protected static ?string $title = '导出至ETCD'; // 自定义页面标题
protected static ?int $navigationSort = 99999;
public function updateSettingsToEtcd()
{

View File

@@ -23,17 +23,31 @@ class MetricResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationLabel = '测点配置管理'; // 设置侧边栏的中文名称
protected static ?string $label = '测点';
protected static ?string $pluralLabel = '测点';
public static function getBreadcrumb(): string
{
return '测点配置管理'; // 修改最外层面包屑标题为 "测点配置管理"
}
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->label('名称')
->required()
->maxLength(255),
TextInput::make('help')
->label('帮助')
->maxLength(255),
Section::make('Node ID')
Section::make('节点 ID')
->description('节点设置必须唯一')
->columns([
'default' => 3
@@ -47,17 +61,17 @@ class MetricResource extends Resource
3 => 'GUID',
])
->default(1)
->label('Identifier Type')
->label('标识符类型')
->required()
->reactive(), // 确保当选择的值变化时触发其他字段的重新渲染
TextInput::make('namespace_index')
->label('Namespace')
->label('命名空间')
->required(),
// 数值型标识符字段
TextInput::make('numeric_id')
->label('Numeric ID')
->label('数值 ID')
->required()
->visible(fn($get) => $get('identifier_type') == Metric::TYPE_NUMERIC),
@@ -80,9 +94,10 @@ class MetricResource extends Resource
{
return $table
->columns([
TextColumn::make('name'),
TextColumn::make('name')
->label('名称'),
TextColumn::make('nodeid')
->label('Node ID')
->label('节点 ID')
->state(function ($record) {
switch ($record->identifier_type) {
case 1: // Numeric
@@ -96,6 +111,7 @@ class MetricResource extends Resource
}
}),
TextColumn::make('help')
->label('帮助')
])
->filters([
//

View File

@@ -8,5 +8,7 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMetric extends CreateRecord
{
protected static ?string $title = '测点配置管理'; // 自定义页面标题
protected static string $resource = MetricResource::class;
}

View File

@@ -10,6 +10,8 @@ class EditMetric extends EditRecord
{
protected static string $resource = MetricResource::class;
protected static ?string $title = '测点配置管理'; // 自定义页面标题
protected function getHeaderActions(): array
{
return [

View File

@@ -10,6 +10,8 @@ class ListMetrics extends ListRecords
{
protected static string $resource = MetricResource::class;
protected static ?string $title = '测点配置管理'; // 自定义页面标题
protected function getHeaderActions(): array
{
return [

View File

@@ -26,18 +26,12 @@ class DataSourceSettings extends Settings
public ?string $certificate_authentication_file;
//信任列表
public ?string $trusted_list;
//测点地址
public string $measurement_point_address;
//接口地址
public string $interface_address;
public ?string $username;
public ?string $password;
//证书身份验证文件
public string $certificate_identity_file;
//密钥身份验证文件
public string $key_identity_file;
//启用
public bool $state;
//读取模式
public ?string $read_mode;
//缓存更新

View File

@@ -15,13 +15,13 @@ return new class extends SettingsMigration
$this->migrator->add('datasource.key_authentication_file', '');
$this->migrator->add('datasource.certificate_authentication_file', '');
$this->migrator->add('datasource.trusted_list', '');
$this->migrator->add('datasource.measurement_point_address', '');
$this->migrator->add('datasource.interface_address', '');
// $this->migrator->add('datasource.measurement_point_address', '');
// $this->migrator->add('datasource.interface_address', '');
$this->migrator->add('datasource.username', '');
$this->migrator->add('datasource.password', '');
$this->migrator->add('datasource.certificate_identity_file', '');
$this->migrator->add('datasource.key_identity_file', '');
$this->migrator->add('datasource.state', false);
// $this->migrator->add('datasource.state', false);
$this->migrator->add('datasource.read_mode', "sync");
$this->migrator->add('datasource.cache_update', 500);