6.5 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | must_haves | |||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16-api-migration | 04 | execute | 1 |
|
true |
|
Purpose: The batch UI sub-workflow fetches the container list 5 times (once per action path: mode selection, toggle update, exec, navigation, clear). All 5 are identical GET queries to Docker API. Replace with GraphQL queries plus normalizer for Docker API contract compatibility.
Output: n8n-batch-ui.json with all Docker API HTTP Request nodes replaced by Unraid GraphQL queries, wired through normalizer. All existing Code nodes (bitmap encoding, keyboard building, toggle handling) unchanged.
<execution_context> @/home/luc/.claude/get-shit-done/workflows/execute-plan.md @/home/luc/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/16-api-migration/16-RESEARCH.md @.planning/phases/15-infrastructure-foundation/15-02-SUMMARY.md @n8n-batch-ui.json @n8n-workflow.json (for Phase 15 utility node code — GraphQL Response Normalizer) @ARCHITECTURE.md Task 1: Replace all 5 Docker API container queries with Unraid GraphQL queries in n8n-batch-ui.json n8n-batch-ui.json Replace all 5 Docker API HTTP Request nodes with Unraid GraphQL query equivalents. All 5 nodes are identical GET requests to `docker-socket-proxy:2375/containers/json?all=true`. Each one:Nodes to migrate:
- "Fetch Containers For Mode" — used when entering batch selection
- "Fetch Containers For Update" — used after toggling a container
- "Fetch Containers For Exec" — used when executing batch action
- "Fetch Containers For Nav" — used when navigating pages
- "Fetch Containers For Clear" — used after clearing selection
For EACH of the 5 nodes, apply the same transformation:
a. Change HTTP Request configuration:
- Method: POST
- URL:
={{ $env.UNRAID_HOST }}/graphql - Body:
{"query": "query { docker { containers { id names state image } } }"} - Headers:
Content-Type: application/json,x-api-key: ={{ $env.UNRAID_API_KEY }} - Timeout: 15000ms
- Error handling:
continueRegularOutput
b. Add a GraphQL Response Normalizer Code node between each HTTP Request and its downstream Code node consumer. Copy normalizer logic from n8n-workflow.json's "GraphQL Response Normalizer" utility node.
The normalizer transforms:
{data: {docker: {containers: [...]}}}→ flat array[{Id, Names, State, Image}]- State mapping: RUNNING→running, STOPPED→exited, PAUSED→paused
Wiring for each of the 5 paths:
[upstream] → HTTP Request (GraphQL) → Normalizer (Code) → [existing downstream Code node]
Specifically:
- Route Batch UI Action → Fetch Containers For Mode → Normalizer → Build Batch Keyboard
- Needs Keyboard Update? (true) → Fetch Containers For Update → Normalizer → Rebuild Keyboard After Toggle
- [exec path] → Fetch Containers For Exec → Normalizer → Handle Exec
- Handle Nav → Fetch Containers For Nav → Normalizer → Rebuild Keyboard For Nav
- Handle Clear → Fetch Containers For Clear → Normalizer → Rebuild Keyboard After Clear
All downstream Code nodes remain UNCHANGED. They use bitmap encoding with container arrays and reference Names[0], State, Image — the normalizer ensures these fields exist in the correct format.
Implementation optimization: Since all 5 normalizers do the exact same thing, consider creating them as 5 identical Code nodes (n8n sub-workflows cannot share nodes across paths — each path needs its own node instance). Keep the Code identical across all 5 to simplify future maintenance.
Rename HTTP Request nodes to remove Docker-specific naming:
- "Fetch Containers For Mode" → keep name (not Docker-specific)
- "Fetch Containers For Update" → keep name
- "Fetch Containers For Exec" → keep name
- "Fetch Containers For Nav" → keep name
- "Fetch Containers For Clear" → keep name Load n8n-batch-ui.json with python3 and verify:
- Zero HTTP Request nodes contain "docker-socket-proxy" in URL
- All 5 HTTP Request nodes use POST to
$env.UNRAID_HOST/graphql - 5 GraphQL Response Normalizer Code nodes exist (one per query path)
- All downstream Code nodes (Build Batch Keyboard, Handle Toggle, Handle Exec, etc.) are UNCHANGED
- Node count increased from 17 to 22 (5 normalizer nodes added)
- All connections valid
- Push to n8n via API and verify HTTP 200 All 5 container queries in n8n-batch-ui.json use Unraid GraphQL API. Normalizer transforms responses to Docker API contract. All bitmap encoding and keyboard building Code nodes unchanged. Workflow pushed to n8n successfully.
<success_criteria>
- n8n-batch-ui.json has zero Docker socket proxy references
- All container data flows through GraphQL Response Normalizer
- Batch selection keyboard, toggle, exec, nav, clear all work with normalized data
- Downstream Code nodes unchanged (zero-change migration for consumers)
- Workflow valid and pushed to n8n </success_criteria>