50e8519220
- Add 6 renderer components: StatCard, Gauge, List, Progress, AlertBanner, Chart - Add IntegrationWidget container with auto-refresh, loading, error states - Add IntegrationAlertOverlay for layout-level critical alerts - Add IntegrationConfigFields for dynamic form generation from Zod schemas - Register integration type in WidgetRenderer - Extend WidgetCreationForm with integration app/endpoint pickers - Extend AppForm with integration config section and test connection button - Add /api/integrations/alerts endpoint
45 lines
2.3 KiB
Markdown
45 lines
2.3 KiB
Markdown
# Phase 5: Portainer Integration
|
|
|
|
**Status:** ⬜ Not Started
|
|
**Parent plan:** [PLAN.md](./PLAN.md)
|
|
**Domain:** backend
|
|
|
|
## Objective
|
|
Implement Portainer integration to display container and stack status from Docker environments managed by Portainer.
|
|
|
|
## Tasks
|
|
|
|
- [ ] Task 1: Create `src/lib/server/integrations/portainer/schema.ts` — Zod schemas for auth config (`{ apiKey: string, endpointId: number }`) and endpoint responses.
|
|
- [ ] Task 2: Create `src/lib/server/integrations/portainer/client.ts` — HTTP client for Portainer API. Auth via `X-API-Key` header. Endpoints: `/api/endpoints/{id}/docker/containers/json`, `/api/stacks`, `/api/endpoints/{id}/docker/containers/{cid}/json`.
|
|
- [ ] Task 3: Create `src/lib/server/integrations/portainer/transform.ts` — Transform: containers → summary (running/stopped/error counts as stat-card), container list with state + CPU/memory, stacks → list with up/down status.
|
|
- [ ] Task 4: Create `src/lib/server/integrations/portainer/index.ts` — Integration implementation. Endpoints: `container-summary` (stat-card), `container-list` (list), `stack-status` (list). testConnection: fetch endpoints list.
|
|
- [ ] Task 5: Register Portainer integration in registry.
|
|
|
|
## Files to Modify/Create
|
|
- `src/lib/server/integrations/portainer/schema.ts` — new
|
|
- `src/lib/server/integrations/portainer/client.ts` — new
|
|
- `src/lib/server/integrations/portainer/transform.ts` — new
|
|
- `src/lib/server/integrations/portainer/index.ts` — new
|
|
- `src/lib/server/integrations/registry.ts` — modify: register Portainer
|
|
|
|
## Acceptance Criteria
|
|
- Container summary shows running/stopped/error counts
|
|
- Container list shows name, state, image, CPU/memory usage
|
|
- Stack status shows stack names with up/down indicators
|
|
- Test connection validates API key and endpoint ID
|
|
- Handles multiple Portainer endpoints
|
|
|
|
## Notes
|
|
- Portainer API uses API key in `X-API-Key` header
|
|
- Container stats (CPU/memory) require a separate API call per container — limit to top N for performance
|
|
- Stack status comes from a separate endpoint
|
|
- endpointId is required — Portainer manages multiple Docker hosts
|
|
|
|
## Review Checklist
|
|
- [ ] All tasks completed
|
|
- [ ] Performance: limited container stats calls
|
|
- [ ] Code follows project conventions
|
|
|
|
## Handoff to Next Phase
|
|
<!-- Filled in after completion -->
|