[Refactor]: add api clients and refactor components#509
Merged
Conversation
…SwaggerPicker, WorkspaceSelector
…61023-exploring-refactoring-opportunities
Contributor
There was a problem hiding this comment.
Pull Request Overview
This refactor adds centralized API client services and standardizes error handling across the workspace editor components. The changes replace direct axios calls with dedicated service layers for improved maintainability and consistency.
Key changes:
- Introduced structured API clients (
workspaceApi,specsApi,commandApi,cliApi,errorHandlerApi) to centralize HTTP communication - Standardized error handling with a unified
errorHandlerApi.getErrorMessage()method - Converted multiple components from direct axios usage to service-based API calls
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/web/src/views/workspace/WorkspaceSelector.tsx | Replaced axios calls with workspaceApi and specsApi, standardized error handling |
| src/web/src/views/workspace/WSEditorSwaggerPicker.tsx | Migrated to workspaceApi/specsApi, converted Promise chains to async/await |
| src/web/src/views/workspace/WSEditorCommandGroupContent.tsx | Updated to use commandApi and errorHandlerApi |
| src/web/src/views/workspace/WSEditorCommandContent.tsx | Replaced axios with commandApi, standardized error handling |
| src/web/src/views/workspace/WSEditorCommandArgumentsContent.tsx | Migrated to commandApi and errorHandlerApi |
| src/web/src/views/workspace/WSEditorClientConfig.tsx | Updated to use workspaceApi, specsApi, and errorHandlerApi |
| src/web/src/views/workspace/WSEditor.tsx | Replaced axios calls with service APIs, simplified client config handling |
| src/web/src/views/cli/CLIModuleSelector.tsx | Migrated to cliApi and errorHandlerApi |
| src/web/src/views/cli/CLIModuleGenerator.tsx | Updated to use cliApi and standardized error handling |
| src/web/src/services/workspaceApi.ts | New service module for workspace-related API operations |
| src/web/src/services/specsApi.ts | New service module for specs and planes API operations |
| src/web/src/services/index.ts | Central export point for all service modules |
| src/web/src/services/errorHandlerApi.ts | New centralized error handling utility |
| src/web/src/services/commandApi.ts | New service module for command-related API operations |
| src/web/src/services/cliApi.ts | New service module for CLI-related API operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
necusjz
approved these changes
Sep 30, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current issues: