feat(ops-server): implement TypedRouter integration and modular handler classes

This commit is contained in:
2025-06-08 07:04:35 +00:00
parent ab19130904
commit 61778bdba8
10 changed files with 1188 additions and 14 deletions

View File

@@ -70,14 +70,14 @@ ts_interfaces/
- **Health Check**
- [x] `IReq_GetHealthStatus` - Service health monitoring
### Phase 2: Backend Implementation
### Phase 2: Backend Implementation
#### 2.1 Enhance OpsServer (`ts/opsserver/classes.opsserver.ts`)
#### 2.1 Enhance OpsServer (`ts/opsserver/classes.opsserver.ts`)
- [ ] Add TypedRouter initialization
- [ ] Use TypedServer's built-in typedrouter
- [ ] CORS is already handled by TypedServer
- [ ] Add handler registration method
- [x] Add TypedRouter initialization
- [x] Use TypedServer's built-in typedrouter
- [x] CORS is already handled by TypedServer
- [x] Add handler registration method
```typescript
// Example structure following cloudly pattern
@@ -122,15 +122,15 @@ TypedServer (built-in typedrouter at /typedrequest)
This allows clean separation of concerns while keeping all handlers accessible through the single `/typedrequest` endpoint.
#### 2.2 Create Handler Classes
#### 2.2 Create Handler Classes
Create modular handlers in `ts/opsserver/handlers/`:
- [ ] `stats.handler.ts` - Server and performance statistics
- [ ] `email.handler.ts` - Email-related operations
- [ ] `dns.handler.ts` - DNS management statistics
- [ ] `security.handler.ts` - Security and reputation metrics
- [ ] `config.handler.ts` - Configuration management
- [x] `stats.handler.ts` - Server and performance statistics
- [x] `security.handler.ts` - Security and reputation metrics
- [x] `config.handler.ts` - Configuration management
- [x] `logs.handler.ts` - Log retrieval and streaming
- [x] `admin.handler.ts` - Authentication and session management
Each handler should:
- Have its own typedrouter that gets added to OpsServer's router
@@ -298,10 +298,17 @@ Create modular components in `ts_web/elements/components/`:
- Added `@api.global/typedrequest-interfaces` dependency
- All interfaces compile successfully
- **Phase 2: Backend Implementation** - TypedRouter integration and handlers
- Enhanced OpsServer with hierarchical TypedRouter structure
- Created all handler classes with proper TypedHandler registration
- Implemented mock data responses for all endpoints
- Fixed all TypeScript compilation errors
- VirtualStream used for log streaming with Uint8Array encoding
### Next Steps
- Phase 2: Backend Implementation - Enhance OpsServer and create handlers
- Phase 3: Frontend State Management - Set up Smartstate
- Phase 4: Frontend Integration - Create API clients and update dashboard
- Phase 5: Create modular UI components
---