diff --git a/.idea/php.xml b/.idea/php.xml
index e25e5f1..11a284f 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -17,103 +17,204 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
@@ -124,58 +225,65 @@
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ce70d64..c8b654c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,119 +4,229 @@
-
+
+
+
+
+
+
+
+
- $PROJECT_DIR$/management-panel/composer.json
+ $PROJECT_DIR$/composer.json
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
@@ -127,52 +237,54 @@
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
{
@@ -183,24 +295,33 @@
- {
- "keyToString": {
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "git-widget-placeholder": "master",
- "last_opened_file_path": "E:/data-collection-terminal",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
+
+
+
+
+
+
+
+
+
+
+
+ 1724723944634
+
+
+
+ 1724723944634
+
+
diff --git a/management-panel/app/Filament/Pages/ManageDataSource.php b/management-panel/app/Filament/Pages/ManageDataSource.php
new file mode 100644
index 0000000..af544d9
--- /dev/null
+++ b/management-panel/app/Filament/Pages/ManageDataSource.php
@@ -0,0 +1,129 @@
+schema([
+ Select::make('data_source_type')
+ ->options([
+ 'opcua' => 'Opcua',
+ ])
+ ->default('opcua')
+ ->label('数据源类型')
+ ->columns(1)
+ ->required()
+ ->reactive(),
+
+ Fieldset::make()
+ ->schema([
+ TextInput::make('name')
+ ->label('名称')
+ ->required(),
+
+ Textarea::make('description')
+ ->label('描述')
+ ->autosize()
+ ->nullable(),
+
+ TextInput::make('opcua_service_address')
+ ->label('opcua服务地址')
+ ->prefix('opc.tcp://')
+ ->required(),
+ ])
+ ->visible(fn($get) => in_array($get('data_source_type'), ['opcua'])),
+
+ Fieldset::make()
+ ->schema([
+ Select::make('security_mode')
+ ->label('安全模式')
+ ->required()
+ ->options([
+ 'Anonymous' => '匿名模式',
+ 'UsernamePassword' => '用户名密码模式',
+ 'Certificate' => '证书/密钥模式',
+ 'CertificateAndUsernamePassword' => '证书/密码 + 用户名密码模式',
+ 'OpensslMbedtls' => 'Openssl/mbedtls模式',
+ ])
+ ->reactive(), // Triggers reactivity for the dependsOn method
+
+ TextInput::make('security_policy_address')
+ ->label('安全策略地址')
+ ->nullable(),
+
+
+ // Certificate + UsernamePassword mode: Shows 'username', 'password', 'key_authentication_file', 'certificate_authentication_file', 'trusted_list'
+ TextInput::make('username')
+ ->label('用户名')
+ ->nullable()
+ ->visible(fn($get) => in_array($get('security_mode'), ['UsernamePassword', 'CertificateAndUsernamePassword'])),
+
+ TextInput::make('password')
+ ->label('密码')
+ ->password()
+ ->revealable()
+ ->nullable()
+ ->visible(fn($get) => in_array($get('security_mode'), ['UsernamePassword', 'CertificateAndUsernamePassword'])),
+
+ TextInput::make('key_authentication_file')
+ ->label('密钥文件')
+ ->visible(fn($get) => in_array($get('security_mode'), ['Certificate', 'CertificateAndUsernamePassword'])),
+
+ TextInput::make('certificate_authentication_file')
+ ->label('证书文件')
+ ->visible(fn($get) => in_array($get('security_mode'), ['Certificate', 'CertificateAndUsernamePassword'])),
+
+ TextInput::make('trusted_list')
+ ->label('信任列表')
+ ->nullable()
+ ->visible(fn($get) => in_array($get('security_mode'), ['Certificate', 'CertificateAndUsernamePassword'])),
+
+ // Openssl/Mbedtls mode: Shows 'certificate_identity_file', 'key_identity_file'
+ TextInput::make('certificate_identity_file')
+ ->label('证书身份验证文件')
+ ->visible(fn($get) => $get('security_mode') === 'OpensslMbedtls'),
+
+ TextInput::make('key_identity_file')
+ ->label('密钥身份验证文件')
+ ->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'),
+ ])
+ ->visible(fn($get) => in_array($get('data_source_type'), ['opcua'])),
+ ]);
+ }
+}
diff --git a/management-panel/config/settings.php b/management-panel/config/settings.php
new file mode 100644
index 0000000..5ccf245
--- /dev/null
+++ b/management-panel/config/settings.php
@@ -0,0 +1,94 @@
+ [
+
+ ],
+
+ /*
+ * The path where the settings classes will be created.
+ */
+ 'setting_class_path' => app_path('Settings'),
+
+ /*
+ * In these directories settings migrations will be stored and ran when migrating. A settings
+ * migration created via the make:settings-migration command will be stored in the first path or
+ * a custom defined path when running the command.
+ */
+ 'migrations_paths' => [
+ database_path('settings'),
+ ],
+
+ /*
+ * When no repository was set for a settings class the following repository
+ * will be used for loading and saving settings.
+ */
+ 'default_repository' => 'database',
+
+ /*
+ * Settings will be stored and loaded from these repositories.
+ */
+ 'repositories' => [
+ 'database' => [
+ 'type' => Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class,
+ 'model' => null,
+ 'table' => null,
+ 'connection' => null,
+ ],
+ 'redis' => [
+ 'type' => Spatie\LaravelSettings\SettingsRepositories\RedisSettingsRepository::class,
+ 'connection' => null,
+ 'prefix' => null,
+ ],
+ ],
+
+ /*
+ * The encoder and decoder will determine how settings are stored and
+ * retrieved in the database. By default, `json_encode` and `json_decode`
+ * are used.
+ */
+ 'encoder' => null,
+ 'decoder' => null,
+
+ /*
+ * The contents of settings classes can be cached through your application,
+ * settings will be stored within a provided Laravel store and can have an
+ * additional prefix.
+ */
+ 'cache' => [
+ 'enabled' => env('SETTINGS_CACHE_ENABLED', false),
+ 'store' => null,
+ 'prefix' => null,
+ 'ttl' => null,
+ ],
+
+ /*
+ * These global casts will be automatically used whenever a property within
+ * your settings class isn't a default PHP type.
+ */
+ 'global_casts' => [
+ DateTimeInterface::class => Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast::class,
+ DateTimeZone::class => Spatie\LaravelSettings\SettingsCasts\DateTimeZoneCast::class,
+// Spatie\DataTransferObject\DataTransferObject::class => Spatie\LaravelSettings\SettingsCasts\DtoCast::class,
+ Spatie\LaravelData\Data::class => Spatie\LaravelSettings\SettingsCasts\DataCast::class,
+ ],
+
+ /*
+ * The package will look for settings in these paths and automatically
+ * register them.
+ */
+ 'auto_discover_settings' => [
+ app_path('Settings'),
+ ],
+
+ /*
+ * Automatically discovered settings classes can be cached, so they don't
+ * need to be searched each time the application boots up.
+ */
+ 'discovered_settings_cache_path' => base_path('bootstrap/cache'),
+];
diff --git a/management-panel/database/migrations/2022_12_14_083707_create_settings_table.php b/management-panel/database/migrations/2022_12_14_083707_create_settings_table.php
new file mode 100644
index 0000000..9b14b86
--- /dev/null
+++ b/management-panel/database/migrations/2022_12_14_083707_create_settings_table.php
@@ -0,0 +1,24 @@
+id();
+
+ $table->string('group');
+ $table->string('name');
+ $table->boolean('locked')->default(false);
+ $table->json('payload');
+
+ $table->timestamps();
+
+ $table->unique(['group', 'name']);
+ });
+ }
+};