diff --git a/src/X1.BackendServices/X1.BackendServices.csproj b/src/X1.BackendServices/X1.BackendServices.csproj index 265983f..4201546 100644 --- a/src/X1.BackendServices/X1.BackendServices.csproj +++ b/src/X1.BackendServices/X1.BackendServices.csproj @@ -14,7 +14,6 @@ - diff --git a/src/X1.WebAPI/Program.cs b/src/X1.WebAPI/Program.cs index b7c8b75..8970e26 100644 --- a/src/X1.WebAPI/Program.cs +++ b/src/X1.WebAPI/Program.cs @@ -21,9 +21,8 @@ using Microsoft.IdentityModel.Tokens; using System.Text; using CellularManagement.Domain.Options; using X1.WebAPI.Extensions; -using X1.DynamicClientCore.Extensions; using X1.BackendServices; - +using X1.DynamicClientCore.Extensions; // 创建 Web 应用程序构建器 var builder = WebApplication.CreateBuilder(args); diff --git a/src/X1.WebAPI/X1.WebAPI.csproj b/src/X1.WebAPI/X1.WebAPI.csproj index 4325682..c674a55 100644 --- a/src/X1.WebAPI/X1.WebAPI.csproj +++ b/src/X1.WebAPI/X1.WebAPI.csproj @@ -29,6 +29,7 @@ + diff --git a/src/X1.WebUI/src/constants/api.ts b/src/X1.WebUI/src/constants/api.ts index ed1fb98..13d314b 100644 --- a/src/X1.WebUI/src/constants/api.ts +++ b/src/X1.WebUI/src/constants/api.ts @@ -3,6 +3,10 @@ export const API_PATHS = { // 设备相关 DEVICES: '/devices', DEVICE_RUNTIMES: '/device-runtimes', + TERMINAL_DEVICES: '/terminal-devices', + + // AT操作相关 + AT_OPERATIONS: '/at-operations', // 协议相关 PROTOCOLS: '/protocolversions', diff --git a/src/X1.WebUI/src/constants/menuConfig.ts b/src/X1.WebUI/src/constants/menuConfig.ts index 029d2bc..f730bb0 100644 --- a/src/X1.WebUI/src/constants/menuConfig.ts +++ b/src/X1.WebUI/src/constants/menuConfig.ts @@ -1,4 +1,4 @@ -import { LucideIcon, LayoutDashboard, Users, Settings, FolderOpen, TestTube, BarChart3, Gauge, FileText, ClipboardList, Network } from 'lucide-react'; +import { LucideIcon, LayoutDashboard, Users, Settings, FolderOpen, TestTube, BarChart3, Gauge, FileText, ClipboardList, Network, Smartphone } from 'lucide-react'; // 定义权限类型 export type Permission = @@ -54,6 +54,12 @@ export type Permission = | 'corenetworkconfigs.manage' | 'networkstackconfigs.view' | 'networkstackconfigs.manage' + // 终端设备管理权限 + | 'terminaldevices.view' + | 'terminaldevices.manage' + // ADB操作管理权限 + | 'adboperations.view' + | 'adboperations.manage' // 设备运行时管理权限 | 'deviceruntimes.view' | 'deviceruntimes.manage' @@ -199,7 +205,24 @@ export const menuItems: MenuItem[] = [ href: '/dashboard/instruments/device-runtimes/list', permission: 'deviceruntimes.view', }, - + ], + }, + { + title: '终端管理', + icon: Smartphone, + href: '/dashboard/terminal-devices', + permission: 'terminaldevices.view', + children: [ + { + title: '终端设备', + href: '/dashboard/terminal-devices', + permission: 'terminaldevices.view', + }, + { + title: 'ADB命令配置', + href: '/dashboard/terminal-devices/adb-operations', + permission: 'adboperations.view', + }, ], }, { diff --git a/src/X1.WebUI/src/contexts/AuthContext.tsx b/src/X1.WebUI/src/contexts/AuthContext.tsx index 54cabc3..2d539f0 100644 --- a/src/X1.WebUI/src/contexts/AuthContext.tsx +++ b/src/X1.WebUI/src/contexts/AuthContext.tsx @@ -87,6 +87,12 @@ const getDefaultPermissions = (userPermissions: Record = {}) => // 协议日志管理权限 'protocollogs.view', 'protocollogs.manage', + // 终端设备管理权限 + 'terminaldevices.view', + 'terminaldevices.manage', + // ADB操作管理权限 + 'adboperations.view', + 'adboperations.manage', ]) ]; diff --git a/src/X1.WebUI/src/pages/adb-operations/AdbOperationForm.tsx b/src/X1.WebUI/src/pages/adb-operations/AdbOperationForm.tsx new file mode 100644 index 0000000..4306edf --- /dev/null +++ b/src/X1.WebUI/src/pages/adb-operations/AdbOperationForm.tsx @@ -0,0 +1,146 @@ +import React, { useState, useEffect } from 'react'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; +import { Switch } from '@/components/ui/switch'; +import { AdbOperation, CreateAdbOperationRequest, UpdateAdbOperationRequest } from '@/services/adbOperationsService'; + +interface AdbOperationFormProps { + onSubmit: (data: CreateAdbOperationRequest | UpdateAdbOperationRequest) => void; + isSubmitting: boolean; + initialData?: AdbOperation; +} + +export default function AdbOperationForm({ onSubmit, isSubmitting, initialData }: AdbOperationFormProps) { + const [formData, setFormData] = useState({ + command: '', + description: '', + path: '', + useAbsolutePath: false, + isEnabled: true, + waitTimeMs: 0, + }); + + useEffect(() => { + if (initialData) { + setFormData({ + command: initialData.command, + description: initialData.description, + path: initialData.path, + useAbsolutePath: initialData.useAbsolutePath, + isEnabled: initialData.isEnabled, + waitTimeMs: initialData.waitTimeMs, + }); + } + }, [initialData]); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + if (initialData) { + // 更新操作 + const updateData: UpdateAdbOperationRequest = { + id: initialData.id, + ...formData, + }; + onSubmit(updateData); + } else { + // 创建操作 + const createData: CreateAdbOperationRequest = { + ...formData, + }; + onSubmit(createData); + } + }; + + const handleInputChange = (field: string, value: string | number | boolean) => { + setFormData(prev => ({ + ...prev, + [field]: value, + })); + }; + + return ( +
+
+
+ + handleInputChange('command', e.target.value)} + placeholder="例如: adb devices, adb shell pm list packages" + required + /> +

+ 输入要执行的ADB命令,支持参数 +

+
+ +
+ +