-
Notifications
You must be signed in to change notification settings - Fork 0
Updates API client to align with changes in the ros2_medkit gateway #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add new types: Execution, App, Function, Fault, ServerCapabilities - Update Operations API to use /executions model - Add Apps, Functions, Faults API methods - Add SSE client for real-time fault streaming - Add legacy aliases for backward compatibility
…ecution model - Remove all legacy operations API (invokeOperation, getActionStatus, etc.) - Remove legacy store methods (activeGoals, refreshActionStatus, cancelActionGoal) - Remove legacy types (ActionGoalStatus, ActionGoalStatusValue, ActionGoalResult, etc.) - Update ActionOperationResponse to use execution_id/execution_status - Update ActionStatusPanel to use Execution model (executionId, ExecutionStatus) - Update OperationsPanel to use createExecution instead of invokeOperation - Update OperationResponse to display execution_id/execution_status BREAKING CHANGE: All goal-based API removed, now uses SOVD-compliant executions model
- Add Apps as children of Components (Component → apps/ folder) - Add Faults virtual folder to both Components and Apps - Update VirtualFolderData to support faults/apps folder types and entityType - Update toTreeNode to create 5 virtual folders for Components: - data, operations, configurations, faults, apps - Update toTreeNode to create 4 virtual folders for Apps: - data, operations, configurations, faults - Update loadChildren to handle: - apps folder: filter apps by component_id - faults folder: load entity faults from API - Use entityType for correct API endpoints - Update selectEntity to handle App and Fault entity selection - Add tree icons for app (Cpu) and fault (AlertTriangle) types - Add icons for faults folder and apps folder SOVD Entity Model: Area → Components Component → [data, operations, configurations, faults, apps] App → [data, operations, configurations, faults]
- Update OperationResponse.tsx to use CreateExecutionResponse type - Use correct ExecutionStatus values (lowercase: 'succeeded', 'running', etc.) - Fix sovd-api.ts to handle wrapped API response formats (areas, components) - Remove unused legacy OperationResponse types from types.ts
- Add unwrapItems() helper to extract arrays from wrapped API responses
- Fix getEntities to unwrap areas, components, and data endpoints
- Fix listOperations, listApps, listFunctions to use unwrapItems
- Fix getAppData, getFunctionData, getFunctionOperations
- Fix listConfigurations to extract parameters from x-medkit.parameters
- Fix listApps to transform API response, extracting component_id from x-medkit
All API responses now use SOVD format: {items: [...], x-medkit: {...}}
- Data items now return {id, name, category, x-medkit} instead of {topic, ...}
- Transform data items to ComponentTopic format using 'name' field
- Fix setParameter to handle new response format {data, id, x-medkit.parameter}
- getAppData now properly transforms items to ComponentTopic
- Add FaultsPanel component for displaying and clearing faults - Transform fault API response (fault_code, severity number) to UI format - Add uniqueKey to ComponentTopic for deduplicating topics by direction - Parse data item x-medkit response format in getEntityDetails - Add entityType prop to ConfigurationPanel and OperationsPanel - Handle faults folderType in VirtualFolderContent
|
I plan to do further improvements in #14 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request updates the sovd_web_ui API client to align with changes in the ros2_medkit gateway, implementing SOVD-compliant API contracts. The changes migrate from the old operations API to a new executions model, and add support for new entity types (Apps, Functions, and Faults).
Changes:
- Migrated operations API from direct invocation to SOVD-compliant executions model (POST /{entity}/operations/{op}/executions)
- Added support for Apps (ROS 2 nodes), Functions (capability groupings), and Faults (diagnostic trouble codes) as new entity types
- Updated type definitions to include Execution, App, Function, Fault, and related interfaces
- Added virtual folders for faults and apps in the entity tree
- Created FaultsPanel component for displaying and clearing faults
- Updated UI components to handle execution status instead of goal status
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/types.ts | Added Execution, App, Function, Fault types and related interfaces; updated VirtualFolderData to support new entity types |
| src/lib/sovd-api.ts | Migrated to executions API; added Apps, Functions, and Faults API methods; added server capabilities and SSE fault stream support |
| src/lib/store.ts | Replaced activeGoals with activeExecutions; added faults state management; updated entity tree to include faults and apps virtual folders |
| src/components/OperationsPanel.tsx | Updated to use createExecution instead of invokeOperation; changed execution tracking from goal IDs to execution IDs |
| src/components/OperationResponse.tsx | Simplified to display execution status and ID (removed detailed result/error display) |
| src/components/ActionStatusPanel.tsx | Updated to track executions instead of goals; renamed from goal_id to executionId throughout |
| src/components/FaultsPanel.tsx | New component for displaying and managing faults for components and apps |
| src/components/EntityTreeNode.tsx | Added icons for fault, app, and apps folder node types |
| src/components/EntityDetailPanel.tsx | Added FaultsPanel integration for fault virtual folders |
| src/components/ConfigurationPanel.tsx | Added entityType prop (currently unused) |
Comments suppressed due to low confidence (1)
src/components/OperationResponse.tsx:59
- The OperationResponseDisplay component no longer displays the result or error fields from the CreateExecutionResponse. For service calls, result may contain important response data, and for failed executions, the error field should be displayed. The original implementation showed these fields, but they were removed in the refactoring. These fields should be conditionally displayed when present.
export function OperationResponseDisplay({ response }: OperationResponseProps) {
const isSuccess = response.status === 'succeeded';
const statusConfig = getStatusConfig(response.status);
const StatusIcon = statusConfig.icon;
return (
<div
className={`rounded-lg border ${isSuccess ? 'border-green-500/30 bg-green-500/5' : 'border-muted bg-muted/5'}`}
>
{/* Header */}
<div className="flex items-center gap-3 px-3 py-2 border-b border-inherit">
<StatusIcon
className={`w-4 h-4 ${statusConfig.color} ${response.status === 'running' ? 'animate-spin' : ''}`}
/>
<div className="flex items-center gap-2 flex-1">
<Badge variant={statusConfig.variant}>{response.status}</Badge>
</div>
</div>
{/* Body */}
<div className="p-3 space-y-2 text-sm">
{/* Execution ID */}
<div className="flex items-center gap-2">
<Hash className="w-3.5 h-3.5 text-muted-foreground" />
<span className="text-muted-foreground text-xs">Execution ID:</span>
<code className="bg-muted px-1.5 py-0.5 rounded text-xs font-mono">{response.id}</code>
</div>
</div>
</div>
);
}
- Fix severity mapping order in transformFault() - check critical (>=3) before error (===2) to correctly categorize fault severities - Extract DataItemResponse interface to types.ts (was duplicated 4x) - Rename Function to SovdFunction to avoid shadowing JS global Function - Remove all console.debug/error [DEBUG] logs from FaultsPanel and store - Wire entityType parameter through OperationsPanel callbacks - Wire entityType parameter through ConfigurationPanel callbacks - Fix subscribeFaultStream to transform raw API faults via transformFault()
…icient server-side filtering
Pull Request
Summary
This pull request updates the sovd_web_ui API client to align with changes in the ros2_medkit gateway, implementing SOVD-compliant API contracts. The changes migrate from the old operations API to a new executions model, and add support for new entity types (Apps, Functions, and Faults).
Changes:
Issue
Link the related issue (required):
Type
Testing
How was this tested / how should reviewers verify it?
Checklist
npm run lint)npm run build)