fetch(modify):修复BUG
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m27s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m27s
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
# Device Operations Specification
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Reboot Device
|
||||
|
||||
The system SHALL provide the ability to reboot an IoT device via its IMEI.
|
||||
|
||||
#### Scenario: Successfully reboot device
|
||||
|
||||
- **WHEN** an authenticated user initiates a reboot operation on a device with valid IMEI
|
||||
- **THEN** the system sends the reboot command to the device
|
||||
- **AND** returns a success response with operation confirmation
|
||||
|
||||
#### Scenario: Reboot operation with confirmation
|
||||
|
||||
- **WHEN** a user clicks the reboot device button
|
||||
- **THEN** the system prompts for confirmation with a warning message
|
||||
- **AND** only proceeds if the user confirms the action
|
||||
|
||||
#### Scenario: Reboot with invalid IMEI
|
||||
|
||||
- **WHEN** a user attempts to reboot a device with invalid or non-existent IMEI
|
||||
- **THEN** the system returns a 400 error with appropriate error message
|
||||
|
||||
### Requirement: Reset Device to Factory Settings
|
||||
|
||||
The system SHALL provide the ability to reset an IoT device to factory settings via its IMEI.
|
||||
|
||||
#### Scenario: Successfully reset device
|
||||
|
||||
- **WHEN** an authenticated user initiates a factory reset operation on a device
|
||||
- **THEN** the system sends the reset command to the device
|
||||
- **AND** returns a success response
|
||||
|
||||
#### Scenario: Reset operation with strong confirmation
|
||||
|
||||
- **WHEN** a user clicks the factory reset button
|
||||
- **THEN** the system displays a warning dialog explaining data loss
|
||||
- **AND** requires user confirmation before proceeding
|
||||
- **AND** only executes if the user explicitly confirms
|
||||
|
||||
#### Scenario: Insufficient permissions for reset
|
||||
|
||||
- **WHEN** a user without proper permissions attempts to reset a device
|
||||
- **THEN** the system returns a 403 forbidden error
|
||||
|
||||
### Requirement: Set Device Speed Limit
|
||||
|
||||
The system SHALL provide the ability to configure upload and download speed limits for an IoT device.
|
||||
|
||||
#### Scenario: Successfully set speed limit
|
||||
|
||||
- **WHEN** an authenticated user submits valid speed limit parameters
|
||||
- **THEN** the system applies the upload and download speed limits to the device
|
||||
- **AND** returns a success response
|
||||
|
||||
#### Scenario: Configure speed limits via dialog
|
||||
|
||||
- **WHEN** a user selects the speed limit option
|
||||
- **THEN** the system displays a dialog with input fields for upload_speed and download_speed (KB/s)
|
||||
- **AND** validates that both values are integers >= 1
|
||||
|
||||
#### Scenario: Invalid speed limit parameters
|
||||
|
||||
- **WHEN** a user submits speed limits less than 1 KB/s
|
||||
- **THEN** the system returns a 400 parameter error
|
||||
- **AND** displays validation error messages
|
||||
|
||||
### Requirement: Switch Device SIM Card
|
||||
|
||||
The system SHALL provide the ability to switch the active SIM card on a multi-SIM device.
|
||||
|
||||
#### Scenario: Successfully switch to target card
|
||||
|
||||
- **WHEN** an authenticated user initiates a card switch with valid target ICCID
|
||||
- **THEN** the system switches the device to use the specified card
|
||||
- **AND** returns a success response
|
||||
|
||||
#### Scenario: Switch card via dialog
|
||||
|
||||
- **WHEN** a user selects the switch card option
|
||||
- **THEN** the system displays a dialog prompting for target_iccid
|
||||
- **AND** validates the ICCID format
|
||||
|
||||
#### Scenario: Switch to non-existent card
|
||||
|
||||
- **WHEN** a user attempts to switch to an ICCID that doesn't exist or isn't available
|
||||
- **THEN** the system returns a 400 error with descriptive message
|
||||
|
||||
### Requirement: Configure Device WiFi Settings
|
||||
|
||||
The system SHALL provide the ability to configure WiFi settings including SSID, password, and enabled status.
|
||||
|
||||
#### Scenario: Successfully configure WiFi
|
||||
|
||||
- **WHEN** an authenticated user submits valid WiFi configuration
|
||||
- **THEN** the system applies the WiFi settings to the device
|
||||
- **AND** returns a success response
|
||||
|
||||
#### Scenario: Configure WiFi via dialog
|
||||
|
||||
- **WHEN** a user selects the WiFi configuration option
|
||||
- **THEN** the system displays a dialog with fields for:
|
||||
- enabled (启用状态: 0=禁用, 1=启用)
|
||||
- ssid (WiFi名称, 1-32 characters)
|
||||
- password (WiFi密码, 8-63 characters)
|
||||
- **AND** validates all field constraints
|
||||
|
||||
#### Scenario: Invalid WiFi parameters
|
||||
|
||||
- **WHEN** a user submits WiFi configuration with invalid parameters
|
||||
- **THEN** the system returns a 400 error
|
||||
- **AND** displays specific validation errors (e.g., "SSID too long", "Password too short")
|
||||
|
||||
### Requirement: Device Management UI Integration
|
||||
|
||||
The system SHALL integrate device operations into the device management page at `/asset-management/devices`.
|
||||
|
||||
#### Scenario: Display primary operation button
|
||||
|
||||
- **WHEN** a user views the device management page
|
||||
- **THEN** the system displays a "重启设备" (Reboot Device) button as the primary operation
|
||||
|
||||
#### Scenario: Display dropdown menu for additional operations
|
||||
|
||||
- **WHEN** a user views the device management page
|
||||
- **THEN** the system displays a "更多操作" (More Operations) dropdown menu
|
||||
- **AND** the dropdown contains: 恢复出厂, 设置限速, 切换SIM卡, 设置WiFi
|
||||
|
||||
#### Scenario: Show loading indicator during operations
|
||||
|
||||
- **WHEN** a device operation is in progress
|
||||
- **THEN** the system displays a loading indicator
|
||||
- **AND** disables the operation buttons to prevent duplicate requests
|
||||
|
||||
### Requirement: Authentication and Authorization
|
||||
|
||||
The system SHALL enforce JWT-based authentication for all device operations.
|
||||
|
||||
#### Scenario: Access with valid JWT token
|
||||
|
||||
- **WHEN** a user makes a request with a valid Bearer token
|
||||
- **THEN** the system processes the request normally
|
||||
|
||||
#### Scenario: Access with expired token
|
||||
|
||||
- **WHEN** a user makes a request with an expired JWT token
|
||||
- **THEN** the system returns a 401 unauthorized error
|
||||
- **AND** redirects to the login page
|
||||
|
||||
### Requirement: Error Handling and User Feedback
|
||||
|
||||
The system SHALL provide clear error messages and success notifications for all operations.
|
||||
|
||||
#### Scenario: Display success message
|
||||
|
||||
- **WHEN** a device operation completes successfully
|
||||
- **THEN** the system displays a success message notification
|
||||
- **AND** automatically closes the operation dialog
|
||||
|
||||
#### Scenario: Handle network errors
|
||||
|
||||
- **WHEN** a network error occurs during a device operation
|
||||
- **THEN** the system displays a user-friendly error message
|
||||
- **AND** allows the user to retry the operation
|
||||
|
||||
#### Scenario: Handle server errors
|
||||
|
||||
- **WHEN** a 500 server error occurs
|
||||
- **THEN** the system displays an error message with timestamp
|
||||
- **AND** logs the error for debugging
|
||||
|
||||
### Requirement: Operation Confirmation Dialogs
|
||||
|
||||
The system SHALL require user confirmation for destructive operations.
|
||||
|
||||
#### Scenario: Confirm reboot operation
|
||||
|
||||
- **WHEN** a user initiates a reboot
|
||||
- **THEN** the system shows a confirmation dialog stating "确定要重启该设备吗?"
|
||||
- **AND** requires explicit confirmation
|
||||
|
||||
#### Scenario: Confirm factory reset operation
|
||||
|
||||
- **WHEN** a user initiates a factory reset
|
||||
- **THEN** the system shows a strong warning dialog stating "确定要恢复出厂设置吗?此操作将清除所有数据!"
|
||||
- **AND** requires explicit confirmation
|
||||
|
||||
#### Scenario: No confirmation for query operations
|
||||
|
||||
- **WHEN** a user initiates speed limit, card switch, or WiFi configuration
|
||||
- **THEN** the system displays input dialogs without confirmation prompts
|
||||
- **AND** only executes after user submits valid parameters
|
||||
@@ -0,0 +1,151 @@
|
||||
# IoT Card Operations Specification
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Query IoT Card Flow Usage
|
||||
|
||||
The system SHALL provide the ability to query real-time flow usage for an IoT card via its ICCID.
|
||||
|
||||
#### Scenario: Successfully query flow usage
|
||||
|
||||
- **WHEN** an authenticated user requests flow usage for a valid ICCID
|
||||
- **THEN** the system returns flow usage data including used flow amount and unit
|
||||
|
||||
#### Scenario: Query with invalid ICCID
|
||||
|
||||
- **WHEN** a user requests flow usage for an invalid or non-existent ICCID
|
||||
- **THEN** the system returns a 400 error with appropriate error message
|
||||
|
||||
### Requirement: Query IoT Card Realname Status
|
||||
|
||||
The system SHALL provide the ability to query the realname authentication status for an IoT card via its ICCID.
|
||||
|
||||
#### Scenario: Successfully query realname status
|
||||
|
||||
- **WHEN** an authenticated user requests realname status for a valid ICCID
|
||||
- **THEN** the system returns the current realname authentication status
|
||||
|
||||
#### Scenario: Query status for unauthenticated user
|
||||
|
||||
- **WHEN** an unauthenticated user attempts to query realname status
|
||||
- **THEN** the system returns a 401 unauthorized error
|
||||
|
||||
### Requirement: Query IoT Card Real-time Status
|
||||
|
||||
The system SHALL provide the ability to query the real-time operational status of an IoT card via its ICCID.
|
||||
|
||||
#### Scenario: Successfully query card status
|
||||
|
||||
- **WHEN** an authenticated user requests card status for a valid ICCID
|
||||
- **THEN** the system returns card status information including ICCID and current status (准备/正常/停机)
|
||||
|
||||
#### Scenario: Query with unauthorized access
|
||||
|
||||
- **WHEN** a user without proper permissions attempts to query card status
|
||||
- **THEN** the system returns a 403 forbidden error
|
||||
|
||||
### Requirement: Get IoT Card Realname Link
|
||||
|
||||
The system SHALL provide the ability to generate and retrieve a realname authentication link for an IoT card.
|
||||
|
||||
#### Scenario: Successfully retrieve realname link
|
||||
|
||||
- **WHEN** an authenticated user requests the realname link for a valid ICCID
|
||||
- **THEN** the system returns an HTTPS URL that can be used for realname authentication
|
||||
|
||||
#### Scenario: Display realname link as QR code
|
||||
|
||||
- **WHEN** the system returns a realname authentication link
|
||||
- **THEN** the UI displays the link as a QR code for easy mobile scanning
|
||||
|
||||
### Requirement: Start IoT Card (复机)
|
||||
|
||||
The system SHALL provide the ability to start (restore service) an IoT card via its ICCID.
|
||||
|
||||
#### Scenario: Successfully start a stopped card
|
||||
|
||||
- **WHEN** an authenticated user initiates a start operation on a stopped card
|
||||
- **THEN** the system processes the request and restores card service
|
||||
- **AND** displays a success message to the user
|
||||
|
||||
#### Scenario: Start operation with confirmation
|
||||
|
||||
- **WHEN** a user clicks the start card button
|
||||
- **THEN** the system prompts for confirmation before executing the operation
|
||||
- **AND** only proceeds if the user confirms the action
|
||||
|
||||
#### Scenario: Insufficient permissions for start operation
|
||||
|
||||
- **WHEN** a user without proper permissions attempts to start a card
|
||||
- **THEN** the system returns a 403 forbidden error
|
||||
|
||||
### Requirement: Stop IoT Card (停机)
|
||||
|
||||
The system SHALL provide the ability to stop (suspend service) an IoT card via its ICCID.
|
||||
|
||||
#### Scenario: Successfully stop an active card
|
||||
|
||||
- **WHEN** an authenticated user initiates a stop operation on an active card
|
||||
- **THEN** the system processes the request and suspends card service
|
||||
- **AND** displays a success message to the user
|
||||
|
||||
#### Scenario: Stop operation with confirmation
|
||||
|
||||
- **WHEN** a user clicks the stop card button
|
||||
- **THEN** the system prompts for confirmation before executing the operation
|
||||
- **AND** only proceeds if the user confirms the action
|
||||
|
||||
#### Scenario: Server error during stop operation
|
||||
|
||||
- **WHEN** a server error occurs during the stop operation
|
||||
- **THEN** the system returns a 500 error with error details
|
||||
- **AND** displays an appropriate error message to the user
|
||||
|
||||
### Requirement: IoT Card Management UI Integration
|
||||
|
||||
The system SHALL integrate IoT card operations into the card management page at `/asset-management/iot-card-management`.
|
||||
|
||||
#### Scenario: Display primary operation button
|
||||
|
||||
- **WHEN** a user views the IoT card management page
|
||||
- **THEN** the system displays a "查询流量使用" (Query Flow Usage) button as the primary operation
|
||||
|
||||
#### Scenario: Display dropdown menu for additional operations
|
||||
|
||||
- **WHEN** a user views the IoT card management page
|
||||
- **THEN** the system displays a "更多操作" (More Operations) dropdown menu
|
||||
- **AND** the dropdown contains: 查询实名状态, 查询卡状态, 获取实名链接, 启用卡片, 停用卡片
|
||||
|
||||
#### Scenario: Show operation results in dialog
|
||||
|
||||
- **WHEN** a user executes a query operation (flow, realname status, or card status)
|
||||
- **THEN** the system displays results in a modal dialog with properly formatted data
|
||||
|
||||
### Requirement: Authentication and Authorization
|
||||
|
||||
The system SHALL enforce JWT-based authentication for all IoT card operations.
|
||||
|
||||
#### Scenario: Access with valid JWT token
|
||||
|
||||
- **WHEN** a user makes a request with a valid Bearer token
|
||||
- **THEN** the system processes the request normally
|
||||
|
||||
#### Scenario: Access with expired token
|
||||
|
||||
- **WHEN** a user makes a request with an expired JWT token
|
||||
- **THEN** the system returns a 401 unauthorized error
|
||||
|
||||
### Requirement: Error Handling
|
||||
|
||||
The system SHALL provide clear error messages for all failure scenarios.
|
||||
|
||||
#### Scenario: Handle 400 parameter errors
|
||||
|
||||
- **WHEN** a request contains invalid parameters
|
||||
- **THEN** the system returns a 400 error with specific validation failure details
|
||||
|
||||
#### Scenario: Handle 500 server errors
|
||||
|
||||
- **WHEN** an internal server error occurs
|
||||
- **THEN** the system returns a 500 error with error timestamp
|
||||
- **AND** logs the error for debugging purposes
|
||||
Reference in New Issue
Block a user