[增添]增加了时间配置管理功能及页面
This commit is contained in:
44
management-panel/app/Filament/Pages/ManageTime.php
Normal file
44
management-panel/app/Filament/Pages/ManageTime.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
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([
|
||||||
|
TextInput::make('global_time')
|
||||||
|
->label('默认拉取时间')
|
||||||
|
->required()
|
||||||
|
->suffix("s"),
|
||||||
|
TextInput::make('node_exporter_time')
|
||||||
|
->label('系统监控时间间隔')
|
||||||
|
->required()
|
||||||
|
->suffix("s"),
|
||||||
|
TextInput::make('opcua_time')
|
||||||
|
->label('配置读取时间')
|
||||||
|
->required()
|
||||||
|
->suffix("s"),
|
||||||
|
TextInput::make('prometheus_time')
|
||||||
|
->label('数据存储时间')
|
||||||
|
->required()
|
||||||
|
->suffix("h"),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
management-panel/app/Settings/TimeSettings.php
Normal file
22
management-panel/app/Settings/TimeSettings.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Settings;
|
||||||
|
|
||||||
|
use Spatie\LaravelSettings\Settings;
|
||||||
|
|
||||||
|
class TimeSettings extends Settings
|
||||||
|
{
|
||||||
|
// 默认拉取时间
|
||||||
|
public ?string $global_time;
|
||||||
|
// 系统扫描时间
|
||||||
|
public ?string $node_exporter_time;
|
||||||
|
// 系统配置时间
|
||||||
|
public ?string $opcua_time;
|
||||||
|
// 数据存储时间
|
||||||
|
public ?string $prometheus_time;
|
||||||
|
|
||||||
|
public static function group(): string
|
||||||
|
{
|
||||||
|
return 'time';
|
||||||
|
}
|
||||||
|
}
|
||||||
48
management-panel/config/filament-logger.php
Normal file
48
management-panel/config/filament-logger.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'datetime_format' => 'd/m/Y H:i:s',
|
||||||
|
'date_format' => 'd/m/Y',
|
||||||
|
|
||||||
|
'activity_resource' => \Z3d0X\FilamentLogger\Resources\ActivityResource::class,
|
||||||
|
|
||||||
|
'resources' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'log_name' => 'Resource',
|
||||||
|
'logger' => \Z3d0X\FilamentLogger\Loggers\ResourceLogger::class,
|
||||||
|
'color' => 'success',
|
||||||
|
'exclude' => [
|
||||||
|
//App\Filament\Resources\UserResource::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'access' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'logger' => \Z3d0X\FilamentLogger\Loggers\AccessLogger::class,
|
||||||
|
'color' => 'danger',
|
||||||
|
'log_name' => 'Access',
|
||||||
|
],
|
||||||
|
|
||||||
|
'notifications' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'logger' => \Z3d0X\FilamentLogger\Loggers\NotificationLogger::class,
|
||||||
|
'color' => null,
|
||||||
|
'log_name' => 'Notification',
|
||||||
|
],
|
||||||
|
|
||||||
|
'models' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'log_name' => 'Model',
|
||||||
|
'color' => 'warning',
|
||||||
|
'logger' => \Z3d0X\FilamentLogger\Loggers\ModelLogger::class,
|
||||||
|
'register' => [
|
||||||
|
//App\Models\User::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'custom' => [
|
||||||
|
// [
|
||||||
|
// 'log_name' => 'Custom',
|
||||||
|
// 'color' => 'primary',
|
||||||
|
// ]
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -7,7 +7,7 @@ return [
|
|||||||
* put them (manually) here.
|
* put them (manually) here.
|
||||||
*/
|
*/
|
||||||
'settings' => [
|
'settings' => [
|
||||||
|
\App\Settings\TimeSettings::class
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateActivityLogTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('log_name')->nullable();
|
||||||
|
$table->text('description');
|
||||||
|
$table->nullableMorphs('subject', 'subject');
|
||||||
|
$table->nullableMorphs('causer', 'causer');
|
||||||
|
$table->json('properties')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
$table->index('log_name');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddEventColumnToActivityLogTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->string('event')->nullable()->after('subject_type');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('event');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->uuid('batch_uuid')->nullable()->after('properties');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||||
|
$table->dropColumn('batch_uuid');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Spatie\LaravelSettings\Migrations\SettingsMigration;
|
||||||
|
|
||||||
|
|
||||||
|
return new class extends SettingsMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$this->migrator->add('time.global_time', '');
|
||||||
|
$this->migrator->add('time.node_exporter_time', '');
|
||||||
|
$this->migrator->add('time.opcua_time', '');
|
||||||
|
$this->migrator->add('time.prometheus_time', '');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user