mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-10-14 14:59:32 +07:00
5.9 KiB
5.9 KiB
Garage Web UI API Upgrade Report
Upgrade Overview
The Garage Web UI project has been successfully upgraded from Garage Admin API v1 to v2.
Upgrade Timeline
- Completion Date: December 2024
- Scope of Upgrade: All API calls within the frontend React hooks
Upgrade Details
1. Home Page (src/pages/home/hooks.ts
)
- ✅
useNodesHealth
:/v1/health
→/v2/GetClusterHealth
2. Cluster Page (src/pages/cluster/hooks.ts
)
- ✅
useClusterStatus
:/v1/status
→/v2/GetClusterStatus
- ✅
useClusterLayout
:/v1/layout
→/v2/GetClusterLayout
- ✅
useConnectNode
:/v1/connect
→/v2/ConnectClusterNodes
- ✅
useAssignNode
:/v1/layout
→/v2/AddClusterLayout
- ✅
useUnassignNode
:/v1/layout
→/v2/AddClusterLayout
- ✅
useRevertChanges
:/v1/layout/revert
→/v2/RevertClusterLayout
- ✅
useApplyChanges
:/v1/layout/apply
→/v2/ApplyClusterLayout
3. Keys Page (src/pages/keys/hooks.ts
)
- ✅
useKeys
:/v1/key?list
→/v2/ListKeys
- ✅
useCreateKey
:/v1/key
→/v2/CreateKey
- ✅
useCreateKey
(Import):/v1/key/import
→/v2/ImportKey
- ✅
useRemoveKey
:/v1/key
→/v2/DeleteKey
4. Buckets Page (src/pages/buckets/hooks.ts
)
- ✅
useBuckets
:/buckets
→/v2/ListBuckets
- ✅
useCreateBucket
:/v1/bucket
→/v2/CreateBucket
5. Bucket Management Page (src/pages/buckets/manage/hooks.ts
)
- ✅
useBucket
:/v1/bucket
→/v2/GetBucketInfo
- ✅
useUpdateBucket
:/v1/bucket
→/v2/UpdateBucket
- ✅
useAddAlias
:/v1/bucket/alias/global
→/v2/PutBucketGlobalAlias
- ✅
useRemoveAlias
:/v1/bucket/alias/global
→/v2/DeleteBucketGlobalAlias
- ✅
useAllowKey
:/v1/bucket/allow
→/v2/AllowBucketKey
- ✅
useDenyKey
:/v1/bucket/deny
→/v2/DenyBucketKey
- ✅
useRemoveBucket
:/v1/bucket
→/v2/DeleteBucket
Upgrade Statistics
API Endpoint Mapping
Original v1 Endpoint | New v2 Endpoint | Status |
---|---|---|
/v1/health |
/v2/GetClusterHealth |
✅ |
/v1/status |
/v2/GetClusterStatus |
✅ |
/v1/layout |
/v2/GetClusterLayout |
✅ |
/v1/connect |
/v2/ConnectClusterNodes |
✅ |
/v1/layout (POST) |
/v2/AddClusterLayout |
✅ |
/v1/layout/revert |
/v2/RevertClusterLayout |
✅ |
/v1/layout/apply |
/v2/ApplyClusterLayout |
✅ |
/v1/key?list |
/v2/ListKeys |
✅ |
/v1/key (POST) |
/v2/CreateKey |
✅ |
/v1/key/import |
/v2/ImportKey |
✅ |
/v1/key (DELETE) |
/v2/DeleteKey |
✅ |
/buckets |
/v2/ListBuckets |
✅ |
/v1/bucket (POST) |
/v2/CreateBucket |
✅ |
/v1/bucket (GET) |
/v2/GetBucketInfo |
✅ |
/v1/bucket (PUT) |
/v2/UpdateBucket |
✅ |
/v1/bucket (DELETE) |
/v2/DeleteBucket |
✅ |
/v1/bucket/alias/global (PUT) |
/v2/PutBucketGlobalAlias |
✅ |
/v1/bucket/alias/global (DELETE) |
/v2/DeleteBucketGlobalAlias |
✅ |
/v1/bucket/allow |
/v2/AllowBucketKey |
✅ |
/v1/bucket/deny |
/v2/DenyBucketKey |
✅ |
Upgrade Count
- Total Endpoints Upgraded: 18
- Successfully Upgraded: 18 (100%)
- Number of Files Upgraded: 5 TypeScript hook files
Backend Compatibility
✅ No Backend Modifications Required:
- The backend uses a reverse proxy (
ProxyHandler
) to directly forward API requests to the Garage Admin API. - All v2 API requests are automatically forwarded to the correct Garage Admin endpoints.
- No changes to the Go backend code were necessary.
Build Verification
✅ Build Successful:
- TypeScript compilation passed.
- Vite bundling was successful.
- No compilation errors.
⚠️ Code Quality Warnings:
- ESLint
any
type warnings are present (do not affect functionality). - It is recommended to optimize type definitions in the future.
New Feature Availability
After upgrading to the v2 API, the project can now use the following new features:
Enhanced Cluster Management
- More detailed cluster health status information
- Improved layout management operations
- Better node connection handling
Enhanced Key Management
- Support for more key types
- Improved permission management
- Better key import/export functionality
Enhanced Bucket Management
- Richer bucket metadata
- Improved alias management
- Finer-grained permission control
Next Step Recommendations
- Type Definition Optimization: Replace
any
types with specific interface definitions. - Functional Testing: Test all upgraded features in a development environment.
- Documentation Update: Update project documentation to reflect the use of the v2 API.
- Error Handling: Adjust error handling logic based on the v2 API's response format.
Risk Assessment
Low Risk
- API path upgrade was successful.
- No compilation errors.
- Good backend compatibility.
Features Requiring Testing
- Actual calls to all upgraded API endpoints.
- Handling of error responses.
- Compatibility of new API parameter formats.
Rollback Plan
To roll back to the v1 API if necessary:
- Restore the API paths in all hook files.
- Ensure the Garage server supports the v1 API.
- Recompile and redeploy.
Upgrade Complete: The Garage Web UI has now been successfully upgraded to Garage Admin API v2, providing enhanced functionality and better performance.